Leer Gps

Postby Biel EA6DD » Tue Feb 05, 2008 10:58 am

En la clase hay que rectificar los calculos de coordenadas, las conversiones de latitud y longitud a decimal para coordenadas Sur y Oeste son erroneas.
Las lineas correctas son :


Code: Select all  Expand view  RUN
   // calculamos latitud y longitud en decimal
   // es la que utiliza Google Maps
   nGrados  := Val(SubStr( ::cLat, 1, 2) )
   nMinutos := Val(SubStr( ::cLat, 3, 7) ) /60
   ::nLat   := (nGrados + nMinutos) * IIF( ::cNS ="S", -1, 1 )

   // longitud
   nGrados   := Val(SubStr( ::cLong, 1, 3 ) )
   nMinutos  := Val(SubStr( ::cLong, 4, 7 ) ) /60
   ::nLong   := (nGrados + nMinutos) * IIF( ::cEw ="W", -1, 1 )


Solo faltaba unos parentesis, para los casos negativos.
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 jlcapel » Sat Apr 12, 2008 11:35 am

Hola a todos,

He compilado y enlazado el ejemplo del primer mensaje de este hilo y me dice que me faltan las siguientes funciones:

gps.obj : error LNK2001: unresolved external symbol HB_FUN_COMREAD
gps.obj : error LNK2001: unresolved external symbol HB_FUN_COMCLOSE
gps.obj : error LNK2001: unresolved external symbol HB_FUN_OPENCOM
gps.exe : fatal error LNK1120: 3 unresolved externals


¿Que me falta?
User avatar
jlcapel
 
Posts: 229
Joined: Wed Oct 12, 2005 5:32 pm
Location: Valencia - España

Postby Biel EA6DD » Mon Apr 14, 2008 6:29 am

http://fivetechsoft.com/forums/viewtopic.php?t=8361
En este otro hilo puedes encontrarlas, son de Salvador tambien.
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 Otto » Fri Aug 01, 2008 8:43 pm

Silvio, does the GPS program work on your HTC.
I yes, would you be so kind to share the code.
Thanks in advance
Otto
User avatar
Otto
 
Posts: 6364
Joined: Fri Oct 07, 2005 7:07 pm

Postby Biel EA6DD » Mon Aug 04, 2008 7:48 am

I'm usinng the tGps class with HTC touch (wm2006), it's runing ok.

Here you are the class and the connection functions to use GPS with your PDA.

http://www.ea6dd.com/ftp/bielsys/gps/tGps.prg
http://www.ea6dd.com/ftp/bielsys/gps/ppccom.prg
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 Silvio » Thu Aug 21, 2008 8:24 pm

Dear Biel ,
I must compile them and run or I must create another prg ?
thanks

when I compile it
tGps.c
tGps.prg(311) : warning C4244: 'initializing' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
tGps.prg(321) : warning C4244: '+=' : conversion from 'double ' to 'long ', possible loss of data
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Biel EA6DD » Fri Aug 22, 2008 10:15 am

Hi Silvio,
just add both prg to your project and compile.
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 Silvio » Fri Aug 22, 2008 2:12 pm

I compiled
I insert it on my tytn II with gps ( there is tomtom run ok into)
I not see nothing
Perhaps ... there is something wrong....
can see a snap shot of your htc ?
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Biel EA6DD » Fri Aug 22, 2008 6:36 pm

Show us your code, maybe we can help you.

You need to know the comm port of your GPS, and then connect to this port.
Code: Select all  Expand view  RUN
...
oGps   := Tgps():New( oWnd )
oGps:Conecta( nCom ) //Stablish connection to GPS
IF oGps:Connect()
    ?oGps:cDate, oGps:cLat
ENDIF
oGps:Desconecta()

If connection stablished ok, then you can show to screen the DATAs from oGps (cDate,cLat,cLong, and many more) . This values change every 1500 ms (defined in the tGps class READINTERVAL)
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 Silvio » Sun Aug 24, 2008 3:43 pm

>You need to know the comm port of your GPS, and then connect to this port.
How I can connect the com port

Mine is com4

