当前位置: 首页>>代码示例>>C#>>正文


C# BacnetAddress类代码示例

本文整理汇总了C#中BacnetAddress的典型用法代码示例。如果您正苦于以下问题:C# BacnetAddress类的具体用法?C# BacnetAddress怎么用?C# BacnetAddress使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BacnetAddress类属于命名空间,在下文中一共展示了BacnetAddress类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BacnetAsyncResult

 public BacnetAsyncResult(BacnetClient comm, BacnetAddress adr, byte invoke_id, byte[] transmit_buffer, int transmit_length, bool wait_for_transmit, int transmit_timeout)
 {
     m_transmit_timeout = transmit_timeout;
     m_adr = adr;
     m_wait_for_transmit = wait_for_transmit;
     m_transmit_buffer = transmit_buffer;
     m_transmit_length = transmit_length;
     AsyncWaitHandle = new System.Threading.ManualResetEvent(false);
     m_comm = comm;
     m_wait_invoke_id = invoke_id;
     m_comm.OnComplexAck += new BacnetClient.ComplexAckHandler(m_comm_OnComplexAck);
     m_comm.OnError += new BacnetClient.ErrorHandler(m_comm_OnError);
     m_comm.OnAbort += new BacnetClient.AbortHandler(m_comm_OnAbort);
     m_comm.OnSimpleAck += new BacnetClient.SimpleAckHandler(m_comm_OnSimpleAck);
     m_comm.OnSegment += new BacnetClient.SegmentHandler(m_comm_OnSegment);
 }
开发者ID:RF77,项目名称:comfobox-mqtt,代码行数:16,代码来源:BACnetClient.cs

示例2: Set

 public void Set(BacnetAddress adr, byte invoke_id, byte sequence_number, byte window_size)
 {
     lock (m_lockObject)
     {
         this.adr = adr;
         this.invoke_id = invoke_id;
         this.sequence_number = sequence_number;
         this.window_size = window_size;
         m_wait.Set();
     }
 }
开发者ID:RF77,项目名称:comfobox-mqtt,代码行数:11,代码来源:BACnetClient.cs

示例3: handler_OnIam

        /*****************************************************************************************************/
        static void handler_OnIam(BacnetClient sender, BacnetAddress adr, uint device_id, uint max_apdu, BacnetSegmentations segmentation, ushort vendor_id)
        {
            lock (DevicesList)
            {
                // Device already registred ?
                foreach (BacNode bn in DevicesList)
                    if (bn.getAdd(device_id) != null) return;   // Yes

                // Not already in the list
                DevicesList.Add(new BacNode(adr, device_id));   // add it
            }
        }
开发者ID:temcocontrols,项目名称:T3000_Building_Automation_System,代码行数:13,代码来源:BACnetClass.cs

示例4: Send

        public int Send(byte[] buffer, int offset, int data_length, BacnetAddress address, bool wait_for_transmission, int timeout)
        {
            if (m_TS == -1) throw new Exception("Source address must be set up before sending messages");

            //add to queue
            BacnetNpduControls function = NPDU.DecodeFunction(buffer, offset);
            BacnetMstpFrameTypes frame_type = (function & BacnetNpduControls.ExpectingReply) == BacnetNpduControls.ExpectingReply ? BacnetMstpFrameTypes.FRAME_TYPE_BACNET_DATA_EXPECTING_REPLY : BacnetMstpFrameTypes.FRAME_TYPE_BACNET_DATA_NOT_EXPECTING_REPLY;
            byte[] copy = new byte[data_length + MSTP.MSTP_HEADER_LENGTH + 2];
            Array.Copy(buffer, offset, copy, MSTP.MSTP_HEADER_LENGTH, data_length);
            MessageFrame f = new MessageFrame(frame_type, address.adr[0], copy, data_length);
            m_send_queue.AddLast(f);
            if (m_reply == null)
            {
                m_reply = f;
                m_reply_mutex.Set();
            }

            //wait for message to be sent
            if (wait_for_transmission)
                if (!f.send_mutex.WaitOne(timeout))
                    return -ETIMEDOUT;

            return data_length;
        }
开发者ID:RF77,项目名称:comfobox-mqtt,代码行数:24,代码来源:BACnetTransport.cs

示例5: Convert

 public static void Convert(BacnetAddress addr, out System.Net.IPEndPoint ep)
 {
     long ip_address = BitConverter.ToUInt32(addr.adr, 0);
     ushort port = (ushort)((addr.adr[4] << 8) | (addr.adr[5] << 0));
     ep = new System.Net.IPEndPoint(ip_address, (int)port);
 }
