Skip to content

Commit 0e30c11

Browse files
committed
SOFIE-261 | add estimate state info to LSG topic about t-timers
1 parent f3eaf43 commit 0e30c11

File tree

10 files changed

+267
-97
lines changed

10 files changed

+267
-97
lines changed

packages/live-status-gateway-api/api/components/tTimers/tTimerMode/tTimerMode.yaml

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,26 @@ $defs:
77
type:
88
type: string
99
const: countdown
10-
startTime:
11-
description: Unix timestamp when timer started (milliseconds). May be adjusted when pausing/resuming.
10+
paused:
11+
description: Whether the timer is currently paused
12+
type: boolean
13+
zeroTime:
14+
description: >-
15+
Unix timestamp (ms) when the timer reaches/reached zero.
16+
Present when paused is false. The client calculates remaining time as zeroTime - Date.now().
17+
type: number
18+
remainingMs:
19+
description: >-
20+
Frozen remaining duration in milliseconds.
21+
Present when paused is true.
1222
type: number
13-
pauseTime:
14-
description: Unix timestamp when paused (milliseconds), or null if running
15-
oneOf:
16-
- type: number
17-
- type: 'null'
1823
durationMs:
19-
description: Total countdown duration in milliseconds
24+
description: Total countdown duration in milliseconds (the original configured duration)
2025
type: number
2126
stopAtZero:
2227
description: Whether timer stops at zero or continues into negative values
2328
type: boolean
24-
required: [type, startTime, pauseTime, durationMs, stopAtZero]
29+
required: [type, paused, durationMs, stopAtZero]
2530
additionalProperties: false
2631
examples:
2732
- $ref: './tTimerModeCountdown-example.yaml'
@@ -34,15 +39,20 @@ $defs:
3439
type:
3540
type: string
3641
const: freeRun
37-
startTime:
38-
description: Unix timestamp when timer started (milliseconds). May be adjusted when pausing/resuming.
42+
paused:
43+
description: Whether the timer is currently paused
44+
type: boolean
45+
zeroTime:
46+
description: >-
47+
Unix timestamp (ms) when the timer was at zero (i.e. when it was started).
48+
Present when paused is false. The client calculates elapsed time as Date.now() - zeroTime.
49+
type: number
50+
elapsedMs:
51+
description: >-
52+
Frozen elapsed time in milliseconds.
53+
Present when paused is true.
3954
type: number
40-
pauseTime:
41-
description: Unix timestamp when paused (milliseconds), or null if running
42-
oneOf:
43-
- type: number
44-
- type: 'null'
45-
required: [type, startTime, pauseTime]
55+
required: [type, paused]
4656
additionalProperties: false
4757
examples:
4858
- $ref: './tTimerModeFreeRun-example.yaml'
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
type: countdown
2-
startTime: 1706371800000
3-
pauseTime: null
2+
paused: false
3+
zeroTime: 1706371920000
44
durationMs: 120000
55
stopAtZero: true
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
type: freeRun
2-
startTime: 1706371900000
3-
pauseTime: 1706372000000
2+
paused: false
3+
zeroTime: 1706371800000

packages/live-status-gateway-api/api/components/tTimers/tTimerStatus/tTimerStatus-example.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ label: 'Segment Timer'
33
configured: true
44
mode:
55
type: countdown
6-
startTime: 1706371800000
7-
pauseTime: null
6+
paused: false
7+
zeroTime: 1706371920000
88
durationMs: 120000
99
stopAtZero: true
10+
estimate:
11+
paused: false
12+
zeroTime: 1706371920000
13+
anchorPartId: 'part_break_1'

