@iotile/iotile-cloud
Version:
A typescript library for interfacing with the IOTile Cloud API
60 lines • 2.16 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var page_1 = require("./page");
var DataPage = /** @class */ (function (_super) {
__extends(DataPage, _super);
function DataPage(url, thisPage, pageCount, stream) {
var _this = _super.call(this, url, thisPage, pageCount) || this;
_this.stream = stream;
_this.data = [];
return _this;
}
return DataPage;
}(page_1.Page));
exports.DataPage = DataPage;
var DataPoint = /** @class */ (function () {
function DataPoint(data) {
if (data === void 0) { data = {}; }
this.timestamp = new Date(data.timestamp);
if ('id' in data) {
this.id = data.id;
}
if ('stream' in data) {
// Only getData returns a stream slug
this.stream = data.stream;
}
if ('value' in data) {
// NewScheme: Value represents a number as per the Stream's VarType
this.value = data.value;
}
if ('int_value' in data) {
// OldScheme: We only store the raw number from the device
this.rawValue = data.int_value;
}
if ('output_value' in data) {
this.outValue = data.output_value;
}
if ('display_value' in data) {
this.displayValue = data.display_value;
}
if ('streamer_local_id' in data) {
this.incrementalId = data.streamer_local_id;
}
if ('dirty_ts' in data) {
this.dirtyTimestamp = data.dirty_ts;
}
}
return DataPoint;
}());
exports.DataPoint = DataPoint;
//# sourceMappingURL=datapoint.js.map