开发者ID:RF77,项目名称:comfobox-mqtt,代码行数:6,代码来源:BACnetTransport.cs

示例6: BacNode

 public BacNode(BacnetAddress adr, uint deviceId)
 {
     _adr = adr;
     _deviceId = deviceId;
 }
开发者ID:RF77,项目名称:comfobox-mqtt,代码行数:5,代码来源:BacNode.cs

示例7: OnPacketArrival

        void OnPacketArrival(RawCapture packet)
        {
            // don't process any packet too short to not be valid
            if (packet.Data.Length <= 17)
                return;

            byte[] buffer = packet.Data;
            int offset = 0;

            int length;
            byte dsap, ssap, control;

            // Got frames send by me, not for me, not broadcast
            byte[] dest = Mac(buffer, offset);
            if (!_isOutboundPacket(dest, 0) && (dest[0] != 255))
                return;

            offset += 6;

            // source address
            BacnetAddress Bac_source = new BacnetAddress(BacnetAddressTypes.Ethernet, 0, Mac(buffer, offset));
            offset += 6;

            // len
            length = buffer[offset] * 256 + buffer[offset + 1];
            offset += 2;

            // 3 bytes LLC hearder
            dsap = buffer[offset++];
            ssap = buffer[offset++];
            control = buffer[offset++];

            length -= 3; // Bacnet content length eq. ethernet lenght minus LLC header length

            // don't process non-BACnet packets
            if (dsap != 0x82 || ssap != 0x82 || control != 0x03)
                return;

            if (MessageRecieved != null)
                MessageRecieved(this, buffer, HeaderLength, length, Bac_source);
        }
开发者ID:temcocontrols,项目名称:T3000_Building_Automation_System,代码行数:41,代码来源:BacnetTransportEthernet.cs

示例8: BeginReinitializeRequest

        public IAsyncResult BeginReinitializeRequest(BacnetAddress adr, BacnetReinitializedStates state, string password, bool wait_for_transmit, byte invoke_id = 0)
        {
            Trace.WriteLine("Sending ReinitializeRequest ... ", null);
            if (invoke_id == 0) invoke_id = unchecked(m_invoke_id++);

            EncodeBuffer b = GetEncodeBuffer(m_client.HeaderLength);
            NPDU.Encode(b, BacnetNpduControls.PriorityNormalMessage, adr.RoutedSource, null, DEFAULT_HOP_COUNT, BacnetNetworkMessageTypes.NETWORK_MESSAGE_WHO_IS_ROUTER_TO_NETWORK, 0);
            APDU.EncodeConfirmedServiceRequest(b, BacnetPduTypes.PDU_TYPE_CONFIRMED_SERVICE_REQUEST | (m_max_segments != BacnetMaxSegments.MAX_SEG0 ? BacnetPduTypes.SEGMENTED_RESPONSE_ACCEPTED : 0), BacnetConfirmedServices.SERVICE_CONFIRMED_REINITIALIZE_DEVICE, m_max_segments, m_client.MaxAdpuLength, invoke_id, 0, 0);
            Services.EncodeReinitializeDevice(b, state, password);

            //send
            BacnetAsyncResult ret = new BacnetAsyncResult(this, adr, invoke_id, b.buffer, b.offset - m_client.HeaderLength, wait_for_transmit, m_transmit_timeout);
            ret.Resend();

            return ret;
        }
开发者ID:RF77,项目名称:comfobox-mqtt,代码行数:16,代码来源:BACnetClient.cs

示例9: BeginReadRangeRequest

        // Fc
        public IAsyncResult BeginReadRangeRequest(BacnetAddress adr, BacnetObjectId object_id,  uint idxBegin, uint Quantity, bool wait_for_transmit, byte invoke_id = 0)
        {
            Trace.WriteLine("Sending ReadRangeRequest ... ", null);
            if (invoke_id == 0) invoke_id = unchecked(m_invoke_id++);

            //encode
            EncodeBuffer b = GetEncodeBuffer(m_client.HeaderLength);
            NPDU.Encode(b, BacnetNpduControls.PriorityNormalMessage, adr.RoutedSource, null, DEFAULT_HOP_COUNT, BacnetNetworkMessageTypes.NETWORK_MESSAGE_WHO_IS_ROUTER_TO_NETWORK, 0);
            APDU.EncodeConfirmedServiceRequest(b, BacnetPduTypes.PDU_TYPE_CONFIRMED_SERVICE_REQUEST | (m_max_segments != BacnetMaxSegments.MAX_SEG0 ? BacnetPduTypes.SEGMENTED_RESPONSE_ACCEPTED : 0), BacnetConfirmedServices.SERVICE_CONFIRMED_READ_RANGE, m_max_segments, m_client.MaxAdpuLength, invoke_id, 0, 0);
            Services.EncodeReadRange(b, object_id, (uint)BacnetPropertyIds.PROP_LOG_BUFFER, ASN1.BACNET_ARRAY_ALL, BacnetReadRangeRequestTypes.RR_BY_POSITION, idxBegin, DateTime.Now, (int)Quantity);
            //send
            BacnetAsyncResult ret = new BacnetAsyncResult(this, adr, invoke_id, b.buffer, b.offset - m_client.HeaderLength, wait_for_transmit, m_transmit_timeout);
            ret.Resend();

            return ret;
        }
