Esempio n. 1
0
            bool HandleCommandWithRetData(
                InterfaceCommand command, byte[] commandData,
                out byte[] responseData)
            {
                bool commandHandledSuccessfully = false;

                //send command at device
                m_Device.SendCmdMessage(command, commandData);
                //wait timeout response filled
                Thread.Sleep(B2B_RETURN_ACK_TIMEOUT_MSEC);
                if (Helper.GetDeviceCmdResponse(
                        m_Device.m_CommunicationPort, out responseData) &&
                    Response.CheckDataPacket(responseData) &&
                    NakResponse.CheckData(responseData) == false)
                {
                    commandHandledSuccessfully = true;
                }
                return(commandHandledSuccessfully);
            }
Esempio n. 2
0
            public bool Handle(out T response)
            {
                bool ret = false;

                response = null;
                byte[] responseData;

                lock (m_Device.m_PortLocker)
                {
                    if (HandleCommandWithRetData(
                            m_InterfaceCommand, m_CommandData, out responseData) &&
                        Response.CheckDataPacket(responseData) &&
                        NakResponse.CheckData(responseData) == false)
                    {
                        if (OnHandle(responseData, out response) == true)
                        {
                            m_Device.SendAckMessage();
                            ret = true;
                        }
                    }
                }
                return(ret);
            }