metawear-capacitor
Capacitor plugin for metawear's swift sdk.
Install
npm install metawear-capacitor
npx cap sync
API
connect()
disconnect()
startData()
startAccelData()
startGyroData()
stopData()
downloadData()
stopLogs()
connect()
connect() => Promise<null>
Connects to the metawear sensor.
Returns: Promise<null>
disconnect()
disconnect() => Promise<null>
Disconnect metawear sensor.
Returns: Promise<null>
startData()
startData() => Promise<null>
Start accel and gryo data streaming and on-board logging.
Returns: Promise<null>
startAccelData()
startAccelData() => Promise<null>
Start accel data streaming and on-board logging.
Listen in JS for the logging ID with: MetawearCapacitor.addListener('accelLogID', (logID) -> { ... });
Listen in JS with: MetawearCapacitor.addListener('accelData', (accel) => { ... });
Returns: Promise<null>
startGyroData()
startGyroData() => Promise<null>
Start gyro data streaming and on-board logging.
Listen in JS for the logging ID with: MetawearCapacitor.addListener('gyroLogID', (logID) -> { ... });
Listen in JS for data stream with: MetawearCapacitor.addListener('gyroData', (gyro) => { ... });
Returns: Promise<null>
stopData()
stopData() => Promise<null>
Stop data streaming and on-board logging.
Returns: Promise<null>
downloadData()
downloadData() => Promise<null>
Downloads one of the two logs from the metawear sensor.
Listen in JS for the log data with: MetawearCapacitor.addListener('logData-ID', (logData) -> { ... }); (logData["x"], logData["y"], logData["z"] are floats.)
Listen in JS for the log progress with: MetawearCapacitor.addListener('logProgress-ID', (progress) -> { ... }); (progress["progress"] is a number between 0 and 1.)
Listen in JS for log finish with: MetawearCapacitor.addListener('logFinished-ID', () => { ... });
Returns: Promise<null>
stopLogs()
stopLogs() => Promise<null>
Stop on-board logging.
Returns: Promise<null>