packages/live-status-gateway-api/api/components/tTimers/tTimerStatus/tTimerStatus.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,34 @@ $defs:
1717
oneOf:
1818
- type: 'null'
1919
- $ref: '../tTimerMode/tTimerMode.yaml#/$defs/tTimerMode'
20+
estimate:
21+
description: >-
22+
Estimated timing for when we expect to reach an anchor part.
23+
Used to calculate over/under diff
24+
oneOf:
25+
- type: 'null'
26+
- type: object
27+
title: TTimerEstimate
28+
description: >-
29+
Estimate timing state for a T-timer
30+
properties:
31+
paused:
32+
description: Whether the estimate is frozen
33+
type: boolean
34+
zeroTime:
35+
description: >-
36+
Unix timestamp in milliseconds of estimated arrival at the anchor part
37+
type: number
38+
durationMs:
39+
description: >-
40+
Frozen remaining duration estimate in milliseconds
41+
type: number
42+
required: [paused]
43+
additionalProperties: false
44+
anchorPartId:
45+
description: >-
46+
The Part ID that this timer is counting towards (the timing anchor)
47+
type: string
2048
required: [index, label, configured]
2149
additionalProperties: false
2250
examples:

packages/live-status-gateway-api/src/generated/asyncapi.yaml

Lines changed: 62 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -746,33 +746,37 @@ channels:
746746
type:
747747
type: string
748748
const: countdown
749-
startTime:
750-
description: Unix timestamp when timer started (milliseconds). May be adjusted
751-
when pausing/resuming.
749+
paused:
750+
description: Whether the timer is currently paused
751+
type: boolean
752+
zeroTime:
753+
description: Unix timestamp (ms) when the timer reaches/reached zero. Present
754+
when paused is false. The client
755+
calculates remaining time as zeroTime -
756+
Date.now().
757+
type: number
758+
remainingMs:
759+
description: Frozen remaining duration in milliseconds. Present when paused is
760+
true.
752761
type: number
753-
pauseTime:
754-
description: Unix timestamp when paused (milliseconds), or null if running
755-
oneOf:
756-
- type: number
757-
- type: "null"
758762
durationMs:
759-
description: Total countdown duration in milliseconds
763+
description: Total countdown duration in milliseconds (the original configured
764+
duration)
760765
type: number
761766
stopAtZero:
762767
description: Whether timer stops at zero or continues into negative values
763768
type: boolean
764769
required:
765770
- type
766-
- startTime
767-
- pauseTime
771+
- paused
768772
- durationMs
769773
- stopAtZero
770774
additionalProperties: false
771775
examples:
772776
- &a29
773777
type: countdown
774-
startTime: 1706371800000
775-
pauseTime: null
778+
paused: false
779+
zeroTime: 1706371920000
776780
durationMs: 120000
777781
stopAtZero: true
778782
- type: object
@@ -782,25 +786,52 @@ channels:
782786
type:
783787
type: string
784788
const: freeRun
785-
startTime:
786-
description: Unix timestamp when timer started (milliseconds). May be adjusted
787-
when pausing/resuming.
789+
paused:
790+
description: Whether the timer is currently paused
791+
type: boolean
792+
zeroTime:
793+
description: Unix timestamp (ms) when the timer was at zero (i.e. when it was
794+
started). Present when paused is false.
795+
The client calculates elapsed time as
796+
Date.now() - zeroTime.
797+
type: number
798+
elapsedMs:
799+
description: Frozen elapsed time in milliseconds. Present when paused is true.
788800
type: number
789-
pauseTime:
790-
description: Unix timestamp when paused (milliseconds), or null if running
791-
oneOf:
792-
- type: number
793-
- type: "null"
794801
required:
795802
- type
796-
- startTime
797-
- pauseTime
803+
- paused
798804
additionalProperties: false
799805
examples:
800806
- &a30
801807
type: freeRun
802-
startTime: 1706371900000
803-
pauseTime: 1706372000000
808+
paused: false
809+
zeroTime: 1706371800000
810+
estimate:
811+
description: Estimated timing for when we expect to reach an anchor part. Used
812+
to calculate over/under diff
813+
oneOf:
814+
- type: "null"
815+
- type: object
816+
title: TTimerEstimate
817+
description: Estimate timing state for a T-timer
818+
properties:
819+
paused:
820+
description: Whether the estimate is frozen
821+
type: boolean
822+
zeroTime:
823+
description: Unix timestamp in milliseconds of estimated arrival at the anchor
824+
part
825+
type: number
826+
durationMs:
827+
description: Frozen remaining duration estimate in milliseconds
828+
type: number
829+
required:
830+
- paused
831+
additionalProperties: false
832+
anchorPartId:
833+
description: The Part ID that this timer is counting towards (the timing anchor)
834+
type: string
804835
required:
805836
- index
806837
- label
@@ -812,10 +843,14 @@ channels:
812843
configured: true
813844
mode:
814845
type: countdown
815-
startTime: 1706371800000
816-
pauseTime: null
846+
paused: false
847+
zeroTime: 1706371920000
817848
durationMs: 120000
818849
stopAtZero: true
850+
estimate:
851+
paused: false
852+
zeroTime: 1706371920000
853+
anchorPartId: part_break_1
819854
minItems: 3
820855
maxItems: 3
821856
required:

