Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            List <string> argsList = new List <string>(args);
            int           idx      = argsList.FindIndex(x => x == "-t" || x == "--thingsboard");

            if (idx >= 0 && args.Length > idx + 1)
            {
                ThingsBoardURL = args[idx + 1];
            }

            Parser.Default.ParseArguments <CommandLineArguments>(args)
            .WithParsed(cmdLineOptions =>
            {
                cmdLineOptions = ProcessDSLinkJson(cmdLineOptions);

                //Init the logging engine
                InitializeLogging(cmdLineOptions);

                //Construct a link Configuration
                var config = new Configuration(cmdLineOptions.LinkName, false, true);

                //Construct our custom link
                var dslink = new SensolusLink(config, cmdLineOptions);

                InitializeLink(dslink).Wait();
            })
            .WithNotParsed(errors => { Environment.Exit(-1); });
            while (true)
            {
                Thread.Sleep(1000);
            }
        }
Ejemplo n.º 2
0
        public static async Task InitializeLink(SensolusLink dsLink)
        {
            await dsLink.Connect();

            dsLink.LoadData();
            dsLink.InitializeDefaultNodes();
            await dsLink.SaveNodes();
        }