自定义service:
[stack/ble/service/uuid.h]
#define HELLO_SERVICE 0x22,0x19,0x0d,0x0c,0x0b,0x0a,0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0x00
[vendor/ble_remote/app_att.h]
在typedef enum的OTA_CMD_OUT_DESC_H下方加上
// hello_service
hello_PS_H,
hello_str_CD_H,
hello_str_DP_H,
[vendor/ble_remote/app_att.c]
static const u8 my_HelloServiceUUID[16] = WRAPPING_BRACES(HELLO_SERVICE);
static const u8 my_HelloServiceManufacturerNameStringVal[5] = {
CHAR_PROP_READ,
U16_LO(hello_str_DP_H), U16_HI(hello_str_DP_H),
U16_LO(CHARACTERISTIC_UUID_MANU_NAME_STRING), U16_HI(CHARACTERISTIC_UUID_MANU_NAME_STRING)
};
在static const attribute_t my_Attributes[] = {的
{0,ATT_PERMISSIONS_READ, 2,sizeof (my_OtaName),(u8*)(&userdesc_UUID), (u8*)(my_OtaName), 0, 0},
#endif
的下方加上
// hello service
{3,ATT_PERMISSIONS_READ,2,16,(u8*)&my_primaryServiceUUID, (u8*)my_HelloServiceUUID, 0, 0},
{0,ATT_PERMISSIONS_READ,2,sizeof(my_HelloServiceManufacturerNameStringVal),(u8*)&my_characterUUID, (u8*)my_HelloServiceManufacturerNameStringVal, 0, 0},
{0,ATT_PERMISSIONS_READ,2,23,(u8*)&my_HelloServiceManufacturerNameStringVal[3],(u8*)"Hello Hello Hello World",0,0},
