Пример #1
0
        /// <summary>
        /// 发送连续帧
        /// </summary>
        /// <param name="_runout"></param>
        /// <returns></returns>
        public ZLG_API.VCI_CAN_OBJ SendConsecutiveFrame()
        {
            List <byte> listSendFrame = new List <byte> {
            };

            try
            {
                byte[] arrTimes          = BitConverter.GetBytes(ExpectedSN++); // hong
                byte   nConsecutiveTimes = (byte)(2 << 4 | (arrTimes[0] & 0x0F));

                listSendFrame.AddRange(SetConsecutiveFrame(nConsecutiveTimes));
                for (int i = 0; i < 7; i++)
                {
                    if (ListNetLayerByteData.Count - Offset > 0)  // hong  if (ListNetLayerByteData.Count > 0)
                    {
                        listSendFrame.Add(ListNetLayerByteData[Offset++]);
                        //Offset++;
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(NetworkLayerCommunication.ConvertToCANFrame(this.nID, listSendFrame));//new SendSingleFrame(_strID, sendData, "连续帧");
        }
Пример #2
0
 public void Initialize()
 {
     AppLayerSenFun += _apf =>
     {
         NetworkLayerCommunication.DisposeSendFlag(_apf);
     };
     netWorkCommClass.RaiseNetworkLayerCommEvent += HandlerNetworkLayerCommEvent;
 }
Пример #3
0
        /// <summary>
        /// 发送流控
        /// </summary>
        /// <returns></returns>
        public ZLG_API.VCI_CAN_OBJ SendFlowControl()
        {
            List <byte> sendData = new List <byte> {
            };

            sendData.AddRange(SetFlowControlFrame(FS_Sign, BS_Num, STmin_ms));

            return(NetworkLayerCommunication.ConvertToCANFrame(ApplicationLayerProtocol.RequestID, sendData));
        }
Пример #4
0
        /// <summary>
        /// 发送单帧
        /// </summary>
        /// <returns></returns>
        public ZLG_API.VCI_CAN_OBJ SendSingleFrame()
        {
            List <byte> sendData = new List <byte> {
            };

            sendData.AddRange(SetSingleFrame(DataLen));
            sendData.AddRange(SetFlowControlFrame(FS_Sign, BS_Num, STmin_ms));

            return(NetworkLayerCommunication.ConvertToCANFrame(this.nID, sendData));
        }
Пример #5
0
        /// <summary>
        /// 发送首帧
        /// </summary>
        /// <returns></returns>
        public ZLG_API.VCI_CAN_OBJ SendFirstFrame()
        {
            List <byte> listSendData = new List <byte> {
            };

            DataLen = ListNetLayerByteData.Count; // hongs
            listSendData.AddRange(SetFirstFrame(DataLen));
            listSendData.AddRange(ListNetLayerByteData.Take(6));

            Offset += 6; // hongs
            ExpectedSN++;

            return(NetworkLayerCommunication.ConvertToCANFrame(this.nID, listSendData));
        }