Skip to content

Commit 87f5dba

Browse files
committed
reinstate Thing class doc
1 parent e326208 commit 87f5dba

3 files changed

Lines changed: 22 additions & 18 deletions

File tree

docs/beginners-guide/articles/thing/index.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
A default logger with IO stream handler is configured for each `Thing` instance. One can override the logger by passing a custom logger instance to the `Thing` constructor:
66

7-
```py title="Custom Logger" linenums="1" hl_lines="3"
7+
```py title="Custom Logger" linenums="1" hl_lines="12"
88
class WarningsToFileHandler(logging.FileHandler):
99
"""Custom handler that writes only WARNING+ logs to a separate file."""
1010
def emit(self, record):
@@ -48,9 +48,16 @@ Endpoint | Description
4848
`http(s)://<host>:<port>/<thing_id>/logger/logs` | all logs
4949
`http(s)://<host>:<port>/<thing_id>/logger/logs/debug` | debug logs and above -->
5050

51+
### Meta
52+
53+
To be updated with use cases of modifying Thing metaclass, in the meanwhile there is decent documentation in
54+
the developer notes: [Thing MetaClass](../../../design/metaclasses.md#metaclasses).
55+
5156
### Post Init
5257

53-
`Thing` classes define a `__post_init__` method which is invoked after loading properties from a database.
58+
To be updated, please refer to the developer notes in the meantime: [Thing Post Init](../../../design/metaclasses.md#__post_init__-method).
59+
60+
<!-- `Thing` classes define a `__post_init__` method which is invoked after loading properties from a database.
5461
All initialization logic which depend on database loaded properties can placed in this method:
5562
5663
```py title="Post Init" linenums="1"
@@ -61,11 +68,8 @@ class MyThing(Thing):
6168
super().__post_init__() # dont forget to call parent
6269
self.logger.info("Thing initialized with properties from DB")
6370
```
64-
65-
### Meta
66-
67-
To be updated with use cases of modifying Thing metaclass.
71+
-->
6872

6973
### Composition
7074

71-
To be updated with using sub-things within a Thing.
75+
To be updated.

docs/design/metaclasses.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ class CameraMeta(ThingMeta):
4242
class Image(Property):
4343

4444
def __init__(self,
45-
compression_ratio: int = 1,
46-
transpose: bool = False,
47-
flip_horizontal: bool = False,
48-
flip_vertical: bool = False,
49-
observable: bool = False,
50-
) -> None:
45+
compression_ratio: int = 1,
46+
transpose: bool = False,
47+
flip_horizontal: bool = False,
48+
flip_vertical: bool = False,
49+
observable: bool = False,
50+
) -> None:
5151
...
5252

5353
class RPiCamera(Thing, metaclass=CameraMeta):
@@ -65,7 +65,7 @@ class IDSCamera(Thing, metaclass=CameraMeta):
6565

6666
## `__post_init__` Method
6767

68-
There is no specific need to explicitly call a `__post_init__` method. A possible application of `__post_init__` could be to run default code after connecting to the hardware:
68+
There is no specific need to explicitly call a `__post_init__` method as it is auto-invoked by the [`ThingMeta`](../api-reference/thing/thing-meta.md). A possible application of `__post_init__` could be to run default code after connecting to the hardware:
6969

7070
```python
7171

@@ -93,4 +93,4 @@ flowchart TD
9393
D --> E[__post_init__ is called to run additional setup code <br/>which are dependent on the loaded properties]
9494
```
9595

96-
Of course, the `__post_init__` method can be used for any other purpose. The `__post_init__` is auto-invoked by the [`ThingMeta`](../api-reference/thing/thing-meta.md).
96+
Of course, the `__post_init__` method can be used for any other purpose.

docs/design/zmq.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ The main purpose of the RPC broker is to:
44

55
- add scheduling control for the interaction affordances
66
- decouple protocol handlers (a.k.a controllers) from the actual execution of the interaction affordances
7-
- unify execution control across multiple protocols
8-
- maintain standardized behaviour irrespective of the protocol, for example, pushing an event must cause both the HTTP and MQTT clients to receive the same event
7+
- unify execution across multiple protocols
8+
- maintain standardized behaviour irrespective of the protocol, for example, pushing an event must cause both a HTTP and a MQTT client to receive the same event
99

1010
Three types of scheduling are supported:
1111

@@ -35,7 +35,7 @@ sequenceDiagram
3535
ProtocolHandler-->>Client: Forward Event (Pub, protocol specific)
3636
```
3737

38-
In a certain way, this is definitely a protocol-to-protocol transfer of request and response, with a minor difference that ZMQ handles this over its `INPROC` transport over threads & shared memory, which is significantly more efficient than TCP-to-TCP communication.
38+
In a certain way, this is definitely a protocol-to-protocol transfer of request and response, with a minor difference that ZMQ handles this over its `INPROC` transport over threads & shared memory, which is significantly more efficient than TCP-to-TCP communication & adds very little overhead.
3939

4040
The scheduling message is a simple JSON object, tailored to arbitrary serialization and ZMQ multipart messaging scheme:
4141

0 commit comments

Comments
 (0)