Ejemplo n.º 1
0
 

        public void PortSwitchStatus(int status)
        {
            string alertMsg = "No Error";
            string alertTitle = "Error";

            switch (status)
            {
                case ServiceTool.Legacy.Dongle.Constants.SVTLogonError:
                    alertTitle = "Error";
                    alertMsg = "REM protocol not supported";
                    break;
                case ServiceTool.Legacy.Dongle.Constants.SVTConnected:
                    alertTitle = "Success";
                    alertMsg = "REM protocol is supported";
                    break;
                case ServiceTool.Legacy.Dongle.Constants.SVTNoResponse:
                    alertTitle = "Error";
                    alertMsg = "No Response from GECB...";
                    break;
            }

            var okAlertController = UIAlertController.Create(alertTitle, alertMsg, UIAlertControllerStyle.Alert);
            okAlertController.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null));
            PresentViewController(okAlertController, true, null);
        }


        public void ZkipStatus(bool status)
        {
            if(status == true)
            {
                zkipStatus = true;
            }
            else
            {
                zkipStatus = false;
            }

        }

        public static string ByteArrayToString(byte[] ba)
        {
            return BitConverter.ToString(ba).Replace("-", " ");
        }

        public string strSRDOResp = " " ;// TODO: Delete if not works

        public void Process(SRDOReadResponse read)
        {           string srdoRead;
            if ( read.SRDO == 1 )
            {
                srdoRead = "Rcv' Read SRDO: " + read.SRDO + " Data: " + System.Text.Encoding.UTF8.GetString(read.Data, 0, read.Data.Length);
                Console.WriteLine("srdoRead :" + srdoRead);
                strSRDOResp = srdoRead;
            }
            else
            {
                 
                if (read.Error == 0)
                {
                    srdoRead = "Rcv' Read SRDO: " + read.SRDO + " Size: " + read.Length + " Data: " + ByteArrayToString(read.Data);
                }
                else 
                {
                    srdoRead = "Rcv' Read SRDO: " + read.SRDO + " Error: " + read.Error;
                }

            }

            //UpdateTextView(srdoRead);
            Console.WriteLine("ProcessRead");
        }

        public void Process(SRDOWriteResponse write)
        {
            string srdoWrite;
            if ( write.Length == 0)
            {
                srdoWrite = "Rcv' Write SRDO: " + write.SRDO + " Success! " ;
            }
            else
            {
                srdoWrite = "Rcv' Write SRDO: " + write.SRDO + " Failed! " ;
            }

            //UpdateTextView(srdoWrite);
            Console.WriteLine("SRDOWriteResponse");
        }

        public void Process(SRDOReadParameterizedResponse srdo)
        {
            string msg;
            if (srdo.Error == 0)
            {
                msg = "Rcv' Read Para SRDO: " + srdo.SRDO + " Data: " + ByteArrayToString(srdo.Data) + " Success! ";
            }
            else
            {
                msg = "Rcv' Read Para SRDO: " + srdo.SRDO + " Failed! ";
            }
            //UpdateTextView(msg);
        }

        public void Process(SRDOWriteParameterizedResponse srdo)
        {
            string msg;
            if ( srdo.Length == 0)
            {
                msg = "Rcv' Write Para SRDO: " + srdo.SRDO + " Success! " ;
            }
            else
            {
                msg = "Rcv' Write Para SRDO: " + srdo.SRDO + " Failed! " ;
            }
            //UpdateTextView(msg);
        }

        public void Process(SRDOCommandResponse srdo)
        {
            string msg;

            msg = "Rcv' Command Response: " + srdo.Response + " Argument Length " + srdo.ArgumentLength;

           // UpdateTextView(msg);
        }

        public void Process(RTDDataResponse rtd)
        {
            string msg;

            if (rtd.Length > 0)
            {
                msg = "Rcv' RTD Data: " + ByteArrayToString(rtd.Data);
                //UpdateTextView(msg);
            }
        }
        
        public void Process(RTDStopResponse rtd)
        {
            string msg;
            msg = "Rcv' RTD STOP ";
           // UpdateTextView(msg);
        }

        #endregion //EVENT_HANDLERS
    }
}

Ejemplo n.º 2
0
 internal void SRDOResponse(SRDOWriteParameterizedResponse srdo)
 {
     //Console.WriteLine(srdo.TID);
     OnWriteParaRsp?.Invoke(this, srdo);
 }