Package Exports
- tactilus-mat-status
- tactilus-mat-status/app.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (tactilus-mat-status) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
tactilus-mat-status
tactilus-mat-status
is a lightweight and efficient library designed to analyze data from the Tactilus sensor mat and determine the user's body position in real-time.
Features Detects the following positions on the mat:
- Standing
- Lying Down
- In Motion
- Falling Down
- No One on the Mat
Installation
Install Tactilus mat status with npm
npm install tactilus-mat-status
const { EventSource } = require("eventsource")
const { getStatusFromMatSensors } = require("./app")
const es = new EventSource('http://10.0.0.1/api/sse');
const url = "http://10.0.0.1/api/frequency";
const maxFramesToKeep = 10;
fetch(url, {
headers: {
"content-type":
"application/x-www-form-urlencoded; charset=UTF-8",
},
body: (
3 * 3600
).toString(),
method: "put",
}).then(res=>{
const frames = [];
es.addEventListener('newframe', function (e) {
const pressureMatrix = JSON.parse(e.data);
const currentFrame = pressureMatrix.readings[0];
frames.push(currentFrame);
if (frames.length > maxFramesToKeep) {
frames.shift();
}
if (frames.length === maxFramesToKeep) {
console.log(getStatusFromMatSensors(frames));
}
});
})