System.IO.BACnet.BacnetPtpProtocolTransport.Send C# (CSharp) Method

Send() public method

public Send ( byte buffer, int offset, int data_length, BacnetAddress address, bool wait_for_transmission, int timeout ) : int
buffer byte
offset int
data_length int
address BacnetAddress
wait_for_transmission bool
timeout int
return int
        public int Send(byte[] buffer, int offset, int data_length, BacnetAddress address, bool wait_for_transmission, int timeout)
        {
            BacnetPtpFrameTypes frame_type = BacnetPtpFrameTypes.FRAME_TYPE_DATA0;
            if (m_sequence_counter) frame_type = BacnetPtpFrameTypes.FRAME_TYPE_DATA1;
            m_sequence_counter = !m_sequence_counter;

            //add header
            int full_length = PTP.Encode(buffer, offset - PTP.PTP_HEADER_LENGTH, frame_type, data_length);

            //wait for send allowed
            if (!m_may_send.WaitOne(timeout))
                return -BacnetMstpProtocolTransport.ETIMEDOUT;

            //debug
            if (StateLogging)
                Trace.WriteLine("         " + frame_type, null);

            //send
            SendWithXonXoff(buffer, offset - HeaderLength, full_length);
            return data_length;
        }