ovos-ui-enclosure-protocol 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2023 Casimiro Ferreira
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,78 @@
1
+ Metadata-Version: 2.4
2
+ Name: ovos-ui-enclosure-protocol
3
+ Version: 0.0.1
4
+ Summary: Legacy Mark-1 hardware enclosure protocol listener for OpenVoiceOS
5
+ Author-email: JarbasAi <jarbasai@mailfence.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/OpenVoiceOS/ovos-ui-enclosure-protocol
8
+ Project-URL: Repository, https://github.com/OpenVoiceOS/ovos-ui-enclosure-protocol
9
+ Keywords: enclosure,mark1,mycroft,OVOS,OpenVoiceOS,PHAL
10
+ Requires-Python: >=3.10
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: ovos-bus-client
14
+ Provides-Extra: test
15
+ Requires-Dist: pytest; extra == "test"
16
+ Requires-Dist: pytest-cov; extra == "test"
17
+ Dynamic: license-file
18
+
19
+ # ovos-ui-enclosure-protocol
20
+
21
+ The consumer/listener home of the legacy **Mark-1 hardware enclosure protocol**
22
+ for OpenVoiceOS.
23
+
24
+ The `enclosure.*` bus messages control the Mark-1 hardware enclosure: the LED
25
+ eyes, the mouth/faceplate display, and the system LEDs. This package provides
26
+ `EnclosureProtocolListener`, a consumer mix-in that a hardware enclosure plugin
27
+ inherits to wire the `enclosure.*` subscriptions to overridable no-op handlers.
28
+ [`ovos-PHAL-plugin-mk1`](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-mk1)
29
+ is the reference listener implementation.
30
+
31
+ The producer side — `EnclosureAPI`, the skill-facing helper that *emits*
32
+ `enclosure.*` — lives in
33
+ [`ovos-gui-api-client`](https://github.com/OpenVoiceOS/ovos-gui-api-client)
34
+ alongside `GUIInterface`, so `self.gui` and `self.enclosure` come from the same
35
+ client.
36
+
37
+ The enclosure protocol is **no longer a core abstraction**: `PHALPlugin` in
38
+ `ovos-plugin-manager` no longer bakes in the `enclosure.*` handlers, and modern
39
+ visual output is done through `GUIInterface` (OVOS-GUI-1). This package exists
40
+ so hardware enclosure plugins keep a stable, dependency-light home for the
41
+ listener side of the protocol. It does **not** reimplement GUI templates.
42
+
43
+ ## Install
44
+
45
+ ```bash
46
+ pip install ovos-ui-enclosure-protocol
47
+ ```
48
+
49
+ ## Implementing a listener
50
+
51
+ ```python
52
+ from ovos_ui_enclosure_protocol import EnclosureProtocolListener
53
+
54
+ class MyEnclosure(EnclosureProtocolListener):
55
+ def __init__(self, bus):
56
+ self.bus = bus
57
+ self.register_enclosure_namespace()
58
+
59
+ def on_eyes_color(self, message=None):
60
+ ... # drive the hardware
61
+
62
+ def shutdown(self):
63
+ self.shutdown_enclosure_namespace()
64
+ ```
65
+
66
+ Every handler defaults to a no-op, so a plugin only overrides the commands its
67
+ hardware supports. `ovos-PHAL-plugin-mk1` is the reference listener
68
+ implementation.
69
+
70
+ ## Documentation
71
+
72
+ - [`docs/index.md`](docs/index.md) — overview, install, listener guide.
73
+ - [`docs/enclosure-protocol.md`](docs/enclosure-protocol.md) — the full
74
+ `enclosure.*` message contract with producers and listeners.
75
+
76
+ ## License
77
+
78
+ Apache-2.0
@@ -0,0 +1,60 @@
1
+ # ovos-ui-enclosure-protocol
2
+
3
+ The consumer/listener home of the legacy **Mark-1 hardware enclosure protocol**
4
+ for OpenVoiceOS.
5
+
6
+ The `enclosure.*` bus messages control the Mark-1 hardware enclosure: the LED
7
+ eyes, the mouth/faceplate display, and the system LEDs. This package provides
8
+ `EnclosureProtocolListener`, a consumer mix-in that a hardware enclosure plugin
9
+ inherits to wire the `enclosure.*` subscriptions to overridable no-op handlers.
10
+ [`ovos-PHAL-plugin-mk1`](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-mk1)
11
+ is the reference listener implementation.
12
+
13
+ The producer side — `EnclosureAPI`, the skill-facing helper that *emits*
14
+ `enclosure.*` — lives in
15
+ [`ovos-gui-api-client`](https://github.com/OpenVoiceOS/ovos-gui-api-client)
16
+ alongside `GUIInterface`, so `self.gui` and `self.enclosure` come from the same
17
+ client.
18
+
19
+ The enclosure protocol is **no longer a core abstraction**: `PHALPlugin` in
20
+ `ovos-plugin-manager` no longer bakes in the `enclosure.*` handlers, and modern
21
+ visual output is done through `GUIInterface` (OVOS-GUI-1). This package exists
22
+ so hardware enclosure plugins keep a stable, dependency-light home for the
23
+ listener side of the protocol. It does **not** reimplement GUI templates.
24
+
25
+ ## Install
26
+
27
+ ```bash
28
+ pip install ovos-ui-enclosure-protocol
29
+ ```
30
+
31
+ ## Implementing a listener
32
+
33
+ ```python
34
+ from ovos_ui_enclosure_protocol import EnclosureProtocolListener
35
+
36
+ class MyEnclosure(EnclosureProtocolListener):
37
+ def __init__(self, bus):
38
+ self.bus = bus
39
+ self.register_enclosure_namespace()
40
+
41
+ def on_eyes_color(self, message=None):
42
+ ... # drive the hardware
43
+
44
+ def shutdown(self):
45
+ self.shutdown_enclosure_namespace()
46
+ ```
47
+
48
+ Every handler defaults to a no-op, so a plugin only overrides the commands its
49
+ hardware supports. `ovos-PHAL-plugin-mk1` is the reference listener
50
+ implementation.
51
+
52
+ ## Documentation
53
+
54
+ - [`docs/index.md`](docs/index.md) — overview, install, listener guide.
55
+ - [`docs/enclosure-protocol.md`](docs/enclosure-protocol.md) — the full
56
+ `enclosure.*` message contract with producers and listeners.
57
+
58
+ ## License
59
+
60
+ Apache-2.0
@@ -0,0 +1,24 @@
1
+ """ovos-ui-enclosure-protocol.
2
+
3
+ Consumer side of the legacy Mark-1 hardware enclosure protocol.
4
+
5
+ ``EnclosureProtocolListener`` is a mix-in that a hardware enclosure plugin
6
+ inherits to wire the ``enclosure.*`` bus subscriptions to overridable no-op
7
+ handlers, so a plugin only implements the commands its hardware supports.
8
+ ``ovos-PHAL-plugin-mk1`` is the reference listener implementation.
9
+
10
+ The producer side (``EnclosureAPI``, the skill-facing helper that emits the
11
+ ``enclosure.*`` messages) lives in ``ovos-gui-api-client`` alongside
12
+ ``GUIInterface`` — ``self.gui`` and ``self.enclosure`` come from the same
13
+ client. This package does not reimplement it.
14
+
15
+ The enclosure protocol is **no longer a core abstraction**: ``PHALPlugin`` in
16
+ ``ovos-plugin-manager`` no longer wires ``enclosure.*`` handlers. A hardware
17
+ plugin that wants enclosure-protocol support mixes in
18
+ ``EnclosureProtocolListener`` from this package instead. Modern visual output
19
+ is handled by ``GUIInterface`` (OVOS-GUI-1) and its template system.
20
+ """
21
+ from ovos_ui_enclosure_protocol.listener import EnclosureProtocolListener
22
+ from ovos_ui_enclosure_protocol.version import __version__
23
+
24
+ __all__ = ["EnclosureProtocolListener", "__version__"]
@@ -0,0 +1,273 @@
1
+ """Consumer side of the enclosure protocol.
2
+
3
+ ``EnclosureProtocolListener`` is a mix-in that wires the ``enclosure.*`` bus
4
+ messages emitted by :class:`EnclosureAPI` to overridable no-op handler methods.
5
+ A hardware enclosure plugin inherits this mix-in to get the subscriptions wired
6
+ up and only overrides the handlers it cares about.
7
+
8
+ This deliberately does NOT include the general PHAL lifecycle (Thread/run/
9
+ shutdown/register_core_events) — those stay in ``ovos-plugin-manager``'s
10
+ ``PHALPlugin``. The listener base only needs ``self.bus``.
11
+
12
+ ``ovos-PHAL-plugin-mk1`` is the reference implementation that subclasses this
13
+ listener.
14
+ """
15
+
16
+
17
+ class EnclosureProtocolListener:
18
+ """Mix-in that subscribes a hardware plugin to the ``enclosure.*`` protocol.
19
+
20
+ Subclasses are expected to provide a ``self.bus`` (a connected
21
+ ``MessageBusClient``) before calling :meth:`register_enclosure_namespace`,
22
+ and to override the ``on_*`` handlers they support. Every handler defaults
23
+ to a no-op so unsupported commands are simply ignored.
24
+ """
25
+
26
+ _mouth_events = False
27
+
28
+ def register_enclosure_namespace(self):
29
+ """Wire all ``enclosure.*`` messages to this listener's handlers."""
30
+ self.bus.on("enclosure.notify.no_internet", self.on_no_internet)
31
+ self.bus.on("enclosure.reset", self.on_reset)
32
+
33
+ # enclosure commands for the system
34
+ self.bus.on("enclosure.system.reset", self.on_system_reset)
35
+ self.bus.on("enclosure.system.mute", self.on_system_mute)
36
+ self.bus.on("enclosure.system.unmute", self.on_system_unmute)
37
+ self.bus.on("enclosure.system.blink", self.on_system_blink)
38
+
39
+ # enclosure commands for eyes
40
+ self.bus.on("enclosure.eyes.on", self.on_eyes_on)
41
+ self.bus.on("enclosure.eyes.off", self.on_eyes_off)
42
+ self.bus.on("enclosure.eyes.blink", self.on_eyes_blink)
43
+ self.bus.on("enclosure.eyes.narrow", self.on_eyes_narrow)
44
+ self.bus.on("enclosure.eyes.look", self.on_eyes_look)
45
+ self.bus.on("enclosure.eyes.color", self.on_eyes_color)
46
+ self.bus.on("enclosure.eyes.level", self.on_eyes_brightness)
47
+ self.bus.on("enclosure.eyes.volume", self.on_eyes_volume)
48
+ self.bus.on("enclosure.eyes.spin", self.on_eyes_spin)
49
+ self.bus.on("enclosure.eyes.timedspin", self.on_eyes_timed_spin)
50
+ self.bus.on("enclosure.eyes.reset", self.on_eyes_reset)
51
+ self.bus.on("enclosure.eyes.setpixel", self.on_eyes_set_pixel)
52
+ self.bus.on("enclosure.eyes.fill", self.on_eyes_fill)
53
+
54
+ # enclosure commands for mouth
55
+ self.bus.on("enclosure.mouth.events.activate", self._activate_mouth_events)
56
+ self.bus.on("enclosure.mouth.events.deactivate", self._deactivate_mouth_events)
57
+ self.bus.on("enclosure.mouth.talk", self._on_mouth_talk)
58
+ self.bus.on("enclosure.mouth.think", self._on_mouth_think)
59
+ self.bus.on("enclosure.mouth.listen", self._on_mouth_listen)
60
+ self.bus.on("enclosure.mouth.smile", self._on_mouth_smile)
61
+ self.bus.on("enclosure.mouth.viseme", self._on_mouth_viseme)
62
+ self.bus.on("enclosure.mouth.viseme_list", self._on_mouth_viseme_list)
63
+
64
+ # mouth / matrix display
65
+ self.bus.on("enclosure.mouth.reset", self.on_display_reset)
66
+ self.bus.on("enclosure.mouth.text", self.on_text)
67
+ self.bus.on("enclosure.mouth.display", self.on_display)
68
+ self.bus.on("enclosure.weather.display", self.on_weather_display)
69
+
70
+ def shutdown_enclosure_namespace(self):
71
+ """Remove all ``enclosure.*`` subscriptions wired by this listener."""
72
+ self.bus.remove("enclosure.notify.no_internet", self.on_no_internet)
73
+ self.bus.remove("enclosure.reset", self.on_reset)
74
+
75
+ self.bus.remove("enclosure.system.reset", self.on_system_reset)
76
+ self.bus.remove("enclosure.system.mute", self.on_system_mute)
77
+ self.bus.remove("enclosure.system.unmute", self.on_system_unmute)
78
+ self.bus.remove("enclosure.system.blink", self.on_system_blink)
79
+
80
+ self.bus.remove("enclosure.eyes.on", self.on_eyes_on)
81
+ self.bus.remove("enclosure.eyes.off", self.on_eyes_off)
82
+ self.bus.remove("enclosure.eyes.blink", self.on_eyes_blink)
83
+ self.bus.remove("enclosure.eyes.narrow", self.on_eyes_narrow)
84
+ self.bus.remove("enclosure.eyes.look", self.on_eyes_look)
85
+ self.bus.remove("enclosure.eyes.color", self.on_eyes_color)
86
+ self.bus.remove("enclosure.eyes.level", self.on_eyes_brightness)
87
+ self.bus.remove("enclosure.eyes.volume", self.on_eyes_volume)
88
+ self.bus.remove("enclosure.eyes.spin", self.on_eyes_spin)
89
+ self.bus.remove("enclosure.eyes.timedspin", self.on_eyes_timed_spin)
90
+ self.bus.remove("enclosure.eyes.reset", self.on_eyes_reset)
91
+ self.bus.remove("enclosure.eyes.setpixel", self.on_eyes_set_pixel)
92
+ self.bus.remove("enclosure.eyes.fill", self.on_eyes_fill)
93
+
94
+ self.bus.remove("enclosure.mouth.events.activate", self._activate_mouth_events)
95
+ self.bus.remove("enclosure.mouth.events.deactivate", self._deactivate_mouth_events)
96
+ self.bus.remove("enclosure.mouth.talk", self._on_mouth_talk)
97
+ self.bus.remove("enclosure.mouth.think", self._on_mouth_think)
98
+ self.bus.remove("enclosure.mouth.listen", self._on_mouth_listen)
99
+ self.bus.remove("enclosure.mouth.smile", self._on_mouth_smile)
100
+ self.bus.remove("enclosure.mouth.viseme", self._on_mouth_viseme)
101
+ self.bus.remove("enclosure.mouth.viseme_list", self._on_mouth_viseme_list)
102
+
103
+ self.bus.remove("enclosure.mouth.reset", self.on_display_reset)
104
+ self.bus.remove("enclosure.mouth.text", self.on_text)
105
+ self.bus.remove("enclosure.mouth.display", self.on_display)
106
+ self.bus.remove("enclosure.weather.display", self.on_weather_display)
107
+
108
+ # Lifecycle
109
+ def on_reset(self, message=None):
110
+ """The enclosure should restore itself to a started state.
111
+ Typically this would be represented by the eyes being 'open'
112
+ and the mouth reset to its default (smile or blank).
113
+ """
114
+ pass
115
+
116
+ def on_no_internet(self, message=None):
117
+ """Handle the no-internet notification."""
118
+ pass
119
+
120
+ # System events
121
+ def on_system_reset(self, message=None):
122
+ """The enclosure hardware should reset any CPUs, etc."""
123
+ pass
124
+
125
+ def on_system_mute(self, message=None):
126
+ """Mute (turn off) the system speaker."""
127
+ pass
128
+
129
+ def on_system_unmute(self, message=None):
130
+ """Unmute (turn on) the system speaker."""
131
+ pass
132
+
133
+ def on_system_blink(self, message=None):
134
+ """The 'eyes' should blink the given number of times."""
135
+ pass
136
+
137
+ # Eyes events
138
+ def on_eyes_on(self, message=None):
139
+ """Illuminate or show the eyes."""
140
+ pass
141
+
142
+ def on_eyes_off(self, message=None):
143
+ """Turn off or hide the eyes."""
144
+ pass
145
+
146
+ def on_eyes_fill(self, message=None):
147
+ """Use the eyes as a type of progress meter."""
148
+ pass
149
+
150
+ def on_eyes_blink(self, message=None):
151
+ """Make the eyes blink."""
152
+ pass
153
+
154
+ def on_eyes_narrow(self, message=None):
155
+ """Make the eyes look narrow, like a squint."""
156
+ pass
157
+
158
+ def on_eyes_look(self, message=None):
159
+ """Make the eyes look to the given side."""
160
+ pass
161
+
162
+ def on_eyes_color(self, message=None):
163
+ """Change the eye color to the given RGB color."""
164
+ pass
165
+
166
+ def on_eyes_brightness(self, message=None):
167
+ """Set the brightness of the eyes in the display."""
168
+ pass
169
+
170
+ def on_eyes_reset(self, message=None):
171
+ """Restore the eyes to their default (ready) state."""
172
+ pass
173
+
174
+ def on_eyes_timed_spin(self, message=None):
175
+ """Make the eyes 'roll' for the given time."""
176
+ pass
177
+
178
+ def on_eyes_volume(self, message=None):
179
+ """Indicate the volume using the eyes."""
180
+ pass
181
+
182
+ def on_eyes_spin(self, message=None):
183
+ """Make the eyes 'roll'."""
184
+ pass
185
+
186
+ def on_eyes_set_pixel(self, message=None):
187
+ """Set individual pixels of the neopixel eyes."""
188
+ pass
189
+
190
+ # Mouth events (gated by mouth_events_active)
191
+ def _on_mouth_talk(self, message=None):
192
+ """Show a generic 'talking' animation for non-synched speech."""
193
+ if self.mouth_events_active:
194
+ self.on_talk(message)
195
+
196
+ def _on_mouth_think(self, message=None):
197
+ """Show a 'thinking' image or animation."""
198
+ if self.mouth_events_active:
199
+ self.on_think(message)
200
+
201
+ def _on_mouth_listen(self, message=None):
202
+ """Show a 'listening' image or animation."""
203
+ if self.mouth_events_active:
204
+ self.on_listen(message)
205
+
206
+ def _on_mouth_smile(self, message=None):
207
+ """Show a 'smile' image or animation."""
208
+ if self.mouth_events_active:
209
+ self.on_smile(message)
210
+
211
+ def _on_mouth_viseme(self, message=None):
212
+ """Display a viseme mouth shape for synched speech."""
213
+ if self.mouth_events_active:
214
+ self.on_viseme(message)
215
+
216
+ def _on_mouth_viseme_list(self, message=None):
217
+ """Handle mouth visemes sent as a list in a single message."""
218
+ if self.mouth_events_active:
219
+ self.on_viseme_list(message)
220
+
221
+ # Display (faceplate) events
222
+ def on_display_reset(self, message=None):
223
+ """Restore the mouth display to normal (blank)."""
224
+ pass
225
+
226
+ def on_talk(self, message=None):
227
+ """Show a generic 'talking' animation for non-synched speech."""
228
+ pass
229
+
230
+ def on_think(self, message=None):
231
+ """Show a 'thinking' image or animation."""
232
+ pass
233
+
234
+ def on_listen(self, message=None):
235
+ """Show a 'listening' image or animation."""
236
+ pass
237
+
238
+ def on_smile(self, message=None):
239
+ """Show a 'smile' image or animation."""
240
+ pass
241
+
242
+ def on_viseme(self, message=None):
243
+ """Display a viseme mouth shape for synched speech."""
244
+ pass
245
+
246
+ def on_viseme_list(self, message=None):
247
+ """Handle mouth visemes sent as a list in a single message."""
248
+ pass
249
+
250
+ def on_text(self, message=None):
251
+ """Display text (scrolling as needed)."""
252
+ pass
253
+
254
+ def on_display(self, message=None):
255
+ """Display images on the faceplate."""
256
+ pass
257
+
258
+ def on_weather_display(self, message=None):
259
+ """Show the temperature and a weather icon."""
260
+ pass
261
+
262
+ # Mouth-event gating
263
+ @property
264
+ def mouth_events_active(self):
265
+ return self._mouth_events
266
+
267
+ def _activate_mouth_events(self, message=None):
268
+ """Enable movement of the mouth with speech."""
269
+ self._mouth_events = True
270
+
271
+ def _deactivate_mouth_events(self, message=None):
272
+ """Disable movement of the mouth with speech."""
273
+ self._mouth_events = False
@@ -0,0 +1,10 @@
1
+ # START_VERSION_BLOCK
2
+ VERSION_MAJOR = 0
3
+ VERSION_MINOR = 0
4
+ VERSION_BUILD = 1
5
+ VERSION_ALPHA = 0
6
+ # END_VERSION_BLOCK
7
+
8
+ __version__ = f"{VERSION_MAJOR}.{VERSION_MINOR}.{VERSION_BUILD}" + (
9
+ f"a{VERSION_ALPHA}" if VERSION_ALPHA else ""
10
+ )
@@ -0,0 +1,78 @@
1
+ Metadata-Version: 2.4
2
+ Name: ovos-ui-enclosure-protocol
3
+ Version: 0.0.1
4
+ Summary: Legacy Mark-1 hardware enclosure protocol listener for OpenVoiceOS
5
+ Author-email: JarbasAi <jarbasai@mailfence.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/OpenVoiceOS/ovos-ui-enclosure-protocol
8
+ Project-URL: Repository, https://github.com/OpenVoiceOS/ovos-ui-enclosure-protocol
9
+ Keywords: enclosure,mark1,mycroft,OVOS,OpenVoiceOS,PHAL
10
+ Requires-Python: >=3.10
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: ovos-bus-client
14
+ Provides-Extra: test
15
+ Requires-Dist: pytest; extra == "test"
16
+ Requires-Dist: pytest-cov; extra == "test"
17
+ Dynamic: license-file
18
+
19
+ # ovos-ui-enclosure-protocol
20
+
21
+ The consumer/listener home of the legacy **Mark-1 hardware enclosure protocol**
22
+ for OpenVoiceOS.
23
+
24
+ The `enclosure.*` bus messages control the Mark-1 hardware enclosure: the LED
25
+ eyes, the mouth/faceplate display, and the system LEDs. This package provides
26
+ `EnclosureProtocolListener`, a consumer mix-in that a hardware enclosure plugin
27
+ inherits to wire the `enclosure.*` subscriptions to overridable no-op handlers.
28
+ [`ovos-PHAL-plugin-mk1`](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-mk1)
29
+ is the reference listener implementation.
30
+
31
+ The producer side — `EnclosureAPI`, the skill-facing helper that *emits*
32
+ `enclosure.*` — lives in
33
+ [`ovos-gui-api-client`](https://github.com/OpenVoiceOS/ovos-gui-api-client)
34
+ alongside `GUIInterface`, so `self.gui` and `self.enclosure` come from the same
35
+ client.
36
+
37
+ The enclosure protocol is **no longer a core abstraction**: `PHALPlugin` in
38
+ `ovos-plugin-manager` no longer bakes in the `enclosure.*` handlers, and modern
39
+ visual output is done through `GUIInterface` (OVOS-GUI-1). This package exists
40
+ so hardware enclosure plugins keep a stable, dependency-light home for the
41
+ listener side of the protocol. It does **not** reimplement GUI templates.
42
+
43
+ ## Install
44
+
45
+ ```bash
46
+ pip install ovos-ui-enclosure-protocol
47
+ ```
48
+
49
+ ## Implementing a listener
50
+
51
+ ```python
52
+ from ovos_ui_enclosure_protocol import EnclosureProtocolListener
53
+
54
+ class MyEnclosure(EnclosureProtocolListener):
55
+ def __init__(self, bus):
56
+ self.bus = bus
57
+ self.register_enclosure_namespace()
58
+
59
+ def on_eyes_color(self, message=None):
60
+ ... # drive the hardware
61
+
62
+ def shutdown(self):
63
+ self.shutdown_enclosure_namespace()
64
+ ```
65
+
66
+ Every handler defaults to a no-op, so a plugin only overrides the commands its
67
+ hardware supports. `ovos-PHAL-plugin-mk1` is the reference listener
68
+ implementation.
69
+
70
+ ## Documentation
71
+
72
+ - [`docs/index.md`](docs/index.md) — overview, install, listener guide.
73
+ - [`docs/enclosure-protocol.md`](docs/enclosure-protocol.md) — the full
74
+ `enclosure.*` message contract with producers and listeners.
75
+
76
+ ## License
77
+
78
+ Apache-2.0
@@ -0,0 +1,11 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ ovos_ui_enclosure_protocol/__init__.py
5
+ ovos_ui_enclosure_protocol/listener.py
6
+ ovos_ui_enclosure_protocol/version.py
7
+ ovos_ui_enclosure_protocol.egg-info/PKG-INFO
8
+ ovos_ui_enclosure_protocol.egg-info/SOURCES.txt
9
+ ovos_ui_enclosure_protocol.egg-info/dependency_links.txt
10
+ ovos_ui_enclosure_protocol.egg-info/requires.txt
11
+ ovos_ui_enclosure_protocol.egg-info/top_level.txt
@@ -0,0 +1,5 @@
1
+ ovos-bus-client
2
+
3
+ [test]
4
+ pytest
5
+ pytest-cov
@@ -0,0 +1 @@
1
+ ovos_ui_enclosure_protocol
@@ -0,0 +1,32 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "ovos-ui-enclosure-protocol"
7
+ dynamic = ["version"]
8
+ description = "Legacy Mark-1 hardware enclosure protocol listener for OpenVoiceOS"
9
+ readme = "README.md"
10
+ license = "Apache-2.0"
11
+ authors = [{name = "JarbasAi", email = "jarbasai@mailfence.com"}]
12
+ requires-python = ">=3.10"
13
+ keywords = ["enclosure", "mark1", "mycroft", "OVOS", "OpenVoiceOS", "PHAL"]
14
+ dependencies = [
15
+ "ovos-bus-client",
16
+ ]
17
+
18
+ [project.optional-dependencies]
19
+ test = [
20
+ "pytest",
21
+ "pytest-cov",
22
+ ]
23
+
24
+ [project.urls]
25
+ Homepage = "https://github.com/OpenVoiceOS/ovos-ui-enclosure-protocol"
26
+ Repository = "https://github.com/OpenVoiceOS/ovos-ui-enclosure-protocol"
27
+
28
+ [tool.setuptools.packages.find]
29
+ include = ["ovos_ui_enclosure_protocol*"]
30
+
31
+ [tool.setuptools.dynamic]
32
+ version = {attr = "ovos_ui_enclosure_protocol.version.__version__"}
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+