当前位置: 首页 > news >正文

杭州网站优化搜索wordpress 分类排序

杭州网站优化搜索,wordpress 分类排序,组建一个网站,怎么制作二维码前言 最近接了一个外包,发现了esp32连接小程序会有很多bug,所以接下来会慢慢更新解决方案,还是需要多接触项目才能进步呀兄弟们! 附上uuid的生成链接: // See the following for generating UUIDs: // https://www.uu…

前言

最近接了一个外包,发现了esp32连接小程序会有很多bug,所以接下来会慢慢更新解决方案,还是需要多接触项目才能进步呀兄弟们!

附上uuid的生成链接:

// See the following for generating UUIDs:
// https://www.uuidgenerator.net/

问题

这里借用一下,别人博客遇到的问题。

后面重新开看流程时发现使用 wx.getBLEDeviceCharacteristics的时候有出现了三个特征值,以至于报错,博主问题原链接

我们可以看到微信小程序维护的也....现在2024年了这个bug还没修好.....

链接

解决办法

问题发现

解决办法只能从esp32代码来入手,首先来看看原本的蓝牙连接代码,我们可以看到,首先在开头就写了四个uuid特征码来进行蓝牙初始化,创建、发送、接收,这就是导致问题出现的关键


#define SERVICE_UUID        "1596c77c-cf40-4137-9957-d24916f8e50b"   //你可以通过上面的网址去生成UUID
#define CHARACTERISTIC_UUID "1596c77c-cf40-4137-9957-d24916f8e50b"
#define CHARACTERISTIC_UUID_RX "1596c77c-cf40-4137-9957-d24916f8e50b"
#define CHARACTERISTIC_UUID_TX "1596c77c-cf40-4137-9957-d24916f8e50b"void setup() {chipId = String((uint32_t)ESP.getEfuseMac(), HEX);chipId.toUpperCase();
//  chipid =ESP.getEfuseMac();
//  Serial.printf("Chip id: %s\n", chipid.c_str());Serial.println("chipId:"+chipId);Serial.println();Serial.printf("Chip id: %s\n", chipId.c_str());// Create the BLE DeviceBLEDevice::init("xhn_Service");// Create the BLE ServerpServer = BLEDevice::createServer();pServer->setCallbacks(new MyServerCallbacks());//随机生成的uuid放入BLEService *pService = pServer->createService(SERVICE_UUID);// Create a BLE CharacteristicpTxCharacteristic = pService->createCharacteristic(CHARACTERISTIC_UUID_TX,  BLECharacteristic::PROPERTY_NOTIFY);pTxCharacteristic->addDescriptor(new BLE2902());BLECharacteristic * pRxCharacteristic = pService->createCharacteristic(CHARACTERISTIC_UUID_RX,                                  uuid_RX,                                                   BLECharacteristic::PROPERTY_WRITE);pRxCharacteristic->setCallbacks(new MyCallbacks());// Start the servicepService->start();// Start advertisingpServer->getAdvertising()->start();Serial.println("Waiting a client connection to notify...");
}String readString;void loop() {if (deviceConnected) {//        pTxCharacteristic->setValue(&txValue, 1);//        pTxCharacteristic->notify();//        txValue++;//    delay(10); // bluetooth stack will go into congestion, if too many packets are sent}while (Serial.available() > 0) {if (deviceConnected) {delay(3);readString += Serial.read();pTxCharacteristic->setValue(chipId.c_str());
//      pTxCharacteristic->setValue((uint32_t)ESP.getEfuseMac());pTxCharacteristic->notify();Serial.println(chipId);}}// disconnectingif (!deviceConnected && oldDeviceConnected) {delay(500); // give the bluetooth stack the chance to get things readypServer->startAdvertising(); // restart advertisingSerial.println("start advertising");oldDeviceConnected = deviceConnected;}// connectingif (deviceConnected && !oldDeviceConnected) {// do stuff here on connectingoldDeviceConnected = deviceConnected;}
}

问题解决

因为我们初始化,接收、发送时,传递的都是同一个uuid,所以导致特征码重复,而报错,所以我们就可以在初始化的时候使用一个uuid,在发送或接收使用uuid时,切换另一个,因为获取uuid的目的是为了让小程序绑定设备码,所以在初始化的时候我们就可以绑定成功,从而uuid的作用就不重要了。

这边以修改接收的uuid为例:(其实修改一行就解决问题了),或者你将发送的UUID的修改成别的uuid也可以,只要你在小程序绑定号设备号就行,因为设备号是不会改变的。


#define SERVICE_UUID        "1596c77c-cf40-4137-9957-d24916f8e50b"   //你可以通过上面的网址去生成UUID
#define CHARACTERISTIC_UUID "1596c77c-cf40-4137-9957-d24916f8e50b"
#define CHARACTERISTIC_UUID_RX "2abe697b-cad9-409b-802e-624646c3e69c"
#define CHARACTERISTIC_UUID_TX "1596c77c-cf40-4137-9957-d24916f8e50b"void setup() {chipId = String((uint32_t)ESP.getEfuseMac(), HEX);chipId.toUpperCase();
//  chipid =ESP.getEfuseMac();
//  Serial.printf("Chip id: %s\n", chipid.c_str());Serial.println("chipId:"+chipId);Serial.println();Serial.printf("Chip id: %s\n", chipId.c_str());// Create the BLE DeviceBLEDevice::init("xhn_Service");// Create the BLE ServerpServer = BLEDevice::createServer();pServer->setCallbacks(new MyServerCallbacks());//随机生成的uuid放入BLEService *pService = pServer->createService(SERVICE_UUID);// Create a BLE CharacteristicpTxCharacteristic = pService->createCharacteristic(CHARACTERISTIC_UUID_TX,  BLECharacteristic::PROPERTY_NOTIFY);pTxCharacteristic->addDescriptor(new BLE2902());BLECharacteristic * pRxCharacteristic = pService->createCharacteristic(CHARACTERISTIC_UUID_RX,                                                                                   BLECharacteristic::PROPERTY_WRITE);pRxCharacteristic->setCallbacks(new MyCallbacks());// Start the servicepService->start();// Start advertisingpServer->getAdvertising()->start();Serial.println("Waiting a client connection to notify...");
}String readString;void loop() {if (deviceConnected) {//        pTxCharacteristic->setValue(&txValue, 1);//        pTxCharacteristic->notify();//        txValue++;//    delay(10); // bluetooth stack will go into congestion, if too many packets are sent}while (Serial.available() > 0) {if (deviceConnected) {delay(3);readString += Serial.read();pTxCharacteristic->setValue(chipId.c_str());
//      pTxCharacteristic->setValue((uint32_t)ESP.getEfuseMac());pTxCharacteristic->notify();Serial.println(chipId);}}// disconnectingif (!deviceConnected && oldDeviceConnected) {delay(500); // give the bluetooth stack the chance to get things readypServer->startAdvertising(); // restart advertisingSerial.println("start advertising");oldDeviceConnected = deviceConnected;}// connectingif (deviceConnected && !oldDeviceConnected) {// do stuff here on connectingoldDeviceConnected = deviceConnected;}
}

http://www.yayakq.cn/news/982293/

相关文章:

  • 外贸网站搭建难不难外网网站
  • 专门做2k名单的网站ui图标素材网站
  • 社区网站建设湛江手机建站模板
  • 做双语网站用什么cms系统好手机网站 怎么开发
  • 昆明自动seo搜索引擎优化人员优化
  • 个人免费设计网站四川微信小程序代理
  • 廊坊做网站1766534168微信网站开发 新闻
  • 江门网站建设设计石家庄小程序平台开发
  • 建网站免费软件怎么在360上做推广
  • 在哪些网站可以做企业名称预审网站建设安全措施
  • dnf做任务解除制裁网站东莞关键词搜索排名
  • 铜陵县住房和城乡建设局网站接做网站的项目
  • 张家界市建设工程造价管理站网站层流病房建设单位网站
  • 非标自动化东莞网站建设拟定一个物流网站建设方案
  • 个人网站 数据库如何上传到空间淮北哪里做网站
  • 做海外视频的网站有哪些网站建设公司名字
  • 视频网站哪个做的好处wordpress插件改图标
  • 电影影视网站模板免费下载拟定一个农产品电商网站的建设需求
  • wordpress做分类网站网页游戏网站哪个好
  • 网站开发主框架一般用什么布局厂房装修多少钱一个平方米
  • iis7如何搭建网站p2p网站审批
  • 固安住房和城乡建设网站郴州今天几例
  • 新网互联魔方手机网站建站系统寿光市建设局网站
  • 软路由系统如何做网站净水 技术支持 东莞网站建设
  • 国外做gif的网站北京响应式网站设计
  • 系统优化大师冯宗耀seo教程
  • 烟台模板建站代理泰安选择企业建站公司
  • 京东网站建设的意义深圳网站制作必选祥奔科技
  • 楚雄网站建设公司深圳软装设计公司有哪些
  • 智能建站源码做网站专业的公司