Catalog API
Version: 1.0.0
Status:
Catalog interface for Thunder framework.
(Defined with IValuePoint::ICatalog in IButler.h)
Table of Contents
Introduction
Scope
This document describes purpose and functionality of the Catalog interface (version 1.0.0). It includes detailed specification about its methods and properties as well as sent notifications.
Case Sensitivity
All identifiers of the interfaces described in this document are case-sensitive. Thus, unless stated otherwise, all keywords, entities, properties, relations and actions should be treated as such.
Acronyms, Abbreviations and Terms
The table below provides and overview of acronyms used in this document and their definitions.
| Acronym | Description |
|---|---|
| API | Application Programming Interface |
| HTTP | Hypertext Transfer Protocol |
| JSON | JavaScript Object Notation; a data interchange format |
| JSON-RPC | A remote procedure call protocol encoded in JSON |
The table below provides and overview of terms and abbreviations used in this document and their definitions.
| Term | Description |
|---|---|
| callsign | The name given to an instance of a plugin. One plugin can be instantiated multiple times, but each instance the instance name, callsign, must be unique. |
References
| Ref ID | Description |
|---|---|
| HTTP | HTTP specification |
| JSON-RPC | JSON-RPC 2.0 specification |
| JSON | JSON specification |
| Thunder | Thunder API Reference |
Description
Catalog JSON-RPC interface.
Methods
The following methods are provided by the Catalog interface:
Built-in methods:
| Method | Description |
|---|---|
| exists | Checks if a JSON-RPC method or property exists |
| register | Registers for an asynchronous JSON-RPC notification |
| unregister | Unregisters from an asynchronous JSON-RPC notification |
ValuePoint Catalog interface methods:
| Method | Description |
|---|---|
| resource | |
| resources |
exists method
Checks if a JSON-RPC method or property exists.
Description
This method will return True for the following methods/properties: valuePoint::identifier, valuePoint::bundle, valuePoint::condition, valuePoint::type, valuePoint::minimum, valuePoint::maximum, valuePoint::value, valuePoint::metadata, exists, register, unregister, resource, resources.
Parameters
| Name | Type | M/O | Description |
|---|---|---|---|
| params | object | mandatory | ... |
| params.method | string | mandatory | Name of the method or property to look up |
Result
| Name | Type | M/O | Description |
|---|---|---|---|
| result | boolean | mandatory | Denotes if the method exists or not |
Example
Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.exists",
"params": {
"method": "methodName"
}
}
Response
{
"jsonrpc": "2.0",
"id": 42,
"result": false
}
register method
Registers for an asynchronous JSON-RPC notification.
Description
This method supports the following event names: activated, deactivated, valuePoint::update, valuePoint::metadata.
Parameters
| Name | Type | M/O | Description |
|---|---|---|---|
| params | object | mandatory | ... |
| params.event | string | mandatory | Name of the notification to register for |
| params.id | string | mandatory | Client identifier |
Result
| Name | Type | M/O | Description |
|---|---|---|---|
| result | null | mandatory | Always null |
Errors
| Message | Description |
|---|---|
ERROR_FAILED_REGISTERED |
Failed to register for the notification (e.g. already registered) |
Example
Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.register",
"params": {
"event": "eventName",
"id": "myapp"
}
}
Response
{
"jsonrpc": "2.0",
"id": 42,
"result": null
}
unregister method
Unregisters from an asynchronous JSON-RPC notification.
Description
This method supports the following event names: activated, deactivated, valuePoint::update, valuePoint::metadata.
Parameters
| Name | Type | M/O | Description |
|---|---|---|---|
| params | object | mandatory | ... |
| params.event | string | mandatory | Name of the notification to register for |
| params.id | string | mandatory | Client identifier |
Result
| Name | Type | M/O | Description |
|---|---|---|---|
| result | null | mandatory | Always null |
Errors
| Message | Description |
|---|---|
ERROR_FAILED_UNREGISTERED |
Failed to unregister from the notification (e.g. not yet registered) |
Example
Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.unregister",
"params": {
"event": "eventName",
"id": "myapp"
}
}
Response
{
"jsonrpc": "2.0",
"id": 42,
"result": null
}
resource method
Parameters
| Name | Type | M/O | Description |
|---|---|---|---|
| params | object | mandatory | ... |
| params.id | integer | mandatory | ... |
Result
| Name | Type | M/O | Description |
|---|---|---|---|
| result | string (instance ID) | mandatory | ... |
Example
Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.resource",
"params": {
"id": 0
}
}
Response
{
"jsonrpc": "2.0",
"id": 42,
"result": "id1"
}
resources method
Parameters
This method takes no parameters.
Result
| Name | Type | M/O | Description |
|---|---|---|---|
| result | array | mandatory | ... |
| result[#] | integer | mandatory | ... |
Example
Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.resources"
}
Response
{
"jsonrpc": "2.0",
"id": 42,
"result": [
0
]
}
Properties
The following properties are provided by the Catalog interface:
ValuePoint Catalog interface properties:
| Property | R/W | Description |
|---|---|---|
| valuePoint::identifier | read-only | Each IValuePoint instance has a unique identifier that identifies the instance |
| valuePoint::bundle | read-only | If this IValuePoint belongs to a bundle that has multiple IValuePoints the id that identifies the bundle and the result will be Core::ERROR_NONE |
| valuePoint::condition | read-only | Current state/condition of this IValuePoint |
| valuePoint::type | read-only | Characteristics of this IValuePoint(IElement) |
| valuePoint::minimum | read-only | The minimum value this IValuePoint(IElement) can reach |
| valuePoint::maximum | read-only | The maximum value this IValuePoint(IElement) can reach |
| valuePoint::value | read/write | The current value of this IValuePoint |
| valuePoint::metadata | read-only | There most be more than meets the eye, report it as a JSON string |
valuePoint::identifier property
Provides access to the each IValuePoint instance has a unique identifier that identifies the instance. The value returned here return the unique ID of this IValuePoint.
This property is read-only.
Value
| Name | Type | M/O | Description |
|---|---|---|---|
| (property) | integer | mandatory | Each IValuePoint instance has a unique identifier that identifies the instance. The value returned here return the unique ID of this IValuePoint |
The valuepoint instance ID shall be passed within the method designator, i.e.
valuePoint#<valuepoint-id>::identifier.
Example
Get Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.valuePoint#id1::identifier"
}
Get Response
{
"jsonrpc": "2.0",
"id": 42,
"result": 0
}
valuePoint::bundle property
Provides access to the if this IValuePoint belongs to a bundle that has multiple IValuePoints the id that identifies the bundle and the result will be Core::ERROR_NONE. If it does not belong to a bundle, this call returns Core::ERROR_UNAVAILABLE,.
This property is read-only.
Value
| Name | Type | M/O | Description |
|---|---|---|---|
| (property) | integer | mandatory | If this IValuePoint belongs to a bundle that has multiple IValuePoints the id that identifies the bundle and the result will be Core::ERROR_NONE. If it does not belong to a bundle, this call returns Core::ERROR_UNAVAILABLE, |
The valuepoint instance ID shall be passed within the method designator, i.e.
valuePoint#<valuepoint-id>::bundle.
Example
Get Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.valuePoint#id1::bundle"
}
Get Response
{
"jsonrpc": "2.0",
"id": 42,
"result": 0
}
valuePoint::condition property
Provides access to the current state/condition of this IValuePoint.
This property is read-only.
Value
| Name | Type | M/O | Description |
|---|---|---|---|
| (property) | string | mandatory | Current state/condition of this IValuePoint (must be one of the following: ACTIVATED, CONSTRUCTING, DEACTIVATED) |
The valuepoint instance ID shall be passed within the method designator, i.e.
valuePoint#<valuepoint-id>::condition.
Example
Get Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.valuePoint#id1::condition"
}
Get Response
{
"jsonrpc": "2.0",
"id": 42,
"result": "ACTIVATED"
}
valuePoint::type property
Provides access to the characteristics of this IValuePoint(IElement).
This property is read-only.
Value
| Name | Type | M/O | Description |
|---|---|---|---|
| (property) | integer | mandatory | Characteristics of this IValuePoint(IElement) |
The valuepoint instance ID shall be passed within the method designator, i.e.
valuePoint#<valuepoint-id>::type.
Example
Get Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.valuePoint#id1::type"
}
Get Response
{
"jsonrpc": "2.0",
"id": 42,
"result": 0
}
valuePoint::minimum property
Provides access to the the minimum value this IValuePoint(IElement) can reach.
This property is read-only.
Value
| Name | Type | M/O | Description |
|---|---|---|---|
| (property) | integer | mandatory | The minimum value this IValuePoint(IElement) can reach |
The valuepoint instance ID shall be passed within the method designator, i.e.
valuePoint#<valuepoint-id>::minimum.
Example
Get Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.valuePoint#id1::minimum"
}
Get Response
{
"jsonrpc": "2.0",
"id": 42,
"result": 0
}
valuePoint::maximum property
Provides access to the the maximum value this IValuePoint(IElement) can reach.
This property is read-only.
Value
| Name | Type | M/O | Description |
|---|---|---|---|
| (property) | integer | mandatory | The maximum value this IValuePoint(IElement) can reach |
The valuepoint instance ID shall be passed within the method designator, i.e.
valuePoint#<valuepoint-id>::maximum.
Example
Get Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.valuePoint#id1::maximum"
}
Get Response
{
"jsonrpc": "2.0",
"id": 42,
"result": 0
}
valuePoint::value property
Provides access to the the current value of this IValuePoint.
Value
| Name | Type | M/O | Description |
|---|---|---|---|
| (property) | object | mandatory | The current value of this IValuePoint |
| (property).value | integer | mandatory | ... |
| Name | Type | M/O | Description |
|---|---|---|---|
| (property) | integer | mandatory | Represent the current value of this IValuePoint |
The valuepoint instance ID shall be passed within the method designator, i.e.
valuePoint#<valuepoint-id>::value.
Example
Get Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.valuePoint#id1::value"
}
Get Response
{
"jsonrpc": "2.0",
"id": 42,
"result": 0
}
Set Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.valuePoint#id1::value",
"params": {
"value": 0
}
}
Set Response
{
"jsonrpc": "2.0",
"id": 42,
"result": "null"
}
valuePoint::metadata property
Provides access to the there most be more than meets the eye, report it as a JSON string.
This property is read-only.
Value
| Name | Type | M/O | Description |
|---|---|---|---|
| (property) | object | mandatory | There most be more than meets the eye, report it as a JSON string |
| (property).base | string | mandatory | ... (must be one of the following: GROUP, IDENTIFICATION, MEASUREMENT, REGULATOR) |
| (property).extended | string | mandatory | ... (must be one of the following: ACCESS_CONTROL, AIR, BURGLAR, CARBON_DIOXIDE, CARBON_MONOXIDE, CLOCK, ELECTRICITY, EMERGENCY, GAS, GENERAL, HUMIDITY, LIGHT, POWER_MANAGEMENT, PRESSURE, SMOKE, SYSTEM, TEMPERATURE, WATER) |
| (property).type | string | mandatory | ... (must be one of the following: AMPERE, DEGREES, FREQUENCY, KVAH, KWH, LOGIC, LUX, PERCENTAGE, PULSES, UNITS, VOLT) |
| (property).fraction | integer | mandatory | ... |
| (property).manufacturer | string | mandatory | ... |
| (property).model | string | mandatory | ... |
| (property).communication | string | mandatory | ... (must be one of the following: BLUETOOTH, COAP, HARDWARE, HTTP, I2C, MODBUS, MQTT, NRF24, ONEWIRE, SERIAL, SPI, UNKNOWN, VIRTUALS, ZIGBEE, ZWAVE) |
| (property)?.metadata | string | optional | ... |
The valuepoint instance ID shall be passed within the method designator, i.e.
valuePoint#<valuepoint-id>::metadata.
Example
Get Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.valuePoint#id1::metadata"
}
Get Response
{
"jsonrpc": "2.0",
"id": 42,
"result": {
"base": "MEASUREMENT",
"extended": "ELECTRICITY",
"type": "PERCENTAGE",
"fraction": 0,
"manufacturer": "...",
"model": "...",
"communication": "SERIAL",
"metadata": "..."
}
}
Notifications
Notifications are autonomous events triggered by the internals of the implementation and broadcasted via JSON-RPC to all registered observers. Refer to [Thunder] for information on how to register for a notification.
The following events are provided by the Catalog interface:
ValuePoint Catalog interface events:
| Notification | Description |
|---|---|
| activated | Signal a new IValuePoint, with the given Id became actived |
| deactivated | Signal a new IValuePoint, with the given Id became deactived |
| valuePoint::update | Signal event any change in value |
| valuePoint::metadata | Signal event any change in Metadata |
activated notification
Signal a new IValuePoint, with the given Id became actived.
Notification Parameters
| Name | Type | M/O | Description |
|---|---|---|---|
| params | object | mandatory | ... |
| params.id | string (instance ID) | mandatory | Id of the IValuePoint |
Example
Registration
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.register",
"params": {
"event": "activated",
"id": "myid"
}
}
Notification
{
"jsonrpc": "2.0",
"method": "myid.activated",
"params": {
"id": "id1"
}
}
The client ID parameter is passed within the notification designator, i.e.
<client-id>.activated.
deactivated notification
Signal a new IValuePoint, with the given Id became deactived.
Notification Parameters
| Name | Type | M/O | Description |
|---|---|---|---|
| params | object | mandatory | ... |
| params.id | string (instance ID) | mandatory | Id of the IValuePoint |
Example
Registration
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.register",
"params": {
"event": "deactivated",
"id": "myid"
}
}
Notification
{
"jsonrpc": "2.0",
"method": "myid.deactivated",
"params": {
"id": "id1"
}
}
The client ID parameter is passed within the notification designator, i.e.
<client-id>.deactivated.
valuePoint::update notification
Signal event any change in value.
Notification Parameters
| Name | Type | M/O | Description |
|---|---|---|---|
| params | object | mandatory | ... |
| params.id | integer | mandatory | Id of the value |
Example
Registration
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.valuepoint#id1::register",
"params": {
"event": "update",
"id": "myid"
}
}
Notification
{
"jsonrpc": "2.0",
"method": "myid.valuePoint#id1::update",
"params": {
"id": 0
}
}
The client ID parameter is passed within the notification designator, i.e.
<client-id>.valuePoint#<valuepoint-id>::update.The valuepoint instance id parameter is passed within the notification designator, i.e.
<client-id>.valuePoint#<valuepoint-id>::update.
valuePoint::metadata notification
Signal event any change in Metadata.
Notification Parameters
| Name | Type | M/O | Description |
|---|---|---|---|
| params | object | mandatory | ... |
| params.id | integer | mandatory | Id of the Metadata |
Example
Registration
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.valuepoint#id1::register",
"params": {
"event": "metadata",
"id": "myid"
}
}
Notification
{
"jsonrpc": "2.0",
"method": "myid.valuePoint#id1::metadata",
"params": {
"id": 0
}
}
The client ID parameter is passed within the notification designator, i.e.
<client-id>.valuePoint#<valuepoint-id>::metadata.The valuepoint instance id parameter is passed within the notification designator, i.e.
<client-id>.valuePoint#<valuepoint-id>::metadata.