api: Refactor meta/meta.proto to streams/meta.proto.

This commit is contained in:
Orne Brocaar
2023-10-31 10:19:38 +00:00
parent 09e1ae0263
commit ec0ecf2044
28 changed files with 255 additions and 338 deletions

14
api/rust/build.rs vendored
View File

@ -13,7 +13,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
std::fs::create_dir_all(out_dir.join("gw")).unwrap();
std::fs::create_dir_all(out_dir.join("internal")).unwrap();
std::fs::create_dir_all(out_dir.join("integration")).unwrap();
std::fs::create_dir_all(out_dir.join("meta")).unwrap();
std::fs::create_dir_all(out_dir.join("streams")).unwrap();
std::fs::create_dir_all(out_dir.join("api")).unwrap();
#[cfg(feature = "json")]
@ -136,25 +136,25 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.build(&[".integration"])?;
}
// meta
// streams
tonic_build::configure()
.out_dir(out_dir.join("meta"))
.file_descriptor_set_path(out_dir.join("meta").join("proto_descriptor.bin"))
.out_dir(out_dir.join("streams"))
.file_descriptor_set_path(out_dir.join("streams").join("proto_descriptor.bin"))
.compile_well_known_types(true)
.extern_path(".common", "crate::common")
.extern_path(".gw", "crate::gw")
.compile(
&[cs_dir.join("meta").join("meta.proto").to_str().unwrap()],
&[cs_dir.join("streams").join("meta.proto").to_str().unwrap()],
&[proto_dir.join("chirpstack").to_str().unwrap()],
)?;
#[cfg(feature = "json")]
{
let descriptor_set = std::fs::read(out_dir.join("meta").join("proto_descriptor.bin"))?;
let descriptor_set = std::fs::read(out_dir.join("streams").join("proto_descriptor.bin"))?;
pbjson_build::Builder::new()
.register_descriptors(&descriptor_set)?
.ignore_unknown_fields()
.out_dir(out_dir.join("meta"))
.out_dir(out_dir.join("streams"))
.extern_path(".common", "crate::common")
.extern_path(".gw", "crate::gw")
.build(&[".meta"])?;

View File

@ -1,62 +0,0 @@
syntax = "proto3";
package meta;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4/meta";
option java_package = "io.chirpstack.api.meta";
option java_multiple_files = true;
option java_outer_classname = "MetaProto";
option csharp_namespace = "Chirpstack.Meta";
import "common/common.proto";
import "gw/gw.proto";
message UplinkMeta {
// Device EUI (EUI64).
string dev_eui = 1;
// TX meta-data.
gw.UplinkTxInfo tx_info = 2;
// RX meta-data.
repeated gw.UplinkRxInfo rx_info = 3;
// PHYPayload byte count.
uint32 phy_payload_byte_count = 4;
// MAC-Command byte count.
uint32 mac_command_byte_count = 5;
// Application payload byte count.
uint32 application_payload_byte_count = 6;
// Message type.
common.MType message_type = 7;
}
message DownlinkMeta {
// Device EUI (EUI64).
string dev_eui = 1;
// Multicast Group ID (UUID).
string multicast_group_id = 2;
// TX meta-data.
gw.DownlinkTxInfo tx_info = 3;
// PHYPayload byte count.
uint32 phy_payload_byte_count = 4;
// MAC-Command byte count.
uint32 mac_command_byte_count = 5;
// Application payload byte count.
uint32 application_payload_byte_count = 6;
// Message type.
common.MType message_type = 7;
// Gateway ID (EUI64).
string gateway_id = 8;
}

View File

@ -0,0 +1,61 @@
syntax = "proto3";
package meta;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4/streams";
option java_package = "io.chirpstack.api.streams";
option java_multiple_files = true;
option java_outer_classname = "StreamsProto";
option csharp_namespace = "Chirpstack.Streams";
import "common/common.proto";
import "gw/gw.proto";
message UplinkMeta {
// Device EUI (EUI64).
string dev_eui = 1;
// TX meta-data.
gw.UplinkTxInfo tx_info = 2;
// RX meta-data.
repeated gw.UplinkRxInfo rx_info = 3;
// PHYPayload byte count.
uint32 phy_payload_byte_count = 4;
// MAC-Command byte count.
uint32 mac_command_byte_count = 5;
// Application payload byte count.
uint32 application_payload_byte_count = 6;
// Message type.
common.MType message_type = 7;
}
message DownlinkMeta {
// Device EUI (EUI64).
string dev_eui = 1;
// Multicast Group ID (UUID).
string multicast_group_id = 2;
// TX meta-data.
gw.DownlinkTxInfo tx_info = 3;
// PHYPayload byte count.
uint32 phy_payload_byte_count = 4;
// MAC-Command byte count.
uint32 mac_command_byte_count = 5;
// Application payload byte count.
uint32 application_payload_byte_count = 6;
// Message type.
common.MType message_type = 7;
// Gateway ID (EUI64).
string gateway_id = 8;
}

2
api/rust/src/lib.rs vendored
View File

@ -6,4 +6,4 @@ pub mod gw;
pub mod integration;
#[cfg(feature = "internal")]
pub mod internal;
pub mod meta;
pub mod streams;

View File

@ -1,3 +0,0 @@
include!(concat!(env!("OUT_DIR"), "/meta/meta.rs"));
#[cfg(feature = "json")]
include!(concat!(env!("OUT_DIR"), "/meta/meta.serde.rs"));

3
api/rust/src/streams.rs vendored Normal file
View File

@ -0,0 +1,3 @@
include!(concat!(env!("OUT_DIR"), "/streams/meta.rs"));
#[cfg(feature = "json")]
include!(concat!(env!("OUT_DIR"), "/streams/meta.serde.rs"));