Exemple #1
0
        static public void SendTestRequests(
            IReadOnlyList <int> sensorIds,
            ISensorService sensorService,
            int requestCount,
            int repeatCount,
            TimeSpan maxStepLength,
            RequestReport report)
        {
            var random = new Random();

            for (int i = 0; i < repeatCount; i++)
            {
                List <GetSensorDataParameters> parameters = Enumerable
                                                            .Repeat(0, requestCount)
                                                            .Select(_ => new GetSensorDataParameters {
                    SensorId = sensorIds[random.Next(sensorIds.Count)]
                })
                                                            .ToList();

                // Debug использован для простоты - чтобы не конфигурировать цвета в NLog.config.
                _logger.Debug($"Trying to send {requestCount} requests simultaneously (attempt #{i + 1} of {repeatCount}).");

                report.Start();

                var tasks = parameters
                            .Select(x => Task.Run(() => sensorService.GetSensorData(x)))
                            .ToArray();

                Task.WaitAll(tasks);
                report.StopAndLog(maxStepLength);
            }
        }
Exemple #2
0
 public Sensor(ISensor sensor, ISensorService sensorService)
 {
     _sensor                    = sensor ?? throw new ArgumentNullException(nameof(sensor));
     _sensorService             = sensorService ?? throw new ArgumentNullException(nameof(sensorService));
     _sensor.ConnectionChanged += sensor_ConnectionChanged;
     _sensor.StatusChanged     += sensor_StatusChanged;
 }
Exemple #3
0
 public AdminController(
     ISensorService sensorService,
     IMaterialService materialService)
 {
     this.sensorService   = sensorService;
     this.materialService = materialService;
 }
 public SensorViewModel(ISensorService service)
 {
     this.service = service;
     LoadData();
     LoadCommands();
     Messenger.Default.Register <Sensor>(this, HandleSensorMessage);
 }
Exemple #5
0
        public MapPageViewModel(INavigationService navigationService, IPermissionService permissionService,
                                IStringLocalizer <MapPageViewModel> stringLocalizer, IEventAggregator eventAggregator, IApiClient apiClient,
                                IAppDataService appDataService, IMapper mapper, INotificationService notificationService, ISensorService sensorService)
            : base(navigationService, permissionService, stringLocalizer)
        {
            EventAggregator     = eventAggregator;
            ApiClient           = apiClient;
            AppDataService      = appDataService;
            Mapper              = mapper;
            NotificationService = notificationService;
            SensorService       = sensorService;

            SamplePointsViewModel = new SamplePointsViewModel
            {
                Points = new ObservableCollection <SamplePointViewModel>().OnObservableCollectionChildrenPropertyChanged((sender, args) =>
                {
                    if (args.PropertyName == nameof(ISelectable.Selected))
                    {
                        OnPointSelectedChanged((SamplePointViewModel)sender);
                    }
                }),
            };

            NavigateToValidationUploadCommand = new DelegateCommand(() =>
            {
                NavigationService.NavigateToValidationUploadAsync(ValidationSessionId);
            });

            ToogleTileLayerCommand = new DelegateCommand(() => { ShowTileLayer = !ShowTileLayer; });
        }
 public AddCargoViewModel(ICargoService cargoService, ISensorService sensorService)
 {
     this.cargoService  = cargoService;
     this.sensorService = sensorService;
     LoadCommands();
     LoadData();
 }
Exemple #7
0
 public MonitoringController(IMonitoringService service, ISensorService sensorService, IUserService userService, IProductService productService)
 {
     monitoringService   = service;
     this.sensorService  = sensorService;
     this.userService    = userService;
     this.productService = productService;
 }
 public DashboardController(IUserSensorService userSensorService, UserManager <ApplicationUser> userManager, ISensorService sensorService, ISensorDataService sensorDataService)
 {
     this.userSensorService = userSensorService;
     this.userManager       = userManager;
     this.sensorService     = sensorService;
     this.sensorDataService = sensorDataService;
 }
Exemple #9
0
 public SensorHub(SensorsDBContext sensorsDBContext, IOptions <RaspberryPiSettings> raspberryPiSettings, ISensorService sensorService, ILedService ledService)
 {
     context  = sensorsDBContext;
     settings = raspberryPiSettings.Value;
     sensor   = sensorService;
     led      = ledService;
 }
