Constructor
new ThingsController()
Properties:
| Name | Type | Attributes | Description |
|---|---|---|---|
things |
object.<ConsumedThing> | The property is the ConsumedThing id and the value is the ConsumedThing. |
|
currentThing |
object.<ConsumedThing> |
<nullable> |
The current consumed thing which is the thing that will be used by the methods. |
observedProperties |
object.<Array.<string>> | Contains all the observed properties where the key is the thing id and the value is all the observed properties. |
|
subscribedEvents |
object.<Array.<string>> | Contains all the subscribed event where the key is the thing id and the value is all the subscribed event. |
- Source:
Members
currentThingID :string
Get the current thing id.
Type:
- string
- Source:
currentThingTitle :string
Get the current thing title.
Type:
- string
- Source:
Methods
addCredential(username, password) → {void}
Add security credential to the currentThing.
Parameters:
| Name | Type | Description |
|---|---|---|
username |
string | |
password |
string |
- Source:
Returns:
- Type
- void
(async) consume(td)
Consume a thing description.
Parameters:
| Name | Type | Description |
|---|---|---|
td |
object | Thing description object. |
- Source:
Returns:
void
getActionForm(td) → {object}
Get the action interaction affordance object from the currentThing.
Parameters:
| Name | Type | Description |
|---|---|---|
td |
object | Thing description object. |
- Source:
Returns:
- Type
- object
getActions() → {Array.<string>}
Get all actions interaction affordance from the currentThing.
- Source:
Returns:
- Type
- Array.<string>
getEventDescription(event) → {string|undefined}
Get the description for an event.
Parameters:
| Name | Type | Description |
|---|---|---|
event |
string |
- Source:
Returns:
- Type
- string | undefined
getEvents() → {object}
Get all events interaction affordance from the currentThing.
- Source:
Returns:
- Type
- object
getEventsTD() → {object}
Get the object for all events from the currentThing.
- Source:
Returns:
- Type
- object
getEventTD(event) → {object}
get the event ob for the currentThing.
Parameters:
| Name | Type | Description |
|---|---|---|
event |
string | The event interaction affordance. |
- Source:
Returns:
- Type
- object
getMetadata() → {Array.<Array.<string>>}
return the metadata for the currentThing.
- Source:
Returns:
- Type
- Array.<Array.<string>>
getPropertiesTD() → {object}
Get the object for all properties from the currentThing.
- Source:
Returns:
- Type
- object
getPropertyDescription(property) → {string|undefined}
Get the description for a property.
Parameters:
| Name | Type | Description |
|---|---|---|
property |
string |
- Source:
Returns:
- Type
- string | undefined
getPropertyTD(property) → {object}
get the property interaction affordance object from the currentThing.
Parameters:
| Name | Type | Description |
|---|---|---|
property |
string | The property interaction affordance. |
- Source:
Returns:
- Type
- object
getReadableProperties() → {Array.<string>}
Get all the readable properties.
- Source:
Returns:
- Type
- Array.<string>
getToplevelForms() → {object}
get op(s) for the top level form for the currentThing.
- Source:
Returns:
- Type
- object
getTopLevelFormTD(property) → {object}
get the top level form object for the currentThing.
Parameters:
| Name | Type | Description |
|---|---|---|
property |
"readallproperties" | "readmultipleproperties" | "writeallproperties" | "writemultipleproperties" | The top level form type |
- Source:
Returns:
- Type
- object
getUriVariables(affordance, interactionAffordance) → {object}
Get the uriVariables object from the TD for the specified affordance and interactionAffordance for the currentThing.
Parameters:
| Name | Type | Description |
|---|---|---|
affordance |
"properties" | "actions" | "events" | |
interactionAffordance |
string |
- Source:
Returns:
- Type
- object
getWritableProperties() → {Array.<string>}
Get all the writable properties.
- Source:
Returns:
- Type
- Array.<string>
hasCurrentThing() → {boolean}
Returns false if the this.#currentThing is null and true otherwise.
- Source:
Returns:
- Type
- boolean
hasSecurity() → {boolean}
Returns false if the this.#currentThing has nosec_sc
- Source:
Returns:
- Type
- boolean
hasUriVariables(affordance, interactionAffordance) → {boolean}
Returns true if the this.#currentThing has uriVariables.
Parameters:
| Name | Type | Description |
|---|---|---|
affordance |
"properties" | "actions" | "events" | |
interactionAffordance |
string |
- Source:
Returns:
- Type
- boolean
(async) invokeAction(action, payload, uriVariables) → {*}
Parameters:
| Name | Type | Description |
|---|---|---|
action |
string | |
payload |
* | |
uriVariables |
object |
- Source:
Returns:
- Type
- *
isEventSubscribed(event) → {boolean}
Parameters:
| Name | Type | Description |
|---|---|---|
event |
string | The event interaction affordance. |
- Source:
Returns:
- Type
- boolean
isPropertyObservable(property) → {boolean}
Parameters:
| Name | Type | Description |
|---|---|---|
property |
string | The property interaction affordance. |
- Source:
Returns:
- Type
- boolean
isPropertyObserved(property) → {boolean}
Parameters:
| Name | Type | Description |
|---|---|---|
property |
string | The property interaction affordance. |
- Source:
Returns:
- Type
- boolean
isPropertyReadable(property) → {boolean}
Parameters:
| Name | Type | Description |
|---|---|---|
property |
string | The property interaction affordance. |
- Source:
Returns:
- Type
- boolean
isPropertyWritable(property) → {boolean}
Parameters:
| Name | Type | Description |
|---|---|---|
property |
string | The property interaction affordance. |
- Source:
Returns:
- Type
- boolean
observeProperty(property) → {object.<status:boolean, data:string>}
Parameters:
| Name | Type | Description |
|---|---|---|
property |
string | The property interaction affordance. |
- Source:
Returns:
- Type
- object.<status:boolean, data:string>
(async) readAllProperties() → {*}
- Source:
Returns:
- Type
- *
(async) readMultipleProperties() → {object}
- Source:
Returns:
- Type
- object
(async) readProperty(property, uriVariables) → {*}
Parameters:
| Name | Type | Description |
|---|---|---|
property |
string | |
uriVariables |
object |
- Source:
Returns:
- Type
- *
securityType() → {string|undefined}
Get the security type for the currentThing.
- Source:
Returns:
- Type
- string | undefined
setCurrentThingByID(id)
Change the current Thing.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string |
- Source:
subscribeEvent(event)
Parameters:
| Name | Type | Description |
|---|---|---|
event |
string |
- Source:
(async) unobserveProperty(property)
Parameters:
| Name | Type | Description |
|---|---|---|
property |
string | The property interaction affordance. |
- Source:
unsubscribeEvent(event)
Parameters:
| Name | Type | Description |
|---|---|---|
event |
string |
- Source:
(async) writeAllProperties(properties) → {object.<status:boolean, data:string>}
Parameters:
| Name | Type | Description |
|---|---|---|
properties |
Array.<string> | All properties. |
- Source:
Returns:
- Type
- object.<status:boolean, data:string>
(async) writeMultipleProperties(properties) → {object.<status:boolean, data:string>}
Parameters:
| Name | Type | Description |
|---|---|---|
properties |
Array.<string> |
- Source:
Returns:
- Type
- object.<status:boolean, data:string>
(async) writeProperty(property, value, uriVariables) → {object.<status:boolean, data:string>}
Parameters:
| Name | Type | Description |
|---|---|---|
property |
string | |
value |
* | |
uriVariables |
object |
- Source:
Returns:
- Type
- object.<status:boolean, data:string>