开发者ID:RF77,项目名称:comfobox-mqtt,代码行数:17,代码来源:BACnetClient.cs

示例10: BeginRawEncodedDecodedPropertyConfirmedRequest

        // Fc
        public IAsyncResult BeginRawEncodedDecodedPropertyConfirmedRequest(BacnetAddress adr, BacnetObjectId object_id, BacnetPropertyIds property_id, BacnetConfirmedServices service_id, byte[] InOutBuffer, bool wait_for_transmit, byte invoke_id = 0)
        {
            Trace.WriteLine("Sending RawEncodedRequest ... ", null);
            if (invoke_id == 0) invoke_id = unchecked(m_invoke_id++);

            EncodeBuffer b = GetEncodeBuffer(m_client.HeaderLength);
            NPDU.Encode(b, BacnetNpduControls.PriorityNormalMessage | BacnetNpduControls.ExpectingReply, adr.RoutedSource, null, DEFAULT_HOP_COUNT, BacnetNetworkMessageTypes.NETWORK_MESSAGE_WHO_IS_ROUTER_TO_NETWORK, 0);
            APDU.EncodeConfirmedServiceRequest(b, BacnetPduTypes.PDU_TYPE_CONFIRMED_SERVICE_REQUEST | (m_max_segments != BacnetMaxSegments.MAX_SEG0 ? BacnetPduTypes.SEGMENTED_RESPONSE_ACCEPTED : 0), service_id , m_max_segments, m_client.MaxAdpuLength, invoke_id, 0, 0);

            ASN1.encode_context_object_id(b, 0, object_id.type, object_id.instance);
            ASN1.encode_context_enumerated(b, 1, (byte)property_id);

            // No content encoding to do
            if (InOutBuffer!=null)
                b.Add(InOutBuffer, InOutBuffer.Length);

            //send
            BacnetAsyncResult ret = new BacnetAsyncResult(this, adr, invoke_id, b.buffer, b.offset - m_client.HeaderLength, wait_for_transmit, m_transmit_timeout);
            ret.Resend();

            return ret;
        }
开发者ID:RF77,项目名称:comfobox-mqtt,代码行数:23,代码来源:BACnetClient.cs

示例11: BeginConfirmedNotify

        public IAsyncResult BeginConfirmedNotify(BacnetAddress adr, uint subscriberProcessIdentifier, uint initiatingDeviceIdentifier, BacnetObjectId monitoredObjectIdentifier, uint timeRemaining, IList<BacnetPropertyValue> values, bool wait_for_transmit, byte invoke_id = 0)
        {
            Trace.WriteLine("Sending Notify (confirmed) ... ", null);
            if (invoke_id == 0) invoke_id = unchecked(m_invoke_id++);

            EncodeBuffer b = GetEncodeBuffer(m_client.HeaderLength);
            NPDU.Encode(b, BacnetNpduControls.PriorityNormalMessage, adr.RoutedSource, null, DEFAULT_HOP_COUNT, BacnetNetworkMessageTypes.NETWORK_MESSAGE_WHO_IS_ROUTER_TO_NETWORK, 0);
            APDU.EncodeConfirmedServiceRequest(b, BacnetPduTypes.PDU_TYPE_CONFIRMED_SERVICE_REQUEST | (m_max_segments != BacnetMaxSegments.MAX_SEG0 ? BacnetPduTypes.SEGMENTED_RESPONSE_ACCEPTED : 0), BacnetConfirmedServices.SERVICE_CONFIRMED_COV_NOTIFICATION, m_max_segments, m_client.MaxAdpuLength, invoke_id, 0, 0);
            Services.EncodeCOVNotifyConfirmed(b, subscriberProcessIdentifier, initiatingDeviceIdentifier, monitoredObjectIdentifier, timeRemaining, values);

            //send
            BacnetAsyncResult ret = new BacnetAsyncResult(this, adr, invoke_id, b.buffer, b.offset - m_client.HeaderLength, wait_for_transmit, m_transmit_timeout);
            ret.Resend();

            return ret;
        }
