ED_ERR_PARAM_BAD_VALUE error

With this code the function ed_GprsSetConfig return the error ED_ERR_PARAM_BAD_VALUE. WHY? What’s wrong?

gprs_params=gprs();
	set_gprs=ed_GprsSetConfig(&gprs_params);


ed_gprsSetupParams_t gprs (void)
{
	gprs_es.Mode=1;
	gprs_es.ApnServ[GPRS_STRMAXSIZE+1]="airetlnet.es";
	gprs_es.ApnUn[GPRS_AUTHSTRMAXSIZE+1]="vodafone";
	gprs_es.ApnPw[GPRS_AUTHSTRMAXSIZE+1]="vodafone";

	return gprs_es;
}

Hi konker,

Did you check with the debugger if the gprs_params have the values set correctly after the call of gprs(); ?

I don’t think the function can work this way, and since you are modifying a global variable in the gprs() function you might as well not use a return value at all but the following

ed_GprsSetConfig(&gprs_es);

Best Regards,
Jan

Thank you jan, but I have the same problem.
I follow next steps to send an email:

-ed_Init()
-ed_GprsSetConfig()
-ed_DialupConnectionStart()
-ed_SMTPSetConfig()
-ed_EmailSetConfig()
-ed_SendMail()

How can I wait the enough time between two steps for the modem can do the functions?

Is it correct? or I have to use at commands like “at+cgatt=1”?
The function ed_Init() does the same function that at+cgatt=1???
How can I use at+cgatt command in a c++ aplication??

Thank you very much.

You did set the PIN, right?

You can listen to +WIND, +CREG, +CGREG unsolicited messages… Also some functions will inform you by calling callback functions you supply about the current status.

I am not sure about the e-mail part, but you will need to send the at+cgatt=1 - ed_Init() will not do it. Without this you will not be attached to the GPRS network, and therefore you won’t be able to use TCP/IP of course.

Using at+cgatt=1 is tricky. I had problems with that… So I prefer to use AT+WGPRS=0,0. You need to send that command only once, after Reset the ME will attach automatically to GPRS network and you don’t need to send AT+CGATT=1. Works perfectly for me, very convenient!

To send AT commands use the function adl_atCmdCreate().

