示例#1
0
        static void Main(string[] args)
        {
            controller = new AdapterController <HGU_HuaWei_Adapter>();
            controller.Prepare();//核心入口
            controller.Start();
            //Console.WriteLine(controller.Adapter.Name + " 已经启动, 等待控制器命令...");

            while (true)
            {
                Thread.Sleep(Timeout.Infinite);
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            Console.WriteLine(@"   ______           _____ _                 __      __  _           ");
            Console.WriteLine(@"  / ____/___       / ___/(_)___ ___  __  __/ /___ _/ /_(_)___  ____ ");
            Console.WriteLine(@" / /   / __ \______\__ \/ / __ `__ \/ / / / / __ `/ __/ / __ \/ __ \");
            Console.WriteLine(@"/ /___/ /_/ /_____/__/ / / / / / / / /_/ / / /_/ / /_/ / /_/ / / / /");
            Console.WriteLine(@"\____/\____/     /____/_/_/ /_/ /_/\__,_/_/\__,_/\__/_/\____/_/ /_/ ");

            Data.SessionData = new SessionData();

            //Create a new adapter controller
            using (AdapterController adapterController = new AdapterController(Data.SessionData, Data.AdapterDescription, new MIPAddress("127.0.0.1", 9009), new DescriptionBasedMMUProvider(Data.CoSimMMUDescription), new CosimInstantiator()))
            {
                adapterController.Start();

                Console.ReadLine();
            }
        }
        static void Main(string[] args)
        {
            MAdapterDescription adapterDescription = new MAdapterDescription()
            {
                ID         = Guid.NewGuid().ToString(),
                Language   = "C#",
                Name       = "Debug Adapter C#",
                Properties = new Dictionary <string, string>(),
                Addresses  = new List <MIPAddress>()
                {
                    new MIPAddress("127.0.0.1", 8999)
                }
            };


            using (AdapterController adapterController = new AdapterController(SessionData, adapterDescription, RegisterAddress, new MMUProvider(), new MMUInstantiator()))
            {
                adapterController.Start();
                Console.ReadLine();
            }
        }
示例#4
0
        /// <summary>
        /// Entry routine
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            //Create a new logger instance
            Logger.Instance = new Logger
            {
                //Log everything
                Level = Log_level.L_DEBUG
            };

            //Register for unhandled exceptions in the application
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;



            Console.WriteLine(@"   ______  __ __     ___       __            __           ");
            Console.WriteLine(@"  / ____/_/ // /_   /   | ____/ /___ _____  / /____  _____");
            Console.WriteLine(@" / /   /_  _  __/  / /| |/ __  / __ `/ __ \/ __/ _ \/ ___/");
            Console.WriteLine(@"/ /___/_  _  __/  / ___ / /_/ / /_/ / /_/ / /_/  __/ /    ");
            Console.WriteLine(@"\____/ /_//_/    /_/  |_\__,_/\__,_/ .___/\__/\___/_/     ");
            Console.WriteLine(@"                                  /_/                     ");
            Console.WriteLine(@"_________________________________________________________________");



            //Parse the command line arguments
            if (!ParseCommandLineArguments(args))
            {
                Logger.Log(Log_level.L_ERROR, "Cannot parse the command line arguments. Closing the adapter!");
                return;
            }

            Console.WriteLine($"Adapter is reachable at: {address.Address}:{address.Port}");
            Console.WriteLine($"Register is reachable at: {mmiRegisterAddress.Address}:{mmiRegisterAddress.Port}");
            Console.WriteLine($"MMUs will be loaded from: {mmuPath}");
            Console.WriteLine(@"_________________________________________________________________");


            //Create the adapter description -> To do load from file in future
            MAdapterDescription adapterDescription = new MAdapterDescription()
            {
                Name      = "CSharpAdapter",
                Addresses = new List <MIPAddress>()
                {
                    address
                },
                ID         = "438543643-436436435-2354235",
                Language   = "C#",
                Parameters = new List <MParameter>(),
                Properties = new Dictionary <string, string>()
            };


            //Create a session cleaner for the utilized session data
            sessionCleaner = new SessionCleaner(sessionData)
            {
                //Session shoould be cleaned after 60 minutes
                Timeout = TimeSpan.FromMinutes(60),

                //The session cleaner should check every minute
                UpdateTime = TimeSpan.FromMinutes(1)
            };

            //Start the session cleaner
            sessionCleaner.Start();

            //Create a new adapter controller which scans the filesystem and checks for MMUs there
            using (AdapterController adapterController = new AdapterController(sessionData, adapterDescription, mmiRegisterAddress, new FileBasedMMUProvider(sessionData, new List <string>()
            {
                mmuPath
            }, new List <string>()
            {
                "C#", "C++CLR"
            }), new CSharpMMUInstantiator()))
            {
                //Start the adapter controller
                adapterController.Start();

                Console.ReadLine();
            }
        }