开发者ID:RF77,项目名称:comfobox-mqtt,代码行数:16,代码来源:BACnetClient.cs

示例12: AddListElementRequest

        //*************************************************************
        public bool AddListElementRequest(BacnetAddress adr, BacnetObjectId object_id,BacnetPropertyReference reference, IList<BacnetValue> value_list, byte invoke_id = 0)
        {
            using (BacnetAsyncResult result = (BacnetAsyncResult)BeginAddListElementRequest(adr, object_id,reference,value_list, true, invoke_id))
            {
                for (int r = 0; r < m_retries; r++)
                {

                    if (result.WaitForDone(m_timeout))
                    {
                        Exception ex;
                        EndAddListElementRequest(result, out ex);
                        if (ex != null) throw ex;
                        else return true;
                    }
                    result.Resend();
                }
            }
            //values = null;
            return false;
        }
开发者ID:RF77,项目名称:comfobox-mqtt,代码行数:21,代码来源:BACnetClient.cs

示例13: Wait

 public bool Wait(BacnetAddress adr, byte invoke_id, int timeout)
 {
     System.Threading.Monitor.Enter(m_lockObject);
     while (!adr.Equals(this.adr) || this.invoke_id != invoke_id)
     {
         m_wait.Reset();
         System.Threading.Monitor.Exit(m_lockObject);
         if (!m_wait.WaitOne(timeout)) return false;
         System.Threading.Monitor.Enter(m_lockObject);
     }
     System.Threading.Monitor.Exit(m_lockObject);
     this.adr = null;
     return true;
 }
开发者ID:RF77,项目名称:comfobox-mqtt,代码行数:14,代码来源:BACnetClient.cs

示例14: DeviceCommunicationControlRequest

 public bool DeviceCommunicationControlRequest(BacnetAddress adr, uint timeDuration, uint enable_disable, string password, byte invoke_id = 0)
 {
     using (BacnetAsyncResult result = (BacnetAsyncResult)BeginDeviceCommunicationControlRequest(adr, timeDuration, enable_disable, password, true, invoke_id))
     {
         for (int r = 0; r < m_retries; r++)
         {
             if (result.WaitForDone(m_timeout))
             {
                 Exception ex;
                 EndDeviceCommunicationControlRequest(result, out ex);
                 if (ex != null) return false;
                 else return true;
             }
             result.Resend();
         }
     }
     return false;
 }
开发者ID:RF77,项目名称:comfobox-mqtt,代码行数:18,代码来源:BACnetClient.cs

示例15: BeginRemoveListElementRequest

        //***********************************************************************
        public IAsyncResult BeginRemoveListElementRequest(BacnetAddress adr, BacnetObjectId object_id,BacnetPropertyReference reference, IList<BacnetValue> value_list, bool wait_for_transmit, byte invoke_id = 0)
        {
            Trace.WriteLine("Sending RemoveListElementRequest ... ", null);
            if (invoke_id == 0) invoke_id = unchecked(m_invoke_id++);

            EncodeBuffer b = GetEncodeBuffer(m_client.HeaderLength);
            NPDU.Encode(b, BacnetNpduControls.PriorityNormalMessage, adr.RoutedSource, null, DEFAULT_HOP_COUNT, BacnetNetworkMessageTypes.NETWORK_MESSAGE_WHO_IS_ROUTER_TO_NETWORK, 0);
            APDU.EncodeConfirmedServiceRequest(b, BacnetPduTypes.PDU_TYPE_CONFIRMED_SERVICE_REQUEST | (m_max_segments != BacnetMaxSegments.MAX_SEG0 ? BacnetPduTypes.SEGMENTED_RESPONSE_ACCEPTED : 0), BacnetConfirmedServices.SERVICE_CONFIRMED_REMOVE_LIST_ELEMENT, m_max_segments, m_client.MaxAdpuLength, invoke_id, 0, 0);
            Services.EncodeAddListElement(b, object_id,(uint) reference.propertyIdentifier,(uint) reference.propertyArrayIndex,value_list);

            //send
            BacnetAsyncResult ret = new BacnetAsyncResult(this, adr, invoke_id, b.buffer, b.offset - m_client.HeaderLength, wait_for_transmit, m_transmit_timeout);
            ret.Resend();

            return ret;
        }
开发者ID:RF77,项目名称:comfobox-mqtt,代码行数:17,代码来源:BACnetClient.cs


注:本文中的BacnetAddress类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。