Exemple #1
0
        internal static string GetDescription(this NetworkRegistrationState value, string network)
        {
            switch (value)
            {
            case NetworkRegistrationState.Error:
                return("### " + network + " network registration ERROR ###");

            case NetworkRegistrationState.NotSearching:
                return("### not searching for " + network + " network ###");

            case NetworkRegistrationState.Registered:
                return("!!! registered with " + network + " network !!!");

            case NetworkRegistrationState.RegistrationDenied:
                return("### " + network + " network registration DENIED ###");

            case NetworkRegistrationState.Roaming:
                return("!!! registered with " + network + " network (roaming) !!!");

            case NetworkRegistrationState.Searching:
                return("... searching " + network + " network ...");

            case NetworkRegistrationState.Unknown:
            default:
                return("");
            }
        }
Exemple #2
0
        private static void SIM800H_GprsNetworkRegistrationChanged(NetworkRegistrationState networkState)
        {
            Debug.Print(networkState.GetDescription("GPRS"));

            if (networkState == NetworkRegistrationState.Registered)
            {
                // SIM800H is registered with GPRS network so we can request an Internet connection now

                // add event handler to know when we have an active Internet connection
                // remove it first so we don't have duplicate calls in case a new successful registration occurs
                SIM800H.GprsProvider.GprsIpAppsBearerStateChanged -= GprsProvider_GprsIpAppsBearerStateChanged;
                SIM800H.GprsProvider.GprsIpAppsBearerStateChanged += GprsProvider_GprsIpAppsBearerStateChanged;

                // async call to GPRS provider to open the GPRS bearer
                // we can set a callback here to get the result of that request and act accordingly
                // or we can manage this in the GprsIpAppsBearerStateChanged event handler that we've already setup during the configuration
                SIM800H.GprsProvider.OpenBearerAsync(BearerProfile.IpAppsBearer);
            }
        }
Exemple #3
0
 private static void SIM800H_GsmNetworkRegistrationChanged(NetworkRegistrationState networkState)
 {
     Debug.Print(networkState.GetDescription("GSM"));
 }
Exemple #4
0
        private static void SIM800H_GprsNetworkRegistrationChanged(NetworkRegistrationState networkState)
        {
            Debug.Print(networkState.GetDescription("GPRS"));

            if (networkState == NetworkRegistrationState.Registered)
            {
                // SIM800H is registered with GPRS network so we can request an Internet connection now

                // add event handler to know when we have an active Internet connection
                // remove it first so we don't have duplicate calls in case a new successful registration occurs
                SIM800H.GprsProvider.GprsIpAppsBearerStateChanged -= GprsProvider_GprsIpAppsBearerStateChanged;
                SIM800H.GprsProvider.GprsIpAppsBearerStateChanged += GprsProvider_GprsIpAppsBearerStateChanged;

                // async call to GPRS provider to open the GPRS bearer
                // we can set a callback here to get the result of that request and act accordingly
                // or we can manage this in the GprsIpAppsBearerStateChanged event handler that we've already setup during the configuration
                SIM800H.GprsProvider.OpenBearerAsync(BearerProfile.IpAppsBearer);
            }
        }
Exemple #5
0
 private static void SIM800H_GsmNetworkRegistrationChanged(NetworkRegistrationState networkState)
 {
     Debug.Print(networkState.GetDescription("GSM"));
 }
Exemple #6
0
 private static void SIM800H_GsmNetworkRegistrationChanged(NetworkRegistrationState networkState)
 {
     Console.WriteLine(networkState.GetDescription("GSM"));
 }
        static void SIM800_GprsNetworkRegistrationChanged(NetworkRegistrationState networkState)
        {
            if (networkState == NetworkRegistrationState.Registered)
            {
                Debug.Print("...GPRS network registered...");

                // add event handlers but remove them first so we don't have duplicate calls in case this a new registration
                SIM800H.GprsProvider.GprsIpAppsBearerStateChanged -= GprsProvider_GprsIpAppsBearerStateChanged;
                SIM800H.GprsProvider.GprsIpAppsBearerStateChanged += GprsProvider_GprsIpAppsBearerStateChanged;

                // open GPRS bearer async
                SIM800H.GprsProvider.OpenBearerAsync((a) =>
                {
                    Eclo.NetMF.SIM800H.Gprs.OpenBearerAsyncResult result = (Eclo.NetMF.SIM800H.Gprs.OpenBearerAsyncResult)a;
                    if (result.Result == Eclo.NetMF.SIM800H.Gprs.OpenBearerResult.Open)
                    {
                        // GPRS bearer open
                        Debug.Print("...GPRS bearer open...");
                    }
                    else if (!(result.Result == Eclo.NetMF.SIM800H.Gprs.OpenBearerResult.Open ||
                            result.Result == Eclo.NetMF.SIM800H.Gprs.OpenBearerResult.AlreadyOpen))
                    {
                        // failed to open GPRS bearer
                        Debug.Print("### FAILED to open GPRS bearer ###");
                    }
                });
            }
        }
 private static void SIM800H_GsmNetworkRegistrationChanged(NetworkRegistrationState networkState)
 {
     if (networkState == NetworkRegistrationState.Registered)
     {
         Debug.Print("...GSM network registered...");
     }
 }