Hi, On Thu, May 18, 2017 at 8:00 PM, Krasi Georgiev <krasi.root@xxxxxxxxx> wrote: > Thanks > > I watched this video 3 times, but he talks about profile registration and the auto connect very briefly so I tried everything that comes to mind, but can’t make it to work > > If you have done it can you post some pseudo code for the code execution ? > > I am sure it is not very complicated , just still too new to the whole concept. So what is the role you want the system to assume? As central: bluetoothctl> scan on *** Wait for the device you want to connect to show up *** bluetoothctl> connect <address> bluetoothctl> select-attribute <path or uuid> For peripheral: GATT application is not supported yet by bluetoothctl, but I have some plans to include support for it at some point (patch are of course welcome), in case you are looking for a C example you can find it here: https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/tools/gatt-service.c tools/gatt-service: gatt-service unique name: :1.152 Registered service: /service1 Get Primary: True Get UUID: 00001802-0000-1000-8000-00805f9b34fb Exist Includes: 00001802-0000-1000-8000-00805f9b34fb Characteristic(00002a06-0000-1000-8000-00805f9b34fb): Get("Value") Descriptor(8260c653-1a54-426b-9e36-e84c238bc669): Get("Value") Get Primary: True Get UUID: 00001802-0000-1000-8000-00805f9b34fb Exist Includes: 00001802-0000-1000-8000-00805f9b34fb Characteristic(00002a06-0000-1000-8000-00805f9b34fb): Get("Value") Descriptor(8260c653-1a54-426b-9e36-e84c238bc669): Get("Value") Get Primary: True Get UUID: 00001802-0000-1000-8000-00805f9b34fb Exist Includes: 00001802-0000-1000-8000-00805f9b34fb Characteristic(00002a06-0000-1000-8000-00805f9b34fb): Get("Value") Descriptor(8260c653-1a54-426b-9e36-e84c238bc669): Get("Value") RegisterApplication: OK RegisterApplication: OK bluetoothctl> advertise on > >> On 18 May 2017, at 18:41, Barry Byford <31baz66@xxxxxxxxx> wrote: >> >> Szymon Janc talks through using BlueZ for BLE on this video: >> https://youtu.be/VMDyebKT5c4 >> Slides at: >> http://events.linuxfoundation.org/sites/events/files/slides/Doing%20Bluetooth%20Low%20Energy%20on%20Linux.pdf >> >> Should be helpful for you to understand the logic. >> >> >> On 17 May 2017 at 11:35, Krasi Georgiev <krasi.root@xxxxxxxxx> wrote: >>> 3 hours later and still no luck :( >>> >>> I am reading all api documents over and over again and can’t understand the logic. >>> >>> I think I need to register an object that implements the org.bluez.GattProfile1 interface, but what should be the bus name and object path for this object I am completely unsure... >>> >>> Desperate for any useful info so thanks in advance :) >>> >>>> On 16 May 2017, at 23:31, Krasi Georgiev <krasi.root@xxxxxxxxx> wrote: >>>> >>>> Thanks >>>> I already looked at these, but they don’t cover what I need and also a but high level with the dbus python package which hides most of the important details. >>>> >>>> Anyway I think I got a better idea now. I think I need to register the org.bluez.GattProfile1 interface in the dbus and then call org.bluez.ProfileManager1.RegisterProfile , will test it tomorrow and hopefully I will get it going. >>>> >>>> >>>>> On 16 May 2017, at 22:08, Barry Byford <31baz66@xxxxxxxxx> wrote: >>>>> >>>>> Hello Krasi, >>>>> >>>>> >>>>> On 16 May 2017 at 12:42, Krasi Georgiev <krasi.root@xxxxxxxxx> wrote: >>>>>> Hi all >>>>>> >>>>>> Can you give me a quick example with a pseudo code (or using qdbus) for workflow steps how to setup an >>>>>> auto connect to a device that supports given UUID service (0000180f-0000-1000-8000-00805f9b34fb - Battery Service) >>>>> >>>>> The examples for BlueZ are in the test directory. The ones you might >>>>> find useful are: >>>>> https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/test-discovery >>>>> https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-gatt-client >>>>> >>>>> >>>>> >>>>>> >>>>>> From what I understand all I need to do is send a call to the sytembus to register the hci0 adapter to auto connect >>>>>> >>>>>> org.bluez.ProfileManager1.RegisterProfile , /org/bluez/Test (ObjPath), "00001802-0000-1000-8000-00805f9b34fb” (service UUID) >>>>>> >>>>>> and if the discovery finds a device with such service it should auto connect right ? >>>>>> >>>>>> >>>>>> I am not sure what is the ObjPath parameter for and when i introspect I don’t even see the /org/bluez/GattProfile1 >>>>>> >>>>>> I am using bluez Version 5.45 on a Raspberry Pi zero >>>>>> Linux 4.4.50+ armv6l >>>>>> >>>>>> >>>>>> I tried making the call using with gdbus, but couldn’t figure out how to structure the osa{sv} paramters >>>>>> also tried dbus-send , but the tool doesn’t seem to support this structures (no nesting) >>>>>> >>>>>> >>>>>> I am using golang godbus bindings and the call gets executed without an error , but the bluetooth adapter doesn’t auto connect >>>>>> >>>>>> >>>>>> here is the gist >>>>>> https://gist.githubusercontent.com/krasi-georgiev/56f88cd18893578fa83c328f038479d6/raw/25f11f2fd7b55d82590732fa8f253febda623645/main.go >>>>>> >>>>>> go get github.com/godbus/dbus >>>>>> wget https://gist.githubusercontent.com/krasi-georgiev/56f88cd18893578fa83c328f038479d6/raw/25f11f2fd7b55d82590732fa8f253febda623645/main.go >>>>>> go run main.go >>>>>> >>>>>> >>>>>> I would really appreciate some useful info. >>>>>> Thanks-- >>>>>> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in >>>>>> the body of a message to majordomo@xxxxxxxxxxxxxxx >>>>>> More majordomo info at http://vger.kernel.org/majordomo-info.html >>>> >>> >>> -- >>> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in >>> the body of a message to majordomo@xxxxxxxxxxxxxxx >>> More majordomo info at http://vger.kernel.org/majordomo-info.html > > -- > To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Luiz Augusto von Dentz -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html