Exemplo n.º 1
0
    async def create_from_symmetric_key(self, transport_type, device_id,
                                        module_id, hostname, symmetric_key):
        kwargs = get_kwargs(transport_type)

        self.client = self.client_class.create_from_symmetric_key(
            symmetric_key, hostname, device_id, module_id, **kwargs)

        mqtt_transport.DEFAULT_KEEPALIVE = DEFAULT_KEEPALIVE
        self._attach_connect_event_watcher()
Exemplo n.º 2
0
    async def create_from_connection_string(self, transport_type,
                                            connection_string, cert):
        kwargs = get_kwargs(transport_type)

        if "GatewayHostName" in connection_string:
            self.client = self.client_class.create_from_connection_string(
                connection_string, server_verification_cert=cert, **kwargs)
        else:
            self.client = self.client_class.create_from_connection_string(
                connection_string, **kwargs)
        mqtt_transport.DEFAULT_KEEPALIVE = DEFAULT_KEEPALIVE
        self._attach_connect_event_watcher()
    async def create_from_environment(self, transport_type):
        kwargs = get_kwargs(transport_type)

        self.client = IoTHubModuleClient.create_from_edge_environment(**kwargs)
        mqtt_transport.DEFAULT_KEEPALIVE = DEFAULT_KEEPALIVE
        self._attach_connect_event_watcher()