seeing-things / zwo

ZWO SDK and custom software for debugging and using it.
23 stars 4 forks source link

Implement camera selection logic in 'capture' program #37

Closed jgottula closed 4 years ago

jgottula commented 4 years ago

This isn't really a super-polished thing, to be honest. But it's probably good enough to test at this point to see if it works properly.

Basically: the program now takes potentially multiple arguments, one of which is a camera name. The camera initialization code will iterate over all connected cameras and check whether the given string is a case-insensitive substring of each connected camera's name. If there is exactly one such match, then that camera is selected for use. If there are zero or multiple matches, then the program exits with an error.

If the user doesn't specify a camera argument when running the program, then the camera initialization code will still just arbitrarily pick the first camera index and run with that. (Thinking about it, this should probably actually be an error condition... the user should have to explicitly say they want "any" camera to get this behavior.)

Things to note about this PR as it currently stands:

jgottula commented 4 years ago

Probably too rough to merge as it stands, but likely good enough to test and basically work and be improved upon.

bgottula commented 4 years ago

Yeah I think we ought to at least try ASIGetID before moving ahead with your current approach, but if that API doesn't work this should be fine.

Only other comment is that in this project opening curly braces go on a new line, so please stay consistent with that style.

jgottula commented 4 years ago

Alright I'll adjust my brace style.

bgottula commented 4 years ago

I would like to use this tomorrow and Saturday. @jgottula do you plan to finish the work remaining here? If I don't hear anything by tomorrow evening I will take over so I can make forward progress.

bgottula commented 4 years ago

Since unrecognized program arguments are ignored, tonight when I put the filename as an argument without a file= prefix the program happily ignored it and I lost all the imagery I thought I had gathered. Unrecognized program options should result in an error message and termination.