React Native Sensie SDK.
Docs
Install via yarn. Link it and install dependencies for ios.
yarn add react-native-sensie-module
npx react-native link
cd ios && pod install
Import SensieEngine and CalibrationSession class.
import { SensieEngine } from "react-native-sensie-module";
Pass the generated token for Sensie SDK.
const s = new SensieEngine({accessToken: '[Token]'})
A method to establish a connection. It should return a promise that will tell us if the connection was successful.
await s.connect()
Also, canRecalibrate property will be set depending on stored sensies in storage.
calibrationSession = await s.startCalibration({
userId,
onEnds: (result) => {
}
})
result will be an object with a single property contains calibration strength.
const sensie = await calibrationSession.captureSensie({
flow,
onSensorData: (data) => {
}
})
sensie will be an object with the following properties:
- id: the id of the sensie
- whips: the number of whips
- valid: true if whips == 3
flow is boolean value(true or false)
onSensorData is a callback function that will be called every time we have new values from the sensors (optional)
data will be an object with the following properties:
- gyroX: the gyroscope X axis value
- gyroY: the gyroscope Y axis value
- gyroZ: the gyroscope Z axis value
- accelX: the accelerometer X axis value
- accelY: the accelerometer Y axis value
- accelZ: the accelerometer Z axis value
Reset storage if you want to recalibrate.
await s.resetCalibration();
await s.startEvaluation(userId) // creation of evaluation session
const sensie = await s.captureSensie({
userId,
onSensorData: (data) => {}, // (optional)
});
sensie object will be an object with the following properties:
- id: the id of the sensie but undefied yet.
- whips: the number of whips
- flowing: the result of the evaluation (true or false)
- setAgreement: Method for setting agreement. Sensie id will be set as soon as the agrement value is set. Agreement enum is included in the index.tsx.
enum Agreement {
Agree = 1,
Disagree = -1,
AgreeAfterReflecting = 2,
}
sensie.setAgreement(Agreement.Agree)
See the contributing guide to learn how to contribute to the repository and the development workflow.
Proprietary Software