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.

蓝牙特征值问题

Other Parts Discussed in Thread: CC2540

UUID 是0xfff2 对应的是write without response

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

这句该怎么改?

  • 大哥,你的问题没有描述清楚

    1、你是在从机上更改UUID所对应的值,还是在master方更改扫描到的UUID值

    2、另外这一句话是哪个例程里面的,还是你自己写的,最好描述清楚,你把问题描述的越清楚,大家越能帮到你

    3、如果你这样问估计2020年也得不到你想要的答案

  • 我买的蓝牙转串口模块是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 错误才导致发送错误

         

        

     

  • 可以加我qq420253108帮我解决问题,必有重谢!(你懂得)