I was wondering if someone could advise me
a Supplier of my PoS Terminal has given me a few programs they have made in C to get the status of the cash drawer port as well as Open the drawer
I also have libptcash.so and libptcash.a files and the read me is telling me to use that from my user program (but I have no clue how to do that)
but they are small single run program
does anyone know how they could be converted to Gambas so i could monitor the cash drawer port all the time (i have attached the C source code so if someone smarter then me wants to see it they can)
My machine a 2 (PT621X_A)
//MACHINE_TYPE
#define PT6200_A 1
#define PT621X_A 2
#define PT5700_A 3
#define PT571X_A 4
#define PT6900_A 5
#define PT691X_A 6
#define PT8800_A 7
//{==add by frankie on 20111027
#define PT8850_A 8
#define SP800_A 9
#define SP1000_A 10
#define SP820_A 11
#define PT6315C_A 11
#define SP600_A 12
#define SP810_A 13
#define WT_110_A 14
#define SP2500_A 15
#define SP3515_A 15
#define SP1060_A 16
#define SP7615_A 17
#define SP7615_A_IO 19
#define SP5615_A 18
//==}
#define PT6200_B 21
#define PT621X_B 22
#define PT5700_B 23
#define PT571X_B 24
#define PT6900_B 25
#define PT691X_B 26
#define PT8800_B 27
//{==add by frankie on 20111027
#define PT8850_B 28
#define SP800_B 29
#define SP1000_B 30
#define SP820_B 31
#define PT6315C_B 31
#define SP600_B 32
#define SP810_B 33
#define WT_110_B 34
#define SP2500_B 35
#define SP3515_B 35
#define SP1060_B 36
#define SP7615_B 37
#define SP5615_B 38
//==}
/********************************************************************
Function: Open_Cash(int machine_type)
Description:
Open the cash drawer.
Parameter:
int machine_type : should be one of
PT6200 , PT621X , PT5700 , PT571X , PT6900 , PT691X,PT8800
return val:
return :
0: open success
1: open fail
********************************************************************/
// 0: success -1: fail
int Open_Cash(int machine_type);
/********************************************************************
Function: Get_Cash_Status(int machine_type)
Description:
Open the cash drawer.
Parameter:
int machine_type : should be one of
PT6200 , PT621X , PT5700 , PT571X , PT6900 , PT691X ,PT8800
return val:
return :
0: cash drawer closed
1: cash drawer opened
********************************************************************/
int Get_Cash_Status(int machine_type);
/********************************************************************
Function: ReadSN(unsigned char * psnbuf)
Description:
read the MB Serial Number.
Parameter:
psnbuf,will return the SN, 12 characters
return :
0: success
-1: fail
********************************************************************/
int ReadSN(unsigned char * psnbuf);
#include <stdio.h>
#include "cashdrawer.h"
int main(int argc,char *argv[])
{
int machine_type;
int ret;
machine_type = atoi(argv[1]);
ret=Open_Cash(machine_type);
printf("open cash return = %d\n",ret);
if(ret == 0)
printf("open success\n");
else
printf("open fail\n");
}
#include <stdio.h>
#include "cashdrawer.h"
int main(int argc,char *argv[])
{
int machine_type;
int status;
machine_type = atoi(argv[1]);
status=Get_Cash_Status(machine_type);
printf("get cash status = %2x\n",status);
if(status == 1)
printf("cash drawer is opened\n");
else if(status == 0)
printf("cash drawer is closed\n");
else
printf("get cash status fail\n");
}
Ideally I would like to be able to click on the Gambas App a button that says "Open Drawer" and it will open the drawer and then show a mesage saying "Please close the drawer" until they close the Drawer
Below is the readme file (and it talks about threaded API)
1. How to install the Partner cashdrawer driver
1) tar -xvzf PT_Cashdrawer_Driver.tar.gz
2) cd PT_Cashdrawer_Driver
3)
sh install.sh
( the install.sh need using the "root" user permission)
4) reboot
2. How to test the driver
1) cd PT_Cashdrawer_Driver/test_utilities/64bit (if your linux is 32bit ,so please into the folder "32bit")
2) ./opencash xx (will open the cashdrawer,xx is the machine type. The machine type please check the cashdrawer.h .For example: ./opencash 11 , will open SP820_A)
3) ./getstatus xx(will get the cashdrawer open/close status)
4) ./readSN (will return the mainboard's Serial Number)
3. How to uninstall the driver
sh uninstall.sh
4.How to call the open/stastus API in usr program
We provide two dll :libptcash.so ,libptcashc++.so . Default please using the libptcash.so ,if your program is using the C++,maybe using the libptcash.so will have problem.So please using the libptcahsc++.so.
5.Thredd APIs be provided:
1)int Open_Cash(int machine_type); Open the cash drawer.
2)int Get_Cash_Status(int machine_type); Get the cash drawer open/close status.
3)int ReadSN(unsigned char * psnbuf); Get the mainboard's Serial Number.
the description like these:
/********************************************************************
Function: Open_Cash(int machine_type)
Description:
Open the cash drawer.
Parameter:
int machine_type : should be one of
PT6200 , PT621X , PT5700 , PT571X , PT6900 , PT691X, PT8800........
return val:
return :
0: open success
1: open fail
********************************************************************/
int Open_Cash(int machine_type);
/********************************************************************
Function: Get_Cash_Status(int machine_type)
Description:
Open the cash drawer.
Parameter:
int machine_type : should be one of
PT6200 , PT621X , PT5700 , PT571X , PT6900 , PT691X, PT8800........
return val:
return :
0: cash drawer closed
1: cash drawer opened
********************************************************************/
int Get_Cash_Status(int machine_type);
/********************************************************************
Function: ReadSN(unsigned char * psnbuf)
Description:
read the MB Serial Number.
Parameter:
psnbuf,will return the SN, 12 characters
return :
0: success
-1: fail
********************************************************************/
int ReadSN(unsigned char * psnbuf);
5.About the "machine_type"
#define PT6200_A 1
#define PT621X_A 2
#define PT5700_A 3
#define PT571X_A 4
#define PT6900_A 5
#define PT691X_A 6
#define PT8800_A 7
#define PT8850_A 8
#define SP800_A 9
#define SP1000_A 10
#define SP820_A 11
#define PT6315C_A 11
#define SP600_A 12
#define SP810_A 13
#define WT_110_A 14
#define SP2500_A 15
#define SP3515_A 15
#define SP5514_A 15
#define SP1060_A 16
#define SP2600_A 16
#define SP7615_A 17
#define SP5615_A 18
#define PT6200_B 21
#define PT621X_B 22
#define PT5700_B 23
#define PT571X_B 24
#define PT6900_B 25
#define PT691X_B 26
#define PT8800_B 27
#define PT8850_B 28
#define SP800_B 29
#define SP1000_B 30
#define SP820_B 31
#define PT6315C_B 31
#define SP600_B 32
#define SP810_B 33
#define WT_110_B 34
#define SP2500_B 35
#define SP3515_B 35
#define SP5514_B 35
#define SP1060_B 36
#define SP2600_B 36
#define SP7615_B 37
#define SP5615_B 38