-- requires https://github.com/Snaipe/wssdl/releases/download/v0.2.0/wssdl.lua local wssdl = require 'wssdl' ant_msg = wssdl.packet { sync:u8():hex(), length:u8(), class:u8():hex(), payload:payload({ class, 'antplus.class' }, length * 8), checksum:u8():hex() } ant_broadcast_event = wssdl.packet { channel:u8(), payload:bytes(8), extendedFlag:u8():hex(), deviceNumber:u16():le(), deviceType:u8():hex(), transmissionType:u8():hex(), --rssiMeasurementType:u8():hex(), --rssi:u8(), --rssiThreshold:u8(), --rxTimestamp:u16():le(), } ant_power_msg = wssdl.packet { page:u8(), eventCount:u8(), unknown:u8(), instantaneousCadence:u8(), accumulatedPower:u16(), instantaneousPower:u16(), } wssdl.dissect { usb.bulk:add { [0xFFFF] = ant_msg:proto('antplus', 'ANT+ Protocol') }, antplus.class:add { [0x4E] = ant_broadcast_event:proto('antplus_broadcast_event', 'ANT+ Broadcast Event') }, --antplus_broadcast_event.deviceType:add { -- [0x0B] = ant_power_msg:proto('antplus_power_meter', 'ANT+ Power Meter') --}, }