AndreasFagschlunger / O2Xfs

Java API for accessing CEN/XFS API, EMV Level 2 Kernel
47 stars 28 forks source link

How to get a PTR form list using the PtrInfoCommand.FORM_LIST command? #58

Closed jifffffy closed 6 years ago

jifffffy commented 6 years ago

Hi, can you provide a test using the PtrInfoCommand.FORM_LIST command? I wrote a task named PTRFormTestPrintoutEjectTask , I want to print a form after getting the form list . the following code is how I get the form list:

WFSResult wfsResult = new XfsInfoCommand<>(service, PtrInfoCommand.FORM_LIST).call();
LPSTR lpszFormList = new LPSTR();
lpszFormList.allocate();
lpszFormList.pointTo(wfsResult.getResults());
Logger.info("lpszFormList = {}", lpszFormList.get());

the console shows:

2018-04-18 16:22:16,622 DEBUG [PTRFormTestPrintoutEjectTask] at.o2xfs.xfs.service.cmd.XfsCallable: call(): Waiting ...
2018-04-18 16:22:16,622 DEBUG [MessageHandler] at.o2xfs.xfs.service.EventDispatcher: dispatch(XFSMessage, IXfsEventNotification, WFSResult): xfsMessage=WFS_GETINFO_COMPLETE,eventNotification=at.o2xfs.xfs.service.cmd.XfsCallable@1531aee,wfsResult=at.o2xfs.xfs.WFSResult@1ae32b8[requestID=28,service=5,timestamp=at.o2xfs.win32.SYSTEMTIME@80e194[types=[2018, 4, 3, 18, 16, 22, 16, 620]],result=0,u=at.o2xfs.win32.Union@3ca899[size=4,fields={commandCode=101,eventID=101}],buffer=Address: B283C07D, Value: 94ADC07D]
2018-04-18 16:22:16,623 DEBUG [MessageHandler] at.o2xfs.xfs.service.cmd.XfsCallable: fireOperationCompleteEvent(WFSResult): wfsResult=at.o2xfs.xfs.WFSResult@1ae32b8[requestID=28,service=5,timestamp=at.o2xfs.win32.SYSTEMTIME@80e194[types=[2018, 4, 3, 18, 16, 22, 16, 620]],result=0,u=at.o2xfs.win32.Union@3ca899[size=4,fields={commandCode=101,eventID=101}],buffer=Address: B283C07D, Value: 94ADC07D]
2018-04-18 16:22:16,660 INFO  [PTRFormTestPrintoutEjectTask] at.o2xfs.xfs.service.ptr.PTRStatusCallable: call(): result=at.o2xfs.xfs.v3_00.ptr.PtrStatus3@4def2[device=HWERROR,media=NOTPRESENT,paper={OUT,NOTSUPP,NOTSUPP,NOTSUPP,NOTSUPP,NOTSUPP,NOTSUPP,NOTSUPP,NOTSUPP,NOTSUPP,NOTSUPP,NOTSUPP,NOTSUPP,NOTSUPP,NOTSUPP,NOTSUPP},toner=NOTSUPP,ink=NOTSUPP,lamp=NOTSUPP,retractBins=Optional.empty,mediaOnStacker=0,extra={Media_Info=0000, Error_Code=0621000070010, Error_Description=Device has a error, Please check Error Code!}]
2018-04-18 16:22:16,660 DEBUG [PTRFormTestPrintoutEjectTask] at.o2xfs.xfs.service.XfsServiceManager: free(WFSResult): wfsResult=at.o2xfs.xfs.WFSResult@1ae32b8[requestID=28,service=5,timestamp=at.o2xfs.win32.SYSTEMTIME@80e194[types=[2018, 4, 3, 18, 16, 22, 16, 620]],result=0,u=at.o2xfs.win32.Union@3ca899[size=4,fields={commandCode=101,eventID=101}],buffer=Address: B283C07D, Value: 94ADC07D]
2018-04-18 16:22:16,660 DEBUG [PTRFormTestPrintoutEjectTask] at.o2xfs.xfs.XfsAPI: wfsFreeResult(WFSResult): wfsResult=at.o2xfs.xfs.WFSResult@1ae32b8[requestID=28,service=5,timestamp=at.o2xfs.win32.SYSTEMTIME@80e194[types=[2018, 4, 3, 18, 16, 22, 16, 620]],result=0,u=at.o2xfs.win32.Union@3ca899[size=4,fields={commandCode=101,eventID=101}],buffer=Address: B283C07D, Value: 94ADC07D]
2018-04-18 16:22:16,667 DEBUG [PTRFormTestPrintoutEjectTask] at.o2xfs.xfs.XfsAPI: wfsAsyncGetInfo(HSERVICE, DWORD, Type, DWORD, HWND): hService=5,dwCategory=103,queryDetails=null,dwTimeOut=0,hWnd=120C0800
2018-04-18 16:22:16,669 DEBUG [MessageHandler] at.o2xfs.xfs.util.MessageHandler: callback(int, Buffer): msg=1031,lpWFSResult=at.o2xfs.win32.impl.Win32Buffer@ca0a3d[size=4,address=B0F30821]
2018-04-18 16:22:16,669 DEBUG [MessageHandler] at.o2xfs.xfs.service.XfsServiceManager: callback(XFSMessage, WFSResult): msg=WFS_GETINFO_COMPLETE,wfsResult=at.o2xfs.xfs.WFSResult@5eee79[requestID=29,service=5,timestamp=at.o2xfs.win32.SYSTEMTIME@172f77[types=[2018, 4, 3, 18, 16, 22, 16, 668]],result=0,u=at.o2xfs.win32.Union@1302844[size=4,fields={commandCode=103,eventID=103}],buffer=Address: 3283C07D, Value: 94ACC07D]
2018-04-18 16:22:16,669 DEBUG [MessageHandler] at.o2xfs.xfs.service.RequestQueue: getEventNotification(RequestId): Waiting for RequestId: 29
2018-04-18 16:22:16,670 DEBUG [PTRFormTestPrintoutEjectTask] at.o2xfs.xfs.service.cmd.XfsCallable: call(): Waiting ...
2018-04-18 16:22:16,670 DEBUG [MessageHandler] at.o2xfs.xfs.service.EventDispatcher: dispatch(XFSMessage, IXfsEventNotification, WFSResult): xfsMessage=WFS_GETINFO_COMPLETE,eventNotification=at.o2xfs.xfs.service.cmd.XfsCallable@b70dc,wfsResult=at.o2xfs.xfs.WFSResult@5eee79[requestID=29,service=5,timestamp=at.o2xfs.win32.SYSTEMTIME@172f77[types=[2018, 4, 3, 18, 16, 22, 16, 668]],result=0,u=at.o2xfs.win32.Union@1302844[size=4,fields={commandCode=103,eventID=103}],buffer=Address: 3283C07D, Value: 94ACC07D]
2018-04-18 16:22:16,670 DEBUG [MessageHandler] at.o2xfs.xfs.service.cmd.XfsCallable: fireOperationCompleteEvent(WFSResult): wfsResult=at.o2xfs.xfs.WFSResult@5eee79[requestID=29,service=5,timestamp=at.o2xfs.win32.SYSTEMTIME@172f77[types=[2018, 4, 3, 18, 16, 22, 16, 668]],result=0,u=at.o2xfs.win32.Union@1302844[size=4,fields={commandCode=103,eventID=103}],buffer=Address: 3283C07D, Value: 94ACC07D]
2018-04-18 16:22:16 [PTRFormTestPrintoutEjectTask] staf.service.operator.task.xfs.ptr.PTRFormTestPrintoutEjectTask.execute()
INFO: lpszFormList = ���}

I can't get the form list. What should I do? thanks very much!

AndreasFagschlunger commented 6 years ago

First off, your printer say it has a hardware error. 2nd, use LPZZSTR instead of LPSTR. The result of WFS_INF_PTR_FORM_LIST is Pointer to a list of null-terminated form names, with the final name terminating with two null characters..

jifffffy commented 6 years ago

Thanks very much! The problem has been solved