Using the JXFSChk Service

About this task
The following is an example of a operation using the JXFS Check Reader Service:

Service definition:

<JXFSChk id="JXFSChk" deviceName="CheckReader" automaticOpen="false" 
    jxfsIniConfig="c:\\jxfs\\jxfs.cfg" pocket="2"/> 

Context definition:

<context id="workstation" type="wks" parent="branch"> 
  <refKColl refId="workstation"/> 
  <refService refId="JXFSChk" alias="myChk" type="chk"/> 
</context>

Format definition:

<fmtDef id="checkReaderFmt"> 
  <record dataName="workstation"> 
    <fString dataName="checkData"/> 
  </record> 
</fmtDef> 

Application flow:

// Synchronous reading of check data
JXFSChk chkReader = (JXFSChk)ctx.getService("myChk"); 
try { 
  
	// open the device 
  chkReader.openSync(); 
  com.jxfs.general.JxfsStatus s = chkReader.getStatus(); 

  // Print the status of the device 
  System.out.println("JxfsStatus= "+s.toString()); 
  System.out.println("readDataSync() call. Insert check..."); 

  // Doesn't read the image 
  chkReader.setGetImage(false); 

  // Reads the check. Waits until the data is read. 
  int returnCode = chkReader.readDataSync(); 
  System.out.println("readDataSync r= " + String.valueOf(returnCode)); 
  System.out.println(" Data from check " + chkReader.getData().getCheckData());

} Catch (JxfsException jxfse) { 
  System.out.println("JxfsException: " + jxfse); 
} 
See the example in Using the JXFSPrt Service for information on using events. 

See the example in Using the JXFSPrt Service for information on using events.