public StorageHandler(ILogging logging, IIniSettings iniSettings, string dbPath = null)
        {
            _logging     = logging;
            _iniSettings = iniSettings;
            var fullPathToDb = CreateDbPath();

            if (!string.IsNullOrEmpty(dbPath))
            {
                fullPathToDb = dbPath;
            }

            _pathToRepo = fullPathToDb;

            if (File.Exists(fullPathToDb))
            {
                return;
            }
            _logging.LogDebug("Creating folder for liteDb database");
            var dbDirectory = Path.GetDirectoryName(fullPathToDb);

            if (dbDirectory != null)
            {
                Directory.CreateDirectory(dbDirectory);
            }
        }
Example #2
0
        public override string InitIO(string port)
        {
            _iniSettings = new IniSettings(HS);

            //_iniSettings.IniSettingsChangedForCheckInterval += IniSettingsChangedForCheckInterval;
            _iniSettings.IniSettingsChangedForUserNamePassword += IniSettingsChangedForUserNamePassword;;

            _log = new Log(HS, _iniSettings);

            _log.Info("Starting plugin");
            _config = new ConfigHandler(HS, Callback, _iniSettings, _log);
            _config.Register();

            _deviceHandler = new DeviceHandler(HS, _log);

            _settings = new Setting(HS);
            _settings.DoIniFileTemplateIfFileMissing();

            _restHandler = new RestHandler(_log);

            StartLoginAndDataFetchingInNewThread();

            Shutdown = false;
            _log.Debug("Done init io");
            return("");
        }
 public ConfigHandler(IHSApplication hs, IAppCallbackAPI callbackApi, IIniSettings iniSettings, ILog log)
 {
     _hs          = hs;
     _callbackApi = callbackApi;
     _iniSettings = iniSettings;
     _log         = log;
 }
Example #4
0
 public MainPlugin(IHSApplication hs, ILogging logging, IIniSettings iniSettings, IAppCallbackAPI callback, HsCollectionFactory collectionFactory)
 {
     _hs                = hs;
     _logging           = logging;
     _iniSettings       = iniSettings;
     _callback          = callback;
     _collectionFactory = collectionFactory;
 }
Example #5
0
 public MainConfig(ILogging logging, IHSApplication hs, IIniSettings iniSettings, IAppCallbackAPI callback, IMainPlugin mainPlugin)
 {
     _hs          = hs;
     _logging     = logging;
     _iniSettings = iniSettings;
     _callback    = callback;
     _mainPlugin  = mainPlugin;
 }
 public GeneralConfig(string pageName, IHSApplication hs, IAppCallbackAPI callback,
                      IIniSettings iniSettings, ILog log) : base(pageName)
 {
     _pageName    = pageName;
     _hs          = hs;
     _callback    = callback;
     _iniSettings = iniSettings;
     _log         = log;
 }
 public GetTriggersFromHomeSeerHandler(IIniSettings iniSettings, ILogging logging, IAppCallbackAPI callback, int?delayInSeconds = null)
 {
     _iniSettings = iniSettings;
     _logging     = logging;
     _callback    = callback;
     if (delayInSeconds.HasValue)
     {
         _delayInSeconds = delayInSeconds.Value;
     }
 }
Example #8
0
 public ConfigGeneral(string pageName, IHSApplication hs, IIniSettings iniSettings,
                      ILogging log, IMainPlugin mainPlugin) : base(pageName)
 {
     _pageName     = pageName;
     _pageNameText = pageName.Replace("_", " ");
     _hs           = hs;
     _iniSettings  = iniSettings;
     _logging      = log;
     _mainPlugin   = mainPlugin;
 }
Example #9
0
        public Log(IHSApplication hs, IIniSettings iniSettings)
        {
            _hs          = hs;
            _iniSettings = iniSettings;
            _iniSettings.IniSettingsChangedForLogLevel += OnIniSettingsChangedForLogLevel;

            if (_iniSettings.LogLevel == LogLevel.DebugToFile || _iniSettings.LogLevel == LogLevel.DebugToFileAndLog)
            {
                CreateLogFile();
            }
        }
Example #10
0
        public Logging(IIniSettings iniSettings, IHSApplication hs)
        {
            _iniSettings = iniSettings;
            _hs          = hs;

            var logPath = Path.Combine(Utility.ExePath, "Logs");

            if (!Directory.Exists(logPath))
            {
                Directory.CreateDirectory(logPath);
            }
            var logFile = Path.Combine(logPath, Utility.PluginName + "Debug.log");

            if (_iniSettings.LogLevel == LogLevel.DebugToFile || _iniSettings.LogLevel == LogLevel.DebugToFileAndLog)
            {
                CreateLogFile();
            }
        }
Example #11
0
        public TriggerHandler(IHSApplication hs, IAppCallbackAPI callback, IIniSettings iniSettings,
                              ILogging logging, IHsCollectionFactory collectionFactory, IHomeSeerHandler homeSeerHandler, IStorageHandler storageHandler)
        {
            _hs                = hs;
            _callback          = callback;
            _iniSettings       = iniSettings;
            _logging           = logging;
            _collectionFactory = collectionFactory;
            _homeSeerHandler   = homeSeerHandler;
            _storageHandler    = storageHandler;
            _logging.LogDebug("Creating trigger types");
            _triggerTypes = CreateTriggerTypes();

            _logging.LogDebug("Starting thread to fetch triggers");
            GetPluginTriggersFromHomeSeerInNewThread();

            _logging.LogDebug("Done init TriggerHandler");
        }
Example #12
0
 public ConfigurationLoadingChecker(IFileSystem fileSystem, IIniSettings iniSettings)
 {
     _fileSystem  = fileSystem;
     _iniSettings = iniSettings;
 }
 public void SetUp()
 {
     _iniSettings = NSubstitute.Substitute.For <IIniSettings>();
     _logging     = NSubstitute.Substitute.For <ILogging>();
     _callBack    = NSubstitute.Substitute.For <IAppCallbackAPI>();
 }
 public void SetUp()
 {
     _logging     = NSubstitute.Substitute.For <ILogging>();
     _iniSettings = NSubstitute.Substitute.For <IIniSettings>();
 }
Example #15
0
 public ConfigAbout(string pageName, IHSApplication hs, IIniSettings iniSettings, ILogging log) : base(pageName)
 {
     _pageName     = pageName;
     _hs           = hs;
     _pageNameText = pageName.Replace("_", " ");
 }
Example #16
0
 public ModuleManager(IIniSettings settings)
 {
     _settings = settings;
 }
Example #17
0
 public F****r(IIniSettings settings, IModuleManager moduleMgr)
 {
     _settings      = settings;
     _moduleManager = moduleMgr;
 }
Example #18
0
 public IniConverterFactory(ITypeManager typeManager, IIniSettings iniSettings)
 {
     _typeManager = typeManager;
     _iniSettings = iniSettings;
 }
Example #19
0
 public EnumerableConverter(IIniConverter underlyingTypeIniConverter, IIniSettings iniSettings)
 {
     _underlyingTypeIniConverter = underlyingTypeIniConverter;
     _iniSettings = iniSettings;
 }