示例#1
0
        public virtual void processResponse(string error, bool success)
        {
            String msg = new String(error);

            msg.Serialize();
            byte[] buf = new byte[msg.Serialized.Length + 1];
            buf[0] = (byte)(success ? 0x01 : 0x00);
            msg.Serialized.CopyTo(buf, 1);
            connection.write(buf, (uint)buf.Length, onResponseWritten, true);
        }
        public virtual void processResponse(string error, bool success)
        {
            var msg = new Messages.std_msgs.String(error);

            msg.Serialized = msg.Serialize();
            byte[] buf;
            if (success)
            {
                buf    = new byte[msg.Serialized.Length + 1 + 4];
                buf[0] = (byte)(success ? 0x01 : 0x00);
                msg.Serialized.CopyTo(buf, 5);
                Array.Copy(BitConverter.GetBytes(msg.Serialized.Length), 0, buf, 1, 4);
            }
            else
            {
                buf    = new byte[1 + 4];
                buf[0] = (byte)(success ? 0x01 : 0x00);
                Array.Copy(BitConverter.GetBytes(0), 0, buf, 1, 4);
            }
            connection.write(buf, buf.Length, onResponseWritten);
        }
示例#3
0
        public virtual async Task ProcessResponse(string error, bool success)
        {
            var msg = new Messages.std_msgs.String(error);

            msg.Serialized = msg.Serialize();
            byte[] buf;
            if (success)
            {
                buf    = new byte[msg.Serialized.Length + 1 + 4];
                buf[0] = (byte)(success ? 0x01 : 0x00);
                msg.Serialized.CopyTo(buf, 5);
                Array.Copy(BitConverter.GetBytes(msg.Serialized.Length), 0, buf, 1, 4);
            }
            else
            {
                buf    = new byte[1 + 4];
                buf[0] = (byte)(success ? 0x01 : 0x00);
                Array.Copy(BitConverter.GetBytes(0), 0, buf, 1, 4);
            }

            await connection.WriteBlock(buf, 0, buf.Length, cancel);
        }
示例#4
0
 public virtual void processResponse(string error, bool success)
 {
     String msg = new String(error);
     msg.Serialize();
     byte[] buf = new byte[msg.Serialized.Length + 1];
     buf[0] = (byte) (success ? 0x01 : 0x00);
     msg.Serialized.CopyTo(buf, 1);
     connection.write(buf, (uint) buf.Length, onResponseWritten, true);
 }