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字符串和开发板中设置的字节序是相反的。