Update 'src/pubsub/pubsub/Readme.md'

This commit is contained in:
winterhalderp 2021-04-23 15:39:40 +02:00
parent e5d6633aca
commit 97dbc52459
1 changed files with 12 additions and 3 deletions

View File

@ -20,10 +20,16 @@ Library files:
* `MinimalServiceClient` class
## How to use
In the following the various classes named above are referred to as `Minimal<X>` with `<X>` standing for topic publisher/subscriber or service host/client.
You can use the `Minimal<X>` classes in three ways:
* Create `Minimal<X>` in your script (eg. [topic_listener.py](None) where data is echanged between the script environment and the class environment)
* Implement `Minimal<X>` inside your device class the same way as implementing in your main script (__<-- ToDo !!!__)
* Build device class upon `Minimal<X>` class (eg. [statemachine_host_example.py](None) where a device class is built upon the `MinimalServiceProvider` class) by implementing this structure
* Create `Minimal<X>` in your script (eg. [topic_listener.py](None)): Here data is echanged between the script environment and the class environment.
__Upsides__: You can implement as many instances of `Minimal<X>` as you like
__Downsides__: Code get's complicated and confusing
* Implement `Minimal<X>` inside your device class the same way as implementing in your main script (__<-- ToDo !!!__)
__Upsides__: You can implement as man instances of `Minimal<X>` as you like; You can wrap these instances inside you device class
__Downsides__: __ToDo__
* Build device class upon `Minimal<X>` by using this structure
```python
class Child_Class(Parent_Class):
```
@ -31,3 +37,6 @@ For example:
```python
class StateMachineCMDServiceProvider(MinimalServiceProvider):
```
(Example: [statemachine_host_example.py](None): device class is built upon `MinimalServiceProvider` class.)
__Upsides__: `Minimal<X>` is automatically instantiated when creating an instance of your device class though `__init()__`
__Downsides__: You can only implement one instance of `Minimal<X>`, eg. one device class can only implement one publisher, in this case you want to implement `Minimal<X>` inside device class (see above)