ESP
0.1
The Example-based Sensor Predictions (ESP) system tries to bring machine learning to the maker community.
|
Emulate keyboard key presses corresponding to prediction results. More...
#include <ostream.h>
Public Member Functions | |
MacOSKeyboardOStream (std::map< uint32_t, char > key_mapping) | |
Create a MacOSKeyboardOStream instance, specifying the key presses to emulate for each predicted class label. More... | |
MacOSKeyboardOStream (uint32_t count,...) | |
Create a MacOSKeyboardOStream instance, specifying the key presses to emulate for each predicted class label. More... | |
virtual void | onReceive (uint32_t label) |
Public Member Functions inherited from Stream | |
Stream () | |
virtual bool | start () |
virtual void | stop () |
void | toggle () |
bool | hasStarted () |
Additional Inherited Members | |
Protected Attributes inherited from Stream | |
std::atomic_bool | has_started_ |
Emulate keyboard key presses corresponding to prediction results.
This class generates a key-down then key-up command for keys corresponding to class labels predicted by the current pipeline. The mapping from class labels to keys is specified in the constructor. Note that no key press will be generated if less than 500 ms have elapsed since the last key press.
To use an MacOSKeyboardOStream instance in your application, pass it to useOutputStream() in your setup() function.
|
inline |
Create a MacOSKeyboardOStream instance, specifying the key presses to emulate for each predicted class label.
key_mapping | a map from predicted class labels to keys. Note that class 0 is the GRT's special null prediction label and is not used to generate key presses. |
|
inline |
Create a MacOSKeyboardOStream instance, specifying the key presses to emulate for each predicted class label.
count | the number of keys specified |
... | the key to "press" upon prediction of the corresponding class label. Each key is a UTF16 character passed as an int. The first key specified corresponds to class label 1, the second to class label 2, etc. |
|
inlinevirtual |
Implements OStream.