Inheritance: System.IO.BinaryWriter
Exemple #1
0
        public void _encodeRecursive(LCMDataOutputStream outs)
        {
            byte[] __strbuf = null;
            outs.Write(this.timestamp); 
 
            for (int a = 0; a < 3; a++) {
                outs.Write(this.position[a]); 
            }
 
            for (int a = 0; a < 4; a++) {
                outs.Write(this.orientation[a]); 
            }
 
            outs.Write(this.num_ranges); 
 
            for (int a = 0; a < this.num_ranges; a++) {
                outs.Write(this.ranges[a]); 
            }
 
            __strbuf = System.Text.Encoding.GetEncoding("US-ASCII").GetBytes(this.name); outs.Write(__strbuf.Length+1); outs.Write(__strbuf, 0, __strbuf.Length); outs.Write((byte) 0); 
 
            outs.Write(this.enabled); 
 
        }
Exemple #2
0
 public void Encode(LCMDataOutputStream outs)
 {
     outs.Write((long) LCM_FINGERPRINT);
     _encodeRecursive(outs);
 }
Exemple #3
0
 public void _encodeRecursive(LCMDataOutputStream outs)
 {
     for (int a = 0; a < 4; a++) {
         for (int b = 0; b < 5; b++) {
             outs.Write(this.goals[a,b]);
         }
     }
 }
        private void PublishEx(string channel, byte[] data, int offset, int length)
        {
            byte[] channelBytes = System.Text.Encoding.GetEncoding("US-ASCII").GetBytes(channel);

            int payloadSize = channelBytes.Length + length;

            if (payloadSize <= FRAGMENTATION_THRESHOLD)
            {
                LCMDataOutputStream outs = new LCMDataOutputStream(length + channel.Length + 32);

                outs.Write(MAGIC_SHORT);
                outs.Write(this.msgSeqNumber);

                outs.Write(channelBytes, 0, channelBytes.Length);
                outs.Write((byte)0);

                outs.Write(data, offset, length);

                sock.Send(outs.Buffer, outs.Length, inetEP);
            }
            else
            {
                int nfragments = payloadSize / FRAGMENTATION_THRESHOLD;
                if (payloadSize % FRAGMENTATION_THRESHOLD > 0)
                {
                    nfragments++;
                }

                if (nfragments > 65535)
                {
                    Console.Error.WriteLine("LC error: too much data for a single message");
                    return;
                }

                // first fragment is special.  insert channel before data
                LCMDataOutputStream outs = new LCMDataOutputStream(10 + FRAGMENTATION_THRESHOLD);

                int fragmentOffset = 0;
                int fragNo         = 0;

                outs.Write(MAGIC_LONG);
                outs.Write(this.msgSeqNumber);
                outs.Write(length);
                outs.Write(fragmentOffset);
                outs.Write((short)fragNo);
                outs.Write((short)nfragments);
                outs.Write(channelBytes, 0, channelBytes.Length);
                outs.Write((byte)0);

                int firstfragDatasize = FRAGMENTATION_THRESHOLD - (channelBytes.Length + 1);

                outs.Write(data, offset, firstfragDatasize);

                sock.Send(outs.Buffer, outs.Length, inetEP);

                fragmentOffset += firstfragDatasize;

                for (fragNo = 1; fragNo < nfragments; fragNo++)
                {
                    outs = new LCMDataOutputStream(10 + FRAGMENTATION_THRESHOLD);

                    outs.Write(MAGIC_LONG);
                    outs.Write(this.msgSeqNumber);
                    outs.Write(length);
                    outs.Write(fragmentOffset);
                    outs.Write((short)fragNo);
                    outs.Write((short)nfragments);
                    int fragLen = System.Math.Min(FRAGMENTATION_THRESHOLD, length - fragmentOffset);
                    outs.Write(data, offset + fragmentOffset, fragLen);

                    sock.Send(outs.Buffer, outs.Length, inetEP);

                    fragmentOffset += fragLen;
                }
            }

            this.msgSeqNumber++;
        }
