@iotile/iotile-cloud
Version:
A typescript library for interfacing with the IOTile Cloud API
90 lines (89 loc) • 3.39 kB
TypeScript
import { Variable, VariableDictionary } from "./variable";
import { Stream } from "./stream";
import { Device } from "./device";
import { SensorGraph, SensorGraphDictionary } from "./sensorgraph";
import { Property, PropertyDictionary } from "./property";
import { ProjectOverlay } from "../cloud/project-overlay";
import { DataPoint } from "./datapoint";
import { Unit } from "./unit";
import { Org } from "./org";
import { Mdo } from "./mdo";
import { ProjectTemplate, ProjectTemplateDictionary } from "./projecttemplate";
export declare class Project {
[key: string]: any;
id: string;
gid: string;
name: string;
createdBy: string;
createdOn: Date;
orgSlug: string;
slug: string;
rawData: any;
org?: Org;
template: string;
projectTemplate?: string;
projTemplateMap: ProjectTemplateDictionary;
variables: Array<Variable>;
variableMap: VariableDictionary;
sensorGraphs: Array<SensorGraph>;
sensorGraphMap: SensorGraphDictionary;
devices: Array<Device>;
private deviceMap;
streams: Array<Stream>;
private streamMap;
overlay: ProjectOverlay;
properties: Array<Property>;
propertyMap: PropertyDictionary;
counts: {
[index: string]: number;
};
constructor(data?: any);
private toJson;
serialize(): any;
static Unserialize(obj: {
[key: string]: any;
}): Project;
addDevices(devices: Array<Device>): void;
addStreams(streams: Array<Stream>): void;
removeDevice(slug: string): Device;
addStream(stream: Stream): void;
addSensorGraphs(sg: Array<SensorGraph>): void;
addSensorGraph(sg: SensorGraph): void;
getSensorGraph(slug: string): SensorGraph;
addProjectTemplates(templates: Array<ProjectTemplate>): void;
getProjectTemplate(): ProjectTemplate;
addVariables(variables: Array<Variable>): void;
addVariable(variable: Variable): void;
getVariable(slug: string): Variable | undefined;
getVariableForStream(slug: string): Variable | undefined;
getDevice(slug: string, unmodified?: boolean): Device | null;
deviceModified(slug: string): boolean;
hasDevice(slug: string): boolean;
getStream(slug: string, unmodified?: boolean): Stream | null;
streamsForDevice(deviceSlug: string, filterByIOInfo?: boolean): {
[key: string]: Stream;
};
getSensorGraphSlugs(): string[];
applyOverlay(overlay: ProjectOverlay): void;
addProperties(properties: Array<Property>): void;
getProperty(name: string): Property;
computeInputValue(stream: Stream, rawValue: number, mdo?: Mdo): number;
getInputUnits(stream: Stream): Unit | null;
getOutputUnits(stream: Stream): Unit | null;
computeValue(stream: Stream, data: DataPoint): number | undefined;
computeOutputValue(stream: Stream, value: number): number;
/**
*
* @description
* Given a DataPoint with a .rawValue, compute
* value using the stream.mdo and stream.inputUnit
* Then compute outValue using the stream.outputUnit
* Finally, DisplayValue represents the string version of outValue
*
* @param {DataPoint} dataPoint should have rawValue defined
* @param {Stream} stream is the stream to use to get input/output units
*
* @returns {DataPoint} Modified dataPoint
*/
processDataPoint(stream: Stream, dataPoint: DataPoint): DataPoint;
}