Exemple #10
0
 public SensorController(IUserSensorService userSensorService, ISensorService sensorService, IMemoryCache memoryCache, ISensorDataService sensorDataService)
 {
     this.userSensorService = userSensorService ?? throw new ArgumentNullException(nameof(userSensorService));
     this.sensorService     = sensorService ?? throw new ArgumentNullException(nameof(sensorService));
     this.memoryCache       = memoryCache ?? throw new ArgumentNullException(nameof(memoryCache));
     this.sensorDataService = sensorDataService ?? throw new ArgumentNullException(nameof(sensorDataService));
 }
        public OverlayEntryProvider(ISensorService sensorService,
                                    IAppConfiguration appConfiguration,
                                    IEventAggregator eventAggregator,
                                    IOnlineMetricService onlineMetricService,
                                    ISystemInfo systemInfo, IRTSSService rTSSService,
                                    ILogger <OverlayEntryProvider> logger)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            _sensorService       = sensorService;
            _appConfiguration    = appConfiguration;
            _eventAggregator     = eventAggregator;
            _onlineMetricService = onlineMetricService;
            _systemInfo          = systemInfo;
            _rTSSService         = rTSSService;
            _logger = logger;

            _onDictionaryUpdatedBuffered = _sensorService
                                           .OnDictionaryUpdated
                                           .Replay(1)
                                           .AutoConnect(0);

            _ = Task.Run(async() => await LoadOrSetDefault())
                .ContinueWith(task => _taskCompletionSource.SetResult(true));

            SubscribeToOptionPopupClosed();

            _logger.LogDebug("{componentName} Ready", this.GetType().Name);

            stopwatch.Stop();
            _logger.LogInformation(this.GetType().Name + " {initializationTime}s initialization time", Math.Round(stopwatch.ElapsedMilliseconds * 1E-03, 1));
        }
Exemple #12
0
 public Worker(ILogger <Worker> logger, IAmqpService service, IScooterService service1, ISensorService service2)
 {
     _logger         = logger;
     _service        = service;
     _serviceScooter = service1;
     _serviceSensor  = service2;
 }
Exemple #13
0
 public EventHandler(IEventRepository eventRepository, ISensorRepository sensorRepository, ISensorService sensorService, EventWsHandler eventWs)
 {
     _eventRepository  = eventRepository;
     _sensorRepository = sensorRepository;
     _sensorService    = sensorService;
     _eventWs          = eventWs;
 }
 public SensorController(
     ISensorDataGenerator _generator,
     ISensorService _sensors)
 {
     this.generator = _generator;
     this.sensors   = _sensors;
 }
 public HomeController(ISensorDataService sensorDataService, UserManager <ApplicationUser> userManager, IUserSensorService userSensorService, ISensorService sensorService, DataContext dataContext)
 {
     this.sensorDataService = sensorDataService;
     this.userSensorService = userSensorService;
     this.sensorService     = sensorService;
     this.dataContext       = dataContext;
     this.userManager       = userManager;
 }
Exemple #16
0
        public ShareController(ISensorService sensorService, IHttpClientProvider httpClient)
        {
            Guard.WhenArgument(sensorService, "sensorService").IsNull().Throw();
            Guard.WhenArgument(httpClient, "httpClient").IsNull().Throw();

            this.httpClient    = httpClient;
            this.sensorService = sensorService;
        }
Exemple #17
0
        public UserController(IUserService userService, ISensorService sensorService, RoleManager <IdentityRole> roleManager, UserManager <User> userManager)
        {
            _userService       = userService ?? throw new ArgumentNullException(nameof(userService));
            this.sensorService = sensorService ?? throw new ArgumentNullException(nameof(sensorService));

            _roleManager = roleManager ?? throw new ArgumentNullException(nameof(roleManager));
            _userManager = userManager ?? throw new ArgumentNullException(nameof(userManager));
        }
Exemple #18
0
 public CargoViewModel(ICargoService cargoService, ISensorService sensorService)
 {
     this.cargoService  = cargoService;
     this.sensorService = sensorService;
     LoadData();
     LoadCommands();
     Messenger.Default.Register <Cargo>(this, HandleCargoMessage);
 }
