Skip to content

Commit

Permalink
feat(quick-tsr): add command report and debug logging
Browse files Browse the repository at this point in the history
it can be enabled with `reportAllCommands: true` and `debug: true` respectively
  • Loading branch information
ianshade committed Oct 5, 2023
1 parent 634acb1 commit f693569
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/quick-tsr/src/tsrHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ export class TSRHandler {
await device.device.on('slowCommand', ((_info: SlowSentCommandInfo) => {
// console.log(`Device ${device.deviceId} slow command: ${_info}`)
}) as () => void)
await device.device.on('commandReport', ((command: any) => {
console.log(`Device ${device.deviceId} command: ${JSON.stringify(command)}`)
}) as () => void)
await device.device.on('debug', (...args: any[]) => {
const data = args.map((arg) => (typeof arg === 'object' ? JSON.stringify(arg) : arg))
console.log(`Device ${device.deviceId} debug: ${data}`)
})
// also ask for the status now, and update:
// onConnectionChanged(await device.device.getStatus())
} catch (e) {
Expand Down

0 comments on commit f693569

Please sign in to comment.