示例#1
0
        public string InitIO(string port)
        {
            var initLogString = $"{Utility.PluginName} MainPlugin InitIo started";

            Console.WriteLine(initLogString);
            _logging.Log(initLogString);
            _config = new MainConfig(_logging, _hs, _iniSettings, _callback, this);
            _config.RegisterConfigs();

            _callback.RegisterEventCB(Enums.HSEvent.VALUE_CHANGE, Utility.PluginName, "");

            _logging.Log($"Done creating configs");
            _iniSettings.IniSettingsChanged += _logging.IniSettingHasChanged;
            _homeSeerHandler = new HomeSeerHandler(_hs, _logging);
            _logging.Log($"Done creating HomeSeerHandler");

            _storageHandler = new StorageHandler(_logging, _iniSettings);
            _logging.Log($"Done creating StorageHandler");

            _triggerHandler = new TriggerHandler(_hs, _callback, _iniSettings, _logging, _collectionFactory, _homeSeerHandler, _storageHandler);
            _logging.Log($"Done creating _triggerHandler ");

            //_callback.RegisterEventCB(Enums.HSEvent.CONFIG_CHANGE, Utility.PluginName, "");
            //Register callback on every event of value change. This is the method to find if this is a value of a device we are following

            _logging.Log($"Done registering callback");
            _logging.Log($"{Utility.PluginName} MainPlugin InitIo Complete");
            return("");
        }
示例#2
0
        public string InitIO(string port)
        {
            Console.WriteLine("InitIO called!");
            Thread.Sleep(5000);
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
            Thread.CurrentThread.CurrentCulture   = new CultureInfo("en-US");

            mCore = new EnOceanManager(hsHost, hsHostCB, this);
            mCore.Initialize();
            hsHostCB.RegisterEventCB(Enums.HSEvent.CONFIG_CHANGE, Name, "");
            //hsHostCB.RegisterEventCB(Enums.HSEvent.LOG, Name, "");
            hsHostCB.RegisterEventCB(Enums.HSEvent.SETUP_CHANGE, Name, "");
            //hsHostCB.RegisterEventCB(Enums.HSEvent.STRING_CHANGE, Name, "");
            hsHostCB.RegisterEventCB(Enums.HSEvent.GENERIC, Name, "");

            this.mPageBuilder = new PageBuilder(hsHost, hsHostCB, this, mCore);

            hsHost.RegisterPage(Constants.PLUGIN_STRING_ID, Name, "");
            hsHost.RegisterPage(Constants.PLUGIN_STRING_ID + "_Interfaces", Name, "");

            WebPageDesc wpd = new WebPageDesc();

            wpd.link       = Constants.PLUGIN_STRING_ID;
            wpd.linktext   = "Configuration";
            wpd.page_title = "Configuration";
            wpd.plugInName = Name;
            hsHostCB.RegisterLink(wpd);
            hsHostCB.RegisterConfigLink(wpd);

            WebPageDesc wpi = new WebPageDesc();

            wpi.link       = Constants.PLUGIN_STRING_ID + "_Interfaces";
            wpi.linktext   = "Interfaces";
            wpi.page_title = "Interfaces";
            wpi.plugInName = Name;
            hsHostCB.RegisterLink(wpi);

            Console.WriteLine("INIT IO complete");
            return(""); // empty == OK
        }