Example #1
0
        private async Task DisableImu()
        {
            var msg = new ESenseMessage(CMD_IMU_ENABLE, DISABLE, 0);
            await _connection.WriteAsync(CHAR_IMU_ENABLE, msg);

            _imuEnabled = false;
        }
Example #2
0
        private async Task EnableImu()
        {
            var msg = new ESenseMessage(CMD_IMU_ENABLE, ENABLE, (byte)SamplingRate);
            await _connection.WriteAsync(CHAR_IMU_ENABLE, msg);

            _imuEnabled = true;
        }
Example #3
0
        private BatteryState ParseMessage(byte[] data)
        {
            var message = new ESenseMessage();

            try
            {
                message.Decode(data);
                return(new BatteryState()
                {
                    Voltage = (message.Data[0] * 256 + message.Data[1]) / 1000f,
                    Charging = (message.Data[2] & 1) == 1
                });
            }
            catch (Exception)
            {
                return(null);
            }
        }