packages/live-status-gateway-api/src/generated/schema.ts

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,14 @@ interface TTimerStatus {
478478
* Timer mode and timing state. Null if not configured.
479479
*/
480480
mode?: TTimerModeCountdown | TTimerModeFreeRun | null
481+
/**
482+
* Estimated timing for when we expect to reach an anchor part. Used to calculate over/under diff
483+
*/
484+
estimate?: TTimerEstimate | null
485+
/**
486+
* The Part ID that this timer is counting towards (the timing anchor)
487+
*/
488+
anchorPartId?: string
481489
}
482490

483491
/**
@@ -495,15 +503,19 @@ enum TTimerIndex {
495503
interface TTimerModeCountdown {
496504
type: 'countdown'
497505
/**
498-
* Unix timestamp when timer started (milliseconds). May be adjusted when pausing/resuming.
506+
* Whether the timer is currently paused
499507
*/
500-
startTime: number
508+
paused: boolean
501509
/**
502-
* Unix timestamp when paused (milliseconds), or null if running
510+
* Unix timestamp (ms) when the timer reaches/reached zero. Present when paused is false. The client calculates remaining time as zeroTime - Date.now().
503511
*/
504-
pauseTime: number | null
512+
zeroTime?: number
505513
/**
506-
* Total countdown duration in milliseconds
514+
* Frozen remaining duration in milliseconds. Present when paused is true.
515+
*/
516+
remainingMs?: number
517+
/**
518+
* Total countdown duration in milliseconds (the original configured duration)
507519
*/
508520
durationMs: number
509521
/**
@@ -518,13 +530,35 @@ interface TTimerModeCountdown {
518530
interface TTimerModeFreeRun {
519531
type: 'freeRun'
520532
/**
521-
* Unix timestamp when timer started (milliseconds). May be adjusted when pausing/resuming.
533+
* Whether the timer is currently paused
522534
*/
523-
startTime: number
535+
paused: boolean
536+
/**
537+
* Unix timestamp (ms) when the timer was at zero (i.e. when it was started). Present when paused is false. The client calculates elapsed time as Date.now() - zeroTime.
538+
*/
539+
zeroTime?: number
540+
/**
541+
* Frozen elapsed time in milliseconds. Present when paused is true.
542+
*/
543+
elapsedMs?: number
544+
}
545+
546+
/**
547+
* Estimate timing state for a T-timer
548+
*/
549+
interface TTimerEstimate {
550+
/**
551+
* Whether the estimate is frozen
552+
*/
553+
paused: boolean
554+
/**
555+
* Unix timestamp in milliseconds of estimated arrival at the anchor part
556+
*/
557+
zeroTime?: number
524558
/**
525-
* Unix timestamp when paused (milliseconds), or null if running
559+
* Frozen remaining duration estimate in milliseconds
526560
*/
527-
pauseTime: number | null
561+
durationMs?: number
528562
}
529563

530564
interface ActivePiecesEvent {
@@ -1001,6 +1035,7 @@ export {
10011035
TTimerIndex,
10021036
TTimerModeCountdown,
10031037
TTimerModeFreeRun,
1038+
TTimerEstimate,
10041039
ActivePiecesEvent,
10051040
SegmentsEvent,
10061041
Segment,

0 commit comments

Comments
 (0)