Class: DataReceiverController

OSH.DataReceiver. DataReceiverController

This class is responsible of handling datasources. It observes necessary events to manage datasources.

new OSH.DataReceiver.DataReceiverController()

Listens to Events:
  • OSH.EventManager.EVENT.event:CONNECT_DATASOURCE
  • OSH.EventManager.EVENT.event:DISCONNECT_DATASOURCE
  • OSH.EventManager.EVENT.event:DATASOURCE_UPDATE_TIME
Example

var datasource = new OSH.DataReceiver... // creates OSH.DataReceiver.<>

// creates controller
var dataProviderController = new OSH.DataReceiver.DataReceiverController({
replayFactor : replayFactor
});

// adds datasource to controller
dataProviderController.addDataSource(weatherDataSource);

// and/or adds entity to controller
var entity = {
id : "entity-"+OSH.Utils.randomUUID(),
name: "Some entity",
dataSources: [datasource]
};

dataProviderController.addEntity(entity);

Methods

addDataSource(dataSource, options)

Adds a dataSource to the current list of datasources and pushes it into the buffer.

Name Type Description
dataSource Object

the datasource to add

options

@deprecated

See:

addEntity(dataSource, options)

Adds a entity to the current list of datasources and pushes it into the buffer.

Name Type Description
dataSource Object

the datasource to add

options

@deprecated

See:

Connects each connector

Instantiates a new OSH.Buffer OSH.Buffer

updateDataSourceTime(id, startTime, endTime)

Updates the datasource time range.

Name Type Description
id

the datasource id

startTime

the start time

endTime

the end time