Ejemplo n.º 1
0
        //**********************************************************************

        public void executeGo1(CmdLineCmd aCmd)
        {
            string tString = aCmd.argString(1);
            bool   tPass   = MyFunctions.IsValidIPAddress(tString);

            Prn.print(0, "{0} {1}", tString, tPass);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Prn.initializeForConsole();
            MyCmdLineExec tCmdLineExec = new MyCmdLineExec();

            CmdLineConsole.execute(tCmdLineExec);
        }
Ejemplo n.º 3
0
        //**********************************************************************
        //**********************************************************************
        //**********************************************************************
        // Receive message handlers

        public override void processRxMsg(ByteContent aMsg)
        {
            BaseMsg tRxMsg = (BaseMsg)aMsg;

            // Message jump table based on message type.
            // Calls corresponding specfic message handler method.
            switch (tRxMsg.mMessageType)
            {
            case MsgIdT.cTestMsg:
                processRxMsg((TestMsg)tRxMsg);
                break;

            case MsgIdT.cStatusRequestMsg:
                processRxMsg((StatusRequestMsg)tRxMsg);
                break;

            case MsgIdT.cStatusResponseMsg:
                processRxMsg((StatusResponseMsg)tRxMsg);
                break;

            case MsgIdT.cDataMsg:
                processRxMsg((DataMsg)tRxMsg);
                break;

            default:
                Prn.print(Prn.ThreadRun1, "NetworkThread.processRxMsg UNKNOWN");
                break;
            }
        }
Ejemplo n.º 4
0
        //**********************************************************************
        //**********************************************************************
        //**********************************************************************
        // Thread run function.

        public void threadRun()
        {
            while (!mTerminate)
            {
                Thread.Sleep(1000);
                Prn.print(Prn.View11, "TIMER {0}", mCount++);
            }
        }
Ejemplo n.º 5
0
        //**********************************************************************
        //**********************************************************************
        //**********************************************************************
        // Configure the socket.

        public void configure(BaseMsgMonkeyCreator aMonkeyCreator, String aAddress, int aPort)
        {
            mMonkey     = aMonkeyCreator.createNew();
            mUdpClient  = new UdpClient(aPort);
            mIPEndPoint = new IPEndPoint(IPAddress.Parse(aAddress), aPort);

            Prn.print(Prn.SocketInit2, "UdpRxMsgSocket     $ {0,16} : {1}", mIPEndPoint.Address.ToString(), mIPEndPoint.Port);
        }
Ejemplo n.º 6
0
 public static void show(DataRecord aMsg)
 {
     Prn.print(Prn.ThreadRun1, "ProtoCommMsg.DataRecord");
     Prn.print(Prn.ThreadRun1, "Code1      {0}", aMsg.mCode1);
     Prn.print(Prn.ThreadRun1, "Code2      {0}", aMsg.mCode2);
     Prn.print(Prn.ThreadRun1, "Code3      {0}", aMsg.mCode3);
     Prn.print(Prn.ThreadRun1, "Code4      {0}", aMsg.mCode4);
 }
Ejemplo n.º 7
0
        //**********************************************************************
        //**********************************************************************
        //**********************************************************************
        // Configure the socket.

        public void configure(BaseMsgMonkeyCreator aMonkeyCreator, String aAddress, int aPort)
        {
            mMonkey     = aMonkeyCreator.createNew();
            mSocket     = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
            mIPEndPoint = new IPEndPoint(IPAddress.Parse(aAddress), aPort);

            Prn.print(Prn.SocketInit2, "UdpTxMsgSocket     $ {0,16} : {1}", mIPEndPoint.Address.ToString(), mIPEndPoint.Port);
        }
