Anonymous

Project:PizzaPrinter: Difference between revisions

From London Hackspace Wiki
Line 65: Line 65:


Bonus points for heat containment with flappy doors on each side, maybe even servo-operated doors.
Bonus points for heat containment with flappy doors on each side, maybe even servo-operated doors.
=== Oven ===
Should be doable with cheap ovens from Lidl, maybe toaster heater elements, to create a pizza-sized box of heat with two open sides.
Bonus points for heat containment with flappy doors on each side, maybe even servo-operated doors.
== Pizza API ==
Pseudo code for interacting programatically with the Pizza Printer.
There are two primitive objects:
# Printer object
# Pizza object
Both are independent but to actually print a pizza, a printer object is required.
=== Printer object ===
* Methods
==== new ====
Instantiates a new printer object.
Printer pr = new Printer();
==== list ====
Returns integer array with ids of available printers.
Printer pr = new Printer();
int arr[] = pr.list();
for(int i=0; i<arr.size(); i++)
  print "Available pizza network printer id = " + arr[i] + "\n";
==== bind ====
Arguments, printer id.
Binds printer object to specific printer.
pr.bind(''printerID'')
==== queue ====
Returns integer array with pizza ids waiting in queue.
Printer pr = new Printer();
pr.bind(''printerID'');
int arr[] = pr.queue();
for(int i=0; i<arr.size(); i++)
  print "Pizza id = " + arr[i] + " is the " + i + " in the queue for " + ''printerID''+ "\n";
=== Pizza object ===
* Methods
Instantiates a new printer object.
Pizza pz = new Pizza();
==== printer ====
Bind a pizza object to a printer object.
If called with no argument, returns printer object pizza object is bound to, if any.
Pizza pz = new Pizza();
Printer pr = new Printer();
pr.id(''printerID'');
pz.printer(pr);
==== id ====
Returns pizza object id.
int iPizzaID = pz.id();
==== layers ====
Returns string array with canonical pizza layers in ascending order.
Pizza pz = new Pizza();
string arr[] = pz.list();
for(int i=0; i<arr.size(); i++)
  print "Pizza layer " + i + " = " + arr[i] + "\n";
==== add_layer ====
Adds a layer to a pizza object.
Pizza pz = new Pizza();
pz.add_layer('crust');
pz.add_layer('mozzarella');
pz.add_layer('tomato');
pz.add_layer('oregano');
==== print ====
Put pizza object in printer queue.
pz.print();
==== ready ====
Returns boolean value on pizza print status.
if(pz.ready())
  print "Pizza " + pz.id() + " is ready at printer " + pz.printer() + "\n";
=== Examples ===
// Instantiate pizza object
Pizza pz = new Pizza();
// add layers
pz.add_layer("crust");
pz.add_layer("aubergine"); // throws warning, no aubergines available.
pz.add_layer("tomato");
pz.add_layer("oregano");
pz.print(); // throws warning, pizza not bound to printer
// Instantiate printer object
Printer pr = new Printer();
// bind to printer
pr.bind(''printerID'');
// bind pizza object to printer object
pz.printer(pr); 
// pool status
while(!pz.ready())
  ;
if(pz.ready())
  print "Pizza id " + pz.id() + " is ready at printer " + pz.printer();


== Why? ==
== Why? ==