Import Files advice

Post

Posted
Rating:
#1 (In Topic #1053)
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
Hello to all you super smart people out there,

I need to ask you all a question

I am trying to work out how to pull in some Java Drivers into my EPoS application

The Demo  I was reading said I need to do this

Code (gambas)

  1. import "jpos.JposException"
  2. import "jpos.POSPrinter"
  3. import "jpos.util.JposPropertiesConst"
  4.  
  5. import "java.time.Duration"
  6. import "java.time.Instant"
  7.  

But When I try it says Missing As and the cursor is at the end of the first Line

This is what I am trying to run

Code (gambas)

  1.    Dim f As File = New File("/algPoS/algPoS.xml")
  2.    
  3.  
  4.     System.setProperty(JposPropertiesConst.JPOS_POPULATOR_FILE_PROP_NAME, f.getAbsolutePath());
  5.     / / System.getProperties().list(System.out);
  6.    
  7.     FiscalPrinter fiscalPrinter = New FiscalPrinter();
  8.  
  9.     'This will print a recpit to the PoS printer via the JavaPoS Drivers
  10.     POSPrinterControl113 printer = (jpos.POSPrinterControl113) New POSPrinter();
  11.     CashDrawerControl113 drawer = (CashDrawerControl113) New CashDrawer();
  12.  
  13.     Try
  14.         printer.open("POSPrinter")
  15.         printer.claim(1000)
  16.         printer.setDeviceEnabled(True)
  17.        
  18.      Catch (Exception e)
  19.         System.err.println("Printer deactivated " + e.getMessage())
  20.         printerdisabled = True
  21.         drawerdisabled = True
  22.         Return
  23.     End Try
  24.    
  25.     Try
  26.         drawer.open("CashDrawer")
  27.         drawer.claim(100)
  28.         drawer.setDeviceEnabled(True)
  29.      Catch (Exception e)
  30.         System.out.println("Cashdrawer deactivated: " + e.getMessage())
  31.         drawerdisabled = True
  32.         Return
  33.     End Try
  34.  

This is a JavaPoS Interface (allows me to talk to ANY printer from any manufacturer as long as they have JavaPoS Drivers for it and I don't need to know how to program it as the JavaPoS does that for me)

If I can get this to work I can add so meany new features to my application(s) and have some of my old trusted functions back (like Cash drawer status)

Anyone have any idea how I can get this small section to work I would be greatful.
Online now: No Back to the top

Post

Posted
Rating:
#2
Guru
BruceSteers is in the usergroup ‘Guru’
 Er, convert it into gambas code because it isn't.
Online now: No Back to the top

Post

Posted
Rating:
#3
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
 The import jpos.JposException For example bring function into the software that is provided by a JavaPoS API (I assume I would use the import or do I load them in a different way)

So how would I import the functions I need in to Gambas?

How do I use the JavaPoS API inside my Gambas Application>
Online now: No Back to the top

Post

Posted
Rating:
#4
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
ok I have done some updates to the code

I have changed the code that brings in the Libarys to

Code (gambas)

  1. Library "jpos.JposException"
  2. Library "jpos.POSPrinter"
  3. Library "jpos.util.JposPropertiesConst"
  4. Library "java.time.Duration"
  5. Library "java.time.Instant"
  6.  

and now I am getting unknow idenifier on the JposPropertiesConst section of

Code (gambas)

  1. System.setProperty(JposPropertiesConst.JPOS_POPULATOR_FILE_PROP_NAME, "/algPoS/algPoS.xml")

does anyone have any other idea as how to get this to work I feel i am getting close
Online now: No Back to the top

Post

Posted
Rating:
#5
Guru
BruceSteers is in the usergroup ‘Guru’
 System.setProperty() is not a gambas function

maybe you want Object.SetProperty() but probably not as it's not an object its a pointer to a library function.

Sorry i cannot help as i do not use external libraries at all.
Online now: No Back to the top

Post

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

BruceSteers said

System.setProperty() is not a gambas function

maybe you want Object.SetProperty() but probably not as it's not an object its a pointer to a library function.

Sorry i cannot help as i do not use external libraries at all.

I must be doing something as when I type jpos. I get a list of all the function that I can use but at run time I get a error at the JposPropertiesConst part

Sometime I wish I went back to my DOS Systems (but that was still buggy)
Online now: No Back to the top

Post

Posted
Rating:
#7
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
Well after a little bit of googling I have sort of managed to import the libarys into Gambas

But now when I run the program I get the following error

Code (gambas)

  1. POSPrinterControl113 posprinter = PoSPrinter.POSPrinterControl113 New RecipitPrinter
  2.  
at the NEW location I get "Not a Object in FMain.class"

Any idea's where to go now guys?

This is my Code

Code (gambas)

  1. Private JposException As Pointer Library "jpos.JposException"
  2. Private PoSPrinter As Pointer Library "jpos.POSPrinter"
  3. Private JposPropertiesConst As Pointer Library "jpos.util.JposPropertiesConst"
  4.  
  5. Public Sub btnOpenConnections_Click()
  6.  
  7.     'Object.SetProperty(JposPropertiesConst.JPOS_POPULATOR_FILE_PROP_NAME, "/algPoS/algPoS.xml", "")
  8.  
  9.     'This will print a recpit to the PoS printer via the JavaPoS Drivers
  10.     POSPrinterControl113 posprinter = PoSPrinter.POSPrinterControl113 New RecipitPrinter
  11.     'CashDrawerControl113 drawer = jpos.Printer.CashDrawerControl113 New CashDrawer
  12.  
Online now: No Back to the top

Post

Posted
Rating:
#8
Guru
BruceSteers is in the usergroup ‘Guru’

AndyGable said

Well after a little bit of googling I have sort of managed to import the libarys into Gambas

But now when I run the program I get the following error

Code (gambas)

  1. POSPrinterControl113 posprinter = PoSPrinter.POSPrinterControl113 New RecipitPrinter
  2.  
at the NEW location I get "Not a Object in FMain.class"

Any idea's where to go now guys?

to have 2 objects to the left of that assignment is not valid code

POSPrinterControl113 posprinter =

that's gotta be wrong and probably the error.
Online now: No Back to the top

Post

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

BruceSteers said

AndyGable said

Well after a little bit of googling I have sort of managed to import the libarys into Gambas

But now when I run the program I get the following error

Code (gambas)

  1. POSPrinterControl113 posprinter = PoSPrinter.POSPrinterControl113 New RecipitPrinter
  2.  
at the NEW location I get "Not a Object in FMain.class"

Any idea's where to go now guys?

to have 2 objects to the left of that assignment is not valid code

POSPrinterControl113 posprinter =

that's gotta be wrong and probably the error.


ive removed them and tried

Code (gambas)

  1. Dim PoSPrinterLocal as NEW PoSPrinter.POSPrinterControl113

but it is show me a error saying Unknown identifier 'PoSPrinter'


The JavaPoS works on Windows vb.net and C programming languages and they say it should work for other non Java languages as well
Online now: No Back to the top
1 guest and 0 members have just viewed this.