Esempio n. 1
0
        protected override void OnMessage(MessageEventArgs e)
        {
            Console.WriteLine(e.Data);
            var targets = new Targets();
            DwellableCollection dwellableCollection = new DwellableCollection(2, TimeSpan.Zero);

            //TODO: Remove hardoced file name
            dwellableCollection.LoadTargetsFromFile("testTargets");
            foreach (var target in dwellableCollection.dwellableTargets)
            {
                targets.targets.Add(target);
            }
            Send(JsonConvert.SerializeObject(targets));
        }
Esempio n. 2
0
        public Dal200Control(int dtdtPort, int dwellRadius, int dwellTime)
        {
            activeUsers         = new Dictionary <int, DtdtSubject>();
            DwellableCollection = new DwellableCollection(dwellRadius, TimeSpan.FromSeconds(dwellTime));

            oldTrackingData = new JsonData();

            dtdtHandler = new KinetOSCHandler(dtdtPort);
            dtdtHandler.OnDataReceived += DtdtDataReceived;
            dtdtHandler.StartReceiving();

            wsServer = new WebSocketServer($"ws://{NetworkUtils.GetLocalIPAddress()}");
            wsServer.AddWebSocketService <Dall200Messages>("/Dal200");
            wsServer.Start();
        }
        public Dal200Control(int dtdtPort, int dwellRadius, int dwellTime, int screensverTimeInSeconds)
        {
            activeUsers         = new Dictionary <int, DtdtSubject>();
            DwellableCollection = new DwellableCollection(dwellRadius, TimeSpan.FromSeconds(dwellTime));

            oldTrackingData = new JsonData();

            dtdtHandler = new KinetOSCHandler(dtdtPort);
            dtdtHandler.OnDataReceived += DtdtDataReceived;
            dtdtHandler.StartReceiving();

            wsServer = new WebSocketServer($"ws://{NetworkUtils.GetLocalIPAddress()}");
            wsServer.AddWebSocketService <Dall200Messages>("/Dal200");
            wsServer.Start();

            screensaverInterval        = screensverTimeInSeconds * 1000;
            screenSaverTimer           = new Timer(screensaverInterval);
            screenSaverTimer.AutoReset = false;
            screenSaverTimer.Elapsed  += ScreenSaverTimerElapsed;
            screenSaverTimer.Start();
        }
 public void TestLoad()
 {
     loadedCollection = new DwellableCollection(3, TimeSpan.Zero);
     loadedCollection.LoadTargetsFromFile("testTargets");
     Assert.AreNotEqual(loadedCollection.dwellableTargets.Count, 0);
 }