public UnconfirmedCOVnotification(byte[] apdu)
        {
            int len = 2;

            BacNetTag tag = new BacNetTag(apdu, len, ref len);
            ProccessId = new BacNetUInt(apdu, len, tag.Length, ref len);

            tag = new BacNetTag(apdu, len, ref len);
            Device = new BacNetObject(apdu, len, ref len);

            tag = new BacNetTag(apdu, len, ref len);
            Object = new BacNetObject(apdu, len, ref len);

            tag = new BacNetTag(apdu, len, ref len);
            TimeRemaining = new BacNetUInt(apdu, len, tag.Length, ref len);

            tag = new BacNetTag(apdu, len, ref len);

            tag = new BacNetTag(apdu, len, ref len);
            BacNetUInt value = new BacNetUInt(apdu, len, tag.Length, ref len);

            //{
            tag = new BacNetTag(apdu, len, ref len);

            tag = new BacNetTag(apdu, len, ref len);

            //Это не правильно!!!!
            /*BacNetReal analogvalue = new BacNetReal(apdu, len, tag.Length, ref len);

            //}
            tag = new BacNetTag(apdu, len, ref len);

            tag = new BacNetTag(apdu, len, ref len);*/
        }
Exemple #2
0
 public WriteProperty(BacNetObject bacNetObject, BacNetEnums.BACNET_PROPERTY_ID propertyId, ArrayList valueList)
 {
     ObjectId = bacNetObject;
     PropertyId = new BacNetUInt();
     PropertyId.Value = (uint) propertyId;
     ValueList = valueList;
     InvokeId = BacNetDevice.Instance.InvokeId;
 }
        public UnconfirmedEventNotification(byte[] apdu)
        {
            int len = 2;

            BacNetTag tag = new BacNetTag(apdu, len, ref len);
            ProccessId = new BacNetUInt(apdu, len, tag.Length, ref len);

            tag = new BacNetTag(apdu, len, ref len);
            Device = new BacNetObject(apdu, len, ref len);

            tag = new BacNetTag(apdu, len, ref len);
            Object = new BacNetObject(apdu, len, ref len);

            tag = new BacNetTag(apdu, len, ref len);
            if (tag.Length == 6 && tag.Number == 3)
            {
                tag = new BacNetTag(apdu, len, ref len);
                if (tag.Length == 6 && tag.Number == 2)
                {
                    TimeStamp = new BacNetTimeStamp(apdu, len, ref len);
                }
                tag = new BacNetTag(apdu, len, ref len);
                tag = new BacNetTag(apdu, len, ref len);
                if (tag.Length != 7 && tag.Number != 3)
                    throw new Exception("Invalid TimeStamp");
            }

            tag = new BacNetTag(apdu, len, ref len);
            NotificationClass = new BacNetUInt(apdu, len, tag.Length, ref len);

            tag = new BacNetTag(apdu, len, ref len);
            Priority = new BacNetUInt(apdu, len, tag.Length, ref len);

            tag = new BacNetTag(apdu, len, ref len);
            EventType = new BacNetUInt(apdu, len, tag.Length, ref len);

            tag = new BacNetTag(apdu, len, ref len);
            Message = new BacNetString(apdu, len, tag.Length, ref len);

            tag = new BacNetTag(apdu, len, ref len);
            NotifyType = new BacNetUInt(apdu, len, tag.Length, ref len);

            tag = new BacNetTag(apdu, len, ref len);
            AckRequired = new BacNetUInt(apdu, len, tag.Length, ref len);

            tag = new BacNetTag(apdu, len, ref len);
            FromState = new BacNetUInt(apdu, len, tag.Length, ref len);

            tag = new BacNetTag(apdu, len, ref len);
            ToState = new BacNetUInt(apdu, len, tag.Length, ref len);
        }
Exemple #4
0
        public WhoIs(byte[] apdu)
        {
            if(apdu.Length < 2)
                throw new Exception("Malformed APDU byte array");
            if (apdu.Length == 2)
                return;
            int len = 2;
            //Low limit
            BacNetTag lowLimitTag = new BacNetTag(apdu, len, ref len);
            LowLimit = new BacNetUInt(apdu, len, lowLimitTag.Length, ref len);
            //High limit

            BacNetTag highLimitTag = new BacNetTag(apdu, len, ref len);
            HighLimit = new BacNetUInt(apdu, len, highLimitTag.Length, ref len);
        }
