File tree Expand file tree Collapse file tree
shared/packages/tsr-bridge/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -151,6 +151,37 @@ export class TSR {
151151
152152 const device = await devicePr
153153
154+ if ( newDeviceOptions . type === DeviceType . CASPARCG ) {
155+ const originalPrepare = device . device . prepareForHandleState ?. bind ( device . device )
156+ if ( originalPrepare ) {
157+ device . device . prepareForHandleState = async ( newStateTime : number , ...args : any [ ] ) => {
158+ const now = this . getCurrentTime ( )
159+ this . log . info ( 'TSR resync prepare' , {
160+ deviceId,
161+ newStateTime,
162+ now,
163+ diff : newStateTime - now ,
164+ } )
165+ return originalPrepare ( newStateTime , ...args )
166+ }
167+ }
168+
169+ const originalHandle = device . device . handleState ?. bind ( device . device )
170+ if ( originalHandle ) {
171+ device . device . handleState = async ( newState : any , newMappings : any ) => {
172+ const now = this . getCurrentTime ( )
173+ const stateTime = newState ?. time
174+ this . log . info ( 'TSR resync handleState' , {
175+ deviceId,
176+ stateTime,
177+ now,
178+ diff : typeof stateTime === 'number' ? stateTime - now : null ,
179+ } )
180+ return originalHandle ( newState , newMappings )
181+ }
182+ }
183+ }
184+
154185 await device . device . on ( 'connectionChanged' , ( ...args ) => {
155186 // TODO: figure out why the arguments to this event callback lost the correct typings
156187 const status = args [ 0 ] as DeviceStatus
You can’t perform that action at this time.
0 commit comments