Exemple #19
0
 public OrderController(IOrderService service, IUserService userService, IProductService productService, ISensorService sensorService, IMonitoringService monitoringService)
 {
     orderService           = service;
     this.userService       = userService;
     this.productService    = productService;
     this.sensorService     = sensorService;
     this.monitoringService = monitoringService;
 }
Exemple #20
0
 public BasicPhotoService(ISensorService<KinectSensor> sensorService)
 {
     _greenScreen = new KinectNoBackgroundView();
     //_greenScreen.Start();
     _sensorService = sensorService;
     _colorFrameDescription = _sensorService.Sensor.ColorFrameSource.CreateFrameDescription(ColorImageFormat.Bgra);
     this.Photo = new WriteableBitmap(_colorFrameDescription.Width, _colorFrameDescription.Height, 96.0, 96.0, PixelFormats.Bgr32, null);
     Init();
 }
 private ISensorService getSensorService()
 {
     if (null == sensorService)
     {
         sensorService = SpringUtil.getService<ISensorService>();
         sensorService.startSensor(SENSOR_IDX);
     }
     return sensorService;
 }
 public CurrentSensorValues(
     Dictionary <int, Device> deviceCache,
     ISensorService sensorService,
     ILogger <CurrentSensorValues> logger)
 {
     _deviceCache   = deviceCache;
     _sensorService = sensorService;
     _logger        = logger;
 }
Exemple #23
0
 public MonitorService(
     ISensorService <TKey> sensorService,
     IProbeMonitorService <TKey> probeMonitorService,
     ILogger <MonitorService <TKey> > logger)
 {
     this.sensorService       = sensorService;
     this.probeMonitorService = probeMonitorService;
     this.logger = logger;
 }
 public SensoresController(ISensorRepository sensorRepository,
                           ISensorService sensorService,
                           IMapper mapper,
                           INotificador notificador) : base(notificador)
 {
     _sensorRepository = sensorRepository;
     _sensorService    = sensorService;
     _mapper           = mapper;
 }
Exemple #25
0
 public BasicPhotoService(ISensorService <KinectSensor> sensorService)
 {
     _greenScreen = new KinectNoBackgroundView();
     //_greenScreen.Start();
     _sensorService         = sensorService;
     _colorFrameDescription = _sensorService.Sensor.ColorFrameSource.CreateFrameDescription(ColorImageFormat.Bgra);
     this.Photo             = new WriteableBitmap(_colorFrameDescription.Width, _colorFrameDescription.Height, 96.0, 96.0, PixelFormats.Bgr32, null);
     Init();
 }
 public QueryController(
     ISensorService sensorService,
     IStatisticService statisticService,
     IAutomatizationService automatizationService)
 {
     this.sensorService         = sensorService;
     this.statisticService      = statisticService;
     this.automatizationService = automatizationService;
 }
Exemple #27
0
        private async void Init()
        {
            _demographicsService = new BiometricTelemetryService(ConfigurationManager.AppSettings["Azure.Hub.Biometric"]);
            _demographicsService.DemographicsReceived += _demographicsService_DemographicsReceived;

            _demographicsService.DemographicsProcessingFailure += _demographicsService_DemographicsProcessingFailure;

            _sensorService = new KinectSensorService(_demographicsService);
            _sensorService.Open();
        }
 public MessagesController(IHttpContextAccessor ctx,
                           IMessageRepository messages,
                           ISensorLinkRepository links,
                           IApiKeyRepository keys,
                           ISensorService sensorService,
                           ISensorRepository sensors) : base(ctx, sensors, links, keys)
 {
     this.m_messages      = messages;
     this.m_sensorService = sensorService;
 }
Exemple #29
0
 public ExportController(IHttpContextAccessor ctx,
                         IMeasurementRepository measurements,
                         ISensorService sensorService,
                         ISensorRepository sensors,
                         ISensorLinkRepository links,
                         IApiKeyRepository keys) : base(ctx, sensors, links, keys)
 {
     this.m_measurements  = measurements;
     this.m_sensorService = sensorService;
 }
