B4J Question [SOlved] Brainboxes BL-819 RS232 to Bluetooth

Mark Read

Well-Known Member
Licensed User
Longtime User
Continuing the thread I started here : https://www.b4x.com/android/forum/threads/brainboxes-bl-819-rs232-to-bluetooth.62572/

I have tried in B4A to get this working but my Tablet (Galaxy Tab 2) has great problems pairing, so I have gone back to my RPi.

This is what I have so far:

RPi with the B4J program below.
A Brainbox BL-819 directly connected to my sensor (yes its the Windsonic yet again, never did solve the RS232 to USB RPi problem).

A log output without and with the bluecove.debug activated.

What happens. I get the connection and the stream is opened but the astream_newdata is never called.
I thought there might be some other problem so I downloaded the SENA app and tried on my tablet - super, the data is coming every second.

Something I am missing.

Hoping for a simple mistake.

BlueCove version 2.1.1-SNAPSHOT on bluez
***********************************************************
My address: 00:1A:7D:DA:71:0F
***********************************************************
searching for devices..
***********************************************************
***********************************************************
Found device: Brainboxes RS232 Adapter: 000A4F01360A
***********************************************************
***********************************************************
Discovery finished
Trying to connect to Brainboxes RS232 Adapter: 000A4F01360A
***********************************************************
***********************************************************
Connected to: Brainboxes RS232 Adapter - 000A4F01360A
***********************************************************
Connecting to serial
Stream open: true
***********************************************************

