Classes
- ANTGateway
ANT Gateway API's main object.
In ANT framework, gateway provides sensor virtualization and DNN partitioning. Sensor virtualization means unifying interfaces to access physical sensors, soft sensors, local sensors, and remote sensors. DNN partitioning means executing a DNN on multiple heterogeneous devices. In real IoT systems, there are heterogeneous devices including gateway, but the single device among them cannot provide sufficient computational resources to DNNs. Therefore, DNN partitioning is required.
There are two ways to implement gateway in ANT framework.
- ML fragment element (Based on gstreamer)
- Virtual sensor (Based on OCF standard)
ML fragment element is an approach to extend the gstreamer to DNN partitioning. In this way, to associate a DNN with a physical sensor, the app developer must implement their own sensor sampling element that can be compatible to gstreamer.
Actually, many IoT devices does not use gstreamer-based approach, but use OCF standard. Therefore, we additionally provide virtual sensor, an approach based on OCF standard.
Virtual sensor is an abstract layer that provide unified interface of physical sensors, rule-based soft sensors, and DNN-based soft sensors (a.k.a. deep sensors). It also supports DNN partitioning on the deep sensors. To support that, ANT additionally provides DNN fragment engine and gateway manager.
- VirtualSensorAdapter
Virtual sensor adapter object. It is a module to arbitrate user and OCF thread and to organize virtual sensor system. This object can be created by using GatewayAPI.getVSAdapter().
- VirtualSensor
Virtual sensor object. It is a module to service virtual sensor through OCF resources and several JavaScript handlers. This object can be created by using VirtualSensorAdapter.createSensor().
- GatewayManager
Module to manage virtual sensors and DNN partitioning. This module must run on gateway device.
- VirtualSensorManager
module to manage virtual sensors. It discovers virtual sensors via OCF discovery message and associate the virtual sensors to form a sensor data pipeline for the IoT applications.
- DFEScheduler
DFE Scheduler object. It is a module to manage DNN partitioning. It monitors the current status of DFEs running on several devices and make commands to control DFE's partitioning points. (Not yet implemented)
- GatewayClient
Gateway client.
ANTGateway
ANT Gateway API's main object.
In ANT framework, gateway provides sensor virtualization and DNN partitioning. Sensor virtualization means unifying interfaces to access physical sensors, soft sensors, local sensors, and remote sensors. DNN partitioning means executing a DNN on multiple heterogeneous devices. In real IoT systems, there are heterogeneous devices including gateway, but the single device among them cannot provide sufficient computational resources to DNNs. Therefore, DNN partitioning is required.
There are two ways to implement gateway in ANT framework.
- ML fragment element (Based on gstreamer)
- Virtual sensor (Based on OCF standard)
ML fragment element is an approach to extend the gstreamer to DNN partitioning. In this way, to associate a DNN with a physical sensor, the app developer must implement their own sensor sampling element that can be compatible to gstreamer.
Actually, many IoT devices does not use gstreamer-based approach, but use OCF standard. Therefore, we additionally provide virtual sensor, an approach based on OCF standard.
Virtual sensor is an abstract layer that provide unified interface of physical sensors, rule-based soft sensors, and DNN-based soft sensors (a.k.a. deep sensors). It also supports DNN partitioning on the deep sensors. To support that, ANT additionally provides DNN fragment engine and gateway manager.
Kind: global class
new ANTGateway()
The constructor of ANT Gateway API object.
antGateway.createImgClsImagenetElement(modelPath, numFragments, targetUri) ⇒ Object
Create a ML fragment element that runs a image classificaiton model trained with ImageNet dataset. It is the first way to perform gateway-centric DNN partitioning. It internally uses gstreamer.
Kind: instance method of ANTGateway
Returns: Object
- a new ML fragment element for the ML model
Param | Type | Description |
---|---|---|
modelPath | String |
the path of image classification model |
numFragments | Number |
the number of fragments |
targetUri | String |
the URI of target device that will be used for DNN partitioning |
antGateway.createDFE(modelName, numFragments) ⇒ Object
Create a DFE (DNN fragment engine) instance for the given model name and the number of fragments.
Kind: instance method of ANTGateway
Returns: Object
- a new DFE instance
Param | Type | Description |
---|---|---|
modelName | String |
the name of model to be executed by DFE |
numFragments | String |
the number of the model's fragments |
antGateway.getVSAdapter() ⇒ Object
Create a virtual sensor adapter. It is the second way to perform gateway-centric DNN partitioning. It internally uses OCF standard.
Kind: instance method of ANTGateway
Returns: Object
- virtual sensor adapter object
VirtualSensorAdapter
Virtual sensor adapter object. It is a module to arbitrate user and OCF thread and to organize virtual sensor system. This object can be created by using GatewayAPI.getVSAdapter().
Kind: global class
- VirtualSensorAdapter
- new VirtualSensorAdapter()
- .start()
- .stop()
- .createSensor(sensorName, sensorType, deviceType, observerHandler, generatorHandler, settingHandler)
- .createDeepSensor(sensorName, sensorType, deviceType, modelName, numFragments)
- .createGWManager() ⇒
Object
- .createGWClient() ⇒
Object
- .getOCFAdapter() ⇒
Object
- .getGWManager() ⇒
Object
- .getGWClient() ⇒
Object
- .findSensorByName(name) ⇒
Object
- .findSensorByUri(name) ⇒
Object
- .getResource(uri) ⇒
Object
- .addResource(resource)
new VirtualSensorAdapter()
The constructor of virtual sensor adapter.
virtualSensorAdapter.start()
Start the virtual sensor adapter. This function starts also OCF adapter managed by OCF API.
Kind: instance method of VirtualSensorAdapter
virtualSensorAdapter.stop()
Stop the virtual sensor adapter. This function stops also OCF adapter managed by OCF API.
Kind: instance method of VirtualSensorAdapter
virtualSensorAdapter.createSensor(sensorName, sensorType, deviceType, observerHandler, generatorHandler, settingHandler)
Create a new virtual sensor. Every virtual sensors can be discovered by using one of three keys; sensorName, sensorType and deviceType.
Kind: instance method of VirtualSensorAdapter
Param | Type | Description |
---|---|---|
sensorName | String |
the name of virtual sensor |
sensorType | String |
the sensor type of virtual sensor |
deviceType | String |
the device type of virtual sensor |
observerHandler | function |
(Optional) the observer handler function. It is called when a OCF client sends a request to the inlet of this virtual sensor. If you will not use observerHandler, you can use undefined for observerHandler. |
generatorHandler | function |
the generator handler function. It is called when a OCF client sends a request to the outlet of this virtual sensor. This parameter is mandatory. |
settingHandler | function |
(Optional) the setting handler function. It is called when a OCF client sends a request to the setting of this virtual sensor. If you will not use settingHandler, you can use undefined for settingHandler. |
virtualSensorAdapter.createDeepSensor(sensorName, sensorType, deviceType, modelName, numFragments)
Create a deep sensor for the given DNN model's name and the number of fragments.
Kind: instance method of VirtualSensorAdapter
Param | Type | Description |
---|---|---|
sensorName | String |
the name of virtual sensor |
sensorType | String |
the sensor type of virtual sensor |
deviceType | String |
the device type of virtual sensor |
modelName | String |
the name of DNN model to be executed by this virtual sensor |
numFragments | Number |
the number of the DNN model's fragments |
virtualSensorAdapter.createGWManager() ⇒ Object
It returns the singleton gateway manager. If the gateway manager is not initialized, the gateway manager will be created.
Kind: instance method of VirtualSensorAdapter
Returns: Object
- the singleton gateway manager
virtualSensorAdapter.createGWClient() ⇒ Object
It returns the singleton gateway client. If the gateway client is not initialized, the gateway client will be created.
Kind: instance method of VirtualSensorAdapter
Returns: Object
- the singleton gateway client
virtualSensorAdapter.getOCFAdapter() ⇒ Object
It returns the OCF adapter. If the OCF adapter is not initialized, it returns undefined.
Kind: instance method of VirtualSensorAdapter
Returns: Object
- the OCF adapter managed by the virtual sensor adapter
virtualSensorAdapter.getGWManager() ⇒ Object
It returns the singleton gateway manager. If the gateway manager is not initialized, it returns undefined.
Kind: instance method of VirtualSensorAdapter
Returns: Object
- the singleton gateway manager
virtualSensorAdapter.getGWClient() ⇒ Object
It returns the singleton gateway client. If the gateway client is not initialized, it returns undefined.
Kind: instance method of VirtualSensorAdapter
Returns: Object
- the singleton gateway client
virtualSensorAdapter.findSensorByName(name) ⇒ Object
Find the virtual sensor by sensor name.
Kind: instance method of VirtualSensorAdapter
Returns: Object
- the found virtual sensor object. If any virtual sensor
has not found, this function returns undefined.
Param | Type | Description |
---|---|---|
name | String |
the name of virtual sensor |
virtualSensorAdapter.findSensorByUri(name) ⇒ Object
Find the virtual sensor by URI.
Kind: instance method of VirtualSensorAdapter
Returns: Object
- the found virtual sensor object. If any virtual sensor
has not found, this function returns undefined.
Param | Type | Description |
---|---|---|
name | String |
the URI of virtual sensor |
virtualSensorAdapter.getResource(uri) ⇒ Object
Get an OCF resource managed by the virtual sensor adapter. The URI of the target OCF resource is given.
Kind: instance method of VirtualSensorAdapter
Returns: Object
- the OCF resource for the given URI. If any resource
for the URI is not found, this function returns undefined.
Param | Type | Description |
---|---|---|
uri | String |
the URI of the target OCF resource |
virtualSensorAdapter.addResource(resource)
Add an OCF resource to the virtual sensor adapter.
Kind: instance method of VirtualSensorAdapter
Param | Type | Description |
---|---|---|
resource | Object |
OCF resource to be added to the resource list of virtual sensor adapter. |
VirtualSensor
Virtual sensor object. It is a module to service virtual sensor through OCF resources and several JavaScript handlers. This object can be created by using VirtualSensorAdapter.createSensor().
Kind: global class
- VirtualSensor
- new VirtualSensor(sensorName, sensorType, deviceType, observerHandler, generatorHandler, settingHandler)
- .getName() ⇒
String
- .getUri() ⇒
String
- .getInletResource() ⇒
Object
- .getOutletResource() ⇒
Object
- .getSettingResource() ⇒
Object
- .getObserverHandler() ⇒
function
- .getGeneratorHandler() ⇒
function
- .getSettingHandler() ⇒
function
- .getObservers() ⇒
Array.<Object>
new VirtualSensor(sensorName, sensorType, deviceType, observerHandler, generatorHandler, settingHandler)
The constructor of virtual sensor.
Param | Type | Description |
---|---|---|
sensorName | String |
the name of virtual sensor |
sensorType | String |
the sensor type of virtual sensor |
deviceType | String |
the device type of virtual sensor |
observerHandler | function |
the observer handler function. |
generatorHandler | function |
the generator handler function. |
settingHandler | function |
the setting handler function. |
virtualSensor.getName() ⇒ String
Get the name of virtual sensor.
Kind: instance method of VirtualSensor
Returns: String
- the name of virtual sensor
virtualSensor.getUri() ⇒ String
Get the URI of virtual sensor.
Kind: instance method of VirtualSensor
Returns: String
- the URI of virtual sensor
virtualSensor.getInletResource() ⇒ Object
Get the inlet resource of virtual sensor.
Kind: instance method of VirtualSensor
Returns: Object
- the inlet resource of virtual sensor
virtualSensor.getOutletResource() ⇒ Object
Get the outlet resource of virtual sensor.
Kind: instance method of VirtualSensor
Returns: Object
- the outlet resource of virtual sensor
virtualSensor.getSettingResource() ⇒ Object
Get the setting resource of virtual sensor.
Kind: instance method of VirtualSensor
Returns: Object
- the setting resource of virtual sensor
virtualSensor.getObserverHandler() ⇒ function
Get the observer handler of virtual sensor.
Kind: instance method of VirtualSensor
Returns: function
- the observer handler of virtual sensor
virtualSensor.getGeneratorHandler() ⇒ function
Get the generator handler of virtual sensor.
Kind: instance method of VirtualSensor
Returns: function
- the generator handler of virtual sensor
virtualSensor.getSettingHandler() ⇒ function
Get the setting handler of virtual sensor.
Kind: instance method of VirtualSensor
Returns: function
- the setting handler of virtual sensor
virtualSensor.getObservers() ⇒ Array.<Object>
Get the observer list of virtual sensor.
Kind: instance method of VirtualSensor
Returns: Array.<Object>
- the observer list of virtual sensor
GatewayManager
Module to manage virtual sensors and DNN partitioning. This module must run on gateway device.
VirtualSensorManager
module to manage virtual sensors. It discovers virtual sensors via OCF discovery message and associate the virtual sensors to form a sensor data pipeline for the IoT applications.
DFEScheduler
DFE Scheduler object. It is a module to manage DNN partitioning. It monitors the current status of DFEs running on several devices and make commands to control DFE's partitioning points. (Not yet implemented)
GatewayClient
Gateway client.
Kind: global class
gatewayClient.getVirtualSensors(onResult) ⇒ Boolean
Send a request to gateway to retreive virtual sensor list
Kind: instance method of GatewayClient
Returns: Boolean
- the result of sending the request
Param | Type | Description |
---|---|---|
onResult | function |
callback function when the response came |
gatewayClient.associateVirtualSensors(sourceOutlet, sinkInlet, intervalMS, onResult) ⇒ Boolean
Send a request to gateway to associate two virtual sensors
Kind: instance method of GatewayClient
Returns: Boolean
- the result of sending the request
Param | Type | Description |
---|---|---|
sourceOutlet | Object |
the information about source outlet resource |
sinkInlet | Object |
the information about sink inlet resource |
intervalMS | Number |
the interval of sending GET request to the outlet Its unit is milliseconds. |
onResult | function |
callback function when the response came |