请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
器件型号:LP-EM-CC2340R5 主题中讨论的其他器件:CC2340R5
工具与软件:
下午好!
我使用 cc2340r5和 simplelink_lowpower_f3_sdk_8_10_01_02。
我的程序基于 basic_ble 并进行了一些逻辑修改。
我尝试使用 GATT 将一个值写入另一个器件的特征。 但是、当我执行 GATT_WriteCharValue 时、我会得到 faultISR()。
下面是我用于创建特征记录查询的函数
bStatus_t GATT_API::writeCharValue(uint16_t conn_handle, uint16_t char_handle) { uint8_t* value = (uint8_t*)ICall_malloc(sizeof(uint8_t) * 2); value[0] = 7; value[1] = 0; attWriteReq_t pReq = { .handle = char_handle, .len = sizeof(value), .pValue = value, .sig = 0, .cmd = 0, }; BLEAppUtil_entityId_t taskId = BLEAppUtil_getSelfEntity(); bStatus_t status = GATT_WriteCharValue(conn_handle, &pReq, taskId); return status; }
在此之前、我使用 GATT_DiscCharsByUUID 查询响应获得了特征的句柄。
attReadByTypeRsp_t *pRsp = &(gattMsg->msg.readByTypeRsp); for (uint8_t i = 0; i < pRsp->numPairs; i++) { conn_dev_info->service_.cmd_char_handle_ = BUILD_UINT16(pRsp->pDataList[i], pRsp->pDataList[i + 1]); }
我不知道我在使用此功能条目时做了什么错误。 并且似乎没有通过 UUID 记录特征的方法(尽管有一个供读取)