Exemple #30
0
 public SensorController(ISensorRepository sensorRepository,
                         ISensorService sensorService,
                         IMapper mapper,
                         IHubContext <EventoHub> hubContext)
 {
     _sensorRepository = sensorRepository;
     _sensorService    = sensorService;
     _mapper           = mapper;
     _hubContext       = hubContext;
 }
 public AdminController(ApplicationUserManager userManager, ApplicationDbContext dbContext,
                        ISensorService sensorService)
 {
     Guard.WhenArgument <ApplicationDbContext>(dbContext, "dbContext").IsNull().Throw();
     this.dbContext = dbContext;
     Guard.WhenArgument <ApplicationUserManager>(userManager, "userManager").IsNull().Throw();
     this.userManager = userManager;
     Guard.WhenArgument <ISensorService>(sensorService, "sensorService").IsNull().Throw();
     this.sensorService = sensorService;
 }
Exemple #32
0
        public KinectDepthService(ISensorService<KinectSensor> sensorService)
        {
            _sensorService = sensorService;

            this.DepthBytes = new Subject<byte[]>();

            _depthFrameDescription = _sensorService.Sensor.DepthFrameSource.FrameDescription;
            this.PixelHeight = _depthFrameDescription.Height;
            this.PixelWidth = _depthFrameDescription.Width;
            _depthPixels = new byte[this.PixelWidth * this.PixelHeight];
        }
Exemple #33
0
 public App()
 {
     InitializeComponent();
     //Opens the First Page, typically the Login page now
     //TODO : Will change this to registration page
     //TODO : Based on cached details the landing page will vary between registration and Login
     cache         = new CacheImpl();
     sensorService = new SensorService();
     triggered     = new TriggeredOptimizer(cache);
     CheckCacheAndLoad();
 }
Exemple #34
0
        public KinectSpeechService(ISensorService<KinectSensor> sensorService)
        {
            _sensorService = sensorService;

            IReadOnlyList<AudioBeam> audioBeamList = _sensorService.Sensor.AudioSource.AudioBeams;
            System.IO.Stream audioStream = audioBeamList[0].OpenInputStream();

            // create the convert stream
            _convertStream = new KinectAudioStream(audioStream);

            _ri = TryGetKinectRecognizer();
        }
        public KioskInteractionService(ISensorService<KinectSensor> sensorService,
            IDemographicsService demographicsService,
            IItemInteractionService itemInteractionService,
            IBodyTrackingService bodyTrackingService,
            IConfigurationProvider configurationProvider)
        {
            _currentZone = "NoTrack";
            _demographicService = demographicsService;

            _eventHub = new EventHubMessageSender(ConfigurationManager.AppSettings["Azure.Hub.Kiosk"]);

            _sensorService = sensorService;
              //  _telemetryService = telemetryService;

            _itemInteractionService = itemInteractionService;
            _itemInteractionService.ItemInteraction += _itemInteractionService_ItemInteraction;
            _coordinateMapper = _sensorService.Sensor.CoordinateMapper;

            _configurationProvider = configurationProvider;
            _configurationProvider.ConfigurationSettingsChanged += _configurationProvider_ConfigurationSettingsChanged;
            GetConfig();

            _sensorService.StatusChanged += _sensorService_StatusChanged;
            _bodyFrameReader = _sensorService.Sensor.BodyFrameSource.OpenReader();
            if (_bodyFrameReader != null)
                _bodyFrameReader.FrameArrived += _bodyFrameReader_FrameArrived;

            _sensorService.Open();

            _interactionProcessingQueue = new BlockingCollection<KioskStateEventArgs>();
            {
                IObservable<KioskStateEventArgs> ob = _interactionProcessingQueue.
                  GetConsumingEnumerable().
                  ToObservable(TaskPoolScheduler.Default);

                ob.Subscribe(p =>
                {
                    //var temp = Thread.CurrentThread.ManagedThreadId;
                    // This handler will get called whenever
                    // anything appears on myQueue in the future.
                    this.SendIteraction(p);
                    //Debug.Write("Consuming: {0}\n", p);
                });
            }

            _bodyTrackingService = bodyTrackingService;

            CurrentState = KioskStates.NoTrack;
        }
        private void initialize(int sensorIdx)
        {
            Enabled = true;

            cameraService = SpringUtil.getService<ICameraService>();
            sensorService = SpringUtil.getService<ISensorService>();
            skeletonService = SpringUtil.getService<ISkeletonService>();
            gestureService = SpringUtil.getService<IGestureService>();

            sensorService.startSensor(sensorIdx);
            cameraService.startCameraService(sensorService.getSensor(sensorIdx));
            skeletonService.enableSkeleton(sensorService.getSensor(sensorIdx));
            gestureService.enableGestureService(sensorService.getSensor(sensorIdx));

            imgHandLeft = new BitmapImage(new Uri(Application.Current.StartupUri, IMAGE_HAND_LEFT));
            imgHandRight = new BitmapImage(new Uri(Application.Current.StartupUri, IMAGE_HAND_RIGHT));
            imgHandLeftActive = new BitmapImage(new Uri(Application.Current.StartupUri, IMAGE_HAND_LEFT_ACTIVE));
            imgHandRightActive = new BitmapImage(new Uri(Application.Current.StartupUri, IMAGE_HAND_RIGHT_ACTIVE));

            imgHandLeft.Freeze();
            imgHandRight.Freeze();
            imgHandLeftActive.Freeze();
            imgHandRightActive.Freeze();
        }
 public HomeController(ISensorService sensorService, IDataReadingService dataReadingService)
 {
     _sensorService = sensorService;
     _dataReadingService = dataReadingService;
 }
 public SensorController(ISensorService sensorService, IDataReadingService sensorDataService)
 {
     _sensorService = sensorService;
     _sensorDataService = sensorDataService;
 }
