commit fd9b558d4c2e7b47957d9d549e022cf0240f69e0
parent 2b1d21d3e61665bd1001d5b499f7c55dab7bdc60
Author: Daniel Barlow <dan@telent.net>
Date: Thu, 8 Jan 2026 00:03:45 +0000
table subscriptions can have start/end
Diffstat:
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/ecu-esp32/src/streamer.rs b/ecu-esp32/src/streamer.rs
@@ -14,6 +14,8 @@ use crate::ecu::Ecu;
#[derive(Debug)]
enum SubscriptionKind {
+ // only subscribable value currently is a raw table, but we expect
+ // in future to have interpreted values as well
Table(u8, usize, usize)
}
@@ -46,13 +48,15 @@ impl Subscriber {
fn update_subscriptions(&mut self, message: &[u8]) {
let mut subs = Vec::new();
- for c in message.chunks(4) {
+ for c in message.chunks(6) {
let interval : u64 = (u64::from(c[0]) << 8) + u64::from(c[1]);
let sub_type = c[2];
let table_number = c[3];
+ let (start, end) = (c[4].into(), c[5].into());
if interval > 0 && sub_type == b'T' {
- subs.push(Subscription::new(SubscriptionKind::Table(table_number, 0, 40),
- Duration::from_millis(interval)))
+ subs.push(Subscription::new(
+ SubscriptionKind::Table(table_number, start, end),
+ Duration::from_millis(interval)))
}
}
info!("subs {:?}", subs);
diff --git a/streamclient.rb b/streamclient.rb
@@ -2,12 +2,12 @@ require 'socket'
sock = UDPSocket.new
-def subscribe(table, interval)
- [interval, "T", table].pack("s>AC")
+def subscribe(interval, table, start, finish)
+ [interval, "T", table, start, finish].pack("s>ACCC")
end
sock.connect("eculogical.local", 5000)
-sock.send(subscribe(0x11, 4000), 0)
+sock.send(subscribe(500, 0x11, 0, 25), 0)
finish = Time.now + 60
while Time.now < finish