Пример #1
0
        private void cmbRadio_SelectedIndexChanged(object sender, EventArgs e)
        {
            selectedInterfaceId = radios[cmbRadio.SelectedIndex].InterfaceID;
            InitializeEventHandlers();
            uint age = 0;

            lvNetwork.Items.Clear();
            try
            {
                lastScannedNetworks = (MBN_PROVIDER[])m_MbnInterface.GetVisibleProviders(out age);
                PopulateNetworks(lastScannedNetworks);
                lblLastScan.Text = DateTime.Now.AddSeconds(-1 * age).ToShortTimeString();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Networks not found.  Please scan to find networks.");
                lblLastScan.Text = "Unknown";
            }

            //Fill In the registration stuff
            IMbnRegistration registrationInterface = m_MbnInterface as IMbnRegistration;

            updateRegistration(registrationInterface);

            //Fill in the IMSI
            try
            {
                string IMSI = m_MbnInterfaceManager.GetInterface(selectedInterfaceId).GetSubscriberInformation().SubscriberID;
                lblIMSI.Text = IMSI;
            } catch (Exception ex)
            {
                lblIMSI.Text = "Unknown";
            }

            //Check if connected
            try
            {
                IMbnConnection       connection = ((IMbnConnection[])m_MbnConnectionManager.GetConnections())[0];
                MBN_ACTIVATION_STATE activationState;
                string profileName;
                connection.GetConnectionState(out activationState, out profileName);
                if (activationState == MBN_ACTIVATION_STATE.MBN_ACTIVATION_STATE_ACTIVATED)
                {
                    btnPcConnect.Enabled = false;
                }
                else
                {
                    btnPcDisconnect.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                btnPcDisconnect.Enabled = false;
            }
        }
Пример #2
0
        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);
        }