private void OnSetUpdateIntervalPacket(SensorUpdateInterval interval) { _transmitIndex = 0; _deviceProvider.SetSensorUpdateInterval(interval); WearableProxyServerProtocol.EncodeUpdateIntervalValue(_transmitBuffer, ref _transmitIndex, interval); SendTransmitBuffer(); }
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(); }
private void OnQueryUpdateIntervalPacket() { _transmitIndex = 0; WearableProxyServerProtocol.EncodeUpdateIntervalValue(_transmitBuffer, ref _transmitIndex, _deviceProvider.GetSensorUpdateInterval()); SendTransmitBuffer(); }