Беспроводная связь с BLueNRG usinf stm32l053r8t6 nucleo
Привет всем гикам,
I am beginner to BLE technology since kindly help me out by clearing the issue
я пытаюсь добавить новую службу GATT в x-cube ble (" 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 ;
}
1 ответ
Возможно, вы не вызываете функцию Add_UV_Sensor_Service()
в файле main.c, где есть место для инициализации сервисов.