Exemplo n.º 1
0
 private void OnSetUpdateIntervalPacket(SensorUpdateInterval interval)
 {
     _transmitIndex = 0;
     _deviceProvider.SetSensorUpdateInterval(interval);
     WearableProxyServerProtocol.EncodeUpdateIntervalValue(_transmitBuffer, ref _transmitIndex, interval);
     SendTransmitBuffer();
 }
Exemplo n.º 2
0
        private void SendWelcomePackets()
        {
            // Prepare to transmit
            _transmitIndex = 0;

            // Device connection info
            if (_deviceProvider.ConnectedDevice == null)
            {
                WearableProxyServerProtocol.EncodeConnectionStatus(
                    _transmitBuffer,
                    ref _transmitIndex,
                    WearableProxyProtocolBase.ConnectionState.Disconnected,
                    new Device {
                    name = String.Empty, uid = WearableConstants.EmptyUID
                });
            }
            else
            {
                _transmitIndex = 0;
                WearableProxyServerProtocol.EncodeConnectionStatus(
                    _transmitBuffer,
                    ref _transmitIndex,
                    WearableProxyProtocolBase.ConnectionState.Connected,
                    _deviceProvider.ConnectedDevice.Value);
            }

            // Update interval value
            WearableProxyServerProtocol.EncodeUpdateIntervalValue(_transmitBuffer, ref _transmitIndex, _deviceProvider.GetSensorUpdateInterval());

            // Rotation source
            WearableProxyServerProtocol.EncodeRotationSourceValue(_transmitBuffer, ref _transmitIndex, _deviceProvider.GetRotationSource());

            // Sensor status
            SensorId[] sensors = (SensorId[])Enum.GetValues(typeof(SensorId));
            for (int i = 0; i < sensors.Length; i++)
            {
                SensorId sensor = sensors[i];
                WearableProxyServerProtocol.EncodeSensorStatus(_transmitBuffer, ref _transmitIndex, sensor, _deviceProvider.GetSensorActive(sensor));
            }

            // Gesture status
            GestureId[] gestures = WearableConstants.GestureIds;
            for (int i = 0; i < gestures.Length; i++)
            {
                GestureId gestureId = gestures[i];
                if (gestureId != GestureId.None)
                {
                    WearableProxyServerProtocol.EncodeGestureStatus(_transmitBuffer, ref _transmitIndex, gestureId, _deviceProvider.GetGestureEnabled(gestureId));
                }
            }

            // Transmit
            SendTransmitBuffer();
        }
Exemplo n.º 3
0
 private void OnQueryUpdateIntervalPacket()
 {
     _transmitIndex = 0;
     WearableProxyServerProtocol.EncodeUpdateIntervalValue(_transmitBuffer, ref _transmitIndex, _deviceProvider.GetSensorUpdateInterval());
     SendTransmitBuffer();
 }