@iotile/iotile-device
Version:
A typescript library for interfacing with IOTile BLE devices
39 lines • 1.2 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var ShockInfo = /** @class */ (function () {
function ShockInfo(peakVal, peakAxis, duration, dVx, dVy, dVz) {
this.peakAxis = peakAxis;
// convert from mg/LSB to G
this.peakVal = peakVal * 0.049;
this.duration = duration;
// convert to m/s from 16.16 fixed point format
this.dVx = dVx / 65536.0;
this.dVy = dVy / 65536.0;
this.dVz = dVz / 65536.0;
}
Object.defineProperty(ShockInfo.prototype, "axis", {
get: function () {
var axisMap = {
0: 'X',
1: 'Y',
2: 'Z'
};
return axisMap[this.peakAxis];
},
enumerable: true,
configurable: true
});
Object.defineProperty(ShockInfo.prototype, "largestDeltaV", {
get: function () {
var max = Math.max(Math.abs(this.dVx), Math.abs(this.dVy), Math.abs(this.dVz));
return max * 39.3701;
},
enumerable: true,
configurable: true
});
return ShockInfo;
}());
exports.ShockInfo = ShockInfo;
;
;
//# sourceMappingURL=types.js.map