Exemple #5
0
 public ReadPropertyAck(byte[] apdu)
 {
     InvokeId = apdu[1];
     int len = 3;
     //Object tag
     BacNetTag objectIdTag = new BacNetTag(apdu, len, ref len);
     if (objectIdTag.Class == false)
         throw new Exception("Reject.Invalid_tag");
     Obj = new BacNetObject(apdu, len, ref len);
     //Property Id
     BacNetTag propertyIdTag = new BacNetTag(apdu, len, ref len);
     if (propertyIdTag.Number != 1)
         throw new Exception("Reject.Invalid_tag");
     BacNetUInt PropertyId = new BacNetUInt(apdu, len, propertyIdTag.Length, ref len);
     BacNetTag openingTag = new BacNetTag(apdu, len, ref len);
     ArrayList ValueList = new ArrayList();
     if (openingTag.Length == 6)
     {
         BacNetTag metaTag = new BacNetTag(apdu, len, ref len);
         while (metaTag.Length != 7)
         {
             if (metaTag.Class == false)
             {
                 object value = ByteConverter.GetAppTagValue(apdu, len, metaTag, ref len);
                 ValueList.Add(value);
             }
             else
             {
                 if (metaTag.Length == 6 && PropertyId.Value == (int)BacNetEnums.BACNET_PROPERTY_ID.PROP_WEEKLY_SCHEDULE)
                 {
                     var value = BuildScheduleDay(apdu, ref len);
                     ValueList.Add(value);
                 }
                 if (metaTag.Length == 4 && metaTag.Number == 0 && PropertyId.Value == (int)BacNetEnums.BACNET_PROPERTY_ID.PROP_LIST_OF_OBJECT_PROPERTY_REFERENCES)
                 {
                     var value = BuildObjectPropertyReference(apdu, ref len);
                     ValueList.Add(value);
                 }
             }
             metaTag = new BacNetTag(apdu, len, ref len);
         }
     }
     var property = new BacNetProperty {PropertyId = PropertyId, Values = ValueList};
     Obj.Properties.Add(property);
 }
Exemple #6
0
 public WhoIs(UInt16 startAddress = UInt16.MinValue, UInt16 endAddress = UInt16.MaxValue)
 {
     if (startAddress <= endAddress && endAddress != UInt16.MaxValue)
     {
         LowLimit = new BacNetUInt { Value = startAddress };
         HighLimit = new BacNetUInt { Value = endAddress };
     }
     /*ServiceNumber = (byte) BacNetEnums.BACNET_UNCONFIRMED_SERVICE.SERVICE_UNCONFIRMED_WHO_IS;
     if (startAddress != UInt16.MinValue && endAddress != UInt16.MaxValue)
     {
         byte[] start = ByteConverter.GetBytes(startAddress);
         _params.AddRange((new BacNetTag { Class = true, Length = (byte)start.Length, Number = 0 }).GetBytes());
         _params.AddRange(start);
         byte[] end = ByteConverter.GetBytes(endAddress);
         _params.AddRange((new BacNetTag { Class = true, Length = (byte)end.Length, Number = 1 }).GetBytes());
         _params.AddRange(end);
     }*/
 }
Exemple #7
0
 private object BuildObjectPropertyReference(byte[] apdu, ref int len)
 {
     var objId = new BacNetObject(apdu, len, ref len);
     var metaTag = new BacNetTag(apdu, len, ref len);
     var propId = new BacNetUInt(apdu, len, metaTag.Length, ref len);
     return new BacNetObjectPropertyRef {ObjectId = objId, PropertyId = propId};
 }
Exemple #8
0
 private void InitializeFields()
 {
     Values     = new ArrayList();
     PropertyId = new BacNetUInt();
 }
Exemple #9
0
 private void InitializeFields()
 {
     Values = new ArrayList();
     PropertyId = new BacNetUInt();
 }
Exemple #10
0
 public BacNetEnumeration(byte[] apdu, int startIndex, int length, ref int len)
 {
     BacNetUInt res = new BacNetUInt(apdu, startIndex, length, ref len);
     Value = res.Value;
 }
Exemple #11
0
        public BacNetEnumeration(byte[] apdu, int startIndex, int length, ref int len)
        {
            BacNetUInt res = new BacNetUInt(apdu, startIndex, length, ref len);

            Value = res.Value;
        }
 private List<BacNetProperty> ReadProperties(byte[] apdu, int startIndex, uint objectId, ref int len)
 {
     List<BacNetProperty> res = new List<BacNetProperty>();
     var openingTag = new BacNetTag(apdu, len, ref len);
     if (openingTag.Length == 6 && openingTag.Number == 1)
     {
         BacNetTag metaTag = new BacNetTag(apdu, len, ref len);
         while ((metaTag.Length != 7 || metaTag.LongTag) && metaTag.Number != 1)
         {
             var propertyId = new BacNetUInt(apdu, len, metaTag.Length, ref len);
             BacNetProperty prop = new BacNetProperty { PropertyId = propertyId};
             prop.Values = ReadValues(apdu, len, ref len);
             res.Add(prop);
             metaTag = new BacNetTag(apdu, len, ref len);
         }
     }
     return res;
 }