Also, in the thread “Sendind DATA through GPRS” (http://wavecom.profileo.com/modules/movie/scenes/forums/viewtopic.php?t=149&postdays=0&postorder=asc&highlight=wgprs&start=0) there is a lot of basic information about GPRS and problems related to that. The thread is quite long and not everything applies to you, but I think it’s worth taking a look…

Best Regards,
Jan

Thak you very much for your help, jan.

I don’t set PIN because my SIM hasn’t PIN. But the function ed_dialupconnectionstart return me an error like: ED_ERR_PIN_NOT ENTERED. I may put the PIN anyway?

I’m trying to understand the function adl_AtCmdCreate() but I think I don’t undestand it.
Is it correct?:

adlAtCmdCreate("AT#WGPRS 0,0",TRUE,(adl_atResponsHandle_t)RspHdl,OK,NULL)


void RspHdl (adl_atResponsHandle_t *response)
{
        if (response==OK){do somthing}
        if (response==NULL){do somthing}
}

Thank you!

Actually, I don’t know. I have never tried it with a SIM that does not require a PIN…

not quite OK…

should be something like:

bool wgprs_response_handler ( adl_atResponse_t *pars) 
{
  // use string compare functions here...
  // the response data is in  pars->StrData  !
}

[...]

adl_atCmdCreate( "at+wgprs=0,0",FALSE,(adl_atRspHandler_t) wgprs_response_handler,"*",NULL);

Best Regards,
Jan

Thank you very much, jan. I think a have to improve my c knowledge…

I have another question, I hope the last question.

My problem is that when I execute the program the first thing (after de ed_Init()) is call simSubscribe.

adl_simSubscribe((adl_simHdlr_f)SimHandler,"2587");


void SimHandler (u8 Event)
{

	switch ( Event )
	{
		case ADL_SIM_EVENT_PIN_OK :
			{	TRACE (( 1, "*****ADL_SIM_EVENT_PIN_OK" ));}
		break;
		case ADL_SIM_EVENT_REMOVED :
			{TRACE (( 1, "******ADL_SIM_EVENT_REMOVED" ));}
		break;
		case ADL_SIM_EVENT_INSERTED :
			{TRACE (( 1, "****ADL_SIM_EVENT_INSERTED" ));}
		break;
		case ADL_SIM_EVENT_FULL_INIT :
			{TRACE (( 1, "****ADL_SIM_EVENT_FULL_INIT" ));}
		break;
		case ADL_SIM_EVENT_PIN_ERROR :
			{TRACE (( 1, "****ADL_SIM_EVENT_PIN_ERROR" ));}
		break;
		case ADL_SIM_EVENT_PIN_NO_ATTEMPT :
			{TRACE (( 1, "****ADL_SIM_EVENT_PIN_NO_ATTEMPT" ));}
		break;
		case ADL_SIM_EVENT_PIN_WAIT :
			{TRACE (( 1, "****ADL_SIM_EVENT_PIN_WAIT" ));}
		break;
		default :
			{	TRACE (( 1, "****raro PIN" ));}
		break;
	}

}

It work fine.
After that I do:

adl_atCmdCreate( "at+wgprs=0,0",FALSE,(adl_atRspHandler_t)wgprs_response_handler,"*",NULL);


bool wgprs_response_handler ( adl_atResponse_t *pars) 
{ 
  if (pars->StrData==OK)
  {TRACE ((1,"GPRS connectat"));}
  else {TRACE ((1,"GPRS NO CONNECTAT"));}
}

The problem is that I don’t know how to do that adl_atCmdCreate waits the end of adl_simSubscribe.
adl_atCmdCreate start before recieve ADL_SIM_EVENT_FULL_INIT from adl_simSubscribe.

Moreover I have

warning C4716: 'wgprs_response_handler' : must return a value

that I haven’t know if it’s important.

If you can help me another time…

Thank you very much another time!

Hi konker,

To compare strings, you could use for example the wm_strnicmp() function. “==” will not work on strings, even if there is no error message…

The following code will compare if the string starts with “+CREG:” (after leaving out 2 bytes at the beginning of string)

if ( !wm_strnicmp(paras->StrData+2, "+CREG:",6) ) {
  }

You can also check for OK like in the code below… And you can always return FALSE at the end of the Handler function. Please see the Open AT ADL User Guide for information what that means…

bool some_handler( adl_atResponse_t *paras )
{
   switch ( paras->RspID )
   {
      case ADL_STR_OK:
      {
         // result was OK
         // do whatever you would like to do now...
         break;
      }
      default:
      {
         // you can do something else here....
         //DebugPrint( "unexpected RspID (%d)", paras->RspID );
      }
   }
   return FALSE;
}

You can put code into the case branch for ADL_SIM_EVENT_FULL_INIT to ensure that these commands are executed only after the SIM has been completely initiated.

Best Regards,
Jan

Thank you very much, jan. Another time, thank you very much.

I know control the wismo a little now.

But I have still a problem :frowning: .

The function ed_Init must be called in the adl_main of the client application. But, if I want initialize PIN using ADL function adl_simSubscribe, ed_Init must be called AFTER adl_simSubscribe.

What does meam it? Can I call adl_simSubscribe and after ed_Init without wait ADL_SIM_EVENT_FULL_INIT, or once I have recived ADL_SIM_EVENT_FULL_INIT I must call the function ed_Init???

If I have to wait the ADL_SIM_EVENT_FULL_INIT response from adl_simSubscribe I have a problem…, how can I wait this in the adl_main to execute ed_Init?

I ask this because I another functions returns me errors and I don’t know if it is the problem.

Thank you very much.