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.

Modifying simplekeys profile to send more than one byte

Hello all,

I am trying to modify the simplekeys.c along with keyfobdemo.c to all a client to read more than 1 byte upon notification, basically SIMPLEPROFILE_CHAR5 + SK_KEYPRESSED functionality.  I have done extensive searching on the topic, http://e2e.ti.com/support/low_power_rf/f/538/t/157081.aspx?pi239031352=2 was a good reference but it doesn't look like the original poster found success either.  I would like to receive a notification whenever one of the buttons on the keyfob is pressed, once that notificaion is recieved, the client (BTool) would read in an array of size greater than 1, say 5 bytes.  Is this even possible with this Attribute?  I have increased the size of skKeyPressed to an array of size 5, as well as modifying the profile attributes table, all in simplekeys.c. 

In the keyfobapp_HandleKeys function, I created test_array[5] = {0x0F,0x0F, 0x0F, 0x0F, 0x0F} and my call of set parameter function in the HadleKeys function looks like this... SK_SetParameter( SK_KEY_ATTR, 5, test_array).

I then modify the SK_SetParameter function in simplekeys.c by adding the osal_memcpy(skKeyPressed, pValue, 5). 

Can anyone help?  Thanks. -Chris

  • Yes you can increase the characteristic size. The maximum number of bytes that can be sent in one notification is 20 (char size can be bigger than this but only 20bytes of it can be sent in one go. Several parts of the code need to be changed to handle size greater than 1 e.g.

    simpleProfile_WriteAttrCB() does a length check prior to a write operation and returns an error if the length does not match. This would have to be increased to prevent an error here.

    Additionally, in several functions the value is copied as a single byte only. e.g. SimpleProfile_GetParameter uses *((uint8*)value) = simpleProfileChar5;. This would need to be changed to osal_memcpy( value, simpleProfileChar5, SIMPLEPROFILE_CHAR5_LEN ); to copy all bytes.

    There was a good post on this a while back but you will need to search for it.