Bluetooth mangoH yellow launch

I downloaded the last firmware 0.6.0 but my version bluez is still 5.50 and not 5.52. Anyway, I am not sure it is the origin of my problem.

Concerning your previous message :“I looks like not all functions in bluetoothctl work on the yellow. The connect function is classic Bluetooth and it does not appear to work.” Do you mean it is normal that it doesn’t work but the BLE apps can work even if devices are not connected? Could you try to make a connect to one your device please and let me know if it works?

BLE doesn’t connect the way Bluetooth Classic does, it’s a different protocol in many respects. So connect working (or not working) on one does not apply to the other. Using bluetoothctl I get different errors trying to connect from either side:

Ubuntu->mangOH
[bluetooth]# connect 3C:E1:A1:E8:B6:E1
Attempting to connect to 3C:E1:A1:E8:B6:E1
Failed to connect: org.bluez.Error.Failed
[bluetooth]# 

mangoh->Ubuntu
[bluetooth]# connect 5C:F3:70:98:69:EC
Device 5C:F3:70:98:69:EC not available
[bluetooth]# 

Here is gatttool on Ubuntu connecting to my application on the mangOH yellow using BLE:

paul@paul-ThinkCentre-M72e:~$ sudo gatttool -b 3C:E1:A1:E8:B6:E1 -I
[3C:E1:A1:E8:B6:E1][LE]> connect
Attempting to connect to 3C:E1:A1:E8:B6:E1
Connection successful
[3C:E1:A1:E8:B6:E1][LE]> primary
attr handle: 0x0001, end grp handle: 0x0005 uuid: 00001800-0000-1000-8000-00805f9b34fb
attr handle: 0x0006, end grp handle: 0x000d uuid: 00001801-0000-1000-8000-00805f9b34fb
attr handle: 0x000e, end grp handle: 0x0013 uuid: 6e400001-b5a3-f393-e0a9-e50e24dcca9e
[3C:E1:A1:E8:B6:E1][LE]> char-desc
handle: 0x0001, uuid: 00002800-0000-1000-8000-00805f9b34fb
handle: 0x0002, uuid: 00002803-0000-1000-8000-00805f9b34fb
handle: 0x0003, uuid: 00002a00-0000-1000-8000-00805f9b34fb
handle: 0x0004, uuid: 00002803-0000-1000-8000-00805f9b34fb
handle: 0x0005, uuid: 00002a01-0000-1000-8000-00805f9b34fb
handle: 0x0006, uuid: 00002800-0000-1000-8000-00805f9b34fb
handle: 0x0007, uuid: 00002803-0000-1000-8000-00805f9b34fb
handle: 0x0008, uuid: 00002a05-0000-1000-8000-00805f9b34fb
handle: 0x0009, uuid: 00002902-0000-1000-8000-00805f9b34fb
handle: 0x000a, uuid: 00002803-0000-1000-8000-00805f9b34fb
handle: 0x000b, uuid: 00002b29-0000-1000-8000-00805f9b34fb
handle: 0x000c, uuid: 00002803-0000-1000-8000-00805f9b34fb
handle: 0x000d, uuid: 00002b2a-0000-1000-8000-00805f9b34fb
handle: 0x000e, uuid: 00002800-0000-1000-8000-00805f9b34fb
handle: 0x000f, uuid: 00002803-0000-1000-8000-00805f9b34fb
handle: 0x0010, uuid: 6e400003-b5a3-f393-e0a9-e50e24dcca9e
handle: 0x0011, uuid: 00002902-0000-1000-8000-00805f9b34fb
handle: 0x0012, uuid: 00002803-0000-1000-8000-00805f9b34fb
handle: 0x0013, uuid: 6e400002-b5a3-f393-e0a9-e50e24dcca9e
[3C:E1:A1:E8:B6:E1][LE]> 

btgatt-client connecting to same application:

