请问TI的工程师,CC2640R2蓝牙模块之间,主机发送NOTIFY使能后,主机能收到从机的数据,但我要把收到的从机数据,又发送给从机。主机先发送notify使能,再发送从机数据,怎么做到啊?谢谢
Alvin Chen:
你是不是就想主机给从机发数据:
attWriteReq_t writeReq;uint8_t temp = 1;// Populate the Request StructurewriteReq.cmd = 0;writeReq.handle = throughputHandles[THROUGHPUT_SERVICE_TOGGLE_THROUGHPUT].charHdl;writeReq.len = THROUGHPUT_SERVICE_TOGGLE_THROUGHPUT_LEN;writeReq.pValue = GATT_bm_alloc(connHandle, ATT_WRITE_REQ, THROUGHPUT_SERVICE_TOGGLE_THROUGHPUT_LEN, NULL);memcpy(writeReq.pValue, &temp, THROUGHPUT_SERVICE_TOGGLE_THROUGHPUT_LEN);writeReq.sig = 0;// Perform a GATT Write + Check Statusuint8_t status;status = GATT_WriteCharValue(connHandle, &writeReq, selfEntity);if( status != SUCCESS ){// We didn't successfully send this command to the stack!// Let's attempt to retransmit again and free the pValue pointerGATT_bm_free((gattMsg_t *)&writeReq, ATT_WRITE_REQ);Event_post(syncEvent, SBC_TOGGLE_THROUGHPUT_EVT);}
liping meng:
回复 Alvin Chen:
这个只是主机给从机发送数据。我想知道的是,主机接收从机的数据后,再把数据发送给从机。这个里面,主机先发一次NOTIFY给从机,接收从机数据,然后再发一次数据给从机,怎么做到啊?
Alvin Chen:
回复 liping meng:
没懂,你是想使能notify?不太懂。
liping meng:
回复 Alvin Chen:
先发送notify使能,然后发送其他数据。我已经解决了,谢谢啊!
TI中文支持网


