Dudas Ejemplo GPRS

Dudas Ejemplo GPRS

Postby Arturo Lopesoria » Fri Feb 08, 2008 3:59 pm

ANTONIO, ELIAS TORRES, AMIGOS DEL FORO:

El 25 Oct 2007 Elias Torres publica en este foro un ejemplo para abrir de manera automatica el servicio de GPRS. Tengo 2 preguntas:

1.- Al compilar me manda error al no encontrar la referencia a CONNMGR_STATUS_CONNECTED. Me falta algún include? Cuál?

2.- Con el objeto de comunicarse vía GPRS por medio de FTP yo estoy usando primeramente InternetOpen, después InternetConnect, y a partir de ahí utilizo funciones para FTP. La pregunta concreta es: DEBO UTILIZAR GPRSCONNECT ANTES QUE INTERNETCONNECT?

GRACIAS. SALUDOS!
Arturo LS
User avatar
Arturo Lopesoria
 
Posts: 94
Joined: Fri Aug 10, 2007 1:47 am
Location: Mexico DF

Postby Biel EA6DD » Fri Feb 08, 2008 9:46 pm

Te debe faltar el include de "connmgr.h"

Code: Select all  Expand view
#pragma BEGINDUMP

#include "windows.h"
#include "wininet.h"
#include "hbapi.h"
#include "initguid.h"
#include "connmgr.h"
...


GprsConnect Debes utilizarlo antes de InternetOpen.
Ejemplo de funcion que conecta via GPRS, solo testea si pued abrir la conexion, y devuelve un mensaje.

Code: Select all  Expand view
//------------------
FUNCTION GprsTst()
//------------------
   LOCAL hInternet, hConnect:=0,nVeces:=0, hGprs
   CursorWait()
   hGprs:=GprsConnect()
   hInternet:= InternetOpen( "HnasMbl", INTERNET_OPEN_TYPE_DIRECT, 0, 0, 0 )
   IF !hInternet==0
      WHILE hConnect==0 .AND. nVeces<3
         hConnect:=InternetConnect( hInternet, Trim(Cfg->Ip), Cfg->Puerto, Trim(Cfg->Usr), Trim(Cfg->Psw), INTERNET_SERVICE_FTP, 0, 0 )
         nVeces++
      END
      IF hConnect==0
         MsgStop('Error al conectar FTP via GPRS')
      ELSE
         MsgInfo('GPRS  O K!','Chequeo conexión')
      ENDIF
      InternetCloseHandle( hConnect )
      InternetCloseHandle( hInternet )
   ELSE
      MsgStop('GPRS no disponible')
   ENDIF
   GprsRelease(hGprs)
   CursorWE()
RETURN NIL
Saludos desde Mallorca
Biel Maimó
http://bielsys.blogspot.com/
User avatar
Biel EA6DD
 
Posts: 682
Joined: Tue Feb 14, 2006 9:48 am
Location: Mallorca

Postby Arturo Lopesoria » Sat Feb 09, 2008 3:27 am

Biel. Muchas Gracias, esto se ve mucho mas simple y sencillo de lo que ahora estoy haciendo, lo probare.
Saludos desde Mexico!



Biel EA6DD wrote:Te debe faltar el include de "connmgr.h"

Code: Select all  Expand view
#pragma BEGINDUMP

#include "windows.h"
#include "wininet.h"
#include "hbapi.h"
#include "initguid.h"
#include "connmgr.h"
...


GprsConnect Debes utilizarlo antes de InternetOpen.
Ejemplo de funcion que conecta via GPRS, solo testea si pued abrir la conexion, y devuelve un mensaje.

Code: Select all  Expand view
//------------------
FUNCTION GprsTst()
//------------------
   LOCAL hInternet, hConnect:=0,nVeces:=0, hGprs
   CursorWait()
   hGprs:=GprsConnect()
   hInternet:= InternetOpen( "HnasMbl", INTERNET_OPEN_TYPE_DIRECT, 0, 0, 0 )
   IF !hInternet==0
      WHILE hConnect==0 .AND. nVeces<3
         hConnect:=InternetConnect( hInternet, Trim(Cfg->Ip), Cfg->Puerto, Trim(Cfg->Usr), Trim(Cfg->Psw), INTERNET_SERVICE_FTP, 0, 0 )
         nVeces++
      END
      IF hConnect==0
         MsgStop('Error al conectar FTP via GPRS')
      ELSE
         MsgInfo('GPRS  O K!','Chequeo conexión')
      ENDIF
      InternetCloseHandle( hConnect )
      InternetCloseHandle( hInternet )
   ELSE
      MsgStop('GPRS no disponible')
   ENDIF
   GprsRelease(hGprs)
   CursorWE()
RETURN NIL
Arturo LS
User avatar
Arturo Lopesoria
 
Posts: 94
Joined: Fri Aug 10, 2007 1:47 am
Location: Mexico DF


Return to FiveWin para Pocket PC

Who is online

Users browsing this forum: No registered users and 38 guests