Send strings over a TCP socket based on pipeline predictions.
More...
#include <ostream.h>
Send strings over a TCP socket based on pipeline predictions.
This class connects to a TCP server and sends it strings when predictions are made by the current machine learning pipeline. The TCP connection is only made once, when ESP first starts, and is not restored if the other side disconnects.
To use an TcpOStream instance in your application, pass it to useOutputStream() in your setup() function.
- Examples:
- user_accelerometer_gestures.cpp, user_accelerometer_poses.cpp, user_accelerometer_walk_detection.cpp, user_color_sensor.cpp, user_speaker.cpp, and user_touche.cpp.
TcpOStream::TcpOStream |
( |
string |
server, |
|
|
int |
port |
|
) |
| |
|
inline |
Create a TCPOStream instance. This passes the predicted class labels directly to the TCP stream, as ASCII-formatted, newline-terminated strings (e.g. class label 1 will be sent as the string "1\n").
- Parameters
-
server | the hostname or IP address of the TCP server to connect to |
port | the port of the TCP server to connect to |
TcpOStream::TcpOStream |
( |
string |
server, |
|
|
int |
port, |
|
|
std::map< uint32_t, string > |
tcp_stream_mapping |
|
) |
| |
|
inline |
Create a TCPOStream instance.
- Parameters
-
server | the hostname or IP address of the TCP server to connect to |
port | the port of the TCP server to connect to : a map from predicted class labels to strings to send over the TCP connection. No delimiters or other characters are added to the strings specified, so, if they're required, be sure to include them in the provided strings. Note that 0 is a special GRT class label indicating no prediction, and will not trigger the sending of a string. |
TcpOStream::TcpOStream |
( |
string |
server, |
|
|
int |
port, |
|
|
uint32_t |
count, |
|
|
|
... |
|
) |
| |
|
inline |
Create a TCPOStream instance.
- Parameters
-
server | the hostname or IP address of the TCP server to connect to |
port | the port of the TCP server to connect to |
count | the number of strings provided |
... | the strings to send over the TCP connection for each predicted class label. The first string provided corresponds to class label 1, the second to class label 2, etc. No delimiters or other characters are added to the strings specified, so, if they're required, be sure to include them in the provided strings. |
virtual void TcpOStream::onReceive |
( |
uint32_t |
label | ) |
|
|
inlinevirtual |
virtual void TcpOStream::onReceive |
( |
vector< double > |
data | ) |
|
|
inlinevirtual |
bool TcpOStream::start |
( |
| ) |
|
|
virtual |
Start the stream.
Reimplemented from Stream.
The documentation for this class was generated from the following files: