is-open

xod/esp8266/is-open

Checks if a TCP connection is open
is-open
@/is-open
Checks if a TCP connection is open
SOCKxod/net/socket
A socket
INET@/esp8266-inet
An internet connection
CHKpulse
Perform the check
is-open
SOCK
INET
CHK
Y
N
Npulse
Pulses if the connection is closed
Ypulse
Pulses if the connection is open

C++ implementation

struct State {
};

// clang-format off
{{ GENERATED_CODE }}
// clang-format on

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

    auto inet = getValue<input_INET>(ctx);
    if (inet.wifi->isSocketOpen()) {
        emitValue<output_Y>(ctx, 1);
    } else {
        emitValue<output_N>(ctx, 1);
    }
}