Ejemplo n.º 1
0
        public async Task UpdateHeatingSwitch(string id, DeviceHeatingModel model)
        {
            Twin twin = new Twin();

            twin.Properties.Desired[HEATING_KEY] = model.HeatingSwitch;
            await this.registry.UpdateTwinAsync(id, twin, "*");
        }
Ejemplo n.º 2
0
        public async Task <DeviceHeatingModel> GetHeatingSwitch(string id)
        {
            var twin = await this.registry.GetTwinAsync(id);

            DeviceHeatingModel model = new DeviceHeatingModel();

            if (twin.Properties.Reported.Contains(HEATING_KEY))
            {
                bool heating;
                if (bool.TryParse(twin.Properties.Reported[HEATING_KEY].ToString(), out heating))
                {
                    model.HeatingSwitch = heating;
                }
            }
            return(model);
        }
Ejemplo n.º 3
0
 public async Task UpdateDeviceHeatingSwitch(string id, [FromBody] DeviceHeatingModel model)
 {
     await this.devices.UpdateHeatingSwitch(id, model);
 }