public PinWrapper(JSCallback jsCallback)
        {
            m_jsCallback = jsCallback;

            if (m_MbnInterfaceManager == null)
            {
                // Get MbnInterfaceManager
                m_MbnInterfaceManager = (IMbnInterfaceManager)new MbnInterfaceManager();
            }

            // Get the mbn interface
            m_MbnInterface = GetFirstInterface();

            if (m_PinManagerEventsSink == null)
            {
                // Advise for pin manager events
                m_PinManagerEventsSink = new PinManagerEventsSink(this.OnGetPinStateCompleteHandler, GetMbnPinManagerEventsConnectionPoint());
            }

            if (m_PinEventsSink == null)
            {
                // Advise for pin events
                m_PinEventsSink = new PinEventsSink(this.OnPinEnterComplete, GetMbnPinEventsConnectionPoint());
            }
        }
        public PinWrapper(JSCallback jsCallback)
        {
            m_jsCallback = jsCallback;

            if (m_MbnInterfaceManager == null)
            {
                // Get MbnInterfaceManager
                m_MbnInterfaceManager = (IMbnInterfaceManager) new MbnInterfaceManager();
            }

            // Get the mbn interface
            m_MbnInterface = GetFirstInterface();

            if (m_PinManagerEventsSink == null)
            {
                // Advise for pin manager events
                m_PinManagerEventsSink = new PinManagerEventsSink(this.OnGetPinStateCompleteHandler, GetMbnPinManagerEventsConnectionPoint());
            }

            if (m_PinEventsSink == null)
            {
                // Advise for pin events
                m_PinEventsSink = new PinEventsSink(this.OnPinEnterComplete, GetMbnPinEventsConnectionPoint());
            }
        }
        static void Main(string[] args)
        {
            MbnInterfaceManager  mbnInfMgr = new MbnInterfaceManager();
            IMbnInterfaceManager infMgr    = (IMbnInterfaceManager)mbnInfMgr;


            MbnConnectionManager  mbnConnectionMgr  = new MbnConnectionManager();
            IMbnConnectionManager ImbnConnectionMgr = (IMbnConnectionManager)mbnConnectionMgr;


            IMbnConnection[] connections = (IMbnConnection[])ImbnConnectionMgr.GetConnections();
            foreach (IMbnConnection conn in connections)
            {
                IMbnInterface      mobileInterface = infMgr.GetInterface(conn.InterfaceID) as IMbnInterface;
                MBN_INTERFACE_CAPS caps            = mobileInterface.GetInterfaceCapability();

                MBN_PROVIDER provider = mobileInterface.GetHomeProvider();
                Console.WriteLine("Device Id :" + caps.deviceID);
                Console.WriteLine("DataClass: " + caps.cellularClass);
                Console.WriteLine("Manufacturer: " + caps.manufacturer);
                Console.WriteLine("Model : " + caps.model);
                Console.WriteLine("Firmware Version: " + caps.firmwareInfo);
                Console.WriteLine("Manufacturer:        " + caps.manufacturer);
                Console.WriteLine("Model:               " + caps.model);
                Console.WriteLine("DeviceID:            " + caps.deviceID);
                Console.WriteLine("FirmwareInfo:        " + caps.firmwareInfo);

                Console.WriteLine("InterfaceID:         " + mobileInterface.InterfaceID);
                Console.WriteLine("Provider:            " + provider.providerName);
                Console.WriteLine("ProviderID:          " + provider.providerID);
                Console.WriteLine("ProviderState:       " + provider.providerState);
            }
            Console.ReadKey(true);
        }
        public void OnInterfaceRemoval(IMbnInterface oldInterface)
        {
            OnInterfaceRemovalHandler callback;

            if (m_RemovalCallback.TryGetTarget(out callback))
            {
                callback.Invoke(oldInterface);
            }
        }
