var bleApi = require('baseBleApi.js'); module.exports = { sendCommand: sendCommand } function sendCommand(params) { var defaults = { adviceId: "", sendCommend: "", onSuccessCallBack: function successCallBack(res) {}, onFailCallBack: function failCallBack(res) {}, onCompleteCallBack: function completeCallBack(res) {}, services: ["xxxxx-xxxxxxxxx-xxxxx"], writeServiceUUID: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx", notifyServiceUUID: "xxxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx", notifyCharacteristicUUID: "xxxxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxx", writeCharacteristicUUID: "xxxx-xxxx-xxxx-xxxx-xxxx" } var setParams = Object.assign(defaults, params) bleApi.writeCommend(setParams); }