Help getting status of cash drawer in Gambas

Post

Posted
Rating:
#1 (In Topic #803)
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
Reference https://reference.epso….php?content_id=124#gs_lr

Hi all,

The above page shows how I can get the status of the attached cash drawer on a Epson printer could someone please show me how it would convert into Gambas? I ask as I have a sort of working code in FreeBASIC but I am not sure as to how I can convert it to Gambas code.

Once this has been figure this out then all I need to do is work out how to process the status of the printer it self (that is normally low paper, cover open or offline)
Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Guru
cogier is in the usergroup ‘Guru’
 I have a sort of working code in FreeBASIC but I am not sure as to how I can convert it to Gambas code.

Please post the FreeBASIC code? That may help us to help you, as I suspect no one will have your printer to experiment on.
Online now: No Back to the top

Post

Posted
Rating:
#3
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’

cogier said

 I have a sort of working code in FreeBASIC but I am not sure as to how I can convert it to Gambas code.

Please post the FreeBASIC code? That may help us to help you, as I suspect no one will have your printer to experiment on.

Well it seems I do not have working code in FreeBASIC i have looked at all my Code projects and For some reason in the past
I removed the cash drawer support and now I can not find the code I did.

I am looking at my emails to see if I can find the email with the code on but I am sorry at this moment in time I do not have the code
Online now: No Back to the top

Post

Posted
Rating:
#4
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
I have finally found something from 2012 that was used to test the status of the cash drawer (and I am not sure if it works or not but
it should give a idea of what to do with the Epson code)

Code

Dim status As String
   
   Open COM "COM1:9600,N,8,1,CD0,CS0,DS0,rs" As #1
   
   Print #1, Chr(10) & Chr(4) & 1
   
   While Loc(1) =0
      Sleep 1
   Wend
   
   status = Input(Loc(1), 1)
   
   Print Bin(Val(status),8)
   
   If Bit(Val(status), 3) = -1 Then
      Print "Kickout connector high"
   Else
      Print "Kickout connector low"
   EndIf
   
   If Bit(Val(status), 4) = -1 Then
      Print "Offline"
   Else
      Print "Online"
   EndIf
   
   If Bit(Val(status), 6) = -1 Then
      Print "Waiting for Online Recovery"
   Else
      Print "Not Waiting for Online Recovery"
   EndIf
   
   If Bit(Val(status), 7) = -1 Then
      Print "Paper fed by button"
   Else
      Print "Paper not fed by button"
   EndIf
   
   Close #1


if i remember right it should get the status from the printer and load it into the location called status and then print this to the screen (example 00000000) this will change depending on the status of the printer (if the cash drawer is open then it should look something like this 00100000)

I hope this helps someone to point me in the right direction
Online now: No Back to the top

Post

Posted
Rating:
#5
Avatar
Guru
cogier is in the usergroup ‘Guru’
You should look at the code already put up for you here.

From that, you should be able to change the Sport SerialPort command using the details from your earlier code. Have a look in your /dev folder to get the correct name of your serial port.

Further help is available here.
Online now: No Back to the top
1 guest and 0 members have just viewed this.