Errors
Code: Select all  Expand view  RUN
Progetto: TestGPS, Ambiente: FWPPC:
[1]:Harbour.Exe test.prg  /m /n /w2 /es /iC:\work\FWPPC\INCLUDE /ic:\work\fwppc\include;C:\Work\HARBOU~1\include /oObj\test.c
Harbour devel build 1.1-1 Intl.
Copyright 1999-2007, http://www.harbour-project.org/
Compiling 'test.prg'...
test.prg(12) Warning W0001  Ambiguous reference: 'NCOM'
Lines 1734, Functions/Procedures 1
Generating C source output to 'Obj\test.c'... Done.
[1]:clarm.Exe -W3 -c /DARM /DUNICODE /IC:\work\FWPPC\INCLUDE -IC:\Work\HARBOU~1\Include /IC:\Work\Vce\Include\ARM /Fotest.Obj test.c
Microsoft (R) C/C++ Optimizing Compiler Version 12.20.9615 for ARM
Copyright (C) Microsoft Corp 1984-2002. All rights reserved.

test.c
[1]:Harbour.Exe tGps.prg  /m /n /w2 /es /iC:\work\FWPPC\INCLUDE /ic:\work\fwppc\include;C:\Work\HARBOU~1\include /oObj\tGps.c
Harbour devel build 1.1-1 Intl.
Copyright 1999-2007, http://www.harbour-project.org/
Compiling 'tGps.prg'...
tGps.prg(202) Warning W0001  Ambiguous reference: 'CLOC'
tGps.prg(213) Warning W0003  Variable: 'NLAT' declared but not used in function: 'TGPS_GPGGA(177)'
tGps.prg(213) Warning W0003  Variable: 'NLON' declared but not used in function: 'TGPS_GPGGA(177)'
tGps.prg(300) Warning W0001  Ambiguous reference: 'C6'
tGps.prg(301) Warning W0001  Ambiguous reference: 'C6'
Lines 2018, Functions/Procedures 13
Generating C source output to 'Obj\tGps.c'... Done.
[1]:clarm.Exe -W3 -c /DARM /DUNICODE /IC:\work\FWPPC\INCLUDE -IC:\Work\HARBOU~1\Include /IC:\Work\Vce\Include\ARM /FotGps.Obj tGps.c
Microsoft (R) C/C++ Optimizing Compiler Version 12.20.9615 for ARM
Copyright (C) Microsoft Corp 1984-2002. All rights reserved.

tGps.c
tGps.prg(311) : warning C4244: 'initializing' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
tGps.prg(321) : warning C4244: '+=' : conversion from 'double ' to 'long ', possible loss of data
[1]:Harbour.Exe ppccom.prg  /m /n /w2 /es /iC:\work\FWPPC\INCLUDE /ic:\work\fwppc\include;C:\Work\HARBOU~1\include /oObj\ppccom.c
Harbour devel build 1.1-1 Intl.
Copyright 1999-2007, http://www.harbour-project.org/
Compiling 'ppccom.prg'...
Lines 1869, Functions/Procedures 4
Generating C source output to 'Obj\ppccom.c'... Done.
[1]:clarm.Exe -W3 -c /DARM /DUNICODE /IC:\work\FWPPC\INCLUDE -IC:\Work\HARBOU~1\Include /IC:\Work\Vce\Include\ARM /Foppccom.Obj ppccom.c
Microsoft (R) C/C++ Optimizing Compiler Version 12.20.9615 for ARM
Copyright (C) Microsoft Corp 1984-2002. All rights reserved.

ppccom.c
[1]:Link.Exe @TestGPS.vcl /nologo /SUBSYSTEM:WINDOWSCE,4.20 /MACHINE:ARM
   Creating library C:\work\FWPPC\SAMPLES\gps\TestGPS.lib and object C:\work\FWPPC\SAMPLES\gps\TestGPS.exp
Sto caricando C:\work\FWPPC\SAMPLES\gps\TestGPS.Exe
Sharing or network error (access denied)





MY test.prg

Code: Select all  Expand view  RUN
#include "FWCE.ch"


function Main()

  local oWnd, oGps



oGps   := Tgps():New( oWnd )

oGps:Conecta( nCom ) //Stablish connection to GPS

IF oGps:Connect()

*  ? oGps:cDate, oGps:cLat , oGps:cLong , oGps:cSpeed ,cAlt


       DEFINE WINDOW oWnd


         @ 1, 1 SAY "Date:"+oGps:cDate    SIZE 70, 20
         @ 2, 1 SAY "Lat.:"+oGps:cLat     SIZE 70, 20
         @ 3, 1 SAY "Long.:"+oGps:cLong   SIZE 70, 20
         @ 4, 1 SAY "Speed:"+oGps:cSpeed  SIZE 70, 20
         @ 5, 1 SAY "Alt:"+ oGps:cAlt     SIZE 70, 20
         @ 6, 1 SAY "Sats:"+ oGps:cSats    SIZE 70, 20
         @ 7, 1 SAY "N/S:" + oGps:cNS    SIZE 70, 20
         @ 8, 1 SAY "E/W:"+  oGps:cEW      SIZE 70, 20





        ACTIVATE WINDOW oWnd






