mynewt 学习二:修改UUID

mynewt 默认服务UUID 使用128Bit 数据,现修改成16bit 数据

同样是在文件Gatt_svr.c 默认如下:

/* 59462f12-9543-9999-12c8-58b459a2712d */
static const ble_uuid128_t gatt_svr_svc_sec_test_uuid = 
       BLE_UUID128_INIT(0x2d, 0x71, 0xa2, 0x59, 0xb4, 0x58, 0xc8, 0x12,
                     0x99, 0x99, 0x43, 0x95, 0x12, 0x2f, 0x46, 0x59);

/* 5c3a659e-897e-45e1-b016-007107c96df6 */
static const ble_uuid128_t gatt_svr_chr_sec_test_rand_uuid = 
        BLE_UUID128_INIT(0xf6, 0x6d, 0xc9, 0x07, 0x71, 0x00, 0x16, 0xb0,
                         0xe1, 0x45, 0x7e, 0x89, 0x9e, 0x65, 0x3a, 0x5c);

/* 5c3a659e-897e-45e1-b016-007107c96df7 */
static const ble_uuid128_t gatt_svr_chr_sec_test_static_uuid = 
        BLE_UUID128_INIT(0xf7, 0x6d, 0xc9, 0x07, 0x71, 0x00, 0x16, 0xb0,
                         0xe1, 0x45, 0x7e, 0x89, 0x9e, 0x65, 0x3a, 0x5c);

修改后如下:

static const ble_uuid16_t gatt_svr_svc_sec_test_uuid =  BLE_UUID16_INIT(0x1901);
//static const ble_uuid128_t gatt_svr_svc_sec_test_uuid = 
//    BLE_UUID128_INIT(0x2d, 0x71, 0xa2, 0x59, 0xb4, 0x58, 0xc8, 0x12,
//                     0x99, 0x99, 0x43, 0x95, 0x12, 0x2f, 0x46, 0x59);

/* 5c3a659e-897e-45e1-b016-007107c96df6 */
static const ble_uuid16_t gatt_svr_chr_sec_test_rand_uuid =  BLE_UUID16_INIT(0x2b10);
//static const ble_uuid128_t gatt_svr_chr_sec_test_rand_uuid =  BLE_UUID16_INIT(0x01, 0x19);
//        BLE_UUID128_INIT(0xf6, 0x6d, 0xc9, 0x07, 0x71, 0x00, 0x16, 0xb0,
//                         0xe1, 0x45, 0x7e, 0x89, 0x9e, 0x65, 0x3a, 0x5c);

/* 5c3a659e-897e-45e1-b016-007107c96df7 */
static const ble_uuid16_t gatt_svr_chr_sec_test_static_uuid = BLE_UUID16_INIT(0x2b11);
//static const ble_uuid128_t gatt_svr_chr_sec_test_static_uuid = BLE_UUID16_INIT(0x02, 0x19);
//        BLE_UUID128_INIT(0xf7, 0x6d, 0xc9, 0x07, 0x71, 0x00, 0x16, 0xb0,
// 

 

编译,烧录........

posted @ 2018-12-04 16:52  不在+年华  阅读(666)  评论(0编辑  收藏  举报