module.exports = { getMacByDeviceId: getMacByDeviceId, getMacBySplitDeviceId: getMacBySplitDeviceId, getDeviceMacId: getDeviceMacId, getResponseByDeviceId: getResponseByDeviceId, getResponseByDeviceMacId: getResponseByDeviceMacId, } ///获取设备mac相关 macId: deviceId.split(lexin_devices.leXinÏ)[1] function getMacBySplitDeviceId(splitDeviceId) { if (splitDeviceId.length < 12) { return splitDeviceId; } return splitDeviceId.slice(-12); }; function getMacByDeviceId(deviceId) { const lexin_devices = require('../lexin/devices'); var splitDeviceId = deviceId.split(lexin_devices.leXin); if (splitDeviceId.length != 2) { return ""; } return getMacBySplitDeviceId(splitDeviceId[1]); }; ///获取设备mac相关 function getDeviceMacId(deviceId) { const lexin_devices = require('../lexin/devices'); var splitDeviceId = deviceId.split(lexin_devices.leXin); if (splitDeviceId.length != 2) { return ""; } var mac = getMacBySplitDeviceId(splitDeviceId[1]); return `AIrSMArT_${mac}` }; ///通过设备id获取mac地址 function getResponseByDeviceId(deviceId) { var deviceMacId = getDeviceMacId(deviceId); return getResponseByDeviceMacId(deviceMacId); }; ///通过mac地址过去请求 /AIrSMArT_7cdfa1fd3af0/user/pub_response function getResponseByDeviceMacId(deviceMacId) { return `/${deviceMacId}/user/pub_response`; };