Exemple #1
0
        static void Main(string[] args)
        {
            var    connector = new EltraMasterConnector();
            string filePath  = "TEST_0200h_0000h_0000h_0000h.xdd";

            Console.WriteLine($"Hello Test Eltra Unit Tests Master!");

            MsgLogger.LogLevels  = "Error;Exception;Timing;Workflow";
            MsgLogger.LogOutputs = "Console";

            var runner = Task.Run(async() =>
            {
                connector.Host = "https://eltra.ch";

                if (args.Length > 0)
                {
                    connector.Host = args[0];
                }

                Console.WriteLine("Sign-in ...");

                if (await connector.SignIn(new UserIdentity()
                {
                    Login = $"*****@*****.**", Name = "Test", Password = "******", Role = "developer"
                }, true))
                {
                    var predefinedAlias = new UserIdentity()
                    {
                        Login = "******", Password = "******", Name = "Tester", Role = "engineer"
                    };

                    if (await connector.CreateAlias(predefinedAlias))
                    {
                        Console.WriteLine($"User-defined alias, login='******', password='******'");
                    }
                    else
                    {
                        Console.WriteLine("ERROR: user defined alias not created!");
                    }

                    connector.StatusChanged              += OnConnectorStatusChanged;
                    connector.ChannelStatusChanged       += OnChannelStatusChanged;
                    connector.RemoteChannelStatusChanged += OnRemotePartyChannelStatusChanged;

                    Console.WriteLine("Signed in - Start service");

                    connector.StartService("TEST", new TestDeviceManager(filePath));
                }
                else
                {
                    Console.WriteLine("error: cannot sign-in!");
                }
            });

            Console.ReadKey();

            connector.StopService("TEST");

            runner.Wait();
        }
Exemple #2
0
        static void Main(string[] args)
        {
            var    connector   = new EltraMasterConnector();
            int    serviceId   = 1;
            string serviceName = "DUMMY#1";

            if (args.Length > 0)
            {
                if (int.TryParse(args[0], out int si))
                {
                    serviceId = si;
                }
            }

            serviceName = $"DUMMY#{serviceId}";

            string filePath = "DUMMY_0100h_0000h_0000h_0000h.xdd";

            Console.WriteLine($"Hello Dummy Eltra Master - {serviceName}!");

            var runner = Task.Run(async() =>
            {
                //connector.Host = "https://eltra.ch";
                connector.Host = "http://*****:*****@eltra.ch", Name = "Dummy", Password = "******", Role = "developer"
                }, true))
                {
                    var predefinedAlias = new UserIdentity()
                    {
                        Login = "******", Password = "******", Name = "dummy", Role = "engineer"
                    };

                    if (await connector.CreateAlias(predefinedAlias))
                    {
                        Console.WriteLine($"User-defined alias, login='******', password='******'");
                    }
                    else
                    {
                        Console.WriteLine("ERROR: user defined alias not created!");
                    }

                    var alias = await connector.CreateAlias("operator");

                    if (alias != null)
                    {
                        Console.WriteLine($"Alias, login='******', password='******'");
                    }
                    else
                    {
                        Console.WriteLine("ERROR: alias not created!");
                    }

                    connector.StatusChanged              += OnConnectorStatusChanged;
                    connector.ChannelStatusChanged       += OnChannelStatusChanged;
                    connector.RemoteChannelStatusChanged += OnRemotePartyChannelStatusChanged;

                    Console.WriteLine("Signed in - Start service");

                    connector.StartService(serviceName, new DummyDeviceManager(filePath));
                }
                else
                {
                    Console.WriteLine("error: cannot sign-in!");
                }
            });

            Console.ReadKey();

            connector.StopService(serviceName);

            runner.Wait();
        }