Skip to content

Commit

Permalink
Merge pull request #250 from helium/mv/customregions
Browse files Browse the repository at this point in the history
Define custom regions
  • Loading branch information
mikev authored Jan 10, 2023
2 parents eeb6a8d + e964419 commit c440c95
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,25 @@ impl std::str::FromStr for Region {
match s.to_ascii_uppercase().as_str() {
"US915" => Ok(Region::Us915),
"EU868" => Ok(Region::Eu868),
"EU868_A" => Ok(Region::Eu868A),
"EU868_B" => Ok(Region::Eu868B),
"EU868_C" => Ok(Region::Eu868C),
"EU868_D" => Ok(Region::Eu868D),
"EU868_E" => Ok(Region::Eu868E),
"EU868_F" => Ok(Region::Eu868F),
"EU433" => Ok(Region::Eu433),
"CN470" => Ok(Region::Cn470),
"CN779" => Ok(Region::Cn779),
"AU915" => Ok(Region::Au915),
"AU915_SB1" => Ok(Region::Au915Sb1),
"AU915_SB2" => Ok(Region::Au915Sb2),
"AS923_1" => Ok(Region::As9231),
"AS923_1A" => Ok(Region::As9231a),
"AS923_1B" => Ok(Region::As9231b),
"AS923_1C" => Ok(Region::As9231c),
"AS923_1D" => Ok(Region::As9231d),
"AS923_1E" => Ok(Region::As9231e),
"AS923_1F" => Ok(Region::As9231f),
"AS923_2" => Ok(Region::As9232),
"AS923_3" => Ok(Region::As9233),
"AS923_4" => Ok(Region::As9234),
Expand All @@ -183,12 +196,25 @@ impl std::fmt::Display for Region {
match self {
Region::Us915 => f.write_str("US915"),
Region::Eu868 => f.write_str("EU868"),
Region::Eu868A => f.write_str("EU868_A"),
Region::Eu868B => f.write_str("EU868_B"),
Region::Eu868C => f.write_str("EU868_C"),
Region::Eu868D => f.write_str("EU868_D"),
Region::Eu868E => f.write_str("EU868_E"),
Region::Eu868F => f.write_str("EU868_F"),
Region::Eu433 => f.write_str("EU433"),
Region::Cn470 => f.write_str("CN470"),
Region::Cn779 => f.write_str("CN779"),
Region::Au915 => f.write_str("AU915"),
Region::Au915Sb1 => f.write_str("AU915_SB1"),
Region::Au915Sb2 => f.write_str("AU915_SB2"),
Region::As9231 => f.write_str("AS923_1"),
Region::As9231a => f.write_str("AS923_1A"),
Region::As9231b => f.write_str("AS923_1B"),
Region::As9231c => f.write_str("AS923_1C"),
Region::As9231d => f.write_str("AS923_1D"),
Region::As9231e => f.write_str("AS923_1E"),
Region::As9231f => f.write_str("AS923_1F"),
Region::As9232 => f.write_str("AS923_2"),
Region::As9233 => f.write_str("AS923_3"),
Region::As9234 => f.write_str("AS923_4"),
Expand Down
13 changes: 13 additions & 0 deletions src/region.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,17 @@ enum region {
AS923_1B = 12;
CD900_1A = 13;
RU864 = 14;
EU868_A = 15;
EU868_B = 16;
EU868_C = 17;
EU868_D = 18;
EU868_E = 19;
EU868_F = 20;
AU915_SB1 = 21;
AU915_SB2 = 22;
AS923_1A = 23;
AS923_1C = 24;
AS923_1D = 25;
AS923_1E = 26;
AS923_1F = 27;
}

0 comments on commit c440c95

Please sign in to comment.