Skip to content

Commit 9d92b26

Browse files
anteeekrjmunro
authored andcommitted
SOFIE-261 | add projected state info to LSG topic about t-timers
1 parent 95fd1b7 commit 9d92b26

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+
projected:
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+
projected:
21+
description: >-
22+
Projected 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: TTimerProjected
28+
description: >-
29+
Projected timing state for a T-timer
30+
properties:
31+
paused:
32+
description: Whether the projected time is frozen
33+
type: boolean
34+
zeroTime:
35+
description: >-
36+
Unix timestamp in milliseconds of projected arrival at the anchor part
37+
type: number
38+
durationMs:
39+
description: >-
40+
Frozen remaining duration projection 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
@@ -776,33 +776,37 @@ channels:
776776
type:
777777
type: string
778778
const: countdown
779-
startTime:
780-
description: Unix timestamp when timer started (milliseconds). May be adjusted
781-
when pausing/resuming.
779+
paused:
780+
description: Whether the timer is currently paused
781+
type: boolean
782+
zeroTime:
783+
description: Unix timestamp (ms) when the timer reaches/reached zero. Present
784+
when paused is false. The client
785+
calculates remaining time as zeroTime -
786+
Date.now().
787+
type: number
788+
remainingMs:
789+
description: Frozen remaining duration in milliseconds. Present when paused is
790+
true.
782791
type: number
783-
pauseTime:
784-
description: Unix timestamp when paused (milliseconds), or null if running
785-
oneOf:
786-
- type: number
787-
- type: "null"
788792
durationMs:
789-
description: Total countdown duration in milliseconds
793+
description: Total countdown duration in milliseconds (the original configured
794+
duration)
790795
type: number
791796
stopAtZero:
792797
description: Whether timer stops at zero or continues into negative values
793798
type: boolean
794799
required:
795800
- type
796-
- startTime
797-
- pauseTime
801+
- paused
798802
- durationMs
799803
- stopAtZero
800804
additionalProperties: false
801805
examples:
802806
- &a29
803807
type: countdown
804-
startTime: 1706371800000
805-
pauseTime: null
808+
paused: false
809+
zeroTime: 1706371920000
806810
durationMs: 120000
807811
stopAtZero: true
808812
- type: object
@@ -812,25 +816,52 @@ channels:
812816
type:
813817
type: string
814818
const: freeRun
815-
startTime:
816-
description: Unix timestamp when timer started (milliseconds). May be adjusted
817-
when pausing/resuming.
819+
paused:
820+
description: Whether the timer is currently paused
821+
type: boolean
822+
zeroTime:
823+
description: Unix timestamp (ms) when the timer was at zero (i.e. when it was
824+
started). Present when paused is false.
825+
The client calculates elapsed time as
826+
Date.now() - zeroTime.
827+
type: number
828+
elapsedMs:
829+
description: Frozen elapsed time in milliseconds. Present when paused is true.
818830
type: number
819-
pauseTime:
820-
description: Unix timestamp when paused (milliseconds), or null if running
821-
oneOf:
822-
- type: number
823-
- type: "null"
824831
required:
825832
- type
826-
- startTime
827-
- pauseTime
833+
- paused
828834
additionalProperties: false
829835
examples:
830836
- &a30
831837
type: freeRun
832-
startTime: 1706371900000
833-
pauseTime: 1706372000000
838+
paused: false
839+
zeroTime: 1706371800000
840+
projected:
841+
description: Projected timing for when we expect to reach an anchor part. Used
842+
to calculate over/under diff
843+
oneOf:
844+
- type: "null"
845+
- type: object
846+
title: TTimerProjected
847+
description: Projected timing state for a T-timer
848+
properties:
849+
paused:
850+
description: Whether the projected time is frozen
851+
type: boolean
852+
zeroTime:
853+
description: Unix timestamp in milliseconds of projected arrival at the anchor
854+
part
855+
type: number
856+
durationMs:
857+
description: Frozen remaining duration projection in milliseconds
858+
type: number
859+
required:
860+
- paused
861+
additionalProperties: false
862+
anchorPartId:
863+
description: The Part ID that this timer is counting towards (the timing anchor)
864+
type: string
834865
required:
835866
- index
836867
- label
@@ -842,10 +873,14 @@ channels:
842873
configured: true
843874
mode:
844875
type: countdown
845-
startTime: 1706371800000
846-
pauseTime: null
876+
paused: false
877+
zeroTime: 1706371920000
847878
durationMs: 120000
848879
stopAtZero: true
880+
projected:
881+
paused: false
882+
zeroTime: 1706371920000
883+
anchorPartId: part_break_1
849884
minItems: 3
850885
maxItems: 3
851886
required:

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

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,14 @@ interface TTimerStatus {
501501
* Timer mode and timing state. Null if not configured.
502502
*/
503503
mode?: TTimerModeCountdown | TTimerModeFreeRun | null
504+
/**
505+
* Projected timing for when we expect to reach an anchor part. Used to calculate over/under diff
506+
*/
507+
projected?: TTimerProjected | null
508+
/**
509+
* The Part ID that this timer is counting towards (the timing anchor)
510+
*/
511+
anchorPartId?: string
504512
}
505513

