You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
940 B
33 lines
940 B
import 'dart:typed_data';
|
|
|
|
import 'package:meshcore_open/helpers/region_key.dart';
|
|
|
|
/// A flood region as discovered from a repeater.
|
|
///
|
|
/// [name] is the `#`-stripped region name the firmware reports over the air.
|
|
/// Value equality is by name so a discovery service can dedupe replies.
|
|
class Region {
|
|
final String name;
|
|
|
|
const Region(this.name);
|
|
|
|
/// A wildcard region (matches a family of names) rather than a single one.
|
|
bool get isWildcard => name.contains('*');
|
|
|
|
/// A private region whose key is not derivable from its name.
|
|
bool get isPrivate => isPrivateRegionName(name);
|
|
|
|
/// The 16-byte transport key for this region, or null when it is private
|
|
/// or blank.
|
|
Uint8List? get transportKey => transportKeyForName(name);
|
|
|
|
@override
|
|
bool operator ==(Object other) => other is Region && other.name == name;
|
|
|
|
@override
|
|
int get hashCode => name.hashCode;
|
|
|
|
@override
|
|
String toString() => 'Region($name)';
|
|
}
|