qdot/libfitbit — Issue #21: run_opcode "default" return?
Author: marcushall42
Created: 2012-02-04 20:57:57+00:00
State: open

in python/fitbit.py, FitBit::run_opcode, it looks like there is something missing..

First, it sends the opcode to the tracker, then looks at the reply data[1]. There are three cases for 0x42, 0x61, and 0x41. If it isn't any of those, then we just fall out of the routine and don't return anything? Is that correct behavior?

For the 0x61 case, we optionally send a payload, then look for a reply (does this work even if we don't send a payload??) Once we get a payload, we check data[1] for 0x41 (should we validate data[0] like above??) and return if it matches, but if it doesn't, then we just fall into the outer switch (which will check against 0x41 again, guaranteed to fail..), and then fall out of the routine.

I don't know enough about what's happening with the protocol to make sense of what should be done here, but it looks a bit incomplete. Maybe it's just missing error handling?