Esempio n. 5
0
 // This will be called back when interface arrival operation is complete
 public void OnInterfaceArrival(IMbnInterface newInterface)
 {
     // Invoke main page thread to show UI
     OnInterfaceArrivalHandler callback;
     if (m_ArrivalCallback.TryGetTarget(out callback))
     {
         callback.Invoke(newInterface);
     }
 }
        public void OnSetPreferredProvidersComplete(IMbnInterface newInterface, uint requestID, int status)
        {
            OnSetPreferredProvidersCompleteHandler callback;

            if (m_OnSetPreferredProvidersCompleteCallback.TryGetTarget(out callback))
            {
                callback.Invoke(newInterface, requestID, status);
            }
        }
        public void OnPreferredProvidersChange(IMbnInterface newInterface)
        {
            OnPreferredProvidersChangeHandler callback;

            if (m_OnPreferredProvidersChangeCallback.TryGetTarget(out callback))
            {
                callback.Invoke(newInterface);
            }
        }
        public void OnScanNetworkComplete(IMbnInterface newInterface, uint requestID, int status)
        {
            OnScanNetworkCompleteHandler callback;

            if (m_OnScanNetworkCompleteCallback.TryGetTarget(out callback))
            {
                callback.Invoke(newInterface, requestID, status);
            }
        }
        public void OnSubscriberInformationChange(IMbnInterface newInterface)
        {
            OnSubscriberInformationChangeHandler callback;

            if (m_OnSubscriberInformationChangeCallback.TryGetTarget(out callback))
            {
                callback.Invoke(newInterface);
            }
        }
        public void OnEmergencyModeChange(IMbnInterface newInterface)
        {
            OnEmergencyModeChangeHandler callback;

            if (m_OnEmergencyModeChangeCallback.TryGetTarget(out callback))
            {
                callback.Invoke(newInterface);
            }
        }
        public void OnHomeProviderAvailable(IMbnInterface newInterface)
        {
            OnHomeProviderAvailableHandler callback;

            if (m_OnHomeProviderAvailableCallback.TryGetTarget(out callback))
            {
                callback.Invoke(newInterface);
            }
        }
        public void OnInterfaceArrival(IMbnInterface newInterface)
        {
            OnInterfaceArrivalHandler callback;

            if (m_ArrivalCallback.TryGetTarget(out callback))
            {
                callback.Invoke(newInterface);
            }
        }
        async void ProcessOnInterfaceRemoval(IMbnInterface oldInterface)
        {
            await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                string message = "";

                message += "\nOnInterfaceRemoval event received for interface ID: " + oldInterface.InterfaceID;
                message += "\nAnd hence disabling scenario buttons, please plug-in required mobilebroadband device";

                DisableScenarioButtons(this, EventArgs.Empty);

                rootPage.NotifyUser(message, NotifyType.StatusMessage);
            });
        }
        async void ProcessOnInterfaceArrival(IMbnInterface newInterface)
        {
            await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                string message = "";

                message += "\nOnInterfaceArrival event received for interface ID: " + newInterface.InterfaceID;
                message += "\nAnd hence enabling scenario buttons";

                EnableScenarioButtons(this, EventArgs.Empty);

                rootPage.NotifyUser(message, NotifyType.StatusMessage);
            });
        }
Esempio n. 15
0
        private void mobile_connect_button_Click(object sender, RoutedEventArgs e)
        {
            //connect to mobile profile
            mobile_password_label.Content = "Connected to Mobile Broadband Network";

            MBNConnect.MBNConnect allive             = new MBNConnect.MBNConnect();
            MbnInterfaceManager   mbnInfMgr          = new MbnInterfaceManager();
            IMbnInterfaceManager  mbnInfMgrInterface = mbnInfMgr as IMbnInterfaceManager;

            IMbnInterface[] mobileInterfaces = mbnInfMgrInterface.GetInterfaces() as IMbnInterface[];
            IMbnInterface   inf  = (IMbnInterface)mobileInterfaces[1];
            IMbnConnection  conn = inf.GetConnection();

            allive.KeepConnectionAllive(conn);
        }
