Android Question Newbie questions on IDE, Libraries and BLE

tseyfarth

Member
Licensed User
Longtime User
Hello all!

I've been programming for many many years but this is the first time using B4A or any of the Anywhere Software's products. I have a couple of questions I am hoping to get some clarity on:
I have started off using the BLEExample that works, connecting to my Bluetooth LE module. However, I need to add the capability of sending a message, in text, to the device.

1 - Looking over and working with this sample, and a few others on BLE, I cannot find out where to get the documentation on the BLE2 library so I cannot seem to figure out what functions are there, and how to use them properly. This is specific, but the same question really applies to all libraries.

2 - Is there a resource that has all of the functions etc in one place that can be reviewed? Please see below.

3 - What I *think* I need to do is to just add a field for entering the text to send, and a button to send it. That part was easy. But the *complicated* part is "how" to send it and in what form?

I have this code, but I get an error on compiling-

Error description: Cannot cast type: {Type=String,Rank=0, RemoteObject=True} to: {Type=Byte,Rank=1, RemoteObject=True}
Error occurred on line: 215
manager.WriteData(ConnectedName,charId, msg)
Word: msg

SendMessage:
Public Sub SendMessage (msg As String)
    manager.WriteData(ConnectedName,charId, msg)
End Sub

OK, so how to correct? It looks like it wants msg to be in byte format, how to convert? Is there a resource that has all of the functions etc in one place that can be reviewed?

Finally, any other tutorials or sample code to help get me going would be really appreciated. BTW, I did watch most of the videos - they have been helpful.

Thank you,
Tim
 

agraham

Expert
Licensed User
Longtime User
It looks like it wants msg to be in byte format, how to convert?
Use the ByteConverter library.

2 - Is there a resource that has all of the functions etc in one place that can be reviewed? Please see below.
Down at the bottom of the first post get the latest version
B4X Object Browser
The latest B4x Version is available from here. AutoUpdate will take over from that point.

Also
 
Upvote 0

tseyfarth

Member
Licensed User
Longtime User
Hello Agraham.

Thank you for your suggestions, I appreciate your response. Those tools really help make it easier.

Tim
 
Upvote 0
Top