I want to configure specific note types during cash in operation
Input parameter should be in the following format: LPUSHORT lpusNoteIDs;
When I execute the below commands I get invalid data error (-52)
LPUSHORT* lpusNoteIDs;
lpusNoteIDs = (LPUSHORT*)malloc(7*sizeof(LPUSHORT));
for(int i =0;i<7;i++)
{
lpusNoteIDs[i]=(LPUSHORT)malloc(sizeof(USHORT));
}
lpusNoteIDs[0] = (LPUSHORT)0x2700;
lpusNoteIDs[1] = (LPUSHORT)0x2710;
lpusNoteIDs[2] = (LPUSHORT)0x2701;
lpusNoteIDs[3] = (LPUSHORT)0x2711;
lpusNoteIDs[4] = (LPUSHORT)0x2721;
lpusNoteIDs[5] = (LPUSHORT)0x2732;
lpusNoteIDs[6] = (LPUSHORT)0x2704;
hResult = WFSExecute(hService, WFS_CMD_CIM_CONFIGURE_NOTETYPES, (LPVOID)lpusNoteIDs, 400000, &res);
return (int)hResult;
I have even tried the below code but it gives me the same error
LPUSHORT* lpusNoteIDs;
USHORT abc[]={1000,9985,10001,10017,10034,9988};
lpusNoteIDs=(LPUSHORT*)abc;
hResult = WFSExecute(hService, WFS_CMD_CIM_CONFIGURE_NOTETYPES,(LPVOID)lpusNoteIDs, 600000, &res);
return (int)hResult;
In CIM Service Provider Implementation Specification document it says:
lpusNoteIDs :-Pointer to a NULL terminated list of unsigned shorts which contains the note IDs of the bank notes
Any help as to how the values must be passed would be very useful.. Thanks in advance.
You must use WFMAllocate and WFMAllocateMore functions to allocate memory for XFS structures to transfer it between application and service provider. Your example bellow:
LPUSHORT lpusNoteIDs = NULL;
const int countNotes = 7;
// Always use WFMAllocate* functions for XFS memory allocation
WFSRESULT hr = WFMAllocateBuffer(sizeof(USHORT)*(countNotes+1), WFS_MEM_ZEROINIT|WFS_MEM_SHARE, (void**)&lpusNoteIDs);
// Fill note ID's
lpusNoteIDs[0] = (USHORT)0x2700;
lpusNoteIDs[1] = (USHORT)0x2710;
lpusNoteIDs[2] = (USHORT)0x2701;
lpusNoteIDs[3] = (USHORT)0x2711;
lpusNoteIDs[4] = (USHORT)0x2721;
lpusNoteIDs[5] = (USHORT)0x2732;
lpusNoteIDs[6] = (USHORT)0x2704;
hr = WFSExecute(hService, WFS_CMD_CIM_CONFIGURE_NOTETYPES, (LPVOID)&lpusNoteIDs, 400000, &res);