Ejemplo n.º 1
0
 protected override void ReadInternal(ResponseReader reader)
 {
     uint hours = reader.ReadByte();
     uint minutes = reader.ReadByte();
     uint seconds = reader.ReadByte();
     m_Time.TotalHundreths = 100 * (3600 * hours + 60 * minutes + seconds);
 }
Ejemplo n.º 2
0
        protected override void ReadInternal(ResponseReader reader)
        {
            uint pace = reader.ReadUShort();
            reader.ReadByte(); // Expecting 0x39 - Seconds per kilometer

            m_Pace.TotalHundreths = 50 * pace;
        }
Ejemplo n.º 3
0
 public void Read(ResponseReader reader)
 {
     uint id = reader.ReadByte();
     uint size = reader.ReadByte();
     if (id == (uint)m_Id && size == m_RspSize)
     {
         ReadInternal(reader);
     }
     else
     {
         Debug.WriteLine("[Command.Read] id/size mismatch");
     }
 }
Ejemplo n.º 4
0
 protected override void ReadInternal(ResponseReader reader)
 {
     WorkoutType val = (WorkoutType)reader.ReadByte();
     WorkoutType = Enum.IsDefined(typeof(WorkoutType), val) ? val : WorkoutType.Unknown;
 }
Ejemplo n.º 5
0
 protected override void ReadInternal(ResponseReader reader)
 {
     DragFactor = (uint)reader.ReadByte();
 }
Ejemplo n.º 6
0
 protected override void ReadInternal(ResponseReader reader)
 {
     StrokeState val = (StrokeState)reader.ReadByte();
     StrokeState = Enum.IsDefined(typeof(StrokeState), val) ? val : StrokeState.Unknown;
 }
Ejemplo n.º 7
0
 protected override void ReadInternal(ResponseReader reader)
 {
     m_Distance.TotalTenths = 10 * reader.ReadUShort();
     reader.ReadByte(); // Expecting 0x24 - Metres
 }
Ejemplo n.º 8
0
 protected override void ReadInternal(ResponseReader reader)
 {
     m_Time.TotalHundreths = reader.ReadUInt() + reader.ReadByte();
 }
Ejemplo n.º 9
0
 public Commander(IConnection connection)
 {
     m_Connection = connection;
     m_RspReader = new ResponseReader(64);
 }
Ejemplo n.º 10
0
 protected override void ReadInternal(ResponseReader reader)
 {
     m_Distance.TotalTenths = reader.ReadUInt() + reader.ReadByte();
 }
Ejemplo n.º 11
0
 protected abstract void ReadInternal(ResponseReader reader);
Ejemplo n.º 12
0
 protected override void ReadInternal(ResponseReader reader)
 {
     Calories = reader.ReadUShort();
 }
Ejemplo n.º 13
0
 protected override void ReadInternal(ResponseReader reader)
 {
     Power = reader.ReadUShort();
     reader.ReadByte(); // Expecting 0x58 - Watts
 }
Ejemplo n.º 14
0
        public bool Read(ResponseReader reader)
        {
            if (m_Open)
            {
                throw new CommandSetException("Attempting to read set before it has been prepared.");
            }

            bool success = false;
            try
            {
                if (m_PM3Commands.Count > 0)
                {
                    // Read the PM3 custom command marker and size
                    if (reader.ReadByte() == (uint)CSAFE.SETUSERCFG1_CMD)
                    {
                        // Read the size
                        reader.ReadByte();
                    }

                    // Read PM3 commands
                    foreach (Command cmd in m_PM3Commands)
                    {
                        cmd.Read(reader);
                    }
                }

                // Read CSAFE commands
                foreach (Command cmd in m_CSAFECommands)
                {
                    cmd.Read(reader);
                }

                // Ensure whole response has been read
                success = (reader.Position == reader.Size);
            }
            catch (BufferExceededException e)
            {
                Debug.WriteLine(string.Format("[CommandSet.Read] {0}", e.Message));
            }

            return success;
        }
Ejemplo n.º 15
0
 protected override void ReadInternal(ResponseReader reader)
 {
     HeartRate = reader.ReadByte();
 }
Ejemplo n.º 16
0
 protected override void ReadInternal(ResponseReader reader)
 {
     StrokeRate = reader.ReadUShort();
     reader.ReadByte(); // Expecting 0x54 - StrokesPerMinute
 }