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.

蓝牙读特征值问题



我买的蓝牙转串口模块是peripheral设备,我有个开发板里面有个串口透传例程,用开发板的SimpleBLECentral例程 能和我的模块连接,(买的模块)peripheral设备能给开发板(cc2540 central设备)发数据,开发板能收到数据,开发板发数据,(买的模块)peripheral设备收不到数据。

模块用lightblue搜索的结果如图,

我在主机例程中是不是要获得0xfff2的simpleBLECharHdl 

主机程序simpleBLECentral.c  这个文件下的函数

static void simpleBLEGATTDiscoveryEvent( gattMsgEvent_t *pMsg )

{

 .

.

.

req.type.uuid[0] = LO_UINT16(SIMPLEPROFILE_CHAR2_UUID);

        req.type.uuid[1] = HI_UINT16(SIMPLEPROFILE_CHAR2_UUID);

 

        GATT_ReadUsingCharUUID( simpleBLEConnHandle, &req, simpleBLETaskId );

      }

    }

  }

  else if ( simpleBLEDiscState == BLE_DISC_STATE_CHAR )

  {

    // Characteristic found, store handle

    if ( pMsg->method == ATT_READ_BY_TYPE_RSP || //这里以前是&&

         pMsg->msg.readByTypeRsp.numPairs > 0 )

    {

      simpleBLECharHdl = BUILD_UINT16( pMsg->msg.readByTypeRsp.dataList[0],

                                       pMsg->msg.readByTypeRsp.dataList[1] );

 

发送数据函数

len = length;

         attWriteReq_t req;

         req.handle = simpleBLECharHdl;

         req.len = len;

    req.sig = 0;//必须要填

    req.cmd = 0;//必须要填

         osal_memcpy(req.value,pBuffer,len);

         status = GATT_WriteCharValue( simpleBLEConnHandle, &req, simpleBLETaskId );

simpleBLEConnHandle 这个是什么  发送数据提示 write error 1 ,我想只有simpleBLECharHdl 或者simpleBLEConnHandle 错误才导致发送错误

     

    

 可以加 秋秋420253108  有重谢。(你懂得)