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.

RTOS/CC1350: Make message transfer with Simple Peripheral CC1350lp BLE example

Part Number: CC1350

Tool/software: TI-RTOS

I use this example to pass messages from server (periph) to client(central). I use the BLE software user guide on the example.

I want to use the Notify option on characteristic 4 . I found the abstract build the format of it in simple_gatt_profile.c on

static gattAttribute_t simpleProfileAttrTbl[SERVAPP_NUM_ATTR_SUPPORTED]

.

.

.

// Characteristic 4 Declaration
{
{ ATT_BT_UUID_SIZE, characterUUID },
GATT_PERMIT_READ,
0,
&simpleProfileChar4Props
},

// Characteristic Value 4
{
{ ATT_BT_UUID_SIZE, simpleProfilechar4UUID },
0,
0,
&simpleProfileChar4
},

// Characteristic 4 configuration
{
{ ATT_BT_UUID_SIZE, clientCharCfgUUID },
GATT_PERMIT_READ | GATT_PERMIT_WRITE,
0,
(uint8 *)&simpleProfileChar4Config
},

// Characteristic 4 User Description
{
{ ATT_BT_UUID_SIZE, charUserDescUUID },
GATT_PERMIT_READ,
0,
simpleProfileChar4UserDesp
},

1. As I see it according Figure 36. Simple GATT Profile Characteristic Table (from software user guide) the notification sign should be place in Characteristic 4 Declaration I can't see any define for Notification (0x10) in gatt.h file, between #define GATT_PERMIT_READ                 0x01  till #define GATT_PERMIT_ENCRYPT_WRITE        0x80 also  #define GATT_PERMIT_AUTHOR_READ       0x10 has the some value. But if I look on Characteristic 4 Declaration values (where I think need to put the Nfy) there iis "GATT_PERMIT_READ" (mark in red) value. So how it know it is use for Nty/Ind?

2. To know which permission is active in Nty/Ind use Characteristic 4 configuration where for notifications (writing 0x0001) or indications (writing 0x0002).  I see the read & write values (in green) written there. What is mean (Nty AND Ind) ? What is the difference between those two? What I am write there if I only want Nty?

