コード例 #1
0
 internal void Remove(MessageClient service)
 {
     lock (this.accessLock)
     {
         if (service == null)
         {
             return;
         }
         this.messageClientList.Remove(service);
     }
 }
コード例 #2
0
 internal InterbusHandling(string name)
 {
     this.name                   = name.Length != 0 ? "InterbusHandling " + name : nameof(InterbusHandling);
     this.diagnostic             = new Diagnostic(this.Name);
     this.msgClient              = new MessageClient(this.Name);
     this.msgClient.Timeout      = 5;
     this.msgClient.OnException += new ExceptionHandler(this.MsgClient_OnException);
     this.HandlingState          = InterbusHandlingState.Idle;
     this.RevisionInfo           = new RevisionInformation();
     this.FirmwareSercivePositiveConfirmationReceived += new ConfirmationReceiveHandler(this.OnPDCycleTimeHandler);
     this.FirmwareSercivePositiveConfirmationReceived += new ConfirmationReceiveHandler(this.OnGetVersionInfoHandler);
     this.activeFirmwareService = (FirmwareService)null;
 }
コード例 #3
0
        public int CompareTo(object obj)
        {
            MessageClient pMessageClient = obj as MessageClient;

            if (this.ControllerId > pMessageClient.ControllerId)
            {
                return(1);
            }
            if (this.ControllerId < pMessageClient.ControllerId)
            {
                return(-1);
            }
            return(this.CompareName(pMessageClient));
        }
コード例 #4
0
ファイル: PCP.cs プロジェクト: Chuanfeng-Feng/DemoModbus
 public PCP(string Name, int CR)
 {
     if (CR > 1)
     {
         this._commReference = CR;
     }
     this._locMessage = new MessageClient(Name);
     if (this._name == null)
     {
         this._name = this._locMessage.Name;
     }
     this._locMessage.OnException            += new ExceptionHandler(this._locMessage_OnException);
     this._locMessage.OnConfirmationReceived += new ConfirmationReceiveHandler(this._locMessage_OnConfirmationReceived);
     this._diagnostic = new Diagnostic(this.Name);
 }
コード例 #5
0
 internal void UpdateReceiveConfirmations(int receiveResult, int receiveUserId, int receiveLength, byte[] receiveData)
 {
     lock (this.accessLock)
     {
         if (this.GetWaitingConfirmations().Count <= 0)
         {
             return;
         }
         MessageClient waitConfirmation = this.GetClientWithWaitConfirmation(receiveUserId);
         if (waitConfirmation != null)
         {
             waitConfirmation.SetReceiveData(receiveData, receiveLength);
             waitConfirmation.CallConfirmationReceivedEvent((object)this);
         }
         foreach (MessageClient waitingConfirmation in (IEnumerable <MessageClient>) this.GetWaitingConfirmations())
         {
             waitingConfirmation.CheckTimeout();
         }
     }
 }
コード例 #6
0
 private int CompareName(MessageClient pMessageClient)
 {
     return(this.Name.CompareTo(pMessageClient.Name));
 }