paul@paul-ThinkCentre-M72e:~/bluez-5.50/tools$ ./btgatt-client -d 3C:E1:A1:E8:B6:E1
Connecting to device... Done
[GATT client]# Service Added - UUID: 00001800-0000-1000-8000-00805f9b34fb start: 0x0001 end: 0x0005
[GATT client]# Service Added - UUID: 00001801-0000-1000-8000-00805f9b34fb start: 0x0006 end: 0x000d
[GATT client]# Service Added - UUID: 6e400001-b5a3-f393-e0a9-e50e24dcca9e start: 0x000e end: 0x0013
[GATT client]# GATT discovery procedures complete
[GATT client]# 
service - start: 0x0001, end: 0x0005, type: primary, uuid: 00001800-0000-1000-8000-00805f9b34fb
	  charac - start: 0x0002, value: 0x0003, props: 0x02, ext_props: 0x0000, uuid: 00002a00-0000-1000-8000-00805f9b34fb
	  charac - start: 0x0004, value: 0x0005, props: 0x02, ext_props: 0x0000, uuid: 00002a01-0000-1000-8000-00805f9b34fb

service - start: 0x0006, end: 0x000d, type: primary, uuid: 00001801-0000-1000-8000-00805f9b34fb
	  charac - start: 0x0007, value: 0x0008, props: 0x20, ext_props: 0x0000, uuid: 00002a05-0000-1000-8000-00805f9b34fb
		  descr - handle: 0x0009, uuid: 00002902-0000-1000-8000-00805f9b34fb
	  charac - start: 0x000a, value: 0x000b, props: 0x0a, ext_props: 0x0000, uuid: 00002b29-0000-1000-8000-00805f9b34fb
	  charac - start: 0x000c, value: 0x000d, props: 0x02, ext_props: 0x0000, uuid: 00002b2a-0000-1000-8000-00805f9b34fb

service - start: 0x000e, end: 0x0013, type: primary, uuid: 6e400001-b5a3-f393-e0a9-e50e24dcca9e
	  charac - start: 0x000f, value: 0x0010, props: 0x10, ext_props: 0x0000, uuid: 6e400003-b5a3-f393-e0a9-e50e24dcca9e
		  descr - handle: 0x0011, uuid: 00002902-0000-1000-8000-00805f9b34fb
	  charac - start: 0x0012, value: 0x0013, props: 0x08, ext_props: 0x0000, uuid: 6e400002-b5a3-f393-e0a9-e50e24dcca9e

[GATT client]# 

Well, thanks. I will try. Also, my application bluetoothServices is stopped and I cannot start it. I guess it is normal?

gatttool connecting to bluetoothServices. I have found that sometimes it terminates due to a registration timeout but if you power cycle the mangOH it’s ok.

