Skip to content

Commit

Permalink
Use an Accept header to indiate what kind of data we want.
Browse files Browse the repository at this point in the history
This should let the server do two things:

1) Support different printers
2) Support different modes on printers (text vs bitmap; raw byte stream vs bitmap image to be parsed.
  • Loading branch information
lazyatom committed Apr 6, 2012
1 parent 29acb57 commit 50798dd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion printer.ino
Expand Up @@ -11,8 +11,9 @@
const char *printerId = "abcdef123456"; // the unique ID for this printer.
byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0x86, 0x67 }; // physical mac address

const char* host = "printer.gofreerange.com";
const char *printerType = "A2-bitmap"; // controls the format of the data sent from the server

const char* host = "printer.gofreerange.com"; // the host of the backend server
const unsigned int port = 80;
const unsigned long pollingDelay = 10000; // delay between polling requests (milliseconds)

Expand Down Expand Up @@ -99,6 +100,7 @@ void checkForDownload() {
digitalWrite(downloadLED, HIGH);
client.print("GET "); client.print("/printer/"); client.print(printerId); client.println(" HTTP/1.0");
client.print("Host: "); client.print(host); client.print(":"); client.println(port);
client.print("Accept: application/vnd.freerange.printer."); client.println(printerType);
client.println();
boolean parsingHeader = true;
#ifdef DEBUG
Expand Down

0 comments on commit 50798dd

Please sign in to comment.