/// <summary>
 /// 发送召唤命令
 /// </summary>
 /// <param name="cot">传输原因</param>
 /// <param name="qoi">召唤限定词</param>
 private void SendMasterCommand(CauseOfTransmissionList cot, QualifyOfInterrogationList qoi)
 {
     try
     {
         var id = TypeIdentification.C_IC_NA_1;//召唤命令
         eventTypeIDManager.AddEventProcess(new EventProperty(id));
         var frame = new MasterCommand(appMessageManager.TransmitSequenceNumber, appMessageManager.RealReceiveSequenceNumber,
                                       id, cot, appMessageManager.ASDUADdress, qoi);
         var array = frame.GetAPDUDataArray();
         MainTypeIProcess(array, array.Length, appMessageManager.WaitTime, id);
         appMessageManager.UpdateTransmitSequenceNumber();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "SendMasterCommand发送召唤命令");
     }
 }
Beispiel #2
0
        /// <summary>
        /// MasterCommand APDU初始化,用于主站系统 召唤命令
        /// </summary>
        /// <param name="typeID">类型ID</param>
        /// <param name="transmitSeqNum">发送序列号</param>
        /// <param name="ReceiveSeqNum">接收序列号</param>
        /// <param name="cot">传输原因</param>
        /// <param name="asduPublicAddress">ASDU公共地址</param>
        /// <param name="qoi">召唤限定词</param>
        public MasterCommand(UInt16 transmitSeqNum, UInt16 ReceiveSeqNum, TypeIdentification typeID,
                             CauseOfTransmissionList cot, UInt16 asduPublicAddress, QualifyOfInterrogationList qoi)
        {
            ASDU = new ApplicationServiceDataUnit((byte)typeID, (byte)1, false, (byte)cot, asduPublicAddress);
            //信息对象地址为0
            ASDU.InformationObject[0] = 0;
            ASDU.InformationObject[1] = 0;
            ASDU.InformationObject[2] = 0;
            //召唤限定词
            ASDU.InformationObject[3] = (byte)qoi;

            var apduLen = 4 + ASDU.Length; //控制域长度4 + ASDU长度

            APCI = new APCITypeI((byte)apduLen, transmitSeqNum, ReceiveSeqNum);

            TimeStamp = DateTime.Now;
        }