Beispiel #1
0
        public Program(String[] _)
        {
            InIReader.SetSearchPath(new List <String>()
            {
                "/etc/lorabot", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\lorabot"
            });
            if (!InIReader.ConfigExist("settings"))
            {
                Helper.WriteError("No settings.ini found. Abord!");
                return;
            }
            InIReader settings = InIReader.GetInstance("settings");

            this.logger.SetPath(settings.GetValue("logging", "path"));

            LoraParser parser = new LoraParser(settings.GetValue("general", "key"));

            LoraController lora = new LoraController(settings.GetSection("lora"));

            lora.Received += parser.ReceivedPacket;

            this.ModulLoader("Fraunhofer.Fit.IoT.Bots.LoraBot.Moduls", parser);
            this.ModulInterconnect();
            this.ModulEvents();

            parser.DataUpdate   += this.Lora_Parsed;
            parser.PanicUpdate  += this.Lora_Parsed;
            parser.StatusUpdate += this.Lora_Parsed;
            lora.Transmitted    += this.Lora_Transmitted;

            this.WaitForShutdown();
            Console.WriteLine("after wait");

            this.ModulDispose();
            Console.WriteLine("after dispose");

            lora.Dispose();
            Console.WriteLine("after loradisp");
        }
Beispiel #2
0
        public Program()
        {
            InIReader.SetSearchPath(new List <String>()
            {
                "/etc/lorascral", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\lorascral"
            });
            if (!InIReader.ConfigExist("settings"))
            {
                Helper.WriteError("No settings.ini found. Abord!");
                return;
            }
            InIReader settings = InIReader.GetInstance("settings");

            this.logger.SetPath(settings.GetValue("logging", "path"));

            this.Connect(settings);
            this.Attach();
            this.WaitForShutdown();
            this.Dispose();
        }