Echo Plugin
Bases: BasePlugin
EchoPlugin is a simple diagnostic plugin that echoes incoming events.
It is useful for testing the event system and verifying that events are being dispatched correctly with their data payload and timestamp.
Source code in plugins/echo/main.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
|
__init__()
Initializes the EchoPlugin.
Sets the plugin name and creates a logger instance.
Source code in plugins/echo/main.py
34 35 36 37 38 39 40 41 |
|
on_event(topic, data, timestamp)
Handles incoming events and logs the message.
If a message
key exists in the event data, it is echoed.
Otherwise, the entire data dictionary is converted to a string and echoed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
topic
|
str
|
The topic name of the event (e.g., "echo"). |
required |
data
|
dict
|
Event data payload. |
required |
timestamp
|
float
|
Simulation time in seconds when the event occurred. |
required |
Source code in plugins/echo/main.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
|
on_init(config)
Called once when the plugin is initialized.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
dict
|
Optional configuration parameters (unused in this plugin). |
required |
Source code in plugins/echo/main.py
43 44 45 46 47 48 49 50 |
|
on_shutdown()
Called when the plugin is being shut down.
Used to perform any cleanup before unloading the plugin.
Source code in plugins/echo/main.py
69 70 71 72 73 74 75 |
|