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

Emulate mouse double-clicks at locations corresponding to prediction results. More...

#include <ostream.h>

Inheritance diagram for MacOSMouseOStream:
OStream Stream

Public Member Functions

 MacOSMouseOStream (std::map< uint32_t, pair< uint32_t, uint32_t > > mouse_mapping)
 Create a MacOSMouseOStream instance, specifying the locations at which to double-click the mouse for each predicted class label. More...
 
 MacOSMouseOStream (uint32_t count,...)
 Create a MacOSMouseOStream instance, specifying the location at which to double-click the mouse 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 mouse double-clicks at locations corresponding to prediction results.

This class generates a mouse double-click at locations corresponding to class labels predicted by the current pipeline. The mapping from class labels to locations is specified in the constructor. Note that no double-click will be generated if less than 500 ms have elapsed since the last double-click.

To use an MacOSMouseOStream instance in your application, pass it to useOutputStream() in your setup() function.

Constructor & Destructor Documentation

MacOSMouseOStream::MacOSMouseOStream ( std::map< uint32_t, pair< uint32_t, uint32_t > >  mouse_mapping)
inline

Create a MacOSMouseOStream instance, specifying the locations at which to double-click the mouse for each predicted class label.

Parameters
mouse_mappinga map from predicted class labels to screen locations (x, y pairs). Note that class 0 is the GRT's special null prediction label and is not used to generate mouse clicks.
MacOSMouseOStream::MacOSMouseOStream ( uint32_t  count,
  ... 
)
inline

Create a MacOSMouseOStream instance, specifying the location at which to double-click the mouse for each predicted class label.

Parameters
countthe number of locations specified
...the location at which to "double-click" upon prediction of the corresponding class label. Each location is specified by two uint32_t parameters: x then y. The first location (first two parameters) specified corresponds to class label 1, the second (parameters 3 and 4) to class label 2, etc.

Member Function Documentation

virtual void MacOSMouseOStream::onReceive ( uint32_t  label)
inlinevirtual

Implements OStream.


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