@isaac-platform/isaac-integration-sdk
Version:
A Typescript SDK for integrating with ISAAC
40 lines (38 loc) • 1.73 kB
JavaScript
import isaacConnection from "./controller/isaac.js";
import * as isaacPanels from "./panels/index.js";
import * as isaacVariables from "./variables/index.js";
import * as isaacBackups from "./backups/index.js";
import * as isaacSchedule from "./schedule/index.js";
import * as isaacObjects from "./objects/index.js";
import { Heartbeat } from "./heartbeat.js";
class ISAACServer {
// public subsystem: isaacSubsystems.subsystemController
/* Pseudocode:
myIsaac.subsystems.nrDemo2.variables.update('temperature', 50);
myIsaac.variables.update('nrDemo2', 'temperature', 50);
myIsaac.subsystems.nrDemo2.variables.temperature.update(50); ????
The variables of a subsystem should be a subset of the main variables object such that they can be
updated in various "styles" without creating duplicate references which may become out of sync.
*/
constructor(ipAddress, moduleID, authToken) {
this.isActive = false;
this.isaacConn = new isaacConnection({
ip: ipAddress,
subsystemID: moduleID,
apiToken: authToken,
});
this.panels = new isaacPanels.panelController(this.isaacConn);
this.variables = new isaacVariables.variableController(this.isaacConn);
this.backups = new isaacBackups.backupController(this.isaacConn);
this.schedule = new isaacSchedule.scheduleController(this.isaacConn);
this.objects = new isaacObjects.objectController(this.isaacConn);
this.heartbeat = new Heartbeat(this);
}
}
class ISAAC {
static connection(ipAddress, moduleName, apiToken) {
return new ISAACServer(ipAddress, moduleName, apiToken);
}
}
export default ISAAC;
export { ISAACServer };