Nrf51822中设置128bit UUID service
?
?
Nrf51822中設置128bit UUID service
?
uint32_tble_dajia_add_service(ble_dajia_t *p_wechat)
{
?????????????????? uint32_t err_code;
?????????????????? ble_uuid_t ble_wechat_uuid;
?????????????????? const ble_uuid128_tbase_uuid128 =
??? {
??????? {
??????????? 0x23, 0xD1, 0xBC, 0xEA, 0x5F, 0x78,0x23, 0x15,
??????????? 0xDE, 0xEF, 0x12, 0x12, 0x00, 0x00,0x00, 0x00
??????? }
??? };
?????????????????? ble_wechat_uuid.uuid =0x1122;
??????????????????
?????????????????? //BLE_UUID_BLE_ASSIGN(ble_wechat_uuid,BLE_UUID_DAJIA_SERVICE);// ??UUID
?????????????????? err_code =sd_ble_uuid_vs_add(&base_uuid128, &(ble_wechat_uuid.type));
?????????????????? if (err_code != NRF_SUCCESS)
??? {
??????? return err_code;
??? }
??????????????????
?????????????????? err_code =sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &ble_wechat_uuid,&p_wechat->service_handle);
?????????????????? return err_code;
}
?
安卓端搜索到的UUID字符串是:03-17 16:24:45.595:E/DeviceScanActivity(31942): -->serviceuuid:00001122-1212-efde-1523-785feabcd123
?
在Nordic開發板中是小端格式,uuid字符串和開發板中設置的字節序是相反的。
?
posted on 2017-06-18 14:01 mthoutai 閱讀(...) 評論(...) 編輯 收藏轉載于:https://www.cnblogs.com/mthoutai/p/7044213.html
總結
以上是生活随笔為你收集整理的Nrf51822中设置128bit UUID service的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 如何快速增加pdf书签,解除pdf限制
- 下一篇: 【BZOJ2115】[Wc2011] X