feat: use uv and protobuf
This commit is contained in:
86
components/app_proto/proto/hr_packet.proto
Normal file
86
components/app_proto/proto/hr_packet.proto
Normal file
@ -0,0 +1,86 @@
|
||||
// See `Generator Options` section in
|
||||
// https://jpa.kapsi.fi/nanopb/docs/reference.html#generator-options
|
||||
// for nanopb specific options
|
||||
//
|
||||
// Remember to include
|
||||
// https://github.com/nanopb/nanopb/blob/master/generator/proto/nanopb.proto
|
||||
// when generating the proto file
|
||||
|
||||
syntax = "proto3";
|
||||
import "nanopb.proto";
|
||||
|
||||
package hr_packet;
|
||||
|
||||
enum HrConfidence {
|
||||
// [0,25)
|
||||
ZERO = 0;
|
||||
// [25,50)
|
||||
LOW = 1;
|
||||
// [50,75]
|
||||
MEDIUM = 2;
|
||||
// (75,100]
|
||||
HIGH = 3;
|
||||
}
|
||||
|
||||
enum LoRaBW {
|
||||
BW_NONE = 0;
|
||||
// nobody is using 7.8 kHz bandwidth
|
||||
// so to satisfy protobuf, we use NONE for zero value
|
||||
BW_10_4 = 0x08;
|
||||
BW_15_6 = 0x01;
|
||||
BW_20_8 = 0x09;
|
||||
BW_31_25 = 0x02;
|
||||
BW_41_7 = 0x0A;
|
||||
BW_62_5 = 0x03;
|
||||
BW_125_0 = 0x04;
|
||||
BW_250_0 = 0x05;
|
||||
BW_500_0 = 0x06;
|
||||
}
|
||||
|
||||
message LoRaParameters {
|
||||
LoRaBW bw = 1;
|
||||
int32 sf = 2 [(nanopb).int_size = IS_8];
|
||||
float frequency = 3;
|
||||
}
|
||||
|
||||
message StatusFlag {
|
||||
HrConfidence hr_confidence = 1 [(nanopb).int_size = IS_8];
|
||||
bool is_active = 2;
|
||||
bool is_on_skin = 3;
|
||||
uint32 battery = 4 [(nanopb).int_size = IS_8];
|
||||
}
|
||||
|
||||
message HrOnlyPacket {
|
||||
StatusFlag status = 1 [(nanopb).int_size = IS_8];
|
||||
uint32 id = 2 [(nanopb).int_size = IS_8];
|
||||
uint32 packet_num = 3 [(nanopb).int_size = IS_8];
|
||||
uint32 hr = 4 [(nanopb).int_size = IS_8];
|
||||
}
|
||||
|
||||
message HrPpgPacket {
|
||||
StatusFlag status = 1 [(nanopb).int_size = IS_8];
|
||||
uint32 id = 2 [(nanopb).int_size = IS_8];
|
||||
uint32 packet_num = 3 [(nanopb).int_size = IS_8];
|
||||
uint32 hr = 4 [(nanopb).int_size = IS_8];
|
||||
repeated uint32 ppg_data = 5 [(nanopb).max_count = 36];
|
||||
}
|
||||
|
||||
message PacketStatus {
|
||||
// Estimation of RSSI of the LoRa® signal (after despreading) on last packet received.
|
||||
sint32 signal_rssi_pkt = 1;
|
||||
}
|
||||
|
||||
message GatewayInfo {
|
||||
uint32 region_id = 1 [(nanopb).int_size = IS_8];
|
||||
bytes gateway_mac = 2 [(nanopb).max_size = 6];
|
||||
LoRaParameters radio_parameters = 3;
|
||||
}
|
||||
|
||||
message HrPacket {
|
||||
GatewayInfo gateway_info = 1;
|
||||
oneof packet {
|
||||
HrOnlyPacket hr_only_packet = 2;
|
||||
HrPpgPacket hr_ppg_packet = 3;
|
||||
}
|
||||
PacketStatus packet_status = 4;
|
||||
}
|
||||
Reference in New Issue
Block a user