mgram 0.1.0__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.
- mgram-0.1.0/.gitignore +13 -0
- mgram-0.1.0/LICENSE +202 -0
- mgram-0.1.0/PKG-INFO +139 -0
- mgram-0.1.0/README.md +111 -0
- mgram-0.1.0/examples/block/tracker.mgram +42 -0
- mgram-0.1.0/examples/ceremony/commissioning.mgram +26 -0
- mgram-0.1.0/examples/class/firmware_model.mgram +51 -0
- mgram-0.1.0/examples/class/measurement.mgram +32 -0
- mgram-0.1.0/examples/class/sensor_driver.mgram +15 -0
- mgram-0.1.0/examples/component/firmware.mgram +27 -0
- mgram-0.1.0/examples/component/system.mgram +11 -0
- mgram-0.1.0/examples/component/system_detail.mgram +33 -0
- mgram-0.1.0/examples/dfd/sensor_context.mgram +11 -0
- mgram-0.1.0/examples/dfd/sensor_node.mgram +22 -0
- mgram-0.1.0/examples/dfd/sensor_system.mgram +56 -0
- mgram-0.1.0/examples/dfd/sensor_to_cloud.mgram +29 -0
- mgram-0.1.0/examples/dfd/system_overview.mgram +20 -0
- mgram-0.1.0/examples/gantt/duty_cycle.mgram +18 -0
- mgram-0.1.0/examples/gantt/ota_update.mgram +22 -0
- mgram-0.1.0/examples/gantt/rev_b.mgram +21 -0
- mgram-0.1.0/examples/gantt/sensor_read.mgram +28 -0
- mgram-0.1.0/examples/gantt/smp_upload.mgram +19 -0
- mgram-0.1.0/examples/hydraulic/nachher.mgram +32 -0
- mgram-0.1.0/examples/hydraulic/vorher.mgram +44 -0
- mgram-0.1.0/examples/hydraulic/wp_areas.mgram +25 -0
- mgram-0.1.0/examples/hydraulic/wp_fbh.mgram +7 -0
- mgram-0.1.0/examples/hydraulic/wp_fbh_tww.mgram +26 -0
- mgram-0.1.0/examples/hydraulic/wp_kombispeicher.mgram +24 -0
- mgram-0.1.0/examples/layers/mcumgr.mgram +19 -0
- mgram-0.1.0/examples/layers/sensor_node.mgram +21 -0
- mgram-0.1.0/examples/packet/ble_adv.mgram +16 -0
- mgram-0.1.0/examples/packet/ipv4.mgram +18 -0
- mgram-0.1.0/examples/packet/pin_cnf.mgram +11 -0
- mgram-0.1.0/examples/packet/tcp.mgram +25 -0
- mgram-0.1.0/examples/sequence/ble_backlog.mgram +24 -0
- mgram-0.1.0/examples/sequence/measure_cycle.mgram +18 -0
- mgram-0.1.0/examples/sequence/measurement_upload.mgram +11 -0
- mgram-0.1.0/examples/sequence/ota_update.mgram +34 -0
- mgram-0.1.0/examples/state/ble_connection.mgram +19 -0
- mgram-0.1.0/examples/state/dfu_image.mgram +21 -0
- mgram-0.1.0/examples/state/duty_cycle.mgram +15 -0
- mgram-0.1.0/examples/state/ota_update.mgram +32 -0
- mgram-0.1.0/examples/state/write_buffer.mgram +13 -0
- mgram-0.1.0/pyproject.toml +64 -0
- mgram-0.1.0/skills/mgram/SKILL.md +25 -0
- mgram-0.1.0/src/mgram/__init__.py +107 -0
- mgram-0.1.0/src/mgram/__main__.py +6 -0
- mgram-0.1.0/src/mgram/check.py +321 -0
- mgram-0.1.0/src/mgram/cli.py +319 -0
- mgram-0.1.0/src/mgram/dsl.py +303 -0
- mgram-0.1.0/src/mgram/geometry.py +213 -0
- mgram-0.1.0/src/mgram/grid.py +610 -0
- mgram-0.1.0/src/mgram/labels.py +209 -0
- mgram-0.1.0/src/mgram/place.py +671 -0
- mgram-0.1.0/src/mgram/refs.py +85 -0
- mgram-0.1.0/src/mgram/registry.py +245 -0
- mgram-0.1.0/src/mgram/route.py +646 -0
- mgram-0.1.0/src/mgram/scene.py +153 -0
- mgram-0.1.0/src/mgram/sphinx.py +332 -0
- mgram-0.1.0/src/mgram/svg.py +138 -0
- mgram-0.1.0/src/mgram/text.py +28 -0
- mgram-0.1.0/src/mgram/theme.py +190 -0
- mgram-0.1.0/src/mgram/types/__init__.py +4 -0
- mgram-0.1.0/src/mgram/types/block.py +203 -0
- mgram-0.1.0/src/mgram/types/ceremony.py +208 -0
- mgram-0.1.0/src/mgram/types/classes.py +162 -0
- mgram-0.1.0/src/mgram/types/component.py +129 -0
- mgram-0.1.0/src/mgram/types/dfd.py +160 -0
- mgram-0.1.0/src/mgram/types/gantt.py +730 -0
- mgram-0.1.0/src/mgram/types/hydraulic.py +393 -0
- mgram-0.1.0/src/mgram/types/layers.py +272 -0
- mgram-0.1.0/src/mgram/types/packet.py +391 -0
- mgram-0.1.0/src/mgram/types/sequence.py +695 -0
- mgram-0.1.0/src/mgram/types/state.py +219 -0
- mgram-0.1.0/src/mgram/types/uml.py +62 -0
- mgram-0.1.0/tests/conftest.py +15 -0
- mgram-0.1.0/tests/golden/block-catalog.svg +17 -0
- mgram-0.1.0/tests/golden/block-tracker.svg +19 -0
- mgram-0.1.0/tests/golden/ceremony-catalog.svg +15 -0
- mgram-0.1.0/tests/golden/ceremony-commissioning.svg +14 -0
- mgram-0.1.0/tests/golden/class-catalog.svg +19 -0
- mgram-0.1.0/tests/golden/class-firmware_model.svg +21 -0
- mgram-0.1.0/tests/golden/class-measurement.svg +18 -0
- mgram-0.1.0/tests/golden/class-sensor_driver.svg +12 -0
- mgram-0.1.0/tests/golden/component-catalog.svg +16 -0
- mgram-0.1.0/tests/golden/component-firmware.svg +16 -0
- mgram-0.1.0/tests/golden/component-system.svg +14 -0
- mgram-0.1.0/tests/golden/component-system_detail.svg +17 -0
- mgram-0.1.0/tests/golden/dfd-catalog.svg +9 -0
- mgram-0.1.0/tests/golden/dfd-sensor_context.svg +10 -0
- mgram-0.1.0/tests/golden/dfd-sensor_node.svg +15 -0
- mgram-0.1.0/tests/golden/dfd-sensor_system.svg +14 -0
- mgram-0.1.0/tests/golden/dfd-sensor_to_cloud.svg +13 -0
- mgram-0.1.0/tests/golden/dfd-system_overview.svg +14 -0
- mgram-0.1.0/tests/golden/gantt-catalog.svg +17 -0
- mgram-0.1.0/tests/golden/gantt-duty_cycle.svg +11 -0
- mgram-0.1.0/tests/golden/gantt-ota_update.svg +14 -0
- mgram-0.1.0/tests/golden/gantt-rev_b.svg +15 -0
- mgram-0.1.0/tests/golden/gantt-sensor_read.svg +14 -0
- mgram-0.1.0/tests/golden/gantt-smp_upload.svg +15 -0
- mgram-0.1.0/tests/golden/hydraulic-catalog.svg +20 -0
- mgram-0.1.0/tests/golden/hydraulic-nachher.svg +21 -0
- mgram-0.1.0/tests/golden/hydraulic-vorher.svg +23 -0
- mgram-0.1.0/tests/golden/hydraulic-wp_areas.svg +20 -0
- mgram-0.1.0/tests/golden/hydraulic-wp_fbh.svg +14 -0
- mgram-0.1.0/tests/golden/hydraulic-wp_fbh_tww.svg +19 -0
- mgram-0.1.0/tests/golden/hydraulic-wp_kombispeicher.svg +18 -0
- mgram-0.1.0/tests/golden/layers-catalog.svg +14 -0
- mgram-0.1.0/tests/golden/layers-mcumgr.svg +14 -0
- mgram-0.1.0/tests/golden/layers-sensor_node.svg +13 -0
- mgram-0.1.0/tests/golden/packet-ble_adv.svg +13 -0
- mgram-0.1.0/tests/golden/packet-catalog.svg +13 -0
- mgram-0.1.0/tests/golden/packet-ipv4.svg +10 -0
- mgram-0.1.0/tests/golden/packet-pin_cnf.svg +10 -0
- mgram-0.1.0/tests/golden/packet-tcp.svg +12 -0
- mgram-0.1.0/tests/golden/sequence-ble_backlog.svg +18 -0
- mgram-0.1.0/tests/golden/sequence-catalog.svg +22 -0
- mgram-0.1.0/tests/golden/sequence-measure_cycle.svg +18 -0
- mgram-0.1.0/tests/golden/sequence-measurement_upload.svg +13 -0
- mgram-0.1.0/tests/golden/sequence-ota_update.svg +20 -0
- mgram-0.1.0/tests/golden/state-ble_connection.svg +13 -0
- mgram-0.1.0/tests/golden/state-catalog.svg +13 -0
- mgram-0.1.0/tests/golden/state-dfu_image.svg +14 -0
- mgram-0.1.0/tests/golden/state-duty_cycle.svg +13 -0
- mgram-0.1.0/tests/golden/state-ota_update.svg +14 -0
- mgram-0.1.0/tests/golden/state-write_buffer.svg +14 -0
- mgram-0.1.0/tests/test_block.py +72 -0
- mgram-0.1.0/tests/test_ceremony.py +52 -0
- mgram-0.1.0/tests/test_check.py +137 -0
- mgram-0.1.0/tests/test_cli.py +93 -0
- mgram-0.1.0/tests/test_dfd.py +313 -0
- mgram-0.1.0/tests/test_dsl.py +107 -0
- mgram-0.1.0/tests/test_gantt.py +218 -0
- mgram-0.1.0/tests/test_golden.py +33 -0
- mgram-0.1.0/tests/test_hydraulic.py +137 -0
- mgram-0.1.0/tests/test_layers.py +100 -0
- mgram-0.1.0/tests/test_packet.py +133 -0
- mgram-0.1.0/tests/test_place.py +118 -0
- mgram-0.1.0/tests/test_properties.py +431 -0
- mgram-0.1.0/tests/test_refs.py +59 -0
- mgram-0.1.0/tests/test_registry.py +95 -0
- mgram-0.1.0/tests/test_route.py +58 -0
- mgram-0.1.0/tests/test_sequence.py +215 -0
- mgram-0.1.0/tests/test_sphinx.py +234 -0
- mgram-0.1.0/tests/test_theme.py +217 -0
- mgram-0.1.0/tests/test_uml.py +241 -0
mgram-0.1.0/.gitignore
ADDED
mgram-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
mgram-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: mgram
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Diagrams from text files on a grid: hydraulic plans and more, with readability checks
|
|
5
|
+
Project-URL: Homepage, https://jonas-rem.github.io/mgram/
|
|
6
|
+
Project-URL: Documentation, https://jonas-rem.github.io/mgram/
|
|
7
|
+
Project-URL: Repository, https://github.com/jonas-rem/mgram
|
|
8
|
+
Project-URL: Issues, https://github.com/jonas-rem/mgram/issues
|
|
9
|
+
Author-email: Jonas Remmert <j.remmert@mailbox.org>
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: dfd,diagrams,gantt,hydraulic,packet,sphinx,svg,uml
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Topic :: Documentation :: Sphinx
|
|
21
|
+
Classifier: Topic :: Multimedia :: Graphics
|
|
22
|
+
Requires-Python: >=3.11
|
|
23
|
+
Provides-Extra: png
|
|
24
|
+
Requires-Dist: cairosvg>=2.7; extra == 'png'
|
|
25
|
+
Provides-Extra: sphinx
|
|
26
|
+
Requires-Dist: sphinx>=7; extra == 'sphinx'
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# mgram
|
|
30
|
+
|
|
31
|
+
mgram is a diagramming tool for technical diagrams, built for agentic use and
|
|
32
|
+
docs-as-text. Diagrams are written in plain text (`.mgram`), exported to SVG,
|
|
33
|
+
PNG or PDF, or embedded directly in Sphinx documentation.
|
|
34
|
+
|
|
35
|
+
See the full showcase and documentation at
|
|
36
|
+
[jonas-rem.github.io/mgram](https://jonas-rem.github.io/mgram/).
|
|
37
|
+
|
|
38
|
+
## Example
|
|
39
|
+
|
|
40
|
+
```text
|
|
41
|
+
sequence
|
|
42
|
+
size small
|
|
43
|
+
participant node : Sensor node
|
|
44
|
+
participant gw : Gateway
|
|
45
|
+
participant cloud : Cloud
|
|
46
|
+
call node -> node : sample SHT40
|
|
47
|
+
send node -> gw : notify reading
|
|
48
|
+
call gw -> cloud : publish QoS 1
|
|
49
|
+
call cloud -> cloud : store
|
|
50
|
+
reply cloud -> gw : PUBACK
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+

|
|
54
|
+
|
|
55
|
+
## Showcase
|
|
56
|
+
|
|
57
|
+
**Data flow diagram (`dfd`)** ([source](https://github.com/jonas-rem/mgram/blob/main/examples/dfd/sensor_to_cloud.mgram),
|
|
58
|
+
[docs](https://jonas-rem.github.io/mgram/types/dfd.html)):
|
|
59
|
+
|
|
60
|
+

|
|
61
|
+
|
|
62
|
+
**Timing and Gantt chart (`gantt`)** ([source](https://github.com/jonas-rem/mgram/blob/main/examples/gantt/duty_cycle.mgram),
|
|
63
|
+
[docs](https://jonas-rem.github.io/mgram/types/gantt.html)):
|
|
64
|
+
|
|
65
|
+

|
|
66
|
+
|
|
67
|
+
**Packet layout (`packet`)** ([source](https://github.com/jonas-rem/mgram/blob/main/examples/packet/tcp.mgram),
|
|
68
|
+
[docs](https://jonas-rem.github.io/mgram/types/packet.html)):
|
|
69
|
+
|
|
70
|
+

|
|
71
|
+
|
|
72
|
+
**Hydraulic plan (`hydraulic`)** ([source](https://github.com/jonas-rem/mgram/blob/main/examples/hydraulic/wp_fbh_tww.mgram),
|
|
73
|
+
[docs](https://jonas-rem.github.io/mgram/types/hydraulic.html)):
|
|
74
|
+
|
|
75
|
+

|
|
76
|
+
|
|
77
|
+
## Diagram types
|
|
78
|
+
|
|
79
|
+
mgram supports 11 diagram types (see the
|
|
80
|
+
[diagram selection guide](https://jonas-rem.github.io/mgram/choose.html)):
|
|
81
|
+
|
|
82
|
+
| Type | Purpose |
|
|
83
|
+
|---|---|
|
|
84
|
+
| [`component`](https://jonas-rem.github.io/mgram/types/component.html) | UML component and architecture block diagrams |
|
|
85
|
+
| [`block`](https://jonas-rem.github.io/mgram/types/block.html) | Hardware block diagrams with buses, signals and power trees |
|
|
86
|
+
| [`layers`](https://jonas-rem.github.io/mgram/types/layers.html) | Execution contexts, layers and seams |
|
|
87
|
+
| [`class`](https://jonas-rem.github.io/mgram/types/class.html) | UML class diagrams with attributes and operations |
|
|
88
|
+
| [`sequence`](https://jonas-rem.github.io/mgram/types/sequence.html) | UML sequence diagrams |
|
|
89
|
+
| [`state`](https://jonas-rem.github.io/mgram/types/state.html) | UML state machine diagrams with composite states |
|
|
90
|
+
| [`gantt`](https://jonas-rem.github.io/mgram/types/gantt.html) | Gantt charts and timing diagrams |
|
|
91
|
+
| [`packet`](https://jonas-rem.github.io/mgram/types/packet.html) | Bit-level packet headers and register layouts |
|
|
92
|
+
| [`dfd`](https://jonas-rem.github.io/mgram/types/dfd.html) | Data flow diagrams for threat modelling |
|
|
93
|
+
| [`ceremony`](https://jonas-rem.github.io/mgram/types/ceremony.html) | Security ceremonies across trust zones |
|
|
94
|
+
| [`hydraulic`](https://jonas-rem.github.io/mgram/types/hydraulic.html) | Hydraulic plans of heat pump systems |
|
|
95
|
+
|
|
96
|
+
## Quick start
|
|
97
|
+
|
|
98
|
+
```sh
|
|
99
|
+
pip install 'mgram[png,sphinx]' # extras: png (cairosvg + libcairo), sphinx
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Render a diagram or inspect the syntax of a type:
|
|
103
|
+
|
|
104
|
+
```sh
|
|
105
|
+
mgram render examples/dfd/sensor_to_cloud.mgram > diagram.svg
|
|
106
|
+
mgram render examples/dfd/sensor_to_cloud.mgram --theme docs/theme.toml --png diagram.png
|
|
107
|
+
mgram help # quick start and diagram types
|
|
108
|
+
mgram help dfd # syntax, kinds, ports, checks and example
|
|
109
|
+
mgram help -v dfd # include placer rules and domain guidelines
|
|
110
|
+
mgram catalog hydraulic > catalog.svg
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Exit codes of `mgram render`: `0` without findings, `1` with findings (printed
|
|
114
|
+
to stderr as `FILE:LINE: check: message; fix: proposal`), and `2` on a syntax,
|
|
115
|
+
usage or output error.
|
|
116
|
+
|
|
117
|
+
## Documentation and integrations
|
|
118
|
+
|
|
119
|
+
The [usage guide](https://jonas-rem.github.io/mgram/usage.html) covers:
|
|
120
|
+
|
|
121
|
+
- **Syntax and auto-layout:** grid coordinates, placer hints (`col`, `row`,
|
|
122
|
+
`align`), `mgram freeze` and detail links (`detail=`).
|
|
123
|
+
- **Python API:** `mgram.render()` and `mgram.freeze()` with element bounding
|
|
124
|
+
boxes and references (`ref=`).
|
|
125
|
+
- **Sphinx extension:** `.. mgram::` and `.. mgram-catalog::` directives with
|
|
126
|
+
inline SVG HTML, PDF LaTeX output and reference resolvers.
|
|
127
|
+
- **Themes:** TOML theme files for colours, accent tinting, fonts and CSS.
|
|
128
|
+
- **AI coding agents:** `mgram help -v` and `mgram help -v <type>` teach the
|
|
129
|
+
workflow, syntax, checks and domain guidelines directly from the CLI;
|
|
130
|
+
[`skills/mgram/`](https://github.com/jonas-rem/mgram/tree/main/skills/mgram) is an optional thin skill wrapper.
|
|
131
|
+
|
|
132
|
+
## Contributing
|
|
133
|
+
|
|
134
|
+
See [CONTRIBUTING.md](https://github.com/jonas-rem/mgram/blob/main/CONTRIBUTING.md) and the
|
|
135
|
+
[development guide](https://jonas-rem.github.io/mgram/development.html).
|
|
136
|
+
|
|
137
|
+
## License
|
|
138
|
+
|
|
139
|
+
Apache License 2.0, see [LICENSE](https://github.com/jonas-rem/mgram/blob/main/LICENSE).
|
mgram-0.1.0/README.md
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# mgram
|
|
2
|
+
|
|
3
|
+
mgram is a diagramming tool for technical diagrams, built for agentic use and
|
|
4
|
+
docs-as-text. Diagrams are written in plain text (`.mgram`), exported to SVG,
|
|
5
|
+
PNG or PDF, or embedded directly in Sphinx documentation.
|
|
6
|
+
|
|
7
|
+
See the full showcase and documentation at
|
|
8
|
+
[jonas-rem.github.io/mgram](https://jonas-rem.github.io/mgram/).
|
|
9
|
+
|
|
10
|
+
## Example
|
|
11
|
+
|
|
12
|
+
```text
|
|
13
|
+
sequence
|
|
14
|
+
size small
|
|
15
|
+
participant node : Sensor node
|
|
16
|
+
participant gw : Gateway
|
|
17
|
+
participant cloud : Cloud
|
|
18
|
+
call node -> node : sample SHT40
|
|
19
|
+
send node -> gw : notify reading
|
|
20
|
+
call gw -> cloud : publish QoS 1
|
|
21
|
+
call cloud -> cloud : store
|
|
22
|
+
reply cloud -> gw : PUBACK
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+

|
|
26
|
+
|
|
27
|
+
## Showcase
|
|
28
|
+
|
|
29
|
+
**Data flow diagram (`dfd`)** ([source](https://github.com/jonas-rem/mgram/blob/main/examples/dfd/sensor_to_cloud.mgram),
|
|
30
|
+
[docs](https://jonas-rem.github.io/mgram/types/dfd.html)):
|
|
31
|
+
|
|
32
|
+

|
|
33
|
+
|
|
34
|
+
**Timing and Gantt chart (`gantt`)** ([source](https://github.com/jonas-rem/mgram/blob/main/examples/gantt/duty_cycle.mgram),
|
|
35
|
+
[docs](https://jonas-rem.github.io/mgram/types/gantt.html)):
|
|
36
|
+
|
|
37
|
+

|
|
38
|
+
|
|
39
|
+
**Packet layout (`packet`)** ([source](https://github.com/jonas-rem/mgram/blob/main/examples/packet/tcp.mgram),
|
|
40
|
+
[docs](https://jonas-rem.github.io/mgram/types/packet.html)):
|
|
41
|
+
|
|
42
|
+

|
|
43
|
+
|
|
44
|
+
**Hydraulic plan (`hydraulic`)** ([source](https://github.com/jonas-rem/mgram/blob/main/examples/hydraulic/wp_fbh_tww.mgram),
|
|
45
|
+
[docs](https://jonas-rem.github.io/mgram/types/hydraulic.html)):
|
|
46
|
+
|
|
47
|
+

|
|
48
|
+
|
|
49
|
+
## Diagram types
|
|
50
|
+
|
|
51
|
+
mgram supports 11 diagram types (see the
|
|
52
|
+
[diagram selection guide](https://jonas-rem.github.io/mgram/choose.html)):
|
|
53
|
+
|
|
54
|
+
| Type | Purpose |
|
|
55
|
+
|---|---|
|
|
56
|
+
| [`component`](https://jonas-rem.github.io/mgram/types/component.html) | UML component and architecture block diagrams |
|
|
57
|
+
| [`block`](https://jonas-rem.github.io/mgram/types/block.html) | Hardware block diagrams with buses, signals and power trees |
|
|
58
|
+
| [`layers`](https://jonas-rem.github.io/mgram/types/layers.html) | Execution contexts, layers and seams |
|
|
59
|
+
| [`class`](https://jonas-rem.github.io/mgram/types/class.html) | UML class diagrams with attributes and operations |
|
|
60
|
+
| [`sequence`](https://jonas-rem.github.io/mgram/types/sequence.html) | UML sequence diagrams |
|
|
61
|
+
| [`state`](https://jonas-rem.github.io/mgram/types/state.html) | UML state machine diagrams with composite states |
|
|
62
|
+
| [`gantt`](https://jonas-rem.github.io/mgram/types/gantt.html) | Gantt charts and timing diagrams |
|
|
63
|
+
| [`packet`](https://jonas-rem.github.io/mgram/types/packet.html) | Bit-level packet headers and register layouts |
|
|
64
|
+
| [`dfd`](https://jonas-rem.github.io/mgram/types/dfd.html) | Data flow diagrams for threat modelling |
|
|
65
|
+
| [`ceremony`](https://jonas-rem.github.io/mgram/types/ceremony.html) | Security ceremonies across trust zones |
|
|
66
|
+
| [`hydraulic`](https://jonas-rem.github.io/mgram/types/hydraulic.html) | Hydraulic plans of heat pump systems |
|
|
67
|
+
|
|
68
|
+
## Quick start
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
pip install 'mgram[png,sphinx]' # extras: png (cairosvg + libcairo), sphinx
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Render a diagram or inspect the syntax of a type:
|
|
75
|
+
|
|
76
|
+
```sh
|
|
77
|
+
mgram render examples/dfd/sensor_to_cloud.mgram > diagram.svg
|
|
78
|
+
mgram render examples/dfd/sensor_to_cloud.mgram --theme docs/theme.toml --png diagram.png
|
|
79
|
+
mgram help # quick start and diagram types
|
|
80
|
+
mgram help dfd # syntax, kinds, ports, checks and example
|
|
81
|
+
mgram help -v dfd # include placer rules and domain guidelines
|
|
82
|
+
mgram catalog hydraulic > catalog.svg
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Exit codes of `mgram render`: `0` without findings, `1` with findings (printed
|
|
86
|
+
to stderr as `FILE:LINE: check: message; fix: proposal`), and `2` on a syntax,
|
|
87
|
+
usage or output error.
|
|
88
|
+
|
|
89
|
+
## Documentation and integrations
|
|
90
|
+
|
|
91
|
+
The [usage guide](https://jonas-rem.github.io/mgram/usage.html) covers:
|
|
92
|
+
|
|
93
|
+
- **Syntax and auto-layout:** grid coordinates, placer hints (`col`, `row`,
|
|
94
|
+
`align`), `mgram freeze` and detail links (`detail=`).
|
|
95
|
+
- **Python API:** `mgram.render()` and `mgram.freeze()` with element bounding
|
|
96
|
+
boxes and references (`ref=`).
|
|
97
|
+
- **Sphinx extension:** `.. mgram::` and `.. mgram-catalog::` directives with
|
|
98
|
+
inline SVG HTML, PDF LaTeX output and reference resolvers.
|
|
99
|
+
- **Themes:** TOML theme files for colours, accent tinting, fonts and CSS.
|
|
100
|
+
- **AI coding agents:** `mgram help -v` and `mgram help -v <type>` teach the
|
|
101
|
+
workflow, syntax, checks and domain guidelines directly from the CLI;
|
|
102
|
+
[`skills/mgram/`](https://github.com/jonas-rem/mgram/tree/main/skills/mgram) is an optional thin skill wrapper.
|
|
103
|
+
|
|
104
|
+
## Contributing
|
|
105
|
+
|
|
106
|
+
See [CONTRIBUTING.md](https://github.com/jonas-rem/mgram/blob/main/CONTRIBUTING.md) and the
|
|
107
|
+
[development guide](https://jonas-rem.github.io/mgram/development.html).
|
|
108
|
+
|
|
109
|
+
## License
|
|
110
|
+
|
|
111
|
+
Apache License 2.0, see [LICENSE](https://github.com/jonas-rem/mgram/blob/main/LICENSE).
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
block
|
|
2
|
+
size large
|
|
3
|
+
# Asset tracker: hardware of the LTE-M node; the rails tag the parts they supply
|
|
4
|
+
source usb : USB-C | 5 V
|
|
5
|
+
source bat : Battery | Li-ion 3.7 V
|
|
6
|
+
block pmic : PMIC | nPM1300
|
|
7
|
+
rail v18 tags : 1V8
|
|
8
|
+
rail v33 row=0 tags : 3V3
|
|
9
|
+
package sip col=0 : nRF9161 SiP {
|
|
10
|
+
block cpu col=0 row=1 : Cortex-M33 | 64 MHz
|
|
11
|
+
block flash col=0 row=0 : Flash | 1 MB
|
|
12
|
+
block ram col=0 row=2 : RAM | 256 KB
|
|
13
|
+
block modem : LTE-M / NB-IoT | modem
|
|
14
|
+
}
|
|
15
|
+
bus i2c : I2C | 400 kHz
|
|
16
|
+
block sht : SHT40 | humidity, temp.
|
|
17
|
+
block lis : LIS2DH12 | accelerometer
|
|
18
|
+
block drv : LED driver | LP5562
|
|
19
|
+
block nor row=5 : NOR flash | 8 MB
|
|
20
|
+
block led : RGB LED
|
|
21
|
+
block ant : LTE antenna
|
|
22
|
+
block sim row=11 : eSIM
|
|
23
|
+
power usb -> pmic : VBUS
|
|
24
|
+
power bat -> pmic : VBAT
|
|
25
|
+
power pmic -> v18
|
|
26
|
+
power pmic -> v33
|
|
27
|
+
power v18 -> sip
|
|
28
|
+
power v18 -> sht
|
|
29
|
+
power v18 -> lis
|
|
30
|
+
power v33 -> drv
|
|
31
|
+
power v33 -> nor
|
|
32
|
+
link cpu -> flash
|
|
33
|
+
link cpu -> ram
|
|
34
|
+
link cpu -> modem : IPC
|
|
35
|
+
link modem.e -> ant : RF
|
|
36
|
+
link modem.s -> sim : UICC
|
|
37
|
+
link cpu -> i2c
|
|
38
|
+
link cpu -> nor : SPI
|
|
39
|
+
link i2c -> sht
|
|
40
|
+
link i2c -> lis
|
|
41
|
+
link i2c -> drv
|
|
42
|
+
signal drv -> led : PWM
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
ceremony
|
|
2
|
+
size large
|
|
3
|
+
# Commissioning of a climate sensor: only the technician ties a node to its room
|
|
4
|
+
lane cloud : Cloud backend
|
|
5
|
+
zone site : On site {
|
|
6
|
+
human tech : Technician
|
|
7
|
+
lane app : Phone app | Android
|
|
8
|
+
}
|
|
9
|
+
zone node : Sensor node {
|
|
10
|
+
lane fw : Firmware | application core
|
|
11
|
+
lane radio : BLE radio | network core
|
|
12
|
+
}
|
|
13
|
+
lane tag : Device label | QR code
|
|
14
|
+
msg cloud -> app : Room list
|
|
15
|
+
msg tag -> tech : Device key | QR code
|
|
16
|
+
msg tech -> app : Device key | camera scan
|
|
17
|
+
note over=tech : reads the room number at the door
|
|
18
|
+
msg tech -> app : Room assignment
|
|
19
|
+
msg app -> radio : Pairing request | device key
|
|
20
|
+
msg radio -> fw : Bond keys
|
|
21
|
+
msg fw -> app : Node ID | signed
|
|
22
|
+
msg app -> cloud : Node ID, room
|
|
23
|
+
msg cloud -> app : Provisioning token
|
|
24
|
+
msg app -> fw : Provisioning token
|
|
25
|
+
msg fw -> cloud : First reading | over the gateway
|
|
26
|
+
note over=tech : checks the reading in the app before leaving
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
class
|
|
2
|
+
size large
|
|
3
|
+
# Climate sensor: classes of the sensor node firmware by package
|
|
4
|
+
package drivers : drivers {
|
|
5
|
+
interface sensor : Sensor
|
|
6
|
+
| + init(): int
|
|
7
|
+
| + read(m: Measurement*): int
|
|
8
|
+
class sht40 : Sht40
|
|
9
|
+
| - addr: uint8_t
|
|
10
|
+
class bme280 : Bme280
|
|
11
|
+
| - calib: Bme280Calib
|
|
12
|
+
class bus : I2cBus
|
|
13
|
+
| + transfer(addr, tx, rx): int
|
|
14
|
+
}
|
|
15
|
+
package app : app {
|
|
16
|
+
class sampler : Sampler
|
|
17
|
+
| - period_s: uint16_t
|
|
18
|
+
| + tick(): void
|
|
19
|
+
struct meas : Measurement
|
|
20
|
+
| + time_s: uint32_t
|
|
21
|
+
| + temp_mc: int32_t
|
|
22
|
+
| + rh_pm: uint16_t
|
|
23
|
+
}
|
|
24
|
+
package storage : storage {
|
|
25
|
+
class store abstract : Store
|
|
26
|
+
| + append(m: Measurement): int
|
|
27
|
+
| + oldest(m: Measurement*): int
|
|
28
|
+
class flashlog : FlashLog
|
|
29
|
+
| - sector: uint16_t
|
|
30
|
+
class ramlog : RamLog
|
|
31
|
+
| - ring: Measurement[64]
|
|
32
|
+
}
|
|
33
|
+
package ble : ble {
|
|
34
|
+
class service : ClimateService
|
|
35
|
+
| + notify(m: Measurement): int
|
|
36
|
+
| + on_confirm(): void
|
|
37
|
+
class backlog : BacklogSender
|
|
38
|
+
| - in_flight: bool
|
|
39
|
+
| + resume(): void
|
|
40
|
+
}
|
|
41
|
+
aggregation sampler -> sensor to=1..2
|
|
42
|
+
realizes sht40 -> sensor
|
|
43
|
+
realizes bme280 -> sensor
|
|
44
|
+
directed sht40 -> bus
|
|
45
|
+
directed bme280 -> bus
|
|
46
|
+
directed sampler -> store
|
|
47
|
+
inherits flashlog -> store
|
|
48
|
+
inherits ramlog -> store
|
|
49
|
+
composition backlog -> service
|
|
50
|
+
directed backlog -> store
|
|
51
|
+
dependency sampler -> meas
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
class
|
|
2
|
+
# Climate sensor: measurement path in the firmware of the sensor node
|
|
3
|
+
class sampler : Sampler
|
|
4
|
+
| - period_s: uint16_t
|
|
5
|
+
| + tick(): void
|
|
6
|
+
interface sensor : Sensor
|
|
7
|
+
| + init(): int
|
|
8
|
+
| + read(m: Measurement*): int
|
|
9
|
+
class sht40 : Sht40
|
|
10
|
+
| - addr: uint8_t
|
|
11
|
+
class bme280 : Bme280
|
|
12
|
+
| - calib: Bme280Calib
|
|
13
|
+
class bus : I2cBus
|
|
14
|
+
| + transfer(addr, tx, rx): int
|
|
15
|
+
class ring : RingBuffer
|
|
16
|
+
| - head: uint16_t
|
|
17
|
+
| - count: uint16_t
|
|
18
|
+
| + push(m: Measurement): bool
|
|
19
|
+
| + pop(m: Measurement*): bool
|
|
20
|
+
struct meas : Measurement
|
|
21
|
+
| + time_s: uint32_t
|
|
22
|
+
| + temp_mc: int32_t
|
|
23
|
+
| + rh_pm: uint16_t
|
|
24
|
+
enum status : SensorStatus | OK | BUSY | CRC_ERROR | NO_DEVICE
|
|
25
|
+
aggregation sampler -> sensor from=1 to=1..2
|
|
26
|
+
composition sampler -> ring from=1 to=1
|
|
27
|
+
realizes sht40 -> sensor
|
|
28
|
+
realizes bme280 -> sensor
|
|
29
|
+
directed sht40 -> bus
|
|
30
|
+
directed bme280 -> bus
|
|
31
|
+
dependency ring -> meas
|
|
32
|
+
dependency sensor -> status : «return»
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
class
|
|
2
|
+
# Climate sensor: one driver interface for both humidity sensors
|
|
3
|
+
interface sensor : Sensor
|
|
4
|
+
| + init(): int
|
|
5
|
+
| + read(m: Measurement*): int
|
|
6
|
+
class sht40 : Sht40
|
|
7
|
+
| - addr: uint8_t
|
|
8
|
+
class bme280 : Bme280
|
|
9
|
+
| - calib: Bme280Calib
|
|
10
|
+
struct meas : Measurement
|
|
11
|
+
| + temp_mc: int32_t
|
|
12
|
+
| + rh_pm: uint16_t
|
|
13
|
+
realizes sht40 -> sensor
|
|
14
|
+
realizes bme280 -> sensor
|
|
15
|
+
dependency sensor -> meas
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
component
|
|
2
|
+
# Climate sensor: firmware architecture of the sensor node, in layers
|
|
3
|
+
layer app : Application {
|
|
4
|
+
component meas : Measurement | duty cycle
|
|
5
|
+
component ota : OTA agent
|
|
6
|
+
}
|
|
7
|
+
layer svc : Services {
|
|
8
|
+
component sensors detail=../class/sensor_driver.mgram : Sensor drivers
|
|
9
|
+
component log : Data logger
|
|
10
|
+
component gatt : GATT services | climate, DFU
|
|
11
|
+
}
|
|
12
|
+
layer platform : Platform {
|
|
13
|
+
component i2c : I2C driver
|
|
14
|
+
component flash : Flash driver
|
|
15
|
+
component ble : BLE stack | SoftDevice
|
|
16
|
+
}
|
|
17
|
+
interface istore : Storage
|
|
18
|
+
component boot : Bootloader | MCUboot
|
|
19
|
+
uses meas -> sensors : read
|
|
20
|
+
uses meas -> log : append
|
|
21
|
+
uses meas -> gatt : notify
|
|
22
|
+
uses ota -> gatt : image
|
|
23
|
+
uses sensors -> i2c
|
|
24
|
+
requires log -> istore
|
|
25
|
+
provides flash -> istore
|
|
26
|
+
uses gatt -> ble
|
|
27
|
+
uses boot -> flash : swap
|