|
---
|
|
---
|
|
title: Subscribe
|
|
title: Modules
|
|
summary: Subscribe class is used to receive continuous parameter updates from motorcortex server. It simplifies creating and removing subscription groups.
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
# Subscribe
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Subscribe](Classes/classmcx__cpp_1_1Subscribe.md) class is used to receive continuous parameter updates from motorcortex server. It simplifies creating and removing subscription groups. [More...](#detailed-description)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Classes
|
|
|
|
|
|
|
|
| | Name |
|
|
|
|
| -------------- | -------------- |
|
|
|
|
| class | **[mcx_cpp::Subscription](Classes/classmcx__cpp_1_1Subscription.md)** |
|
|
|
|
| class | **[mcx_cpp::Subscribe](Classes/classmcx__cpp_1_1Subscribe.md)** |
|
|
|
|
|
|
|
|
## Types
|
|
|
|
|
|
|
|
| | Name |
|
|
|
|
| -------------- | -------------- |
|
|
|
|
| typedef std::shared_ptr< ParameterList > | **[ParameterListPtr](Modules/group__subscribe.md#typedef-parameterlistptr)** |
|
|
|
|
| typedef std::vector< GetParameter > | **[ParameterList](Modules/group__subscribe.md#typedef-parameterlist)** |
|
|
|
|
|
|
|
|
## Functions
|
|
|
|
|
|
|
|
| | Name |
|
|
|
|
| -------------- | -------------- |
|
|
|
|
| std::string | **[alias](Modules/group__subscribe.md#function-alias)**() const |
|
|
|
|
| uint32_t | **[id](Modules/group__subscribe.md#function-id)**() const |
|
|
|
|
| void | **[notify](Modules/group__subscribe.md#function-notify)**(const std::function< void(std::vector< GetParameter >)> & clb) |
|
|
|
|
| std::vector< GetParameter > | **[read](Modules/group__subscribe.md#function-read)**() const |
|
|
|
|
| | **[Subscription](Modules/group__subscribe.md#function-subscription)**(const [motorcortex_GroupStatusMsg](Classes/struct__motorcortex__GroupStatusMsg.md) & group_status_msg) |
|
|
|
|
| | **[Subscription](Modules/group__subscribe.md#function-subscription)**(const McxStatus & status) |
|
|
|
|
| | **[Subscription](Modules/group__subscribe.md#function-subscription)**() |
|
|
|
|
| StatusReply | **[unsubscribe](Modules/group__subscribe.md#function-unsubscribe)**(const Subscription & subscription) const <br>Unsubscribes from the group. |
|
|
|
|
| SubscriptionReply | **[subscribe](Modules/group__subscribe.md#function-subscribe)**(std::vector< std::string > path_list, const std::string & group_alias, size_t frequency_divider) const <br>Create a subscription group for a list of the parameters. |
|
|
|
|
| void | **[close](Modules/group__subscribe.md#function-close)**() <br>Closes connection to the server. |
|
|
|
|
| ConnectionReply | **[connect](Modules/group__subscribe.md#function-connect)**(std::string url, const ConnectionOptions & connection_options) <br>Opens a subscribe connection. |
|
|
|
|
| ConnectionReply | **[connect](Modules/group__subscribe.md#function-connect)**(std::string url) <br>Opens a subscribe connection. |
|
|
|
|
| std::string | **[url](Modules/group__subscribe.md#function-url)**() const <br>Returns connection URL. |
|
|
|
|
| | **[~Subscribe](Modules/group__subscribe.md#function-~subscribe)**() <br>Destructor. |
|
|
|
|
| | **[Subscribe](Modules/group__subscribe.md#function-subscribe)**(const Request & request) <br>Creates new [Subscribe](Classes/classmcx__cpp_1_1Subscribe.md). |
|
|
|
|
| | **[Subscribe](Modules/group__subscribe.md#function-subscribe)**() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Detailed Description
|
|
|
|
|
|
|
|
[Subscribe](Classes/classmcx__cpp_1_1Subscribe.md) class is used to receive continuous parameter updates from motorcortex server. It simplifies creating and removing subscription groups.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Subscription](Classes/classmcx__cpp_1_1Subscription.md) class represents a group of parameters. It returns the latest values and a timestamp of the group. [Subscription](Classes/classmcx__cpp_1_1Subscription.md) class could be used as an observer, which notifies on every update or could be used as polling.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Types Documentation
|
|
|
|
|
|
|
|
### typedef ParameterListPtr
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
typedef std::shared_ptr< ParameterList > ParameterListPtr;
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### typedef ParameterList
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
typedef std::vector< GetParameter > ParameterList;
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Functions Documentation
|
|
|
|
|
|
|
|
### function alias
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
std::string alias() const
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### function id
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
uint32_t id() const
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### function notify
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
void notify(
|
|
|
|
const std::function< void(std::vector< GetParameter >)> & clb
|
|
|
|
)
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### function read
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
std::vector< GetParameter > read() const
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### function Subscription
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
explicit Subscription(
|
|
|
|
const motorcortex_GroupStatusMsg & group_status_msg
|
|
|
|
)
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### function Subscription
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
explicit Subscription(
|
|
|
|
const McxStatus & status
|
|
|
|
)
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### function Subscription
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
Subscription()
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### function unsubscribe
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
StatusReply unsubscribe(
|
|
|
|
const Subscription & subscription
|
|
|
|
) const
|
|
|
|
```
|
|
|
|
|
|
|
|
Unsubscribes from the group.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
**Return**: a promise, which resolves when the unsubscribe operation is complete, fails otherwise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### function subscribe
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
SubscriptionReply subscribe(
|
|
|
|
std::vector< std::string > path_list,
|
|
|
|
const std::string & group_alias,
|
|
|
|
size_t frequency_divider
|
|
|
|
) const
|
|
|
|
```
|
|
|
|
|
|
|
|
Create a subscription group for a list of the parameters.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
**Return**: a subscription handle, which acts as a Promise, it is resolved when subscription is ready or failed. After the subscription is ready the handle is used to retrieve latest data.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### function close
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
void close()
|
|
|
|
```
|
|
|
|
|
|
|
|
Closes connection to the server.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### function connect
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
ConnectionReply connect(
|
|
|
|
std::string url,
|
|
|
|
const ConnectionOptions & connection_options
|
|
|
|
)
|
|
|
|
```
|
|
|
|
|
|
|
|
Opens a subscribe connection.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
**Return**: status of the connection.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### function connect
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
ConnectionReply connect(
|
|
|
|
std::string url
|
|
|
|
)
|
|
|
|
```
|
|
|
|
|
|
|
|
Opens a subscribe connection.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
**Return**: status of the connection.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### function url
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
std::string url() const
|
|
|
|
```
|
|
|
|
|
|
|
|
Returns connection URL.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### function ~Subscribe
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
~Subscribe()
|
|
|
|
```
|
|
|
|
|
|
|
|
Destructor.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### function Subscribe
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
explicit Subscribe(
|
|
|
|
const Request & request
|
|
|
|
)
|
|
|
|
```
|
|
|
|
|
|
|
|
Creates new [Subscribe](Classes/classmcx__cpp_1_1Subscribe.md).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### function Subscribe
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
Subscribe()
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
# Modules
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* **module [Request](Modules/group__request.md)**<br>Request/Reply communication is used to send commands to a motorcortex server.
|
|
|
|
* **module [Subscribe](Modules/group__subscribe.md)**<br>[Subscribe](Classes/classmcx__cpp_1_1Subscribe.md) class is used to receive continuous parameter updates from motorcortex server. It simplifies creating and removing subscription groups.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-------------------------------
|
|
-------------------------------
|
|
|
|
|
|
Updated on 7 February 2020 at 16:36:19 CET |
|
Updated on 7 February 2020 at 16:36:20 CET |
|
\ No newline at end of file |
|
\ No newline at end of file |