Ejemplo n.º 8
0
 public static void show(TestMsg aMsg)
 {
     Prn.print(Prn.ThreadRun1, "ProtoComm.TestMsg");
     Prn.print(Prn.ThreadRun1, "Code1      {0}", aMsg.mCode1);
     Prn.print(Prn.ThreadRun1, "Code2      {0}", aMsg.mCode2);
     Prn.print(Prn.ThreadRun1, "Code3      {0}", aMsg.mCode3);
     Prn.print(Prn.ThreadRun1, "Code4      {0}", aMsg.mCode4);
 }
Ejemplo n.º 9
0
        //**********************************************************************
        //**********************************************************************
        //**********************************************************************
        // Launch thread.

        public void start()
        {
            Prn.print(Prn.View11, "TIMER START");
            // Create new thread object using thread run function
            mThread = new Thread(new ThreadStart(threadRun));
            // Start the thread
            mThread.Start();
        }
Ejemplo n.º 10
0
 static void Main(string[] args)
 {
     Prn.initializeForConsole();
     if (false)
     {
         MyCmdLineExec tCmdLineExec = new MyCmdLineExec();
         CmdLineConsole.execute(tCmdLineExec);
     }
     else
     {
         MyLaunch.generate(args);
     }
 }
Ejemplo n.º 11
0
        public static void show(StatusRequestMsg aMsg)
        {
            Prn.print(Prn.ThreadRun1, "ProtoCommMsg.StatusMsg");
            Prn.print(Prn.ThreadRun1, "Code1      {0}", aMsg.mCode1);
            Prn.print(Prn.ThreadRun1, "Code2      {0}", aMsg.mCode2);
            Prn.print(Prn.ThreadRun1, "Code3      {0}", aMsg.mCode3);
            Prn.print(Prn.ThreadRun1, "Code4      {0}", aMsg.mCode4);

            for (int i = 0; i < aMsg.mNumOfWords; i++)
            {
                Prn.print(Prn.ThreadRun1, "Words     {0} {1}", 1, aMsg.mWords[i]);
                aMsg.mWords[i] = 101 + i;
            }
        }
Ejemplo n.º 12
0
        //**********************************************************************
        //**********************************************************************
        //**********************************************************************

        public static void initializePrint()
        {
            Prn.initializeForConsole();

            Prn.setFilter(Prn.SocketInit1, false);
            Prn.setFilter(Prn.SocketInit2, true);
            Prn.setFilter(Prn.SocketRun1, true);
            Prn.setFilter(Prn.SocketRun2, false);
            Prn.setFilter(Prn.SocketRun3, false);
            Prn.setFilter(Prn.SocketRun4, false);

            Prn.setFilter(Prn.ThreadRun1, true);
            Prn.setFilter(Prn.ThreadRun2, false);
            Prn.setFilter(Prn.ThreadRun3, false);
            Prn.setFilter(Prn.ThreadRun4, false);
        }
Ejemplo n.º 13
0
 public static void show(DataMsg aMsg)
 {
     Prn.print(Prn.ThreadRun1, "ProtoCommMsg.DataMsg");
     Console.WriteLine("UChar    {0:X}", aMsg.mUChar);
     Console.WriteLine("UShort   {0:X}", aMsg.mUShort);
     Console.WriteLine("UInt     {0:X}", aMsg.mUInt);
     Console.WriteLine("Unit64   {0:X}", aMsg.mUInt64);
     Console.WriteLine("Char     {0:X}", aMsg.mChar);
     Console.WriteLine("Short    {0:X}", aMsg.mShort);
     Console.WriteLine("Int      {0:X}", aMsg.mInt);
     Console.WriteLine("Int64    {0:X}", aMsg.mInt64);
     Console.WriteLine("Float    {0}", aMsg.mFloat);
     Console.WriteLine("Double   {0}", aMsg.mDouble);
     Console.WriteLine("Bool     {0}", aMsg.mBool);
     Console.WriteLine("String   {0}", aMsg.mString1);
     Console.WriteLine("String   {0}", aMsg.mString2);
     Console.WriteLine("");
     show(aMsg.mDataRecord);
     Console.WriteLine("");
 }
