Class: DataSource

OSH.DataReceiver.DataSource

The DataSource is the abstract class used to create different datasources.

Constructor

(abstract) new DataSource(name, properties)

Parameters:
Name Type Description
name string

the datasource name

properties Object

the datasource properties

Properties
Name Type Description
timeShift boolean

fix some problem with some android devices with some timestamp shift to 16 sec

syncMasterTime boolean

defines if the datasource is synchronize with the others one

bufferingTime number

defines the time during the data has to be buffered

timeOut number

defines the limit time before data has to be skipped

protocol string

defines the protocol of the datasource. @see OSH.DataConnector.DataConnector

Source:

Methods

buildUrl(properties) → {string}

Builds the full url.

Parameters:
Name Type Description
properties object
Properties
Name Type Description
protocol string

the connector protocol

endpointUrl string

the endpoint url

service string

the service

offeringID string

the offeringID

observedProperty string

the observed property

startTime string

the start time (ISO format)

endTime string

the end time (ISO format)

replaySpeed number

the replay factor

responseFormat number

the response format (e.g video/mp4)

Source:
Returns:

the full url

Type
string

connect()

Connect the dataSource then the connector will be opened as well.

Source:

disconnect()

Disconnect the dataSource then the connector will be closed as well.

Source:

getId() → {string}

Gets the datasource id.

Source:
Returns:

the datasource id

Type
string

getName() → {*}

Gets the datasource name.

Source:
Returns:
Type
*

initDataSource(properties)

Inits the datasource with the constructor properties.

Parameters:
Name Type Description
properties
Source:

onData(data)

Parameters:
Name Type Description
data Object

the data object

Source:
Example
<p>data is represented as<br>data = {<br>   timeStamp: timeStamp // number<br>   data: data // data to render<br>};</p>

parseData(data) → {String|Object|number|ArrayBuffer|*}

The default timestamp parser

Parameters:
Name Type Description
data

the full data message returned by the connector

Source:
Returns:

data the formatted data

Type
String | Object | number | ArrayBuffer | *

parseTimeStamp(data) → {number}

The default timestamp parser

Parameters:
Name Type Description
data

the full data message returned by the connector

Source:
Returns:

the formatted timestamp

Type
number

Type Definitions

onMessage

The callback which receives data.

Source: