示例#1
0
 public BacnetLogRecord(BacnetTrendLogValueTypes type, object value, DateTime stamp, uint status)
 {
     this.type   = type;
     timestamp   = stamp;
     statusFlags = BacnetBitString.ConvertFromInt(status);
     any_value   = null;
     Value       = value;
 }
示例#2
0
        public static BacnetBitString ConvertFromInt(uint value)
        {
            BacnetBitString ret = new BacnetBitString();

            ret.value     = BitConverter.GetBytes(value);
            ret.bits_used = (byte)Math.Ceiling(Math.Log(value, 2));
            return(ret);
        }
示例#3
0
        public DeviceReportingRecipient(BacnetBitString WeekofDay, DateTime fromTime, DateTime toTime, BacnetAddress adr, uint processIdentifier, bool Ack_Required, BacnetBitString evenType)
        {
            Id = new BacnetObjectId();

            this.WeekofDay         = WeekofDay;
            this.toTime            = toTime;
            this.fromTime          = fromTime;
            this.adr               = adr;
            this.processIdentifier = processIdentifier;
            this.Ack_Required      = Ack_Required;
            this.evenType          = evenType;
        }
示例#4
0
        public static BacnetBitString Parse(string str)
        {
            BacnetBitString ret = new BacnetBitString();

            ret.value = new byte[BACnetSerialize.ASN1.MAX_BITSTRING_BYTES];

            if (!string.IsNullOrEmpty(str))
            {
                ret.bits_used = (byte)str.Length;
                for (int i = 0; i < ret.bits_used; i++)
                {
                    bool is_set = str[i] == '1';
                    if (is_set)
                    {
                        ret.value[i / 8] |= (byte)(1 << (i % 8));
                    }
                }
            }

            return(ret);
        }
示例#5
0
        public DeviceReportingRecipient(BacnetValue v0, BacnetValue v1, BacnetValue v2, BacnetValue v3, BacnetValue v4, BacnetValue v5, BacnetValue v6)
        {
            Id  = new BacnetObjectId();
            adr = null;

            WeekofDay = (BacnetBitString)v0.Value;
            fromTime  = (DateTime)v1.Value;
            toTime    = (DateTime)v2.Value;
            if (v3.Value is BacnetObjectId)
            {
                Id = (BacnetObjectId)v3.Value;
            }
            else
            {
                BacnetValue[] netdescr = (BacnetValue[])v3.Value;
                ushort        s        = (ushort)(uint)netdescr[0].Value;
                byte[]        b        = (byte[])netdescr[1].Value;
                adr = new BacnetAddress(BacnetAddressTypes.IP, s, b);
            }
            processIdentifier = (uint)v4.Value;
            Ack_Required      = (bool)v5.Value;
            evenType          = (BacnetBitString)v6.Value;
        }