diff --git a/Cargo.lock b/Cargo.lock index ccd01eb..d7067fd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -356,24 +356,6 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "capnp" -version = "0.20.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "053b81915c2ce1629b8fb964f578b18cb39b23ef9d5b24120d0dfc959569a1d9" -dependencies = [ - "embedded-io", -] - -[[package]] -name = "capnpc" -version = "0.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aa3d5f01e69ed11656d2c7c47bf34327ea9bfb5c85c7de787fcd7b6c5e45b61" -dependencies = [ - "capnp", -] - [[package]] name = "cast" version = "0.3.0" @@ -633,12 +615,6 @@ version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" -[[package]] -name = "embedded-io" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" - [[package]] name = "encoding_rs" version = "0.8.35" @@ -738,6 +714,12 @@ dependencies = [ "simd-adler32", ] +[[package]] +name = "fixedbitset" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" + [[package]] name = "flate2" version = "1.1.0" @@ -1554,6 +1536,12 @@ dependencies = [ "uuid", ] +[[package]] +name = "multimap" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d87ecb2933e8aeadb3e3a02b828fed80a7528047e68b4f424523a0981a3a084" + [[package]] name = "native-tls" version = "0.2.14" @@ -1820,6 +1808,16 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +[[package]] +name = "petgraph" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3672b37090dbd86368a4145bc067582552b29c27377cad4e0a306c97f9bd7772" +dependencies = [ + "fixedbitset", + "indexmap", +] + [[package]] name = "pin-project-lite" version = "0.2.16" @@ -1903,6 +1901,16 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "prettyplease" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "664ec5419c51e34154eec046ebcba56312d5a2fc3b09a06da188e1ad21afadf6" +dependencies = [ + "proc-macro2", + "syn", +] + [[package]] name = "proc-macro2" version = "1.0.94" @@ -1931,6 +1939,58 @@ dependencies = [ "syn", ] +[[package]] +name = "prost" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2796faa41db3ec313a31f7624d9286acf277b52de526150b7e69f3debf891ee5" +dependencies = [ + "bytes", + "prost-derive", +] + +[[package]] +name = "prost-build" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be769465445e8c1474e9c5dac2018218498557af32d9ed057325ec9a41ae81bf" +dependencies = [ + "heck", + "itertools 0.12.1", + "log", + "multimap", + "once_cell", + "petgraph", + "prettyplease", + "prost", + "prost-types", + "regex", + "syn", + "tempfile", +] + +[[package]] +name = "prost-derive" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d" +dependencies = [ + "anyhow", + "itertools 0.12.1", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "prost-types" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52c2c1bf36ddb1a1c396b3601a3cec27c2462e45f07c386894ec3ccf5332bd16" +dependencies = [ + "prost", +] + [[package]] name = "qoi" version = "0.4.1" @@ -3628,9 +3688,10 @@ dependencies = [ name = "wxbox-interchange" version = "0.1.0" dependencies = [ - "capnp", - "capnpc", "nexrad-decode", + "prost", + "prost-build", + "prost-types", "wxbox-ar2", ] diff --git a/client/bun.lock b/client/bun.lock index 3a87140..d7408a6 100644 --- a/client/bun.lock +++ b/client/bun.lock @@ -8,10 +8,12 @@ "@turf/turf": "^7.2.0", "@types/geojson": "^7946.0.16", "maplibre-gl": "^5.5.0", + "ts-protoc-gen": "^0.15.0", }, "devDependencies": { "@eslint/compat": "^1.2.5", "@eslint/js": "^9.18.0", + "@protobuf-ts/plugin": "^2.10.0", "@sveltejs/adapter-auto": "^6.0.0", "@sveltejs/kit": "^2.16.0", "@sveltejs/vite-plugin-svelte": "^5.0.0", @@ -170,6 +172,16 @@ "@polka/url": ["@polka/url@1.0.0-next.29", "", {}, "sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww=="], + "@protobuf-ts/plugin": ["@protobuf-ts/plugin@2.10.0", "", { "dependencies": { "@protobuf-ts/plugin-framework": "^2.10.0", "@protobuf-ts/protoc": "^2.10.0", "@protobuf-ts/runtime": "^2.10.0", "@protobuf-ts/runtime-rpc": "^2.10.0", "typescript": "^3.9" }, "bin": { "protoc-gen-ts": "bin/protoc-gen-ts", "protoc-gen-dump": "bin/protoc-gen-dump" } }, "sha512-iMX4C4TVfMNRLn2msK0cVg5jmizjtu5FYiy8EK5Lg6EgyR9TVHeK2rzmufWKYM2Pcg1jSwC0cFcXHQnCoeFxUg=="], + + "@protobuf-ts/plugin-framework": ["@protobuf-ts/plugin-framework@2.10.0", "", { "dependencies": { "@protobuf-ts/runtime": "^2.10.0", "typescript": "^3.9" } }, "sha512-EuW9irbt+w7Ml1CaAxK6xyl7pSuWVbNy0rsChxJEthMrAVTN5EPdJ3whNWvsRBa+HwRImEl8KHNnRoq/vGOHbg=="], + + "@protobuf-ts/protoc": ["@protobuf-ts/protoc@2.10.0", "", { "bin": { "protoc": "protoc.js" } }, "sha512-S4BtGBh22+uL5E6qLVxV0QNY6tiLVB8QL7RIkvo+KYknipZfSNwubdKy5CPkrwVXzJn4s3cx7bKx1w6BxkBIPg=="], + + "@protobuf-ts/runtime": ["@protobuf-ts/runtime@2.10.0", "", {}, "sha512-ypYwGg9Pn3W/2lZ7/HW60hONGuSdzphvOY8Dq7LeNttymDe0y3LaTUUMRpuGqOT6FfrWEMnfQbyqU8AAreo8wA=="], + + "@protobuf-ts/runtime-rpc": ["@protobuf-ts/runtime-rpc@2.10.0", "", { "dependencies": { "@protobuf-ts/runtime": "^2.10.0" } }, "sha512-8CS/XPv3+pMK4v8UKhtCdvbS4h9l7aqlteKdRt0/UbIKZ8n0qHj6hX8cBhz2ngvohxCOS0N08zPr9aCLBNhW3Q=="], + "@rollup/rollup-android-arm-eabi": ["@rollup/rollup-android-arm-eabi@4.40.2", "", { "os": "android", "cpu": "arm" }, "sha512-JkdNEq+DFxZfUwxvB58tHMHBHVgX23ew41g1OQinthJ+ryhdRk67O31S7sYw8u2lTjHUPFxwar07BBt1KHp/hg=="], "@rollup/rollup-android-arm64": ["@rollup/rollup-android-arm64@4.40.2", "", { "os": "android", "cpu": "arm64" }, "sha512-13unNoZ8NzUmnndhPTkWPWbX3vtHodYmy+I9kuLxN+F+l+x3LdVF7UCu8TWVMt1POHLh6oDHhnOA04n8oJZhBw=="], @@ -712,6 +724,8 @@ "globals": ["globals@16.1.0", "", {}, "sha512-aibexHNbb/jiUSObBgpHLj+sIuUmJnYcgXBlrfsiDZ9rt4aF2TFRbyLgZ2iFQuVZ1K5Mx3FVkbKRSgKrbK3K2g=="], + "google-protobuf": ["google-protobuf@3.21.4", "", {}, "sha512-MnG7N936zcKTco4Jd2PX2U96Kf9PxygAPKBug+74LHzmHXmceN16MmRcdgZv+DGef/S9YvQAfRsNCn4cjf9yyQ=="], + "gopd": ["gopd@1.2.0", "", {}, "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg=="], "graceful-fs": ["graceful-fs@4.2.11", "", {}, "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ=="], @@ -1044,6 +1058,8 @@ "ts-api-utils": ["ts-api-utils@2.1.0", "", { "peerDependencies": { "typescript": ">=4.8.4" } }, "sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ=="], + "ts-protoc-gen": ["ts-protoc-gen@0.15.0", "", { "dependencies": { "google-protobuf": "^3.15.5" }, "bin": { "protoc-gen-ts": "bin/protoc-gen-ts" } }, "sha512-TycnzEyrdVDlATJ3bWFTtra3SCiEP0W0vySXReAuEygXCUr1j2uaVyL0DhzjwuUdQoW5oXPwk6oZWeA0955V+g=="], + "tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], "type-check": ["type-check@0.4.0", "", { "dependencies": { "prelude-ls": "^1.2.1" } }, "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew=="], @@ -1094,6 +1110,10 @@ "@humanfs/node/@humanwhocodes/retry": ["@humanwhocodes/retry@0.3.1", "", {}, "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA=="], + "@protobuf-ts/plugin/typescript": ["typescript@3.9.10", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q=="], + + "@protobuf-ts/plugin-framework/typescript": ["typescript@3.9.10", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q=="], + "@tailwindcss/oxide-wasm32-wasi/@emnapi/core": ["@emnapi/core@1.4.3", "", { "dependencies": { "@emnapi/wasi-threads": "1.0.2", "tslib": "^2.4.0" }, "bundled": true }, "sha512-4m62DuCE07lw01soJwPiBGC0nAww0Q+RY70VZ+n49yDIO13yyinhbWCeNnaob0lakDtWQzSdtNWzJeOJt2ma+g=="], "@tailwindcss/oxide-wasm32-wasi/@emnapi/runtime": ["@emnapi/runtime@1.4.3", "", { "dependencies": { "tslib": "^2.4.0" }, "bundled": true }, "sha512-pBPWdu6MLKROBX05wSNKcNb++m5Er+KQ9QkB+WVM+pW2Kx9hoSrVTnu3BdkI5eBLZoKu/J6mW/B6i6bJB2ytXQ=="], diff --git a/client/package.json b/client/package.json index ea9967d..8a03fd6 100644 --- a/client/package.json +++ b/client/package.json @@ -11,11 +11,13 @@ "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", "format": "prettier --write .", - "lint": "prettier --check . && eslint ." + "lint": "prettier --check . && eslint .", + "protobuf:update": "protoc --ts_out src/lib/generated_interop --proto_path ../crates/interchange/src/ ../crates/interchange/src/*.proto" }, "devDependencies": { "@eslint/compat": "^1.2.5", "@eslint/js": "^9.18.0", + "@protobuf-ts/plugin": "^2.10.0", "@sveltejs/adapter-auto": "^6.0.0", "@sveltejs/kit": "^2.16.0", "@sveltejs/vite-plugin-svelte": "^5.0.0", @@ -47,6 +49,7 @@ "@lucide/svelte": "^0.510.0", "@turf/turf": "^7.2.0", "@types/geojson": "^7946.0.16", - "maplibre-gl": "^5.5.0" + "maplibre-gl": "^5.5.0", + "ts-protoc-gen": "^0.15.0" } } diff --git a/client/src/lib/Map.svelte b/client/src/lib/Map.svelte index d4fc749..bfcea72 100644 --- a/client/src/lib/Map.svelte +++ b/client/src/lib/Map.svelte @@ -10,6 +10,7 @@ import CloudAlertIcon from "@lucide/svelte/icons/cloud-alert"; import {borderLUT, fillLUT} from "$lib/alertLayer"; import AlertPopup from "$lib/AlertPopup.svelte"; + import {CifContainer} from "$lib/generated_interop/cifContainer"; interface Props { categories: LayerList; @@ -142,11 +143,19 @@ map.getCanvas().style.cursor = ''; popup.remove(); }); + (async () => { + let r = await fetch('http://localhost:3000/v2/nexrad/l2/KM/1/REF'); + const bytes = await r.bytes(); + const container = CifContainer.fromBinary(bytes); + console.log('wxrad http://localhost:3000/v2/nexrad/l2/KRLX/1/REF: ', container); + })(); }); map.on('error', (e) => { console.error(e); toast.error('Data loading failed!'); }); + + }); diff --git a/client/src/lib/generated_interop/cifContainer.ts b/client/src/lib/generated_interop/cifContainer.ts new file mode 100644 index 0000000..031d000 --- /dev/null +++ b/client/src/lib/generated_interop/cifContainer.ts @@ -0,0 +1,80 @@ +// @generated by protobuf-ts 2.10.0 +// @generated from protobuf file "cifContainer.proto" (package "cif", syntax proto3) +// tslint:disable +import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; +import type { IBinaryWriter } from "@protobuf-ts/runtime"; +import { WireType } from "@protobuf-ts/runtime"; +import type { BinaryReadOptions } from "@protobuf-ts/runtime"; +import type { IBinaryReader } from "@protobuf-ts/runtime"; +import { UnknownFieldHandler } from "@protobuf-ts/runtime"; +import type { PartialMessage } from "@protobuf-ts/runtime"; +import { reflectionMergePartial } from "@protobuf-ts/runtime"; +import { MessageType } from "@protobuf-ts/runtime"; +import { DigitalRadarData } from "./digitalRadarData"; +/** + * @generated from protobuf message cif.CifContainer + */ +export interface CifContainer { + /** + * @generated from protobuf oneof: message_type + */ + messageType: { + oneofKind: "digitalRadarData"; + /** + * @generated from protobuf field: cif.digitalRadarData.DigitalRadarData digitalRadarData = 1; + */ + digitalRadarData: DigitalRadarData; + } | { + oneofKind: undefined; + }; +} +// @generated message type with reflection information, may provide speed optimized methods +class CifContainer$Type extends MessageType { + constructor() { + super("cif.CifContainer", [ + { no: 1, name: "digitalRadarData", kind: "message", oneof: "messageType", T: () => DigitalRadarData } + ]); + } + create(value?: PartialMessage): CifContainer { + const message = globalThis.Object.create((this.messagePrototype!)); + message.messageType = { oneofKind: undefined }; + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: CifContainer): CifContainer { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* cif.digitalRadarData.DigitalRadarData digitalRadarData */ 1: + message.messageType = { + oneofKind: "digitalRadarData", + digitalRadarData: DigitalRadarData.internalBinaryRead(reader, reader.uint32(), options, (message.messageType as any).digitalRadarData) + }; + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: CifContainer, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* cif.digitalRadarData.DigitalRadarData digitalRadarData = 1; */ + if (message.messageType.oneofKind === "digitalRadarData") + DigitalRadarData.internalBinaryWrite(message.messageType.digitalRadarData, writer.tag(1, WireType.LengthDelimited).fork(), options).join(); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message cif.CifContainer + */ +export const CifContainer = new CifContainer$Type(); diff --git a/client/src/lib/generated_interop/digitalRadarData.ts b/client/src/lib/generated_interop/digitalRadarData.ts new file mode 100644 index 0000000..612856a --- /dev/null +++ b/client/src/lib/generated_interop/digitalRadarData.ts @@ -0,0 +1,498 @@ +// @generated by protobuf-ts 2.10.0 +// @generated from protobuf file "digitalRadarData.proto" (package "cif.digitalRadarData", syntax proto3) +// tslint:disable +import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; +import type { IBinaryWriter } from "@protobuf-ts/runtime"; +import { WireType } from "@protobuf-ts/runtime"; +import type { BinaryReadOptions } from "@protobuf-ts/runtime"; +import type { IBinaryReader } from "@protobuf-ts/runtime"; +import { UnknownFieldHandler } from "@protobuf-ts/runtime"; +import type { PartialMessage } from "@protobuf-ts/runtime"; +import { reflectionMergePartial } from "@protobuf-ts/runtime"; +import { MessageType } from "@protobuf-ts/runtime"; +/** + * @generated from protobuf message cif.digitalRadarData.DigitalRadarData + */ +export interface DigitalRadarData { + /** + * @generated from protobuf field: int32 vcpNumber = 1; + */ + vcpNumber: number; + /** + * @generated from protobuf field: int32 elevationNumber = 2; + */ + elevationNumber: number; + /** + * @generated from protobuf field: repeated cif.digitalRadarData.Radial radials = 3; + */ + radials: Radial[]; +} +/** + * @generated from protobuf message cif.digitalRadarData.Radial + */ +export interface Radial { + /** + * @generated from protobuf field: fixed64 collectionTimestamp = 1; + */ + collectionTimestamp: bigint; + /** + * @generated from protobuf field: int32 azimuthNumber = 2; + */ + azimuthNumber: number; + /** + * @generated from protobuf field: float azimuthAngleDegrees = 3; + */ + azimuthAngleDegrees: number; + /** + * @generated from protobuf field: float azimuthSpacingDegrees = 4; + */ + azimuthSpacingDegrees: number; + /** + * @generated from protobuf field: cif.digitalRadarData.RadialStatus radialStatus = 5; + */ + radialStatus: RadialStatus; + /** + * @generated from protobuf field: int32 elevationNumber = 6; + */ + elevationNumber: number; + /** + * @generated from protobuf field: float elevationDegrees = 7; + */ + elevationDegrees: number; + /** + * @generated from protobuf field: cif.digitalRadarData.MomentaryProduct product = 8; + */ + product?: MomentaryProduct; +} +/** + * @generated from protobuf message cif.digitalRadarData.MomentaryProduct + */ +export interface MomentaryProduct { + /** + * @generated from protobuf field: cif.digitalRadarData.MomentaryMeta productMetadata = 1; + */ + productMetadata?: MomentaryMeta; + /** + * @generated from protobuf field: cif.digitalRadarData.MomentaryData data = 2; + */ + data?: MomentaryData; +} +/** + * @generated from protobuf message cif.digitalRadarData.MomentaryMeta + */ +export interface MomentaryMeta { + /** + * @generated from protobuf field: string productName = 1; + */ + productName: string; +} +/** + * @generated from protobuf message cif.digitalRadarData.MomentaryData + */ +export interface MomentaryData { + /** + * @generated from protobuf field: float scale = 1; + */ + scale: number; + /** + * @generated from protobuf field: float offset = 2; + */ + offset: number; + /** + * @generated from protobuf field: int32 startRange = 3; + */ + startRange: number; + /** + * @generated from protobuf field: int32 sampleInterval = 4; + */ + sampleInterval: number; + /** + * @generated from protobuf field: repeated int32 data = 5; + */ + data: number[]; +} +/** + * @generated from protobuf enum cif.digitalRadarData.RadialStatus + */ +export enum RadialStatus { + /** + * @generated from protobuf enum value: RADIAL_STATUS_UNKNOWN = 0; + */ + UNKNOWN = 0, + /** + * @generated from protobuf enum value: RADIAL_STATUS_ELEVATION_START = 1; + */ + ELEVATION_START = 1, + /** + * @generated from protobuf enum value: RADIAL_STATUS_INTERMEDIATE_RADIAL_DATA = 2; + */ + INTERMEDIATE_RADIAL_DATA = 2, + /** + * @generated from protobuf enum value: RADIAL_STATUS_ELEVATION_END = 3; + */ + ELEVATION_END = 3, + /** + * @generated from protobuf enum value: RADIAL_STATUS_VOLUME_SCAN_START = 4; + */ + VOLUME_SCAN_START = 4, + /** + * @generated from protobuf enum value: RADIAL_STATUS_VOLUME_SCAN_END = 5; + */ + VOLUME_SCAN_END = 5, + /** + * @generated from protobuf enum value: RADIAL_STATUS_ELEVATION_START_VCP_FINAL = 6; + */ + ELEVATION_START_VCP_FINAL = 6 +} +// @generated message type with reflection information, may provide speed optimized methods +class DigitalRadarData$Type extends MessageType { + constructor() { + super("cif.digitalRadarData.DigitalRadarData", [ + { no: 1, name: "vcpNumber", kind: "scalar", T: 5 /*ScalarType.INT32*/ }, + { no: 2, name: "elevationNumber", kind: "scalar", T: 5 /*ScalarType.INT32*/ }, + { no: 3, name: "radials", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => Radial } + ]); + } + create(value?: PartialMessage): DigitalRadarData { + const message = globalThis.Object.create((this.messagePrototype!)); + message.vcpNumber = 0; + message.elevationNumber = 0; + message.radials = []; + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: DigitalRadarData): DigitalRadarData { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* int32 vcpNumber */ 1: + message.vcpNumber = reader.int32(); + break; + case /* int32 elevationNumber */ 2: + message.elevationNumber = reader.int32(); + break; + case /* repeated cif.digitalRadarData.Radial radials */ 3: + message.radials.push(Radial.internalBinaryRead(reader, reader.uint32(), options)); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: DigitalRadarData, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* int32 vcpNumber = 1; */ + if (message.vcpNumber !== 0) + writer.tag(1, WireType.Varint).int32(message.vcpNumber); + /* int32 elevationNumber = 2; */ + if (message.elevationNumber !== 0) + writer.tag(2, WireType.Varint).int32(message.elevationNumber); + /* repeated cif.digitalRadarData.Radial radials = 3; */ + for (let i = 0; i < message.radials.length; i++) + Radial.internalBinaryWrite(message.radials[i], writer.tag(3, WireType.LengthDelimited).fork(), options).join(); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message cif.digitalRadarData.DigitalRadarData + */ +export const DigitalRadarData = new DigitalRadarData$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class Radial$Type extends MessageType { + constructor() { + super("cif.digitalRadarData.Radial", [ + { no: 1, name: "collectionTimestamp", kind: "scalar", T: 6 /*ScalarType.FIXED64*/, L: 0 /*LongType.BIGINT*/ }, + { no: 2, name: "azimuthNumber", kind: "scalar", T: 5 /*ScalarType.INT32*/ }, + { no: 3, name: "azimuthAngleDegrees", kind: "scalar", T: 2 /*ScalarType.FLOAT*/ }, + { no: 4, name: "azimuthSpacingDegrees", kind: "scalar", T: 2 /*ScalarType.FLOAT*/ }, + { no: 5, name: "radialStatus", kind: "enum", T: () => ["cif.digitalRadarData.RadialStatus", RadialStatus, "RADIAL_STATUS_"] }, + { no: 6, name: "elevationNumber", kind: "scalar", T: 5 /*ScalarType.INT32*/ }, + { no: 7, name: "elevationDegrees", kind: "scalar", T: 2 /*ScalarType.FLOAT*/ }, + { no: 8, name: "product", kind: "message", T: () => MomentaryProduct } + ]); + } + create(value?: PartialMessage): Radial { + const message = globalThis.Object.create((this.messagePrototype!)); + message.collectionTimestamp = 0n; + message.azimuthNumber = 0; + message.azimuthAngleDegrees = 0; + message.azimuthSpacingDegrees = 0; + message.radialStatus = 0; + message.elevationNumber = 0; + message.elevationDegrees = 0; + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Radial): Radial { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* fixed64 collectionTimestamp */ 1: + message.collectionTimestamp = reader.fixed64().toBigInt(); + break; + case /* int32 azimuthNumber */ 2: + message.azimuthNumber = reader.int32(); + break; + case /* float azimuthAngleDegrees */ 3: + message.azimuthAngleDegrees = reader.float(); + break; + case /* float azimuthSpacingDegrees */ 4: + message.azimuthSpacingDegrees = reader.float(); + break; + case /* cif.digitalRadarData.RadialStatus radialStatus */ 5: + message.radialStatus = reader.int32(); + break; + case /* int32 elevationNumber */ 6: + message.elevationNumber = reader.int32(); + break; + case /* float elevationDegrees */ 7: + message.elevationDegrees = reader.float(); + break; + case /* cif.digitalRadarData.MomentaryProduct product */ 8: + message.product = MomentaryProduct.internalBinaryRead(reader, reader.uint32(), options, message.product); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: Radial, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* fixed64 collectionTimestamp = 1; */ + if (message.collectionTimestamp !== 0n) + writer.tag(1, WireType.Bit64).fixed64(message.collectionTimestamp); + /* int32 azimuthNumber = 2; */ + if (message.azimuthNumber !== 0) + writer.tag(2, WireType.Varint).int32(message.azimuthNumber); + /* float azimuthAngleDegrees = 3; */ + if (message.azimuthAngleDegrees !== 0) + writer.tag(3, WireType.Bit32).float(message.azimuthAngleDegrees); + /* float azimuthSpacingDegrees = 4; */ + if (message.azimuthSpacingDegrees !== 0) + writer.tag(4, WireType.Bit32).float(message.azimuthSpacingDegrees); + /* cif.digitalRadarData.RadialStatus radialStatus = 5; */ + if (message.radialStatus !== 0) + writer.tag(5, WireType.Varint).int32(message.radialStatus); + /* int32 elevationNumber = 6; */ + if (message.elevationNumber !== 0) + writer.tag(6, WireType.Varint).int32(message.elevationNumber); + /* float elevationDegrees = 7; */ + if (message.elevationDegrees !== 0) + writer.tag(7, WireType.Bit32).float(message.elevationDegrees); + /* cif.digitalRadarData.MomentaryProduct product = 8; */ + if (message.product) + MomentaryProduct.internalBinaryWrite(message.product, writer.tag(8, WireType.LengthDelimited).fork(), options).join(); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message cif.digitalRadarData.Radial + */ +export const Radial = new Radial$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class MomentaryProduct$Type extends MessageType { + constructor() { + super("cif.digitalRadarData.MomentaryProduct", [ + { no: 1, name: "productMetadata", kind: "message", T: () => MomentaryMeta }, + { no: 2, name: "data", kind: "message", T: () => MomentaryData } + ]); + } + create(value?: PartialMessage): MomentaryProduct { + const message = globalThis.Object.create((this.messagePrototype!)); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MomentaryProduct): MomentaryProduct { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* cif.digitalRadarData.MomentaryMeta productMetadata */ 1: + message.productMetadata = MomentaryMeta.internalBinaryRead(reader, reader.uint32(), options, message.productMetadata); + break; + case /* cif.digitalRadarData.MomentaryData data */ 2: + message.data = MomentaryData.internalBinaryRead(reader, reader.uint32(), options, message.data); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: MomentaryProduct, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* cif.digitalRadarData.MomentaryMeta productMetadata = 1; */ + if (message.productMetadata) + MomentaryMeta.internalBinaryWrite(message.productMetadata, writer.tag(1, WireType.LengthDelimited).fork(), options).join(); + /* cif.digitalRadarData.MomentaryData data = 2; */ + if (message.data) + MomentaryData.internalBinaryWrite(message.data, writer.tag(2, WireType.LengthDelimited).fork(), options).join(); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message cif.digitalRadarData.MomentaryProduct + */ +export const MomentaryProduct = new MomentaryProduct$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class MomentaryMeta$Type extends MessageType { + constructor() { + super("cif.digitalRadarData.MomentaryMeta", [ + { no: 1, name: "productName", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } + create(value?: PartialMessage): MomentaryMeta { + const message = globalThis.Object.create((this.messagePrototype!)); + message.productName = ""; + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MomentaryMeta): MomentaryMeta { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* string productName */ 1: + message.productName = reader.string(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: MomentaryMeta, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* string productName = 1; */ + if (message.productName !== "") + writer.tag(1, WireType.LengthDelimited).string(message.productName); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message cif.digitalRadarData.MomentaryMeta + */ +export const MomentaryMeta = new MomentaryMeta$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class MomentaryData$Type extends MessageType { + constructor() { + super("cif.digitalRadarData.MomentaryData", [ + { no: 1, name: "scale", kind: "scalar", T: 2 /*ScalarType.FLOAT*/ }, + { no: 2, name: "offset", kind: "scalar", T: 2 /*ScalarType.FLOAT*/ }, + { no: 3, name: "startRange", kind: "scalar", T: 5 /*ScalarType.INT32*/ }, + { no: 4, name: "sampleInterval", kind: "scalar", T: 5 /*ScalarType.INT32*/ }, + { no: 5, name: "data", kind: "scalar", repeat: 1 /*RepeatType.PACKED*/, T: 5 /*ScalarType.INT32*/ } + ]); + } + create(value?: PartialMessage): MomentaryData { + const message = globalThis.Object.create((this.messagePrototype!)); + message.scale = 0; + message.offset = 0; + message.startRange = 0; + message.sampleInterval = 0; + message.data = []; + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MomentaryData): MomentaryData { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* float scale */ 1: + message.scale = reader.float(); + break; + case /* float offset */ 2: + message.offset = reader.float(); + break; + case /* int32 startRange */ 3: + message.startRange = reader.int32(); + break; + case /* int32 sampleInterval */ 4: + message.sampleInterval = reader.int32(); + break; + case /* repeated int32 data */ 5: + if (wireType === WireType.LengthDelimited) + for (let e = reader.int32() + reader.pos; reader.pos < e;) + message.data.push(reader.int32()); + else + message.data.push(reader.int32()); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: MomentaryData, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* float scale = 1; */ + if (message.scale !== 0) + writer.tag(1, WireType.Bit32).float(message.scale); + /* float offset = 2; */ + if (message.offset !== 0) + writer.tag(2, WireType.Bit32).float(message.offset); + /* int32 startRange = 3; */ + if (message.startRange !== 0) + writer.tag(3, WireType.Varint).int32(message.startRange); + /* int32 sampleInterval = 4; */ + if (message.sampleInterval !== 0) + writer.tag(4, WireType.Varint).int32(message.sampleInterval); + /* repeated int32 data = 5; */ + if (message.data.length) { + writer.tag(5, WireType.LengthDelimited).fork(); + for (let i = 0; i < message.data.length; i++) + writer.int32(message.data[i]); + writer.join(); + } + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message cif.digitalRadarData.MomentaryData + */ +export const MomentaryData = new MomentaryData$Type(); diff --git a/crates/interchange/Cargo.toml b/crates/interchange/Cargo.toml index e217d36..d560143 100644 --- a/crates/interchange/Cargo.toml +++ b/crates/interchange/Cargo.toml @@ -4,7 +4,8 @@ version = "0.1.0" edition = "2024" [dependencies] -capnp = "0.20" +prost = "0.13" +prost-types = "0.13" wxbox-ar2 = { path = "../ar2", optional = true } nexrad-decode = { path = "../nexrad-decode", optional = true } @@ -14,4 +15,4 @@ default = [] ar2 = ["dep:wxbox-ar2", "dep:nexrad-decode"] [build-dependencies] -capnpc = "0.20" \ No newline at end of file +prost-build = "0.13" \ No newline at end of file diff --git a/crates/interchange/schemas/README.md b/crates/interchange/README.md similarity index 95% rename from crates/interchange/schemas/README.md rename to crates/interchange/README.md index 27dbfbe..955834d 100644 --- a/crates/interchange/schemas/README.md +++ b/crates/interchange/README.md @@ -1,4 +1,4 @@ -# wxbox data interchange format +x# wxbox data interchange format The wxbox data interchange format is a fast and compact protocol for interchanging weather data. Primarily intended for compact representations of radar radials, it will also eventually be extended to other types of weather information. diff --git a/crates/interchange/build.rs b/crates/interchange/build.rs index 93a432d..09f87ea 100644 --- a/crates/interchange/build.rs +++ b/crates/interchange/build.rs @@ -1,10 +1,11 @@ fn main() { - capnpc::CompilerCommand::new() - .output_path("src/") - .src_prefix("schemas") - .file("schemas/schema.capnp") - .file("schemas/digitalRadarData.capnp") - .file("schemas/tilerStatusReport.capnp") - .run() - .expect("capnp compiles"); + prost_build::compile_protos( + &[ + "src/cifContainer.proto", + "src/digitalRadarData.proto" + ], + &["src/"] + ).unwrap(); + println!("cargo:rerun-if-changed=src/cif.proto"); + println!("cargo:rerun-if-changed=src/digitalRadarData.proto"); } \ No newline at end of file diff --git a/crates/interchange/schemas/digitalRadarData.capnp b/crates/interchange/schemas/digitalRadarData.capnp deleted file mode 100644 index 7dfb500..0000000 --- a/crates/interchange/schemas/digitalRadarData.capnp +++ /dev/null @@ -1,50 +0,0 @@ -@0xf91dcf1c056cf08a; - -struct DigitalRadarData { - vcpNumber @0 :UInt16; - elevationNumber @1 :UInt8; - - radials @2 :List(Radial); -} - -struct Radial { - collectionTimestamp @0 :Int64; - - azimuthNumber @1 :UInt16; - azimuthAngleDegrees @2 :Float32; - azimuthSpacingDegrees @3 :Float32; - - radialStatus @4 :RadialStatus; - - elevationNumber @5 :UInt8; - elevationDegrees @6 :Float32; - - requestedProduct @7 :MomentaryProduct; -} - -enum RadialStatus { - elevationStart @0; - intermediateRadialData @1; - elevationEnd @2; - volumeScanStart @3; - volumeScanEnd @4; - elevationStartVCPFinal @5; # start of new elevation, last elevation in VCP -} - -struct MomentaryProduct { - productMetadata @0 :MomentaryProductMeta; - data @1 :MomentaryProductData; -} - -struct MomentaryProductMeta { - productName @0 :Text; -} -struct MomentaryProductData { - scale @0 :Float32; - offset @1 :Float32; - - startRange @2 :UInt16; - sampleInterval @3 :UInt16; - - values @4 :List(UInt8); -} \ No newline at end of file diff --git a/crates/interchange/schemas/schema.capnp b/crates/interchange/schemas/schema.capnp deleted file mode 100644 index 38f40c9..0000000 --- a/crates/interchange/schemas/schema.capnp +++ /dev/null @@ -1,8 +0,0 @@ -@0xf4ec6bdd2faa25e6; - -struct Message { - union { - tilerStatusReport @0 :import "tilerStatusReport.capnp".TilerStatusReport; - digitalRadarData @1 :import "digitalRadarData.capnp".DigitalRadarData; - } -} \ No newline at end of file diff --git a/crates/interchange/schemas/tilerStatusReport.capnp b/crates/interchange/schemas/tilerStatusReport.capnp deleted file mode 100644 index 0fdaab1..0000000 --- a/crates/interchange/schemas/tilerStatusReport.capnp +++ /dev/null @@ -1,10 +0,0 @@ -@0xa53697f84202e60f; - -struct TilerStatusReport { - cacheInfo @0 :CacheInfo; -} - -struct CacheInfo { - grib2CacheEntries @0 :UInt64; - nexradCacheEntries @1 :UInt64; -} \ No newline at end of file diff --git a/crates/interchange/src/ar2.rs b/crates/interchange/src/ar2.rs index cd39599..6511ee0 100644 --- a/crates/interchange/src/ar2.rs +++ b/crates/interchange/src/ar2.rs @@ -1,83 +1,93 @@ -use std::io::Cursor; use nexrad_decode::messages::digital_radar_data::RadialStatus; use wxbox_ar2::{MomentData, Radial, Scan}; -pub fn serialize_scan_to_cif_message(scan: &Scan, elevation_number: u8, requested_product: &str) -> Vec { - let mut message = capnp::message::Builder::new_default(); - let cif_message = message.init_root::(); - let mut digital_radar_data = cif_message.init_digital_radar_data(); +use crate::{cif, AsCif}; +use crate::cif::cif_container::MessageType; - digital_radar_data.set_vcp_number(scan.coverage_pattern_number); - digital_radar_data.set_elevation_number(elevation_number); +pub struct Ar2AsCifParams { + pub requested_elevation: u8, + pub requested_product: String +} - // find the elevation the user requested - let maybe_elevation = scan.sweeps.iter().find(|u| u.elevation_number == elevation_number); - if let Some(elevation) = maybe_elevation { - // parse out the radials - let mut radials_we_can_use: Vec<(&Radial, &MomentData)> = vec![]; - for radial in &elevation.radials { - match requested_product { - "REF" if radial.reflectivity.is_some() => { - radials_we_can_use.push((&radial, &radial.reflectivity.as_ref().unwrap())); - }, - "VEL" if radial.velocity.is_some() => { - radials_we_can_use.push((&radial, &radial.velocity.as_ref().unwrap())); - }, - "SW" if radial.spectrum_width.is_some() => { - radials_we_can_use.push((&radial, &radial.spectrum_width.as_ref().unwrap())); - }, - "ZDR" if radial.differential_reflectivity.is_some() => { - radials_we_can_use.push((&radial, &radial.differential_reflectivity.as_ref().unwrap())); - }, - "PHI" if radial.differential_phase.is_some() => { - radials_we_can_use.push((&radial, &radial.differential_phase.as_ref().unwrap())); - }, - "RHO" if radial.correlation_coefficient.is_some() => { - radials_we_can_use.push((&radial, &radial.correlation_coefficient.as_ref().unwrap())); - }, - "CFP" if radial.specific_differential_phase.is_some() => { - radials_we_can_use.push((&radial, &radial.specific_differential_phase.as_ref().unwrap())); - }, - _ => {} + +impl AsCif for Scan { + type Params = Ar2AsCifParams; + fn as_cif(&self, params: &Self::Params) -> cif::CifContainer { + let mut digital_radar_data = cif::digital_radar_data::DigitalRadarData::default(); + digital_radar_data.elevation_number = params.requested_elevation as i32; + digital_radar_data.vcp_number = self.coverage_pattern_number as i32; + + // find the elevation + let maybe_elevation = self.sweeps.iter().find(|u| u.elevation_number == params.requested_elevation); + if let Some(elevation) = maybe_elevation { + // parse out the radials + let mut radials_we_can_use: Vec<(&Radial, &MomentData)> = vec![]; + for radial in &elevation.radials { + match params.requested_product.as_str() { + "REF" if radial.reflectivity.is_some() => { + radials_we_can_use.push((&radial, &radial.reflectivity.as_ref().unwrap())); + }, + "VEL" if radial.velocity.is_some() => { + radials_we_can_use.push((&radial, &radial.velocity.as_ref().unwrap())); + }, + "SW" if radial.spectrum_width.is_some() => { + radials_we_can_use.push((&radial, &radial.spectrum_width.as_ref().unwrap())); + }, + "ZDR" if radial.differential_reflectivity.is_some() => { + radials_we_can_use.push((&radial, &radial.differential_reflectivity.as_ref().unwrap())); + }, + "PHI" if radial.differential_phase.is_some() => { + radials_we_can_use.push((&radial, &radial.differential_phase.as_ref().unwrap())); + }, + "RHO" if radial.correlation_coefficient.is_some() => { + radials_we_can_use.push((&radial, &radial.correlation_coefficient.as_ref().unwrap())); + }, + "CFP" if radial.specific_differential_phase.is_some() => { + radials_we_can_use.push((&radial, &radial.specific_differential_phase.as_ref().unwrap())); + }, + _ => {} + } } + + digital_radar_data.radials = radials_we_can_use.iter() + .map(|u| { + let mut radial = cif::digital_radar_data::Radial::default(); + radial.elevation_number = u.0.elevation_number as i32; + radial.azimuth_angle_degrees = u.0.azimuth_angle_degrees; + radial.azimuth_number = u.0.azimuth_number as i32; + radial.azimuth_spacing_degrees = u.0.azimuth_spacing_degrees; + radial.collection_timestamp = u.0.collection_timestamp as u64; + radial.elevation_degrees = u.0.elevation_number_degrees; + radial.radial_status = match u.0.radial_status { + RadialStatus::ElevationStart => cif::digital_radar_data::RadialStatus::ElevationStart, + RadialStatus::IntermediateRadialData => cif::digital_radar_data::RadialStatus::IntermediateRadialData, + RadialStatus::ElevationEnd => cif::digital_radar_data::RadialStatus::ElevationEnd, + RadialStatus::VolumeScanStart => cif::digital_radar_data::RadialStatus::VolumeScanStart, + RadialStatus::VolumeScanEnd => cif::digital_radar_data::RadialStatus::VolumeScanEnd, + RadialStatus::ElevationStartVCPFinal => cif::digital_radar_data::RadialStatus::ElevationStartVcpFinal, + }.into(); + + let mut moment_meta = cif::digital_radar_data::MomentaryMeta::default(); + moment_meta.product_name = params.requested_product.clone(); + + let mut moment_data = cif::digital_radar_data::MomentaryData::default(); + moment_data.offset = u.1.offset; + moment_data.sample_interval = u.1.sample_interval as i32; + moment_data.scale = u.1.scale; + moment_data.start_range = u.1.start_range as i32; + moment_data.data = u.1.values.iter().map(|u| *u as i32).collect(); + + let mut moment_product = cif::digital_radar_data::MomentaryProduct::default(); + moment_product.product_metadata = Some(moment_meta); + + radial.product = Some(moment_product); + + radial + }) + .collect() } - let mut radials = digital_radar_data.reborrow().init_radials(radials_we_can_use.len() as u32); - - for (number, (radial, data)) in radials_we_can_use.iter().enumerate() { - let mut this_radial_msg = radials.reborrow().get(number as u32); - this_radial_msg.set_collection_timestamp(radial.collection_timestamp); - this_radial_msg.set_azimuth_number(radial.azimuth_number); - this_radial_msg.set_azimuth_angle_degrees(radial.azimuth_angle_degrees); - this_radial_msg.set_azimuth_spacing_degrees(radial.azimuth_spacing_degrees); - this_radial_msg.set_elevation_number(radial.elevation_number); - this_radial_msg.set_elevation_degrees(radial.elevation_number_degrees); - - this_radial_msg.set_radial_status(match radial.radial_status { - RadialStatus::ElevationStart => crate::digitalRadarData_capnp::RadialStatus::ElevationStart, - RadialStatus::IntermediateRadialData => crate::digitalRadarData_capnp::RadialStatus::IntermediateRadialData, - RadialStatus::ElevationEnd => crate::digitalRadarData_capnp::RadialStatus::ElevationEnd, - RadialStatus::VolumeScanStart => crate::digitalRadarData_capnp::RadialStatus::VolumeScanStart, - RadialStatus::VolumeScanEnd => crate::digitalRadarData_capnp::RadialStatus::VolumeScanEnd, - RadialStatus::ElevationStartVCPFinal => crate::digitalRadarData_capnp::RadialStatus::ElevationStartVCPFinal, - }); - - let mut msg_requested_product = this_radial_msg.reborrow().init_requested_product(); - - let mut product_metadata = msg_requested_product.reborrow().init_product_metadata(); - product_metadata.set_product_name(requested_product); - - let mut momentary_product_data = msg_requested_product.reborrow().init_data(); - momentary_product_data.set_scale(data.scale); - momentary_product_data.set_offset(data.offset); - momentary_product_data.set_start_range(data.start_range); - momentary_product_data.set_sample_interval(data.sample_interval); - momentary_product_data.set_values(&*data.values).unwrap(); - } - } else { - digital_radar_data.reborrow().init_radials(0); // no elevation is signalled by an empty radials field + let mut container = cif::CifContainer::default(); + container.message_type = Some(MessageType::DigitalRadarData(digital_radar_data)); + container } - - let mut output = Cursor::new(Vec::new()); - capnp::serialize_packed::write_message(&mut output, &message).unwrap(); - output.into_inner() } \ No newline at end of file diff --git a/crates/interchange/src/cifContainer.proto b/crates/interchange/src/cifContainer.proto new file mode 100644 index 0000000..5fb9921 --- /dev/null +++ b/crates/interchange/src/cifContainer.proto @@ -0,0 +1,11 @@ +syntax = "proto3"; + +package cif; + +import "digitalRadarData.proto"; + +message CifContainer { + oneof message_type { + cif.digitalRadarData.DigitalRadarData digitalRadarData = 1; + } +} \ No newline at end of file diff --git a/crates/interchange/src/digitalRadarData.proto b/crates/interchange/src/digitalRadarData.proto new file mode 100644 index 0000000..858e06c --- /dev/null +++ b/crates/interchange/src/digitalRadarData.proto @@ -0,0 +1,54 @@ +syntax = "proto3"; + +package cif.digitalRadarData; + +message DigitalRadarData { + int32 vcpNumber = 1; + int32 elevationNumber = 2; + + repeated Radial radials = 3; +} + +message Radial { + fixed64 collectionTimestamp = 1; + + int32 azimuthNumber = 2; + float azimuthAngleDegrees = 3; + float azimuthSpacingDegrees = 4; + + RadialStatus radialStatus = 5; + + int32 elevationNumber = 6; + float elevationDegrees = 7; + + MomentaryProduct product = 8; +} + +enum RadialStatus { + RADIAL_STATUS_UNKNOWN = 0; + RADIAL_STATUS_ELEVATION_START = 1; + RADIAL_STATUS_INTERMEDIATE_RADIAL_DATA = 2; + RADIAL_STATUS_ELEVATION_END = 3; + RADIAL_STATUS_VOLUME_SCAN_START = 4; + RADIAL_STATUS_VOLUME_SCAN_END = 5; + RADIAL_STATUS_ELEVATION_START_VCP_FINAL = 6; +} + +message MomentaryProduct { + MomentaryMeta productMetadata = 1; + MomentaryData data = 2; +} + +message MomentaryMeta { + string productName = 1; +} + +message MomentaryData { + float scale = 1; + float offset = 2; + + int32 startRange = 3; + int32 sampleInterval = 4; + + repeated int32 data = 5; +} \ No newline at end of file diff --git a/crates/interchange/src/digitalRadarData_capnp.rs b/crates/interchange/src/digitalRadarData_capnp.rs deleted file mode 100644 index 06e40d8..0000000 --- a/crates/interchange/src/digitalRadarData_capnp.rs +++ /dev/null @@ -1,1588 +0,0 @@ -// @generated by the capnpc-rust plugin to the Cap'n Proto schema compiler. -// DO NOT EDIT. -// source: digitalRadarData.capnp - - -pub mod digital_radar_data { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types }).into() } } - impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } - impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - impl <> ::core::marker::Copy for Reader<'_,> {} - impl <> ::core::clone::Clone for Reader<'_,> { - fn clone(&self) -> Self { *self } - } - - impl <> ::capnp::traits::HasTypeId for Reader<'_,> { - const TYPE_ID: u64 = _private::TYPE_ID; - } - impl <'a,> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { - fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } - } - } - - impl <'a,> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { - fn from(reader: Reader<'a,>) -> Self { - Self::Struct(::capnp::dynamic_struct::Reader::new(reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types::<>, annotation_types: _private::get_annotation_types::<>}))) - } - } - - impl <> ::core::fmt::Debug for Reader<'_,> { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::result::Result<(), ::core::fmt::Error> { - core::fmt::Debug::fmt(&::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f) - } - } - - impl <'a,> ::capnp::traits::FromPointerReader<'a> for Reader<'a,> { - fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>) -> ::capnp::Result { - ::core::result::Result::Ok(reader.get_struct(default)?.into()) - } - } - - impl <'a,> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a,> { - fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { - self.reader - } - } - - impl <'a,> ::capnp::traits::Imbue<'a> for Reader<'a,> { - fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { - self.reader.imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) - } - } - - impl <'a,> Reader<'a,> { - pub fn reborrow(&self) -> Reader<'_,> { - Self { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_vcp_number(self) -> u16 { - self.reader.get_data_field::(0) - } - #[inline] - pub fn get_elevation_number(self) -> u8 { - self.reader.get_data_field::(2) - } - #[inline] - pub fn get_radials(self) -> ::capnp::Result<::capnp::struct_list::Reader<'a,crate::digitalRadarData_capnp::radial::Owned>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn has_radials(&self) -> bool { - !self.reader.get_pointer_field(0).is_null() - } - } - - pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a> } - impl <> ::capnp::traits::HasStructSize for Builder<'_,> { - const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 1, pointers: 1 }; - } - impl <> ::capnp::traits::HasTypeId for Builder<'_,> { - const TYPE_ID: u64 = _private::TYPE_ID; - } - impl <'a,> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a,> { - fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { - Self { builder, } - } - } - - impl <'a,> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { - fn from(builder: Builder<'a,>) -> Self { - Self::Struct(::capnp::dynamic_struct::Builder::new(builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types::<>, annotation_types: _private::get_annotation_types::<>}))) - } - } - - impl <'a,> ::capnp::traits::ImbueMut<'a> for Builder<'a,> { - fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { - self.builder.imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) - } - } - - impl <'a,> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a,> { - fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { - builder.init_struct(::STRUCT_SIZE).into() - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>) -> ::capnp::Result { - ::core::result::Result::Ok(builder.get_struct(::STRUCT_SIZE, default)?.into()) - } - } - - impl <> ::capnp::traits::SetterInput> for Reader<'_,> { - fn set_pointer_builder(mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - self.builder.into_reader().into() - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { builder: self.builder.reborrow() } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - self.builder.as_reader().into() - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.as_reader().total_size() - } - #[inline] - pub fn get_vcp_number(self) -> u16 { - self.builder.get_data_field::(0) - } - #[inline] - pub fn set_vcp_number(&mut self, value: u16) { - self.builder.set_data_field::(0, value); - } - #[inline] - pub fn get_elevation_number(self) -> u8 { - self.builder.get_data_field::(2) - } - #[inline] - pub fn set_elevation_number(&mut self, value: u8) { - self.builder.set_data_field::(2, value); - } - #[inline] - pub fn get_radials(self) -> ::capnp::Result<::capnp::struct_list::Builder<'a,crate::digitalRadarData_capnp::radial::Owned>> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_radials(&mut self, value: ::capnp::struct_list::Reader<'_,crate::digitalRadarData_capnp::radial::Owned>) -> ::capnp::Result<()> { - ::capnp::traits::SetterInput::set_pointer_builder(self.builder.reborrow().get_pointer_field(0), value, false) - } - #[inline] - pub fn init_radials(self, size: u32) -> ::capnp::struct_list::Builder<'a,crate::digitalRadarData_capnp::radial::Owned> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), size) - } - #[inline] - pub fn has_radials(&self) -> bool { - !self.builder.is_pointer_field_null(0) - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { - Self { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - pub static ENCODED_NODE: [::capnp::Word; 71] = [ - ::capnp::word(0, 0, 0, 0, 6, 0, 6, 0), - ::capnp::word(124, 221, 74, 204, 88, 181, 51, 199), - ::capnp::word(23, 0, 0, 0, 1, 0, 1, 0), - ::capnp::word(138, 240, 108, 5, 28, 207, 29, 249), - ::capnp::word(1, 0, 7, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(22, 0, 0, 0, 143, 0, 0, 0), - ::capnp::word(21, 0, 0, 0, 66, 1, 0, 0), - ::capnp::word(37, 0, 0, 0, 7, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(33, 0, 0, 0, 175, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(100, 105, 103, 105, 116, 97, 108, 82), - ::capnp::word(97, 100, 97, 114, 68, 97, 116, 97), - ::capnp::word(46, 99, 97, 112, 110, 112, 58, 68), - ::capnp::word(105, 103, 105, 116, 97, 108, 82, 97), - ::capnp::word(100, 97, 114, 68, 97, 116, 97, 0), - ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), - ::capnp::word(12, 0, 0, 0, 3, 0, 4, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(69, 0, 0, 0, 82, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(68, 0, 0, 0, 3, 0, 1, 0), - ::capnp::word(80, 0, 0, 0, 2, 0, 1, 0), - ::capnp::word(1, 0, 0, 0, 2, 0, 0, 0), - ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(77, 0, 0, 0, 130, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(76, 0, 0, 0, 3, 0, 1, 0), - ::capnp::word(88, 0, 0, 0, 2, 0, 1, 0), - ::capnp::word(2, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 1, 0, 2, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(85, 0, 0, 0, 66, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(80, 0, 0, 0, 3, 0, 1, 0), - ::capnp::word(108, 0, 0, 0, 2, 0, 1, 0), - ::capnp::word(118, 99, 112, 78, 117, 109, 98, 101), - ::capnp::word(114, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(7, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(7, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(101, 108, 101, 118, 97, 116, 105, 111), - ::capnp::word(110, 78, 117, 109, 98, 101, 114, 0), - ::capnp::word(6, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(6, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(114, 97, 100, 105, 97, 108, 115, 0), - ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), - ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(52, 61, 253, 131, 10, 228, 32, 210), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ]; - pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { - match index { - 0 => ::introspect(), - 1 => ::introspect(), - 2 => <::capnp::struct_list::Owned as ::capnp::introspect::Introspect>::introspect(), - _ => panic!("invalid field index {}", index), - } - } - pub fn get_annotation_types(child_index: Option, index: u32) -> ::capnp::introspect::Type { - panic!("invalid annotation indices ({:?}, {}) ", child_index, index) - } - pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { - encoded_node: &ENCODED_NODE, - nonunion_members: NONUNION_MEMBERS, - members_by_discriminant: MEMBERS_BY_DISCRIMINANT, - members_by_name: MEMBERS_BY_NAME, - }; - pub static NONUNION_MEMBERS : &[u16] = &[0,1,2]; - pub static MEMBERS_BY_DISCRIMINANT : &[u16] = &[]; - pub static MEMBERS_BY_NAME : &[u16] = &[1,2,0]; - pub const TYPE_ID: u64 = 0xc733_b558_cc4a_dd7c; - } -} - -pub mod radial { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types }).into() } } - impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } - impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - impl <> ::core::marker::Copy for Reader<'_,> {} - impl <> ::core::clone::Clone for Reader<'_,> { - fn clone(&self) -> Self { *self } - } - - impl <> ::capnp::traits::HasTypeId for Reader<'_,> { - const TYPE_ID: u64 = _private::TYPE_ID; - } - impl <'a,> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { - fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } - } - } - - impl <'a,> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { - fn from(reader: Reader<'a,>) -> Self { - Self::Struct(::capnp::dynamic_struct::Reader::new(reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types::<>, annotation_types: _private::get_annotation_types::<>}))) - } - } - - impl <> ::core::fmt::Debug for Reader<'_,> { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::result::Result<(), ::core::fmt::Error> { - core::fmt::Debug::fmt(&::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f) - } - } - - impl <'a,> ::capnp::traits::FromPointerReader<'a> for Reader<'a,> { - fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>) -> ::capnp::Result { - ::core::result::Result::Ok(reader.get_struct(default)?.into()) - } - } - - impl <'a,> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a,> { - fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { - self.reader - } - } - - impl <'a,> ::capnp::traits::Imbue<'a> for Reader<'a,> { - fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { - self.reader.imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) - } - } - - impl <'a,> Reader<'a,> { - pub fn reborrow(&self) -> Reader<'_,> { - Self { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_collection_timestamp(self) -> i64 { - self.reader.get_data_field::(0) - } - #[inline] - pub fn get_azimuth_number(self) -> u16 { - self.reader.get_data_field::(4) - } - #[inline] - pub fn get_azimuth_angle_degrees(self) -> f32 { - self.reader.get_data_field::(3) - } - #[inline] - pub fn get_azimuth_spacing_degrees(self) -> f32 { - self.reader.get_data_field::(4) - } - #[inline] - pub fn get_radial_status(self) -> ::core::result::Result { - ::core::convert::TryInto::try_into(self.reader.get_data_field::(5)) - } - #[inline] - pub fn get_elevation_number(self) -> u8 { - self.reader.get_data_field::(20) - } - #[inline] - pub fn get_elevation_degrees(self) -> f32 { - self.reader.get_data_field::(6) - } - #[inline] - pub fn get_requested_product(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn has_requested_product(&self) -> bool { - !self.reader.get_pointer_field(0).is_null() - } - } - - pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a> } - impl <> ::capnp::traits::HasStructSize for Builder<'_,> { - const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 4, pointers: 1 }; - } - impl <> ::capnp::traits::HasTypeId for Builder<'_,> { - const TYPE_ID: u64 = _private::TYPE_ID; - } - impl <'a,> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a,> { - fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { - Self { builder, } - } - } - - impl <'a,> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { - fn from(builder: Builder<'a,>) -> Self { - Self::Struct(::capnp::dynamic_struct::Builder::new(builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types::<>, annotation_types: _private::get_annotation_types::<>}))) - } - } - - impl <'a,> ::capnp::traits::ImbueMut<'a> for Builder<'a,> { - fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { - self.builder.imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) - } - } - - impl <'a,> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a,> { - fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { - builder.init_struct(::STRUCT_SIZE).into() - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>) -> ::capnp::Result { - ::core::result::Result::Ok(builder.get_struct(::STRUCT_SIZE, default)?.into()) - } - } - - impl <> ::capnp::traits::SetterInput> for Reader<'_,> { - fn set_pointer_builder(mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - self.builder.into_reader().into() - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { builder: self.builder.reborrow() } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - self.builder.as_reader().into() - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.as_reader().total_size() - } - #[inline] - pub fn get_collection_timestamp(self) -> i64 { - self.builder.get_data_field::(0) - } - #[inline] - pub fn set_collection_timestamp(&mut self, value: i64) { - self.builder.set_data_field::(0, value); - } - #[inline] - pub fn get_azimuth_number(self) -> u16 { - self.builder.get_data_field::(4) - } - #[inline] - pub fn set_azimuth_number(&mut self, value: u16) { - self.builder.set_data_field::(4, value); - } - #[inline] - pub fn get_azimuth_angle_degrees(self) -> f32 { - self.builder.get_data_field::(3) - } - #[inline] - pub fn set_azimuth_angle_degrees(&mut self, value: f32) { - self.builder.set_data_field::(3, value); - } - #[inline] - pub fn get_azimuth_spacing_degrees(self) -> f32 { - self.builder.get_data_field::(4) - } - #[inline] - pub fn set_azimuth_spacing_degrees(&mut self, value: f32) { - self.builder.set_data_field::(4, value); - } - #[inline] - pub fn get_radial_status(self) -> ::core::result::Result { - ::core::convert::TryInto::try_into(self.builder.get_data_field::(5)) - } - #[inline] - pub fn set_radial_status(&mut self, value: crate::digitalRadarData_capnp::RadialStatus) { - self.builder.set_data_field::(5, value as u16); - } - #[inline] - pub fn get_elevation_number(self) -> u8 { - self.builder.get_data_field::(20) - } - #[inline] - pub fn set_elevation_number(&mut self, value: u8) { - self.builder.set_data_field::(20, value); - } - #[inline] - pub fn get_elevation_degrees(self) -> f32 { - self.builder.get_data_field::(6) - } - #[inline] - pub fn set_elevation_degrees(&mut self, value: f32) { - self.builder.set_data_field::(6, value); - } - #[inline] - pub fn get_requested_product(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_requested_product(&mut self, value: crate::digitalRadarData_capnp::momentary_product::Reader<'_>) -> ::capnp::Result<()> { - ::capnp::traits::SetterInput::set_pointer_builder(self.builder.reborrow().get_pointer_field(0), value, false) - } - #[inline] - pub fn init_requested_product(self, ) -> crate::digitalRadarData_capnp::momentary_product::Builder<'a> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) - } - #[inline] - pub fn has_requested_product(&self) -> bool { - !self.builder.is_pointer_field_null(0) - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { - Self { _typeless: typeless, } - } - } - impl Pipeline { - pub fn get_requested_product(&self) -> crate::digitalRadarData_capnp::momentary_product::Pipeline { - ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) - } - } - mod _private { - pub static ENCODED_NODE: [::capnp::Word; 152] = [ - ::capnp::word(0, 0, 0, 0, 6, 0, 6, 0), - ::capnp::word(52, 61, 253, 131, 10, 228, 32, 210), - ::capnp::word(23, 0, 0, 0, 1, 0, 4, 0), - ::capnp::word(138, 240, 108, 5, 28, 207, 29, 249), - ::capnp::word(1, 0, 7, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(145, 0, 0, 0, 194, 1, 0, 0), - ::capnp::word(21, 0, 0, 0, 242, 0, 0, 0), - ::capnp::word(33, 0, 0, 0, 7, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(29, 0, 0, 0, 199, 1, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(100, 105, 103, 105, 116, 97, 108, 82), - ::capnp::word(97, 100, 97, 114, 68, 97, 116, 97), - ::capnp::word(46, 99, 97, 112, 110, 112, 58, 82), - ::capnp::word(97, 100, 105, 97, 108, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), - ::capnp::word(32, 0, 0, 0, 3, 0, 4, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(209, 0, 0, 0, 162, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(212, 0, 0, 0, 3, 0, 1, 0), - ::capnp::word(224, 0, 0, 0, 2, 0, 1, 0), - ::capnp::word(1, 0, 0, 0, 4, 0, 0, 0), - ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(221, 0, 0, 0, 114, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(220, 0, 0, 0, 3, 0, 1, 0), - ::capnp::word(232, 0, 0, 0, 2, 0, 1, 0), - ::capnp::word(2, 0, 0, 0, 3, 0, 0, 0), - ::capnp::word(0, 0, 1, 0, 2, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(229, 0, 0, 0, 162, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(232, 0, 0, 0, 3, 0, 1, 0), - ::capnp::word(244, 0, 0, 0, 2, 0, 1, 0), - ::capnp::word(3, 0, 0, 0, 4, 0, 0, 0), - ::capnp::word(0, 0, 1, 0, 3, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(241, 0, 0, 0, 178, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(244, 0, 0, 0, 3, 0, 1, 0), - ::capnp::word(0, 1, 0, 0, 2, 0, 1, 0), - ::capnp::word(4, 0, 0, 0, 5, 0, 0, 0), - ::capnp::word(0, 0, 1, 0, 4, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(253, 0, 0, 0, 106, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(252, 0, 0, 0, 3, 0, 1, 0), - ::capnp::word(8, 1, 0, 0, 2, 0, 1, 0), - ::capnp::word(5, 0, 0, 0, 20, 0, 0, 0), - ::capnp::word(0, 0, 1, 0, 5, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(5, 1, 0, 0, 130, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(4, 1, 0, 0, 3, 0, 1, 0), - ::capnp::word(16, 1, 0, 0, 2, 0, 1, 0), - ::capnp::word(6, 0, 0, 0, 6, 0, 0, 0), - ::capnp::word(0, 0, 1, 0, 6, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(13, 1, 0, 0, 138, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(16, 1, 0, 0, 3, 0, 1, 0), - ::capnp::word(28, 1, 0, 0, 2, 0, 1, 0), - ::capnp::word(7, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 1, 0, 7, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(25, 1, 0, 0, 138, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(28, 1, 0, 0, 3, 0, 1, 0), - ::capnp::word(40, 1, 0, 0, 2, 0, 1, 0), - ::capnp::word(99, 111, 108, 108, 101, 99, 116, 105), - ::capnp::word(111, 110, 84, 105, 109, 101, 115, 116), - ::capnp::word(97, 109, 112, 0, 0, 0, 0, 0), - ::capnp::word(5, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(5, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(97, 122, 105, 109, 117, 116, 104, 78), - ::capnp::word(117, 109, 98, 101, 114, 0, 0, 0), - ::capnp::word(7, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(7, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(97, 122, 105, 109, 117, 116, 104, 65), - ::capnp::word(110, 103, 108, 101, 68, 101, 103, 114), - ::capnp::word(101, 101, 115, 0, 0, 0, 0, 0), - ::capnp::word(10, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(10, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(97, 122, 105, 109, 117, 116, 104, 83), - ::capnp::word(112, 97, 99, 105, 110, 103, 68, 101), - ::capnp::word(103, 114, 101, 101, 115, 0, 0, 0), - ::capnp::word(10, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(10, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(114, 97, 100, 105, 97, 108, 83, 116), - ::capnp::word(97, 116, 117, 115, 0, 0, 0, 0), - ::capnp::word(15, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(20, 47, 43, 70, 56, 89, 113, 184), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(15, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(101, 108, 101, 118, 97, 116, 105, 111), - ::capnp::word(110, 78, 117, 109, 98, 101, 114, 0), - ::capnp::word(6, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(6, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(101, 108, 101, 118, 97, 116, 105, 111), - ::capnp::word(110, 68, 101, 103, 114, 101, 101, 115), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(10, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(10, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(114, 101, 113, 117, 101, 115, 116, 101), - ::capnp::word(100, 80, 114, 111, 100, 117, 99, 116), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(145, 161, 46, 18, 18, 53, 76, 181), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ]; - pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { - match index { - 0 => ::introspect(), - 1 => ::introspect(), - 2 => ::introspect(), - 3 => ::introspect(), - 4 => ::introspect(), - 5 => ::introspect(), - 6 => ::introspect(), - 7 => ::introspect(), - _ => panic!("invalid field index {}", index), - } - } - pub fn get_annotation_types(child_index: Option, index: u32) -> ::capnp::introspect::Type { - panic!("invalid annotation indices ({:?}, {}) ", child_index, index) - } - pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { - encoded_node: &ENCODED_NODE, - nonunion_members: NONUNION_MEMBERS, - members_by_discriminant: MEMBERS_BY_DISCRIMINANT, - members_by_name: MEMBERS_BY_NAME, - }; - pub static NONUNION_MEMBERS : &[u16] = &[0,1,2,3,4,5,6,7]; - pub static MEMBERS_BY_DISCRIMINANT : &[u16] = &[]; - pub static MEMBERS_BY_NAME : &[u16] = &[2,1,3,0,6,5,4,7]; - pub const TYPE_ID: u64 = 0xd220_e40a_83fd_3d34; - } -} - -#[repr(u16)] -#[derive(Clone, Copy, Debug, PartialEq, Eq)] -pub enum RadialStatus { - ElevationStart = 0, - IntermediateRadialData = 1, - ElevationEnd = 2, - VolumeScanStart = 3, - VolumeScanEnd = 4, - ElevationStartVCPFinal = 5, -} - -impl ::capnp::introspect::Introspect for RadialStatus { - fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Enum(::capnp::introspect::RawEnumSchema { encoded_node: &radial_status::ENCODED_NODE, annotation_types: radial_status::get_annotation_types }).into() } -} -impl ::core::convert::From for ::capnp::dynamic_value::Reader<'_> { - fn from(e: RadialStatus) -> Self { ::capnp::dynamic_value::Enum::new(e.into(), ::capnp::introspect::RawEnumSchema { encoded_node: &radial_status::ENCODED_NODE, annotation_types: radial_status::get_annotation_types }.into()).into() } -} -impl ::core::convert::TryFrom for RadialStatus { - type Error = ::capnp::NotInSchema; - fn try_from(value: u16) -> ::core::result::Result>::Error> { - match value { - 0 => ::core::result::Result::Ok(Self::ElevationStart), - 1 => ::core::result::Result::Ok(Self::IntermediateRadialData), - 2 => ::core::result::Result::Ok(Self::ElevationEnd), - 3 => ::core::result::Result::Ok(Self::VolumeScanStart), - 4 => ::core::result::Result::Ok(Self::VolumeScanEnd), - 5 => ::core::result::Result::Ok(Self::ElevationStartVCPFinal), - n => ::core::result::Result::Err(::capnp::NotInSchema(n)), - } - } -} -impl From for u16 { - #[inline] - fn from(x: RadialStatus) -> u16 { x as u16 } -} -impl ::capnp::traits::HasTypeId for RadialStatus { - const TYPE_ID: u64 = 0xb871_5938_462b_2f14u64; -} -mod radial_status { -pub static ENCODED_NODE: [::capnp::Word; 52] = [ - ::capnp::word(0, 0, 0, 0, 6, 0, 6, 0), - ::capnp::word(20, 47, 43, 70, 56, 89, 113, 184), - ::capnp::word(23, 0, 0, 0, 2, 0, 0, 0), - ::capnp::word(138, 240, 108, 5, 28, 207, 29, 249), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(196, 1, 0, 0, 161, 2, 0, 0), - ::capnp::word(21, 0, 0, 0, 34, 1, 0, 0), - ::capnp::word(37, 0, 0, 0, 7, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(33, 0, 0, 0, 151, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(100, 105, 103, 105, 116, 97, 108, 82), - ::capnp::word(97, 100, 97, 114, 68, 97, 116, 97), - ::capnp::word(46, 99, 97, 112, 110, 112, 58, 82), - ::capnp::word(97, 100, 105, 97, 108, 83, 116, 97), - ::capnp::word(116, 117, 115, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), - ::capnp::word(24, 0, 0, 0, 1, 0, 2, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(65, 0, 0, 0, 122, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(61, 0, 0, 0, 186, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(2, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(61, 0, 0, 0, 106, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(3, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(57, 0, 0, 0, 130, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(4, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(53, 0, 0, 0, 114, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(5, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(49, 0, 0, 0, 186, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(101, 108, 101, 118, 97, 116, 105, 111), - ::capnp::word(110, 83, 116, 97, 114, 116, 0, 0), - ::capnp::word(105, 110, 116, 101, 114, 109, 101, 100), - ::capnp::word(105, 97, 116, 101, 82, 97, 100, 105), - ::capnp::word(97, 108, 68, 97, 116, 97, 0, 0), - ::capnp::word(101, 108, 101, 118, 97, 116, 105, 111), - ::capnp::word(110, 69, 110, 100, 0, 0, 0, 0), - ::capnp::word(118, 111, 108, 117, 109, 101, 83, 99), - ::capnp::word(97, 110, 83, 116, 97, 114, 116, 0), - ::capnp::word(118, 111, 108, 117, 109, 101, 83, 99), - ::capnp::word(97, 110, 69, 110, 100, 0, 0, 0), - ::capnp::word(101, 108, 101, 118, 97, 116, 105, 111), - ::capnp::word(110, 83, 116, 97, 114, 116, 86, 67), - ::capnp::word(80, 70, 105, 110, 97, 108, 0, 0), -]; -pub fn get_annotation_types(child_index: Option, index: u32) -> ::capnp::introspect::Type { - panic!("invalid annotation indices ({:?}, {}) ", child_index, index) -} -} - -pub mod momentary_product { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types }).into() } } - impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } - impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - impl <> ::core::marker::Copy for Reader<'_,> {} - impl <> ::core::clone::Clone for Reader<'_,> { - fn clone(&self) -> Self { *self } - } - - impl <> ::capnp::traits::HasTypeId for Reader<'_,> { - const TYPE_ID: u64 = _private::TYPE_ID; - } - impl <'a,> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { - fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } - } - } - - impl <'a,> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { - fn from(reader: Reader<'a,>) -> Self { - Self::Struct(::capnp::dynamic_struct::Reader::new(reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types::<>, annotation_types: _private::get_annotation_types::<>}))) - } - } - - impl <> ::core::fmt::Debug for Reader<'_,> { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::result::Result<(), ::core::fmt::Error> { - core::fmt::Debug::fmt(&::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f) - } - } - - impl <'a,> ::capnp::traits::FromPointerReader<'a> for Reader<'a,> { - fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>) -> ::capnp::Result { - ::core::result::Result::Ok(reader.get_struct(default)?.into()) - } - } - - impl <'a,> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a,> { - fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { - self.reader - } - } - - impl <'a,> ::capnp::traits::Imbue<'a> for Reader<'a,> { - fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { - self.reader.imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) - } - } - - impl <'a,> Reader<'a,> { - pub fn reborrow(&self) -> Reader<'_,> { - Self { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_product_metadata(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn has_product_metadata(&self) -> bool { - !self.reader.get_pointer_field(0).is_null() - } - #[inline] - pub fn get_data(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(1), ::core::option::Option::None) - } - #[inline] - pub fn has_data(&self) -> bool { - !self.reader.get_pointer_field(1).is_null() - } - } - - pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a> } - impl <> ::capnp::traits::HasStructSize for Builder<'_,> { - const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 0, pointers: 2 }; - } - impl <> ::capnp::traits::HasTypeId for Builder<'_,> { - const TYPE_ID: u64 = _private::TYPE_ID; - } - impl <'a,> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a,> { - fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { - Self { builder, } - } - } - - impl <'a,> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { - fn from(builder: Builder<'a,>) -> Self { - Self::Struct(::capnp::dynamic_struct::Builder::new(builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types::<>, annotation_types: _private::get_annotation_types::<>}))) - } - } - - impl <'a,> ::capnp::traits::ImbueMut<'a> for Builder<'a,> { - fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { - self.builder.imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) - } - } - - impl <'a,> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a,> { - fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { - builder.init_struct(::STRUCT_SIZE).into() - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>) -> ::capnp::Result { - ::core::result::Result::Ok(builder.get_struct(::STRUCT_SIZE, default)?.into()) - } - } - - impl <> ::capnp::traits::SetterInput> for Reader<'_,> { - fn set_pointer_builder(mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - self.builder.into_reader().into() - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { builder: self.builder.reborrow() } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - self.builder.as_reader().into() - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.as_reader().total_size() - } - #[inline] - pub fn get_product_metadata(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_product_metadata(&mut self, value: crate::digitalRadarData_capnp::momentary_product_meta::Reader<'_>) -> ::capnp::Result<()> { - ::capnp::traits::SetterInput::set_pointer_builder(self.builder.reborrow().get_pointer_field(0), value, false) - } - #[inline] - pub fn init_product_metadata(self, ) -> crate::digitalRadarData_capnp::momentary_product_meta::Builder<'a> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) - } - #[inline] - pub fn has_product_metadata(&self) -> bool { - !self.builder.is_pointer_field_null(0) - } - #[inline] - pub fn get_data(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(1), ::core::option::Option::None) - } - #[inline] - pub fn set_data(&mut self, value: crate::digitalRadarData_capnp::momentary_product_data::Reader<'_>) -> ::capnp::Result<()> { - ::capnp::traits::SetterInput::set_pointer_builder(self.builder.reborrow().get_pointer_field(1), value, false) - } - #[inline] - pub fn init_data(self, ) -> crate::digitalRadarData_capnp::momentary_product_data::Builder<'a> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(1), 0) - } - #[inline] - pub fn has_data(&self) -> bool { - !self.builder.is_pointer_field_null(1) - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { - Self { _typeless: typeless, } - } - } - impl Pipeline { - pub fn get_product_metadata(&self) -> crate::digitalRadarData_capnp::momentary_product_meta::Pipeline { - ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) - } - pub fn get_data(&self) -> crate::digitalRadarData_capnp::momentary_product_data::Pipeline { - ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(1)) - } - } - mod _private { - pub static ENCODED_NODE: [::capnp::Word; 51] = [ - ::capnp::word(0, 0, 0, 0, 6, 0, 6, 0), - ::capnp::word(145, 161, 46, 18, 18, 53, 76, 181), - ::capnp::word(23, 0, 0, 0, 1, 0, 0, 0), - ::capnp::word(138, 240, 108, 5, 28, 207, 29, 249), - ::capnp::word(2, 0, 7, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(163, 2, 0, 0, 15, 3, 0, 0), - ::capnp::word(21, 0, 0, 0, 66, 1, 0, 0), - ::capnp::word(37, 0, 0, 0, 7, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(33, 0, 0, 0, 119, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(100, 105, 103, 105, 116, 97, 108, 82), - ::capnp::word(97, 100, 97, 114, 68, 97, 116, 97), - ::capnp::word(46, 99, 97, 112, 110, 112, 58, 77), - ::capnp::word(111, 109, 101, 110, 116, 97, 114, 121), - ::capnp::word(80, 114, 111, 100, 117, 99, 116, 0), - ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), - ::capnp::word(8, 0, 0, 0, 3, 0, 4, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(41, 0, 0, 0, 130, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(40, 0, 0, 0, 3, 0, 1, 0), - ::capnp::word(52, 0, 0, 0, 2, 0, 1, 0), - ::capnp::word(1, 0, 0, 0, 1, 0, 0, 0), - ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(49, 0, 0, 0, 42, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(44, 0, 0, 0, 3, 0, 1, 0), - ::capnp::word(56, 0, 0, 0, 2, 0, 1, 0), - ::capnp::word(112, 114, 111, 100, 117, 99, 116, 77), - ::capnp::word(101, 116, 97, 100, 97, 116, 97, 0), - ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(120, 160, 228, 75, 58, 156, 246, 253), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(100, 97, 116, 97, 0, 0, 0, 0), - ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(8, 104, 131, 104, 171, 253, 43, 210), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ]; - pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { - match index { - 0 => ::introspect(), - 1 => ::introspect(), - _ => panic!("invalid field index {}", index), - } - } - pub fn get_annotation_types(child_index: Option, index: u32) -> ::capnp::introspect::Type { - panic!("invalid annotation indices ({:?}, {}) ", child_index, index) - } - pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { - encoded_node: &ENCODED_NODE, - nonunion_members: NONUNION_MEMBERS, - members_by_discriminant: MEMBERS_BY_DISCRIMINANT, - members_by_name: MEMBERS_BY_NAME, - }; - pub static NONUNION_MEMBERS : &[u16] = &[0,1]; - pub static MEMBERS_BY_DISCRIMINANT : &[u16] = &[]; - pub static MEMBERS_BY_NAME : &[u16] = &[1,0]; - pub const TYPE_ID: u64 = 0xb54c_3512_122e_a191; - } -} - -pub mod momentary_product_meta { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types }).into() } } - impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } - impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - impl <> ::core::marker::Copy for Reader<'_,> {} - impl <> ::core::clone::Clone for Reader<'_,> { - fn clone(&self) -> Self { *self } - } - - impl <> ::capnp::traits::HasTypeId for Reader<'_,> { - const TYPE_ID: u64 = _private::TYPE_ID; - } - impl <'a,> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { - fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } - } - } - - impl <'a,> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { - fn from(reader: Reader<'a,>) -> Self { - Self::Struct(::capnp::dynamic_struct::Reader::new(reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types::<>, annotation_types: _private::get_annotation_types::<>}))) - } - } - - impl <> ::core::fmt::Debug for Reader<'_,> { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::result::Result<(), ::core::fmt::Error> { - core::fmt::Debug::fmt(&::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f) - } - } - - impl <'a,> ::capnp::traits::FromPointerReader<'a> for Reader<'a,> { - fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>) -> ::capnp::Result { - ::core::result::Result::Ok(reader.get_struct(default)?.into()) - } - } - - impl <'a,> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a,> { - fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { - self.reader - } - } - - impl <'a,> ::capnp::traits::Imbue<'a> for Reader<'a,> { - fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { - self.reader.imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) - } - } - - impl <'a,> Reader<'a,> { - pub fn reborrow(&self) -> Reader<'_,> { - Self { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_product_name(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn has_product_name(&self) -> bool { - !self.reader.get_pointer_field(0).is_null() - } - } - - pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a> } - impl <> ::capnp::traits::HasStructSize for Builder<'_,> { - const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 0, pointers: 1 }; - } - impl <> ::capnp::traits::HasTypeId for Builder<'_,> { - const TYPE_ID: u64 = _private::TYPE_ID; - } - impl <'a,> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a,> { - fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { - Self { builder, } - } - } - - impl <'a,> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { - fn from(builder: Builder<'a,>) -> Self { - Self::Struct(::capnp::dynamic_struct::Builder::new(builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types::<>, annotation_types: _private::get_annotation_types::<>}))) - } - } - - impl <'a,> ::capnp::traits::ImbueMut<'a> for Builder<'a,> { - fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { - self.builder.imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) - } - } - - impl <'a,> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a,> { - fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { - builder.init_struct(::STRUCT_SIZE).into() - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>) -> ::capnp::Result { - ::core::result::Result::Ok(builder.get_struct(::STRUCT_SIZE, default)?.into()) - } - } - - impl <> ::capnp::traits::SetterInput> for Reader<'_,> { - fn set_pointer_builder(mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - self.builder.into_reader().into() - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { builder: self.builder.reborrow() } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - self.builder.as_reader().into() - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.as_reader().total_size() - } - #[inline] - pub fn get_product_name(self) -> ::capnp::Result<::capnp::text::Builder<'a>> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_product_name(&mut self, value: impl ::capnp::traits::SetterInput<::capnp::text::Owned>) { - ::capnp::traits::SetterInput::set_pointer_builder(self.builder.reborrow().get_pointer_field(0), value, false).unwrap() - } - #[inline] - pub fn init_product_name(self, size: u32) -> ::capnp::text::Builder<'a> { - self.builder.get_pointer_field(0).init_text(size) - } - #[inline] - pub fn has_product_name(&self) -> bool { - !self.builder.is_pointer_field_null(0) - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { - Self { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - pub static ENCODED_NODE: [::capnp::Word; 37] = [ - ::capnp::word(0, 0, 0, 0, 6, 0, 6, 0), - ::capnp::word(120, 160, 228, 75, 58, 156, 246, 253), - ::capnp::word(23, 0, 0, 0, 1, 0, 0, 0), - ::capnp::word(138, 240, 108, 5, 28, 207, 29, 249), - ::capnp::word(1, 0, 7, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(17, 3, 0, 0, 74, 3, 0, 0), - ::capnp::word(21, 0, 0, 0, 98, 1, 0, 0), - ::capnp::word(41, 0, 0, 0, 7, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(37, 0, 0, 0, 63, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(100, 105, 103, 105, 116, 97, 108, 82), - ::capnp::word(97, 100, 97, 114, 68, 97, 116, 97), - ::capnp::word(46, 99, 97, 112, 110, 112, 58, 77), - ::capnp::word(111, 109, 101, 110, 116, 97, 114, 121), - ::capnp::word(80, 114, 111, 100, 117, 99, 116, 77), - ::capnp::word(101, 116, 97, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), - ::capnp::word(4, 0, 0, 0, 3, 0, 4, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(13, 0, 0, 0, 98, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(12, 0, 0, 0, 3, 0, 1, 0), - ::capnp::word(24, 0, 0, 0, 2, 0, 1, 0), - ::capnp::word(112, 114, 111, 100, 117, 99, 116, 78), - ::capnp::word(97, 109, 101, 0, 0, 0, 0, 0), - ::capnp::word(12, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(12, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ]; - pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { - match index { - 0 => <::capnp::text::Owned as ::capnp::introspect::Introspect>::introspect(), - _ => panic!("invalid field index {}", index), - } - } - pub fn get_annotation_types(child_index: Option, index: u32) -> ::capnp::introspect::Type { - panic!("invalid annotation indices ({:?}, {}) ", child_index, index) - } - pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { - encoded_node: &ENCODED_NODE, - nonunion_members: NONUNION_MEMBERS, - members_by_discriminant: MEMBERS_BY_DISCRIMINANT, - members_by_name: MEMBERS_BY_NAME, - }; - pub static NONUNION_MEMBERS : &[u16] = &[0]; - pub static MEMBERS_BY_DISCRIMINANT : &[u16] = &[]; - pub static MEMBERS_BY_NAME : &[u16] = &[0]; - pub const TYPE_ID: u64 = 0xfdf6_9c3a_4be4_a078; - } -} - -pub mod momentary_product_data { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types }).into() } } - impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } - impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - impl <> ::core::marker::Copy for Reader<'_,> {} - impl <> ::core::clone::Clone for Reader<'_,> { - fn clone(&self) -> Self { *self } - } - - impl <> ::capnp::traits::HasTypeId for Reader<'_,> { - const TYPE_ID: u64 = _private::TYPE_ID; - } - impl <'a,> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { - fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } - } - } - - impl <'a,> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { - fn from(reader: Reader<'a,>) -> Self { - Self::Struct(::capnp::dynamic_struct::Reader::new(reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types::<>, annotation_types: _private::get_annotation_types::<>}))) - } - } - - impl <> ::core::fmt::Debug for Reader<'_,> { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::result::Result<(), ::core::fmt::Error> { - core::fmt::Debug::fmt(&::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f) - } - } - - impl <'a,> ::capnp::traits::FromPointerReader<'a> for Reader<'a,> { - fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>) -> ::capnp::Result { - ::core::result::Result::Ok(reader.get_struct(default)?.into()) - } - } - - impl <'a,> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a,> { - fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { - self.reader - } - } - - impl <'a,> ::capnp::traits::Imbue<'a> for Reader<'a,> { - fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { - self.reader.imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) - } - } - - impl <'a,> Reader<'a,> { - pub fn reborrow(&self) -> Reader<'_,> { - Self { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_scale(self) -> f32 { - self.reader.get_data_field::(0) - } - #[inline] - pub fn get_offset(self) -> f32 { - self.reader.get_data_field::(1) - } - #[inline] - pub fn get_start_range(self) -> u16 { - self.reader.get_data_field::(4) - } - #[inline] - pub fn get_sample_interval(self) -> u16 { - self.reader.get_data_field::(5) - } - #[inline] - pub fn get_values(self) -> ::capnp::Result<::capnp::primitive_list::Reader<'a,u8>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn has_values(&self) -> bool { - !self.reader.get_pointer_field(0).is_null() - } - } - - pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a> } - impl <> ::capnp::traits::HasStructSize for Builder<'_,> { - const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 2, pointers: 1 }; - } - impl <> ::capnp::traits::HasTypeId for Builder<'_,> { - const TYPE_ID: u64 = _private::TYPE_ID; - } - impl <'a,> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a,> { - fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { - Self { builder, } - } - } - - impl <'a,> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { - fn from(builder: Builder<'a,>) -> Self { - Self::Struct(::capnp::dynamic_struct::Builder::new(builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types::<>, annotation_types: _private::get_annotation_types::<>}))) - } - } - - impl <'a,> ::capnp::traits::ImbueMut<'a> for Builder<'a,> { - fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { - self.builder.imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) - } - } - - impl <'a,> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a,> { - fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { - builder.init_struct(::STRUCT_SIZE).into() - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>) -> ::capnp::Result { - ::core::result::Result::Ok(builder.get_struct(::STRUCT_SIZE, default)?.into()) - } - } - - impl <> ::capnp::traits::SetterInput> for Reader<'_,> { - fn set_pointer_builder(mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - self.builder.into_reader().into() - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { builder: self.builder.reborrow() } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - self.builder.as_reader().into() - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.as_reader().total_size() - } - #[inline] - pub fn get_scale(self) -> f32 { - self.builder.get_data_field::(0) - } - #[inline] - pub fn set_scale(&mut self, value: f32) { - self.builder.set_data_field::(0, value); - } - #[inline] - pub fn get_offset(self) -> f32 { - self.builder.get_data_field::(1) - } - #[inline] - pub fn set_offset(&mut self, value: f32) { - self.builder.set_data_field::(1, value); - } - #[inline] - pub fn get_start_range(self) -> u16 { - self.builder.get_data_field::(4) - } - #[inline] - pub fn set_start_range(&mut self, value: u16) { - self.builder.set_data_field::(4, value); - } - #[inline] - pub fn get_sample_interval(self) -> u16 { - self.builder.get_data_field::(5) - } - #[inline] - pub fn set_sample_interval(&mut self, value: u16) { - self.builder.set_data_field::(5, value); - } - #[inline] - pub fn get_values(self) -> ::capnp::Result<::capnp::primitive_list::Builder<'a,u8>> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_values(&mut self, value: impl ::capnp::traits::SetterInput<::capnp::primitive_list::Owned>) -> ::capnp::Result<()> { - ::capnp::traits::SetterInput::set_pointer_builder(self.builder.reborrow().get_pointer_field(0), value, false) - } - #[inline] - pub fn init_values(self, size: u32) -> ::capnp::primitive_list::Builder<'a,u8> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), size) - } - #[inline] - pub fn has_values(&self) -> bool { - !self.builder.is_pointer_field_null(0) - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { - Self { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - pub static ENCODED_NODE: [::capnp::Word; 102] = [ - ::capnp::word(0, 0, 0, 0, 6, 0, 6, 0), - ::capnp::word(8, 104, 131, 104, 171, 253, 43, 210), - ::capnp::word(23, 0, 0, 0, 1, 0, 2, 0), - ::capnp::word(138, 240, 108, 5, 28, 207, 29, 249), - ::capnp::word(1, 0, 7, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(75, 3, 0, 0, 241, 3, 0, 0), - ::capnp::word(21, 0, 0, 0, 98, 1, 0, 0), - ::capnp::word(41, 0, 0, 0, 7, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(37, 0, 0, 0, 31, 1, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(100, 105, 103, 105, 116, 97, 108, 82), - ::capnp::word(97, 100, 97, 114, 68, 97, 116, 97), - ::capnp::word(46, 99, 97, 112, 110, 112, 58, 77), - ::capnp::word(111, 109, 101, 110, 116, 97, 114, 121), - ::capnp::word(80, 114, 111, 100, 117, 99, 116, 68), - ::capnp::word(97, 116, 97, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), - ::capnp::word(20, 0, 0, 0, 3, 0, 4, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(125, 0, 0, 0, 50, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(120, 0, 0, 0, 3, 0, 1, 0), - ::capnp::word(132, 0, 0, 0, 2, 0, 1, 0), - ::capnp::word(1, 0, 0, 0, 1, 0, 0, 0), - ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(129, 0, 0, 0, 58, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(124, 0, 0, 0, 3, 0, 1, 0), - ::capnp::word(136, 0, 0, 0, 2, 0, 1, 0), - ::capnp::word(2, 0, 0, 0, 4, 0, 0, 0), - ::capnp::word(0, 0, 1, 0, 2, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(133, 0, 0, 0, 90, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(132, 0, 0, 0, 3, 0, 1, 0), - ::capnp::word(144, 0, 0, 0, 2, 0, 1, 0), - ::capnp::word(3, 0, 0, 0, 5, 0, 0, 0), - ::capnp::word(0, 0, 1, 0, 3, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(141, 0, 0, 0, 122, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(140, 0, 0, 0, 3, 0, 1, 0), - ::capnp::word(152, 0, 0, 0, 2, 0, 1, 0), - ::capnp::word(4, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 1, 0, 4, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(149, 0, 0, 0, 58, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(144, 0, 0, 0, 3, 0, 1, 0), - ::capnp::word(172, 0, 0, 0, 2, 0, 1, 0), - ::capnp::word(115, 99, 97, 108, 101, 0, 0, 0), - ::capnp::word(10, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(10, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(111, 102, 102, 115, 101, 116, 0, 0), - ::capnp::word(10, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(10, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(115, 116, 97, 114, 116, 82, 97, 110), - ::capnp::word(103, 101, 0, 0, 0, 0, 0, 0), - ::capnp::word(7, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(7, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(115, 97, 109, 112, 108, 101, 73, 110), - ::capnp::word(116, 101, 114, 118, 97, 108, 0, 0), - ::capnp::word(7, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(7, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(118, 97, 108, 117, 101, 115, 0, 0), - ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), - ::capnp::word(6, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ]; - pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { - match index { - 0 => ::introspect(), - 1 => ::introspect(), - 2 => ::introspect(), - 3 => ::introspect(), - 4 => <::capnp::primitive_list::Owned as ::capnp::introspect::Introspect>::introspect(), - _ => panic!("invalid field index {}", index), - } - } - pub fn get_annotation_types(child_index: Option, index: u32) -> ::capnp::introspect::Type { - panic!("invalid annotation indices ({:?}, {}) ", child_index, index) - } - pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { - encoded_node: &ENCODED_NODE, - nonunion_members: NONUNION_MEMBERS, - members_by_discriminant: MEMBERS_BY_DISCRIMINANT, - members_by_name: MEMBERS_BY_NAME, - }; - pub static NONUNION_MEMBERS : &[u16] = &[0,1,2,3,4]; - pub static MEMBERS_BY_DISCRIMINANT : &[u16] = &[]; - pub static MEMBERS_BY_NAME : &[u16] = &[1,3,0,2,4]; - pub const TYPE_ID: u64 = 0xd22b_fdab_6883_6808; - } -} diff --git a/crates/interchange/src/lib.rs b/crates/interchange/src/lib.rs index f64c431..2b54324 100644 --- a/crates/interchange/src/lib.rs +++ b/crates/interchange/src/lib.rs @@ -1,9 +1,25 @@ +use prost::Message; +use crate::cif::CifContainer; + #[allow(non_snake_case)] -pub mod schema_capnp; -#[allow(non_snake_case)] -pub mod digitalRadarData_capnp; -#[allow(non_snake_case)] -pub mod tilerStatusReport_capnp; +pub mod cif { + include!(concat!(env!("OUT_DIR"), "/cif.rs")); + pub mod digital_radar_data { + include!(concat!(env!("OUT_DIR"), "/cif.digital_radar_data.rs")); + } +} #[cfg(feature = "ar2")] -pub mod ar2; \ No newline at end of file +pub mod ar2; + +pub trait AsCif { + type Params; + + fn as_cif(&self, params: &Self::Params) -> cif::CifContainer; +} + +pub fn serialize_cif_message(cif: &CifContainer) -> Vec { + let mut buf = Vec::with_capacity(cif.encoded_len()); + cif.encode(&mut buf).unwrap(); + buf +} \ No newline at end of file diff --git a/crates/interchange/src/schema_capnp.rs b/crates/interchange/src/schema_capnp.rs deleted file mode 100644 index 2d202ca..0000000 --- a/crates/interchange/src/schema_capnp.rs +++ /dev/null @@ -1,287 +0,0 @@ -// @generated by the capnpc-rust plugin to the Cap'n Proto schema compiler. -// DO NOT EDIT. -// source: schema.capnp - - -pub mod message { - pub use self::Which::{TilerStatusReport,DigitalRadarData}; - - #[derive(Copy, Clone)] - pub struct Owned(()); - impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types }).into() } } - impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } - impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - impl <> ::core::marker::Copy for Reader<'_,> {} - impl <> ::core::clone::Clone for Reader<'_,> { - fn clone(&self) -> Self { *self } - } - - impl <> ::capnp::traits::HasTypeId for Reader<'_,> { - const TYPE_ID: u64 = _private::TYPE_ID; - } - impl <'a,> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { - fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } - } - } - - impl <'a,> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { - fn from(reader: Reader<'a,>) -> Self { - Self::Struct(::capnp::dynamic_struct::Reader::new(reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types::<>, annotation_types: _private::get_annotation_types::<>}))) - } - } - - impl <> ::core::fmt::Debug for Reader<'_,> { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::result::Result<(), ::core::fmt::Error> { - core::fmt::Debug::fmt(&::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f) - } - } - - impl <'a,> ::capnp::traits::FromPointerReader<'a> for Reader<'a,> { - fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>) -> ::capnp::Result { - ::core::result::Result::Ok(reader.get_struct(default)?.into()) - } - } - - impl <'a,> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a,> { - fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { - self.reader - } - } - - impl <'a,> ::capnp::traits::Imbue<'a> for Reader<'a,> { - fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { - self.reader.imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) - } - } - - impl <'a,> Reader<'a,> { - pub fn reborrow(&self) -> Reader<'_,> { - Self { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn has_tiler_status_report(&self) -> bool { - if self.reader.get_data_field::(0) != 0 { return false; } - !self.reader.get_pointer_field(0).is_null() - } - #[inline] - pub fn has_digital_radar_data(&self) -> bool { - if self.reader.get_data_field::(0) != 1 { return false; } - !self.reader.get_pointer_field(0).is_null() - } - #[inline] - pub fn which(self) -> ::core::result::Result, ::capnp::NotInSchema> { - match self.reader.get_data_field::(0) { - 0 => { - ::core::result::Result::Ok(TilerStatusReport( - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - )) - } - 1 => { - ::core::result::Result::Ok(DigitalRadarData( - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - )) - } - x => ::core::result::Result::Err(::capnp::NotInSchema(x)) - } - } - } - - pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a> } - impl <> ::capnp::traits::HasStructSize for Builder<'_,> { - const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 1, pointers: 1 }; - } - impl <> ::capnp::traits::HasTypeId for Builder<'_,> { - const TYPE_ID: u64 = _private::TYPE_ID; - } - impl <'a,> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a,> { - fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { - Self { builder, } - } - } - - impl <'a,> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { - fn from(builder: Builder<'a,>) -> Self { - Self::Struct(::capnp::dynamic_struct::Builder::new(builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types::<>, annotation_types: _private::get_annotation_types::<>}))) - } - } - - impl <'a,> ::capnp::traits::ImbueMut<'a> for Builder<'a,> { - fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { - self.builder.imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) - } - } - - impl <'a,> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a,> { - fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { - builder.init_struct(::STRUCT_SIZE).into() - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>) -> ::capnp::Result { - ::core::result::Result::Ok(builder.get_struct(::STRUCT_SIZE, default)?.into()) - } - } - - impl <> ::capnp::traits::SetterInput> for Reader<'_,> { - fn set_pointer_builder(mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - self.builder.into_reader().into() - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { builder: self.builder.reborrow() } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - self.builder.as_reader().into() - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.as_reader().total_size() - } - #[inline] - pub fn set_tiler_status_report(&mut self, value: crate::tilerStatusReport_capnp::tiler_status_report::Reader<'_>) -> ::capnp::Result<()> { - self.builder.set_data_field::(0, 0); - ::capnp::traits::SetterInput::set_pointer_builder(self.builder.reborrow().get_pointer_field(0), value, false) - } - #[inline] - pub fn init_tiler_status_report(self, ) -> crate::tilerStatusReport_capnp::tiler_status_report::Builder<'a> { - self.builder.set_data_field::(0, 0); - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) - } - #[inline] - pub fn has_tiler_status_report(&self) -> bool { - if self.builder.get_data_field::(0) != 0 { return false; } - !self.builder.is_pointer_field_null(0) - } - #[inline] - pub fn set_digital_radar_data(&mut self, value: crate::digitalRadarData_capnp::digital_radar_data::Reader<'_>) -> ::capnp::Result<()> { - self.builder.set_data_field::(0, 1); - ::capnp::traits::SetterInput::set_pointer_builder(self.builder.reborrow().get_pointer_field(0), value, false) - } - #[inline] - pub fn init_digital_radar_data(self, ) -> crate::digitalRadarData_capnp::digital_radar_data::Builder<'a> { - self.builder.set_data_field::(0, 1); - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) - } - #[inline] - pub fn has_digital_radar_data(&self) -> bool { - if self.builder.get_data_field::(0) != 1 { return false; } - !self.builder.is_pointer_field_null(0) - } - #[inline] - pub fn which(self) -> ::core::result::Result, ::capnp::NotInSchema> { - match self.builder.get_data_field::(0) { - 0 => { - ::core::result::Result::Ok(TilerStatusReport( - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - )) - } - 1 => { - ::core::result::Result::Ok(DigitalRadarData( - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - )) - } - x => ::core::result::Result::Err(::capnp::NotInSchema(x)) - } - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { - Self { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - pub static ENCODED_NODE: [::capnp::Word; 52] = [ - ::capnp::word(0, 0, 0, 0, 6, 0, 6, 0), - ::capnp::word(207, 232, 53, 60, 199, 56, 142, 192), - ::capnp::word(13, 0, 0, 0, 1, 0, 1, 0), - ::capnp::word(230, 37, 170, 47, 221, 107, 236, 244), - ::capnp::word(1, 0, 7, 0, 0, 0, 2, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(22, 0, 0, 0, 219, 0, 0, 0), - ::capnp::word(21, 0, 0, 0, 170, 0, 0, 0), - ::capnp::word(29, 0, 0, 0, 7, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(25, 0, 0, 0, 119, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(115, 99, 104, 101, 109, 97, 46, 99), - ::capnp::word(97, 112, 110, 112, 58, 77, 101, 115), - ::capnp::word(115, 97, 103, 101, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), - ::capnp::word(8, 0, 0, 0, 3, 0, 4, 0), - ::capnp::word(0, 0, 255, 255, 0, 0, 0, 0), - ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(41, 0, 0, 0, 146, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(44, 0, 0, 0, 3, 0, 1, 0), - ::capnp::word(56, 0, 0, 0, 2, 0, 1, 0), - ::capnp::word(1, 0, 254, 255, 0, 0, 0, 0), - ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(53, 0, 0, 0, 138, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(56, 0, 0, 0, 3, 0, 1, 0), - ::capnp::word(68, 0, 0, 0, 2, 0, 1, 0), - ::capnp::word(116, 105, 108, 101, 114, 83, 116, 97), - ::capnp::word(116, 117, 115, 82, 101, 112, 111, 114), - ::capnp::word(116, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(107, 210, 50, 88, 206, 228, 195, 255), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(100, 105, 103, 105, 116, 97, 108, 82), - ::capnp::word(97, 100, 97, 114, 68, 97, 116, 97), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(124, 221, 74, 204, 88, 181, 51, 199), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ]; - pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { - match index { - 0 => ::introspect(), - 1 => ::introspect(), - _ => panic!("invalid field index {}", index), - } - } - pub fn get_annotation_types(child_index: Option, index: u32) -> ::capnp::introspect::Type { - panic!("invalid annotation indices ({:?}, {}) ", child_index, index) - } - pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { - encoded_node: &ENCODED_NODE, - nonunion_members: NONUNION_MEMBERS, - members_by_discriminant: MEMBERS_BY_DISCRIMINANT, - members_by_name: MEMBERS_BY_NAME, - }; - pub static NONUNION_MEMBERS : &[u16] = &[]; - pub static MEMBERS_BY_DISCRIMINANT : &[u16] = &[0,1]; - pub static MEMBERS_BY_NAME : &[u16] = &[1,0]; - pub const TYPE_ID: u64 = 0xc08e_38c7_3c35_e8cf; - } - pub enum Which { - TilerStatusReport(A0), - DigitalRadarData(A1), - } - pub type WhichReader<'a,> = Which<::capnp::Result>,::capnp::Result>>; - pub type WhichBuilder<'a,> = Which<::capnp::Result>,::capnp::Result>>; -} diff --git a/crates/interchange/src/tilerStatusReport_capnp.rs b/crates/interchange/src/tilerStatusReport_capnp.rs deleted file mode 100644 index f177313..0000000 --- a/crates/interchange/src/tilerStatusReport_capnp.rs +++ /dev/null @@ -1,447 +0,0 @@ -// @generated by the capnpc-rust plugin to the Cap'n Proto schema compiler. -// DO NOT EDIT. -// source: tilerStatusReport.capnp - - -pub mod tiler_status_report { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types }).into() } } - impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } - impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - impl <> ::core::marker::Copy for Reader<'_,> {} - impl <> ::core::clone::Clone for Reader<'_,> { - fn clone(&self) -> Self { *self } - } - - impl <> ::capnp::traits::HasTypeId for Reader<'_,> { - const TYPE_ID: u64 = _private::TYPE_ID; - } - impl <'a,> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { - fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } - } - } - - impl <'a,> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { - fn from(reader: Reader<'a,>) -> Self { - Self::Struct(::capnp::dynamic_struct::Reader::new(reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types::<>, annotation_types: _private::get_annotation_types::<>}))) - } - } - - impl <> ::core::fmt::Debug for Reader<'_,> { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::result::Result<(), ::core::fmt::Error> { - core::fmt::Debug::fmt(&::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f) - } - } - - impl <'a,> ::capnp::traits::FromPointerReader<'a> for Reader<'a,> { - fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>) -> ::capnp::Result { - ::core::result::Result::Ok(reader.get_struct(default)?.into()) - } - } - - impl <'a,> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a,> { - fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { - self.reader - } - } - - impl <'a,> ::capnp::traits::Imbue<'a> for Reader<'a,> { - fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { - self.reader.imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) - } - } - - impl <'a,> Reader<'a,> { - pub fn reborrow(&self) -> Reader<'_,> { - Self { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_cache_info(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn has_cache_info(&self) -> bool { - !self.reader.get_pointer_field(0).is_null() - } - } - - pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a> } - impl <> ::capnp::traits::HasStructSize for Builder<'_,> { - const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 0, pointers: 1 }; - } - impl <> ::capnp::traits::HasTypeId for Builder<'_,> { - const TYPE_ID: u64 = _private::TYPE_ID; - } - impl <'a,> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a,> { - fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { - Self { builder, } - } - } - - impl <'a,> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { - fn from(builder: Builder<'a,>) -> Self { - Self::Struct(::capnp::dynamic_struct::Builder::new(builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types::<>, annotation_types: _private::get_annotation_types::<>}))) - } - } - - impl <'a,> ::capnp::traits::ImbueMut<'a> for Builder<'a,> { - fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { - self.builder.imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) - } - } - - impl <'a,> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a,> { - fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { - builder.init_struct(::STRUCT_SIZE).into() - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>) -> ::capnp::Result { - ::core::result::Result::Ok(builder.get_struct(::STRUCT_SIZE, default)?.into()) - } - } - - impl <> ::capnp::traits::SetterInput> for Reader<'_,> { - fn set_pointer_builder(mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - self.builder.into_reader().into() - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { builder: self.builder.reborrow() } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - self.builder.as_reader().into() - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.as_reader().total_size() - } - #[inline] - pub fn get_cache_info(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_cache_info(&mut self, value: crate::tilerStatusReport_capnp::cache_info::Reader<'_>) -> ::capnp::Result<()> { - ::capnp::traits::SetterInput::set_pointer_builder(self.builder.reborrow().get_pointer_field(0), value, false) - } - #[inline] - pub fn init_cache_info(self, ) -> crate::tilerStatusReport_capnp::cache_info::Builder<'a> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) - } - #[inline] - pub fn has_cache_info(&self) -> bool { - !self.builder.is_pointer_field_null(0) - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { - Self { _typeless: typeless, } - } - } - impl Pipeline { - pub fn get_cache_info(&self) -> crate::tilerStatusReport_capnp::cache_info::Pipeline { - ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) - } - } - mod _private { - pub static ENCODED_NODE: [::capnp::Word; 37] = [ - ::capnp::word(0, 0, 0, 0, 6, 0, 6, 0), - ::capnp::word(107, 210, 50, 88, 206, 228, 195, 255), - ::capnp::word(24, 0, 0, 0, 1, 0, 0, 0), - ::capnp::word(15, 230, 2, 66, 248, 151, 54, 165), - ::capnp::word(1, 0, 7, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(22, 0, 0, 0, 79, 0, 0, 0), - ::capnp::word(21, 0, 0, 0, 82, 1, 0, 0), - ::capnp::word(41, 0, 0, 0, 7, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(37, 0, 0, 0, 63, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(116, 105, 108, 101, 114, 83, 116, 97), - ::capnp::word(116, 117, 115, 82, 101, 112, 111, 114), - ::capnp::word(116, 46, 99, 97, 112, 110, 112, 58), - ::capnp::word(84, 105, 108, 101, 114, 83, 116, 97), - ::capnp::word(116, 117, 115, 82, 101, 112, 111, 114), - ::capnp::word(116, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), - ::capnp::word(4, 0, 0, 0, 3, 0, 4, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(13, 0, 0, 0, 82, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(12, 0, 0, 0, 3, 0, 1, 0), - ::capnp::word(24, 0, 0, 0, 2, 0, 1, 0), - ::capnp::word(99, 97, 99, 104, 101, 73, 110, 102), - ::capnp::word(111, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(134, 113, 226, 152, 133, 252, 175, 149), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ]; - pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { - match index { - 0 => ::introspect(), - _ => panic!("invalid field index {}", index), - } - } - pub fn get_annotation_types(child_index: Option, index: u32) -> ::capnp::introspect::Type { - panic!("invalid annotation indices ({:?}, {}) ", child_index, index) - } - pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { - encoded_node: &ENCODED_NODE, - nonunion_members: NONUNION_MEMBERS, - members_by_discriminant: MEMBERS_BY_DISCRIMINANT, - members_by_name: MEMBERS_BY_NAME, - }; - pub static NONUNION_MEMBERS : &[u16] = &[0]; - pub static MEMBERS_BY_DISCRIMINANT : &[u16] = &[]; - pub static MEMBERS_BY_NAME : &[u16] = &[0]; - pub const TYPE_ID: u64 = 0xffc3_e4ce_5832_d26b; - } -} - -pub mod cache_info { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types }).into() } } - impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } - impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - impl <> ::core::marker::Copy for Reader<'_,> {} - impl <> ::core::clone::Clone for Reader<'_,> { - fn clone(&self) -> Self { *self } - } - - impl <> ::capnp::traits::HasTypeId for Reader<'_,> { - const TYPE_ID: u64 = _private::TYPE_ID; - } - impl <'a,> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { - fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } - } - } - - impl <'a,> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { - fn from(reader: Reader<'a,>) -> Self { - Self::Struct(::capnp::dynamic_struct::Reader::new(reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types::<>, annotation_types: _private::get_annotation_types::<>}))) - } - } - - impl <> ::core::fmt::Debug for Reader<'_,> { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::result::Result<(), ::core::fmt::Error> { - core::fmt::Debug::fmt(&::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f) - } - } - - impl <'a,> ::capnp::traits::FromPointerReader<'a> for Reader<'a,> { - fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>) -> ::capnp::Result { - ::core::result::Result::Ok(reader.get_struct(default)?.into()) - } - } - - impl <'a,> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a,> { - fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { - self.reader - } - } - - impl <'a,> ::capnp::traits::Imbue<'a> for Reader<'a,> { - fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { - self.reader.imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) - } - } - - impl <> Reader<'_,> { - pub fn reborrow(&self) -> Reader<'_,> { - Self { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_grib2_cache_entries(self) -> u64 { - self.reader.get_data_field::(0) - } - #[inline] - pub fn get_nexrad_cache_entries(self) -> u64 { - self.reader.get_data_field::(1) - } - } - - pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a> } - impl <> ::capnp::traits::HasStructSize for Builder<'_,> { - const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 2, pointers: 0 }; - } - impl <> ::capnp::traits::HasTypeId for Builder<'_,> { - const TYPE_ID: u64 = _private::TYPE_ID; - } - impl <'a,> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a,> { - fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { - Self { builder, } - } - } - - impl <'a,> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { - fn from(builder: Builder<'a,>) -> Self { - Self::Struct(::capnp::dynamic_struct::Builder::new(builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types::<>, annotation_types: _private::get_annotation_types::<>}))) - } - } - - impl <'a,> ::capnp::traits::ImbueMut<'a> for Builder<'a,> { - fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { - self.builder.imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) - } - } - - impl <'a,> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a,> { - fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { - builder.init_struct(::STRUCT_SIZE).into() - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>) -> ::capnp::Result { - ::core::result::Result::Ok(builder.get_struct(::STRUCT_SIZE, default)?.into()) - } - } - - impl <> ::capnp::traits::SetterInput> for Reader<'_,> { - fn set_pointer_builder(mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - self.builder.into_reader().into() - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { builder: self.builder.reborrow() } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - self.builder.as_reader().into() - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.as_reader().total_size() - } - #[inline] - pub fn get_grib2_cache_entries(self) -> u64 { - self.builder.get_data_field::(0) - } - #[inline] - pub fn set_grib2_cache_entries(&mut self, value: u64) { - self.builder.set_data_field::(0, value); - } - #[inline] - pub fn get_nexrad_cache_entries(self) -> u64 { - self.builder.get_data_field::(1) - } - #[inline] - pub fn set_nexrad_cache_entries(&mut self, value: u64) { - self.builder.set_data_field::(1, value); - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { - Self { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - pub static ENCODED_NODE: [::capnp::Word; 54] = [ - ::capnp::word(0, 0, 0, 0, 6, 0, 6, 0), - ::capnp::word(134, 113, 226, 152, 133, 252, 175, 149), - ::capnp::word(24, 0, 0, 0, 1, 0, 2, 0), - ::capnp::word(15, 230, 2, 66, 248, 151, 54, 165), - ::capnp::word(0, 0, 7, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(81, 0, 0, 0, 170, 0, 0, 0), - ::capnp::word(21, 0, 0, 0, 18, 1, 0, 0), - ::capnp::word(37, 0, 0, 0, 7, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(33, 0, 0, 0, 119, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(116, 105, 108, 101, 114, 83, 116, 97), - ::capnp::word(116, 117, 115, 82, 101, 112, 111, 114), - ::capnp::word(116, 46, 99, 97, 112, 110, 112, 58), - ::capnp::word(67, 97, 99, 104, 101, 73, 110, 102), - ::capnp::word(111, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), - ::capnp::word(8, 0, 0, 0, 3, 0, 4, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(41, 0, 0, 0, 146, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(44, 0, 0, 0, 3, 0, 1, 0), - ::capnp::word(56, 0, 0, 0, 2, 0, 1, 0), - ::capnp::word(1, 0, 0, 0, 1, 0, 0, 0), - ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(53, 0, 0, 0, 154, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(56, 0, 0, 0, 3, 0, 1, 0), - ::capnp::word(68, 0, 0, 0, 2, 0, 1, 0), - ::capnp::word(103, 114, 105, 98, 50, 67, 97, 99), - ::capnp::word(104, 101, 69, 110, 116, 114, 105, 101), - ::capnp::word(115, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(9, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(9, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(110, 101, 120, 114, 97, 100, 67, 97), - ::capnp::word(99, 104, 101, 69, 110, 116, 114, 105), - ::capnp::word(101, 115, 0, 0, 0, 0, 0, 0), - ::capnp::word(9, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(9, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), - ]; - pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { - match index { - 0 => ::introspect(), - 1 => ::introspect(), - _ => panic!("invalid field index {}", index), - } - } - pub fn get_annotation_types(child_index: Option, index: u32) -> ::capnp::introspect::Type { - panic!("invalid annotation indices ({:?}, {}) ", child_index, index) - } - pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { - encoded_node: &ENCODED_NODE, - nonunion_members: NONUNION_MEMBERS, - members_by_discriminant: MEMBERS_BY_DISCRIMINANT, - members_by_name: MEMBERS_BY_NAME, - }; - pub static NONUNION_MEMBERS : &[u16] = &[0,1]; - pub static MEMBERS_BY_DISCRIMINANT : &[u16] = &[]; - pub static MEMBERS_BY_NAME : &[u16] = &[0,1]; - pub const TYPE_ID: u64 = 0x95af_fc85_98e2_7186; - } -} diff --git a/crates/tiler/config.toml b/crates/tiler/config.toml index 007f702..d662529 100644 --- a/crates/tiler/config.toml +++ b/crates/tiler/config.toml @@ -16,7 +16,6 @@ missing = -99.0 no_coverage = -999.0 [data.nexrad.base_reflectivity_halfdegree] -from = "DS.p94r0" palette = """ Color4: 10 164 164 255 0 100 100 192 255 Color4: 20 64 128 255 255 32 64 128 255 diff --git a/crates/tiler/src/nexrad.rs b/crates/tiler/src/nexrad.rs index 74b130a..5436ed0 100644 --- a/crates/tiler/src/nexrad.rs +++ b/crates/tiler/src/nexrad.rs @@ -3,7 +3,6 @@ use crate::error::AppError; use crate::nexrad_list_response::ListBucketResult; use crate::tiles::{DataId, TileId}; use anyhow::{anyhow, bail}; -use axum::Json; use axum::extract::{Path, State}; use axum::http::header; use axum::response::IntoResponse; @@ -24,7 +23,8 @@ use std::sync::Arc; use tracing::{debug, info_span}; use wxbox_ar2::sites::wsr88d::{SITES, Wsr88dSite}; use wxbox_ar2::{MomentValue, Radial, Scan, Sweep, parse}; -use wxbox_interchange::ar2::serialize_scan_to_cif_message; +use wxbox_interchange::ar2::{Ar2AsCifParams}; +use wxbox_interchange::{serialize_cif_message, AsCif}; use wxbox_pal::ColorPalette; pub type NexradDataCache = Cache>; @@ -34,7 +34,6 @@ pub type NexradDataConfig = HashMap; #[derive(Serialize, Deserialize, Clone)] pub struct NexradDataSource { - pub from: String, pub palette: String, } impl Debug for NexradDataSource { @@ -127,11 +126,18 @@ pub async fn nexrad_data_handler( state.nexrad_data_cache.get(&data_id).await.unwrap() }; + let cif_message = data.as_cif(&Ar2AsCifParams { + requested_elevation: sweep, + requested_product: product.clone(), + }); Ok(( - [(header::CONTENT_TYPE, "application/wxbox-common-interchange-format")], - serialize_scan_to_cif_message(&data, sweep, &product), + [ + (header::CONTENT_TYPE, "application/wxbox-common-interchange-format".to_string()), + (header::CONTENT_DISPOSITION, format!("attachment; filename=\"{}_{}_{}.wxrad\"", site, sweep, product)) + ], + serialize_cif_message(&cif_message), )) }