Ejemplo n.º 14
0
        //**********************************************************************
        //**********************************************************************
        //**********************************************************************

        public static void initializePrint()
        {
            Prn.initializeForWinForm();

            Prn.setFilter(Prn.SocketInit1, false);
            Prn.setFilter(Prn.SocketInit2, true);
            Prn.setFilter(Prn.SocketRun1, true);
            Prn.setFilter(Prn.SocketRun2, false);
            Prn.setFilter(Prn.SocketRun3, false);
            Prn.setFilter(Prn.SocketRun4, false);

            Prn.setFilter(Prn.ThreadRun1, true);
            Prn.setFilter(Prn.ThreadRun2, false);
            Prn.setFilter(Prn.ThreadRun3, false);
            Prn.setFilter(Prn.ThreadRun4, false);

            Prn.setFilter(Prn.View11, true);
            Prn.setFilter(Prn.View12, true);
            Prn.setFilter(Prn.View13, true);
            Prn.setFilter(Prn.View14, true);
        }
Ejemplo n.º 15
0
        public static void execute(BaseCmdLineExec aExec)
        {
            aExec.reset();

            bool tGoing = true;

            while (tGoing)
            {
                // Read command line
                CmdLineCmd tCmd      = new CmdLineCmd();
                String     tCParBuff = Console.ReadLine();
                tCmd.putCmdLineString(tCParBuff);

                // Toggle print
                if (tCmd.isCmd("P"))
                {
                    Prn.ToggleSuppress();
                }
                // Exit
                else if (tCmd.isCmd("EXIT") || tCmd.isCmd("E"))
                {
                    aExec.executeExit();
                    tGoing = false;
                }
                // Execute command
                else
                {
                    aExec.execute(tCmd);

                    if (tCmd.isBadCmd())
                    {
                        Console.WriteLine("INVALID COMMAND");
                        Console.WriteLine("-----------------------------------------");
                    }
                }
            }
        }
Ejemplo n.º 16
0
        //**********************************************************************
        //**********************************************************************
        //**********************************************************************
        // Send message to the socket.

        public void sendMsg(ByteContent aMsg)
        {
            //------------------------------------------------------------------
            // Create byte buffer.
            ByteBuffer tBuffer = new ByteBuffer(mMonkey.getMaxBufferSize());

            // Copy message to buffer.
            mMonkey.putMsgToBuffer(tBuffer, aMsg);

            //------------------------------------------------------------------
            // Send buffer to socket.
            byte[] tTxBytes  = tBuffer.getBaseAddress();
            int    tTxLength = tBuffer.getPosition();

            try
            {
                int tSent = mSocket.SendTo(tTxBytes, tTxLength, SocketFlags.None, mIPEndPoint);
                Prn.print(Prn.SocketRun2, "UdpTxSocket tx message {0}", tSent);
            }
            catch
            {
                Prn.print(Prn.SocketRun2, "UdpTxSocket Send ERROR");
            }
        }
Ejemplo n.º 17
0
 public override string ToString()
 {
     return(Prn.ToString() + " " + Time.ToString());
 }
Ejemplo n.º 18
0
 public void Show()
 {
     // Amp A.
     Prn.print(0, " Factory Test Settings************************************");
     Prn.print(0, "CommPort                 {0}", CommPort);
 }
Ejemplo n.º 19
0
 public static void show(FirstMessageMsg aMsg)
 {
     Prn.print(Prn.ThreadRun1, "ProtoComm.FirstMessageMsg");
     Prn.print(Prn.ThreadRun1, "Code1      {0}", aMsg.mCode1);
 }
Ejemplo n.º 20
0
        //**********************************************************************

        public void executeGo2(CmdLineCmd aCmd)
        {
            Prn.print(0, "GO2****************************************************");
        }
