Skip to content

Commit

Permalink
fix it
Browse files Browse the repository at this point in the history
  • Loading branch information
lthiery committed Jun 13, 2023
1 parent 3621adc commit 34b7be5
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 111 deletions.
1 change: 1 addition & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const MESSAGES: &[&str] = &[
"src/reward_manifest.proto",
"src/blockchain_region_param_v1.proto",
"src/price_report.proto",
"src/mapper.proto",
];

macro_rules! config {
Expand Down
3 changes: 1 addition & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub use prost::{DecodeError, EncodeError, Message};
pub mod services {
use crate::{
BlockchainRegionParamsV1, BlockchainTokenTypeV1, BlockchainTxn, DataRate, EntropyReportV1,
GatewayStakingMode, MapperAttach, Region, RoutingAddress,
GatewayStakingMode, MapperAttach, MapperMsg, Region, RoutingAddress,
};

pub mod iot_config {
Expand Down Expand Up @@ -41,7 +41,6 @@ pub mod services {

pub mod mapper {
include!(concat!(env!("OUT_DIR"), "/helium.mapper.rs"));
pub use multi_buy_server::{MultiBuy, MultiBuyServer as Server};
}

pub mod multi_buy {
Expand Down
110 changes: 110 additions & 0 deletions src/mapper.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
syntax = "proto3";
package helium;

message mapper_msg {
payload payload = 1;
// the pubkey signs over the message above
// which does not contain the pubkey itself
bytes signature = 2;
bytes pub_key = 3;

// below is optional metadata which depending
// on the message above, may or may not be populated.
// it is included here because it cannot be signed

// hotspots that received the mapper message if it
// was received over lorawan
repeated bytes hotspots = 4;
}

message payload {
oneof message {
mapper_gps gps = 1;
mapper_scan scan = 2;
mapper_attach attach = 3;
}
}

message mapper_attach {
oneof version { mapper_attach_v1 attach_v1 = 1; }
}

message mapper_attach_v1 {
enum mapper_attach_result {
none = 0;
connect = 1;
limited_service = 2;
no_connection = 3;
search = 4;
no_network_service = 5;
}
message mapper_attach_candidate {
enum cell_tech {
lte = 0;
nr = 1;
}
cell_tech type = 1;
// Corresponds "scan_response_counter" in the scan_response_counter which we
// selected attach candidates from
uint32 from_scan_response = 2;
// delay in seconds between locking to the cell and evaluating connectivity
uint32 delay = 3;
uint32 plmn = 4;
uint32 fcn = 5;
// 28-bit (UMTS, LTE) or 36-bit (5G NR)
uint64 cid = 6;
// RSRQ in units of 0.1 dB
int32 rsrp = 7;
// RSRP in units of 0.1 dBm
int32 rsrq = 8;
}
// This allows us to detect censorship efforts. It can roll over.
uint32 attach_counter = 1;
mapper_gps_v1 gps = 2;
mapper_attach_candidate candidate = 3;
mapper_attach_result result = 4;
}

message mapper_gps {
oneof version { mapper_gps_v1 gps_v1 = 1; }
}

message mapper_gps_v1 {
// Unix time in seconds
uint32 unix_time = 1;
// Latitude of the current base station in units of 0.25 sec.
int32 lat = 2;
// Longitude of the current base station in units of 0.25 sec.
int32 lon = 3;
// Horizontal dilution of position in units of 0.01 HDOP.
uint32 hdop = 4;
// Altitude in units of 0.25m above the WGS 84 reference ellipsoid.
int64 altitude = 5;
int32 num_sats = 6;
// Speed in speed in 0.25m/s per second.
uint32 speed = 7;
}

message mapper_scan {
oneof version { mapper_scan_v1 scan_v1 = 1; }
}

message mapper_scan_v1 {
uint32 scan_counter = 1;
mapper_gps_v1 gps = 2;
repeated mapper_scan_result results = 3;
}

message mapper_scan_result {
// 28-bit (UMTS, LTE) or 36-bit (5G NR)
uint64 cid = 1;
// PLMN = (MCC << 16) | MNC
uint32 plmn = 2;
// EARFCN or UARFCN
uint32 fcn = 3;
uint32 pci = 4;
// RSRQ in units of 0.1 dB
int32 rsrp = 5;
// RSRP in units of 0.1 dBm
int32 rsrq = 6;
}
112 changes: 3 additions & 109 deletions src/service/mapper.proto
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
syntax = "proto3";
package helium;
package helium.mapper;

import "mapper.proto";

service scan_upload {
rpc upload(mapper_msg) returns (scan_upload_reply) {}
Expand All @@ -15,111 +17,3 @@ enum scan_upload_status {
invalid_signature = 4;
internal_error = 5;
}

message mapper_msg {
payload payload = 1;
// the pubkey signs over the message above
// which does not contain the pubkey itself
bytes signature = 2;
bytes pub_key = 3;

// below is optional metadata which depending
// on the message above, may or may not be populated.
// it is included here because it cannot be signed

// hotspots that received the mapper message if it
// was received over lorawan
repeated bytes hotspots = 4;
}

message payload {
oneof message {
mapper_gps gps = 1;
mapper_scan scan = 2;
mapper_attach attach = 3;
}
}

message mapper_attach {
oneof version { mapper_attach_v1 attach_v1 = 1; }
}

message mapper_attach_v1 {
enum mapper_attach_result {
none = 0;
connect = 1;
limited_service = 2;
no_connection = 3;
search = 4;
no_network_service = 5;
}
message mapper_attach_candidate {
enum cell_tech {
lte = 0;
nr = 1;
}
cell_tech type = 1;
// Corresponds "scan_response_counter" in the scan_response_counter which we
// selected attach candidates from
uint32 from_scan_response = 2;
// delay in seconds between locking to the cell and evaluating connectivity
uint32 delay = 3;
uint32 plmn = 4;
uint32 fcn = 5;
// 28-bit (UMTS, LTE) or 36-bit (5G NR)
uint64 cid = 6;
// RSRQ in units of 0.1 dB
int32 rsrp = 7;
// RSRP in units of 0.1 dBm
int32 rsrq = 8;
}
// This allows us to detect censorship efforts. It can roll over.
uint32 attach_counter = 1;
mapper_gps_v1 gps = 2;
mapper_attach_candidate candidate = 3;
mapper_attach_result result = 4;
}

message mapper_gps {
oneof version { mapper_gps_v1 gps_v1 = 1; }
}

message mapper_gps_v1 {
// Unix time in seconds
uint32 unix_time = 1;
// Latitude of the current base station in units of 0.25 sec.
int32 lat = 2;
// Longitude of the current base station in units of 0.25 sec.
int32 lon = 3;
// Horizontal dilution of position in units of 0.01 HDOP.
uint32 hdop = 4;
// Altitude in units of 0.25m above the WGS 84 reference ellipsoid.
int64 altitude = 5;
int32 num_sats = 6;
// Speed in speed in 0.25m/s per second.
uint32 speed = 7;
}

message mapper_scan {
oneof version { mapper_scan_v1 scan_v1 = 1; }
}

message mapper_scan_v1 {
uint32 scan_counter = 1;
mapper_gps_v1 gps = 2;
repeated mapper_scan_result results = 3;
}

message mapper_scan_result {
// 28-bit (UMTS, LTE) or 36-bit (5G NR)
uint64 cid = 1;
// PLMN = (MCC << 16) | MNC
uint32 plmn = 2;
// EARFCN or UARFCN
uint32 fcn = 3;
uint32 pci = 4;
// RSRQ in units of 0.1 dB
int32 rsrp = 5;
// RSRP in units of 0.1 dBm
int32 rsrq = 6;
}

0 comments on commit 34b7be5

Please sign in to comment.