diff options
author | Inga Stotland <inga.stotland@intel.com> | 2018-12-14 14:13:25 -0800 |
---|---|---|
committer | Anupam Roy <anupam.r@samsung.com> | 2019-12-17 19:31:43 +0530 |
commit | a8b7b3d3a652b41bb454594d6b0dd0377b14c62e (patch) | |
tree | 23990df6ff343614b09b5d3e8183905c2a752494 /test | |
parent | 549477e1f759d31ef8480c90a5dad469e4c3d1a3 (diff) | |
download | bluez-a8b7b3d3a652b41bb454594d6b0dd0377b14c62e.tar.gz bluez-a8b7b3d3a652b41bb454594d6b0dd0377b14c62e.tar.bz2 bluez-a8b7b3d3a652b41bb454594d6b0dd0377b14c62e.zip |
mesh: Sample Provisioning Agent
This implements a simple provisioning agent to test
org.bluez.mesh.ProvisionAgent interface.
Change-Id: Ia9e3b842abe98cbb9fb1c22bc0e489a07c18b564
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Diffstat (limited to 'test')
-rwxr-xr-x | test/agent.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/test/agent.py b/test/agent.py new file mode 100755 index 00000000..22c92f95 --- /dev/null +++ b/test/agent.py @@ -0,0 +1,40 @@ +#!/usr/bin/python + +import sys +import dbus +import dbus.service +import dbus.mainloop.glib + +AGENT_IFACE = 'org.bluez.mesh.ProvisionAgent1' +AGENT_PATH = "/mesh/test/agent" + +bus = None + +class Agent(dbus.service.Object): + def __init__(self, bus): + self.path = AGENT_PATH + self.bus = bus + dbus.service.Object.__init__(self, bus, self.path) + + def get_properties(self): + caps = [] + oob = [] + caps.append('out-numeric') + oob.append('other') + return { + AGENT_IFACE: { + 'Capabilities': dbus.Array(caps, 's'), + 'OutOfBandInfo': dbus.Array(oob, 's') + } + } + + def get_path(self): + return dbus.ObjectPath(self.path) + + @dbus.service.method(AGENT_IFACE, in_signature="", out_signature="") + def Cancel(self): + print("Cancel") + + @dbus.service.method(AGENT_IFACE, in_signature="su", out_signature="") + def DisplayNumeric(self, type, value): + print("DisplayNumeric type=", type, " number=", value) |