Exemple #39
0
        public ObjectDetectionService(ISensorService<KinectSensor> sensorService)
        {
            _sensorService = sensorService;

            string config = string.Empty;
            try
            {
                using (FileStream fs = new FileStream("ObjectDetectionConfig.txt", FileMode.OpenOrCreate))
                {
                    StreamReader sr = new StreamReader(fs);
                    config = sr.ReadToEnd();
                    fs.Flush();
                }

                if (config == "")
                {
                    ResetConfiguraiontDefaults();
                    this.IsCalibrating = false;
                }
                else
                {
                    ServiceConfiguration = (ObjectDetectionConfiguration)JsonConvert.DeserializeObject(config, typeof(ObjectDetectionConfiguration));
                    objects = ServiceConfiguration.Objects;
                }
            }
            catch 
            {
                ResetConfiguraiontDefaults();
                this.IsCalibrating = true;
            }

            objects.CollectionChanged += objects_CollectionChanged;            

            _sensorService.Open();
            Start();

        }
 public SensorsController(ISensorService sensorService)
 {
     _sensorService = sensorService;
 }
        private void initialize()
        {
            confService = SpringUtil.getService<IConfigService>();
            confService.ReadConfigFromFile();

            sensorService = SpringUtil.getService<ISensorService>();
            skeletonService = SpringUtil.getService<ISkeletonService>();
            gestureService = SpringUtil.getService<IGestureService>();

            updateTimer = new DispatcherTimer(DispatcherPriority.SystemIdle);
            updateTimer.Tick += new EventHandler(updateTimer_Tick);
            updateTimer.Interval = TimeSpan.FromMilliseconds(INTERVAL);
            updateTimer.Start();

            highlightView = new HighlightView(SENSOR_IDX);
            highlightView.Show();

            bubble_settingsControl.InitCloseAnimation(story_hide_settings_bubble_BeginStoryboard.Storyboard, this);
        }
Exemple #42
0
        private async void Init()
        {

            _demographicsService = new OxfordBiometricTelemetryService(ConfigurationManager.AppSettings["Azure.Hub.Biometric"]);
            _demographicsService.DemographicsReceived += _demographicsService_DemographicsReceived;

            _demographicsService.DemographicsProcessingFailure += _demographicsService_DemographicsProcessingFailure;
            
            _sensorService = new KinectSensorService(_demographicsService);
            _sensorService.Open();     



        }
        private void initialize(int sensorIdx)
        {
            Enabled = true;
            LastGesture = String.Empty;
            lastGestureTime = DateTime.Now;

            processService = SpringUtil.getService<IProcessService>();
            sensorService = SpringUtil.getService<ISensorService>();
            shortcutService = SpringUtil.getService<IShortcutService>();
            gestureService = SpringUtil.getService<IGestureService>();
            configService = SpringUtil.getService<IConfigService>();

            this.sensorIdx = sensorIdx;
            sensorService.startSensor(sensorIdx);
            gestureService.enableGestureService(sensorService.getSensor(sensorIdx));
        }