0.1.0 • Published 10 years ago
m3d-capture v0.1.0
m3d-capture 
m3d-capture supports you to capture packets from micro 3d printer.
Dependency
pcap2 : Used for capturing packets
Intro
# Install
$ npm install --save-dev m3d-captureSample
import m3dcap from './m3d-capture';
m3dcap.on(m3dcap.EVENT_DATA_RECEIVE, (obj) => {
console.log(`# data recv serialnumber:${obj.serialnumber}`)
});
m3dcap.on(m3dcap.EVENT_JOB_START, (obj) => {
console.log('# started job')
});
m3dcap.on(m3dcap.EVENT_JOB_CHANGE_STATUS, (newStatus, oldStatus, obj) => {
console.log(`# changed job status ${oldStatus} => ${newStatus}`);
});
m3dcap.on(m3dcap.EVENT_JOB_FINISH, (obj) => {
console.log('# finished job')
});
m3dcap.on(m3dcap.EVENT_PRINTER_CHANGE_STATUS, (newStatus, oldStatus, obj) => {
console.log(`# changed printer status ${oldStatus} => ${newStatus}`);
});
m3dcap.run('lo0', {})Tips
Printer status transition
Idle > Ready > Idle > Printing > Ready > Executing > Idle > Executing
Job status transition
Nothing => Queued => Heating <=> Printing => Nothing