From what I understand this device has bluetooth connection, have you tried connecting to it via BLE, you should be able to implement the same code from the python script in B4A.Does anyone here use the Bosch GLM50C or similar?
I would like to make a small app where only the measurement data is transmitted and displayed via BLE.
Does anyone have something like this running?
I have only found the Python code so far.
BOSCH-GLM-rangefinder/glm100c.py at master · philipptrenz/BOSCH-GLM-rangefinder
Python script to remote control a BOSCH GLM 100C rangefinder via its Bluetooth serial interface - philipptrenz/BOSCH-GLM-rangefindergithub.com
Try the Bluetooth classic library instead, not the BLE.Yes, I have. I use this example program.
As soon as a connection is established, the connection is terminated.
[B4X] BLE 2 - Bluetooth Low Energy
This library replaces the previous BLE library. It is simpler to use and it is more powerful. Its API is based on B4i iBLE library which makes it easy to reuse B4i code. See the iBLE tutorial: https://www.b4x.com/android/forum/threads/ble-bluetooth-low-energy-library.46099/#content Tips &...www.b4x.com
Try the Bluetooth classic library instead, not the BLE.
'Public Sub SendMessage (msg As String)
' AStream.Write(msg.GetBytes("utf8"))
'End Sub
Public Sub SendCommand (cmd() As Byte)
AStream.Write(cmd)
End Sub
Dim BacklightOn() As Byte = Array As Byte(0xC0, 0x47, 0x00, 0x20)
Dim BacklightOff() As Byte = Array As Byte(0xC0, 0x48, 0x00, 0x62)
Do While True
SendCommand(BacklightOn)
Sleep(2000)
SendCommand(BacklightOff)
Sleep(2000)
Loop
Maybe this one?Do you have a link to it?
Does the Device not come with a manual?The only question is, how do I get the measurement data?
have you tried to log what you get in the asyncstream newdata event after you started a Distancecalculation?but not how to get the measurement data
Private Sub AStream_NewData (Buffer() As Byte)
' LOG the Buffer-Data to get inspired
End Sub
how do I get the measurement data?
how do I get the measurement data?
'measure': b'\xC0\x40\x00\xEE',
def measure(self):
self.socket.send(self.cmds['measure'])
data = self.socket.recv(1024)
#print('received:', data)
if self.status[data[0]] is 'ok':
try:
# distance to object from top of device
distance = int(struct.unpack("<L", data[2:6])[0])*0.05
#print(distance, 'mm')
Sub AStreams1_NewData(Buffer() As Byte)
Dim bc As ByteConverter
Log(bc.HexFromBytes(Buffer))
End Sub
BytesToString(Buffer, 0, Buffer.Length, "UTF8")
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?