Ejemplo n.º 1
0
        private void CreateSubscription(uint l_objectInstance, BacnetObjectTypes objectType, uint l_device)
        {
            var l_objectId = new BacnetObjectId(objectType, l_objectInstance);

            var l_address = this.GetBacnetAddress(l_device);

            if (l_address == null)
            {
                Debug.WriteLine($"Failed. Client {l_device} not found");
                return;
            }

            this.m_next_subscription_id++;

            m_bacnetClient.SubscribeCOVRequest(l_address, l_objectId, this.m_next_subscription_id, false, false, 160);

            var l_subscriptionKey = l_address + ":" + l_device + ":" + this.m_next_subscription_id;

            var l_subscription = new Subscription(
                m_bacnetClient,
                l_address,
                new BacnetObjectId(BacnetObjectTypes.OBJECT_DEVICE, l_device),
                l_objectId,
                l_subscriptionKey,
                this.m_next_subscription_id);

            this.m_subscription_list.Add(l_subscriptionKey, l_subscription);
        }
Ejemplo n.º 2
0
 public virtual bool FindBacnetObjectType(BacnetObjectTypes objType)
 {
     foreach (BaCSharpObject b in ObjectsList)
     {
         if (b.PROP_OBJECT_TYPE == (uint)objType)
         {
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 3
0
 private Object FindObject(BacnetObjectTypes object_type)
 {
     //liniear search
     foreach (Object obj in Objects)
     {
         if (obj.Type == object_type)
         {
             return(obj);
         }
     }
     return(null);
 }
Ejemplo n.º 4
0
        public BACnetObject GetBacnetObject(NameValueCollection nodeData, Boolean refresh = false)
        {
            var bacnetDevice = GetBacnetDevice(nodeData, refresh);

            if (refresh)
            {
                bacnetDevice.GetObjects();
            }

            if (bacnetDevice != null)
            {
                BacnetObjectTypes objType     = (BacnetObjectTypes)(Int32.Parse(nodeData["object_type"]));
                UInt32            objInstance = UInt32.Parse(nodeData["object_instance"]);
                var bacnetObjectId            = new BacnetObjectId(objType, objInstance);

                var bacnetObject = bacnetDevice.GetBacnetObject(bacnetObjectId);
                return(bacnetObject);
            }
            return(null);
        }
Ejemplo n.º 5
0
 private Object FindObject(BacnetObjectTypes objectType)
 {
     //liniear search
     return(Objects.FirstOrDefault(obj => obj.Type == objectType));
 }
Ejemplo n.º 6
0
 public BacnetObjectId(BacnetObjectTypes type, uint instance)
 {
     this.type     = type;
     this.instance = instance;
 }