Exemple #1
0
        internal SensorsCollection(GetSensorsResponse jsonResponse)
        {
            if (jsonResponse == null)
            {
                throw new ArgumentNullException("jsonResponse");
            }

            Switches    = jsonResponse.Switches.Select(x => new Switch(x));
            Scenes      = jsonResponse.Scenes.Select(x => new Scene(x));
            KakuSensors = jsonResponse.KakuSensors.Select(x => new KakuSensor(x));
        }
Exemple #2
0
        private void GetSensors(Connection connection, int requestNumber, List <string> deviceIds)
        {
            var result = new Dictionary <string, List <SensorBase> >();

            foreach (var deviceId in deviceIds)
            {
                result.Add(deviceId, deviceCache.GetSensors(deviceId));
            }

            GetSensorsResponse response = new GetSensorsResponse(requestNumber)
            {
                Error  = null,
                Result = result
            };

            connection.Send(PrepareJson(response));
        }