| | |
| | | import pwm from '../dxmodules/dxPwm.js' |
| | | import ntp from '../dxmodules/dxNtp.js' |
| | | import gpio from "../dxmodules/dxGpio.js" |
| | | import nfc from "../dxmodules/dxNfc.js" |
| | | import dxNfcCard from "../dxmodules/dxNfcCard.js" |
| | | import watchdog from "../dxmodules/dxWatchdog.js" |
| | | import dxGpioKey from "../dxmodules/dxGpioKey.js" |
| | | import net from "../dxmodules/dxNetwork.js" |
| | |
| | | driver.nfc = { |
| | | NFC_CARD_RECEIVE: "nfcCardReceive", |
| | | EID_RECEIVE: "eidReceive", |
| | | options: { m1: true, psam: false }, |
| | | init: function () { |
| | | if (!config.get('sys.nfc')) { |
| | | logger.debug("刷卡已关闭") |
| | | return |
| | | } |
| | | this.options.useEid = config.get("sys.nfcIdentityCardEnable") == 3 ? 1 : 0 |
| | | nfc.worker.beforeLoop(this.options) |
| | | dxNfcCard.init(); |
| | | }, |
| | | eidInit: function () { |
| | | if (!config.get('sys.nfc')) { |
| | | return |
| | | } |
| | | if (config.get("sys.nfcIdentityCardEnable") == 3) { |
| | | nfc.eidUpdateConfig({ appid: "1621503", sn: config.get("sys.sn"), device_model: config.get("sys.appVersion") }) |
| | | try { |
| | | dxNfcCard.eidInit({ config: { |
| | | device_model: dxDriver.DRIVER.MODEL |
| | | } }) |
| | | } catch (error) { |
| | | logger.error(error) |
| | | } |
| | | }, |
| | | eidActive: function (code) { |
| | |
| | | version: config.get("sys.appVersion"), |
| | | macAddr: config.get("sys.mac") |
| | | }; |
| | | return nfc.eidActive(options); |
| | | return dxNfcCard.eidActive(options); |
| | | }, |
| | | getConfig: function () { |
| | | return nfc.getConfig(); |
| | | return dxNfcCard.getConfig(); |
| | | }, |
| | | setConfig: function (options) { |
| | | nfc.updateConfig(options); |
| | | dxNfcCard.updateConfig(options); |
| | | }, |
| | | setCallbacks: function (callbacks) { |
| | | dxNfcCard.setCallbacks(callbacks); |
| | | }, |
| | | loop: function () { |
| | | if (!config.get('sys.nfc')) { |
| | | return |
| | | } |
| | | nfc.worker.loop(this.options) |
| | | dxNfcCard.loop(); |
| | | }, |
| | | } |
| | | |
| | | |
| | | driver.face = { |
| | | options: { |
| | | det_max: 1, |