First FWPPC App - Help :-)
Posted: Wed Jan 07, 2009 1:45 pm
Hi Everybody,
I am working on my first FWPPC app
I have tested everything in FWH to make sure my code is good.
Then I changed the include from Fivewin.ch to FWCE.ch and build via the BuildCE.bat
I get the following errors:
Compiling...
Harbour 1.0.1dev Intl. (Rev. 9361)
Copyright (c) 1999-2008, http://www.harbour-project.org/
Compiling 'NN9560.prg' and generating preprocessed output to 'NN9560.ppo'...
Lines 1887, Functions/Procedures 4
Generating C source output to 'NN9560.c'... Done.
Microsoft (R) C/C++ Optimizing Compiler Version 12.20.9615 for ARM
Copyright (C) Microsoft Corp 1984-2002. All rights reserved.
NN9560.c
NN9560.obj : error LNK2001: unresolved external symbol HB_FUN_HEX2STR
NN9560.obj : error LNK2001: unresolved external symbol HB_FUN_STR2HEX
NN9560.obj : error LNK2001: unresolved external symbol HB_FUN_HEXTODEC
FiveCEC.lib(COMM.obj) : error LNK2019: unresolved external symbol BuildCommDCB r
eferenced in function HB_FUN_BUILDCOMMDCB
FiveCEC.lib(COMM.obj) : error LNK2019: unresolved external symbol GetOverlappedR
esult referenced in function listenThread
NN9560.exe : fatal error LNK1120: 5 unresolved externals
Linking errors *
I tried looking at the \fwppc\manual section but it looks like it is the same manual as FWH.
Can you point me in the right direction.
The code I am playing with is below (very rough … just testing a new device)
Thanks
Jeff
#include "FWCE.ch"
STATIC oMainWnd
Function Main()
Define window oMainWnd title "TEST NN9560"
Activate window oMainWnd on init Connect() VALID QUITAPP()
Return nil
Function Connect()
Local oFontTime, oFopntBig, oFontNorm, oFontMed, oFontSmall
PRIVATE cSat, cHR, cSatMin, cSatMax, cHRMin, cHRMax, lFirstRun := .t., cDCB, cDataread
PRIVATE oTimerWalk, oDlg1, oBtn1Stop, oSay1, oSay2
DEFINE FONT oFontTime NAME "ARIAL" SIZE 9, 18 BOLD
ACTIVATE FONT oFontTime
DEFINE FONT oFontBig NAME "ARIAL" SIZE 50, 75 BOLD
ACTIVATE FONT oFontBig
DEFINE FONT oFontNorm NAME "ARIAL" SIZE 15, 25 BOLD
ACTIVATE FONT oFontNorm
DEFINE FONT oFontMed NAME "ARIAL" SIZE 7, 14 BOLD
ACTIVATE FONT oFontMed
DEFINE FONT oFontSmall NAME "ARIAL" SIZE 5, 10 BOLD
ACTIVATE FONT oFontSmall
cSat := "Turn on oximeter"
cHR := "** ** "
cSatMin := "---"
cSatMax := "---"
cHRMin := "---"
cHRMax := "---"
DEFINE DIALOG oDlg1 FROM 5,0 TO 31, 45 TITLE "Test" COLOR RGB(0,0,0),RGB(230,225,172) STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION) of oMainWnd
@ 8,10 BUTTON oBtn1Stop PROMPT "ABORT" SIZE 50,25 of oDlg1 FONT oFontSmall Action (lLoop:=.f., oDlg1:End())
@ 5,1 say oSay1 VAR alltrim(cSat)+" sat " SIZE 360,50 FONT oFontMed of oDlg1 UPDATE COLOR RGB(0,0,0),RGB(230,225,172)
@ 5,21 say oSay2 VAR alltrim(cHr )+" hr " SIZE 360,50 FONT oFontMed of oDlg1 UPDATE COLOR RGB(0,0,0),RGB(230,225,172)
if lFirstrun
DEFINE TIMER oTimerWalk interval 500 ACTION CollectStart(oDlg1)
ACTIVATE TIMER oTimerWalk
endif
ACTIVATE DIALOG oDlg1 CENTER
RETURN NIL
Function CollectStart( oDlg1 )
if ! empty( oTimerWalk )
oTimerWalk:Deactivate()
endif
lFirstRun := .t.
WinExec("\EzSat\DLL\SetComm4.bat",0)
nComm:= OpenComm( "Com4", 1024, 128 )
Syswait(.01)
if ! BuildCommDcb( "COM4:9600,n,8,1", @cDcb )
lLoop := .f.
oDlg1:End()
RETURN NIL
endif
if ! SetCommState( nComm, cDcb )
lLoop := .f.
oDlg1:End()
RETURN NIL
endif
if FlushComm( nComm, 1 ) != 0
nError = GetCommError( nComm )
MsgInfo( "FlushComm Error: " + Str( nError ) )
endif
cDataread := space(1)
Do while Alltrim(STR(HexToDec( Str2Hex( cDataread )))) <> "6"
syswait(.1)
WRITECOMM( nComm, HEX2STR("027002020803"))
ReadComm( nComm , @cDataRead)
cSat = STR(HexToDec( Str2Hex( cDataread )))
oDlg1:Update()
Enddo
lLoop := .t.
DataRead := ""
lconnect := .f.
nData := 1
cData := ""
cPrevData := 0
use \ezsatbt\oxdata
go top
zap
do while lLoop = .t.
Memory(-1)
SysRefresh()
if ReadComm( nComm , @cDataRead) <> 0
oDlg1:Update()
nData := HexToDec( Str2Hex( cDataread ) )
if cData = "SAT"
OxData->SAT := STR(nData)
cData := "XXX"
cSat := ALLTRIM(STR(nData))
endif
if cData = "HR"
APPEND BLANK
OxData->HR := STR(nData)
cData := "SAT"
cHR := ALLTRIM(STR(nData))
endif
If nData >= 128
cData := "HR"
ENDIF
endif
SysWait(.01)
lLoop := lLoop
Memory(-1)
oDlg1:Update()
enddo
if FlushComm( nComm, 1 ) != 0
nError = GetCommError( nComm )
MsgInfo( "FlushComm Error: " + Str( nError ) )
endif
if ! CloseComm( nComm )
nError = GetCommError( nComm )
MsgInfo( "CloseComm Error: " + Str( nError ) )
endif
Return Nil
Function Quitapp()
quit
Return .t.
I am working on my first FWPPC app
I have tested everything in FWH to make sure my code is good.
Then I changed the include from Fivewin.ch to FWCE.ch and build via the BuildCE.bat
I get the following errors:
Compiling...
Harbour 1.0.1dev Intl. (Rev. 9361)
Copyright (c) 1999-2008, http://www.harbour-project.org/
Compiling 'NN9560.prg' and generating preprocessed output to 'NN9560.ppo'...
Lines 1887, Functions/Procedures 4
Generating C source output to 'NN9560.c'... Done.
Microsoft (R) C/C++ Optimizing Compiler Version 12.20.9615 for ARM
Copyright (C) Microsoft Corp 1984-2002. All rights reserved.
NN9560.c
NN9560.obj : error LNK2001: unresolved external symbol HB_FUN_HEX2STR
NN9560.obj : error LNK2001: unresolved external symbol HB_FUN_STR2HEX
NN9560.obj : error LNK2001: unresolved external symbol HB_FUN_HEXTODEC
FiveCEC.lib(COMM.obj) : error LNK2019: unresolved external symbol BuildCommDCB r
eferenced in function HB_FUN_BUILDCOMMDCB
FiveCEC.lib(COMM.obj) : error LNK2019: unresolved external symbol GetOverlappedR
esult referenced in function listenThread
NN9560.exe : fatal error LNK1120: 5 unresolved externals
Linking errors *
I tried looking at the \fwppc\manual section but it looks like it is the same manual as FWH.
Can you point me in the right direction.
The code I am playing with is below (very rough … just testing a new device)
Thanks
Jeff
#include "FWCE.ch"
STATIC oMainWnd
Function Main()
Define window oMainWnd title "TEST NN9560"
Activate window oMainWnd on init Connect() VALID QUITAPP()
Return nil
Function Connect()
Local oFontTime, oFopntBig, oFontNorm, oFontMed, oFontSmall
PRIVATE cSat, cHR, cSatMin, cSatMax, cHRMin, cHRMax, lFirstRun := .t., cDCB, cDataread
PRIVATE oTimerWalk, oDlg1, oBtn1Stop, oSay1, oSay2
DEFINE FONT oFontTime NAME "ARIAL" SIZE 9, 18 BOLD
ACTIVATE FONT oFontTime
DEFINE FONT oFontBig NAME "ARIAL" SIZE 50, 75 BOLD
ACTIVATE FONT oFontBig
DEFINE FONT oFontNorm NAME "ARIAL" SIZE 15, 25 BOLD
ACTIVATE FONT oFontNorm
DEFINE FONT oFontMed NAME "ARIAL" SIZE 7, 14 BOLD
ACTIVATE FONT oFontMed
DEFINE FONT oFontSmall NAME "ARIAL" SIZE 5, 10 BOLD
ACTIVATE FONT oFontSmall
cSat := "Turn on oximeter"
cHR := "** ** "
cSatMin := "---"
cSatMax := "---"
cHRMin := "---"
cHRMax := "---"
DEFINE DIALOG oDlg1 FROM 5,0 TO 31, 45 TITLE "Test" COLOR RGB(0,0,0),RGB(230,225,172) STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION) of oMainWnd
@ 8,10 BUTTON oBtn1Stop PROMPT "ABORT" SIZE 50,25 of oDlg1 FONT oFontSmall Action (lLoop:=.f., oDlg1:End())
@ 5,1 say oSay1 VAR alltrim(cSat)+" sat " SIZE 360,50 FONT oFontMed of oDlg1 UPDATE COLOR RGB(0,0,0),RGB(230,225,172)
@ 5,21 say oSay2 VAR alltrim(cHr )+" hr " SIZE 360,50 FONT oFontMed of oDlg1 UPDATE COLOR RGB(0,0,0),RGB(230,225,172)
if lFirstrun
DEFINE TIMER oTimerWalk interval 500 ACTION CollectStart(oDlg1)
ACTIVATE TIMER oTimerWalk
endif
ACTIVATE DIALOG oDlg1 CENTER
RETURN NIL
Function CollectStart( oDlg1 )
if ! empty( oTimerWalk )
oTimerWalk:Deactivate()
endif
lFirstRun := .t.
WinExec("\EzSat\DLL\SetComm4.bat",0)
nComm:= OpenComm( "Com4", 1024, 128 )
Syswait(.01)
if ! BuildCommDcb( "COM4:9600,n,8,1", @cDcb )
lLoop := .f.
oDlg1:End()
RETURN NIL
endif
if ! SetCommState( nComm, cDcb )
lLoop := .f.
oDlg1:End()
RETURN NIL
endif
if FlushComm( nComm, 1 ) != 0
nError = GetCommError( nComm )
MsgInfo( "FlushComm Error: " + Str( nError ) )
endif
cDataread := space(1)
Do while Alltrim(STR(HexToDec( Str2Hex( cDataread )))) <> "6"
syswait(.1)
WRITECOMM( nComm, HEX2STR("027002020803"))
ReadComm( nComm , @cDataRead)
cSat = STR(HexToDec( Str2Hex( cDataread )))
oDlg1:Update()
Enddo
lLoop := .t.
DataRead := ""
lconnect := .f.
nData := 1
cData := ""
cPrevData := 0
use \ezsatbt\oxdata
go top
zap
do while lLoop = .t.
Memory(-1)
SysRefresh()
if ReadComm( nComm , @cDataRead) <> 0
oDlg1:Update()
nData := HexToDec( Str2Hex( cDataread ) )
if cData = "SAT"
OxData->SAT := STR(nData)
cData := "XXX"
cSat := ALLTRIM(STR(nData))
endif
if cData = "HR"
APPEND BLANK
OxData->HR := STR(nData)
cData := "SAT"
cHR := ALLTRIM(STR(nData))
endif
If nData >= 128
cData := "HR"
ENDIF
endif
SysWait(.01)
lLoop := lLoop
Memory(-1)
oDlg1:Update()
enddo
if FlushComm( nComm, 1 ) != 0
nError = GetCommError( nComm )
MsgInfo( "FlushComm Error: " + Str( nError ) )
endif
if ! CloseComm( nComm )
nError = GetCommError( nComm )
MsgInfo( "CloseComm Error: " + Str( nError ) )
endif
Return Nil
Function Quitapp()
quit
Return .t.