Example #1
0
        public LoginVM()
        {
            UsersService   = new UsersService();
            DevicesService = new DevicesService();

            var ds = DeviceDisplay.MainDisplayInfo.Density;
        }
 protected Task PingDevice(string deviceId)
 {
     return(CommandsExecutor.ExecuteCommand((command) => DevicesService.Ping(command), new PingCommand
     {
         TargetDeviceId = deviceId
     }, timeoutInSeconds: 15));
 }
Example #3
0
 public DeviceOnlineStatusController(
     DevicesService devicesService,
     DeviceConnectionsMappingService deviceConnectionsMappingService)
 {
     _devicesService = devicesService;
     _deviceConnectionsMappingService = deviceConnectionsMappingService;
 }
Example #4
0
 public LightStatsController(
     LightStatsHub lightStatsHub,
     DevicesService devicesService)
 {
     _lightstatsHub  = lightStatsHub;
     _devicesService = devicesService;
 }
Example #5
0
        //window

        public DeviceChoose()
        {
            InitializeComponent();
            _devicesService = new DevicesService();
            //_devicesService = devicesService;
            _devDespList             = _devicesService.DevicesDescriptions;
            devsDespList.ItemsSource = _devDespList;
        }
        public void GetDevices_ReturnsDevices()
        {
            Engine.Data.Configuration.Xgminer minerConfiguration = new Engine.Data.Configuration.Xgminer();
            minerConfiguration.StratumProxy = true;

            DevicesService service = new DevicesService(minerConfiguration);
            List<Xgminer.Data.Device> devices = service.GetDevices(executablePath);

            Assert.IsTrue(devices.Count >= 1);
        }
        public void GetDevices_ReturnsDevices()
        {
            Engine.Data.Configuration.Xgminer minerConfiguration = new Engine.Data.Configuration.Xgminer();
            minerConfiguration.StratumProxy = true;

            DevicesService             service = new DevicesService(minerConfiguration);
            List <Xgminer.Data.Device> devices = service.GetDevices(executablePath);

            Assert.IsTrue(devices.Count >= 1);
        }
Example #8
0
        public ConfirmationVM()
        {
            DeviceService = new DevicesService();

            CheckingMsg = "Confirmando Cuenta";

            StartTimer();

            GetDeviceStatus();
        }
Example #9
0
        public override void OnStart()
        {
            int nbSecond = 0;

            while (PackageHost.IsRunning)
            {
                if (nbSecond++ == 0)
                {
                    try
                    {
                        PackageHost.WriteInfo("Getting NetAtmo measurements");
                        // Authenticate user
                        AuthenticationService authService = new AuthenticationService(PackageHost.GetSettingValue <string>("Netatmo.ClientId"), PackageHost.GetSettingValue <string>("Netatmo.ClientSecret"));
                        AuthenticationToken   authToken   = authService.AuthenticateUser(PackageHost.GetSettingValue <string>("Netatmo.Username"), PackageHost.GetSettingValue <string>("Netatmo.Password"));
                        // Get user devices
                        var devices = new DevicesService(authToken, new HttpWrapper()).Get();
                        // Init Measurements Service
                        var measurementsService = new MeasurementsService(authToken, new HttpWrapper());
                        // For each devices
                        foreach (var device in devices.Result.Devices)
                        {
                            // Push the device
                            this.PushData(measurementsService, device);
                            // Push each modules of the device
                            foreach (var moduleId in device.ModuleIds)
                            {
                                var module = devices.Result.Modules.FirstOrDefault(m => m.Id == moduleId);
                                if (module != null)
                                {
                                    this.PushData(measurementsService, device, module);
                                }
                                else
                                {
                                    PackageHost.WriteError("Module '{0}' not exist !", moduleId);
                                }
                            }
                        }
                        // OK !
                        PackageHost.WriteInfo("All measurements are pushed to the Constellation");
                    }
                    catch (Exception ex)
                    {
                        PackageHost.WriteError("Error while getting NetAtmo measurements : " + ex.ToString());
                    }
                }

                Thread.Sleep(1000);
                if (nbSecond == PackageHost.GetSettingValue <int>("RefreshInterval"))
                {
                    nbSecond = 0;
                }
            }
        }
