Cellular Radio

Hi,

i have some problems with the celluar radio module and my spider board.
i use NETMF 4.3

i can send sms, connect to the gprs network and dial out.
but i cant recieve any calls or other events.
if i call to the cellular module it rings on the phone but the module dont recnogize.

cellularRadio.ModuleInitialized += cellularRadio_ModuleInitialized;
            cellularRadio.PowerOn(40);
            cellularRadio.GsmNetworkRegistrationChanged += cellularRadio_GsmNetworkRegistrationChanged;
            cellularRadio.SmsReceived += new CellularRadio.SmsReceivedHandler(cellularRadio_SmsReceived);
            cellularRadio.SmsListRequested += cellularRadio_SmsListRequested;
            cellularRadio.IncomingCall += new CellularRadio.IncomingCallHandler(cellularRadio_IncomingCall);
  void cellularRadio_SmsReceived(CellularRadio sender, CellularRadio.Sms message)
        {
            
            //characterDisplay.Clear();
            //characterDisplay.Print(message.Message);
            Debug.Print(message.Message);
        }

Thanks

Oliver



Tells the GSM to return Caller ID.   "+CLIP:" is then seen in the serial stream and the incoming call event raised.
2 Likes

Thx @ Sprigo now it works with calls.
is there a command for sms too?

You shouldn’t need any additional AT command for SMS - Just add an event handler to your code.

Hi thx for replay. i used the handler you see in my code above. but dont fire if a sms gets in. have some problems :’( if i connect to my gprs network i get an ip and the connection is fine. but thats all. device dont do any other events than.

What happens if you issue the following after the GSM has registered on the network?



You will need to have an event handler for the SMS list like this.


```cs
        
void cellularRadio_SmsListRequested(CellularRadio sender, ArrayList smsList)
        {
            if (smsList != null)
            {
                foreach (CellularRadio.Sms message in smsList)
                {
                    Debug.Print("");
                    Debug.Print("----------------------------------------------------------------------------------------------");
                    Debug.Print("NEW SMS");
                    Debug.Print("FROM: " + message.TelephoneNumber);
                    Debug.Print("MSG: " + message.TextMessage);
                    Debug.Print("WHEN: " + message.Timestamp.ToString());
                    Debug.Print("STATUS: " + message.Status.ToString());
                    Debug.Print("POS:" + message.Index.ToString());
                    Debug.Print("----------------------------------------------------------------------------------------------");
                    Debug.Print("");
                }
            }
        }

Get this error message after calling the sms list:

  #### Exception System.ArgumentOutOfRangeException - CLR_E_OUT_OF_RANGE (5) ####
    #### Message: 
    #### System.String::Substring [IP: 0000] ####
    #### Gadgeteer.Modules.GHIElectronics.CellularRadio::DoWork [IP: 0669] ####
A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll

There appears to be a bug in the 4.3 version. Grab a copy of the source code from https://bitbucket.org/ghi_elect/gadgeteer/src/2567b2403077bdc7235f3697308d0f8966f6c6de/Modules/GHIElectronics/CellularRadio/?at=master

and make the following changes.

At line 1103 change


to

```cs]this.OnSmsReceived(this, sms);[/code


Then at line 1230 move

```cs] response = response.Substring(last); [/code

to the bottom of the do while loop (between lines 1286 & 1287.

In addition to those changes you will need to add the following line to your initialisation code for the GSM


```cs]cellularRadio.SendATCommand("AT+CSDH=0");[/code
1 Like