Doodle3D-API/src/printerapi.js

36 lines
725 B
JavaScript
Raw Normal View History

2015-07-23 16:12:11 +02:00
import rest from './restapi.js';
2015-07-15 15:06:18 +02:00
export default class {
constructor (localIP) {
this.localIP = localIP;
this.api = `http://${localIP}/d3dapi/`;
}
temperature (callback) {
rest.get(this.api + 'printer/temperature', callback);
}
progress (callback) {
rest.get(this.api + 'printer/progress', callback);
}
state (callback) {
rest.get(this.api + 'printer/state', callback);
}
listAll (callback) {
rest.get(this.api + 'printer/listall', callback);
}
heatup (callback) {
rest.post(this.api + 'printer/heatup', {}, callback);
}
print (data, callback) {
rest.post(this.api + 'printer/print', data, callback);
}
stop (data, callback) {
rest.post(this.api + 'printer/stop', data, callback);
}
}