Exemple #1
0
 public void Create(GW.Broker broker, byte[] configuration)
 {
     this.broker = broker;
     //ReadConfig
     //Init DeviceClient
     client = IoT.DeviceClient.CreateFromConnectionString(Encoding.UTF8.GetString(configuration));
 }
Exemple #2
0
        public void Create(IoTGateway.Broker broker, byte[] configuration)
        {
            Console.WriteLine($"{_moduleName}:  creating...");

            this.configuration = System.Text.Encoding.UTF8.GetString(configuration);
            var m = JsonConvert.DeserializeObject(this.configuration);

            try
            {
                this.iotHubUri    = ((Newtonsoft.Json.Linq.JValue)((Newtonsoft.Json.Linq.JContainer)((Newtonsoft.Json.Linq.JContainer)m).First).First).Value.ToString();
                deviceClient_cli1 = DeviceClient.Create(this.iotHubUri, new DeviceAuthenticationWithRegistrySymmetricKey("cam1", "lZcmVuk6jzjvBEj5hefis/JfCfrUJp0+7T+lTxypymY="), TransportType.Http1);
                deviceClient_cli2 = DeviceClient.Create(this.iotHubUri, new DeviceAuthenticationWithRegistrySymmetricKey("cam2", "a1DpgC+Fpx6Dnu/dBGndN4boeU8B/fx6HH14yZRTbUQ="), TransportType.Http1);
                deviceClient_cli3 = DeviceClient.Create(this.iotHubUri, new DeviceAuthenticationWithRegistrySymmetricKey("cam3", "Apb+9448sdfS34slpf+fBnabgs3d0mQcx1wWpCBtpjs="), TransportType.Http1);
            }
            catch (Exception ex) { Console.WriteLine(ex.Message); }
            Console.WriteLine($"{_moduleName}:  created.");
        }