// The POLLs we send return telemetry data as a sequence of chunks
        public override void ProcessReply(byte[] rgbPayload, Connection connection)
        {
            // Program.Trace("telemetry reply received");
            if (rgbPayload.Length >= 5)
                {
                byte bReply   = rgbPayload[0];  // 0x02
                byte bCommand = rgbPayload[1];  // 0xA2
                byte bStatus  = rgbPayload[2];  // 0==success
                byte bBuffer  = rgbPayload[3];  // 0x00==poll buffer, 0x01==high speed buffer
                byte cb       = rgbPayload[4];  // length of data

                if (cb != 0 || Program.TheForm.TelemetryPollingInterval == 0)
                    {
                    // We're supposed to keep issuing poll commands until no data is returned, then wait the polling interval
                    connection.SendTelemetryPollMessage();
                    }

                // Program.Trace("poll: cmd={0} buf={1} stat={2} cb={3} ", bCommand, bBuffer, ((ERROR_CODE)bStatus).ToString(), cb);

                if (0 == bStatus)
                    {
                    byte[] rgb = rgbPayload.Slice(5,cb);
                    if (rgb.Length > 0)
                        {
                        connection.AddIncomingPolledData(rgb);
                        }
                    }

                this.NoteReplyValid();
                }
            else
                {
                Program.Trace("poll: illegal return buffer size");
                }
        }
 public override void ProcessReply(byte[] rgbPayload, Connection connection)
 {
     if (rgbPayload.Length >= 4)
         {
         // NB: this is the right order; the Mindstorms doc is wrong (it swaps bStatus and bBuffer)
         byte bReply   = rgbPayload[0];  // 0x02
         byte bCommand = rgbPayload[1];
         byte bStatus  = rgbPayload[2];
         byte bBuffer  = rgbPayload[3];
         byte cb       = rgbPayload[4];
         //
         this.CbAvailable = cb;
         this.NoteReplyValid();
         //
         Program.Trace("poll len: cmd={0} buf={1} stat={2} cb={3} ", bCommand, bBuffer, ((ERROR_CODE)bStatus).ToString(), cb);
         }
 }
        public override void ProcessReply(byte[] rgbPayload, Connection connection)
        {
            byte bReply      = rgbPayload[0];
            byte bCommand    = rgbPayload[1];
            byte bStatus     = rgbPayload[2];
            byte bLocalInbox = rgbPayload[3];   // just an echo of what we passed in our 'send': so we know where to put the msg
            byte cbMessage   = rgbPayload[4];

            Program.Trace("msg read: cmd={0} stat={1} inbox={2} cb={3}", bCommand, ((ERROR_CODE)bStatus).ToString(), bLocalInbox, cbMessage);
        }
 //--------------------------------------------------------------------------
 // Access
 //--------------------------------------------------------------------------
 public virtual void ProcessReply(byte[] rgbPayload, Connection connection)
 {
     // subclass responsibility
 }
 //--------------------------------------------------------------------------
 // Access
 //--------------------------------------------------------------------------
 public override void ProcessReply(byte[] rgbPayload, Connection connection)
 {
     byte bReply   = rgbPayload[0];
     byte bCommand = rgbPayload[1];
     byte bStatus  = rgbPayload[2];
     const int dib = 3;
     if (rgbPayload.Length >= 30+dib && bCommand==0x9b)
         {
         StringBuilder s = new StringBuilder();
         for (int ich = 0+dib; ich <= 14+dib && rgbPayload[ich]!=0; ich++)
             {
             s.Append((char)rgbPayload[ich]);
             }
         this.NxtName = s.ToString();
         //
         Program.Trace("GetDeviceInfoNxtMessage: reply received: {0}", this.NxtName);
         this.NoteReplyValid();
         }
 }