----------------------------------------------------------------------------- Constructor -----------------------------------------------------------------------------
| 144 | // Constructor |
| 145 | //----------------------------------------------------------------------------- |
| 146 | Manager::Manager |
| 147 | ( |
| 148 | ): |
| 149 | m_notificationMutex( new Mutex() ) |
| 150 | { |
| 151 | // Ensure the singleton instance is set |
| 152 | s_instance = this; |
| 153 | |
| 154 | // Create the log file (if enabled) |
| 155 | bool logging = false; |
| 156 | Options::Get()->GetOptionAsBool( "Logging", &logging ); |
| 157 | |
| 158 | string userPath = ""; |
| 159 | Options::Get()->GetOptionAsString( "UserPath", &userPath ); |
| 160 | |
| 161 | string logFileNameBase = "OZW_Log.txt"; |
| 162 | Options::Get()->GetOptionAsString( "LogFileName", &logFileNameBase ); |
| 163 | |
| 164 | bool bAppend = false; |
| 165 | Options::Get()->GetOptionAsBool( "AppendLogFile", &bAppend ); |
| 166 | |
| 167 | bool bConsoleOutput = true; |
| 168 | Options::Get()->GetOptionAsBool( "ConsoleOutput", &bConsoleOutput ); |
| 169 | |
| 170 | int nSaveLogLevel = (int) LogLevel_Detail; |
| 171 | |
| 172 | Options::Get()->GetOptionAsInt( "SaveLogLevel", &nSaveLogLevel ); |
| 173 | if ((nSaveLogLevel == 0) || (nSaveLogLevel > LogLevel_StreamDetail)) { |
| 174 | Log::Write(LogLevel_Warning, "Invalid LogLevel Specified for SaveLogLevel in Options.xml"); |
| 175 | nSaveLogLevel = (int) LogLevel_Detail; |
| 176 | } |
| 177 | |
| 178 | int nQueueLogLevel = (int) LogLevel_Debug; |
| 179 | Options::Get()->GetOptionAsInt( "QueueLogLevel", &nQueueLogLevel ); |
| 180 | if ((nQueueLogLevel == 0) || (nQueueLogLevel > LogLevel_StreamDetail)) { |
| 181 | Log::Write(LogLevel_Warning, "Invalid LogLevel Specified for QueueLogLevel in Options.xml"); |
| 182 | nQueueLogLevel = (int) LogLevel_Debug; |
| 183 | } |
| 184 | |
| 185 | int nDumpTrigger = (int) LogLevel_Warning; |
| 186 | Options::Get()->GetOptionAsInt( "DumpTriggerLevel", &nDumpTrigger ); |
| 187 | |
| 188 | string logFilename = userPath + logFileNameBase; |
| 189 | Log::Create( logFilename, bAppend, bConsoleOutput, (LogLevel) nSaveLogLevel, (LogLevel) nQueueLogLevel, (LogLevel) nDumpTrigger ); |
| 190 | Log::SetLoggingState( logging ); |
| 191 | |
| 192 | CommandClasses::RegisterCommandClasses(); |
| 193 | Scene::ReadScenes(); |
| 194 | // petergebruers replace getVersionAsString() with getVersionLongAsString() because |
| 195 | // the latter prints more information, based on the status of the repository |
| 196 | // when "make" was run. A Makefile gets this info from git describe --long --tags --dirty |
| 197 | Log::Write(LogLevel_Always, "OpenZwave Version %s Starting Up", getVersionLongAsString().c_str()); |
| 198 | Log::Write(LogLevel_Always, "Using Language Localization %s", Localization::Get()->GetSelectedLang().c_str()); |
| 199 | NotificationCCTypes::Create(); |
| 200 | |
| 201 | } |
| 202 | |
| 203 | //----------------------------------------------------------------------------- |
nothing calls this directly
no test coverage detected