View Single Post
Old 29-Mar-2007, 01:47 AM   #1 (permalink)
Iphone
Fixed Error!
 
Iphone's Avatar

Posts: 4,202
Join Date: Mar 2007
Rep Power: 6 Iphone is on a distinguished road

IM:
Default How to Connect To Internet Through GPRS

i am working on Wince and i am using Embeded tools (EVC++) for application programming,
i am using a wince device which has an in built GPRS modem.

now i want to connect to the internet over GPRS ,for this i have downloaded the AT command set for my

wince device.and i have wriiten an application which opens the comport and writes the AT commands and

reads back response from the port.

i am succesful to some extent ,

For example
in the below code, all the commands return proper response ,but how do i develope a PPP link after i get 'Connect' as response from Server.


BOOL bHangup = FALSE;
CString strInit;
CString res;

strInit = "AT";
port.Send(strInit);
Sleep(1000);


strInit ="AT+CGATT?";
res=OnSendAndWait(strInit);
AfxMessageBox(_T("AT+CGATT? Response = ") +res);

strInit = "AT+CGATT=1\r"; //GPRS
res=OnSendAndWait(strInit);
AfxMessageBox(res);


strInit = "AT+CGDCONT=1,\"IP\",\"airtelgprs.com\"";
res=OnSendAndWait(strInit);
AfxMessageBox(_T("AT+CGDCONT=1 Response = ") +res);

strInit = "AT+IPR=57600";
res=OnSendAndWait(strInit);
AfxMessageBox(_T("AT+IPR=57600") + res);



strInit = "ATS0=0";
res=OnSendAndWait(strInit);
AfxMessageBox(_T("ATS0=0") + res);

strInit = "AT+IFC=2,2";
res=OnSendAndWait(strInit);
AfxMessageBox(_T("AT+IFC=2,2") + res);




strInit = "ATD*99***1#";
res=OnSendAndWait(strInit);
AfxMessageBox(_T("ATD*99***1 Response = ") + res);


the above AT command returns response as, 'CONNECT' ,
now i know that i have to send something(LCP ,CHAP or something else)
back to the server and build a PPP link,


can anyone help me in writing this code,
how to send a LCP packet to the server??
what would be its response??
what should i send back in order to establist the Link?
Iphone is offline   Reply With Quote