Exemple #1
0
        CTrafficMessage()
        {
            MessagesList = new List <ComData>();
            data         = new DataInterpretor();
            devices      = new DeviceRouting();
            Commandslist = new Commands();

            DeviceRegistry Server = new DeviceRegistry("FTG-SERVER", "server");

            devices.Add(Server);

            myserverID = devices.FindIDByDevice(Server);
        }
Exemple #2
0
        // <summary>
        // The following commands are internally used in the server
        // </summary>

        public dynamic debug(int commandID, int myserverID, int senderID, int receiverID, ComData comdata, DeviceRouting devices)
        {
            string CurrentTime = DateTime.Now.ToString("HH:mm:ss");

            DeviceRegistry sender = devices.FindByID(receiverID);

            if (sender != null)
            {//has sender that is acknowledged by the server
                {
                    string message1 = "";
                    comdata.Get(3, ref message1);

                    string message2 = "";
                    comdata.Get(4, ref message2);


                    Console.WriteLine("'" + sender.Name + "' at " + CurrentTime + ": " + message1 + '\n' + message2);
                }
            }
            else
            {
                Console.WriteLine("Incoming command doesn't have proper sender at " + CurrentTime);
            }
            return(null);
        }
Exemple #3
0
        public dynamic ExecuteCommand(int commandID, int myserverID, int senderID, int receiverID, ComData comdata, DeviceRouting devices)
        {
            if (commandID < 1)
            {
                return(null);
            }

            Func <int, int, int, int, ComData, DeviceRouting, dynamic> f = null;

            try
            {
                f = commandlist.ElementAt(commandID);
            }
            catch
            {
                return(null);
            }

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

            return(f(commandID, myserverID, senderID, receiverID, comdata, devices));
        }