test/test-mesh: Fix output of MessageReceived method 36/228936/1
authorInga Stotland <inga.stotland@intel.com>
Tue, 18 Feb 2020 07:52:08 +0000 (23:52 -0800)
committerAnupam Roy <anupam.r@samsung.com>
Thu, 26 Mar 2020 10:26:22 +0000 (15:56 +0530)
This fixes formatted output of recieved message parameters.

Change-Id: I3df227d548ed9f99c806c6b5fec264555fee5d2f
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
test/test-mesh

index 5777fce..929e28f 100755 (executable)
@@ -559,8 +559,15 @@ class Element(dbus.service.Object):
        @dbus.service.method(MESH_ELEMENT_IFACE,
                                        in_signature="qqvay", out_signature="")
        def MessageReceived(self, source, key, destination, data):
-               print('Message Received on Element %d, src=%04x, dst=%s' %
-                                               self.index, source, destination)
+               print(('Message Received on Element %02x') % self.index, end='')
+               print(', src=', format(source, '04x'), end='')
+
+               if isinstance(destination, int):
+                       print(', dst=%04x' % destination)
+               elif isinstance(destination, dbus.Array):
+                       dst_str = array_to_string(destination)
+                       print(', dst=' + dst_str)
+
                for model in self.models:
                        model.process_message(source, key, data)