Esempio n. 1
0
 public Bcm_Control(PresenceListener PL, oLog log, OBIConfig cfg)
 {
     m_log = log;
     m_PL  = PL;
     m_CFG = cfg;
     m_RelevantChangeCountUsers    = 0;
     m_RelevantChangeCountGroups   = 0;
     m_RelevantChangeCountProfiles = 0;
     m_PSI         = null;
     m_PSI_Session = null;
     m_Subscribed  = new Dictionary <string, ObiUser>(8192);
 }
Esempio n. 2
0
        ////////////////////////////////////////////////////////
        // Startup
        public bool Start(string sServerAddress, string sUserName, string sUserPassword)
        {
            m_PSI     = new PSI();
            m_sPSIUrl = sServerAddress;
            m_PSI.Url = m_sPSIUrl;

            m_sPSIUser = sUserName;
            m_sPSIPass = sUserPassword;

            m_log.Log("BcmControl.Start PSIUrl=" + m_sPSIUrl);

            if (Util.IsNullOrEmpty(m_sPSIUser) || Util.IsNullOrEmpty(m_sPSIPass))
            {
                m_log.Log("Using empty credentials for PSI (no user/password set)");
            }
            else
            {
                m_log.Log("Using credentials for PSI " + m_sPSIUser + "," + m_sPSIPass);
                m_CCache = new System.Net.CredentialCache();
                m_CCache.Add(new System.Uri(m_sPSIUrl), "Basic", new System.Net.NetworkCredential(m_sPSIUser, m_sPSIPass));
                m_PSI.Credentials = m_CCache;
            }

            try
            {
                CreateSessionResult r;
                string stmp;

                r = m_PSI.CreateSession();

                m_PSI_Session = r.SessionID;
                m_log.Log("Created PSI session " + m_PSI_Session);


                if (GetProfileConfig() == false)
                {
                    m_log.Log("Cannot get profile configuration, ending...");
                    return(false);
                }
                if (GetUserConfig() == false)
                {
                    m_log.Log("Cannot get user configuration, ending...");
                    return(false);
                }

                m_EvtFlags = EventFlags.All;
                string stype = m_CFG.GetParameter("EventFlags", "All");
                if (stype == "Call_and_Login")
                {
                    m_EvtFlags = EventFlags.Call_and_Login;
                }
                if (stype == "Call")
                {
                    m_EvtFlags = EventFlags.Call;
                }
                if (stype == "Call_and_Service")
                {
                    m_EvtFlags = EventFlags.Call_and_Service;
                }
                if (stype == "Login")
                {
                    m_EvtFlags = EventFlags.Login;
                }
                if (stype == "Login_and_Service")
                {
                    m_EvtFlags = EventFlags.Login_and_Service;
                }

                stmp = m_CFG.GetParameter("BCM_LyncStateAsEntry", "0");
                if (stmp == "1")
                {
                    stmp = m_CFG.GetParameter("BCM_DB_Directory", "none");
                    if (stmp.Length > 0 && stmp != "none")
                    {
                        m_BcmDB = new Bcm_DB();
                        m_BcmDB.init(m_CFG, m_log, stmp);
                        m_use_dir_entry = 1;
                    }
                }
            }
            catch (Exception x)
            {
                m_log.Log("Error in Bcm_Control start - cannot create session for PSI (" + x + ")");
                return(false);
            }
            return(true);
        }
 static void Channel_MonitorChangedExtObject(EpicsChannel<PSI.EpicsClient2.ExtControl<string>> sender, PSI.EpicsClient2.ExtControl<string> newValue)
 {
     nbEvents++;
 }