mirror of
https://github.com/chirpstack/chirpstack.git
synced 2025-06-18 15:28:12 +00:00
api: Rename Mesh to MeshEvent.
This is needed as we are also adding commands, thus we need MeshEvent and MeshCommand messages.
This commit is contained in:
41
api/proto/gw/gw.proto
vendored
41
api/proto/gw/gw.proto
vendored
@ -114,7 +114,7 @@ message Event {
|
||||
GatewayStats gateway_stats = 2;
|
||||
|
||||
// Gateway Mesh Event.
|
||||
Mesh mesh = 3;
|
||||
MeshEvent mesh = 3;
|
||||
}
|
||||
}
|
||||
|
||||
@ -132,10 +132,13 @@ message Command {
|
||||
|
||||
// Get location.
|
||||
GetLocationRequest get_location = 4;
|
||||
|
||||
// Gateway Mesh Command.
|
||||
MeshCommand mesh = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message Mesh {
|
||||
message MeshEvent {
|
||||
// Gateway ID (of the Border Gateway).
|
||||
string gateway_id = 1;
|
||||
|
||||
@ -146,10 +149,10 @@ message Mesh {
|
||||
google.protobuf.Timestamp time = 3;
|
||||
|
||||
// Mesh events.
|
||||
repeated MeshEvent events = 4;
|
||||
repeated MeshEventItem events = 4;
|
||||
}
|
||||
|
||||
message MeshEvent {
|
||||
message MeshEventItem {
|
||||
oneof event {
|
||||
// Proprietary Mesh event.
|
||||
MeshEventProprietary proprietary = 1;
|
||||
@ -159,6 +162,27 @@ message MeshEvent {
|
||||
}
|
||||
}
|
||||
|
||||
message MeshCommand {
|
||||
// Gateway ID (of the Border Gateway).
|
||||
string gateway_id = 1;
|
||||
|
||||
// Relay ID.
|
||||
string relay_id = 2;
|
||||
|
||||
// Timestamp (second precision).
|
||||
google.protobuf.Timestamp time = 3;
|
||||
|
||||
// Mesh events.
|
||||
repeated MeshCommandItem commands = 4;
|
||||
}
|
||||
|
||||
message MeshCommandItem {
|
||||
oneof command {
|
||||
// Proprietary Mesh command.
|
||||
MeshCommandProprietary proprietary = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message Modulation {
|
||||
oneof parameters {
|
||||
// LoRa modulation information.
|
||||
@ -848,3 +872,12 @@ message MeshEventProprietary {
|
||||
// Payload.
|
||||
bytes payload = 2;
|
||||
}
|
||||
|
||||
// Proprietary mesh command.
|
||||
message MeshCommandProprietary {
|
||||
// Command type.
|
||||
uint32 command_type = 1;
|
||||
|
||||
// Payload.
|
||||
bytes payload = 2;
|
||||
}
|
||||
|
41
api/rust/proto/chirpstack/gw/gw.proto
vendored
41
api/rust/proto/chirpstack/gw/gw.proto
vendored
@ -114,7 +114,7 @@ message Event {
|
||||
GatewayStats gateway_stats = 2;
|
||||
|
||||
// Gateway Mesh Event.
|
||||
Mesh mesh = 3;
|
||||
MeshEvent mesh = 3;
|
||||
}
|
||||
}
|
||||
|
||||
@ -132,10 +132,13 @@ message Command {
|
||||
|
||||
// Get location.
|
||||
GetLocationRequest get_location = 4;
|
||||
|
||||
// Gateway Mesh Command.
|
||||
MeshCommand mesh = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message Mesh {
|
||||
message MeshEvent {
|
||||
// Gateway ID (of the Border Gateway).
|
||||
string gateway_id = 1;
|
||||
|
||||
@ -146,10 +149,10 @@ message Mesh {
|
||||
google.protobuf.Timestamp time = 3;
|
||||
|
||||
// Mesh events.
|
||||
repeated MeshEvent events = 4;
|
||||
repeated MeshEventItem events = 4;
|
||||
}
|
||||
|
||||
message MeshEvent {
|
||||
message MeshEventItem {
|
||||
oneof event {
|
||||
// Proprietary Mesh event.
|
||||
MeshEventProprietary proprietary = 1;
|
||||
@ -159,6 +162,27 @@ message MeshEvent {
|
||||
}
|
||||
}
|
||||
|
||||
message MeshCommand {
|
||||
// Gateway ID (of the Border Gateway).
|
||||
string gateway_id = 1;
|
||||
|
||||
// Relay ID.
|
||||
string relay_id = 2;
|
||||
|
||||
// Timestamp (second precision).
|
||||
google.protobuf.Timestamp time = 3;
|
||||
|
||||
// Mesh events.
|
||||
repeated MeshCommandItem commands = 4;
|
||||
}
|
||||
|
||||
message MeshCommandItem {
|
||||
oneof command {
|
||||
// Proprietary Mesh command.
|
||||
MeshCommandProprietary proprietary = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message Modulation {
|
||||
oneof parameters {
|
||||
// LoRa modulation information.
|
||||
@ -848,3 +872,12 @@ message MeshEventProprietary {
|
||||
// Payload.
|
||||
bytes payload = 2;
|
||||
}
|
||||
|
||||
// Proprietary mesh command.
|
||||
message MeshCommandProprietary {
|
||||
// Command type.
|
||||
uint32 command_type = 1;
|
||||
|
||||
// Payload.
|
||||
bytes payload = 2;
|
||||
}
|
||||
|
@ -417,7 +417,7 @@ async fn message_callback(
|
||||
.inc();
|
||||
let event = match json {
|
||||
true => serde_json::from_slice(&p.payload)?,
|
||||
false => chirpstack_api::gw::Mesh::decode(p.payload.as_ref())?,
|
||||
false => chirpstack_api::gw::MeshEvent::decode(p.payload.as_ref())?,
|
||||
};
|
||||
|
||||
tokio::spawn(uplink::mesh::Mesh::handle(event));
|
||||
|
@ -18,11 +18,11 @@ pub struct Mesh {
|
||||
gateway_id: EUI64,
|
||||
relay_id: RelayId,
|
||||
time: DateTime<Utc>,
|
||||
mesh_event: gw::Mesh,
|
||||
mesh_event: gw::MeshEvent,
|
||||
}
|
||||
|
||||
impl Mesh {
|
||||
pub async fn handle(s: gw::Mesh) {
|
||||
pub async fn handle(s: gw::MeshEvent) {
|
||||
let gateway_id = match EUI64::from_str(&s.gateway_id) {
|
||||
Ok(v) => v,
|
||||
Err(e) => {
|
||||
@ -59,7 +59,7 @@ impl Mesh {
|
||||
}
|
||||
}
|
||||
|
||||
async fn _handle(gateway_id: EUI64, relay_id: RelayId, s: gw::Mesh) -> Result<()> {
|
||||
async fn _handle(gateway_id: EUI64, relay_id: RelayId, s: gw::MeshEvent) -> Result<()> {
|
||||
let ctx = Mesh {
|
||||
gateway_id,
|
||||
relay_id,
|
||||
@ -81,8 +81,8 @@ impl Mesh {
|
||||
|
||||
for event in &self.mesh_event.events {
|
||||
match &event.event {
|
||||
Some(gw::mesh_event::Event::Proprietary(_)) | None => continue,
|
||||
Some(gw::mesh_event::Event::Heartbeat(v)) => self._handle_heartbeat(v).await?,
|
||||
Some(gw::mesh_event_item::Event::Proprietary(_)) | None => continue,
|
||||
Some(gw::mesh_event_item::Event::Heartbeat(v)) => self._handle_heartbeat(v).await?,
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user