From: Brian Gix <brian.gix@intel.com>
To: linux-bluetooth@vger.kernel.org
Cc: inga.stotland@intel.com, brian.gix@intel.com,
michal.lowas-rzechonek@silvair.com
Subject: [PATCH BlueZ 1/3] mesh: Add "create" command to test app
Date: Tue, 14 May 2019 13:15:23 -0700 [thread overview]
Message-ID: <20190514201525.16067-2-brian.gix@intel.com> (raw)
In-Reply-To: <20190514201525.16067-1-brian.gix@intel.com>
Like "join" this command generates a UUID and calls CreateNetwork()
and displays the UUID and token.
---
test/test-mesh | 46 ++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 44 insertions(+), 2 deletions(-)
diff --git a/test/test-mesh b/test/test-mesh
index 7201669a8..f1d2b4e39 100755
--- a/test/test-mesh
+++ b/test/test-mesh
@@ -23,6 +23,7 @@
#
# The main menu:
# token
+# create
# join
# attach
# remove
@@ -37,6 +38,15 @@
# The token can be set from command line arguments as
# well.
#
+# create
+# Creates a new mesh network, with it's first local
+# node. The test generates device UUID to store the node
+# as.
+# In case of successful creation, the application
+# automatically attaches as a node to the daemon. A node
+# 'token' is returned to the application and is used
+# for the runtime of the test.
+#
# join
# Request provisioning of a device to become a node
# on a mesh network. The test generates device UUID
@@ -57,8 +67,8 @@
# For the call to be successful, the valid node token must
# be already set, either from command arguments or by
# executing "set token" operation or automatically after
-# successfully executing "join" operation in the same test
-# run.
+# successfully executing "join" or "create" operation in
+# the same test run.
#
# remove
# Permanently removes any node configuration from daemon
@@ -241,6 +251,22 @@ def join_cb():
def join_error_cb(reason):
print('Join procedure failed: ', reason)
+def create_cb(value):
+ global token
+ global have_token
+ global attach
+
+ print(set_yellow('Created mesh network with token ') +
+ set_green(format(value, '16x')))
+
+ token = value
+ have_token = True
+ if attached == False:
+ attach(token)
+
+def create_error_cb(reason):
+ print('Create procedure failed: ', reason)
+
def remove_node_cb():
global attached
global have_token
@@ -737,6 +763,8 @@ class MainMenu(Menu):
menu_items = {
'token': MenuItem(' - set node ID (token)',
self.__cmd_set_token),
+ 'create': MenuItem(' - create mesh network',
+ self.__cmd_create),
'join': MenuItem(' - join mesh network',
self.__cmd_join),
'attach': MenuItem(' - attach mesh node',
@@ -790,6 +818,20 @@ class MainMenu(Menu):
user_input = INPUT_MESSAGE_PAYLOAD;
print(set_cyan('Enter message payload (hex):'))
+ def __cmd_create(self):
+ if agent == None:
+ print(set_error('Provisioning agent not found'))
+ return
+
+ uuid = bytearray.fromhex("0a0102030405060708090A0B0C0D0E0F")
+ random.shuffle(uuid)
+ uuid_str = array_to_string(uuid)
+
+ print(set_yellow('Creating with UUID ') + set_green(uuid_str))
+ mesh_net.CreateNetwork(app.get_path(), uuid,
+ reply_handler=create_cb,
+ error_handler=create_error_cb)
+
def __cmd_join(self):
if agent == None:
print(set_error('Provisioning agent not found'))
--
2.14.5
next prev parent reply other threads:[~2019-05-14 20:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-14 20:15 [PATCH BlueZ 0/3] mesh: add Keyring to CreateNetwork Brian Gix
2019-05-14 20:15 ` Brian Gix [this message]
2019-05-14 20:15 ` [PATCH BlueZ 2/3] mesh: Fix file open error checking and permissions Brian Gix
2019-05-14 20:15 ` [PATCH BlueZ 3/3] mesh: Save generated Net and Dev keys in KeyRing Brian Gix
2019-05-15 16:46 ` [PATCH BlueZ 0/3] mesh: add Keyring to CreateNetwork Gix, Brian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190514201525.16067-2-brian.gix@intel.com \
--to=brian.gix@intel.com \
--cc=inga.stotland@intel.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=michal.lowas-rzechonek@silvair.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.