Goal
I am developping a simple device running Linux. It is BLE capable, and I am currently using bluez 5.8.
I want to trigger an action
You're really close.
To see the services on a device using your iOS code, try adding
peripheral.delegate = self;
to your didConnectPeripheral
, before the discoverServices
call. I got that from the Apple documentation and it fixed things for me (just don't forget to add CBPeripheralDelegate
to the interface declaration in the header file). Without it, didDiscoverServices
will never be called.
I was able to get the gatt-example
service plugin to run by compiling BlueZ from source with the ./configure --enable-maintainer-mode
. Then if you launch bluetoothd -nd
you'll see something like
src/plugin.c:add_plugin() Loading gatt_example plugin
near the top of the output, and then
attrib/gatt-service.c:gatt_service_add() New service: handle 0x0009, UUID a002, 4 attributes
src/attrib-server.c:attrib_db_add_new() handle=0x0009
attrib/gatt-service.c:gatt_service_add() New characteristic: handle 0x000a
src/attrib-server.c:attrib_db_add_new() handle=0x000a
At that point, my iOS app was able to see the BlueZ peripheral
, connect, and discover its services (after a hciconfig hci0 leadv
).