示例#1
0
            public Byte[] buf;      // Buffer

            public KissBuf(Int32 channel, int command, Byte[] buffer)
            {
                chan  = channel;
                Frame = null;
                cmd   = command;
                buf   = buffer;
            }
示例#2
0
        //  Overload for AckMode                (JNW Jan15)

        public Boolean Send(Frame.TransmitFrame transmitFrame)
        {
            String parsedFrameString = "";

            Byte[] buf = transmitFrame.ibuf;

            //
            // Post outbound packet to monitor queue if enabled
            //

            Byte[] tmp = new Byte[buf.Length];
            buf.CopyTo(tmp, 0);

            new Frame.ReceivedFrame(tmp, out parsedFrameString);

            if (!_packetMonitorEnable.Equals(PacketMonitorType.None))
            {
                StringBuilder frameString = new StringBuilder("|chan:" + chanNum.ToString() + "|-->", 4096);
                frameString.Append(parsedFrameString);
                if (_packetMonitorEnable.Equals(PacketMonitorType.LogFile) || _packetMonitorEnable.Equals(PacketMonitorType.Both))
                {
                    Support.PktPrint(frameString.ToString() + CRLF, ref packetLogSyncObject);
                }

                if (_packetMonitorEnable.Equals(PacketMonitorType.Queue) || _packetMonitorEnable.Equals(PacketMonitorType.Both))
                {
                    packetMonitorQueue.Enqueue(frameString.ToString());
                }
            }

            return(comSerialPort.SendCmd(chanNum, 0, transmitFrame));
        }
示例#3
0
        //  Overload for AckMode                (JNW Jan15)

        public Boolean SendCmd(Int32 channel, Int32 cmd, Frame.TransmitFrame transmitFrame)
        {
            Byte[] buf = transmitFrame.ibuf;

            //
            // Send incoming packet to the TNC via the COM port
            //
            Boolean ret = true;

            if (buf.Length > (MAXBUF >> 1))
            {
                _outboundQueueErrorCount++;
                ret = false;
            }

            //
            // Insert the command
            //

            if (!(ret = sendQ.Enqueue(new KissBuf(channel, transmitFrame))))
            {
                // Outbound Queue is full, so just drop the packet... c'est la vie.
                _outboundQueueErrorCount++;
                ret = false;
            }

            return(ret);
        }
示例#4
0
 public KissBuf(Int32 channel, Frame.TransmitFrame tFrame)
 {
     chan  = channel;
     Frame = tFrame;
 }
示例#5
0
 public Packet(Frame.TransmitFrame transmitType)
 {
     transmitFrame = transmitType;
 }