M500 USER MANUAL AND PROGRAMMER SDK
Page 26
4.3
Example pseudo code
CM500api
m_M500 =
new
CM500api
(); // C# API object
m_M500.
Init
();
m_M500.
RegCB
(OnNewEvent);
// Register event callback
…
// Event callback in DLLs thread
public
void
OnNewEvent(
int
iEvent)
{
switch
(iEvent)
{
case
EV_MS_RDY:
Invoke(
new
MethodInvoker
(ScanMsRdy));
// Calls ScanMsRdy on applications thread
break
;
case
EV_RGB_RDY:
Invoke(
new
MethodInvoker
(ScanRgbRdy));
// RGB image ready
break
;
case
EV_BC_RDY:
Invoke(
new
MethodInvoker
(EvScanBcRdy));
// Barcode ready
break
;
case
EV_IR_RDY:
Invoke(
new
MethodInvoker
(ScanIrRdy));
// IR image ready
break
;
case
EV_UV_RDY:
Invoke(
new
MethodInvoker
(ScanUvRdy));
// UV image ready
Break
…
}
}
// RGB image is ready, process on apps thread
private
void
ScanRgbRdy()
{
m_M500.UpdateRgb();
// Update the RGB bitmap with the last scan
fmUpdateRgb();
// Update the GUI and process the image
}
…
m_M500.
Close
()