Esempio n. 16
0
        public string GetMobileNumber()
        {
            IMbnInterfaceManager      interfaceManager = null;
            IMbnInterface             inf        = null;
            IMbnSubscriberInformation subscriber = null;

            try
            {
                interfaceManager = (IMbnInterfaceManager) new MbnInterfaceManager();
                inf        = interfaceManager.GetInterface(InterfaceID);
                subscriber = inf.GetSubscriberInformation();

                foreach (var ob in subscriber.TelephoneNumbers)
                {
                    if (ob != null)
                    {
                        return((string)ob);
                    }
                }
            }
            catch (Exception e)
            {
                logger.Warn(e);
            }
            finally
            {
                if (subscriber != null)
                {
                    Marshal.FinalReleaseComObject(subscriber);
                }
                if (inf != null)
                {
                    Marshal.FinalReleaseComObject(inf);
                }
                if (interfaceManager != null)
                {
                    Marshal.FinalReleaseComObject(interfaceManager);
                }
            }

            return("Unknown");
        }
Esempio n. 17
0
        private void ProcessOnScanNetworkComplete(IMbnInterface newInterface, uint requestID, int status)
        {
            LogMessage("Scanning Complete");
            uint age;

            try
            {
                MBN_PROVIDER[] lastScannedNetworks = (MBN_PROVIDER[])newInterface.GetVisibleProviders(out age);
                this.Invoke((MethodInvoker) delegate()
                {
                    PopulateNetworks(lastScannedNetworks);
                    lblLastScan.Text = DateTime.Now.AddSeconds(-1 * age).ToShortTimeString();
                    btnScan.Enabled  = true;
                });
            } catch (Exception ex)
            {
                this.Invoke((MethodInvoker) delegate()
                {
                    LogMessage("No Networks found");
                    lblLastScan.Text = DateTime.Now.ToShortTimeString();
                });
            }
        }
Esempio n. 18
0
 private void ProcessOnInterfaceCapabilityAvailable(IMbnInterface newInterface)
 {
     LogMessage("ProcessOnInterfaceCapabilityAvailable");
 }
Esempio n. 19
0
 private void ProcessOnHomeProviderAvailable(IMbnInterface newInterface)
 {
     LogMessage("ProcessOnHomeProviderAvailable");
 }
Esempio n. 20
0
 private void ProcessOnEmergencyModeChange(IMbnInterface newInterface)
 {
     LogMessage("ProcessOnEmergencyModeChange");
 }
