This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
我使用的是CC2640R2F SDK:simplelink_cc2640r2_sdk_2_30_00_28
oad reset service uuid在样例中,是使用了128bit,使用lightblue在手机上查看,也是128位。
现有个需求:实现在手机上查看这个reset service uuid,是16位就可以。
自己做了代码修改,但发现没有实现这个需求,是不是我没有改全?
// OAD Reset GATT Profile Service UUID
static const uint8_t resetServUUID[ATT_BT_UUID_SIZE] =
{
//TI_BASE_UUID_128(OAD_RESET_SERVICE_UUID)
LO_UINT16( OAD_RESET_SERVICE_UUID ), HI_UINT16( OAD_RESET_SERVICE_UUID )
};
static const uint8_t resetCharUUID[ATT_BT_UUID_SIZE] =
{
//TI_BASE_UUID_128(OAD_RESET_CHAR_UUID)
LO_UINT16( OAD_RESET_CHAR_UUID ), HI_UINT16( OAD_RESET_CHAR_UUID )
};
// Simple Profile Service attribute
static CONST gattAttrType_t resetProfileService = { ATT_BT_UUID_SIZE, resetServUUID };
// OAD Reset Characteristic Value
{
{ ATT_BT_UUID_SIZE, resetCharUUID },
OAD_WRITE_PERMIT,
0,
&resetCharVal
},
看起来,例子就是使用了128 bit,我也是要将128bit反向做成16bit.
这个例子和我SDK例子差异还是比较大,比如USE_128_BIT_UUID这个定义在我的例子里并没有。
我是一个新手,研究了半天,还是不知道如何去修改好,请指教!
我参考了simple peripheral example 代码当中确实是使用了16bit,但在手机中发现还是被扩展成128bit的,不知道什么原因?
我这边要实现的需求,就是在手机上看到的UUID是16bit,也就是图中 FFF0,FFF1就可以了。
我进一步去查看 00805F9B34FB 是在哪里加入的,发现有宏 BT_BASE_UUID_128定义了它,但修改这个宏,并没有达到我要的效果,因此,再次求助。
static gattAttribute_t simpleProfileAttrTbl[SERVAPP_NUM_ATTR_SUPPORTED] = { // Simple Profile Service { { ATT_BT_UUID_SIZE, primaryServiceUUID }, /* type */ GATT_PERMIT_READ, /* permissions */ 0, /* handle */ (uint8 *)&simpleProfileService /* pValue */ }, // Characteristic 1 Declaration { { ATT_BT_UUID_SIZE, characterUUID }, GATT_PERMIT_READ, 0, &simpleProfileChar1Props }, // Characteristic Value 1 { { ATT_BT_UUID_SIZE, simpleProfilechar1UUID }, GATT_PERMIT_READ | GATT_PERMIT_WRITE, 0, &simpleProfileChar1 }, // Characteristic 1 User Description { { ATT_BT_UUID_SIZE, charUserDescUUID }, GATT_PERMIT_READ, 0, simpleProfileChar1UserDesp }, // Characteristic 2 Declaration { { ATT_BT_UUID_SIZE, characterUUID }, GATT_PERMIT_READ, 0, &simpleProfileChar2Props }, // Characteristic Value 2 { { ATT_BT_UUID_SIZE, simpleProfilechar2UUID }, GATT_PERMIT_READ, 0, &simpleProfileChar2 }, // Characteristic 2 User Description { { ATT_BT_UUID_SIZE, charUserDescUUID }, GATT_PERMIT_READ, 0, simpleProfileChar2UserDesp }, // Characteristic 3 Declaration { { ATT_BT_UUID_SIZE, characterUUID }, GATT_PERMIT_READ, 0, &simpleProfileChar3Props }, // Characteristic Value 3 { { ATT_BT_UUID_SIZE, simpleProfilechar3UUID }, GATT_PERMIT_WRITE, 0, &simpleProfileChar3 }, // Characteristic 3 User Description { { ATT_BT_UUID_SIZE, charUserDescUUID }, GATT_PERMIT_READ, 0, simpleProfileChar3UserDesp }, // Characteristic 4 Declaration { { ATT_BT_UUID_SIZE, characterUUID }, GATT_PERMIT_READ, 0, &simpleProfileChar4Props }, // Characteristic Value 4 { { ATT_BT_UUID_SIZE, simpleProfilechar4UUID }, 0, 0, &simpleProfileChar4 }, // Characteristic 4 configuration { { ATT_BT_UUID_SIZE, clientCharCfgUUID }, GATT_PERMIT_READ | GATT_PERMIT_WRITE, 0, (uint8 *)&simpleProfileChar4Config }, // Characteristic 4 User Description { { ATT_BT_UUID_SIZE, charUserDescUUID }, GATT_PERMIT_READ, 0, simpleProfileChar4UserDesp }, // Characteristic 5 Declaration { { ATT_BT_UUID_SIZE, characterUUID }, GATT_PERMIT_READ, 0, &simpleProfileChar5Props }, // Characteristic Value 5 { { ATT_BT_UUID_SIZE, simpleProfilechar5UUID }, GATT_PERMIT_AUTHEN_READ, 0, simpleProfileChar5 }, // Characteristic 5 User Description { { ATT_BT_UUID_SIZE, charUserDescUUID }, GATT_PERMIT_READ, 0, simpleProfileChar5UserDesp }, }
找了ipad去看这个例子当中的UUID,发现已经是16bit的了。
那么就有疑问了:为什么android当中显示成128bit,而在iphone当中就会显示成16bit?