Monday, December 16, 2019

How to use indication in simple_peripheral example and use Btool to enable indication.

The following steps show you how to revise CC26xx simple_peripheral example to use indication in simple_peripheral example and use Btool to enable indication.

1. Import CC26xx simple_peripheral example into CCS.

2. Replace "static ICall_EntityID selfEntity;" with "ICall_EntityID selfEntity;" in simple_peripheral.c.

3. Revise the following lines in simple_gatt_profile.c.

    3.a Add "extern ICall_EntityID selfEntity;" in EXTERNAL VARIABLES section.

    3.b Change "static uint8 simpleProfileChar4Props = GATT_PROP_NOTIFY;" to "static uint8 simpleProfileChar4Props = GATT_PROP_INDICATE;".
   
    3.c Change "status = GATTServApp_ProcessCCCWriteReq( connHandle, pAttr, pValue, len,  offset, GATT_CLIENT_CFG_NOTIFY);" to "status = GATTServApp_ProcessCCCWriteReq( connHandle, pAttr, pValue, len,  offset, GATT_CLIENT_CFG_INDICATE );".

    3.d Change

          GATTServApp_ProcessCharCfg( simpleProfileChar4Config, &simpleProfileChar4, FALSE,
                                    simpleProfileAttrTbl, GATT_NUM_ATTRS( simpleProfileAttrTbl ),
                                    INVALID_TASK_ID, simpleProfile_ReadAttrCB );
        
          to

          GATTServApp_ProcessCharCfg( simpleProfileChar4Config, &simpleProfileChar4, FALSE,
                                    simpleProfileAttrTbl, GATT_NUM_ATTRS( simpleProfileAttrTbl ),
                                    selfEntity, simpleProfile_ReadAttrCB );

4. Build simple_peripheral project and download hex to your LaunchPad. Check what BLE MAC address is on Teraterm (or any other terminal tools).



5. Start Btool to do BLE scan and select matched BLE MAC address to establish connection.



6. Write indication enable (02 00 in hex) into Characteristic Value Handle 0x0028 to enable indication and you can receive characteristic 4 indication on Btool.




No comments:

Post a Comment