Ejemplo n.º 21
0
        //**********************************************************************
        //**********************************************************************
        //**********************************************************************
        // Receive message from socket.

        public ByteContent receiveMsg()
        {
            //------------------------------------------------------------------
            // Guard

            if (mUdpClient == null)
            {
                return(null);
            }

            //------------------------------------------------------------------
            // Receive bytes from socket

            byte[] tRxBytes = null;

            try
            {
                tRxBytes = mUdpClient.Receive(ref mIPEndPoint);
            }
            catch
            {
                Prn.print(Prn.SocketRun1, "UdpRxSocket Receive EXCEPTION");
                return(null);
            }
            //------------------------------------------------------------------
            // Guard.

            if (tRxBytes != null)
            {
                Prn.print(Prn.SocketRun2, "UdpRxSocket rx message {0}", tRxBytes.Length);
            }
            else
            {
                Prn.print(Prn.SocketRun1, "UdpRxSocket ERROR");
                return(null);
            }

            //------------------------------------------------------------------
            // Create byte buffer.

            ByteBuffer tBuffer = new ByteBuffer(tRxBytes);

            tBuffer.setCopyFrom();
            tBuffer.setLength(tRxBytes.Length);

            //------------------------------------------------------------------
            // Copy from the receive buffer into the message parser object
            // and validate the header

            mMonkey.extractMessageHeaderParms(tBuffer);

            // If the header is not valid then error
            if (!mMonkey.mHeaderValidFlag)
            {
                Prn.print(Prn.SocketRun1, "UdpRxSocket Receive FAIL INVALID HEADER");
                return(null);
            }

            Prn.print(Prn.SocketRun3, "UdpRxSocket Receive Header {0}", mMonkey.mHeaderLength);

            //------------------------------------------------------------------
            // At this point the buffer contains the complete message.
            // Extract the message from the byte buffer into a new message
            // object and return it.

            tBuffer.rewind();
            ByteContent tRxMsg = mMonkey.getMsgFromBuffer(tBuffer);

            if (tRxMsg == null)
            {
                Prn.print(Prn.SocketRun1, "UdpRxSocket FAIL INVALID MESSAGE");
                return(null);
            }

            // Returning true  means socket was not closed
            // Returning false means socket was closed
            mRxCount++;
            return(tRxMsg);
        }
Ejemplo n.º 22
0
        //**********************************************************************
        //**********************************************************************
        //**********************************************************************
        // Shutdown thread.

        public void stop()
        {
            mTerminate = true;
            Prn.print(Prn.View11, "TIMER STOP");
        }
Ejemplo n.º 23
0
        //**********************************************************************

        public void executeGo3(CmdLineCmd aCmd)
        {
            Console.WriteLine("PrintView2.exe stopping");
            Prn.print(0, "PRINTVIEW_SHUTDOWN");
        }
Ejemplo n.º 24
0
        //**********************************************************************

        public void executeGo2(CmdLineCmd aCmd)
        {
            Prn.print(0, "TESTING");
        }
Ejemplo n.º 25
0
        //******************************************************************************
        // Rx message handler - StatusResponseMsg

        void processRxMsg(StatusResponseMsg aMsg)
        {
            Prn.print(Prn.ThreadRun1, "NetworkThread.processRxMsg_StatusResponseMsg");
            Helper.show(aMsg);
        }
Ejemplo n.º 26
0
 public override string ToString()
 {
     return(Prn.ToString() + PhaseName + GpsTime);
 }
Ejemplo n.º 27
0
        //******************************************************************************
        // Rx message handler - DataMsg

        void processRxMsg(DataMsg aMsg)
        {
            Prn.print(Prn.ThreadRun1, "NetworkThread.processRxMsg_DataMsg");
            Helper.show(aMsg);
        }
Ejemplo n.º 28
0
        //**********************************************************************

        public void executeGo1(CmdLineCmd aCmd)
        {
            Prn.print(Prn.View11, "TESTING");
        }