This feature is not yet tested on the Append:: functions since not all
functions are yet implemented. As soon as they get implemented, this
feature will be verified on them as well.
Furthermore, a Clear function is added.
Finally, in this commit, mouse_left, mouse_right, mouse_middle, and mouse_double got
abbreviated to left, right, middle, and double.
This is the beginning of a solution to issue #3. Right now, it is only
able to preserve keys. In a later commit, modifiers, mouse settings,
etc. will be added as well.
Every function is now a separate subcommand:
* append (append a key, a modifier, or a string to one or more pedals)
* clear (clear one or more pedals)
* help (print a help message)
* list (print a table with all possible keys)
* read (read values from the footpedal)
* set (set a key or mousebutton to one or more pedals)
A disadvantage is that different subcommands cannot be combined in one
call of the application anymore. However, this new structure brings the
major benefit that the program is more intuitive for users.
A second, small change is the fact that the welcome() function now reads
application and authore name from the Cargo file.
Furthermore, I did a small refactoring of the naming conventions for the
enum functions. Instead of vague terms liek value and string, they are
now called u8_to_enum, str_to_enum, or enum_to_str.
Application is now able to set the types (Key, Mouse, MouseKey, String),
which are saved in a struct, with a function. Furthermore, the
application can check the returned type of the board with a match.
This commit also implements the append string functionallity.
This commit included quite a lot of changes:
* The application arguments are now divided in a read and a write part.
This is realized through structopt subcommands.
* The read and write commands are recognized in a match construction
which takes place after the device is opened.
* I refactored some of the error messages and added more error messages
* The pedals_read() function now is able to read 1, 2, or 3 pedals.
Furthermore, the table is now redrawn with box drawing symbols.
* The write function is tested and successfully writes a key to the
device
In hidapi v0.4.1 it is not yet possible to store the HidDevice in a
struct. Although there is already a pull request to implement this, it is not yet merged.
The read function is now moved into the Pedals object and split up to
read_pedals() (which reads all pedals and prints the output) and
read_pedal() (which only reads one pedal).
Furthermore, the beginning of write_pedal() and write_pedals() is added.