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); }
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"); } }
protected override void ReadInternal(ResponseReader reader) { uint pace = reader.ReadUShort(); reader.ReadByte(); // Expecting 0x39 - Seconds per kilometer m_Pace.TotalHundreths = 50 * pace; }
protected override void ReadInternal(ResponseReader reader) { WorkoutType val = (WorkoutType)reader.ReadByte(); WorkoutType = Enum.IsDefined(typeof(WorkoutType), val) ? val : WorkoutType.Unknown; }
protected override void ReadInternal(ResponseReader reader) { DragFactor = (uint)reader.ReadByte(); }
protected override void ReadInternal(ResponseReader reader) { StrokeState val = (StrokeState)reader.ReadByte(); StrokeState = Enum.IsDefined(typeof(StrokeState), val) ? val : StrokeState.Unknown; }
protected override void ReadInternal(ResponseReader reader) { m_Distance.TotalTenths = 10 * reader.ReadUShort(); reader.ReadByte(); // Expecting 0x24 - Metres }
protected override void ReadInternal(ResponseReader reader) { m_Time.TotalHundreths = reader.ReadUInt() + reader.ReadByte(); }
protected override void ReadInternal(ResponseReader reader) { m_Distance.TotalTenths = reader.ReadUInt() + reader.ReadByte(); }
protected override void ReadInternal(ResponseReader reader) { Power = reader.ReadUShort(); reader.ReadByte(); // Expecting 0x58 - Watts }
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; }
protected override void ReadInternal(ResponseReader reader) { HeartRate = reader.ReadByte(); }
protected override void ReadInternal(ResponseReader reader) { StrokeRate = reader.ReadUShort(); reader.ReadByte(); // Expecting 0x54 - StrokesPerMinute }