1

您好所有极客,

               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 ;


}
4

1 回答 1

0

也许您没有调用Add_UV_Sensor_Service()main.c 文件中的函数,该文件中有用于初始化服务的空间。

于 2016-06-17T12:10:27.597 回答