2020-05-11 05:15 AM
hi, i'm using steval-idb00bv2 board ans i want to add my custom service to the other present on the example that already read the sensor present on the board.
this is the code that i have added and give me the problem
#define COPY_RAICAM_DEMO_SERVICE_UUID(uuid_struct) COPY_UUID_128(uuid_struct,0x00,0x00,0x00,0x00,0x00,0x01,0x11,0xe1,0x9a,0xb4,0x00,0x02,0xa5,0xd5,0xc5,0x1b)
#define COPY_BODY_TEMP_CHAR_UUID(uuid_struct) COPY_UUID_128(uuid_struct,0x00,0x00,0x00,0x00,0x00,0x01,0x11,0xe1,0xac,0x36,0x00,0x02,0xa5,0xd5,0xc5,0x1d)
tBleStatus Add_HWServW2ST_Service(void)
{
tBleStatus ret;
uint8_t uuid1[16];
COPY_RAICAM_DEMO_SERVICE_UUID(uuid1);
Osal_MemCpy(&service_raicam_uuid.Service_UUID_128, uuid1, 16);
//https://community.st.com/s/question/0D50X00009XkYAvSAN/sensortile-bluenrgms-custom-service-aci
printf("provo ad aggiungere servizi\n") ;
ret = aci_gatt_add_service(UUID_TYPE_128, &service_raicam_uuid, PRIMARY_SERVICE, 1+6, &RaicamDemoHandle);
if (ret != BLE_STATUS_SUCCESS)
{ printf("errore 3\n") ;
return BLE_STATUS_ERROR;
}
/* Fill the Environmental BLE Characteristc */
COPY_BODY_TEMP_CHAR_UUID(uuid);
Osal_MemCpy(&char_uuid.Char_UUID_128, uuid, 16);
// 2 byte timer + 2 byte temperatura + 4 byte pressione
ret = aci_gatt_add_char(RaicamDemoHandle, UUID_TYPE_128, &char_uuid, 2+2,
CHAR_PROP_NOTIFY|CHAR_PROP_READ,
ATTR_PERMISSION_NONE,
GATT_NOTIFY_READ_REQ_AND_WAIT_FOR_APPL_RESP,
16, 0, &BodyTempCharHandle);
if (ret != BLE_STATUS_SUCCESS)
{ printf("error 4\n") ;
return BLE_STATUS_ERROR;
}
return BLE_STATUS_SUCCESS;
}
here the log from the uart
thanks for the support
2020-05-12 02:49 AM
Hi, at the end i found the solution myself by reading the document PM0257, here i report the extract. before use a service or attribute it is necessary to allocate the relative memory space as describe on the table with the function BlueNRG_Stack_Initialization(&BlueNRG_Stack_Init_params);.
regards