how to connect to GPRS and send data?
-
hi all, i am writing an application which needs to connect to the gprs network and send data(through web service). i have written the application in evc++, using AT commands ,i am able to initlialize ,attach gprs and dial(ATD*99***1#) and i get "CONNECT" as response. but after this stage how do i browse the internet or call my web service?? function which connects and attaches GPRS function code, void CTestGPRSCommandsDlg::OnModemOn() { BOOL bHangup = FALSE; CString strInit; CString res; //to hang up any ongoing calls while(!bHangup) { strInit = "+++"; Sleep(1000); port.Send(strInit); strInit = "ATH0\r"; Sleep(1000); res=OnSendAndWait(strInit); if(res=="OK") { bHangup=TRUE; } } strInit = "AT+CGATT=1\r"; //GPRS res=OnSendAndWait(strInit); AfxMessageBox(res); if(res!="OK") { AfxMessageBox(_T("GPRS Not Attached")); return ; } else { AfxMessageBox(_T("yahooooo GPRS Attached")); } strInit = "AT+CGDCONT=1,IP"; res=OnSendAndWait(strInit); //AfxMessageBox(_T("AT+CGDCONT=1 Response = ") +res); if(res!="OK") { AfxMessageBox(_T("Modem Not Initialized")); return; } strInit = "AT+CGDCONT=2,IP,\"airtelgprs.com\" ,0.0.0.0"; res=OnSendAndWait(strInit); //AfxMessageBox(_T("AT+CGDCONT=2 Response = ") + res); if(res!="OK") { AfxMessageBox(_T("Modem Not Initialized")); return; } strInit = "ATD*99***1#"; res=OnSendAndWait(strInit); //AfxMessageBox(_T("ATD*99***1 Response = ") +res); if(res!="CONNECT") { AfxMessageBox(_T("Modem Not Initialized")); return; } AfxMessageBox(_T("Connected")); } my platform: EVC++ 3.0 pocketpc 2002 Device : intermec 760 with inbuilt GPRS modem.
-
hi all, i am writing an application which needs to connect to the gprs network and send data(through web service). i have written the application in evc++, using AT commands ,i am able to initlialize ,attach gprs and dial(ATD*99***1#) and i get "CONNECT" as response. but after this stage how do i browse the internet or call my web service?? function which connects and attaches GPRS function code, void CTestGPRSCommandsDlg::OnModemOn() { BOOL bHangup = FALSE; CString strInit; CString res; //to hang up any ongoing calls while(!bHangup) { strInit = "+++"; Sleep(1000); port.Send(strInit); strInit = "ATH0\r"; Sleep(1000); res=OnSendAndWait(strInit); if(res=="OK") { bHangup=TRUE; } } strInit = "AT+CGATT=1\r"; //GPRS res=OnSendAndWait(strInit); AfxMessageBox(res); if(res!="OK") { AfxMessageBox(_T("GPRS Not Attached")); return ; } else { AfxMessageBox(_T("yahooooo GPRS Attached")); } strInit = "AT+CGDCONT=1,IP"; res=OnSendAndWait(strInit); //AfxMessageBox(_T("AT+CGDCONT=1 Response = ") +res); if(res!="OK") { AfxMessageBox(_T("Modem Not Initialized")); return; } strInit = "AT+CGDCONT=2,IP,\"airtelgprs.com\" ,0.0.0.0"; res=OnSendAndWait(strInit); //AfxMessageBox(_T("AT+CGDCONT=2 Response = ") + res); if(res!="OK") { AfxMessageBox(_T("Modem Not Initialized")); return; } strInit = "ATD*99***1#"; res=OnSendAndWait(strInit); //AfxMessageBox(_T("ATD*99***1 Response = ") +res); if(res!="CONNECT") { AfxMessageBox(_T("Modem Not Initialized")); return; } AfxMessageBox(_T("Connected")); } my platform: EVC++ 3.0 pocketpc 2002 Device : intermec 760 with inbuilt GPRS modem.
R.Rajesh wrote: port.Send(strInit); This is too low-level. :eek: There are other options! ;) It is better for you to create a RAS connection and then use whatever protocol you need on top of the IP connection it will provide. If you want to be a bit more sophisticated, you can use the Connection Manager to arbitrate the connections for you (there is an MFC example in your PPC 2002 SDK). This way, you don't need to worry about the gory low-level details of making a connection. João Paulo