Exemple #5
0
 public void _encodeRecursive(LCMDataOutputStream outs)
 {
     byte[] __strbuf = null;
     outs.Write(this.utime); 
     outs.Write(this.deg_celsius); 
 }
		private void PublishEx(string channel, byte[] data, int offset, int length)
		{
			byte[] channelBytes = System.Text.Encoding.GetEncoding("US-ASCII").GetBytes(channel);
			
			int payloadSize = channelBytes.Length + length;
			
			if (payloadSize <= FRAGMENTATION_THRESHOLD)
			{
				LCMDataOutputStream outs = new LCMDataOutputStream(length + channel.Length + 32);
				
				outs.Write(MAGIC_SHORT);
				outs.Write(this.msgSeqNumber);

                outs.Write(channelBytes, 0, channelBytes.Length);
                outs.Write((byte) 0);
				
				outs.Write(data, offset, length);

                sock.Send(outs.Buffer, outs.Length, inetEP);
			}
			else
			{
				int nfragments = payloadSize / FRAGMENTATION_THRESHOLD;
				if (payloadSize % FRAGMENTATION_THRESHOLD > 0)
					nfragments++;
				
				if (nfragments > 65535)
				{
					Console.Error.WriteLine("LC error: too much data for a single message");
					return;
				}

                // first fragment is special.  insert channel before data
                LCMDataOutputStream outs = new LCMDataOutputStream(10 + FRAGMENTATION_THRESHOLD);
				
				int fragmentOffset = 0;
				int fragNo = 0;
				
				outs.Write(MAGIC_LONG);
				outs.Write(this.msgSeqNumber);
				outs.Write(length);
				outs.Write(fragmentOffset);
				outs.Write((short) fragNo);
				outs.Write((short) nfragments);
				outs.Write(channelBytes, 0, channelBytes.Length);
				outs.Write((byte) 0);

				int firstfragDatasize = FRAGMENTATION_THRESHOLD - (channelBytes.Length + 1);
				
				outs.Write(data, offset, firstfragDatasize);

                sock.Send(outs.Buffer, outs.Length, inetEP);
				
				fragmentOffset += firstfragDatasize;
				
				for (fragNo = 1; fragNo < nfragments; fragNo++)
				{
                    outs = new LCMDataOutputStream(10 + FRAGMENTATION_THRESHOLD);
					
					outs.Write(MAGIC_LONG);
					outs.Write(this.msgSeqNumber);
					outs.Write(length);
					outs.Write(fragmentOffset);
					outs.Write((short) fragNo);
					outs.Write((short) nfragments);
					int fragLen = System.Math.Min(FRAGMENTATION_THRESHOLD, length - fragmentOffset);
					outs.Write(data, offset + fragmentOffset, fragLen);

                    sock.Send(outs.Buffer, outs.Length, inetEP);
					
					fragmentOffset += fragLen;
				}
			}
			
			this.msgSeqNumber++;
		}
        public void _encodeRecursive(LCMDataOutputStream outs)
        {
            byte[] __strbuf = null;
            __strbuf = System.Text.Encoding.GetEncoding("US-ASCII").GetBytes(this.imageFilename); outs.Write(__strbuf.Length + 1); outs.Write(__strbuf, 0, __strbuf.Length); outs.Write((byte)0);

            outs.Write(this.imageNumber);

            __strbuf = System.Text.Encoding.GetEncoding("US-ASCII").GetBytes(this.agentName); outs.Write(__strbuf.Length + 1); outs.Write(__strbuf, 0, __strbuf.Length); outs.Write((byte)0);

            __strbuf = System.Text.Encoding.GetEncoding("US-ASCII").GetBytes(this.agentAuthor); outs.Write(__strbuf.Length + 1); outs.Write(__strbuf, 0, __strbuf.Length); outs.Write((byte)0);

            __strbuf = System.Text.Encoding.GetEncoding("US-ASCII").GetBytes(this.vote); outs.Write(__strbuf.Length + 1); outs.Write(__strbuf, 0, __strbuf.Length); outs.Write((byte)0);
        }
        public void _encodeRecursive(LCMDataOutputStream outs)
        {
            byte[] __strbuf = null;
            __strbuf = System.Text.Encoding.GetEncoding("US-ASCII").GetBytes(this.imageFilename); outs.Write(__strbuf.Length + 1); outs.Write(__strbuf, 0, __strbuf.Length); outs.Write((byte)0);

            outs.Write(this.jointX);

            outs.Write(this.jointY);

            outs.Write(this.radius);
        }