Exemple #1
0
        public async Task <IList <DeviceProjection> > GetDevicesAsync()
        {
            var location = _applicationSettings.DefaultLocation;

            if (_applicationSettings.LocationConsent)
            {
                location = await _currentLocationDataProvider.GetCurrentUserLocationAsync();
            }
            var sensors = new SensorsNearbyRequest
            {
                Cmd    = "sensorsNearby",
                Lat    = location.Latitude,
                Lng    = location.Longitude,
                Radius = _applicationSettings.DeviceRadius,
                Uuid   = Uuid,
                ApiKey = ApiKey,
                Lang   = "ru"
            };
            var response = await Send <SensorsNearbyResponse>(sensors);

            return(NarodMonExtensions.ConvertSensorsNearbyResponseToDeviceProjections(response));
        }
        public Task <IList <DeviceProjection> > GetDevicesAsync()
        {
            var response = JsonConvert.DeserializeObject <SensorsNearbyResponse>(GetDevicesResponse);

            return(Task.FromResult <IList <DeviceProjection> >(NarodMonExtensions.ConvertSensorsNearbyResponseToDeviceProjections(response)));
        }