3. Which function in the example, update those attributes?

  • Hi Bar Strauss1,

    Notification packets can actually be sent regardless of configuration or settings, but to be compliant, a notifiable characteristic must

    * Have GATT_PROP_NOTIFY flag set in the characteristic properties (GATT_PERMIT_XX are permissions) which are included in the "value" field of the characteristic declaration

    * Have an associated CCCD / clientCharCfgUUID, whose value field the client uses to enable/disable notifiaction and indication.

    * Not send notifications unless a client has written to the CCCD

    For reference, please also see:

    SimpleLink Academy lab on custom profile

    SimpleLink Academy lab on Bluetooth Developer Studio

    To your questions
    1 - The permissions on the characteristic value attribute (with UUID "simpleProfilechar4UUID") are 0, which disallows reading and writing. In other words, only notifications can be sent out from this value. You know it's notifiable by looking at the properties of the characteristic declaration attribute.
    2 - Indications require that the received sends a response. Notifications do not. Both are configured via the configuration/CCCD attribute, but "Characteristic 4" is only set up to allow notifications as it does not handle receiving an indication response. This means - write 0x0001 to it, or 01:00 depending on your method, to enable notifications.

    Best regards,
    Aslak

  • O.K. I get this idea.
    Now I want to try to use the code for make propriety service. I make some test and have some questions.
    1. To make it clear for Notification. If I use the code as is , does the client that get the data need first to confirm the notification method and then it can receive it or it is automatically confirm for every client that make a connection?
    2. I try to play with the Device name. The main function to do it is GGS_SetParameter(GGS_DEVICE_NAME_ATT, GAP_DEVICE_NAME_LEN, attDeviceName);
    But at the example it go directly to location on the memory and get a const text. I even couldn't stop when it get there because it is not one of the visible files. How can I overlap it with the original code and write whatever name I want?
    3. In the code also during init it use devInfoAttrTbl[] for all information setting when it continue and get to
    case GAPROLE_STARTED
    in SimpleBLEPeripheral_processStateChangeEvt it change again the ID. Does it mandatory or it is just example for utility and I can skip it?
    4. If I want to delete some SIMPLEPROFILE_CHARx or add one in addition to configure it in simpleProfileAttrTbl[] which parameter also need to be modify like number of attributes or the configuration table?
    5. Is there any better application ( instead of the SimpleLink starter) which I can use on my SmartPhone to investigate the BLE services, without using Lunchpad board? I want it in a level that can show me what is sending over the link, the notifications ect.
    Regards
    Bar.
  • Hi Bar,

    1. Each client has to say they want notifications when they connect.

    2. You can change the contents of "attDeviceName" it is higher up in the same file

    3. Device info is just an example. You can hard-code the values in to deviceinfoservice if you want.

    4. You can actually remove the NUM_ATTRS length specifier from the attribute table array. But you do not need to change anything, except you need to add handling of the new characteristic and if you delete, ideally you also delete the handling.

    5. I'm not sure such an app exists. BLE Scanner for Android and LightBlue for iOS are decent apps though. Not sure what you mean "without using the launchpad board"

    Finally, please read the link I posted about making a custom service. It explains at least your question 4.

    Best regards,
    Aslak

  • Thanks Aslak.

    I make some progress, and still some old and new question arise.

    1. Also I see that 

    GGS_SetParameter(GGS_DEVICE_NAME_ATT, GAP_DEVICE_NAME_LEN, attDeviceName);

    is use with the string "Simple BLE Peripheral" I see in the discover Device on the client side name "SimpleBLEPeripheral" which come from anther area of the memory, but I don't even know how set it there. So I don't see how can I force my name?

    2. I try to make SimpleProfileChar4   5 bytes of value with notification ,as SimpleProfileChar5. So I change  static uint8 simpleProfileChar4[SIMPLEPROFILE_CHAR5_LEN] = { 0, 0, 0, 0, 0 }; and in the attribute I change to 

    // Characteristic Value 4
    {
    { ATT_BT_UUID_SIZE, simpleProfilechar4UUID },
    0,
    0,
    //&simpleProfileChar4
    simpleProfileChar4
    },

    and also in each set and get change the setting to memcpy as with SimpleProfileChar5. But on the discovery client device I only can see 1 hex byte after allow for notification. What I miss?

    3. To read SimpleProfileChar5 there need read authentication GATT_PERMIT_AUTHEN_READ. When I try it on the client device i get a message to send autentication (in most cases it is "0000" or "1234". I did it both but after send I get disconnect.

    Do I need to add something more in the SimpleBLEPeripheral ex so it will work?

    Regards

    Bar.

  • Hi Bar,

    There are two places the name is set 1) advertisement and/or scanRsp, 2) device name characteristic. Normally, a client will scan and see first the advertisement/scanresponse name, then later often read the device name characteristic. Also keep in mind that e.g iOS will cache this value for some time and will not update the name it displays.

    Please refer to the two labs I mentioned in my original response. For your first question this should be answered in the "Fundamentals" lab on the same site.

    Best regards,
    Aslak
  • Hi Aslak.
    As I look into the advertising process init there is no param for name write. Also I found the location of the name(SimpleBLEPeripheral) in the memory , and even place data breakpoint on it show me it take it in perlemenary process before run the main program (it is look it make in the stack level) . There is also no varible that hold this characteristic so I can't put a different name there. Also I change the name in GGS_SetParameter(GGS_DEVICE_NAME_ATT it didn't get the new name (I think the name in the advertising process get the priority).
    I also look on the Lab you point to and there is no reference taking how to change the name during the advertising process.
    Any idea how to make it come?
    Regards
    Bar.