Description

When writing a new service check the available services code to figure out how they work.

Basically every service must implement two entities/interfaces:

  • Manager: exported in the service base path and responsible for device object creation(SDP query, authorization, storage, initialization, ...)
  • Device or service specific: exports the specific methods provided by the service such as Connect/Disconnect, Play, Send, ...

Internal Services

Internal services must respect the following name standard: bluetoothd-service-{audio, network, input, echo, ...}

In order to be initialized automatically by the BlueZ daemon a configuration file must be provided in the '/etc/bluetooth/' directory. For more information access: Services

External Services

Standalone mode is useful for debug/development purpose making possible run the service without install it.

import dbus
import time

bus = dbus.SystemBus()
bmgr = dbus.Interface(bus.get_object('org.bluez', '/org/bluez'), 'org.bluez.Manager')
database = dbus.Interface(bmgr, 'org.bluez.Database')

# External/Standalone service registration
database.RegisterService("opp", "Ching ling printer","none")

there is a helper function(available at common/dbus.h) that calls Database.RegisterService hiding the D-Bus message.

...
if (argc > 1 && !strcmp(argv[1], "-s"))
    register_external_service(conn, "input", "Input service", "");
...

Authorization

TBD: Brief explanation and add a link to HOWTO/Authorization

Suggestions/Recommendations

  1. Device Discovery: TBD
  2. Service Discovery: TBD
  3. Storage: TBD

Related Documents