private void ReceiveAllSensorInfo(MessageReader reader)
        {
            foreach (NuiSensor sensor in _sensors.Values)
            {
                sensor.ChangeStatus(SensorState.UNKNOWN);
                if (OnSensorDisconnected != null)
                {
                    OnSensorDisconnected.Invoke(sensor);
                }
            }
            _sensors.Clear();

            int sensorCount = reader.ReadInt();

            for (int i = 0; i < sensorCount; i++)
            {
                NuiSensor sensor = MakeSensor(reader);

                sensor.ChangeStatus(SensorState.OPENED);

                if (OnSensorConnected != null)
                {
                    OnSensorConnected.Invoke(sensor);
                }

                _sensors.Add(sensor.Id, sensor);
            }
        }
Exemplo n.º 2
0
 internal BodyData(Dictionary <JointType, Joint> joints, Dictionary <JointType, JointOrientation> orientations, bool valid, int id, NuiSensor sensor, HandStatus leftHand, HandStatus rightHand)
 {
     this.Joints       = joints;
     this.Orientations = orientations;
     this.Id           = id;
     this.Valid        = valid;
     this.Sensor       = sensor;
     this.LeftHand     = leftHand;
     this.RightHand    = rightHand;
 }
        //NuiApplication app, int sensorId, string name, string vendor, SensorState State, ColorInfo color, DepthInfo depth, BodyInfo body
        private void ReceiveNewSensorInfo(MessageReader reader)
        {
            NuiSensor sensor = MakeSensor(reader);

            if (!_sensors.ContainsKey(sensor.Id))
            {
                sensor.ChangeStatus(SensorState.OPENED);

                if (OnSensorConnected != null)
                {
                    OnSensorConnected.Invoke(sensor);
                }

                _sensors.Add(sensor.Id, sensor);
            }
        }
        private NuiSensor MakeSensor(MessageReader reader)
        {
            int         sensorId          = reader.ReadInt();
            string      name              = reader.ReadString();
            string      vendor            = reader.ReadString();
            SensorState state             = (SensorState)reader.ReadInt();
            int         colorWidth        = reader.ReadInt();
            int         colorHeight       = reader.ReadInt();
            int         colorBpp          = reader.ReadInt();
            int         depthWidth        = reader.ReadInt();
            int         depthHeight       = reader.ReadInt();
            int         depthBpp          = reader.ReadInt();
            int         maxTrackingNumber = reader.ReadInt();

            NuiSensor sensor = new NuiSensor(this, name, vendor, sensorId, state, colorWidth, colorHeight, colorBpp, depthWidth, depthHeight, depthBpp, maxTrackingNumber);

            return(sensor);
        }