I just complete a port of OpenCatEsp32 to the M5Stack Core2, and most everything is working correctly. Since I am using the Nybble hardware design, it advertised the bluetooth connection as "Nybble54_SSP" and my iPhone 12 is reporting is correctly. I quickly realized that the IOS app will not work unless the advertised name contains "Bittle or Petoi" so I updated the name to be Bittle. I get the following message:
The device doesn't seem to be a Petoi robot.
I have confirmed that the call
SerialBT.begin(strcat(readBleID(), "_SSP")); //Bluetooth device name
is now passing "Bittle6E_SSP" to the SerialBT.begin(); method. However, in the Petoi IOS, I still see the device showing up as "Nybble54_SSP" no matter what I seem to do. I have deleted the Petoi IOS app and cleared its data, I have turned off bluetooth on both the Petoi app and the iPhone and back on again. I have tried using new UUIDs for the bluetooth system, RX and TX and recompiling and I cannot seem to get the device to advertise to anything other than "Nybble54_SSP". When I was trying to figure out the issue, early on; I also connected with my iPad (before I realized that I needed to include "Bittle" or "Petoi" in the name and it has an advertised name of "Nybble1B_SSP" that is also not changing. I can confirm that if I turn the M5Stack Core2 off, the device goes away on the iPhone and iPad.
I don't know if there is a way to force a new advertised name (if so, I have not found it), or if there is some way to get an IOS device to forget the advertised name, as it seems to be cached somehow.
Any help would be greatly appreciated!
Thanks!
Issue resolved. The Testflight version of the Petoi iOS software solved the issue and worked correctly with the M5Stack ported code (based on ESP32 based BiBoard) without modification to the released BiBoard BLE portion of the code. Thanks to Rongzhong Li for the quick response and access to the TestFliight version of the Petoi App!
Another Update.
The bluetooth interrogation program I was using would only tell you there was a notification available, but would not allow you to subscribe to it. I found another BLE App (BlueSee) that allows you to subscribe to BLE notification channels. By adding in the commented code that loops the initial notify and changing it to 3 attempts and 1000ms between attempts, I was able to physically see the "Petoi Bittle" notification come in on the notify channel (I did this since the tool I used required me to manually subscribe to the notify each time I connected). See code snippet below:
for (byte i = 0; i < CONNECTION_ATTEMPT; i++) {// send the keywords a few times on connection so that the app knows it's a Petoi device pTxCharacteristic->setValue("Petoi Bittle"); //pTxCharacteristic->setValue("Bittle"); pTxCharacteristic->notify(); delay(1000); }
I also noted that the commands sent to the RX Characteristic are indeed echoed on the TX Characteristic notify channel once you have subscribed to it. So, I am guessing that the updated IOS TestFlight APP will resolve the issues I am seeing with the older APP. I will let you know how it goes once I receive the APP. I hope this information is useful!
Thanks so much!
Update, I just used my daughter's iPhone to attempt to connect to the device and it correctly showed the new advertised name of "Bittle6E_SSP". However, it still does not connect and reports the same error code:
The device doesn't seem to be a Petoi robot.
Upon connection the current ESP code send "Bittle" to the IOS app per the code below.
if (deviceConnected && !oldDeviceConnected) { // do stuff here on connecting Serial.println("Bluetooth connected!"); oldDeviceConnected = deviceConnected; delay(HOLD_TIME); // for (byte i = 0; i < CONNECTION_ATTEMPT; i++) {// send the keywords a few times on connection so that the app knows it's a Petoi device //pTxCharacteristic->setValue("Petoi Bittle"); pTxCharacteristic->setValue("Bittle"); pTxCharacteristic->notify(); // delay(100); //}
Is this correctly in sync with what the IOS app is expecting to be sent after connection? Thanks!