public override bool Initialize(ref string errMsg) { InitResult = InitResult.InitFail; bool configured = ConfigMgr.Contains(typeof(IPSSetting).FullName); Setting = ConfigMgr.GetSetting(typeof(IPSSetting), true) as IPSSetting; if (Setting == null) { Log.Error("IPS Setting can not be instantiated"); return(false); } if (!configured) { Log.Error("IPS subsystem has not been configured"); return(true); } InitializeDirectory(); if (!string.IsNullOrEmpty(Setting.ServerAddr)) { _remoteProc = new IPSRemoteProc(Setting.ServerAddr, Setting.InstructPort); } if (!InitializeDevices()) { return(false); } if (!InitializeMaps()) { return(false); } _eventSubscriber = new EventSubscriber(); _eventSubscriber.ServerAddr = Setting.ServerAddr; _eventSubscriber.ServrtPort = Setting.EventPort; _eventSubscriber.LocationTag = Setting.EventTag; _eventSubscriber.OnLocationChanged += OnLocationUpdate; _eventSubscriber.OnCameraStateChanged += OnCameraStateChanged; _eventSubscriber.StartNidsEvent(); if (Setting.IsLDAPEnabled) { _ldapClient = new LDAPClient(Setting.LDAPServerAddr); _ldapClient.Port = Setting.LDAPPort; _ldapClient.User = Setting.LDAPUser; _ldapClient.Password = Setting.LDAPPassowrd; _ldapClient.PortraitDir = PortraitDir; _ldapClient.OnPortaitDownloaded += OnPortraitDownloaded; } return(true); }