Цитата(MikelSV @ Mar 27 2008, 12:04)

По незнанию ляпнул глупость. оказывается у меня ed.
Покопался, разобрался.
Вроде все понял, вот только:
ed_DialupConnectionStart возвращает -10, не введен pin. и без него должно работать.
ed_SocketTCPStart возвращает -11, сеть не активирована, правильно ли активировать через ed_DialupConnectionStart?
в f_gprsAttachResponseHndlr возвращается - 148 Неустановленная ошибка GPRS
Если послать AT+CGDATA=1 через терминал, модем переходит в режим передачи данных, тоесть вроде как интернет есть.
Ага, в gprsAttachResponseHndlr пришло ОК.
ed_DialupConnectionStart возвращает: -14 - ED_ERR_NETWORK_KO - WISMO module is not attached to the network. Network was lost before the requested end of connection.
Что он хочет от сети?
Переходи лучше на WIP, edLib'у приходит конец вместе с q24 q25.
У меня с edLib'ом сделано приблизительно так:
1.
adl_simSubscribe(f_SIM_hndlr, Settings.pin_code);
void f_SIM_hndlr(u8 event){
switch(event){
[...]
//после прихода этого события можно работать
case ADL_SIM_EVENT_FULL_INIT://initialization is done
f_dbgmsg("-f_SIM_hndlr- ADL_SIM_EVENT_FULL_INIT SIM card is ready");
f_smsInit();
SIMflg=TRUE;
break;
[...]
}
//ясное дело надо еще дождаться чтоб GSM поднялся
2.
bool f_gprsAttach(){
if(GPRSattached) return(TRUE);
if(!SIMflg) return(TRUE);
if(!GSMflg) return(TRUE);
[...]
adl_atCmdCreate("at+cgatt=1", FALSE, (adl_atRspHandler_t)f_gprsAttachResponseHndlr,"*",NULL);//GPRS attach AT command
[...]
}
void f_gprsAttachResponseHndlr(adl_atResponse_t* resp){
[...]
strncpy(strbuf, resp->StrData, STRBUFLEN);
[...]
if( strncmp(strbuf, "OK", strlen("OK"))==0) {
f_dbgmsg("-f_gprsAttachResponseHndlr- GPRS attached");
cgattOK=TRUE;
}
[...]
if(strncmp(strbuf,"+CME ERROR: 148",strlen("+CME ERROR: 148"))==0){
f_errmsgf("-%s- +CME ERROR: 148 Unspecified GPRS error, f_gprsEdStop()",__FUNCTION__);
f_gprsEdStop();
}
//Wavecom FAQ
//Error +CME ERROR: 148 can occur in the following cases:
//1. When the GPRS services is not enabled on the SIM card.
//2. When the module is in a roaming and the currently selected PLMN does not support GPRS services for the HPLMN of the module.
//3. When the received signal strength by the module is very weak. In this case, the module is not able to access GPRS network either due to too much buffering of packets (which is leading to timeout) or due to too much errors.
[...]
}
3.
bool f_gprsEdInit(){
[...]
vInitRes = ed_Init();
if(vInitRes == ED_ENTRY_LEVEL_TCP_IP || vInitRes == ED_HIGH_LEVEL_INTERNET) {
vRes = TRUE;
f_dbgmsg("-f_gprsEdInit- GPRS init on success");
}
else{
f_errmsg("-f_gprsEdInit- GPRS not init");
f_errmsgf("-f_gprsEdInit- %s",f_gprsEdErr2str(vInitRes));
}
[...]
}
4.
ed_gprsSetupParams_t vtmpParams;
[...]
vtmpParams.Cid = 1;
vtmpParams.Mode = 1;
strncpy(vtmpParams.ApnServ, apn, GPRS_STRMAXSIZE);//GPRS_STRMAXSIZE edLib
strncpy(vtmpParams.ApnUn, uin, GPRS_AUTHSTRMAXSIZE);
strncpy(vtmpParams.ApnPw, pwd, GPRS_AUTHSTRMAXSIZE);
tmpRes = ed_GprsSetConfig(&vtmpParams);
if(tmpRes == 0){
vRes = TRUE;
f_dbgmsg("-f_gprsEdConfig- Set GPRS settings on success");
}
else{
f_errmsg("-f_gprsEdConfig- Set GPRS settings error");
f_errmsgf("-f_gprsEdConfig- %s",f_gprsEdErr2str(tmpRes));
}
5.
bool f_gprsEdStart(){
[...]
tmpRes = ed_DialupConnectionStart(f_gprsEdStartResponseHndlr);
if(tmpRes == 0) {
f_dbgmsg("-f_GPRS_Start- Connection start on success");
vRes = TRUE;
}
else{
f_errmsg("-f_GPRS_Start- Connection start unsuccess");
f_errmsgf("-f_GPRS_Start- %s",f_gprsEdErr2str(tmpRes));
vRes = FALSE;
}
[...]
}
void f_gprsEdStartResponseHndlr(s32 RspCode, TeDHandle handle){
f_dbgmsgf("-%s- handle: %d", __FUNCTION__, handle);
if(RspCode == ED_OK_GPRS_SESSION_SET){
f_dbgmsgf("-%s- GPRS session is activated", __FUNCTION__);
}
else{
if(RspCode<0){
f_errmsgf("-%s- %s",__FUNCTION__, f_gprsEdErr2str(RspCode));
GPRSattached=FALSE;
cgattOK=FALSE;
}
}
}
6.
void f_gprsStateTmrHndlr(u8 tmrID){//таймер следит за состоянием GPRS
ed_dialupGenInfos_t tmpInfo;
[...]
if(!GPRSattached){
}
//проверяем дружбу edLib с GPRS
ed_DialupGetGeneralInformations(&tmpInfo);
gprsState = tmpInfo.State;
if(gprsState ==ED_ERR_NOT_INIT){
f_gprsEdInit();
}
if(gprsState ==ED_IDLE){
if(cgattOK) f_gprsEdStart();
}
if(gprsState==ED_CONNECTED){
if(!GPRSattached){
//такое бывает если GPRS работал и оборвался
f_gprsAttach();
return;
}
}
[...]
}
ну с сокетом все б.м. понятно...