reverse_beacon 1.0.3 reverse_beacon: ^1.0.3 copied to clipboard
transforms the reverse beacon telnet CW and DIGI servers into a controllable stream
example/reverse_beacon_example.dart
import 'dart:io';
import 'package:reverse_beacon/reverse_beacon.dart';
import 'package:reverse_beacon/src/cw_spot.dart';
void main() async {
var rb = ReverseBeacon();
try {
await rb.connect(callsign: 'n1bri');
} on TelnetCommunicationException catch (_) {
print('Telnet Communication Exception');
exit(-1);
} on InvalidCallsignException catch (_) {
print('Invalid callsign');
exit(-1);
} catch (ex) {
print('unknown issue');
exit(-1);
}
int spotCount = 0;
rb.listen((spot) {
//filter
if (spotCount < 5) {
if (spot.band == Band.meters20 && spot.mode == Mode.cw) {
if ((spot as CWSpot).wpm >= 15) {
print(spot);
spotCount++;
}
}
} else if (spotCount >= 5) {
if (spot.band == Band.meters20 && spot.mode == Mode.ft8) {
print(spot);
spotCount++;
}
}
if (spotCount == 10) {
rb.close();
}
});
}