paul@paul-ThinkCentre-M72e:~/bluez-5.50/tools$ sudo gatttool -b 3C:E1:A1:E8:B6:E1 -I
[3C:E1:A1:E8:B6:E1][LE]> connect
Attempting to connect to 3C:E1:A1:E8:B6:E1
Connection successful
[3C:E1:A1:E8:B6:E1][LE]> primary
attr handle: 0x0001, end grp handle: 0x0005 uuid: 00001800-0000-1000-8000-00805f9b34fb
attr handle: 0x0006, end grp handle: 0x000d uuid: 00001801-0000-1000-8000-00805f9b34fb
attr handle: 0x000e, end grp handle: 0x0011 uuid: 0000180f-0000-1000-8000-00805f9b34fb
attr handle: 0x0012, end grp handle: 0x0014 uuid: 00001802-0000-1000-8000-00805f9b34fb
[3C:E1:A1:E8:B6:E1][LE]> char-desc
handle: 0x0001, uuid: 00002800-0000-1000-8000-00805f9b34fb
handle: 0x0002, uuid: 00002803-0000-1000-8000-00805f9b34fb
handle: 0x0003, uuid: 00002a00-0000-1000-8000-00805f9b34fb
handle: 0x0004, uuid: 00002803-0000-1000-8000-00805f9b34fb
handle: 0x0005, uuid: 00002a01-0000-1000-8000-00805f9b34fb
handle: 0x0006, uuid: 00002800-0000-1000-8000-00805f9b34fb
handle: 0x0007, uuid: 00002803-0000-1000-8000-00805f9b34fb
handle: 0x0008, uuid: 00002a05-0000-1000-8000-00805f9b34fb
handle: 0x0009, uuid: 00002902-0000-1000-8000-00805f9b34fb
handle: 0x000a, uuid: 00002803-0000-1000-8000-00805f9b34fb
handle: 0x000b, uuid: 00002b29-0000-1000-8000-00805f9b34fb
handle: 0x000c, uuid: 00002803-0000-1000-8000-00805f9b34fb
handle: 0x000d, uuid: 00002b2a-0000-1000-8000-00805f9b34fb
handle: 0x000e, uuid: 00002800-0000-1000-8000-00805f9b34fb
handle: 0x000f, uuid: 00002803-0000-1000-8000-00805f9b34fb
handle: 0x0010, uuid: 00002a19-0000-1000-8000-00805f9b34fb
handle: 0x0011, uuid: 00002902-0000-1000-8000-00805f9b34fb
handle: 0x0012, uuid: 00002800-0000-1000-8000-00805f9b34fb
handle: 0x0013, uuid: 00002803-0000-1000-8000-00805f9b34fb
handle: 0x0014, uuid: 00002a06-0000-1000-8000-00805f9b34fb
[3C:E1:A1:E8:B6:E1][LE]> 

Is it necessary to have the app BluetoothServices running to make bluetooth work or it is not related?

BluetoothServices is a Legato application that implements a BLE server, i.e. peripheral. The name means that it implements certain BLE-defined services for a connected BLE client, i.e. host, as can be seen in the traces above. It does not provide anything to other applications on the mangOH. There is a bluetooth daemon which runs on Linux systems and supports all apps using Bluetooth but it’s not a Legato app itself.

I noticed this concerning the bluetoothServices app in the related README :

“Most of this code was originally written outside of the context of a Legato application, so the code is not formatted or named according to Legato style conventions.”

Does it mean that I cannot consider this app to help me develop on BLE?

They are just talking about the C coding style. The interface to BlueZ though glib is correct and it works. I used bluetoothServices as a starting point for my transparent UART BLE application.

Isn’t it better to use bluetoothSensorTag app?

Depends on what you are trying to do. My understanding is that bluetoothSensorTag is a BLE host (i.e. client) which communicates with a sensor tag device (i.e. server). bluetoothServices is a BLE device (i.e. server) which communicates with a host (i.e. client).

Ok. It is quite similar indeed. There is only the notion of proxy in bluetoothSensorTag. I you don’t mind it could be interesting to see your app you developed.

I cannot make our code public but I can tell you that the coding involved changing the service and characteristic definitions previously made within battery_register_services() in battery_service.c . You can see the changes in the output of gatttool posted about.

Thanks for your reply. I am also wondering. Could we build app without D-Bus or is it highly adviced or mandatory with mangoh yellow?

Also, what value take these values (services_om and num_services_registered)? It must come from somewhere to be injected in battery_register_services, right?

image

It appears that you could use L2CAP sockets with BLE. It’s a low level interface that doesn’t use D-Bus. I have never tried it.

battery_register_services() is found in battery_service.c and is called from primary.c . It sets up the service and characteristics and you would modify these to support a different BLE service.

Thanks a lot!! That’s helping a lot! I don’t understand how are introduced ‘io_AddNumericPushHandler’ or ’ dhubAdmin_AddNumericPushHandler’. Is it coming from a library?

These are Legato dhub routines that are defined in the api section of Component.cdef . They don’t have anything to do with Bluetooth itself, they are just used to periodically generate simulated
battery level data.

My understanding is that datahub has nothing to do with Octave (cloud) right? In my project, I am not using Octave this is why