예제 #1
0
 public InMemoryDeviceCredentialProvider()
 {
     deviceCredentialMap["leafdevicename"] = new DeviceCredential
                                             (
         "{deviceId_of_the_leaf_device_in_iothub}", "{iothubhostname}/{deviceid}", "{devicepassword}"
                                             );
 }
예제 #2
0
 public InMemoryDeviceCredentialProvider(IList <TenantConfig> tenantConfig)
 {
     foreach (var tenant in tenantConfig)
     {
         var tenantId = tenant.TenantId;
         foreach (var device in tenant.Devices)
         {
             var deviceCredential = new DeviceCredential(device.Id, $"{device.IoTHubHostName}/{device.Id}", device.SasToken);
             deviceCredentialMap.Add($"{tenantId}.{device.Id}", deviceCredential);
         }
     }
 }