summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md8
-rw-r--r--artifacts/meson.build23
-rw-r--r--doc/api/future.md49
-rw-r--r--fw/sim/meson.build1
-rwxr-xr-xfw/simulate-network.sh5
-rw-r--r--meson.build36
-rw-r--r--pcb/meson.build2
-rwxr-xr-xtools/deploy.py.in (renamed from tools/deploy.py)11
-rw-r--r--tools/meson.build8
-rw-r--r--web/.gitignore2
-rw-r--r--web/index.html12
-rw-r--r--web/meson.build1
12 files changed, 91 insertions, 67 deletions
diff --git a/README.md b/README.md
index a6dfe0a..356feeb 100644
--- a/README.md
+++ b/README.md
@@ -28,14 +28,14 @@ meson setup build
ninja -C build
```
-The resulting artifacts can be listed with `tree`.
+All artifacts of the build are bundled in a tar archive file.
```
-tree build/artifacts
+tar -tf build/iot-contact-v*.tar.zst
```
-These artifacts are organized as static website. It can be opened with Firefox.
+This archive file can be deployed with the `deploy.py` script.
```
-firefox build/artifacts/index.html
+./build/tools/deploy.py
```
diff --git a/artifacts/meson.build b/artifacts/meson.build
deleted file mode 100644
index ac15661..0000000
--- a/artifacts/meson.build
+++ /dev/null
@@ -1,23 +0,0 @@
-artifacts = [
- index_html,
- css,
- schematic,
- bom,
- simulation,
- update_image,
- factory_image,
- kicad_pcb,
-]
-
-foreach artifact : artifacts
- custom_target(
- output: [fs.name(artifact.full_path())],
- command: [
- cp,
- artifact.full_path(),
- meson.current_build_dir(),
- ],
- depends: artifact,
- build_by_default: true,
- )
-endforeach
diff --git a/doc/api/future.md b/doc/api/future.md
index ad5e43d..7530704 100644
--- a/doc/api/future.md
+++ b/doc/api/future.md
@@ -22,35 +22,46 @@ accessed directly with its link-local address.
# HTTP Server
-- `GET /device/type` `text/plain`
-- `GET /device/type/uuid` `text/plain`
-- `GET /device/hardware/version` `text/plain`
-- `GET /device/mac-address/eui-48` `text/plain`
-- `POST /device/reboot`
+- `GET /` `application/json` (returns device info, see below)
- `GET /settings` `application/json`
- `PUT /settings` `application/json`
-- `GET /firmware/bootloader/version` `text/plain`
-- `GET /firmware/bootloader` `application/octet-stream`
+# Device Info
-- `GET /firmware/application/active/version` `text/plain`
-- `GET /firmware/application/active` `application/octet-stream`
-- `GET /firmware/application/active/confirmed-flag` `text/plain`
-- `PUT /firmware/application/active/confirmed-flag` `text/plain`
-
-- `GET /firmware/application/inactive/version` `text/plain`
-- `GET /firmware/application/inactive` `application/octet-stream`
-- `PUT /firmware/application/inactive` `application/octet-stream`
-- `DELETE /firmware/application/inactive`
-- `GET /firmware/application/inactive/test-boot-flag` `text/plain`
-- `PUT /firmware/application/inactive/test-boot-flag` `text/plain`
+```
+{
+ "hostname": "mydevice",
+ "type": {
+ "text": "iot-contact",
+ "uuid": "eeb58c52-8e25-489c-9a1a-c4662fc9318a"
+ },
+ "version": {
+ "hardware": "v1.2.3",
+ "firmware": "v4.5.6"
+ },
+ "address": {
+ "mac": {
+ "eui-48": "00:00:5e:00:53:01"
+ }
+ }
+}
+```
# Settings
```
{
"hostname": "mydevice",
+ "update": {
+ "url": "https://deploy.xengineering.eu/git/iot-contact/latest/",
+ "automation": {
+ "enable": false,
+ "hour": null,
+ "minute": null,
+ "second": null
+ }
+ },
"mqtt": {
"broker": "mqtt://...",
"prefix": "com/example/"
@@ -94,3 +105,5 @@ noted down explicitly in the following MQTT API documentation.
- write-only `request/blind/closure` (`0`, `1`, ... `100`)
- read-only `blind/motion` (`up`, `down`, `stopped`)
- write-only `request/blind/motion` (`up`, `down`, `stopped`)
+- write-only `update/trigger`
+- read-only `update/required` (`true`, `false`)
diff --git a/fw/sim/meson.build b/fw/sim/meson.build
index 5edcad9..2e0b4fa 100644
--- a/fw/sim/meson.build
+++ b/fw/sim/meson.build
@@ -20,5 +20,4 @@ simulation = custom_target(
'--binary-name', 'zephyr.exe',
'--target-name', 'simulation-linux-amd64.exe',
],
- build_by_default: true,
)
diff --git a/fw/simulate-network.sh b/fw/simulate-network.sh
index 1f28a03..880a5f9 100755
--- a/fw/simulate-network.sh
+++ b/fw/simulate-network.sh
@@ -17,6 +17,11 @@
# escalation program to call this script like this:
#
# sudo ./simulate-network.sh
+#
+# The creation of a TAP interface can be done persistently with NetworkManager
+# too:
+#
+# nmcli connection add type tun con-name zeth ifname zeth mode tap
set -euf
diff --git a/meson.build b/meson.build
index 9b7d7c1..7549940 100644
--- a/meson.build
+++ b/meson.build
@@ -1,13 +1,41 @@
-project('iot-contact')
+project(
+ 'iot-contact',
+ version : '0.0.0-dev',
+)
-cp = find_program('cp', required : true)
+tar = find_program('tar', required : true)
fs = import('fs')
+project_version_string = meson.project_name() + '-v' + meson.project_version()
+
+html = fs.copyfile(meson.current_source_dir() / 'web' / 'index.html')
css = fs.copyfile(meson.current_source_dir() / 'simple.css' / 'simple.css')
subdir('tools')
subdir('fw')
subdir('pcb')
-subdir('web')
-subdir('artifacts')
+
+artifacts = [
+ html,
+ css,
+ schematic,
+ bom,
+ simulation,
+ update_image,
+ factory_image,
+ kicad_pcb,
+]
+
+custom_target(
+ output: project_version_string + '.tar.zst',
+ command: [
+ tar,
+ '--zstd',
+ '--transform=s|^|' + project_version_string + '/|',
+ '-cf', '@OUTPUT@',
+ artifacts,
+ ],
+ depends: artifacts,
+ build_by_default: true,
+)
diff --git a/pcb/meson.build b/pcb/meson.build
index 4feecce..7483cd0 100644
--- a/pcb/meson.build
+++ b/pcb/meson.build
@@ -18,7 +18,6 @@ schematic = custom_target(
meson.current_source_dir() / 'iot-contact.kicad_sch',
],
depend_files: schematic_files,
- build_by_default: true,
)
bom = custom_target(
@@ -34,7 +33,6 @@ bom = custom_target(
meson.current_source_dir() / 'iot-contact.kicad_sch',
],
depend_files: schematic_files,
- build_by_default: true,
)
fs = import('fs')
diff --git a/tools/deploy.py b/tools/deploy.py.in
index 26048e8..8eeecda 100755
--- a/tools/deploy.py
+++ b/tools/deploy.py.in
@@ -7,8 +7,8 @@ import pathlib
SCRIPT = pathlib.Path(__file__)
-SOURCE_ROOT = SCRIPT.parent.parent.resolve()
-ARTIFACTS_DEFAULT = SOURCE_ROOT / "build" / "artifacts"
+BUILD_ROOT = SCRIPT.parent.parent.resolve()
+ARTIFACTS_DEFAULT = BUILD_ROOT / "@PROJECT_VERSION_STRING@.tar.zst"
def main() -> None:
@@ -20,7 +20,7 @@ def main() -> None:
"-a",
"--artifacts",
default=ARTIFACTS_DEFAULT,
- help="local path to artifacts folder",
+ help="local path to artifacts archive file",
)
parser.add_argument(
"-H", "--host", default="cloud", help="target `Host` name from ~/.ssh/config"
@@ -28,7 +28,7 @@ def main() -> None:
parser.add_argument(
"-p",
"--path",
- default="/srv/http/deploy.xengineering.eu/public/git/iot-contact/main/",
+ default="/srv/http/deploy.xengineering.eu/public/git/iot-contact/",
help="remote path to destination folder on server",
)
parser.add_argument(
@@ -43,8 +43,7 @@ def main() -> None:
command = [
"rsync",
"-av",
- "--delete",
- f"{str(pathlib.Path(args.artifacts).resolve())}/",
+ f"{str(pathlib.Path(args.artifacts).resolve())}",
f"{args.host}:{args.path}",
]
diff --git a/tools/meson.build b/tools/meson.build
index f58c54b..2a33d0e 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -1,3 +1,11 @@
configure_zephyr = meson.current_source_dir() / 'configure_zephyr.py'
build_zephyr = meson.current_source_dir() / 'build_zephyr.py'
make_factory_image = meson.current_source_dir() / 'make_factory_image.py'
+
+configure_file(
+ configuration : {
+ 'PROJECT_VERSION_STRING': project_version_string,
+ },
+ input : 'deploy.py.in',
+ output : 'deploy.py',
+)
diff --git a/web/.gitignore b/web/.gitignore
deleted file mode 100644
index 07b5637..0000000
--- a/web/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-public
-.hugo_build.lock
diff --git a/web/index.html b/web/index.html
index f8d76ed..d353cb7 100644
--- a/web/index.html
+++ b/web/index.html
@@ -12,16 +12,16 @@
<h4>Printed circuit board</h4>
<ul>
- <li><a href="iot-contact.kicad_pcb">iot-contact.kicad_pcb</a></li>
- <li><a href="schematic.pdf">schematic.pdf</a></li>
- <li><a href="bill-of-materials.csv">bill-of-materials.csv</a></li>
+ <li><a href="pcb/iot-contact.kicad_pcb">iot-contact.kicad_pcb</a></li>
+ <li><a href="pcb/schematic.pdf">schematic.pdf</a></li>
+ <li><a href="pcb/bill-of-materials.csv">bill-of-materials.csv</a></li>
</ul>
<h4>Firmware</h4>
<ul>
- <li><a href="factory-image.bin">factory-image.bin</a></li>
- <li><a href="update-image.bin">update-image.bin</a></li>
- <li><a href="simulation-linux-amd64.exe">simulation-linux-amd64.exe</a></li>
+ <li><a href="fw/factory-image.bin">factory-image.bin</a></li>
+ <li><a href="fw/app/update-image.bin">update-image.bin</a></li>
+ <li><a href="fw/sim/simulation-linux-amd64.exe">simulation-linux-amd64.exe</a></li>
</ul>
</main>
</body>
diff --git a/web/meson.build b/web/meson.build
deleted file mode 100644
index 19551a5..0000000
--- a/web/meson.build
+++ /dev/null
@@ -1 +0,0 @@
-index_html = fs.copyfile(meson.current_source_dir() / 'index.html')