Tuesday, 10 December 2013

Interactive Devices: Lab 5 Individual Post - Implementing the software features

From the last lab we had an Arduino program capable of transmitting rotary encoder inputs to our laptop. In order to make use of these inputs myself and Vlad, after much research, decided to use the OpenFrameworks library to implement the features we set out at the beginning of the project i.e. folder navigation, browser navigation and authentication.

We started by sending the device's rotations from Arduino to OpenFrameworks and subsequently created a Node JS server, listening for commands, in order to perform actions on the browser. As we implemented the new system we quickly remembered that the most important, if not all, computer commands are mapped to certain keyboard shortcuts, even better, these shortcuts are often consistent across programs. Luckily Windows provides a C++ function called keybd_event() which simulates key strokes.

Example:

keybd_event(VK_TAB, 0, 0, 0);                                  // Presses tab key
::Sleep(1000);
keybd_event(VK_TAB, 0, KEYEVENTF_KEYUP, 0);   // Releases tab key

For our authentication we decided to start from the Windows lock screen. The locking action on Windows has a shortcut, Windows Key + L, so we simulated this combination with our program. This first attempt didn't work so we decided to try other combinations to see where the problem lied. After a few successful attempts I quickly realised Windows had a security protocol in place which clearly disabled us from locking the computer programmatically.
As a solution we decided to make our own authentication screen which would record key presses in the background and on pressing enter, if the password was correct, it would let us perform the other previously mapped actions, basically locking down any cube functionality until access was granted.

Using a similar method, myself and Vlad then implemented the following applications for the demo: folder navigation, browser navigation and application switching.

No comments:

Post a Comment