Can App Inventor send binary data to a device via BLE?

I want to perform host/device communication like attached document...
However, the blocks above does not work that way. Can anyone tell me where the problem is?

What does a device actually look like when it sends a "write byte" like an attachment block?
Can anyone please tell me?

serviceUuid: 6e400001-b5a3-f393-e0a9-e50e24dcca9e
CharacteristicUuid: 6e400003-b5a3-f393-e0a9-e50e24dcca9e
Signed: false
Value: ox53 1

BLE1

Hello Noguchi

Can you tell us exactly what device you are sending to and what the command being sent does?

When you tell us the send did not work, how are you identifying the failure - does the device have a terminal attached that can show error messages?

Is the device programmable? Must it be programmed to receive the command you are sending?

Thank you for your reply.

Q: Can you tell us exactly what device you are sending to and what the command being sent does?
A: Please refer to the attached document for sending and receiving commands.
document: https://drive.google.com/file/d/1BJ0lUJGQBflrthEQNTwYh9Iw6JUjqLnU/view?usp=sharing

device: 

device

Q: When you tell us the send did not work, how are you identifying the failure - does the device have a terminal attached that can show error messages?
A: No response from device.

Q: Is the device programmable? Must it be programmed to receive the command you are sending?
A: Yes
The transmission/reception program on the device side has already been completed, and is operating normally on the PC emulator(Refer to attached document).

Hi

So can we see your Script for the device? Just because it works with a PC emulator (emulating what exactly?) does not mean it's 100% compatible with your Android Device.

What is your Android device? Make/Model/Android version.

The documentation is vast - we just need straight answers to straight questions. Please tell us what the command is supposed to do and indeed what the device does.

  1. RRBLE device & PC emulator infomation
    The information about the device and PC emulator received from the client is only the above attached device image and document.

  2. Android device information
    Maker: OPPO
    Device Name: OPPO A5 2020
    Android version: 9

  3. Command execution
    According to the documentation
    When you send the binary data of 'S' + 0x01 from the Android device to the RRBLE device side, the response of '5301E09304000b02BC020000000" will be returned from the RRBLE device side to the Android device.

Right - there is nothing set in your Blocks to receive that data, it's not a string?

  1. Need to remove all the redundant Blocks (Blocks that either send or receive strings)
  2. After the connection is established (before Send), add a Register For Bytes Block, signed = false. This will collect data whenever it is sent to the Android device.
    Use a Bytes Received Block to handle the data received.

All blocks are above (yesterday).

https://community.appinventor.mit.edu/uploads/default/original/3X/6/5/657f8ce69f05776ba33df859bde280f5911c23fe.png

Attachment 1: Communication specifications between BLE device and Android device.

Attachment 2: The blocks created based on the specifications of Attachment 1.

Question: Are the serviceUuid and characteristicUuid settings in the attached blocks correct?
The specifications of Attachment 1 are serviceUuid and characteristicUuid
It is a hexadecimal number.
Is it necessary to change this to ASCII code (?) when setting in block?

Can anyone please tell me?

Attachment 1:


Attachment 2:
BLE Check2 block

Try nRF Connect app, with this app you can send values to your device.

Try send directly 53 and 01

ble53

Thank you for your reply.
The attached blocks that I created based on your app.
When I execute WriteBytes, there is no response or error from the device.
Is there a problem with Characteristic Uuid settings?

Have you tried the nRF app?

Have you tried this block?

Try

I also tried sending (53 1) using WriteBytes, but the same result: no response or error returned from the device.

I also tried sending (83 1) using WriteBytes, but the same result: no response or error returned from the device.

He wants to send 'S' = 0x53 = decimal 83

Hexadecimal (0x53 1) and decimal (83 1) give the same result.
I suspect there is a problem with the Characteristic Uuid settings. Can you please check it?

Properties of "TX CharacteristicUuid 6e400003-b5a3-f393-e0a9-e50e24dcca9e" is NOTIFY".
Is it possible to read device data using readBytes or registerFoBytes?

I don't know what the READ code is on your device, so I suggested that you send
53,1

For example in this code made for HM-10 and Arduino IDE, send 53,1 and receive:
53
1

Try send values from nRF app, click arrow...

I've solved the problem with a lot of advice from everyone.
Thank you very much.

Executing the EnableBluetooth block after the Connected event now returns the response from the device.

I am sorry that I overlooked the execution of EnableBluetooth and made a fuss.

Thanks for telling us what worked.

Never let a good mistake go to waste.

1 Like