In short, I want to change the value of Characteristics 5 in simpleBLEPeripheral. The following is what I did in simpleGATTprofile.c:
1. simpleProfileChar5Props=GATT_PROP_READ | GATT_PROP_WRITE;
2. // Characteristic Value 5 { { ATT_BT_UUID_SIZE, simpleProfilechar5UUID }, GATT_PERMIT_AUTHEN_READ|GATT_PERMIT_AUTHEN_WRITE, 0, simpleProfileChar5 },
3.//Add the following codes to simpleProfile_WriteAttrCB()
case SIMPLEPROFILE_CHAR5_UUID: VOID osal_memset( pAttr->pValue, *pValue, SIMPLEPROFILE_CHAR5_LEN ); break;
But the result I did not expect. the default value of Char5 is [01,02,03,04,05].
when I use BTool to write a new value (eg. [06,07,08,09,00] ), and read Char5 again, the display is [06,06,06,06,06] .
what am I missing?
Hi,
Maybe I'm wrong here but try removing the *,
VOID osal_memset( pAttr->pValue, pValue, SIMPLEPROFILE_CHAR5_LEN );
Br
I try to removeg the * as you said. And the build message I got is Error[Pe167]: argument of type "unsigned char *" is incompatible with parameter of type "uint8" .
But thank you all the same.
My solution shows as follows,
uint8 *pCurBuffer = (uint8 *)pAttr->pValue; uint8 i; for( i = 0; i < SIMPLEPROFILE_CHAR5_LEN ; i++ ) { *( pCurBuffer+i ) = pValue[i]; }