0.3.2 • Published 3 years ago

ecg-at-ipc v0.3.2

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

英语答题器 IPC 工具

安装

npm i ecg-at-ipc
const createIpc = require('ecg-at-ipc')

const ipc = createIpc('ss-answer-tool-D27DFDD9-E25D-4976-A4D3-6179C2000B4C')

ipc.on('err', err => {
  console.log('error', err)
})

ipc.on('connect', () => {
  let o = {
    "command": "init",
    "preferred-device-type": "any"
  };
  ipc.sendCommand(2018, JSON.stringify(o));
})

ipc.on('command', (cmd, str) => {
  console.log(cmd, str)

  let o = JSON.parse(str);
  if (!o.ready) {
    fs.writeFileSync(Date.now()+'.text', JSON.stringify(o));
  } else {
    console.log("OK everything is good!");
  }
})

// 结束ipc
ipc.end()

命名管道名称

命名管道目前固定为以下名称,用于在 windows 系统中与 答题器 sdk 做 ipc 通信

ss-answer-tool-D27DFDD9-E25D-4976-A4D3-6179C2000B4C

参考资料