Example #10
0
        public void GetDevices()
        {
            // Arrange
            var devicesService = new DevicesService(_authenticationToken, new HttpWrapper());

            // Act
            var stationDetails = devicesService.Get().Result;

            // Arrange
            Assert.IsNotNull(stationDetails, "Station Details");
            Assert.IsNotNull(stationDetails.Modules, "Modules");
            Assert.IsNotNull(stationDetails.Devices, "Devices");
        }
Example #11
0
 private void initData()
 {
     _devicesService = new DevicesService();
     //_devicesService = devicesService;
     _devDespList = _devicesService.DevicesDescriptions;
     //foreach(var desp in _devDespList)
     //{
     //    ListBoxItem listBoxItem = new ListBoxItem();
     //    listBoxItem.
     //    interlist.Items.Add()
     //}
     interlist.ItemsSource = _devDespList;
 }
Example #12
0
        public void GetMeasurements_ForModule(Type moduleType)
        {
            // Arrange
            var    measurementService = new MeasurementsService(_authenticationToken);
            string firstDevice        = _user.DeviceIds.First();

            var    devicesService = new DevicesService(_authenticationToken);
            var    stationDetails = devicesService.Get();
            Module module         = stationDetails.Modules.First(x => x.GetType() == moduleType);

            // Act
            List <SensorMeasurement> measurements = measurementService.Get(firstDevice, module);

            // Assert
            Assert.IsNotNull(measurements);
        }
        public void GetMeasurements_ForModule(Type moduleType)
        {
            // Arrange
            string firstDevice = _user.DeviceIds.First();

            // Get the (rain) module to look up measurements from.
            var    devicesService = new DevicesService(_authenticationToken, new HttpWrapper());
            var    stationDetails = devicesService.Get().Result;
            Module module         = stationDetails.Modules.First(x => x.GetType() == moduleType);

            var measurementService = new MeasurementsService(_authenticationToken, new HttpWrapper());

            // Act
            List <SensorMeasurement> measurements = measurementService.Get(firstDevice, module).Result;

            // Assert
            Assert.IsNotNull(measurements);
        }
        public async Task UpdateData()
        {
            IsLoading = true;
            var data = await DevicesService.GetDevicesList(new GetDeviceListQuery { PageNumber = 1, PageSize = 100 });

            var deviceDetailTasks = data.Result.Select(x =>
                                                       DevicesService.GetDeviceStatus(new GetDeviceStatusQuery {
                DeviceId = x.DeviceId
            }));
            var deviceDetails = await Task.WhenAll(deviceDetailTasks);

            Data = data.Result.Zip(deviceDetails, (deviceData, deviceStatusDetails) => new DeviceListRowVm
            {
                DeviceId            = deviceData.DeviceId,
                DeviceName          = deviceData.DeviceName,
                IsOnline            = deviceData.IsOnline,
                LastStatusUpdate    = deviceData.LastStatusUpdate,
                DeviceStatusDetails = deviceStatusDetails
            });
            IsLoading = false;
        }
Example #15
0
 public DeviceInformationController(DevicesService devicesService)
 {
     _devicesService = devicesService;
 }
Example #16
0
 public DevicesController(DevicesService devicesService)
 {
     _devicesService = devicesService;
 }
Example #17
0
 public DevicesController(ILogger <DevicesController> logger, DevicesService devService)
 {
     _logger     = logger;
     _devService = devService;
 }
Example #18
0
 public DevicesController(DevicesService service, IMapper mapper)
 {
     _service = service;
     _mapper  = mapper;
 }