15:13:08.149 Java 1.4+ detected: 1.8.0; Java HotSpot(TM) Client VM; Oracle Corporation
com.intel.bluetooth.UtilsJavaSE.getLocation(UtilsJavaSE.java:121)
15:13:08.236 Use stack ClassLoader
com.intel.bluetooth.NativeLibLoader.loadAsSystemResource(NativeLibLoader.java:358)
15:13:08.259 set dll dir /tmp/bluecove_root_0
com.intel.bluetooth.NativeLibLoader.makeTempName(NativeLibLoader.java:501)
15:13:08.277 Library loaded from /tmp/bluecove_root_0/libbluecove_arm.so
com.intel.bluetooth.NativeLibLoader.loadAsSystemResource(NativeLibLoader.java:401)
15:13:08.280 BluetoothStack selected bluez
com.intel.bluetooth.BlueCoveImpl.detectStack(BlueCoveImpl.java:515)
15:13:08.283 nativeDebugCallback ON
common.c:49
15:13:08.287 localDeviceID 0
com.intel.bluetooth.BluetoothStackBlueZ.initialize(BluetoothStackBlueZ.java:154)
BlueCove version 2.1.1-SNAPSHOT on bluez
***********************************************************
My address: 00:1A:7D:DA:71:0F
***********************************************************
searching for devices..
***********************************************************
15:13:08.434 deviceInquiryStartedCallback
com.intel.bluetooth.DeviceInquiryThread.deviceInquiryStartedCallback(DeviceInquiryThread.java:124)
15:13:08.436 startInquiry return true
com.intel.bluetooth.DeviceInquiryThread.startInquiry(DeviceInquiryThread.java:90)
15:13:08.470 open using BlueCove javax.microedition.io.Connector
javax.microedition.io.Connector.open(Connector.java:82)
15:13:08.480 connecting btspp://localhost:0000110100001000800000805f9b34fb;name=b4j;authenticate=false;encrypt=false;
com.intel.bluetooth.MicroeditionConnector.openImpl(MicroeditionConnector.java:161)
15:13:08.531 created SDPSession 25257952
com.intel.bluetooth.BluetoothStackBlueZ.getSDPSession(BluetoothStackBlueZ.java:519)
15:13:08.550 BlueZ major verion 4 detected
BlueCoveBlueZ_SDPServer.c:94
15:13:08.551 function sdp_extract_pdu of bluez major version 4 is called
BlueCoveBlueZ_SDPServer.c:106
15:13:08.553 pdu scanned 46 -> 46
BlueCoveBlueZ_SDPServer.c:72
15:13:18.713 new RemoteDevice 000A4F01360A
javax.bluetooth.RemoteDevice.<init>(RemoteDevice.java:85)
15:13:18.716 new devicesCashed 0xa4f01360a
com.intel.bluetooth.RemoteDeviceHelper.createRemoteDevice(RemoteDeviceHelper.java:365)
15:13:18.719 new DeviceClass 1280
javax.bluetooth.DeviceClass.<init>(DeviceClass.java:89)
15:13:18.720 deviceDiscoveredCallback address 000A4F01360A
com.intel.bluetooth.BluetoothStackBlueZ$1.deviceDiscoveredCallback(BluetoothStackBlueZ.java:411)
15:13:18.730 deviceDiscoveredCallback deviceClass Peripheral/()/Unclassified/()
com.intel.bluetooth.BluetoothStackBlueZ$1.deviceDiscoveredCallback(BluetoothStackBlueZ.java:412)
***********************************************************
Found device: Brainboxes RS232 Adapter: 000A4F01360A
***********************************************************
15:13:21.461 runDeviceInquiry ends
com.intel.bluetooth.DeviceInquiryThread.run(DeviceInquiryThread.java:115)
***********************************************************
Discovery finished
Trying to connect to Brainboxes RS232 Adapter: 000A4F01360A
***********************************************************
15:13:21.596 searchServicesStartedCallback 1
com.intel.bluetooth.SearchServicesThread.searchServicesStartedCallback(SearchServicesThread.java:174)
15:13:21.599 runSearchServicesImpl uuidSetSize 1
BlueCoveBlueZ_SDPQuery.c:55
15:13:23.183 runSearchServicesImpl session 0x16e92f0 0
BlueCoveBlueZ_SDPQuery.c:86
15:13:23.184 runSearchServicesImpl serviceRecordHandle 65536
BlueCoveBlueZ_SDPQuery.c:93
15:13:23.186 populateServiceRecordAttributeValuesImpl connected 0x16e92f0, recordHandle 0
BlueCoveBlueZ_SDPQuery.c:120
15:13:23.237 populateServiceRecord
BlueCoveBlueZ_SDPQuery.c:458
15:13:23.238 createDataElement 0xa
BlueCoveBlueZ_SDPQuery.c:206
15:13:23.239 dataElement created 0xa
BlueCoveBlueZ_SDPQuery.c:448
15:13:23.240 createDataElement 0x35
BlueCoveBlueZ_SDPQuery.c:206
15:13:23.242 SDP_SEQ
BlueCoveBlueZ_SDPQuery.c:392
15:13:23.243 createDataElement 0x19
BlueCoveBlueZ_SDPQuery.c:206
15:13:23.244 SDP_UUID
BlueCoveBlueZ_SDPQuery.c:374
15:13:23.245 dataElement created 0x19
BlueCoveBlueZ_SDPQuery.c:448
15:13:23.246 dataElement created 0x35
BlueCoveBlueZ_SDPQuery.c:448
15:13:23.247 createDataElement 0x35
BlueCoveBlueZ_SDPQuery.c:206
15:13:23.248 SDP_SEQ
BlueCoveBlueZ_SDPQuery.c:392
15:13:23.248 createDataElement 0x35
BlueCoveBlueZ_SDPQuery.c:206
15:13:23.249 SDP_SEQ
BlueCoveBlueZ_SDPQuery.c:392
15:13:23.250 createDataElement 0x19
BlueCoveBlueZ_SDPQuery.c:206
15:13:23.251 SDP_UUID
BlueCoveBlueZ_SDPQuery.c:374
15:13:23.252 dataElement created 0x19
BlueCoveBlueZ_SDPQuery.c:448
15:13:23.253 dataElement created 0x35
BlueCoveBlueZ_SDPQuery.c:448
15:13:23.254 createDataElement 0x35
BlueCoveBlueZ_SDPQuery.c:206
15:13:23.255 SDP_SEQ
BlueCoveBlueZ_SDPQuery.c:392
15:13:23.256 createDataElement 0x19
BlueCoveBlueZ_SDPQuery.c:206
15:13:23.257 SDP_UUID
BlueCoveBlueZ_SDPQuery.c:374
15:13:23.259 dataElement created 0x19
BlueCoveBlueZ_SDPQuery.c:448
15:13:23.260 createDataElement 0x8
BlueCoveBlueZ_SDPQuery.c:206
15:13:23.261 dataElement created 0x8
BlueCoveBlueZ_SDPQuery.c:448
15:13:23.262 dataElement created 0x35
BlueCoveBlueZ_SDPQuery.c:448
15:13:23.262 dataElement created 0x35
BlueCoveBlueZ_SDPQuery.c:448
15:13:23.263 attrCount 3
BlueCoveBlueZ_SDPQuery.c:482
15:13:23.264 runSearchServicesImpl serviceRecordHandle 65537
BlueCoveBlueZ_SDPQuery.c:93
15:13:23.265 populateServiceRecordAttributeValuesImpl connected 0x16e92f0, recordHandle 1987380440
BlueCoveBlueZ_SDPQuery.c:120
15:13:23.306 populateServiceRecord
BlueCoveBlueZ_SDPQuery.c:458
15:13:23.307 createDataElement 0xa
BlueCoveBlueZ_SDPQuery.c:206
15:13:23.308 dataElement created 0xa
BlueCoveBlueZ_SDPQuery.c:448
15:13:23.309 createDataElement 0x35
BlueCoveBlueZ_SDPQuery.c:206
15:13:23.310 SDP_SEQ
BlueCoveBlueZ_SDPQuery.c:392
15:13:23.311 createDataElement 0x19
BlueCoveBlueZ_SDPQuery.c:206
15:13:23.312 SDP_UUID
BlueCoveBlueZ_SDPQuery.c:374
15:13:23.313 dataElement created 0x19
BlueCoveBlueZ_SDPQuery.c:448
15:13:23.314 dataElement created 0x35
BlueCoveBlueZ_SDPQuery.c:448
15:13:23.315 createDataElement 0x35
BlueCoveBlueZ_SDPQuery.c:206
15:13:23.316 SDP_SEQ
BlueCoveBlueZ_SDPQuery.c:392
15:13:23.317 createDataElement 0x35
BlueCoveBlueZ_SDPQuery.c:206
15:13:23.317 SDP_SEQ
BlueCoveBlueZ_SDPQuery.c:392
15:13:23.319 createDataElement 0x19
BlueCoveBlueZ_SDPQuery.c:206
15:13:23.320 SDP_UUID
BlueCoveBlueZ_SDPQuery.c:374
15:13:23.322 dataElement created 0x19
BlueCoveBlueZ_SDPQuery.c:448
15:13:23.323 dataElement created 0x35
BlueCoveBlueZ_SDPQuery.c:448
15:13:23.324 createDataElement 0x35
BlueCoveBlueZ_SDPQuery.c:206
15:13:23.325 SDP_SEQ
BlueCoveBlueZ_SDPQuery.c:392
15:13:23.326 createDataElement 0x19
BlueCoveBlueZ_SDPQuery.c:206
15:13:23.327 SDP_UUID
BlueCoveBlueZ_SDPQuery.c:374
15:13:23.328 dataElement created 0x19
BlueCoveBlueZ_SDPQuery.c:448
15:13:23.329 createDataElement 0x8
BlueCoveBlueZ_SDPQuery.c:206
15:13:23.330 dataElement created 0x8
BlueCoveBlueZ_SDPQuery.c:448
15:13:23.331 dataElement created 0x35
BlueCoveBlueZ_SDPQuery.c:448
15:13:23.332 dataElement created 0x35
BlueCoveBlueZ_SDPQuery.c:448
15:13:23.332 attrCount 3
BlueCoveBlueZ_SDPQuery.c:482
15:13:23.333 runSearchServicesImpl found 2
BlueCoveBlueZ_SDPQuery.c:104
15:13:23.335 SearchServices finished 1
com.intel.bluetooth.BluetoothStackBlueZ$2.runSearchServices(BluetoothStackBlueZ.java:459)
15:13:23.337 open using BlueCove javax.microedition.io.Connector
javax.microedition.io.Connector.open(Connector.java:82)
15:13:23.339 connecting btspp://000A4F01360A:1;authenticate=false;encrypt=false;master=false
com.intel.bluetooth.MicroeditionConnector.openImpl(MicroeditionConnector.java:161)
15:13:23.363 RFCOMM connect, channel 1
BlueCoveBlueZ_RFCOMM.c:31
15:13:23.815 RFCOMM connected, handle 8
BlueCoveBlueZ_RFCOMM.c:98
15:13:23.827 connection open, open now 1
com.intel.bluetooth.RemoteDeviceHelper$RemoteDeviceWithExtendedInfo.addConnection(RemoteDeviceHelper.java:87)
***********************************************************
Connected to: Brainboxes RS232 Adapter - 000A4F01360A
***********************************************************
Connecting to asyncStream
15:13:23.831 runSearchServices ends 1
com.intel.bluetooth.SearchServicesThread.run(SearchServicesThread.java:159)
15:13:23.851 no data available for read
BlueCoveBlueZ_RFCOMM.c:152
Stream connected: true
***********************************************************
15:13:23.862 closing ConnectionNotifier 9
com.intel.bluetooth.BluetoothConnectionNotifierBase.shutdown(BluetoothConnectionNotifierBase.java:126)
15:13:23.877 closeSDPSession 25257952
com.intel.bluetooth.BluetoothStackBlueZ.unregisterSDPRecord(BluetoothStackBlueZ.java:560)
15:13:23.881 RFCOMM close server handle 9
BlueCoveBlueZ_RFCOMMServer.c:137
15:13:23.894 open using BlueCove javax.microedition.io.Connector
javax.microedition.io.Connector.open(Connector.java:82)
15:13:23.896 connecting btspp://localhost:0000110100001000800000805f9b34fb;name=b4j;authenticate=false;encrypt=false;
com.intel.bluetooth.MicroeditionConnector.openImpl(MicroeditionConnector.java:161)
15:13:23.898 created SDPSession 25257952
com.intel.bluetooth.BluetoothStackBlueZ.getSDPSession(BluetoothStackBlueZ.java:519)
15:13:23.907 BlueZ major verion 4 detected
BlueCoveBlueZ_SDPServer.c:94
15:13:23.908 function sdp_extract_pdu of bluez major version 4 is called
BlueCoveBlueZ_SDPServer.c:106
15:13:23.909 pdu scanned 46 -> 46
BlueCoveBlueZ_SDPServer.c:72
 

Attachments

  • BL-819.zip
    1.6 KB · Views: 392

Mark Read

Well-Known Member
Licensed User
Longtime User
Removed the bt.listen and it works. Many thanks.

A small problem is that the data is split into 10 byte pieces but I have a workaround for that.

Now to try and get the same thing working on my tablet with B4A.
 
Upvote 0
Top