This commit is contained in:
Daniel Ponte 2024-08-20 09:11:21 -04:00
parent e4072458db
commit d613a45a26
7 changed files with 108 additions and 65 deletions

View file

@ -645,6 +645,7 @@ class Command extends $pb.GeneratedMessage {
class TalkgroupInfo extends $pb.GeneratedMessage { class TalkgroupInfo extends $pb.GeneratedMessage {
factory TalkgroupInfo({ factory TalkgroupInfo({
Talkgroup? tg, Talkgroup? tg,
$core.String? systemName,
$core.String? name, $core.String? name,
$core.String? group, $core.String? group,
$core.int? frequency, $core.int? frequency,
@ -656,6 +657,9 @@ class TalkgroupInfo extends $pb.GeneratedMessage {
if (tg != null) { if (tg != null) {
$result.tg = tg; $result.tg = tg;
} }
if (systemName != null) {
$result.systemName = systemName;
}
if (name != null) { if (name != null) {
$result.name = name; $result.name = name;
} }
@ -682,12 +686,13 @@ class TalkgroupInfo extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'TalkgroupInfo', package: const $pb.PackageName(_omitMessageNames ? '' : 'stillbox'), createEmptyInstance: create) static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'TalkgroupInfo', package: const $pb.PackageName(_omitMessageNames ? '' : 'stillbox'), createEmptyInstance: create)
..aOM<Talkgroup>(1, _omitFieldNames ? '' : 'tg', subBuilder: Talkgroup.create) ..aOM<Talkgroup>(1, _omitFieldNames ? '' : 'tg', subBuilder: Talkgroup.create)
..aOS(2, _omitFieldNames ? '' : 'name') ..aOS(2, _omitFieldNames ? '' : 'systemName')
..aOS(3, _omitFieldNames ? '' : 'group') ..aOS(3, _omitFieldNames ? '' : 'name')
..a<$core.int>(4, _omitFieldNames ? '' : 'frequency', $pb.PbFieldType.O3) ..aOS(4, _omitFieldNames ? '' : 'group')
..pPS(5, _omitFieldNames ? '' : 'tags') ..a<$core.int>(5, _omitFieldNames ? '' : 'frequency', $pb.PbFieldType.O3)
..aOM<$1.Struct>(6, _omitFieldNames ? '' : 'metadata', subBuilder: $1.Struct.create) ..pPS(6, _omitFieldNames ? '' : 'tags')
..aOB(7, _omitFieldNames ? '' : 'learned') ..aOM<$1.Struct>(7, _omitFieldNames ? '' : 'metadata', subBuilder: $1.Struct.create)
..aOB(8, _omitFieldNames ? '' : 'learned')
..hasRequiredFields = false ..hasRequiredFields = false
; ;
@ -724,54 +729,63 @@ class TalkgroupInfo extends $pb.GeneratedMessage {
Talkgroup ensureTg() => $_ensure(0); Talkgroup ensureTg() => $_ensure(0);
@$pb.TagNumber(2) @$pb.TagNumber(2)
$core.String get name => $_getSZ(1); $core.String get systemName => $_getSZ(1);
@$pb.TagNumber(2) @$pb.TagNumber(2)
set name($core.String v) { $_setString(1, v); } set systemName($core.String v) { $_setString(1, v); }
@$pb.TagNumber(2) @$pb.TagNumber(2)
$core.bool hasName() => $_has(1); $core.bool hasSystemName() => $_has(1);
@$pb.TagNumber(2) @$pb.TagNumber(2)
void clearName() => clearField(2); void clearSystemName() => clearField(2);
@$pb.TagNumber(3) @$pb.TagNumber(3)
$core.String get group => $_getSZ(2); $core.String get name => $_getSZ(2);
@$pb.TagNumber(3) @$pb.TagNumber(3)
set group($core.String v) { $_setString(2, v); } set name($core.String v) { $_setString(2, v); }
@$pb.TagNumber(3) @$pb.TagNumber(3)
$core.bool hasGroup() => $_has(2); $core.bool hasName() => $_has(2);
@$pb.TagNumber(3) @$pb.TagNumber(3)
void clearGroup() => clearField(3); void clearName() => clearField(3);
@$pb.TagNumber(4) @$pb.TagNumber(4)
$core.int get frequency => $_getIZ(3); $core.String get group => $_getSZ(3);
@$pb.TagNumber(4) @$pb.TagNumber(4)
set frequency($core.int v) { $_setSignedInt32(3, v); } set group($core.String v) { $_setString(3, v); }
@$pb.TagNumber(4) @$pb.TagNumber(4)
$core.bool hasFrequency() => $_has(3); $core.bool hasGroup() => $_has(3);
@$pb.TagNumber(4) @$pb.TagNumber(4)
void clearFrequency() => clearField(4); void clearGroup() => clearField(4);
@$pb.TagNumber(5) @$pb.TagNumber(5)
$core.List<$core.String> get tags => $_getList(4); $core.int get frequency => $_getIZ(4);
@$pb.TagNumber(5)
set frequency($core.int v) { $_setSignedInt32(4, v); }
@$pb.TagNumber(5)
$core.bool hasFrequency() => $_has(4);
@$pb.TagNumber(5)
void clearFrequency() => clearField(5);
@$pb.TagNumber(6) @$pb.TagNumber(6)
$1.Struct get metadata => $_getN(5); $core.List<$core.String> get tags => $_getList(5);
@$pb.TagNumber(6)
set metadata($1.Struct v) { setField(6, v); }
@$pb.TagNumber(6)
$core.bool hasMetadata() => $_has(5);
@$pb.TagNumber(6)
void clearMetadata() => clearField(6);
@$pb.TagNumber(6)
$1.Struct ensureMetadata() => $_ensure(5);
@$pb.TagNumber(7) @$pb.TagNumber(7)
$core.bool get learned => $_getBF(6); $1.Struct get metadata => $_getN(6);
@$pb.TagNumber(7) @$pb.TagNumber(7)
set learned($core.bool v) { $_setBool(6, v); } set metadata($1.Struct v) { setField(7, v); }
@$pb.TagNumber(7) @$pb.TagNumber(7)
$core.bool hasLearned() => $_has(6); $core.bool hasMetadata() => $_has(6);
@$pb.TagNumber(7) @$pb.TagNumber(7)
void clearLearned() => clearField(7); void clearMetadata() => clearField(7);
@$pb.TagNumber(7)
$1.Struct ensureMetadata() => $_ensure(6);
@$pb.TagNumber(8)
$core.bool get learned => $_getBF(7);
@$pb.TagNumber(8)
set learned($core.bool v) { $_setBool(7, v); }
@$pb.TagNumber(8)
$core.bool hasLearned() => $_has(7);
@$pb.TagNumber(8)
void clearLearned() => clearField(8);
} }
class Live extends $pb.GeneratedMessage { class Live extends $pb.GeneratedMessage {

View file

@ -150,12 +150,13 @@ const TalkgroupInfo$json = {
'1': 'TalkgroupInfo', '1': 'TalkgroupInfo',
'2': [ '2': [
{'1': 'tg', '3': 1, '4': 1, '5': 11, '6': '.stillbox.Talkgroup', '10': 'tg'}, {'1': 'tg', '3': 1, '4': 1, '5': 11, '6': '.stillbox.Talkgroup', '10': 'tg'},
{'1': 'name', '3': 2, '4': 1, '5': 9, '9': 0, '10': 'name', '17': true}, {'1': 'system_name', '3': 2, '4': 1, '5': 9, '10': 'systemName'},
{'1': 'group', '3': 3, '4': 1, '5': 9, '9': 1, '10': 'group', '17': true}, {'1': 'name', '3': 3, '4': 1, '5': 9, '9': 0, '10': 'name', '17': true},
{'1': 'frequency', '3': 4, '4': 1, '5': 5, '9': 2, '10': 'frequency', '17': true}, {'1': 'group', '3': 4, '4': 1, '5': 9, '9': 1, '10': 'group', '17': true},
{'1': 'tags', '3': 5, '4': 3, '5': 9, '10': 'tags'}, {'1': 'frequency', '3': 5, '4': 1, '5': 5, '9': 2, '10': 'frequency', '17': true},
{'1': 'metadata', '3': 6, '4': 1, '5': 11, '6': '.google.protobuf.Struct', '9': 3, '10': 'metadata', '17': true}, {'1': 'tags', '3': 6, '4': 3, '5': 9, '10': 'tags'},
{'1': 'learned', '3': 7, '4': 1, '5': 8, '10': 'learned'}, {'1': 'metadata', '3': 7, '4': 1, '5': 11, '6': '.google.protobuf.Struct', '9': 3, '10': 'metadata', '17': true},
{'1': 'learned', '3': 8, '4': 1, '5': 8, '10': 'learned'},
], ],
'8': [ '8': [
{'1': '_name'}, {'1': '_name'},
@ -167,12 +168,12 @@ const TalkgroupInfo$json = {
/// Descriptor for `TalkgroupInfo`. Decode as a `google.protobuf.DescriptorProto`. /// Descriptor for `TalkgroupInfo`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List talkgroupInfoDescriptor = $convert.base64Decode( final $typed_data.Uint8List talkgroupInfoDescriptor = $convert.base64Decode(
'Cg1UYWxrZ3JvdXBJbmZvEiMKAnRnGAEgASgLMhMuc3RpbGxib3guVGFsa2dyb3VwUgJ0ZxIXCg' 'Cg1UYWxrZ3JvdXBJbmZvEiMKAnRnGAEgASgLMhMuc3RpbGxib3guVGFsa2dyb3VwUgJ0ZxIfCg'
'RuYW1lGAIgASgJSABSBG5hbWWIAQESGQoFZ3JvdXAYAyABKAlIAVIFZ3JvdXCIAQESIQoJZnJl' 'tzeXN0ZW1fbmFtZRgCIAEoCVIKc3lzdGVtTmFtZRIXCgRuYW1lGAMgASgJSABSBG5hbWWIAQES'
'cXVlbmN5GAQgASgFSAJSCWZyZXF1ZW5jeYgBARISCgR0YWdzGAUgAygJUgR0YWdzEjgKCG1ldG' 'GQoFZ3JvdXAYBCABKAlIAVIFZ3JvdXCIAQESIQoJZnJlcXVlbmN5GAUgASgFSAJSCWZyZXF1ZW'
'FkYXRhGAYgASgLMhcuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdEgDUghtZXRhZGF0YYgBARIYCgds' '5jeYgBARISCgR0YWdzGAYgAygJUgR0YWdzEjgKCG1ldGFkYXRhGAcgASgLMhcuZ29vZ2xlLnBy'
'ZWFybmVkGAcgASgIUgdsZWFybmVkQgcKBV9uYW1lQggKBl9ncm91cEIMCgpfZnJlcXVlbmN5Qg' 'b3RvYnVmLlN0cnVjdEgDUghtZXRhZGF0YYgBARIYCgdsZWFybmVkGAggASgIUgdsZWFybmVkQg'
'sKCV9tZXRhZGF0YQ=='); 'cKBV9uYW1lQggKBl9ncm91cEIMCgpfZnJlcXVlbmN5QgsKCV9tZXRhZGF0YQ==');
@$core.Deprecated('Use liveDescriptor instead') @$core.Deprecated('Use liveDescriptor instead')
const Live$json = { const Live$json = {

View file

@ -1,4 +1,4 @@
import 'package:provider/provider.dart'; import 'package:intl/intl.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../controller/stillbox.dart'; import '../controller/stillbox.dart';
import '../pb/stillbox.pb.dart'; import '../pb/stillbox.pb.dart';
@ -7,7 +7,9 @@ class LCD extends StatelessWidget {
final Color _lcdColor; final Color _lcdColor;
final SBCall? _call; final SBCall? _call;
final int queueLen; final int queueLen;
const LCD(this._call, this._lcdColor, this.queueLen, {super.key}); final DateFormat timeFormat;
const LCD(this._call, this._lcdColor, this.queueLen, this.timeFormat,
{super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -40,18 +42,32 @@ class LCD extends StatelessWidget {
} }
Widget lcdContents() { Widget lcdContents() {
return Row( String callTime = '';
mainAxisAlignment: MainAxisAlignment.spaceBetween, if (_call != null) {
children: <Widget>[ callTime = timeFormat.format(_call.call.dateTime.toDateTime());
FutureBuilder( }
return FutureBuilder(
future: _call?.tg, future: _call?.tg,
builder: builder: (BuildContext context, AsyncSnapshot<TalkgroupInfo> tgi) {
(BuildContext context, AsyncSnapshot<TalkgroupInfo> tgi) { return Column(mainAxisAlignment: MainAxisAlignment.start, children: [
return Text( Row(
'${tgi.data?.name ?? (_call?.call.talkgroup ?? '')}${tgi.data?.learned ?? false ? ' 📓' : ''}'); mainAxisAlignment: MainAxisAlignment.spaceBetween,
}), crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(callTime),
Text('${tgi.data?.systemName ?? (_call?.call.system ?? '')}'),
Text('Q: $queueLen'), Text('Q: $queueLen'),
]),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'${tgi.data?.name ?? (_call?.call.talkgroup ?? '')}${tgi.data?.learned ?? false ? ' 📓' : ''}'),
Text(_call != null ? 'TG: ${_call.call.talkgroup}' : ''),
])
]); ]);
});
} }
} }

View file

@ -1,5 +1,6 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:just_audio/just_audio.dart'; import 'package:just_audio/just_audio.dart';
import '../../views/lcd.dart'; import '../../views/lcd.dart';
@ -28,6 +29,7 @@ class _MainRadioState extends State<MainRadio> {
SBCall? _call; SBCall? _call;
Completer _completer = Completer(); Completer _completer = Completer();
int queueLen = 0; int queueLen = 0;
DateFormat timeFormat = DateFormat('HH:mm');
@override @override
void initState() { void initState() {
@ -104,7 +106,7 @@ class _MainRadioState extends State<MainRadio> {
const ScannerLabel('Stillbox'), const ScannerLabel('Stillbox'),
LED(_ledColor), LED(_ledColor),
]), ]),
LCD(_call, _lcdColor, queueLen), LCD(_call, _lcdColor, queueLen, timeFormat),
const Keypad(), const Keypad(),
], ],
)), )),

View file

@ -55,12 +55,13 @@ message Command {
message TalkgroupInfo { message TalkgroupInfo {
Talkgroup tg = 1; Talkgroup tg = 1;
optional string name = 2; string system_name = 2;
optional string group = 3; optional string name = 3;
optional int32 frequency = 4; optional string group = 4;
repeated string tags = 5; optional int32 frequency = 5;
optional google.protobuf.Struct metadata = 6; repeated string tags = 6;
bool learned = 7; optional google.protobuf.Struct metadata = 7;
bool learned = 8;
} }
enum LiveState { enum LiveState {

View file

@ -200,6 +200,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "4.2.0" version: "4.2.0"
intl:
dependency: "direct main"
description:
name: intl
sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf
url: "https://pub.dev"
source: hosted
version: "0.19.0"
js: js:
dependency: transitive dependency: transitive
description: description:

View file

@ -49,6 +49,7 @@ dependencies:
media_kit_libs_linux: ^1.1.3 media_kit_libs_linux: ^1.1.3
media_kit_native_event_loop: ^1.0.8 media_kit_native_event_loop: ^1.0.8
media_kit_libs_windows_audio: ^1.0.9 media_kit_libs_windows_audio: ^1.0.9
intl: ^0.19.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: