Skip to content

Commit

Permalink
Merge pull request #297 from ianshade/feat/quicktsr-logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian authored Oct 9, 2023
2 parents 4e57e19 + f693569 commit 5c8fb5f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/quick-tsr/src/tsrHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,21 @@ export class TSRHandler {
this._devices[deviceId] = device

await device.device.on('connectionChanged', ((status: DeviceStatus) => {
console.log(`Device ${device.deviceId} status changed: ${status}`)
console.log(`Device ${device.deviceId} status changed: ${JSON.stringify(status)}`)
}) as () => void)
await device.device.on('slowSentCommand', ((_info: SlowSentCommandInfo) => {
// console.log(`Device ${device.deviceId} slow sent command: ${_info}`)
}) as () => void)
await device.device.on('slowFulfilledCommand', ((_info: SlowFulfilledCommandInfo) => {
// console.log(`Device ${device.deviceId} slow fulfilled 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 5c8fb5f

Please sign in to comment.