private (string roomName, AmbientData data) GetInformationOfRoom(AmazonDynamoDBClient client, DynamoDBContext context, DevicesInLocation devicesInLocation) { var lastUpdate = GetLastUpdate(client, devicesInLocation.DeviceId); if (lastUpdate != null) { var deviceInfos = context.Query <AmbientData>(lastUpdate.DeviceName, QueryOperator.Equal, lastUpdate.Tstamp).ToList(); if (deviceInfos.Any()) { return(devicesInLocation.Room, deviceInfos.First()); } } return(devicesInLocation.Room, null); }
public static DevicesInLocation MapFromResponseItem(Dictionary <string, AttributeValue> item) { if (item.Any()) { var deviceInLocation = new DevicesInLocation(); foreach (var propertyValue in item) { switch (propertyValue.Key) { case "location_id": deviceInLocation.LocationId = propertyValue.Value.S; break; case "device_id": deviceInLocation.DeviceId = propertyValue.Value.S; break; case "boardType": deviceInLocation.BoardType = propertyValue.Value.S; break; case "deviceName": deviceInLocation.DeviceName = propertyValue.Value.S; break; case "locationName": deviceInLocation.LocationName = propertyValue.Value.S; break; case "room": deviceInLocation.Room = propertyValue.Value.S; break; case "active": deviceInLocation.Active = propertyValue.Value.BOOL; break; } } return(deviceInLocation); } return(null); }