Exemple #1
0
        /// <summary>
        /// A routine to send command and receive response, and notify the result.
        /// </summary>
        /// <param name="ComPortAcc"></param>
        /// <param name="Command"></param>
        /// <returns></returns>
        public bool SendAndRecvRoutine(ComPortAccess ComPortAcc, ACommand Command)
        {
            try
            {
                byte[] ResData;
                ComPortAcc.SendAndRecv(Command.CmdData, out ResData);
                Command.ResData = ResData;
                Command.Check();
                this.OnNotifySendReceiveData(new NotifySendReceiveDataEventArgs(Command));

                return(true);
            }
            catch (CommandException CmdExpt)
            {
                this.OnNotifyRecvExceptionEvent(new NotifyCommandException(CmdExpt));

                return(false);
            }
        }