The API definition
So I have got my software stack on a drawing board, next is to make it happen with actual code. RestFul API requests are defined in JSON format:// this is the very 1st API definition, print out something to a remote printer { "sid" :"asdfasdf", "secret" :"13wd23d2323r", "apiversion" :"2014-01-01", "service" :"submit", "parameter" :{ "printerid" :"asdf2323wd2e", "title" :"xxxxxxx", "content" :"xxxxxxx", "contentType" :"PLAINTEXT" } } // Response { "jobid" :"xxxx", "status":"ok", // in progress, fail, ... "printerid" :"xxxx" }
Will update the progress soon....
*Edit 2013-12-27
I have been working on this thing during the holiday season. The rough framework code for public API has been setup as follows:Public facing software stack: Centos + Nginx + PHP + mySQL + GearMan
PHP libraries are:
- Luracast Restler - the framework handles RESTful requests
- Idiorm - ActiveRecord library. (When I am too lazy to write real SQL queries)
- Whole bunch of PHP utility functions I wrote in the past.
- Print API data is strictly structured, saved to database as json encoded string.
- RESTful, no state between requests.
- The API will return right after been fired. (before the actual printer output is finished)
- Client Callback url for job status update.
For the actual worker process that handles individual request processing, I might consider something runs on top of libev as daemon. Could be Node.js or Python Twisted, will leave that for later decision.
*Side note: I am thinking about opensource the entire thing on Github, anyone interested?
If someone can help manage the repo, I'll make it happen.
I'm an amateur developer and would love to get access to this code for a small hobby project of mine which involves the adafruit thermal printer and a raspberry pi. If you did put it on github I would do what I could to help :) cheers Stan
ReplyDeleteHi Stan, Thanks for your interest in the project! I will definitely let you know when it is ready for a alpha release. Right now the code is not quite ready because it still miss a few important function: security, user validation, printer management etc...
DeleteHi Stan and Reed! We would love to contribute to this open source project. For brake rotors in our shop, we need a solution that prints a small pick-pack receipt after a customer or salesperson places an order. Gets order from Ruby-on-Rails app in the cloud and then sends a simple receipt print command to this type of device. We are very interested in this. We are also building a process control solution using PubNub, and I think it would work well for this application to signal when something needs to be printed...
DeleteHi Prescott, I am happy to see you find value in this project. But the bad news is, the code base has never been completed to a state that could be opened. I have stopped working on it a while ago.
DeleteBut with the information on this blog, you should be able to easily make such a printer yourself. I wish you good luck with your project.
Reed
Have you done a transaction from your Blockchain account but with the wrong address? This error is a massive one and is quite difficult to undo this process. Well, you can be relaxed as the team of experts who are active around the clock and have all the methodologies to deal with the errors and you can ask for stepwise Blockchain Support NUmber assistance so that it would be easy to erase all errors. Just take the phone and dial Blockchain customer support number and get the required solutions in the least possible time.
ReplyDeleteThanks for taking the time to discuss about this, I feel strongly about this and so really like to get more about this kind of field. Wonderful stuff to read and I am so delighted to find this valuable article that is amazingly. Recommend that you can buy Printer at MUNBYN, POS Thermal Printer, Handheld Barcode Scanner
ReplyDelete