AppJCenterBluetoothSPPDemo1 and JDY-31 lazarus / 43-Android ---------------------------------------------------------------------- shyub · 2020-08-29 07:32 The example "AppJCenterBluetoothSPPDemo1" given in "lazandroidmodulewizard-master.zip" does not start on my Android-0.6. I did not change anything in it, I compiled it as it is. I check the performance of the phone and the JDY-31 using the third- party application "S2 Terminal for Bluetooth Free_v4.0.3_apkpure.com.apk" - everything works great. If anyone has the opportunity, please check the functionality of this example. ---------------------------------------------------------------------- shyub · 2020-08-29 10:01 Sorry... In jButton1Click, AndroidModule1JNIPrompt and AndroidModule1ActivityResult, I uncommented the procedures focused on working with the microcontroller and everything worked. Only one thing is not clear: why does the version "*** debug.apk" work on the phone, and the version "*** release-unsigned.apk" gives an error during installation? ---------------------------------------------------------------------- shyub · 2020-08-29 13:19 Another nuisance appeared: The ModbusRTU protocol can hardly be used when communicating via Bluetooth. The fact is that the HEX symbols 0x0D, 0x0A are used to indicate the end of the reception. Thus, if I send a combination from the controller: 0x01, 0x02, 0x03, then the jcBluetoothSPP event of the OnDataReceived component does not occur. If the controller sends something like: 0x01, 0x02, 0x03, 0x0D, 0x0A, 0x04, 0x05, 0x06, 0x0D, 0x0A, 0x07, 0x08, then the phone receives 0x04, 0x05, 0x06. Accordingly, the exchange should be carried out only in ASCII encoding ... ---------------------------------------------------------------------- Segator · 2020-08-29 13:55 Quote from: shyub on August 29, 2020, 12:01:02 pmSorry... In jButton1Click, AndroidModule1JNIPrompt and AndroidModule1ActivityResult, I uncommented the procedures focused on working with the microcontroller and everything worked. Only one thing is not clear: why does the version "*** debug.apk" work on the phone, and the version "*** release-unsigned.apk" gives an error during installation? you can't install or update app with the same package name and thiferent signed, the release is signed, the debug not, you must uninstall one to install the other. ---------------------------------------------------------------------- shyub · 2020-08-29 14:05 I delete the old one before installing. When installing Realise, a message appears: "The application is not installed." I opened a new topic above about this. ---------------------------------------------------------------------- jmpessoa · 2020-08-29 18:35 QuoteAnother nuisance appeared: The ModbusRTU protocol can hardly be used when communicating via Bluetooth. The fact is that the HEX symbols 0x0D, 0x0A are used to indicate the end of the reception. Thus, if I send a combination from the controller: 0x01, 0x02, 0x03, then the jcBluetoothSPP event of the OnDataReceived component does not occur. If the controller sends something like: 0x01, 0x02, 0x03, 0x0D, 0x0A, 0x04, 0x05, 0x06, 0x0D, 0x0A, 0x07, 0x08, then the phone receives 0x04, 0x05, 0x06. Accordingly, the exchange should be carried out only in ASCII encoding ... Please, can you put some suggestion to fix this issue? ---------------------------------------------------------------------- shyub · 2020-08-29 19:11 My qualifications are unlikely to allow solving this at the program level, but the idea could be like this: if the Bluetooth receive buffer detects the combination 0x0D, 0x0A, it means that somewhere there is also information that something has arrived in the buffer. You can set a timer that will start when each character is received in this buffer, say for 5 milliseconds. If nothing else arrives within 5 milliseconds, the "buffer contains information" event occurs. The delay of 5-10 ms is not critical, because devices working with ModbusRTU wait for a response within 50 milliseconds. The second option is how the OnRxChar event is done in the Cportlaz_v1.0.0 component, which occurs when the reception of a character or a group of characters ends.