25 lines
636 B
JavaScript
25 lines
636 B
JavaScript
import Interrupt from '../src/interrupt-packet'
|
|
const delay = time => new Promise(res=>setTimeout(()=>res(),time))
|
|
|
|
let interrupts = new Interrupt([9,10,24],{id:'interrupt', mock:true, itrn:{path:'/opt/sockets/mcp.sock'}})
|
|
|
|
interrupts.interruptProcess = function (pin) {
|
|
let packet = {cmd:'pin.interrupt.find', pin:pin}
|
|
this.send(packet)
|
|
}
|
|
|
|
;
|
|
(async () => {
|
|
|
|
await interrupts.init()
|
|
interrupts.fire(9)
|
|
interrupts.fire(10)
|
|
interrupts.fire(24)
|
|
await delay(3000)
|
|
process.kill(process.pid, 'SIGTERM')
|
|
|
|
})().catch(err => {
|
|
console.error('FATAL: UNABLE TO START SYSTEM!\n',err)
|
|
// process.kill(process.pid, 'SIGTERM')
|
|
})
|