FWPPC and MC3000 scan button

FWPPC and MC3000 scan button

Postby cdmmaui » Sun Sep 09, 2007 5:33 am

Hello,

I have upgrade to FWPPC August 2007 and I have created an application and transferred to the MC3000 unit. However, when I run the application the scan button does not work. I tried the demo software loaded on the unit and it works. Can someone tell me how I activate the scan button on the MC3000 unit or check for the scan button event?

Thank you very much.

Sincerely,
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Postby cdmmaui » Sun Sep 09, 2007 11:19 am

Hello,

I found the following code on this forum and got the scan button to work. However, the function is only returning the first character of the barcode. Can anyone help?

#include "FWCE.ch"
#include "hbclass.ch"
#include "Directry.ch"

//----------------------------------------------------------------------------//
function Main()

local oDlg , ;
aGet1, aGet2, aGet3 , ;
cTitle := 'CDM WinWMS - Receipts' , ;
cBuild := 'Build 20070909-0109' , ;
cWmsdata := '' , ;
cOwner := SPACE(10) , ;
cPo := SPACE(30) , ;
cSku := SPACE(50) , ;
nQty := 0 , ;
cUnitId := SerialNumber()

// Database init...
REQUEST DBFCDX
REQUEST DBFFPT
RddSetDefault ('DBFCDX')

// Check connection...
IF ! FILE( "client.dbf")
DbCreate( "client.dbf", { { "data", "C", 50, 0 } } )
ENDIF

pfad := '\'
cDb := 'client'
USE (pfad+cDb) NEW SHARED
IF NETERR()
MsgAlert( 'Unable to open ' + pfad + cDb, cTitle )
RETURN (.F.)
ENDIF
IF client->( reccount() ) < 1
APPEND BLANK
ENDIF
GO TOP
cWmsData := ALLTRIM( client->data )
client->( dbclosearea() )

// Data Folder...
DO WHILE (.T.)
IF FILE(cWmsdata + "wmsdet.dbf")
EXIT
ELSE
cTmp = LEFT( cWmsdata + SPACE(50), 50)

// Window Get...
lPass := MsgGet( cTitle, "Folder Name", @cTmp )
IF ! lPass
RETURN (.F.)
ENDIF

// Init...
cWmsdata = ALLTRIM(cTmp)
IF RIGHT(cWmsdata,1)<>"\"
cWmsdata += "\"
ENDIF

// Update...
pfad := '\'
cDb := 'client'
USE (pfad+cDb) NEW SHARED
IF NETERR()
MsgAlert( 'Unable to open ' + pfad + cDb, cTitle )
RETURN (.F.)
ENDIF
GO TOP
DO WHILE (.T.)
IF client->( dbrlock() )
client->data := ALLTRIM( cWmsdata )
client->( dbrunlock() )
EXIT
ENDIF
ENDDO
client->( dbclosearea() )
ENDIF
ENDDO

DEFINE DIALOG oDlg TITLE cTitle ;
SIZE 300, 300 COLOR "W/B+"

@ 0.7, 01 SAY "Owner" SIZE 20, 10
@ 1.0, 05 GET aGet1 VAR cOwner SIZE 50, 10 PICTURE "@!" VALID CheckScan( @aGet1, @cOwner )

@ 1.7, 01 SAY "P.O. No." SIZE 25, 10
@ 2.0, 05 GET aGet2 VAR cPo SIZE 99, 10 PICTURE "@!" VALID CheckScan( @aGet2, @cPo )

@ 2.5, 01 SAY "SKU" SIZE 15, 10
@ 3.0, 05 GET aGet3 VAR cSku SIZE 99, 10 PICTURE "@!" VALID CheckScan( @aGet3, @cSku )

@ 3.5, 01 SAY "Qty" SIZE 10, 10
@ 4.0, 05 GET nQty SIZE 25, 10 PICTURE "999999"

@ 6.0, 01 BUTTON "Save" ACTION oDlg:End() SIZE 30, 10
@ 6.0, 10 BUTTON "Cancel" ACTION oDlg:End() SIZE 30, 10
@ 6.0, 19 BUTTON "New" ACTION oDlg:End() SIZE 30, 10

@ 8.0, 01 SAY cBuild SIZE 99, 10

ACTIVATE DIALOG oDlg CENTERED ;
VALID MsgYesNo( "Exit", cTitle )

return nil

//-----------------------------------------------------------------------------
FUNCTION CheckScan( oGet, cData )

LOCAL cRet , lReturn := .f., nLen := LEN( cData )

IF oGet:nLastKey = 13
cRet := SCAN_OPEN()
MsgInfo( cRet )
IF VALTYPE( cRet ) = 'C'
cData := LEFT( cRet + SPACE(nLen), nLen )
lReturn := .T.
ENDIF
ENDIF
oGet:Refresh()

RETURN (.T.)

//-----------------------------------------------------------------------------
FUNCTION cesetmenu() ; RETURN NIL
FUNCTION getmenu() ; RETURN NIL
FUNCTION readbitmap() ; RETURN NIL
FUNCTION palbmpread() ; RETURN NIL

#pragma BEGINDUMP

#pragma comment (lib,"scnapi32")
#include <hbapi.h>
#include <windows.h>
#include "Scancapi.h"

LPSCAN_BUFFER lpScanBuffer = NULL;
BOOL bUseText = TRUE;
DWORD dwScanSize = 7095;
DWORD dwScanTimeout = 0;

#define BUFFER_SIZE 7095
#define DEFAULT_TIMEOUT 10000

HANDLE hScanner = NULL;
TCHAR szScannerName[MAX_PATH] = TEXT("SCN1:");
DWORD dwResult ;
CHAR Buffer ;
UINT uMsg ;
DWORD dwTimeout ;

