Moving a function.

This commit is contained in:
Evelyn Eastmond 2018-08-14 13:45:55 -04:00
parent 13edf16caa
commit 9fb522b3ff

View file

@ -512,6 +512,18 @@ class WeDo2 {
}); });
} }
/**
* Write a message to the device BLE session.
* @param {number} uuid - the UUID of the characteristic to write to
* @param {Uint8Array} message - the message to write.
* @return {Promise} - a promise result of the write operation
* @private
*/
_send (uuid, message) {
if (!this.getPeripheralIsConnected()) return;
return this._ble.write(UUID.IO_SERVICE, uuid, message, 'base64');
}
/** /**
* Process the sensor data from the incoming BLE characteristic. * Process the sensor data from the incoming BLE characteristic.
* @param {object} base64 - the incoming BLE data. * @param {object} base64 - the incoming BLE data.
@ -556,18 +568,6 @@ class WeDo2 {
} }
} }
/**
* Write a message to the device BLE session.
* @param {number} uuid - the UUID of the characteristic to write to
* @param {Uint8Array} message - the message to write.
* @return {Promise} - a promise result of the write operation
* @private
*/
_send (uuid, message) {
if (!this.getPeripheralIsConnected()) return;
return this._ble.write(UUID.IO_SERVICE, uuid, message, 'base64');
}
/** /**
* Clear the sensor or motor present at port 1 or 2. * Clear the sensor or motor present at port 1 or 2.
* @param {number} connectID - the port to clear. * @param {number} connectID - the port to clear.