This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Integrating TimeApp and Keyfobdemo projects in CC2541

Other Parts Discussed in Thread: CC2541, CC2540

Hi,

I want to integrate the TimeApp and Keyfobdemo projects into a CC2541 device .I know that TimeApp profile acts GATT client and Keyfobdemo Project acts as GATT Server .So In My Project I want to switch between GATT Client  and GATT Server when the need arises.Can anybody tell how to integrate both so that both works in sync?

  • Hello Don,

    You would not have to change the KeyFob project in order to implement the TimeApp.  You can add the TimeApp profile and services to the KeyFob.  Since I haven't looked at the TimeApp in a long time, I believe if you changed it to notify, then you could updated the host with the time.  I will have to look into the details of the TimeApp.

    Exactly what are you trying to achieve?  Synchronization of the KeyFob (Peripheral) with a Central device or mobile device or just want need a timestamp?

    Thanks,

  • Hi greenja,

    I am using the TimeApp profile for ANCS notfication from the iphone.So i want to integrate this alert notification into the Keyfob Project.The timeApp project is GATT client as it is taking data from the phone.While the Keyfobdemo Project is Server, where it is sending data to the App in the Phone.I want both to work synchronously, so that when a notification comes it should act as client and other times it should behave as Server

    Can you Tell me how to make CC2541 both client and Server at the same time?

    Thanks

    Don

  • Hello Don,

    Sending the time to the KeyFob is really no different than sending the Hi Low Alarm from the app. The Hi Low and OFF buttons each send 1 data value.  This value is either 0, 1 or 2 and gets checked in the case statements in the keyfob_PerformAlert function.  Let's say you added more buttons.  Each button could send another value.  So with 3 buttons you could have hrs/Min/Sec.  Three more buttons and you have Day/month/year.

    Now in this setup you would be limited to sending 0,1,2,3,4,5 as values. This is just to show you that you can receive data (the button value) from the iOS while being a peripheral.

    In the proxreporter.c file in the profiles folder, you can see that the PROXIMITY_ALERT_LEVEL_UUID is looking for a data size of 1.  You can increase the data size to 6 and send Hrs/Min/Sec/day/month/year all at once when you press on of the buttons.  In your app you would replace this physical button press with a software button press.

    How do you change the size of data you ask?  You change that in your app and then remove the length restriction as found in the proximity file.  For each byte that is received, it will have its own pValue as in pValue[0], pValue[1], etc.

    Study the proximity profile.  This is the best example of how to get data from your App.  Once you understand how it works, then you can send streams of data back and forth.  For the sending the time, I send 4 bytes twice.  The first byte of the set tells the peripheral if it is receiving the Date or Time followed by the 3 bytes for time or date.  

    By doing it this way, you can expand so that the first byte can be for Time, date, Lights On, etc, ...you have 256 things you can now send with the same function (button press).

    This is much more efficient than trying to switch roles.  Everything you need for just about every interaction between you iOS device and the KeyFob (CC254x) has already been done for you.  You just have to go through the code.

    Thanks,

  • Hi greenja,

    Thanks for the reply.Actually i want to get the Alert notification( such as incoming call, missed call, new email notification , social messages)from the Iphone when it arrives or when the peripheral device gets connected with the phone.This data includes name of the caller,time and date.For email it will send the name the of the sender and message details.

    This data is not actually getting from the APP. The Iphone should send this to our peripheral device .I have actually able to get the notifications working with standalone TimeApp code. Now i want to combine this into my keyfobdemo code, where i have my application using accelerometer gyroscope etc.At present i am using the proximity profile to get the time from the APP when its getting paired with the peripheral device

    I would like to know whether i can  get a callback from the proximity profile if a new alert like incoming call, social message etc , received in  the phone.if the peripheral device is not paired it should save that data and it should immediately send the information , once its paired with the phone.

    Best Regards

    Don

     

  • Hello Don,

    I believe this was done successfully in the following post http://e2e.ti.com/support/wireless_connectivity/f/538/t/337594.aspx.

    There is also this one. http://e2e.ti.com/support/wireless_connectivity/f/538/t/304802.aspx

    Thanks,

  • Hi greenja,

    Actually i am able to get the alert notification work with the TimeApp code as per the above posts.Now i want add those files related to the timeApp into the Keyfobdemo Project. I want to make the keyfobdemo project as my main program and i would like to make the Alert notification working after integrating both. This is were i am stuck , as Keyfobdemo is GATT server and TimeApp is GATTclient. Need both to work when the need  arises.Hope You get my Point

    Best Regards

    Don

  • If you choose to go the route of changing the architecture of the TimeApp, rather than the method I suggested then you will find the information you need in the following documents:

    GATT_fundamentals.pdf http://developer.bluetooth.org/DevelopmentResources/Pages/Quick-Start-Kit.aspx
    CC2540/41 Software Developers User's Guide swru271 http://www.ti.com/lit/pdf/swru271
    CC2540/41 Sample Application Guide swru297 http://www.ti.com/lit/pdf/swru297

    Both the GATT server and client roles can be implemented in the in the peripheral or central roles.  The above documentation will give you a better understanding of storage and flow of data.

  • Hi,

    I was refering to BLE masterslave switching which describes the role switching. Is this the same way to proceed with GATT client and Server.Can you tell me how to start the discovery within the Keyfobdemo code.

    Best Regards

    Don

  • Hello,

    The master/slave (Central/Peripheral) roles can have either client or server roles assigned to them.  There is no rule that says a master has to be a server and the slave has to be the client.  They are not mutually exclusive.

    Look at the software user's guide and applications guide as well as the other documentation will provide you with the information you need.  Also, as you mentioned, there is the master/slave switch code that you can look at to see how discovery/advertising is done.

    Thanks,