6 - 4
5X80 Series Software Development Kit (SDK) User’s Guide
}
}
}
Sample 6 - An asynchronous barcode capture using Callback function
// Message Handler function
BOOL CALLBACK EventCallback(HHP_EVENT_TYPE eventType,DWORD dwBytes )
{
HHP_DECODE_MSG
decodeInfo;
// Decode message structure.
TCHAR
tcErrMsg[ 128 ];
// Error message buffer.
Result_t
nResult = RESULT_ERR_INTIALIZE;
// Return code.
// Verify the event type is barcode
if( eventType == HHP_BARCODE_EVENT )
{
// Make sure to set the structure size!
decodeInfo.dwStructSize = sizeof( HHP_DECODE_MSG );
// Retrieve the barcode event data.
If( (nResult = hhpGetAsyncResult( &eventType,&decodeInfo )) ==
RESULT_SUCCESS )
{
_tprintf( _T(“Barcode: %s\n”),decodeInfo.pchMessage );
_tprintf( _T(“Barcode Length: %d\n”),decodeInfo.nLength );
_tprintf( _T(“AIM Id : %cn”),decodeInfo.chCodeID );
_tprintf( _T(“HHP Id: %cn”),decodeInfo.chSymLetter );
_tprintf( _T(“Symbol Modifier: %c\n”),decodeInfo.chSymModifier );
}
else
{
hhpGetErrorMessage( nResult,tcErrMsg );
_tprintf( _T(“Capture Barcode Returned: %s\n”),tcErrMsg );
}
}
}
// Code snippet to capture barcode
TCHAR
tcErrMsg[ 128 ]; // Error message buffer.
Result_tnResult = RESULT_ERR_INTIALIZE; // Return code.
// Register the callback function with the SDK.
if ( (nResult = hhpSetAsyncMethods( NULL,NULL,&EventCallback ) == RESULT_SUCCESS )
{
// Call the SDK function to capture a barcode, 6 second timeout. Unless call fails,
we will get a message when command completes.
if ( (nResult = hhpCaptureBarcode( NULL,6000,FALSE ) != RESULT_SUCCESS )
{
hhpGetErrorMessage( nResult,tcErrMsg );
_tprintf( _T("Capture Barcode Returned: %s\n"),tcErrMsg );
}
}
Summary of Contents for 5080
Page 6: ...iv 5X80 Series Software Development Kit SDK User s Guide ...
Page 14: ...1 8 5X80 Series Software Development Kit SDK User s Guide ...
Page 50: ...4 14 5X80 Series Software Development Kit SDK User s Guide ...
Page 60: ...6 8 5X80 Series Software Development Kit SDK User s Guide ...
Page 62: ...7 2 5X80 Series Software Development Kit SDK User s Guide ...
Page 63: ......