506514
/**
@@ -518,15 +526,19 @@ enum TTimerIndex {
518526
interface TTimerModeCountdown {
519527
type: 'countdown'
520528
/**
521-
* Unix timestamp when timer started (milliseconds). May be adjusted when pausing/resuming.
529+
* Whether the timer is currently paused
522530
*/
523-
startTime: number
531+
paused: boolean
524532
/**
525-
* Unix timestamp when paused (milliseconds), or null if running
533+
* Unix timestamp (ms) when the timer reaches/reached zero. Present when paused is false. The client calculates remaining time as zeroTime - Date.now().
526534
*/
527-
pauseTime: number | null
535+
zeroTime?: number
528536
/**
529-
* Total countdown duration in milliseconds
537+
* Frozen remaining duration in milliseconds. Present when paused is true.
538+
*/
539+
remainingMs?: number
540+
/**
541+
* Total countdown duration in milliseconds (the original configured duration)
530542
*/
531543
durationMs: number
532544
/**
@@ -541,13 +553,35 @@ interface TTimerModeCountdown {
541553
interface TTimerModeFreeRun {
542554
type: 'freeRun'
543555
/**
544-
* Unix timestamp when timer started (milliseconds). May be adjusted when pausing/resuming.
556+
* Whether the timer is currently paused
545557
*/
546-
startTime: number
558+
paused: boolean
559+
/**
560+
* 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.
561+
*/
562+
zeroTime?: number
563+
/**
564+
* Frozen elapsed time in milliseconds. Present when paused is true.
565+
*/
566+
elapsedMs?: number
567+
}
568+
569+
/**
570+
* Projected timing state for a T-timer
571+
*/
572+
interface TTimerProjected {
573+
/**
574+
* Whether the projected time is frozen
575+
*/
576+
paused: boolean
577+
/**
578+
* Unix timestamp in milliseconds of projected arrival at the anchor part
579+
*/
580+
zeroTime?: number
547581
/**
548-
* Unix timestamp when paused (milliseconds), or null if running
582+
* Frozen remaining duration projection in milliseconds
549583
*/
550-
pauseTime: number | null
584+
durationMs?: number
551585
}
552586

553587
interface ActivePiecesEvent {
@@ -1025,6 +1059,7 @@ export {
10251059
TTimerIndex,
10261060
TTimerModeCountdown,
10271061
TTimerModeFreeRun,
1062+
TTimerProjected,
10281063
ActivePiecesEvent,
10291064
SegmentsEvent,
10301065
Segment,

0 commit comments

Comments
 (0)