... | ... | @@ -59,30 +59,24 @@ Motorcortex Bindings for JavaScript |
|
|
**Copyright**: Vectioneer
|
|
|
|
|
|
* [motorcortex](#module_motorcortex)
|
|
|
* [module.exports](#exp_module_motorcortex--module.exports) ⏏
|
|
|
* [.MessageTypes](#module_motorcortex--module.exports.MessageTypes)
|
|
|
* [.Subscribe](#module_motorcortex--module.exports.Subscribe)
|
|
|
* [.Request](#module_motorcortex--module.exports.Request)
|
|
|
* [.getParameterFlag](#module_motorcortex--module.exports.getParameterFlag) ⇒ <code>number</code>
|
|
|
* [.getParameterType](#module_motorcortex--module.exports.getParameterType) ⇒ <code>number</code>
|
|
|
* [.getPermission](#module_motorcortex--module.exports.getPermission) ⇒ <code>number</code>
|
|
|
* [.getStatusCode](#module_motorcortex--module.exports.getStatusCode) ⇒ <code>number</code>
|
|
|
* [.getUserGroup](#module_motorcortex--module.exports.getUserGroup) ⇒ <code>number</code>
|
|
|
* [.getDataType](#module_motorcortex--module.exports.getDataType) ⇒ <code>number</code>
|
|
|
* [.statusToStr](#module_motorcortex--module.exports.statusToStr) ⇒ <code>string</code>
|
|
|
|
|
|
<a name="exp_module_motorcortex--module.exports"></a>
|
|
|
|
|
|
### module.exports ⏏
|
|
|
Library namespace, with JS representation of the motorcortex.proto IDL.
|
|
|
|
|
|
**Kind**: Exported member
|
|
|
<a name="module_motorcortex--module.exports.MessageTypes"></a>
|
|
|
|
|
|
#### module.exports.MessageTypes
|
|
|
* [.MessageTypes](#module_motorcortex.MessageTypes)
|
|
|
* [.Subscribe](#module_motorcortex.Subscribe)
|
|
|
* [.Request](#module_motorcortex.Request)
|
|
|
* [.getParameterFlag](#module_motorcortex.getParameterFlag) ⇒ <code>number</code>
|
|
|
* [.getParameterType](#module_motorcortex.getParameterType) ⇒ <code>number</code>
|
|
|
* [.getPermission](#module_motorcortex.getPermission) ⇒ <code>number</code>
|
|
|
* [.getStatusCode](#module_motorcortex.getStatusCode) ⇒ <code>number</code>
|
|
|
* [.getUserGroup](#module_motorcortex.getUserGroup) ⇒ <code>number</code>
|
|
|
* [.getDataType](#module_motorcortex.getDataType) ⇒ <code>number</code>
|
|
|
* [.statusToStr](#module_motorcortex.statusToStr) ⇒ <code>string</code>
|
|
|
* [.name](#module_motorcortex.name)
|
|
|
|
|
|
<a name="module_motorcortex.MessageTypes"></a>
|
|
|
|
|
|
### motorcortex.MessageTypes
|
|
|
Class MessageTypes is responsible for encoding/decoding motorcortex messages.
|
|
|
|
|
|
**Kind**: static property of [<code>module.exports</code>](#exp_module_motorcortex--module.exports)
|
|
|
**Kind**: static property of [<code>motorcortex</code>](#module_motorcortex)
|
|
|
**See**: MessageTypes
|
|
|
**Example**
|
|
|
```js
|
... | ... | @@ -104,12 +98,12 @@ type_load_done.then(function () { |
|
|
console.error('Failed to load data types: ' + reason);
|
|
|
});
|
|
|
```
|
|
|
<a name="module_motorcortex--module.exports.Subscribe"></a>
|
|
|
<a name="module_motorcortex.Subscribe"></a>
|
|
|
|
|
|
#### module.exports.Subscribe
|
|
|
### motorcortex.Subscribe
|
|
|
Class Subscribe is responsible for parameter and group subscriptions.
|
|
|
|
|
|
**Kind**: static property of [<code>module.exports</code>](#exp_module_motorcortex--module.exports)
|
|
|
**Kind**: static property of [<code>motorcortex</code>](#module_motorcortex)
|
|
|
**See**: Subscribe
|
|
|
**Example**
|
|
|
```js
|
... | ... | @@ -127,13 +121,13 @@ sub_conn_done.then(function () { |
|
|
console.error('Failed to establish connection: ' + reason);
|
|
|
});
|
|
|
```
|
|
|
<a name="module_motorcortex--module.exports.Request"></a>
|
|
|
<a name="module_motorcortex.Request"></a>
|
|
|
|
|
|
#### module.exports.Request
|
|
|
### motorcortex.Request
|
|
|
Class Request is responsible for sending commands to motorcortex core:
|
|
|
for example set/get parameter value commands.
|
|
|
|
|
|
**Kind**: static property of [<code>module.exports</code>](#exp_module_motorcortex--module.exports)
|
|
|
**Kind**: static property of [<code>motorcortex</code>](#module_motorcortex)
|
|
|
**See**: Request
|
|
|
**Example**
|
|
|
```js
|
... | ... | @@ -148,12 +142,12 @@ req_conn_done.then(function () { |
|
|
});
|
|
|
}
|
|
|
```
|
|
|
<a name="module_motorcortex--module.exports.getParameterFlag"></a>
|
|
|
<a name="module_motorcortex.getParameterFlag"></a>
|
|
|
|
|
|
#### module.exports.getParameterFlag ⇒ <code>number</code>
|
|
|
### motorcortex.getParameterFlag ⇒ <code>number</code>
|
|
|
Returns properties of the parameter in tree, like overwrite or linked, etc.
|
|
|
|
|
|
**Kind**: static property of [<code>module.exports</code>](#exp_module_motorcortex--module.exports)
|
|
|
**Kind**: static property of [<code>motorcortex</code>](#module_motorcortex)
|
|
|
**Returns**: <code>number</code> - Id of the flags. Multiple flags could be encoded in the return value.
|
|
|
**See**: ./msg/motorcortex.proto
|
|
|
|
... | ... | @@ -171,12 +165,12 @@ if (flag & motorcortex.getParameterFlag('LINK_IS_ACTIVE')) { |
|
|
console.log('Parameter is linked');
|
|
|
}
|
|
|
```
|
|
|
<a name="module_motorcortex--module.exports.getParameterType"></a>
|
|
|
<a name="module_motorcortex.getParameterType"></a>
|
|
|
|
|
|
#### module.exports.getParameterType ⇒ <code>number</code>
|
|
|
### motorcortex.getParameterType ⇒ <code>number</code>
|
|
|
Returns type of the parameter in tree: input, output or parameter.
|
|
|
|
|
|
**Kind**: static property of [<code>module.exports</code>](#exp_module_motorcortex--module.exports)
|
|
|
**Kind**: static property of [<code>motorcortex</code>](#module_motorcortex)
|
|
|
**Returns**: <code>number</code> - Id of the type
|
|
|
**See**: ./msg/motorcortex.proto
|
|
|
|
... | ... | @@ -196,9 +190,9 @@ switch (type) { |
|
|
console.log('Parameter type is a parameter');
|
|
|
}
|
|
|
```
|
|
|
<a name="module_motorcortex--module.exports.getPermission"></a>
|
|
|
<a name="module_motorcortex.getPermission"></a>
|
|
|
|
|
|
#### module.exports.getPermission ⇒ <code>number</code>
|
|
|
### motorcortex.getPermission ⇒ <code>number</code>
|
|
|
Returns type of the parameter permission. Available parameters' permissions.
|
|
|
There are situations when users from the different groups need access to the
|
|
|
protected parts of the parameter tree. Permission flags allows fine-tuning an
|
... | ... | @@ -221,7 +215,7 @@ read & execute for all others. |
|
|
|
|
|
-rwxrwxrwx (0777): full access
|
|
|
|
|
|
**Kind**: static property of [<code>module.exports</code>](#exp_module_motorcortex--module.exports)
|
|
|
**Kind**: static property of [<code>motorcortex</code>](#module_motorcortex)
|
|
|
**Returns**: <code>number</code> - Id of the permission
|
|
|
**See**: ./msg/motorcortex.proto
|
|
|
|
... | ... | @@ -241,12 +235,12 @@ switch (type) { |
|
|
console.log('User can open parameter folder');
|
|
|
}
|
|
|
```
|
|
|
<a name="module_motorcortex--module.exports.getStatusCode"></a>
|
|
|
<a name="module_motorcortex.getStatusCode"></a>
|
|
|
|
|
|
#### module.exports.getStatusCode ⇒ <code>number</code>
|
|
|
### motorcortex.getStatusCode ⇒ <code>number</code>
|
|
|
Returns a status code of the operation.
|
|
|
|
|
|
**Kind**: static property of [<code>module.exports</code>](#exp_module_motorcortex--module.exports)
|
|
|
**Kind**: static property of [<code>motorcortex</code>](#module_motorcortex)
|
|
|
**Returns**: <code>number</code> - Id of status.
|
|
|
**See**: ./msg/motorcortex.proto
|
|
|
|
... | ... | @@ -260,12 +254,12 @@ if (msg.status === motorcortex.getStatusCode('READ_ONLY_MODE')) { |
|
|
console.log('User is logged-in, read only mode.');
|
|
|
}
|
|
|
```
|
|
|
<a name="module_motorcortex--module.exports.getUserGroup"></a>
|
|
|
<a name="module_motorcortex.getUserGroup"></a>
|
|
|
|
|
|
#### module.exports.getUserGroup ⇒ <code>number</code>
|
|
|
### motorcortex.getUserGroup ⇒ <code>number</code>
|
|
|
Returns a user group.
|
|
|
|
|
|
**Kind**: static property of [<code>module.exports</code>](#exp_module_motorcortex--module.exports)
|
|
|
**Kind**: static property of [<code>motorcortex</code>](#module_motorcortex)
|
|
|
**Returns**: <code>number</code> - Id of group.
|
|
|
**See**: ./msg/motorcortex.proto
|
|
|
|
... | ... | @@ -279,12 +273,12 @@ if (parameter.info.group_id === motorcortex.getUserGroup('ADMINISTRATOR')) { |
|
|
console.log('Parameter belongs to administrator user group');
|
|
|
}
|
|
|
```
|
|
|
<a name="module_motorcortex--module.exports.getDataType"></a>
|
|
|
<a name="module_motorcortex.getDataType"></a>
|
|
|
|
|
|
#### module.exports.getDataType ⇒ <code>number</code>
|
|
|
### motorcortex.getDataType ⇒ <code>number</code>
|
|
|
Returns a data type of the item in the parameter tree.
|
|
|
|
|
|
**Kind**: static property of [<code>module.exports</code>](#exp_module_motorcortex--module.exports)
|
|
|
**Kind**: static property of [<code>motorcortex</code>](#module_motorcortex)
|
|
|
**Returns**: <code>number</code> - id of the data type.
|
|
|
**See**: ./msg/motorcortex.proto
|
|
|
|
... | ... | @@ -299,13 +293,13 @@ if (type_id === motorcortex.getDataType('STRING')) { |
|
|
console.log('Parameter has type string');
|
|
|
}
|
|
|
```
|
|
|
<a name="module_motorcortex--module.exports.statusToStr"></a>
|
|
|
<a name="module_motorcortex.statusToStr"></a>
|
|
|
|
|
|
#### module.exports.statusToStr ⇒ <code>string</code>
|
|
|
### motorcortex.statusToStr ⇒ <code>string</code>
|
|
|
Converts a status and error codes to a string description
|
|
|
|
|
|
**Kind**: static property of [<code>module.exports</code>](#exp_module_motorcortex--module.exports)
|
|
|
**Returns**: <code>string</code> - Error desciprion.
|
|
|
**Kind**: static property of [<code>motorcortex</code>](#module_motorcortex)
|
|
|
**Returns**: <code>string</code> - Error description.
|
|
|
**See**: ./msg/motorcortex.proto
|
|
|
|
|
|
| Param | Type | Description |
|
... | ... | @@ -319,6 +313,12 @@ login_reply.then(function (reply) { console.log('Success!') }).catch(function (r |
|
|
console.log('Failed: ' + motorcortex.statusToStr(reply.status));
|
|
|
});
|
|
|
```
|
|
|
<a name="module_motorcortex.name"></a>
|
|
|
|
|
|
### motorcortex.name
|
|
|
The name of the module
|
|
|
|
|
|
**Kind**: static constant of [<code>motorcortex</code>](#module_motorcortex)
|
|
|
<a name="Connection"></a>
|
|
|
|
|
|
## Connection
|
... | ... | @@ -1334,3 +1334,4 @@ This callback notifies when subscription is updated with new values. |
|
|
| Param | Type | Description |
|
|
|
| --- | --- | --- |
|
|
|
| parameters | [<code>Array.<Parameter></code>](#Parameter) | A list of values and timestamps, ordered according to the group layout. |
|
|
|
|