大家好,
I am beginner to BLE technology since kindly help me out by clearing the issue
我正在尝试向x-cube ble添加一个新的GATT服务("http://www.st.com/web/en"),但遗憾的是,该服务未显示在ble调试器中(https://play.google.com/store/apps/details?id=com.adatronics.bledebugger&hl=en)
该代码中已经存在的服务是可见的,但具有新uuid的新服务没有形成
/************************************ Ref code *********************************************************/
(主)
ret = Add_UV_Sensor_Service();
if(ret == BLE_STATUS_SUCCESS)
PRINTF("Environmental Sensor service added successfully.n");
else
PRINTF("Error while adding Environmental Sensor service.n");
(under service .c)
#define COPY_UUID_128(uuid_struct, uuid_15, uuid_14, uuid_13, uuid_12, uuid_11, uuid_10, uuid_9, uuid_8, uuid_7, uuid_6, uuid_5, uuid_4, uuid_3, uuid_2, uuid_1, uuid_0)
do {
uuid_struct[0] = uuid_0; uuid_struct[1] = uuid_1; uuid_struct[2] = uuid_2; uuid_struct[3] = uuid_3;
uuid_struct[4] = uuid_4; uuid_struct[5] = uuid_5; uuid_struct[6] = uuid_6; uuid_struct[7] = uuid_7;
uuid_struct[8] = uuid_8; uuid_struct[9] = uuid_9; uuid_struct[10] = uuid_10; uuid_struct[11] = uuid_11;
uuid_struct[12] = uuid_12; uuid_struct[13] = uuid_13; uuid_struct[14] = uuid_14; uuid_struct[15] = uuid_15;
}while(0)
#define COPY_UV_SENS_SERVICE_UUID(uuid_struct) COPY_UUID_128 (uuid_struct,0x0e,0xd4,0x4b,0x69, 0x20,0xd1, 0x4b,0xc4, 0x9f,0xb0, 0xcf,0xf6,0xf1,0xf1,0xd0,0x71)
tBleStatus Add_UV_Sensor_Service(void)
{
tBleStatus ret;
uint8_t uuid[16];
uint16_t uuid16;
charactFormat charFormat;
uint16_t descHandle;
COPY_UV_SENS_SERVICE_UUID(uuid);
ret = aci_gatt_add_serv(UUID_TYPE_128, uuid, PRIMARY_SERVICE , 5,
&uvSerHandle);
if (ret != BLE_STATUS_SUCCESS) goto fail;
fail:
PRINTF("Error while adding UV_SENS service.n");
return BLE_STATUS_ERROR ;
}
也许您没有在main.c文件中调用函数Add_UV_Sensor_Service()
,因为那里有初始化服务的空间。