summaryrefslogtreecommitdiff
path: root/test/agent.py
diff options
context:
space:
mode:
authorInga Stotland <inga.stotland@intel.com>2019-03-09 23:53:13 -0800
committerBrian Gix <brian.gix@intel.com>2019-03-11 14:50:03 -0700
commitea61add0afc90d490353c90d297ae467fbe3d0ba (patch)
tree54a7ef0a0985156f8316c9b8799ebcc3f6461ae2 /test/agent.py
parent076f20fe3476525ea611c0a2b06e5e6a0b81de75 (diff)
downloadbluez-ea61add0afc90d490353c90d297ae467fbe3d0ba.tar.gz
test: Add unified test for mesh node example app
This adds one script, test-mesh, to replace three test-join, example-onoff-server and example-onoff-client. This is menu driven test that allows provisioning (join) and/or connecting existing (attach) nodes.
Diffstat (limited to 'test/agent.py')
-rwxr-xr-xtest/agent.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/test/agent.py b/test/agent.py
index 22c92f952..778dbe092 100755
--- a/test/agent.py
+++ b/test/agent.py
@@ -1,9 +1,16 @@
-#!/usr/bin/python
+#!/usr/bin/python3
import sys
import dbus
import dbus.service
-import dbus.mainloop.glib
+
+try:
+ from termcolor import colored, cprint
+ set_green = lambda x: colored(x, 'green', attrs=['bold'])
+ set_cyan = lambda x: colored(x, 'cyan', attrs=['bold'])
+except ImportError:
+ set_green = lambda x: x
+ set_cyan = lambda x: x
AGENT_IFACE = 'org.bluez.mesh.ProvisionAgent1'
AGENT_PATH = "/mesh/test/agent"
@@ -37,4 +44,5 @@ class Agent(dbus.service.Object):
@dbus.service.method(AGENT_IFACE, in_signature="su", out_signature="")
def DisplayNumeric(self, type, value):
- print("DisplayNumeric type=", type, " number=", value)
+ print(set_cyan('DisplayNumeric ('), type,
+ set_cyan(') number ='), set_green(value))