Skip to content
This repository was archived by the owner on Oct 28, 2025. It is now read-only.

Commit 4856546

Browse files
authored
Merge pull request #1 from TeamParadise/official-2025.2.2
Merge changes from 2025.2.2 into main
2 parents 5c55481 + a722e2f commit 4856546

File tree

9 files changed

+405
-314
lines changed

9 files changed

+405
-314
lines changed

.github/workflows/elastic-ci.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -177,20 +177,20 @@ jobs:
177177
path: build/macos/Build/Products/Release/elastic-setup-macos.dmg
178178
if-no-files-found: error
179179

180-
- name: Create windows installer
181-
if: ${{ matrix.build-option == 'windows' }}
182-
uses: Minionguyjpro/Inno-Setup-Action@v1.2.5
183-
with:
184-
path: installer_setup_script.iss
185-
options: /O+
186-
187-
- name: Upload windows installer
188-
if: ${{ matrix.build-option == 'windows' }}
189-
uses: actions/upload-artifact@v4
190-
with:
191-
name: ${{ matrix.artifact-name }}_installer
192-
path: "build/windows/x64/installer"
193-
if-no-files-found: error
180+
# - name: Create windows installer
181+
# if: ${{ matrix.build-option == 'windows' }}
182+
# uses: Minionguyjpro/Inno-Setup-Action@v1.2.5
183+
# with:
184+
# path: installer_setup_script.iss
185+
# options: /O+
186+
187+
# - name: Upload windows installer
188+
# if: ${{ matrix.build-option == 'windows' }}
189+
# uses: actions/upload-artifact@v4
190+
# with:
191+
# name: ${{ matrix.artifact-name }}_installer
192+
# path: "build/windows/x64/installer"
193+
# if-no-files-found: error
194194

195195
build-wpilib:
196196
strategy:

lib/services/nt4_client.dart

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,9 @@ class NT4Topic {
249249
return NT4TypeStr.typeMap[type]!;
250250
}
251251

252+
bool get isRetained =>
253+
properties.containsKey('retained') && properties['retained'];
254+
252255
bool get isPersistent =>
253256
properties.containsKey('persistent') && properties['persistent'];
254257
}
@@ -416,9 +419,10 @@ class NT4Client {
416419

417420
// If there are no other subscriptions that are in the same table/tree
418421
if (!_subscribedTopics.any((element) =>
419-
element.topic.startsWith('${sub.topic}/') ||
420-
sub.topic.startsWith('${element.topic}/') ||
421-
sub.topic == element.topic)) {
422+
element.topic.isNotEmpty &&
423+
(element.topic.startsWith('${sub.topic}/') ||
424+
sub.topic.startsWith('${element.topic}/') ||
425+
sub.topic == element.topic))) {
422426
// If there are any topics associated with the table/tree, unpublish them
423427
for (NT4Topic topic in _clientPublishedTopics.values.where((element) =>
424428
element.name.startsWith('${sub.topic}/') ||
@@ -452,22 +456,34 @@ class NT4Client {
452456
return _clientPublishedTopics.containsValue(topic);
453457
}
454458

455-
NT4Topic publishNewTopic(String name, String type) {
456-
NT4Topic newTopic = NT4Topic(name: name, type: type, properties: {});
459+
NT4Topic publishNewTopic(
460+
String name,
461+
String type, [
462+
Map<String, dynamic> properties = const {},
463+
]) {
464+
NT4Topic newTopic = NT4Topic(
465+
name: name,
466+
type: type,
467+
properties: properties,
468+
);
457469
publishTopic(newTopic);
458470
return newTopic;
459471
}
460472

461473
void publishTopic(NT4Topic topic) {
462474
if (_clientPublishedTopics.containsKey(topic.name)) {
463-
topic.pubUID = _clientPublishedTopics[topic.name]!.pubUID;
475+
NT4Topic existing = _clientPublishedTopics[topic.name]!;
476+
topic.pubUID = existing.pubUID;
477+
existing.properties.addAll(topic.properties);
478+
_wsSetProperties(existing);
464479
return;
465480
}
466481
logger.trace('Publishing topic: $topic');
467482

468483
topic.pubUID = getNewPubUID();
469484
_clientPublishedTopics[topic.name] = topic;
470485
_wsPublish(topic);
486+
_wsSetProperties(topic);
471487
}
472488

473489
void unpublishTopic(NT4Topic topic) {
@@ -544,7 +560,7 @@ class NT4Client {
544560
int rxTime = _getClientTimeUS();
545561

546562
int rtt = rxTime - clientTimestamp;
547-
int serverTimeAtRx = (serverTimestamp - rtt / 2.0).round();
563+
int serverTimeAtRx = serverTimestamp + rtt ~/ 2;
548564
_serverTimeOffsetUS = serverTimeAtRx - rxTime;
549565

550566
_lastPongTime = rxTime;

lib/services/nt_connection.dart

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,12 @@ class NTConnection {
217217
_ntClient.publishTopic(topic);
218218
}
219219

220-
NT4Topic publishNewTopic(String name, String type) {
221-
return _ntClient.publishNewTopic(name, type);
220+
NT4Topic publishNewTopic(
221+
String name,
222+
String type, {
223+
Map<String, dynamic> properties = const {},
224+
}) {
225+
return _ntClient.publishNewTopic(name, type, properties);
222226
}
223227

224228
bool isTopicPublished(NT4Topic? topic) {
@@ -233,16 +237,20 @@ class NTConnection {
233237
_ntClient.unpublishTopic(topic);
234238
}
235239

236-
void updateDataFromSubscription(NT4Subscription subscription, dynamic data) {
237-
_ntClient.addSampleFromName(subscription.topic, data);
240+
void updateDataFromSubscription(
241+
NT4Subscription subscription,
242+
dynamic data, [
243+
int? timestamp,
244+
]) {
245+
_ntClient.addSampleFromName(subscription.topic, data, timestamp);
238246
}
239247

240-
void updateDataFromTopic(NT4Topic topic, dynamic data) {
241-
_ntClient.addSample(topic, data);
248+
void updateDataFromTopic(NT4Topic topic, dynamic data, [int? timestamp]) {
249+
_ntClient.addSample(topic, data, timestamp);
242250
}
243251

244252
@visibleForTesting
245-
void updateDataFromTopicName(String topic, dynamic data) {
246-
_ntClient.addSampleFromName(topic, data);
253+
void updateDataFromTopicName(String topic, dynamic data, [int? timestamp]) {
254+
_ntClient.addSampleFromName(topic, data, timestamp);
247255
}
248256
}

0 commit comments

Comments
 (0)