ESP32作为Client,低功耗模式BLE连接HC-08,连接上了,也看到了对应的Properties。
canNotify
canRead
canWriteNoResponse
但我要怎么进行通讯,才能让HC-08使用串口发送数据让ESP32接收到,ESP32发送数据让HC-08在串口接收到
这是我的连接信息
// The remote service we wish to connect to.
static BLEUUID serviceUUID("0000fff0-0000-1000-8000-00805f9b34fb");
// The characteristic of the remote service we are interested in.
static BLEUUID charUUID("0000fff5-0000-1000-8000-00805f9b34fb");
这是我蓝牙HC-08的Properties等信息
services下有多个模式,只有一个模式是可以发送接收的,
case PROPERTY_WRITE_NO_RESPONSE: {
openButton.setText("连接设备");
openButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (openButton.getText().toString().equals("连接设备")) {
openButton.setText("断开连接");
String hex = "57";
if (TextUtils.isEmpty(hex)) {
return;
}
试了全部uuid,ESP32执行发送数据后,HC-08串口也没有数据
if ( Serial.available())
{
String xStr = "hello HC-08";
pRemoteCharacteristic->writeValue(xStr.c_str(), xStr.length());
}
std::string value = pRemoteCharacteristic->readValue();
Serial.print("The characteristic value was: ");
Serial.println(value.c_str());
```
功能有这样的:canWriteNoResponse
难道不过上述的数据发送方式不对吗