Esempio n. 21
0
        private void InitializeEventHandlers()
        {
            try
            {
                // Get the interface
                m_MbnInterface             = m_MbnInterfaceManager.GetInterface(selectedInterfaceId);
                m_MbnConnection            = m_MbnInterface.GetConnection();
                m_MbnDeviceServicesContext = m_MbnDeviceServicesManager.GetDeviceServicesContext(m_MbnInterface.InterfaceID);

                // Register for IMbnConnectionEvents
                if (m_ConnectionEventsSink == null)
                {
                    m_OnConnectCompleteEventDelegate    = new OnConnectCompleteHandler(ProcessOnConnectComplete);
                    m_OnDisconnectCompleteEventDelegate = new OnDisconnectCompleteHandler(ProcessOnDisconnectComplete);
                    m_ConnectionEventsSink = new ConnectionEventsSink(m_OnConnectCompleteEventDelegate,
                                                                      m_OnDisconnectCompleteEventDelegate,
                                                                      GetMbnConnectionEventsConnectionPoint());
                }

                // Register for IMbnDeviceServicesEvents
                if (m_DeviceServicesEventsSink == null)
                {
                    m_OnOpenCommandSessionCompleteEventDelegate = new OnOpenCommandSessionCompleteHandler(ProcessOnOpenCommandSessionComplete);
                    m_OnQueryCommandCompleteEventDelegate       = new OnQueryCommandCompleteHandler(ProcessOnQueryCommandComplete);
                    m_OnSetCommandCompleteEventDelegate         = new OnSetCommandCompleteHandler(ProcessOnSetCommandComplete);
                    m_OnCloseCommandSessionEventDelegate        = new OnCloseCommandSessionCompleteHandler(ProcessOnCloseCommandSessionComplete);
                    m_DeviceServicesEventsSink = new DeviceServicesEventsSink(
                        m_OnOpenCommandSessionCompleteEventDelegate,
                        m_OnQueryCommandCompleteEventDelegate,
                        m_OnCloseCommandSessionEventDelegate,
                        m_OnSetCommandCompleteEventDelegate,
                        GetMbnDeviceServicesEventsConnectionPoint());
                }

                //Register for IMbnRegistrationEvents
                if (m_RegistrationEventsSink == null)
                {
                    m_OnRegisterModeAvailableHandlerEventDelegate    = new OnRegisterModeAvailableHandler(ProcessOnRegisterModeAvailable);
                    m_OnRegisterStateChangeHandlerEventDelegate      = new OnRegisterStateChangeHandler(ProcessOnRegisterStateChange);
                    m_OnPacketServiceStateChangeHandlerEventDelegate = new OnPacketServiceStateChangeHandler(ProcessOnPacketServiceStateChange);
                    m_OnSetRegisterModeCompleteHandlerEventDelegate  = new OnSetRegisterModeCompleteHandler(ProcessOnSetRegisterModeComplete);
                    m_RegistrationEventsSink = new RegistrationEventsSink(
                        m_OnRegisterModeAvailableHandlerEventDelegate,
                        m_OnRegisterStateChangeHandlerEventDelegate,
                        m_OnPacketServiceStateChangeHandlerEventDelegate,
                        m_OnSetRegisterModeCompleteHandlerEventDelegate,
                        GetRegisterEventsConnectionPoint());
                }

                if (m_InterfaceEventsSink == null)
                {
                    OnEmergencyModeChangeHandlerEventDelegate           = new OnEmergencyModeChangeHandler(ProcessOnEmergencyModeChange);
                    OnHomeProviderAvailableHandlerEventDelegate         = new OnHomeProviderAvailableHandler(ProcessOnHomeProviderAvailable);
                    OnInterfaceCapabilityAvailableHandlerEventDelegate  = new OnInterfaceCapabilityAvailableHandler(ProcessOnInterfaceCapabilityAvailable);
                    OnPreferredProvidersChangeHandlerEventDelegate      = new OnPreferredProvidersChangeHandler(ProcessOnPreferredProvidersChange);
                    OnReadyStateChangeHandlerEventDelegate              = new OnReadyStateChangeHandler(ProcessOnReadyStateChange);
                    OnScanNetworkCompleteHandlerEventDelegate           = new OnScanNetworkCompleteHandler(ProcessOnScanNetworkComplete);
                    OnSetPreferredProvidersCompleteHandlerEventDelegate = new OnSetPreferredProvidersCompleteHandler(ProcessOnSetPreferredProvidersComplete);
                    OnSubscriberInformationChangeHandlerEventDelegate   = new OnSubscriberInformationChangeHandler(ProcessOnSubscriberInformationChange);
                    m_InterfaceEventsSink = new InterfaceEventsSink(
                        OnEmergencyModeChangeHandlerEventDelegate,
                        OnHomeProviderAvailableHandlerEventDelegate,
                        OnInterfaceCapabilityAvailableHandlerEventDelegate,
                        OnPreferredProvidersChangeHandlerEventDelegate,
                        OnReadyStateChangeHandlerEventDelegate,
                        OnScanNetworkCompleteHandlerEventDelegate,
                        OnSetPreferredProvidersCompleteHandlerEventDelegate,
                        OnSubscriberInformationChangeHandlerEventDelegate,
                        GetInterfaceEventsConnectionPoint());
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(ParseExceptionCode(e));
            }
        }
Esempio n. 22
0
        void ExecuteAction(ActionType action)
        {
            IMbnInterfaceManager      interfaceManager = null;
            IMbnInterface             inf        = null;
            IMbnSubscriberInformation subscriber = null;

            try
            {
                interfaceManager = (IMbnInterfaceManager) new MbnInterfaceManager();
                inf        = interfaceManager.GetInterface(InterfaceID);
                subscriber = inf.GetSubscriberInformation();

                XmlDocument xml = new XmlDocument();
                xml.LoadXml(mobileProfileTemplate);

                xml["MBNProfile"]["SubscriberID"].InnerText = subscriber.SubscriberID;
                xml["MBNProfile"]["SimIccID"].InnerText     = subscriber.SimIccID;

                //Console.WriteLine("Profile: " + xml.OuterXml);

                IMbnConnection conn = null;

                try
                {
                    conn = inf.GetConnection();

                    //MBN_ACTIVATION_STATE state;
                    //string profile;
                    //conn.GetConnectionState(out state, out profile);

                    uint requestId;

                    if (action == ActionType.Connect)
                    {
                        conn.Connect(MBN_CONNECTION_MODE.MBN_CONNECTION_MODE_TMP_PROFILE, xml.OuterXml, out requestId);
                    }
                    else
                    {
                        conn.Disconnect(out requestId);
                    }
                }
                finally
                {
                    if (conn != null)
                    {
                        Marshal.FinalReleaseComObject(conn);
                    }
                }
            }
            finally
            {
                if (subscriber != null)
                {
                    Marshal.FinalReleaseComObject(subscriber);
                }
                if (inf != null)
                {
                    Marshal.FinalReleaseComObject(inf);
                }
                if (interfaceManager != null)
                {
                    Marshal.FinalReleaseComObject(interfaceManager);
                }
            }
        }
 public void OnInterfaceCapabilityAvailable(IMbnInterface newInterface)
 {
     throw new NotImplementedException();
 }
Esempio n. 24
0
        public void Test()
        {
            IMbnInterfaceManager      interfaceManager = null;
            IMbnInterface             inf        = null;
            IMbnSubscriberInformation subscriber = null;

            try
            {
                interfaceManager = (IMbnInterfaceManager) new MbnInterfaceManager();
                inf        = interfaceManager.GetInterface(InterfaceID);
                subscriber = inf.GetSubscriberInformation();

                uint outCode = 0;
                inf.ScanNetwork(out outCode);

                uint age   = 0;
                var  array = inf.GetVisibleProviders(out age);

                var provider = inf.GetHomeProvider();

                //inf.SetPreferredProviders(new MBN_PROVIDER[] { plusProvider }, out outCode);

                XmlDocument xml = new XmlDocument();
                xml.LoadXml(mobileProfileTemplate);

                xml["MBNProfile"]["SubscriberID"].InnerText = subscriber.SubscriberID;
                xml["MBNProfile"]["SimIccID"].InnerText     = subscriber.SimIccID;

                //Console.WriteLine("Profile: " + xml.OuterXml);

                IMbnConnection conn = null;

                try
                {
                    conn = inf.GetConnection();

                    //MBN_ACTIVATION_STATE state;
                    //string profile;
                    //conn.GetConnectionState(out state, out profile);

                    uint requestId;
                }
                finally
                {
                    if (conn != null)
                    {
                        Marshal.FinalReleaseComObject(conn);
                    }
                }
            }
            finally
            {
                if (subscriber != null)
                {
                    Marshal.FinalReleaseComObject(subscriber);
                }
                if (inf != null)
                {
                    Marshal.FinalReleaseComObject(inf);
                }
                if (interfaceManager != null)
                {
                    Marshal.FinalReleaseComObject(interfaceManager);
                }
            }
        }
Esempio n. 25
0
        static void RefreshRunningProxies()
        {
            List <string> infIdList = new List <string>();

            IMbnInterfaceManager interfaceManager = null;

            try
            {
                interfaceManager = (IMbnInterfaceManager) new MbnInterfaceManager();

                foreach (var obj in interfaceManager.GetInterfaces())
                {
                    try
                    {
                        IMbnInterface inf = (IMbnInterface)obj;
                        infIdList.Add(inf.InterfaceID);
                        Marshal.FinalReleaseComObject(inf);
                    }
                    catch { }
                }
            }
            finally
            {
                if (interfaceManager != null)
                {
                    Marshal.FinalReleaseComObject(interfaceManager);
                }
            }

            foreach (var qproxy in quadplayProxyList)
            {
                if (!infIdList.Contains(qproxy.InterfaceID))
                {
                    qproxy.InvalidateInterface();
                }
            }

            foreach (string infId in infIdList)
            {
                bool exists = false;

                foreach (var qproxy in quadplayProxyList)
                {
                    if (qproxy.InterfaceID == infId)
                    {
                        exists = true;
                        break;
                    }
                }

                if (!exists)
                {
                    bool added = false;

                    lock (quadplayProxyList)
                    {
                        foreach (var qproxy in quadplayProxyList.OrderBy(el => random.Next()))
                        {
                            if (qproxy.InterfaceID == null)
                            {
                                qproxy.SetToInterface(infId);
                                logger.Info($"Binded Proxy: {qproxy.ID} To Interface: {qproxy.InterfaceID}");
                                added = true;
                                break;
                            }
                        }
                    }

                    if (!added)
                    {
                        var qproxy = new QuadplayProxy(nextID++);
                        qproxy.SetToInterface(infId);
                        qproxy.Start();

                        lock (quadplayProxyList)
                        {
                            quadplayProxyList.Add(qproxy);
                        }
                    }
                }
            }
        }
Esempio n. 26
0
        // This will be called when GetDeviceCapability button is clicked
        public void GetDeviceCapability()
        {
            try
            {
                if (m_MbnInterface == null)
                {
                    m_MbnInterface = GetFirstInterface();
                }
                
                var cap = m_MbnInterface.GetInterfaceCapability();

                string message = "";
                message += "Device capabilities:";
                message += "\n\n MBN_CELLULAR_CLASS = " + cap.cellularClass.ToString();
                message += "\n MBN_VOICE_CLASS = " + cap.voiceClass.ToString();
                message += "\n Device ID = " + cap.deviceID.ToString();
                message += "\n Manufacturer = " + cap.manufacturer.ToString();
                message += "\n Model = " + cap.model.ToString();
                message += "\n Firmware Info = " + cap.firmwareInfo.ToString();

                rootPage.NotifyUser(message, NotifyType.StatusMessage);
            }
            catch (Exception e)
            {
                rootPage.NotifyUser(ParseExceptionCode(e), NotifyType.ErrorMessage);
            }
        }
Esempio n. 27
0
 private void ProcessOnSubscriberInformationChange(IMbnInterface newInterface)
 {
     LogMessage("ProcessOnSubscriberInformationChange");
 }
Esempio n. 28
0
 private void ProcessOnPreferredProvidersChange(IMbnInterface newInterface)
 {
     LogMessage("ProcessOnPreferredProvidersChange");
 }
Esempio n. 29
0
        // Register for notifications
        private void RegisterForNotifications()
        {
            try
            {
                if (m_MbnInterface == null)
                {
                    // Get the interface
                    m_MbnInterface = GetFirstInterface();
                }

                if (m_MbnConnection == null)
                {
                    m_MbnConnection = m_MbnInterface.GetConnection();
                }

                if (m_MbnDeviceServicesContext == null)
                {
                    m_MbnDeviceServicesContext = m_MbnDeviceServicesManager.GetDeviceServicesContext(m_MbnInterface.InterfaceID);
                }

                // Register for IMbnInterfaceManagerEvents
                if (m_InterfaceManagerEventsSink == null)
                {
                    m_OnInterfaceArrivalEventDelegate = new OnInterfaceArrivalHandler(ProcessOnInterfaceArrival);
                    m_OnInterfaceRemovalEventDelegate = new OnInterfaceRemovalHandler(ProcessOnInterfaceRemoval);
                    m_InterfaceManagerEventsSink = new InterfaceManagerEventsSink(m_OnInterfaceArrivalEventDelegate,
                                                                                  m_OnInterfaceRemovalEventDelegate,
                                                                                  GetMbnInterfaceManagerEventsConnectionPoint());
                }

                // Register for IMbnPinManagerEvents
                if (m_PinManagerEventsSink == null)
                {
                    m_OnGetPinStateCompleteEventDelegate = new OnGetPinStateCompleteHandler(ProcessOnGetPinStateCompleteHandlerEvt);
                    m_PinManagerEventsSink = new PinManagerEventsSink(m_OnGetPinStateCompleteEventDelegate, GetMbnPinManagerEventsConnectionPoint());
                }

                // Register for IMbnPinEvents
                if (m_PinEventsSink == null)
                {
                    m_OnEnterCompleteEventDelegate = new OnEnterCompleteHandler(ProcessOnEnterComplete);
                    m_PinEventsSink = new PinEventsSink(m_OnEnterCompleteEventDelegate, GetMbnPinEventsConnectionPoint());
                }
                
                // Register for IMbnConnectionEvents
                if (m_ConnectionEventsSink == null)
                {
                    m_OnConnectCompleteEventDelegate = new OnConnectCompleteHandler(ProcessOnConnectComplete);
                    m_OnDisconnectCompleteEventDelegate = new OnDisconnectCompleteHandler(ProcessOnDisconnectComplete);
                    m_ConnectionEventsSink = new ConnectionEventsSink(m_OnConnectCompleteEventDelegate,
                                                                      m_OnDisconnectCompleteEventDelegate,
                                                                      GetMbnConnectionEventsConnectionPoint());
                }
                
                // Register for IMbnDeviceServicesEvents
                if (m_DeviceServicesEventsSink == null)
                {
                    m_OnOpenCommandSessionCompleteEventDelegate = new OnOpenCommandSessionCompleteHandler(ProcessOnOpenCommandSessionComplete);
                    m_OnQueryCommandCompleteEventDelegate = new OnQueryCommandCompleteHandler(ProcessOnQueryCommandComplete);
                    m_OnCloseCommandSessionEventDelegate = new OnCloseCommandSessionCompleteHandler(ProcessOnCloseCommandSessionComplete);
                    m_DeviceServicesEventsSink = new DeviceServicesEventsSink(
                                                    m_OnOpenCommandSessionCompleteEventDelegate,
                                                    m_OnQueryCommandCompleteEventDelegate,
                                                    m_OnCloseCommandSessionEventDelegate,
                                                    GetMbnDeviceServicesEventsConnectionPoint());
                }
            }
            catch (Exception e)
            {
                rootPage.NotifyUser(ParseExceptionCode(e), NotifyType.ErrorMessage);
            }
        }
Esempio n. 30
0
 private void ProcessOnReadyStateChange(IMbnInterface newInterface)
 {
     LogMessage("ProcessOnReadyStateChange");
 }
Esempio n. 31
0
        async void ProcessOnInterfaceArrival(IMbnInterface newInterface)
        {
            // Dispatch to UI thread
            await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                string message = "";

                message += "\nOnInterfaceArrival event received for interface ID: " + newInterface.InterfaceID;
                message += "\nAnd hence enabling scenario buttons";

                EnableScenarioButtons(this, EventArgs.Empty);

                rootPage.NotifyUser(message, NotifyType.StatusMessage);
            });
        }
