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.

How to connect 128bits UUID Service on Android side ?

Other Parts Discussed in Thread: CC2541

Hi TI developer.

I am developing on TI CC2541 Mini Development kit  and communication with Android 4.3 device. And I try to realize how the Android work for connect to the 128bits UUID Service on the CC2541.

So I have download the Source code of  SensorTag App , and download the SensorTag to CC2541.

After connect to the CC2541 , the App show the two button on the View. The APP will disconnect with CC2541 after receive the message which send from CC2541 when CC2541 push the button of B4 on the CC2541.

The question 1

Is the above action define by developer for 128bits UUID Service ? Which UUID is for this action ? 

The question 2

How the SensorTag App connect to 128bits UUID and use it ?

  • The device disconnects when you press B4 not because of any service but instead because the firmware on the CC2541 terminates the BLE link when you press that button, Take a look at sensorTag_HandleKeys().

    If you press the other button do you see an update within the SensorTag App view? Each attribute (represented by a UUID) has certain permissions (r/w) and represents a certain aspect of the server device, which in this case is the sensortag firmware. The sensortag app can read/write these attributes as well as receive indications when they have changed.

    When the button state updates on the sensortag app view it is receiving the value of a specific UUID representing the button state and then updating the view for you to see. Use the USB dongle provided in the MiniDK to set up a packet sniffer or use BTool to get a better understanding of how the different attribute values are read/written to between BLE clients and servers.

    -Matt

  • Hi Matthew Kracht

    Thanks for your reply.

    I have see the GAPRole_TerminateConnection(); in the sensorTag_HandleKeys(). So the CC2541 disconnect by it self when push the B4.

     

    But the CC2541 Mini Development kit only has  B4 and B3 , and the  SensorTag App view didn't change when I press the B3 button. 

     

    Can you direct me which specific 128-bit UUID is use for receiving the value and representing the button state ??

     

     

  • Hey Wun,

    If you check out the source code for the keyfob you'll see the UUIDs for all of the services and characteristics. For the Simple Keys service the UUI for the actual value of the buttons is 0xFFE1. You'll find that declaration within simplekeys.c/h within the project.

    Try running the keyfob demo on your HW instead of the sensor tag and see if you get different results. This will give you a better idea of whether this is a firmware, hardware, or phone app issue. You could also use our BLE device monitor instead of the phone to get a more in depth view of the system and attributes http://processors.wiki.ti.com/index.php/BLE_Device_Monitor_User_Guide. That's what the screen clip is above.

    -Matt

  • How do you convert those 16 bit values such as 0xFFE1 to 128 bit UUIDs needed by Android?  This needs to be documented somewhere, this TI stuff is too hard to use with Android.

  • This is documented in the BlueTooth core spec https://www.bluetooth.org/en-us/specification/adopted-specifications, look at 4.0.

    There are a set of standard UUIDs that are defined by SIG that are either 16bit or 32bit (spec 4.1). The BT base UUID is 00000000-0000-1000-8000-00805F9B34FB and the spec gives how to convert a 16 or 32bit UUID to the 128bit UUID using this base addr. 

    -Matt