Closed VitalyEG closed 6 years ago
The problem is simple, the log output is written in PTRStatusCallable before the structure is copied:
And now take a look at the copy constructor:
It does allocate memory, but it doesn't set any values. So PTRStatusTask
uses an empty structure. Compare with WFSPTRCAPS
where the copy constructor is implemented.
I probably won't fix it, since this is a really old Struct-Class which was handwritten. I can provide better tested classes like CIM, CDM classes, if you need them. But I also don't continue with O²Xfs Operator as it is (Java Swing Client) - I'm currently working on a new approach using web technologies.
So I'm fine with providing better Struct-Classes for PTR if you want - it would take a few days though.
Best regards, Andreas Fagschlunger
@AndreasFagschlunger Thank you very much. Yes. really, filling the structure is not realized for PTR. :+1: Please provide Struct-Classes for PTR, if it's possible. Thanks.
Hello @VitalyEG If you haven't seen it yet, I commited the changes to the PTR classes (843d633cfbb92cb26971e8ca06c88bf372d2e908). The unit tests will follow.
Hi, @AndreasFagschlunger Thanks you for this sources. But I found some toubles. At first, rename 4 classes from: src/main/java/at/o2xfs/xfs/ptr/PTRDeviceState.java src/main/java/at/o2xfs/xfs/ptr/PTRError.java src/main/java/at/o2xfs/xfs/ptr/PTRExecuteCommand.java src/main/java/at/o2xfs/xfs/ptr/PTRInfoCommand.java
to:
src/main/java/at/o2xfs/xfs/ptr/PtrDeviceState.java src/main/java/at/o2xfs/xfs/ptr/PtrError.java src/main/java/at/o2xfs/xfs/ptr/PtrExecuteCommand.java src/main/java/at/o2xfs/xfs/ptr/PtrInfoCommand.java
And on the "DeviceStatusTask.addPTRService" received an exception, see below log:
160821 [DeviceStatusTask] DEBUG at.o2xfs.xfs.XfsAPI - wfsAsyncGetInfo(HSERVICE, DWORD, Type, DWORD, HWND): hService=378
,dwCategory=101,queryDetails=null,dwTimeOut=0,hWnd=6C052200
160821 [DeviceStatusTask] DEBUG at.o2xfs.xfs.service.cmd.XfsCallable - call(): Waiting ...
160836 [MessageHandler] DEBUG at.o2xfs.xfs.util.MessageHandler - callback(int, Buffer): msg=1031,lpWFSResult=at.o2xfs.w
in32.impl.Win32Buffer@c481e4[size=4,address=20F25515]
160836 [MessageHandler] DEBUG at.o2xfs.xfs.service.XfsServiceManager - callback(XFSMessage, WFSResult): msg=WFS_GETINFO
_COMPLETE,wfsResult=at.o2xfs.xfs.WFSResult@c20c41[requestID=2215,service=378,timestamp=at.o2xfs.win32.SYSTEMTIME@1d4c7fb
[types=[2018, 4, 5, 6, 12, 24, 51, 103]],result=0,u=at.o2xfs.win32.Union@1c411d6[size=4,fields={commandCode=101,eventID=
101}],buffer=Address: 06233700, Value: D0933700]
160852 [MessageHandler] DEBUG at.o2xfs.xfs.service.EventDispatcher - dispatch(XFSMessage, IXfsEventNotification, WFSRes
ult): xfsMessage=WFS_GETINFO_COMPLETE,eventNotification=at.o2xfs.xfs.service.cmd.XfsCallable@1b804b8,wfsResult=at.o2xfs.
xfs.WFSResult@c20c41[requestID=2215,service=378,timestamp=at.o2xfs.win32.SYSTEMTIME@1d4c7fb[types=[2018, 4, 5, 6, 12, 24
, 51, 103]],result=0,u=at.o2xfs.win32.Union@1c411d6[size=4,fields={commandCode=101,eventID=101}],buffer=Address: 0623370
0, Value: D0933700]
160852 [MessageHandler] DEBUG at.o2xfs.xfs.service.cmd.XfsCallable - fireOperationCompleteEvent(WFSResult): wfsResult=a
t.o2xfs.xfs.WFSResult@c20c41[requestID=2215,service=378,timestamp=at.o2xfs.win32.SYSTEMTIME@1d4c7fb[types=[2018, 4, 5, 6
, 12, 24, 51, 103]],result=0,u=at.o2xfs.win32.Union@1c411d6[size=4,fields={commandCode=101,eventID=101}],buffer=Address:
06233700, Value: D0933700]
160867 [DeviceStatusTask] DEBUG at.o2xfs.xfs.service.XfsServiceManager - free(WFSResult): wfsResult=at.o2xfs.xfs.WFSRes
ult@c20c41[requestID=2215,service=378,timestamp=at.o2xfs.win32.SYSTEMTIME@1d4c7fb[types=[2018, 4, 5, 6, 12, 24, 51, 103]
],result=0,u=at.o2xfs.win32.Union@1c411d6[size=4,fields={commandCode=101,eventID=101}],buffer=Address: 06233700, Value:
D0933700]
160867 [DeviceStatusTask] DEBUG at.o2xfs.xfs.XfsAPI - wfsFreeResult(WFSResult): wfsResult=at.o2xfs.xfs.WFSResult@c20c41
[requestID=2215,service=378,timestamp=at.o2xfs.win32.SYSTEMTIME@1d4c7fb[types=[2018, 4, 5, 6, 12, 24, 51, 103]],result=0
,u=at.o2xfs.win32.Union@1c411d6[size=4,fields={commandCode=101,eventID=101}],buffer=Address: 06233700, Value: D0933700]
java.lang.IllegalStateException: No buffer
at at.o2xfs.win32.Type.getBytes(Type.java:53)
at at.o2xfs.xfs.win32.XfsWord.longValue(XfsWord.java:72)
at at.o2xfs.xfs.util.XfsConstants.valueOf(XfsConstants.java:47)
at at.o2xfs.xfs.win32.XfsWord.get(XfsWord.java:62)
at at.o2xfs.xfs.win32.XfsWordArray.get(XfsWordArray.java:56)
at at.o2xfs.xfs.win32.XfsWordArray.set(XfsWordArray.java:49)
at at.o2xfs.xfs.v3_20.ptr.PtrStatus320.set(PtrStatus320.java:64)
at at.o2xfs.xfs.v3_30.ptr.PtrStatus330.set(PtrStatus330.java:59)
at at.o2xfs.xfs.v3_30.ptr.PtrStatus330.
Hello @AndreasFagschlunger how is the progress the new approach , can you tell me your technical choice? I'm always watching!
Hello @sunyuyangg555 A bit off topic but it's going to be Angular on frontend and a WebSocket-Endpoint on backend, maybe using WildFly Swarm. It's not very far, currently I'm working on navigation and basically using mocks, not XFS.
Hi, @AndreasFagschlunger. I got "NullPointerException", see below log:
273609 [DeviceStatusTask] DEBUG at.o2xfs.xfs.XfsAPI - wfsAsyncGetInfo(HSERVICE, DWORD, Type, DWORD, HWND): hService=380
,dwCategory=101,queryDetails=null,dwTimeOut=0,hWnd=DC002600
273609 [DeviceStatusTask] DEBUG at.o2xfs.xfs.service.cmd.XfsCallable - call(): Waiting ...
273609 [MessageHandler] DEBUG at.o2xfs.xfs.util.MessageHandler - callback(int, Buffer): msg=1031,lpWFSResult=at.o2xfs.w
in32.impl.Win32Buffer@12c81b9[size=4,address=60F6BD15]
273625 [MessageHandler] DEBUG at.o2xfs.xfs.service.XfsServiceManager - callback(XFSMessage, WFSResult): msg=WFS_GETINFO
_COMPLETE,wfsResult=at.o2xfs.xfs.WFSResult@1ebf08d[requestID=2229,service=380,timestamp=at.o2xfs.win32.SYSTEMTIME@1b3bad
1[types=[2018, 4, 1, 9, 9, 34, 39, 334]],result=0,u=at.o2xfs.win32.Union@9809c5[size=4,fields={commandCode=101,eventID=1
01}],buffer=Address: BE223100, Value: D0933100]
273625 [MessageHandler] DEBUG at.o2xfs.xfs.service.EventDispatcher - dispatch(XFSMessage, IXfsEventNotification, WFSRes
ult): xfsMessage=WFS_GETINFO_COMPLETE,eventNotification=at.o2xfs.xfs.service.cmd.XfsCallable@cd73da,wfsResult=at.o2xfs.x
fs.WFSResult@1ebf08d[requestID=2229,service=380,timestamp=at.o2xfs.win32.SYSTEMTIME@1b3bad1[types=[2018, 4, 1, 9, 9, 34,
39, 334]],result=0,u=at.o2xfs.win32.Union@9809c5[size=4,fields={commandCode=101,eventID=101}],buffer=Address: BE223100,
Value: D0933100]
273640 [MessageHandler] DEBUG at.o2xfs.xfs.service.cmd.XfsCallable - fireOperationCompleteEvent(WFSResult): wfsResult=a
t.o2xfs.xfs.WFSResult@1ebf08d[requestID=2229,service=380,timestamp=at.o2xfs.win32.SYSTEMTIME@1b3bad1[types=[2018, 4, 1,
9, 9, 34, 39, 334]],result=0,u=at.o2xfs.win32.Union@9809c5[size=4,fields={commandCode=101,eventID=101}],buffer=Address:
BE223100, Value: D0933100]
273656 [DeviceStatusTask] DEBUG at.o2xfs.xfs.util.XfsConstants - valueOf(long, Class
Hi, @AndreasFagschlunger. It seems that I need to learn a lot,I am waiting for your good news!
Hi, @AndreasFagschlunger. I checked operation with the printer. Now with obtaining the status of the printer and information of the printer everything is good. Also I looked at source codes on obtaining the status of a dispenser. Class "DeviceStatusTask" is not realized for adding dispenser device and for obtaining the status of the device it is necessary to implement: CdmStatusTask CdmServiceTask CdmServiceListener CdmStatusCallable Did I get it right?
thanks in advance
Hi @VitalyEG The last tasks were for dispensing & presenting cash. While implementing these tasks I realized, I can't continue with O²Xfs Operator as it is, since it's to difficult to create a nice UI. Simple things like user input validation are hard to do. So regarding to your question, you're right - those tasks are missing and you should be able to add them by yourself, since there are templates like PtrStatusTask.
But if you only need the basic information (capabilities, status), you may just only create a simple Java-main application to output this information.
Also I'm still working on the unit tests for the PTR classes. I hope I can finish them until tomorrow.
best regards, Andreas Fagschlunger
Hi, @AndreasFagschlunger.
When I click the PTRCapabilitiesTask has the same "Pointer point to NULL" exception as the device has no retract bin.
I add a null check in the PtrCapabilities3.getMaxRetract method
public int[] getMaxRetract() {
if(Pointer.NULL.equals(maxRetract)){
return new int[]{};
}
return new UShortArray(maxRetract, getRetractBins()).get();
}
Now it works.
Hi @sunyuyangg555 Thank you for your hint, I moved the NULL handling upwards to UShortArray: 2d35802 I think it's safer when UShortArray deals with NULL directly. Sadly I didn't find a quick way to handle this generally. I also added some unit tests addressing this matter.
I will close this issue since the original problem is solved.
Click on PtrStatusTask throws "Pointer point to NULL" exception.
WFSPTRSTATUS returned without errors:
151960 [PTRStatusTask] INFO at.o2xfs.xfs.service.ptr.PTRStatusCallable - call(): WFSPTRSTATUS: at.o2xfs.xfs.ptr.WFSPTRSTATUS@b0751f[device=ONLINE,media=PRESENT,paper=FULL,NOTSUPP,NOTSUPP,NOTSUPP,NOTSUPP,NOTSUPP,NOTSUPP,NOTSUPP,NOTSUPP,NOTSUPP,NOTSUPP,NOTSUPP,NOTSUPP,NOTSUPP,NOTSUPP,NOTSUPP},toner=NOTSUPP,ink=NOTSUPP,lamp=NOTSUPP,retractBins=at.o2xfs.xfs.ptr.WFSPTRRETRACTBINS@152030f[retractBin=BINOK,retractCount=2]],mediaOnStacker=0,extra=61009=0, 61008=0, 61007=0, 61006=0, 61005=0, 61004=0, 61003=0, 61002=0, 61001=0, 61000=0, 61022=0, 61021=0, 61020=0, 1=0, 61019=1, 61018=1, 61017=0, 61016=0, 61015=0, 61014=0, 61013=0, 61012=0, 61011=1, 61010=0, 61032=0, 61031=0},guidLights=[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],devicePosition=POSNOTSUPP,powerSaveRecoveryTime=0,paperType=SINGLESIDED,TYPEUNKNOWN,TYPEUNKNOWN,TYPEUNKNOWN,TYPEUNKNOWN,TYPEUNKNOWN,TYPEUNKNOWN,TYPEUNKNOWN,TYPEUNKNOWN,TYPEUNKNOWN,TYPEUNKNOWN,TYPEUNKNOWN,TYPEUNKNOWN,TYPEUNKNOWN,TYPEUNKNOWN,TYPEUNKNOWN},antiFraudModule=NOTSUPP]
but then throws exception on "getRetractBins" method:
ask.xfs.ptr.PTRStatusTask@1920c9b java.lang.NullPointerException: Pointer points to NULL at at.o2xfs.win32.Pointer.buffer(Pointer.java:84) at at.o2xfs.win32.ZList.(ZList.java:63)
at at.o2xfs.xfs.ptr.WFSPTRSTATUS.getRetractBins(WFSPTRSTATUS.java:205)
at at.o2xfs.operator.task.xfs.ptr.PTRStatusTask.execute(PTRStatusTask.java:61)
at at.o2xfs.operator.task.xfs.XfsServiceTask.doExecute(XfsServiceTask.java:65)
at at.o2xfs.operator.task.Task.execute(Task.java:90)
at at.o2xfs.operator.task.TaskManager.executeTask(TaskManager.java:148)
at at.o2xfs.operator.task.TaskManager.access$100(TaskManager.java:39)
at at.o2xfs.operator.task.TaskManager$1.run(TaskManager.java:136)
at java.lang.Thread.run(Thread.java:745)
Retrack beans, as you see, contains data: retractBins=at.o2xfs.xfs.ptr.WFSPTRRETRACTBINS@152030f[retractBin=BINOK,retractCount=2]
But when I validate it:
public List getRetractBins() {
final List result = new ArrayList();
if (retractBin != null) {
if (!PTRRetractBin.NOTSUPP.equals(retractBin.getRetractBin())) {
result.add(retractBin);
}
} else if (retractBins != null) {
It's return true.