예제 #1
0
        public DataSubscriber(ConfigFlags configurationFlags, KinectProcessor kinectProcessor, UDPSender dataSender)
        {
            _configurationFlags = configurationFlags;

            _dataSender = dataSender;
            _dataSender.StartDataOut();

            kinectProcessor.Reader.MultiSourceFrameArrived += MultiSourceFrameHandler;
        }
        public DataSubscriber(ConfigFlags configurationFlags, KinectProcessor kinectProcessor, UDPSender dataSender)
        {
            _configurationFlags = configurationFlags;

			_dataSender = dataSender;
			_dataSender.StartDataOut();

            kinectProcessor.Reader.MultiSourceFrameArrived += MultiSourceFrameHandler;
        }
        public SessionWorker(string ip, int sendPort, KinectProcessor dataPub, SessionManager sessionManager)
        {
            _ip         = ip;
            _port       = sendPort;
            _udpSender  = new UDPSender(_ip, _port);
            _endSession = false;

            _sessionManager = sessionManager;
            _dataPub        = dataPub;
            _configFlags    = new ConfigFlags();
            _lookupFlags    = new ConfigFlags();
            _flagIterator   = new ConfigFlags();
            _dataSub        = new DataSubscriber(_configFlags, _dataPub, _udpSender);
        }
		public SessionWorker(string ip, int sendPort, KinectProcessor dataPub, SessionManager sessionManager)
		{
			_ip = ip;
			_port = sendPort;
			_udpSender = new UDPSender(_ip, _port);
			_endSession = false;

			_sessionManager = sessionManager;
			_dataPub = dataPub;
			_configFlags = new ConfigFlags();
			_lookupFlags = new ConfigFlags();
			_flagIterator = new ConfigFlags();
			_dataSub = new DataSubscriber(_configFlags, _dataPub, _udpSender);
		}
        private void updateFlags()
        {
            var jointTypes = Enum.GetValues(typeof(JointType));

            // Copy session workers so iteration doesnt break the collection
            SessionWorker[] workers = new SessionWorker[_sessionManager.OpenConnections.Count];
            _sessionManager.OpenConnections.CopyTo(workers);

            foreach (SessionWorker sw in workers)
            {
                // Get the port and IP of this session
                string id = sw.Ip + ":" + sw.Port.ToString();

                // Copy the flags
                ConfigFlags flags = sw.ConfigFlags;

                // Get the list of active joints
                List <string> jointList = new List <string>();
                foreach (JointType jt in jointTypes)
                {
                    if (flags.JointFlags[jt])
                    {
                        jointList.Add(jt.ToString());
                    }
                }

                // If this session already exists update the flags
                if (_localSessions.Exists(tab => tab.Header == id))
                {
                    _localSessions.Find(tab => tab.Header.Equals(id)).displayFlags = flags.JointFlags;
                    _localSessions.Find(tab => tab.Header.Equals(id)).Items        = jointList;
                    _localSessions.Find(tab => tab.Header.Equals(id)).Active       = true;
                }
                else
                {
                    TabData tabData = new TabData(id, jointList, flags.JointFlags, true);
                    _localSessions.Add(tabData);
                }
            }
            updateTabs();
        }