HB_FUNC( SCAN_OPEN )
{
dwResult = SCAN_Open( szScannerName, &hScanner );
if ( dwResult == E_SCN_SUCCESS )
{
dwResult = SCAN_Enable( hScanner );
if ( dwResult == E_SCN_SUCCESS )
{

BOOL state = TRUE;
dwResult = SCAN_SetSoftTrigger(hScanner, &state);
if (dwResult == E_SCN_SUCCESS) {
// allocate a new scan buffer
lpScanBuffer = SCAN_AllocateBuffer(TRUE /* data as chars */, BUFFER_SIZE);
if (lpScanBuffer) {
dwResult = SCAN_ReadLabelWait(hScanner, lpScanBuffer, DEFAULT_TIMEOUT);
if (dwResult == E_SCN_SUCCESS)
{
hb_retclen( (char *)SCNBUF_GETDATA(lpScanBuffer),25);
}
}
SCAN_DeallocateBuffer(lpScanBuffer);
}
state = FALSE;
SCAN_SetSoftTrigger(hScanner, &state);

}
else
{
MessageBox( GetActiveWindow(), L"Error en SCAN_Enable", L"Ok", 0 );

}
}
else
{
MessageBox( GetActiveWindow(), L"Error en SCAN_Open", L"Ok", 0 );
}
}

#pragma ENDDUMP
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Postby Antonio Linares » Sun Sep 09, 2007 11:47 am

Darrell,

Please try this and lets see what length you get:

cRet := SCAN_OPEN()
MsgInfo( Len( cRet ) )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby cdmmaui » Sun Sep 09, 2007 6:23 pm

Antonio,

I changedn the CheckScan function to the following and it worked.

Regards,

FUNCTION CheckScan( oGet, cData )

LOCAL cRet , lReturn := .f., nLen := LEN( cData ) , ;
cTmp := '' , ;
cChar := '' , ;
cStr := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890' , ;
nX := 0

IF oGet:nLastKey = 13
cRet := SCAN_OPEN()
FOR nX=1 TO LEN( cRet )
cChar := SUBSTR( cRet, nX, 1 )
IF cChar $ cStr
cTmp += cChar
ENDIF
NEXT nX
cRet := cTmp
MsgInfo( Len( cRet ), cRet )
IF VALTYPE( cRet ) = 'C'
cData := LEFT( cRet + SPACE(nLen), nLen )
lReturn := .T.
ENDIF
ENDIF
oGet:Refresh()

RETURN (.T.)
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Postby Antonio Linares » Sun Sep 09, 2007 6:32 pm

Very good :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby cdmmaui » Mon Jun 23, 2008 2:26 am

Antonio,

Is it possible to activate the SCAN_OPEN when a key is press on the scanner? The MC3000 has a yellow scan button, is sample code available that can handle such an event?

Thank you,
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Postby Antonio Linares » Mon Jun 23, 2008 7:40 am

Darrell,

What control has the focus when the key is pressed ? The key event will go to the focused control, and in the case that there is no a control, it will be routed to the window or dialog.

Then you just need to implement:

<oControl_or_oWindow_or_oDialog>:bKeyChar = { | nKey | ... your code... }
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby cdmmaui » Mon Jun 23, 2008 1:38 pm

Hi Antonio, I tried this function but I get no response from the yellow key, I get responses from other keys.
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Postby Antonio Linares » Mon Jun 23, 2008 2:02 pm

Does the yellow button start a scan process ?

What your Pocket PC documentation comment about such button ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby cdmmaui » Wed Jul 16, 2008 3:22 am

Hi Antonio,

Yes, the yellow trigger starts the scan process. I get no response with key function you provided. I am having a hard time finding good documentation for the scanner event handler. What is the best key words to search for such events?

Thank You,
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Postby Antonio Linares » Wed Jul 16, 2008 8:45 am

Darrell,

Is this the documentation of your Pocket PC ?
http://74.125.39.104/search?q=cache:8PO ... &gl=es#106

If yes, then I would review chapter 10 details.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Biel EA6DD » Wed Jul 16, 2008 9:18 am

Hi Darrel,
In the past Symbol provides a application (ScanWedge.Exe), you can run this application on init of PocketPc, and when you press the yellow button the application will send the scaned code to the keyboard buffer.
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 cdmmaui » Wed Jul 16, 2008 2:16 pm

Thank you, I will review documentation
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Postby Jon Munro » Thu Aug 14, 2008 7:19 am

Hi Darryl,
I am yet to tackle the Symbol 9000 but have successfully programmed my system for the PSC Falcon 4400 using the API, which appears to be rather similar to Symbol.
Instead of waiting for a scan event, which I couldn't see how I could handle, I simply use a timer function, so that after issuing the scan request it periodically checks for any data, say every 500 msecs. Disable the timer while processing the scanned data and enable when ready to request the next scan. Whenever a scan occurs, the data will be detected in the next cycle. On the Falcon 4420 it works very well and long complex EAN128 barcodes can be scanned, decoded and parsed at 2 per second! Because the scanner is buffered, none are ever lost but just wait in the queue.
I also tried the standard 'keyboard wedge' function but found it to be so slow as to be totally unacceptable, probably caused by the character by character processing and barcodes over 50 digits.
I'll be tackling the Symbol industrial scanners soon...

HTH
User avatar
Jon Munro
 
Posts: 42
Joined: Sun Oct 09, 2005 11:47 am
Location: Brisbane Australia


Return to FiveWin for Pocket PC

Who is online

Users browsing this forum: No registered users and 16 guests