feat: Add some message parsing
This commit is contained in:
parent
919065f377
commit
9bf8b8e4de
8 changed files with 1006 additions and 6 deletions
582
Cargo.lock
generated
582
Cargo.lock
generated
|
|
@ -17,6 +17,12 @@ version = "0.3.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c583acf993cf4245c4acb0a2cc2ab1f9cc097de73411bb6d3647ff6af2b1013d"
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.102"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c"
|
||||
|
||||
[[package]]
|
||||
name = "arrayvec"
|
||||
version = "0.7.6"
|
||||
|
|
@ -61,6 +67,28 @@ version = "2.11.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3"
|
||||
|
||||
[[package]]
|
||||
name = "bitvec"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c"
|
||||
dependencies = [
|
||||
"funty",
|
||||
"radium",
|
||||
"tap",
|
||||
"wyz",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitvec-nom2"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d988fcc40055ceaa85edc55875a08f8abd29018582647fd82ad6128dba14a5f0"
|
||||
dependencies = [
|
||||
"bitvec",
|
||||
"nom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "block-buffer"
|
||||
version = "0.10.4"
|
||||
|
|
@ -70,6 +98,12 @@ dependencies = [
|
|||
"generic-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.20.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb"
|
||||
|
||||
[[package]]
|
||||
name = "bytemuck"
|
||||
version = "1.25.0"
|
||||
|
|
@ -82,6 +116,29 @@ version = "1.5.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33"
|
||||
|
||||
[[package]]
|
||||
name = "c-its-parser"
|
||||
version = "2.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d343eab948bdc3745a9abd17ccc33fe3a0df236888bc460fe9655043fc853581"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"etherparse",
|
||||
"geo-types",
|
||||
"geonetworking",
|
||||
"hex",
|
||||
"nom",
|
||||
"num-traits",
|
||||
"rasn",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.2.62"
|
||||
|
|
@ -129,6 +186,21 @@ version = "1.2.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b"
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-queue"
|
||||
version = "0.3.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115"
|
||||
dependencies = [
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
|
||||
|
||||
[[package]]
|
||||
name = "crypto-common"
|
||||
version = "0.1.7"
|
||||
|
|
@ -292,6 +364,12 @@ dependencies = [
|
|||
"litrs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
|
||||
|
||||
[[package]]
|
||||
name = "embassy-embedded-hal"
|
||||
version = "0.6.0"
|
||||
|
|
@ -933,8 +1011,10 @@ dependencies = [
|
|||
name = "esp32-c_its-companion"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"c-its-parser",
|
||||
"chrono",
|
||||
"critical-section",
|
||||
"crossbeam-queue",
|
||||
"embassy-executor",
|
||||
"embassy-time",
|
||||
"embassy_gps",
|
||||
|
|
@ -1013,6 +1093,15 @@ dependencies = [
|
|||
"vcell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "etherparse"
|
||||
version = "0.20.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3ac016aaf11dfe643edcd088a166234bfcb72e7f06691abfcf21e9af524037f4"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "find-msvc-tools"
|
||||
version = "0.1.9"
|
||||
|
|
@ -1025,6 +1114,12 @@ version = "1.0.7"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||
|
||||
[[package]]
|
||||
name = "foldhash"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
|
||||
|
||||
[[package]]
|
||||
name = "fugit"
|
||||
version = "0.3.9"
|
||||
|
|
@ -1034,6 +1129,12 @@ dependencies = [
|
|||
"gcd",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "funty"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c"
|
||||
|
||||
[[package]]
|
||||
name = "futures-core"
|
||||
version = "0.3.32"
|
||||
|
|
@ -1094,6 +1195,42 @@ dependencies = [
|
|||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "geo-types"
|
||||
version = "0.7.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94776032c45f950d30a13af6113c2ad5625316c9abfbccee4dd5a6695f8fe0f5"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "geonetworking"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea4f48e7b1cdf91ad77ec1e4c5617aee3666a929288f4a3f11e473b67d3a6314"
|
||||
dependencies = [
|
||||
"bitvec",
|
||||
"bitvec-nom2",
|
||||
"bytes",
|
||||
"nom",
|
||||
"num",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"r-efi",
|
||||
"wasip2",
|
||||
"wasip3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hash32"
|
||||
version = "0.3.1"
|
||||
|
|
@ -1103,6 +1240,15 @@ dependencies = [
|
|||
"byteorder",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.15.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
|
||||
dependencies = [
|
||||
"foldhash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.17.0"
|
||||
|
|
@ -1135,6 +1281,18 @@ version = "0.5.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||
|
||||
[[package]]
|
||||
name = "hex"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
||||
|
||||
[[package]]
|
||||
name = "id-arena"
|
||||
version = "2.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954"
|
||||
|
||||
[[package]]
|
||||
name = "ident_case"
|
||||
version = "1.0.1"
|
||||
|
|
@ -1148,7 +1306,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown",
|
||||
"hashbrown 0.17.0",
|
||||
"serde",
|
||||
"serde_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1173,6 +1333,15 @@ dependencies = [
|
|||
"syn 2.0.117",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
|
||||
dependencies = [
|
||||
"either",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.18"
|
||||
|
|
@ -1209,6 +1378,12 @@ version = "1.5.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
||||
|
||||
[[package]]
|
||||
name = "leb128fmt"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.186"
|
||||
|
|
@ -1321,6 +1496,38 @@ dependencies = [
|
|||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23"
|
||||
dependencies = [
|
||||
"num-complex",
|
||||
"num-integer",
|
||||
"num-iter",
|
||||
"num-rational",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-bigint"
|
||||
version = "0.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9"
|
||||
dependencies = [
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-complex"
|
||||
version = "0.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-derive"
|
||||
version = "0.4.2"
|
||||
|
|
@ -1332,6 +1539,36 @@ dependencies = [
|
|||
"syn 2.0.117",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-integer"
|
||||
version = "0.1.46"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-iter"
|
||||
version = "0.1.45"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-rational"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824"
|
||||
dependencies = [
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.19"
|
||||
|
|
@ -1405,6 +1642,16 @@ dependencies = [
|
|||
"syn 2.0.117",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "prettyplease"
|
||||
version = "0.2.37"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"syn 2.0.117",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-crate"
|
||||
version = "3.5.0"
|
||||
|
|
@ -1432,6 +1679,18 @@ dependencies = [
|
|||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "r-efi"
|
||||
version = "6.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
|
||||
|
||||
[[package]]
|
||||
name = "radium"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09"
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.6.4"
|
||||
|
|
@ -1450,6 +1709,54 @@ version = "0.10.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69"
|
||||
|
||||
[[package]]
|
||||
name = "rasn"
|
||||
version = "0.28.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "88235e585f2f3fc26ad809c79a84dd77e6a7203eb7d12e5bcaab89fc036d3d90"
|
||||
dependencies = [
|
||||
"bitvec",
|
||||
"bitvec-nom2",
|
||||
"bytes",
|
||||
"cfg-if",
|
||||
"chrono",
|
||||
"either",
|
||||
"nom",
|
||||
"num-bigint",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
"once_cell",
|
||||
"rasn-derive",
|
||||
"serde_json",
|
||||
"snafu",
|
||||
"xml-no-std",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rasn-derive"
|
||||
version = "0.28.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "11dcd4dab09ceadedb3e2bedf340deb583f0e25bba9ad966b5655c2fb62b1392"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"rasn-derive-impl",
|
||||
"syn 2.0.117",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rasn-derive-impl"
|
||||
version = "0.28.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f121c276d3f2fba8caabc870288de3f81abdb0bb94d5510651e58e1e00a7b9e7"
|
||||
dependencies = [
|
||||
"either",
|
||||
"itertools",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.117",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-automata"
|
||||
version = "0.4.14"
|
||||
|
|
@ -1557,6 +1864,12 @@ version = "1.0.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "1.0.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.228"
|
||||
|
|
@ -1587,6 +1900,19 @@ dependencies = [
|
|||
"syn 2.0.117",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.149"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"memchr",
|
||||
"serde",
|
||||
"serde_core",
|
||||
"zmij",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_yaml"
|
||||
version = "0.9.34+deprecated"
|
||||
|
|
@ -1621,6 +1947,27 @@ version = "1.15.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
|
||||
|
||||
[[package]]
|
||||
name = "snafu"
|
||||
version = "0.8.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e84b3f4eacbf3a1ce05eac6763b4d629d60cbc94d632e4092c54ade71f1e1a2"
|
||||
dependencies = [
|
||||
"snafu-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snafu-derive"
|
||||
version = "0.8.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c1c97747dbf44bb1ca44a561ece23508e99cb592e862f22222dcf42f51d1e451"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.117",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "somni-expr"
|
||||
version = "0.2.0"
|
||||
|
|
@ -1704,6 +2051,12 @@ dependencies = [
|
|||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tap"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
|
||||
|
||||
[[package]]
|
||||
name = "termcolor"
|
||||
version = "1.4.1"
|
||||
|
|
@ -1837,12 +2190,27 @@ version = "0.1.14"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
|
||||
|
||||
[[package]]
|
||||
name = "unsafe-libyaml"
|
||||
version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861"
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "1.23.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ddd74a9687298c6858e9b88ec8935ec45d22e8fd5e6394fa1bd4e99a87789c76"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "valuable"
|
||||
version = "0.1.1"
|
||||
|
|
@ -1867,6 +2235,103 @@ version = "1.0.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
|
||||
|
||||
[[package]]
|
||||
name = "wasip2"
|
||||
version = "1.0.3+wasi-0.2.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "20064672db26d7cdc89c7798c48a0fdfac8213434a1186e5ef29fd560ae223d6"
|
||||
dependencies = [
|
||||
"wit-bindgen 0.57.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasip3"
|
||||
version = "0.4.0+wasi-0.3.0-rc-2026-01-06"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5"
|
||||
dependencies = [
|
||||
"wit-bindgen 0.51.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.121"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49ace1d07c165b0864824eee619580c4689389afa9dc9ed3a4c75040d82e6790"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
"rustversion",
|
||||
"wasm-bindgen-macro",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.121"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e68e6f4afd367a562002c05637acb8578ff2dea1943df76afb9e83d177c8578"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.121"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d95a9ec35c64b2a7cb35d3fead40c4238d0940c86d107136999567a4703259f2"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.117",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.121"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4e0100b01e9f0d03189a92b96772a1fb998639d981193d7dbab487302513441"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-encoder"
|
||||
version = "0.244.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319"
|
||||
dependencies = [
|
||||
"leb128fmt",
|
||||
"wasmparser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-metadata"
|
||||
version = "0.244.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"indexmap",
|
||||
"wasm-encoder",
|
||||
"wasmparser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmparser"
|
||||
version = "0.244.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"hashbrown 0.15.5",
|
||||
"indexmap",
|
||||
"semver",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-util"
|
||||
version = "0.1.11"
|
||||
|
|
@ -1909,6 +2374,115 @@ dependencies = [
|
|||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wit-bindgen"
|
||||
version = "0.51.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5"
|
||||
dependencies = [
|
||||
"wit-bindgen-rust-macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wit-bindgen"
|
||||
version = "0.57.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e"
|
||||
|
||||
[[package]]
|
||||
name = "wit-bindgen-core"
|
||||
version = "0.51.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"heck",
|
||||
"wit-parser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wit-bindgen-rust"
|
||||
version = "0.51.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"heck",
|
||||
"indexmap",
|
||||
"prettyplease",
|
||||
"syn 2.0.117",
|
||||
"wasm-metadata",
|
||||
"wit-bindgen-core",
|
||||
"wit-component",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wit-bindgen-rust-macro"
|
||||
version = "0.51.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"prettyplease",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.117",
|
||||
"wit-bindgen-core",
|
||||
"wit-bindgen-rust",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wit-component"
|
||||
version = "0.244.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bitflags",
|
||||
"indexmap",
|
||||
"log",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"wasm-encoder",
|
||||
"wasm-metadata",
|
||||
"wasmparser",
|
||||
"wit-parser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wit-parser"
|
||||
version = "0.244.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"id-arena",
|
||||
"indexmap",
|
||||
"log",
|
||||
"semver",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"unicode-xid",
|
||||
"wasmparser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wyz"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed"
|
||||
dependencies = [
|
||||
"tap",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xml-no-std"
|
||||
version = "0.8.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cd223bc94c615fc02bf2f4bbc22a4a9bfe489c2add3ec10b1038df3aca44cac7"
|
||||
|
||||
[[package]]
|
||||
name = "xtensa-lx"
|
||||
version = "0.13.0"
|
||||
|
|
@ -1939,3 +2513,9 @@ dependencies = [
|
|||
"quote",
|
||||
"syn 2.0.117",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zmij"
|
||||
version = "1.0.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa"
|
||||
|
|
|
|||
19
Cargo.toml
19
Cargo.toml
|
|
@ -8,6 +8,17 @@ version = "0.1.0"
|
|||
name = "esp32-c_its-companion"
|
||||
path = "./src/main.rs"
|
||||
|
||||
[features]
|
||||
default = ["spat"]
|
||||
|
||||
# echo CAM data on serial
|
||||
cam = ["c-its-parser/cam"]
|
||||
# echo DENM events on serial and BLE
|
||||
denm = ["c-its-parser/denm"]
|
||||
# evaluate SPAT information
|
||||
spat = ["c-its-parser/spatem", "c-its-parser/mapem"]
|
||||
|
||||
|
||||
[dependencies]
|
||||
esp-hal = { version = "~1.1.0", features = ["esp32c5", "log-04", "unstable"] }
|
||||
|
||||
|
|
@ -44,7 +55,15 @@ esp-radio = { version = "0.18.0", features = [
|
|||
] }
|
||||
|
||||
embassy_gps = { version = "0.1.0", default-features = false, features = ["esp", "log-04"], git = "https://github.com/jbeyerstedt/embassy_gps.git", branch = "feat/rework-gpsfix" }
|
||||
c-its-parser = { version = "2.2.1", default-features = false, features = [
|
||||
"time",
|
||||
"geo",
|
||||
"libm",
|
||||
"transport",
|
||||
] }
|
||||
chrono = { version = "0.4.44", default-features = false, features = ["alloc"] }
|
||||
crossbeam-queue = { version = "0.3.12", default-features = false, features = ["alloc"] }
|
||||
|
||||
|
||||
# For fine tuning these settings, please refer to https://doc.rust-lang.org/cargo/reference/profiles.html
|
||||
[profile.dev]
|
||||
|
|
|
|||
65
src/applogic/cam.rs
Normal file
65
src/applogic/cam.rs
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
//! C-ITS CAM Evaluation
|
||||
|
||||
use c_its_parser::standards::cam_1_4_1::cam_pdu_descriptions::{self, HighFrequencyContainer};
|
||||
use log::info;
|
||||
|
||||
pub fn handle_cam(etsi: &cam_pdu_descriptions::CAM) {
|
||||
// only POC output
|
||||
match &etsi.cam.cam_parameters.high_frequency_container {
|
||||
HighFrequencyContainer::basicVehicleContainerHighFrequency(obu) => {
|
||||
let station_id = etsi.header.station_id.0;
|
||||
let lat_deg = etsi
|
||||
.cam
|
||||
.cam_parameters
|
||||
.basic_container
|
||||
.reference_position
|
||||
.latitude
|
||||
.as_deg();
|
||||
let lon_deg = etsi
|
||||
.cam
|
||||
.cam_parameters
|
||||
.basic_container
|
||||
.reference_position
|
||||
.longitude
|
||||
.as_deg();
|
||||
|
||||
if obu.speed.speed_value.is_unavailable() {
|
||||
info!(
|
||||
"Got CAM from {station_id} at {lat_deg:.3}°N, {lon_deg:.3}°E, speed unavailable",
|
||||
);
|
||||
} else {
|
||||
info!(
|
||||
"Got CAM from {station_id} at {lat_deg:.3}°N, {lon_deg:.3}°E, speed {:.2} km/h",
|
||||
obu.speed.speed_value.as_kmh()
|
||||
);
|
||||
}
|
||||
}
|
||||
HighFrequencyContainer::rsuContainerHighFrequency(rsu) => {
|
||||
info!(
|
||||
"Got RSU from {} at {:.3}°N, {:.3}°E, {} protected zones",
|
||||
etsi.header.station_id.0,
|
||||
etsi.cam
|
||||
.cam_parameters
|
||||
.basic_container
|
||||
.reference_position
|
||||
.latitude
|
||||
.as_deg(),
|
||||
etsi.cam
|
||||
.cam_parameters
|
||||
.basic_container
|
||||
.reference_position
|
||||
.longitude
|
||||
.as_deg(),
|
||||
rsu.protected_communication_zones_rsu
|
||||
.as_ref()
|
||||
.map(|d| d.0.len())
|
||||
.unwrap_or_default()
|
||||
);
|
||||
}
|
||||
|
||||
_ => {
|
||||
// enum is non-exhaustive, so we need a default case
|
||||
// but this should never be reached in pactical applications
|
||||
}
|
||||
}
|
||||
}
|
||||
182
src/applogic/denm.rs
Normal file
182
src/applogic/denm.rs
Normal file
|
|
@ -0,0 +1,182 @@
|
|||
//! C-ITS DENM Evaluation
|
||||
|
||||
use c_its_parser::standards::cdd_2_2_1::etsi_its_cdd;
|
||||
use c_its_parser::standards::denm_2_2_1::denm_pdu_description;
|
||||
use log::info;
|
||||
|
||||
pub fn handle_denm(etsi: &denm_pdu_description::DENM) {
|
||||
let mgmt = &etsi.denm.management;
|
||||
|
||||
if mgmt.termination.is_some() {
|
||||
return;
|
||||
}
|
||||
|
||||
if let (Some(sit), Some(loc)) = (&etsi.denm.situation, &etsi.denm.location) {
|
||||
// let timestamp: chrono::DateTime<chrono::Utc> = mgmt.reference_time.clone().into();
|
||||
let end_time = chrono::DateTime::<chrono::Utc>::from(mgmt.reference_time.clone())
|
||||
+ chrono::Duration::seconds(mgmt.validity_duration.0.into());
|
||||
let station_id = &mgmt.action_id.originating_station_id.0;
|
||||
let seq_num = mgmt.action_id.sequence_number.0;
|
||||
|
||||
let lat_deg = mgmt.event_position.latitude.as_deg();
|
||||
let lon_deg = mgmt.event_position.longitude.as_deg();
|
||||
|
||||
// TODO: use `as_deg()` when in new c-its-parser release
|
||||
let heading = loc
|
||||
.event_position_heading
|
||||
.as_ref()
|
||||
.map(|v| f32::from(v.value.0) / 10f32);
|
||||
|
||||
// let direction = mgmt.traffic_direction;
|
||||
|
||||
let (cc, scc) = cause_code_choice_to_numbers(&sit.event_type.cc_and_scc);
|
||||
|
||||
if let Some(hdg) = heading {
|
||||
info!(
|
||||
"DENN: {station_id}/{seq_num} CC {cc}/{scc} at {lat_deg:.3}°N, {lon_deg:.3}°E, hdg {hdg:.1}° until {end_time:?}"
|
||||
)
|
||||
} else {
|
||||
info!(
|
||||
"DENN: {station_id}/{seq_num} CC {cc}/{scc} at {lat_deg:.3}°N, {lon_deg:.3}°E until {end_time:?}"
|
||||
)
|
||||
}
|
||||
} else {
|
||||
info!("DENM: One of situation or location container not available");
|
||||
}
|
||||
}
|
||||
|
||||
fn cause_code_choice_to_numbers(choice: &etsi_its_cdd::CauseCodeChoice) -> (u8, u8) {
|
||||
match choice {
|
||||
etsi_its_cdd::CauseCodeChoice::reserved0(scc) => (0, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::trafficCondition1(scc) => (1, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::accident2(scc) => (2, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::roadworks3(scc) => (3, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved4(scc) => (4, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::impassability5(scc) => (5, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::adverseWeatherCondition_Adhesion6(scc) => (6, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::aquaplaning7(scc) => (7, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved8(scc) => (8, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::hazardousLocation_SurfaceCondition9(scc) => (9, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::hazardousLocation_ObstacleOnTheRoad10(scc) => (10, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::hazardousLocation_AnimalOnTheRoad11(scc) => (11, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::humanPresenceOnTheRoad12(scc) => (12, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved13(scc) => (13, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::wrongWayDriving14(scc) => (14, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::rescueAndRecoveryWorkInProgress15(scc) => (15, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved16(scc) => (16, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::adverseWeatherCondition_ExtremeWeatherCondition17(scc) => {
|
||||
(17, scc.0)
|
||||
}
|
||||
etsi_its_cdd::CauseCodeChoice::adverseWeatherCondition_Visibility18(scc) => (18, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::adverseWeatherCondition_Precipitation19(scc) => (19, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::violence20(scc) => (20, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved21(scc) => (21, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved22(scc) => (22, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved23(scc) => (23, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved24(scc) => (24, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved25(scc) => (25, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::slowVehicle26(scc) => (26, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::dangerousEndOfQueue27(scc) => (27, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::publicTransportVehicleApproaching28(scc) => (28, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved29(scc) => (29, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved30(scc) => (30, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved31(scc) => (31, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved32(scc) => (32, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved33(scc) => (33, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved34(scc) => (34, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved35(scc) => (35, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved36(scc) => (36, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved37(scc) => (37, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved38(scc) => (38, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved39(scc) => (39, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved40(scc) => (40, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved41(scc) => (41, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved42(scc) => (42, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved43(scc) => (43, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved44(scc) => (44, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved45(scc) => (45, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved46(scc) => (46, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved47(scc) => (47, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved48(scc) => (48, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved49(scc) => (49, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved50(scc) => (50, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved51(scc) => (51, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved52(scc) => (52, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved53(scc) => (53, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved54(scc) => (54, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved55(scc) => (55, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved56(scc) => (56, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved57(scc) => (57, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved58(scc) => (58, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved59(scc) => (59, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved60(scc) => (60, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved61(scc) => (61, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved62(scc) => (62, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved63(scc) => (63, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved64(scc) => (64, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved65(scc) => (65, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved66(scc) => (66, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved67(scc) => (67, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved68(scc) => (68, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved69(scc) => (69, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved70(scc) => (70, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved71(scc) => (71, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved72(scc) => (72, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved73(scc) => (73, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved74(scc) => (74, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved75(scc) => (75, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved76(scc) => (76, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved77(scc) => (77, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved78(scc) => (78, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved79(scc) => (79, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved80(scc) => (80, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved81(scc) => (81, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved82(scc) => (82, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved83(scc) => (83, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved84(scc) => (84, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved85(scc) => (85, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved86(scc) => (86, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved87(scc) => (87, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved88(scc) => (88, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved89(scc) => (89, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved90(scc) => (90, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::vehicleBreakdown91(scc) => (91, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::postCrash92(scc) => (92, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::humanProblem93(scc) => (93, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::stationaryVehicle94(scc) => (94, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::emergencyVehicleApproaching95(scc) => (95, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::hazardousLocation_DangerousCurve96(scc) => (96, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::collisionRisk97(scc) => (97, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::signalViolation98(scc) => (98, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::dangerousSituation99(scc) => (99, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::railwayLevelCrossing100(scc) => (100, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved101(scc) => (101, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved102(scc) => (102, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved103(scc) => (103, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved104(scc) => (104, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved105(scc) => (105, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved106(scc) => (106, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved107(scc) => (107, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved108(scc) => (108, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved109(scc) => (109, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved110(scc) => (110, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved111(scc) => (111, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved112(scc) => (112, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved113(scc) => (113, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved114(scc) => (114, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved115(scc) => (115, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved116(scc) => (116, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved117(scc) => (117, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved118(scc) => (118, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved119(scc) => (119, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved120(scc) => (120, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved121(scc) => (121, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved122(scc) => (122, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved123(scc) => (123, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved124(scc) => (124, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved125(scc) => (125, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved126(scc) => (126, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved127(scc) => (127, scc.0),
|
||||
etsi_its_cdd::CauseCodeChoice::reserved128(scc) => (128, scc.0),
|
||||
}
|
||||
}
|
||||
8
src/applogic/mod.rs
Normal file
8
src/applogic/mod.rs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
//! Application Logic
|
||||
|
||||
#[cfg(feature = "cam")]
|
||||
pub mod cam;
|
||||
#[cfg(feature = "denm")]
|
||||
pub mod denm;
|
||||
#[cfg(feature = "spat")]
|
||||
pub mod tlc;
|
||||
51
src/applogic/tlc.rs
Normal file
51
src/applogic/tlc.rs
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
//! C-ITS Traffic Light Data (MAPEM/ SPATEM) Evaluation
|
||||
|
||||
use c_its_parser::standards::mapem_2_2_1::mapem_pdu_descriptions;
|
||||
use c_its_parser::standards::spatem_2_2_1::spatem_pdu_descriptions;
|
||||
use chrono::Datelike;
|
||||
use esp_println::println;
|
||||
|
||||
pub fn handle_mapem(etsi: &mapem_pdu_descriptions::MAPEM) {
|
||||
// TODO: proof of concept only -- replace with actual evaluation
|
||||
if let Some(map) = &etsi.map.intersections {
|
||||
for int in &map.0 {
|
||||
println!("got MAPEM for intersection {}", int.id.id.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn handle_spatem(etsi: &spatem_pdu_descriptions::SPATEM, now: &chrono::NaiveDateTime) {
|
||||
// TODO: proof of concept only -- replace with actual evaluation
|
||||
for int in &etsi.spat.intersections.0 {
|
||||
println!("got SPATEM for intersection {}", int.id.id.0);
|
||||
|
||||
if let (Some(moy), Some(second)) = (&int.moy, &int.time_stamp) {
|
||||
let year = now.year();
|
||||
|
||||
let ref_time = c_its_parser::time_utils::time_from_moy_and_dsecond(moy, second, year);
|
||||
println!("- ref time: {ref_time:?}");
|
||||
|
||||
for state in &int.states.0 {
|
||||
let sig_grp = state.signal_group.0;
|
||||
|
||||
if let Some(event) = state.state_time_speed.0.first() {
|
||||
if let Some(timing) = &event.timing {
|
||||
let min_end_time = timing.min_end_time.to_datetime_from_moy(moy, year);
|
||||
|
||||
println!(
|
||||
"- sig grp. {sig_grp:03}: until {min_end_time:?} at {:?}",
|
||||
event.event_state
|
||||
);
|
||||
} else {
|
||||
println!(
|
||||
"- sig grp. {sig_grp:03}: {:?} until unknown",
|
||||
event.event_state
|
||||
);
|
||||
}
|
||||
} else {
|
||||
println!("- sig grp. {sig_grp:03}: no events");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
103
src/main.rs
103
src/main.rs
|
|
@ -7,19 +7,22 @@
|
|||
)]
|
||||
// #![deny(clippy::large_stack_frames)]
|
||||
|
||||
use alloc::vec::Vec;
|
||||
use core::cell::RefCell;
|
||||
|
||||
use critical_section::Mutex;
|
||||
use crossbeam_queue::ArrayQueue;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_gps::gps::l76k;
|
||||
use esp_backtrace as _;
|
||||
use esp_hal::clock::CpuClock;
|
||||
use esp_hal::timer::timg::TimerGroup;
|
||||
use esp_radio::wifi;
|
||||
use log::{debug, info, warn};
|
||||
use log::{debug, error, info, warn};
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
mod applogic;
|
||||
mod radio;
|
||||
|
||||
const WIFI_CHANNEL: radio::Channel = 180;
|
||||
|
|
@ -85,6 +88,7 @@ esp_bootloader_esp_idf::esp_app_desc!();
|
|||
|
||||
static GNSS_UPDATE: Mutex<RefCell<Option<embassy_gps::types::GpsFix>>> =
|
||||
Mutex::new(RefCell::new(None));
|
||||
static WIFI_RX_QUEUE: Mutex<RefCell<Option<ArrayQueue<Vec<u8>>>>> = Mutex::new(RefCell::new(None));
|
||||
|
||||
#[allow(
|
||||
clippy::large_stack_frames,
|
||||
|
|
@ -111,6 +115,7 @@ async fn main(spawner: Spawner) -> ! {
|
|||
// - GPIO28
|
||||
|
||||
esp_alloc::heap_allocator!(#[esp_hal::ram(reclaimed)] size: 65536);
|
||||
esp_alloc::psram_allocator!(peripherals.PSRAM, esp_hal::psram);
|
||||
|
||||
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
||||
let sw_interrupt =
|
||||
|
|
@ -125,6 +130,10 @@ async fn main(spawner: Spawner) -> ! {
|
|||
)
|
||||
.expect("Failed to initialize Wi-Fi controller");
|
||||
|
||||
critical_section::with(|cs| {
|
||||
WIFI_RX_QUEUE.borrow(cs).replace(Some(ArrayQueue::new(2)));
|
||||
});
|
||||
|
||||
let mut sniffer = interfaces.sniffer;
|
||||
radio::setup_wifi_sniffer(WIFI_CHANNEL, &mut sniffer, handle_frame)
|
||||
.expect("Fatal error initializing 802.11p sniffer");
|
||||
|
|
@ -150,7 +159,7 @@ async fn main(spawner: Spawner) -> ! {
|
|||
|
||||
let mut state = State::default();
|
||||
loop {
|
||||
embassy_time::Timer::after(embassy_time::Duration::from_millis(100)).await;
|
||||
embassy_time::Timer::after(embassy_time::Duration::from_millis(5)).await;
|
||||
|
||||
critical_section::with(|cs| {
|
||||
let gnss_update_ref = GNSS_UPDATE.borrow(cs);
|
||||
|
|
@ -164,6 +173,68 @@ async fn main(spawner: Spawner) -> ! {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
critical_section::with(|cs| {
|
||||
let queue_rc = WIFI_RX_QUEUE.borrow(cs).borrow();
|
||||
// unwrap is fine b/c we stored something in it before
|
||||
let queue = queue_rc.as_ref().unwrap();
|
||||
|
||||
if let Some(data) = queue.pop() {
|
||||
match c_its_parser::de::decode(&data, c_its_parser::Headers::IEEE802LlcGnBtp) {
|
||||
Ok(msg) => {
|
||||
use c_its_parser::ItsMessage;
|
||||
use c_its_parser::standards::extensions::ItsMessageId;
|
||||
|
||||
debug!("Got new {:?} message", ItsMessageId::from(&msg));
|
||||
|
||||
match msg {
|
||||
#[cfg(feature = "spat")]
|
||||
ItsMessage::Mapem {
|
||||
geonetworking: _,
|
||||
transport: _,
|
||||
etsi,
|
||||
} => applogic::tlc::handle_mapem(&etsi),
|
||||
#[cfg(feature = "spat")]
|
||||
ItsMessage::Spatem {
|
||||
geonetworking: _,
|
||||
transport: _,
|
||||
etsi,
|
||||
} => {
|
||||
if state.initialized {
|
||||
applogic::tlc::handle_spatem(&etsi, &state.time);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "cam")]
|
||||
ItsMessage::Cam {
|
||||
geonetworking: _,
|
||||
transport: _,
|
||||
etsi,
|
||||
} => applogic::cam::handle_cam(&etsi),
|
||||
|
||||
#[cfg(feature = "denm")]
|
||||
ItsMessage::DenmV2 {
|
||||
geonetworking: _,
|
||||
transport: _,
|
||||
etsi,
|
||||
} => applogic::denm::handle_denm(&etsi),
|
||||
#[cfg(feature = "denm")]
|
||||
ItsMessage::DenmV1 {
|
||||
geonetworking: _,
|
||||
transport: _,
|
||||
etsi: _,
|
||||
} => {
|
||||
// irrelevant since all received DENMs should be parsed as v2
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(err) => {
|
||||
// will give false-positives when a message is received which wasn't enabled
|
||||
debug!("Failed to parse V2X message: {err}");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -183,8 +254,32 @@ fn handle_frame(frame: wifi::sniffer::PromiscuousPkt<'_>) {
|
|||
return;
|
||||
}
|
||||
|
||||
// TODO: handle 802.11 frame
|
||||
info!("Received frame with {} bytes", frame.len);
|
||||
// Ignore non-broadcast frames
|
||||
if frame.len < (4 + 6) {
|
||||
warn!(
|
||||
"Received frame too small to be a valid broadcast frame: {} bytes",
|
||||
frame.len
|
||||
);
|
||||
return;
|
||||
}
|
||||
let dest_mac = &frame.data[4..10];
|
||||
if dest_mac != [0xff; 6] {
|
||||
warn!("Received frame is not broadcast frame: Dest MAC {dest_mac:02x?}");
|
||||
return;
|
||||
}
|
||||
|
||||
debug!("Received frame with {} bytes", frame.len);
|
||||
|
||||
// Send data to main thread
|
||||
critical_section::with(|cs| {
|
||||
let queue_rc = WIFI_RX_QUEUE.borrow(cs).borrow();
|
||||
// unwrap is fine b/c we stored something in it before
|
||||
let queue = queue_rc.as_ref().unwrap();
|
||||
|
||||
if queue.push(frame.data.to_vec()).is_err() {
|
||||
error!("V2X RX queue is full");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
#[allow(clippy::large_stack_frames, reason = "GNSS driver needs some space")]
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ impl PromiscuousPktType {
|
|||
core::ffi::c_uint::from(self.as_repr())
|
||||
}
|
||||
|
||||
/// Determines if
|
||||
/// Determines if we are the same frame type as `esp_radio::wifi::sniffer::PromiscuousPkt::frame_type`
|
||||
pub fn matches(self, frame_type: core::ffi::c_uint) -> bool {
|
||||
self.as_frame_type() == frame_type
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue