BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { if (ul_reason_for_call == DLL_PROCESS_ATTACH) { g_hModule = hModule; //Initialize logger InitLogEnv(hModule); // Initialize COM CoInitializeEx(0,COINIT_MULTITHREADED); } else if(ul_reason_for_call == DLL_PROCESS_DETACH ) { //Uninstall COM //CoUninitialize(); } return TRUE; }
void ConfigApp::Load() { CConfigExt oConf ; if ( ! oConf.Load(configFilePath.c_str()) ) { char szLocal[ 128 ]; snprintf( szLocal, sizeof(szLocal), "Unable to load config file[%s]\n", configFilePath.c_str()); szLocal[sizeof(szLocal) - 1] = 0; THROW_EXCEPTION1(InvalidConfigAppException, szLocal ); } oConf.GetVar( "LogConfigPath", logConfigPath, MHOST_LOG_INI ); oConf.GetVar( "DatabasePath", databasePath, MHOST_DB3 ); oConf.GetVar( "DatabaseServer", databaseServer, "127.0.0.1" ); oConf.GetVar( "DatabaseName", databaseName, "Monitor_Host" ); oConf.GetVar( "DatabaseUser", databaseUser, "root" ); oConf.GetVar( "DatabasePassword", databasePassword, "" ); oConf.GetVar( "DatabaseTimeout", databaseTimeout, 10 ); oConf.GetVar( "DatabaseVacuumPeriodMinutes", databaseVacuumPeriodMinutes, 30 ); oConf.GetVar( "DatabaseRemoveEntriesCheckPeriodMinutes", databaseRemoveEntriesCheckPeriodMinutes, 10 ); oConf.GetVar( "DatabaseRemoveEntriesOlderThanMinutes", databaseRemoveOlderEntriesThanMinutes, 30 ); oConf.GetVar( "DatabaseRemoveAlarmEntriesOlderThanDays", databaseRemoveOlderAlarmEntriesThanDays , 4 ); oConf.GetVar( "GatewayHost", gatewayHost, "127.0.0.1" ); oConf.GetVar( "GatewayPort", gatewayPort, 4900 ); oConf.GetVar( "GatewayListenMode", gatewayListenMode, false ); oConf.GetVar( "GatewayPacketVersion", gatewayPacketVersion, 1 ); oConf.GetVar( "CommandsTimeout", commandsTimeout, 60 ); oConf.GetVar( "CommandsRetryCountIfTimeout", retryCountIfTimeout, 3 ); oConf.GetVar( "TopologyPooling", topologyPool, 500 ); oConf.GetVar( "DevicesListPooling", devicesListPool, 500 ); oConf.GetVar( "firmDlContractsPooling", firmDlContractsPeriod, 30 ); oConf.GetVar( "ScheduleReportPooling", ScheduleReportPool, 500 ); oConf.GetVar( "DeviceHealthReportPooling", DeviceReportPool, 500 ); oConf.GetVar( "NetworkHealthReportPooling", NetworkReportPool, 500 ); oConf.GetVar( "NeighbourHealthReportPooling", NeighbourReportPool, 500 ); oConf.GetVar( "ContractsAndRoutesPooling", ContractsAndRoutesPool, 500 ); oConf.GetVar( "CommandsCheckPeriod", threadCheckPeriod, 2 ); oConf.GetVar( "UseReadingsHistory", m_nDeviceReadingsHistoryEnable, 0 ); oConf.GetVar( "ReadingsSavePeriod", readingsBulkSaverPeriod, 10 ); oConf.GetVar( "ReadingsMaxEntriesBeforeSave", readingsBulkSaverMaxReadings, 10 ); oConf.GetVar( "BulkDataTransferRate", bulkDataTransferRate, 85 ); oConf.GetVar( "DelayPeriodBeforeFirmwareRetry", delayPeriodBeforeFirmwareRetry, 1 ); oConf.GetVar( "PathToFiles", pathToFirmwareFiles, "/usr/local/NISA/Data/DeviceFirmwares/" ); oConf.GetVar( "PubConfigPath",strPubConfigFile, "" ); oConf.GetVar( "HistoryStatusSize", history_status_size, 6); //security oConf.GetVar( "UseEncryption", m_UseEncryption, 0 ); oConf.GetVar( "ClientCertifFile", m_sslClientCertifFile, "/access_node/activity_files/clientcert.pem" ); oConf.GetVar( "ClientKeyFile", m_sslClientKeyFile, "/access_node/activity_files/clientkey.pem" ); oConf.GetVar( "CACertFile", m_sslCACertFile, "/access_node/activity_files/cacert.pem" ); oConf.GetVar( "LeasePeriod", m_leasePeriod, 15*60 /* 15 minutes */); oConf.GetVar( "LeaseCommittedBurst", m_leaseCommittedBurst, 0 /*default for gw*/ ); oConf.GetVar( "SavePublishPeriod", (int&)m_savePublishPeriod, 2000 /*msec default*/ ); //added by Cristian.Guef if ( InitLogEnv(logConfigPath.c_str()) == false) { char szLocal[ 128 ]; snprintf( szLocal, sizeof(szLocal), "Unable to load LOG config file[%s]\n", logConfigPath.c_str()); szLocal[sizeof(szLocal) - 1] = 0; THROW_EXCEPTION1(InvalidConfigAppException, szLocal); } //added by Cristian.Guef read publisher list -it is delayed now because there should be done alert_subscription //PublisherConf().LoadPublishers(strPubConfigFile.c_str(), PublishersMapStored); //processSignal2 = true; }