send

xod-dev/esp8266/send

Sends a message through an opened TCP/UDP connection Possible errors: — Can't send data to the socket
send
@/send
Sends a message through an opened TCP/UDP connection Possible errors: — Can't send data to the socket
INET@/esp8266-inet
An internet connection
SOCKxod/net/socket
A socket
MSGstring
The message to send
SENDpulse
Send the message
send
INET
SOCK
MSG
SEND
INET'
SOCK'
DONE
DONEpulse
Pulses when the message is successfully sent
SOCK'xod/net/socket
A socket
INET'@/esp8266-inet
An internet connection
To use the node in your project you should have the xod-dev/esp8266 library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

#pragma XOD evaluate_on_pin disable
#pragma XOD evaluate_on_pin enable input_SEND
#pragma XOD error_raise enable

node {
    void evaluate(Context ctx) {
        if (!isInputDirty<input_SEND>(ctx))
            return;

        auto req = getValue<input_MSG>(ctx);
        auto inet = getValue<input_INET>(ctx);

        char _req[length(req) + 1] = { 0 };
        dump(req, _req);

        if (inet.wifi->send(_req)) {
            emitValue<output_DONE>(ctx, 1);
        } else {
            raiseError(ctx);
        }

        emitValue<output_INETU0027>(ctx, inet);
        emitValue<output_SOCKU0027>(ctx, getValue<input_SOCK>(ctx));
    }
}