Esempio n. 32
0
 private void ProcessOnSetPreferredProvidersComplete(IMbnInterface newInterface, uint requestID, int status)
 {
     LogMessage("ProcessOnSetPreferredProvidersComplete");
 }
Esempio n. 33
0
        async void ProcessOnInterfaceRemoval(IMbnInterface oldInterface)
        {
            // Dispatch to UI thread
            await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                string message = "";

                message += "\nOnInterfaceRemoval event received for interface ID: " + oldInterface.InterfaceID;
                message += "\nAnd hence disabling scenario buttons, please plug-in required mobilebroadband device";

                DisableScenarioButtons(this, EventArgs.Empty);

                rootPage.NotifyUser(message, NotifyType.StatusMessage);
            });
        }
Esempio n. 34
0
 // This will be called back when interface removal operation is complete
 public void OnInterfaceRemoval(IMbnInterface oldInterface)
 {
     // Invoke main page thread to show UI
     OnInterfaceRemovalHandler callback;
     if (m_RemovalCallback.TryGetTarget(out callback))
     {
         callback.Invoke(oldInterface);
     }
 }
        private void RegisterForNotifications()
        {
            try
            {
                if (m_MbnInterface == null)
                {
                    m_MbnInterface = GetFirstInterface();
                }

                if (m_MbnConnection == null)
                {
                    m_MbnConnection = m_MbnInterface.GetConnection();
                }

                if (m_MbnDeviceServicesContext == null)
                {
                    m_MbnDeviceServicesContext = m_MbnDeviceServicesManager.GetDeviceServicesContext(m_MbnInterface.InterfaceID);
                }

                // Register for IMbnInterfaceManagerEvents
                if (m_InterfaceManagerEventsSink == null)
                {
                    m_OnInterfaceArrivalEventDelegate = new OnInterfaceArrivalHandler(ProcessOnInterfaceArrival);
                    m_OnInterfaceRemovalEventDelegate = new OnInterfaceRemovalHandler(ProcessOnInterfaceRemoval);
                    m_InterfaceManagerEventsSink      = new InterfaceManagerEventsSink(m_OnInterfaceArrivalEventDelegate,
                                                                                       m_OnInterfaceRemovalEventDelegate,
                                                                                       GetMbnInterfaceManagerEventsConnectionPoint());
                }

                // Register for IMbnPinManagerEvents
                if (m_PinManagerEventsSink == null)
                {
                    m_OnGetPinStateCompleteEventDelegate = new OnGetPinStateCompleteHandler(ProcessOnGetPinStateCompleteHandlerEvt);
                    m_PinManagerEventsSink = new PinManagerEventsSink(m_OnGetPinStateCompleteEventDelegate, GetMbnPinManagerEventsConnectionPoint());
                }

                // Register for IMbnPinEvents
                if (m_PinEventsSink == null)
                {
                    m_OnEnterCompleteEventDelegate = new OnEnterCompleteHandler(ProcessOnEnterComplete);
                    m_PinEventsSink = new PinEventsSink(m_OnEnterCompleteEventDelegate, GetMbnPinEventsConnectionPoint());
                }
                // Register for IMbnConnectionEvents

                if (m_ConnectionEventsSink == null)
                {
                    m_OnConnectCompleteEventDelegate    = new OnConnectCompleteHandler(ProcessOnConnectComplete);
                    m_OnDisconnectCompleteEventDelegate = new OnDisconnectCompleteHandler(ProcessOnDisconnectComplete);
                    m_ConnectionEventsSink = new ConnectionEventsSink(m_OnConnectCompleteEventDelegate,
                                                                      m_OnDisconnectCompleteEventDelegate,
                                                                      GetMbnConnectionEventsConnectionPoint());
                }
                // Register for IMbnDeviceServicesEvents

                if (m_DeviceServicesEventsSink == null)
                {
                    m_OnOpenCommandSessionCompleteEventDelegate = new OnOpenCommandSessionCompleteHandler(ProcessOnOpenCommandSessionComplete);
                    m_OnQueryCommandCompleteEventDelegate       = new OnQueryCommandCompleteHandler(ProcessOnQueryCommandComplete);
                    m_OnCloseCommandSessionEventDelegate        = new OnCloseCommandSessionCompleteHandler(ProcessOnCloseCommandSessionComplete);
                    m_DeviceServicesEventsSink = new DeviceServicesEventsSink(
                        m_OnOpenCommandSessionCompleteEventDelegate,
                        m_OnQueryCommandCompleteEventDelegate,
                        m_OnCloseCommandSessionEventDelegate,
                        GetMbnDeviceServicesEventsConnectionPoint());
                }
            }
            catch (Exception e)
            {
                rootPage.NotifyUser(ParseExceptionCode(e), NotifyType.ErrorMessage);
            }
        }