コード例 #1
0
ファイル: CommandSet.cs プロジェクト: b0urb4k1/Concept2-Rower
        public bool Read(ResponseReader reader)
        {
            if (_open)
                throw new CommandSetException("Attempting to read set before it has been prepared.");

            var success = false;

            try
            {
                if (_pm3Commands.Count > 0)
                {
                    // Read the PM3 custom command marker and size
                    if (reader.ReadByte() == (uint)Enums.Csafe.SETUSERCFG1_CMD)
                        // Read the size
                        reader.ReadByte();

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

                // Read CSAFE commands
                foreach (Command cmd in _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;
        }
コード例 #2
0
ファイル: Command.cs プロジェクト: b0urb4k1/Concept2-Rower
        public void Read(ResponseReader reader)
        {
            uint id = reader.ReadByte();
            uint size = reader.ReadByte();

            if (id == (uint)_id && size == _resonseSize)
                ReadInternal(reader);
            else
                Debug.WriteLine("[Command.Read] id/size mismatch");
        }
コード例 #3
0
ファイル: Command.cs プロジェクト: b0urb4k1/Concept2-Rower
 abstract protected void ReadInternal(ResponseReader reader);