Beispiel #1
0
        //
        // Reading and writing
        //
        public BitString(ByteStream queue)
        {
            int length    = (int)readTag(queue) - 1;
            int remainder = queue.popU1B();

            if (length == 0)
            {
                Value = new bool[0];
            }
            else
            {
                byte[] data = new byte[length];
                queue.Read(data);
                Value = BACnetUtils.convertToBooleans(data, length * 8 - remainder);
            }
        }
Beispiel #2
0
 protected override void WriteImpl(ByteStream queue)
 {
     if (Value.Length == 0)
     {
         queue.WriteByte((byte)0);
     }
     else
     {
         int remainder = Value.Length % 8;
         if (remainder > 0)
         {
             remainder = 8 - remainder;
         }
         queue.WriteByte((byte)remainder);
         queue.Write(BACnetUtils.convertToBytes(Value));
     }
 }
Beispiel #3
0
        public OctetString(string dottedString, int portArg)
        {
            dottedString = dottedString.Trim();
            int colon = dottedString.IndexOf(":");

            if (colon == -1)
            {
                byte[] b = BACnetUtils.dottedStringToBytes(dottedString);
                if (b.Length == 4)
                {
                    Bytes = toBytes(b, portArg);
                }
                else
                {
                    Bytes = b;
                }
            }
            else
            {
                byte[] ip   = BACnetUtils.dottedStringToBytes(dottedString.Substring(0, colon));
                int    port = int.Parse(dottedString.Substring(colon + 1));
                Bytes = toBytes(ip, port);
            }
        }