Exemple #1
0
        public StreemaDevice(string deviceDescriptionFilePath, int nodeId, StreemaSettings settings)
            : base("STREEMA", deviceDescriptionFilePath, nodeId)
        {
            _settings = settings;

            Identification.SerialNumber = 0x100;
        }
        public StreemaDeviceCommunication(MasterDevice device, StreemaSettings settings)
            : base(device)
        {
            _settings = settings;

            _urlParameters           = new List <Parameter>();
            _labelParameters         = new List <Parameter>();
            _imageParameters         = new List <Parameter>();
            _volumeScalingParameters = new List <Parameter>();
            _processIdParameters     = new List <Parameter>();
        }
Exemple #3
0
        static void Main(string[] args)
        {
            string serviceName = "STREEMA";

            var connector = new EltraMasterConnector();
            var settings  = new StreemaSettings();

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

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

            var runner = Task.Run(async() =>
            {
                connector.Host = settings.Host;

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

                if (await connector.SignIn(new UserIdentity()
                {
                    Login = settings.Login, Name = "Streema", Password = settings.LoginPasswd, Role = "developer"
                }, true))
                {
                    var predefinedAlias = new UserIdentity()
                    {
                        Login = settings.Alias, Password = settings.AliasPasswd, Name = "Streema client", 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");

                    //heartbeat every 3 min, timeout device after 9 min
                    connector.ConnectionSettings = new ConnectionSettings()
                    {
                        UpdateInterval = 180, Timeout = 540
                    };

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

            /*if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
             * {
             *  Console.ReadKey();
             *
             *  connector.StopService(serviceName);
             * }*/

            runner.Wait();
        }
 public StreemaDeviceManager(string deviceDescriptionFilePath, StreemaSettings settings)
 {
     AddDevice(new StreemaDevice(deviceDescriptionFilePath, 1, settings));
 }