On 2017-08-23 06:43, Dirk Hohndel wrote:
On Aug 22, 2017, at 7:55 AM, Jef Driesen <j...@libdivecomputer.org> wrote: I don't understand what you gain with those comments. I mean it's just comments. Don't you need this kind of info at runtime instead?

Yup - I simply have a tool that parses the source to give me the
information that I want.

Well, that's a pretty ugly and error-prone hack. You hard-code everything in the application, based on whatever version that was used at build time (which may not even be the same as at runtime). But the reason why that table exists, is to let applications populate the list of supported devices dynamically at runtime! And by doing it this way, you also depend on some of the libdivecomputer internals.

If we're adding this kind of annotations, then I prefer to make this information available through the api. That will be a lot more useful, and may also benefit other applications.

Something like what I proposed for the I/O refactoring:

For the I/O refactoring, I'm already planning to add an extra field with the transport type. Since some devices support multiple transports, the transport type will need to change into a bitfield. So something like this:

{"Shearwater", "Petrel 2",  DC_FAMILY_SHEARWATER_PETREL, 4,
DC_TRANSPORT_SERIAL | DC_TRANSPORT_BLUETOOTH | DC_TRANSPORT_BLE},

Which doesn't tell me if this is an FTDI chip - which is one of the
things that I need to know.

That's quite easy: Suunto (solution, eon, vyper and d9), Oceanic (vtpro, veo250 and atom2), HW (frog, ostc and ostc3) and Cressi (leonardo) backends use an FTDI chip. You don't need to annotate each device for that. Just check the family type.

Note that the usb-serial chipset is often not integrated in the dive computer, but in the external PC interface. So there is not always a nice one-to-one relationship. For example the official Suunto PC interface uses an FTDI chip, but there are also third-party interfaces available using a Silicon Labs chip (and those are quite common). And some really old models still have a real serial port, and thus the user can use any usb-serial dongle.

Jef
_______________________________________________
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to