m3d-capture supports you to capture packets from micro 3d printer.
pcap2 : Used for capturing packets
# Install
$ npm install --save-dev m3d-capture
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', {})
Idle
> Ready
> Idle
> Printing
> Ready
> Executing
> Idle
> Executing
Nothing
=> Queued
=> Heating
<=> Printing
=> Nothing