Pyramid API Released
Updated 5/14/2015! Java API Released
The PTI engineering team is super excited to announce the release update of their new bill validator API. Our goal is to provide you, the developer, with all of the tools you require in order to make awesome things. We have also put together a few samples to demonstrate the power of these APIs that we hope you will find inspiring. All you need is a copy of PTalk.jar, a Pyramid bill validator, and a serial connection to your PC to get started.
Download documentation
Available on Maven (com.pyramidacceptors:jPyramid-RS-232)
Or Download library (jar)
Neat Stuff
For our first round of APIs we have targetted the Java platform. Entrepreneurs and developers work on all platforms so we believe that our tools should be held to the same standard. With the library you will be able to develop desktop, console, and web applications without having to hassle with cross-platform drivers.
Basic Example
The simplest example can be constructed with just two lines of code.
- Instantiate a PyramidAcceptor
- Connect
- Done!
...
// Create instance of bill acceptor and attempt to autodetect the device
PyramidAcceptor acceptor = PyramidAcceptor.valueOfRS232();
// Connect! this handles all the hand shaking and starts up the acceptor
acceptor.connect();
...
</em>
Of course, this is just a basic example. You are free to specify your own port name, port configuration, and even configure event handlers.
Feature-rich Example
In this example we set a custom baud, databit, stopbit, parity, and port name. We also show the ability to change the polling rate and alter the bill enable disable pattern. This allows the master to block certain denominations from accepting.
...
// Create instance of bill acceptor
acceptor = PyramidAcceptor.valueOfRS232(RS232Configuration.INSTANCE,
"COM4", APIConstants.BAUDRATE_9600, APIConstants.DATABITS_7,
APIConstants.STOPBITS_1, APIConstants.PARITY_EVEN);
// Connect! this handles all the handsahking
acceptor.connect();
// Set poll rate to 50 ms
acceptor.setPollRate(50);
// Enable only bills 1 and 2
RS232Configuration.INSTANCE.setEnableMask(0x3);
...
The demonstrates the configuration parameters for a PyramidAcceptor object as well as the bill enable masking.
Applet Sample
With the example we demonstrate a simple applet that charges money for access to a service. In this case it is a silly count bot that counts words on a web page. With a little time you could adapt this to create a kiosk that serves YouTube videos, music, or any other timed service that you would like to sell
Desktop Sample
This is a more traditional example based on a JFrame. This simply enables the bill validator and reports and event or state change. This sample is good for debugging your application to ensure that your product idea will be rock-solid.
Your Input Welcome
Here at Pyramid Technologies we value customer ideas and innovation.
If you require a functionality that our API is not providing, feel free to let us know.
Comments Section
Feel free to comment on the post but keep it clean and on topic.
blog comments powered by Disqus