ENDIF
oGps:Desconecta()

retur nil
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Biel EA6DD » Tue Aug 26, 2008 11:01 am

Try this code:
Code: Select all  Expand view  RUN
#include "Fwce.ch"
Function Main()
    LOCAL oWnd, oGps, nCom, oTimer,cCom:='COM4'

    DEFINE WINDOW oWnd TITLE "Sample GPS"

    oGps   := Tgps():New()
    //oGps:Log(.T.)

    @ 5,    5 SAY "Fecha"    SIZE 53, 20 RIGHT PIXEL
    @ 5,   60 GET oGps:cDate SIZE 80, 20 WHEN .f. PIXEL OF oWnd UPDATE
    @ 5,  145 GET oGps:cTime SIZE 60, 20 WHEN .f. PIXEL OF oWnd UPDATE

    @ 27,   5 SAY "Lat."    SIZE 53,20 RIGHT PIXEL
    @ 27,  60 GET oGps:cLat SIZE 80,20 WHEN .f. PIXEL OF oWnd UPDATE
    @ 27, 145 GET oGps:cNS  SIZE 20,20 WHEN .f. PIXEL OF oWnd UPDATE

    @ 50,   5 SAY "Long."    SIZE 53,20 RIGHT PIXEL
    @ 50,  60 GET oGps:cLong SIZE 80,20 WHEN .f. PIXEL OF oWnd UPDATE
    @ 50, 145 GET oGps:cEW   SIZE 20,20 WHEN .f. PIXEL OF oWnd UPDATE

    @ 72,  5 SAY "Lat dec."  SIZE 50,20 RIGHT PIXEL
    @ 72, 60 GET oGps:nLat   SIZE 80,20 PICTURE "999.999999" RIGHT;
    WHEN .f. PIXEL OF oWnd UPDATE

    @ 94,  5 SAY "Lon dec."  SIZE 50,20 RIGHT PIXEL
    @ 94, 60 GET oGps:nLong  SIZE 80,20 PICTURE "999.999999" RIGHT;
    WHEN .f. PIXEL OF oWnd UPDATE

    @ 118,  5 SAY "Fix"     SIZE 50,20 RIGHT PIXEL
    @ 116, 60 GET oGps:cFix SIZE 30,20 WHEN .f. PIXEL OF oWnd UPDATE

    @ 118,  80 SAY "Sats"     SIZE 50,20 RIGHT PIXEL
    @ 116, 130 GET oGps:cSats SIZE 30,20 WHEN .f. PIXEL OF oWnd UPDATE

    @ 140,  5 SAY "Alt."    SIZE 50,20 RIGHT PIXEL
    @ 138, 60 GET oGps:cAlt SIZE 60,20 WHEN .f. PIXEL OF oWnd UPDATE

    @ 162,  5 SAY "Veloc."    SIZE 50,20 RIGHT PIXEL
    @ 160, 60 GET oGps:cSpeed SIZE 60,20 WHEN .f. PIXEL OF oWnd UPDATE

    @ 184,  5 SAY "Locator."   SIZE 50,20 RIGHT PIXEL
    @ 182, 60 GET oGps:cLoc    SIZE 60,20 WHEN .f. PIXEL OF oWnd UPDATE

    @ 206,  5 SAY 'Com Gps'    SIZE 50,20 RIGHT PIXEL OF oWnd
    @ 204, 60 COMBOBOX cCom ITEMS {"COM1","COM2","COM3","COM4","COM5","COM6","COM7","COM8","COM9"} SIZE 50,20 PIXEL OF oWnd WHEN !oGps:lGps

    @ 244, 5 BUTTON "CONECTAR" SIZE 95, 25 PIXEL;
    ACTION ( oGps:Conecta( val(SubStr(cCom,4,1)) ), oTimer:Activate()) WHEN !oGps:Connect() UPDATE

     @ 244, 110 BUTTON "DESCONECTAR" SIZE 95, 25 PIXEL;
    ACTION ( oTimer:Deactivate(), oGps:Desconecta(),oWnd:END() ) WHEN oGps:Connect() UPDATE

    ACTIVATE WINDOW oWnd;
             ON INIT ( oTimer := Ttimer():New( 1000, { || oWnd:Update() }, oWnd ));
             VALID ( oTimer:End(), oGps:end(), .t.)
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

Previous

Return to FiveWin para Pocket PC

Who is online

Users browsing this forum: No registered users and 3 guests

cron