ESP  0.1
The Example-based Sensor Predictions (ESP) system tries to bring machine learning to the maker community.
MacOSKeyboardOStream Class Reference

Emulate keyboard key presses corresponding to prediction results. More...

#include <ostream.h>

Inheritance diagram for MacOSKeyboardOStream:
OStream Stream

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_
 

Detailed Description

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.

Constructor & Destructor Documentation

MacOSKeyboardOStream::MacOSKeyboardOStream ( std::map< uint32_t, char >  key_mapping)
inline

Create a MacOSKeyboardOStream instance, specifying the key presses to emulate for each predicted class label.

Parameters
key_mappinga 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.
MacOSKeyboardOStream::MacOSKeyboardOStream ( uint32_t  count,
  ... 
)
inline

Create a MacOSKeyboardOStream instance, specifying the key presses to emulate for each predicted class label.

Parameters
countthe 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.

Member Function Documentation

virtual void MacOSKeyboardOStream::onReceive ( uint32_t  label)
inlinevirtual

Implements OStream.


The documentation for this class was generated from the following files: