@@ -42,6 +42,7 @@ IWD_P2P_SERVICE_MANAGER_INTERFACE = 'net.connman.iwd.p2p.ServiceManager'
IWD_P2P_WFD_INTERFACE = 'net.connman.iwd.p2p.Display'
IWD_STATION_DEBUG_INTERFACE = 'net.connman.iwd.StationDebug'
IWD_DPP_INTERFACE = 'net.connman.iwd.DeviceProvisioning'
+IWD_DPP_PKEX_INTERFACE = 'net.connman.iwd.SharedCodeDeviceProvisioning'
IWD_AGENT_MANAGER_PATH = '/net/connman/iwd'
IWD_TOP_LEVEL_PATH = '/'
@@ -299,6 +300,33 @@ class DeviceProvisioning(IWDDBusAbstract):
def role(self):
return self._properties['Role']
+class SharedCodeDeviceProvisioning(IWDDBusAbstract):
+ _iface_name = IWD_DPP_PKEX_INTERFACE
+
+ def start_enrollee(self, key, identifier=None):
+ args = {
+ "Key": key
+ }
+
+ if identifier:
+ args["Identifier"] = identifier
+
+ return self._iface.StartEnrollee(args)
+
+ def start_configurator(self):
+ return self._iface.StartConfigurator()
+
+ def stop(self):
+ self._iface.Stop()
+
+ @property
+ def started(self):
+ return self._properties['Started']
+
+ @property
+ def role(self):
+ return self._properties['Role']
+
class AccessPointDevice(IWDDBusAbstract):
'''
Class represents net.connman.iwd.AccessPoint
@@ -375,6 +403,7 @@ class Device(IWDDBusAbstract):
self._station_props = None
self._station_debug_obj = None
self._dpp_obj = None
+ self._sc_dpp_obj = None
self._ap_obj = None
IWDDBusAbstract.__init__(self, *args, **kwargs)
@@ -407,6 +436,17 @@ class Device(IWDDBusAbstract):
return self._dpp_obj
+ @property
+ def _sc_device_provisioning(self):
+ if self._properties['Mode'] != 'station':
+ self._prop_proxy.Set(IWD_DEVICE_INTERFACE, 'Mode', 'station')
+
+ if self._sc_dpp_obj is None:
+ self._sc_dpp_obj = SharedCodeDeviceProvisioning(
+ object_path=self._object_path,
+ namespace=self._namespace)
+ return self._sc_dpp_obj
+
@property
def _station_debug(self):
if self._properties['Mode'] != 'station':
@@ -774,13 +814,60 @@ class Device(IWDDBusAbstract):
self._station_debug.wait_for_event(event, timeout)
def dpp_start_enrollee(self):
- return self._device_provisioning.start_enrollee()
+ ret = self._device_provisioning.start_enrollee()
+
+ condition = 'obj.started == True'
+ IWD._wait_for_object_condition(self._device_provisioning, condition)
+ condition = 'obj.role == "enrollee"'
+ IWD._wait_for_object_condition(self._device_provisioning, condition)
+
+ return ret
def dpp_start_configurator(self, uri=None):
- return self._device_provisioning.start_configurator(uri)
+ ret = self._device_provisioning.start_configurator(uri)
+
+ condition = 'obj.started == True'
+ IWD._wait_for_object_condition(self._device_provisioning, condition)
+ condition = 'obj.role == "configurator"'
+ IWD._wait_for_object_condition(self._device_provisioning, condition)
+
+ return ret
+
+ def dpp_pkex_enroll(self, *args, **kwargs):
+ ret = self._sc_device_provisioning.start_enrollee(*args, **kwargs)
+
+ condition = 'obj.started == True'
+ IWD._wait_for_object_condition(self._sc_device_provisioning, condition)
+ condition = 'obj.role == "enrollee"'
+ IWD._wait_for_object_condition(self._sc_device_provisioning, condition)
+
+ return ret
+
+ def dpp_pkex_configure(self):
+ ret = self._sc_device_provisioning.start_configurator()
+
+ condition = 'obj.started == True'
+ IWD._wait_for_object_condition(self._sc_device_provisioning, condition)
+ condition = 'obj.role == "configurator"'
+ IWD._wait_for_object_condition(self._sc_device_provisioning, condition)
+
+ return ret
+
+ def dpp_pkex_stop(self):
+ ret = self._sc_device_provisioning.stop()
+
+ condition = 'obj.started == False'
+ IWD._wait_for_object_condition(self._sc_device_provisioning, condition)
+
+ return ret
def dpp_stop(self):
- return self._device_provisioning.stop()
+ ret = self._device_provisioning.stop()
+
+ condition = 'obj.started == False'
+ IWD._wait_for_object_condition(self._device_provisioning, condition)
+
+ return ret
def __str__(self, prefix = ''):
s = prefix + 'Device: ' + self.device_path + '\n'\