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.

CC2541: Adding new profile problem

Hi everyone,

I want to add a new profile to the HeartRate example, and I think that the easiest way to do it is to copy the battery service profile (for example) and rename the profile (for example temperature) and add them to the profile file of the project.

I made all changes in the new temperature service profile files (.c and .h):

  • Rename the functions to avoid duplication with functions of the battery service profile.
  • Add TEMP_SERV_UUID ,  TEMP_LEVEL_UUID and other defines in tempservice.h
  • Changes in tempservice.c (the structure and content is similar to battservice.c but with functions and variables renamed)

and after that I also made the changes in heartrate.c:

  • new defines
  • add new fields in adverData (LO_UINT16(TEMP_SERV_UUID) and HI_UINT16(TEMP_SERV_UUID)) 
  • New functions (heartRateTempPeriodicTask( void ) and static void heartRateTempCB(uint8 event))
  • In heartRate_Init I have included:
    • A Setup for Temperature Characteristic Values
    • Initialize Temperature service (Temp_AddService())
    • Register for Temperature service Calback (Temp_Register ( heartRateTempCB ))
  • In HeartRate_ProcessEvent I also include the event for TEMP_PERIODIC_EVENT:

if ( events & TEMP_PERIODIC_EVT )
{
// Perform periodic temperature task
heartRateTempPeriodicTask();

return (events ^ TEMP_PERIODIC_EVT);
}

  • Also in HeartRateGapStateCB I have included "Temp_HandleConnStatusCB( gapConnHandle, LINKDB_STATUS_UPDATE_REMOVED )"

And that´s all my changes (I think...).

I am able to connect to it using BTool, and I can also discover characteristic by UUID for the new profile (temperature service). A writting operation of 1 in the Temperature service value handle is success but I do not receive any messages. I forgot that I also configure it to send data periodically (it works with battery service but not with temperature service) Do you know if there is something missing or I forgot something? I am with it several days an I do not know what is missing.

I really appreciate your help.


Thank you very much.