Example #1
0
        public static async Task <PnPClient> CreateFromDPSSasAndModelIdAsync(string scopeId, string deviceId, string sas, string modelId, ILogger logger)
        {
            var dc = await ProvisionDeviceWithSasKeyAsync(scopeId, deviceId, sas, modelId, logger);

            deviceClient = new PnPDeviceClient(dc);
            await deviceClient.SetDesiredPropertyUpdateCallbackAsync(DesiredPropertyUpdateCallback, deviceClient);

            return(instance);
        }
 public async Task SetDesiredPropertyUpdateCallbackAsync(DesiredPropertyUpdateCallback callback, object userContext)
 {
     if (client == null)
     {
         await mockClient.SetDesiredPropertyUpdateCallbackAsync(callback, userContext);
     }
     else
     {
         await client.SetDesiredPropertyUpdateCallbackAsync(callback, userContext);
     }
 }
Example #3
0
        public static PnPClient CreateFromConnectionStringAndModelId(string connectionString, string modelId)
        {
            deviceClient = new PnPDeviceClient(DeviceClient.CreateFromConnectionString(connectionString,
                                                                                       TransportType.Mqtt,
                                                                                       new ClientOptions()
            {
                ModelId = modelId
            }));

            deviceClient.SetDesiredPropertyUpdateCallbackAsync(DesiredPropertyUpdateCallback, deviceClient);
            return(instance);
        }
Example #4
0
 public static PnPClient CreateFromDeviceClient(IPnPDeviceClient client)
 {
     deviceClient = client;
     deviceClient.SetDesiredPropertyUpdateCallbackAsync(DesiredPropertyUpdateCallback, deviceClient);
     return(instance);
 }