add-byte-to-packet

gabbapeople/simple-byte-protocol/add-byte-to-packet

Fulfills a packet with values
add-byte-to-packet
@/add-byte-to-packet
Fulfills a packet with values
IN@/packet
B1byte (variadic)
Data byte
add-byte-to-packet
OUT
IN
B1
OUT@/packet
To use the node in your project you should have the gabbapeople/simple-byte-protocol 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

struct State {
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    auto _packet = getValue<input_IN>(ctx);
    if (_packet.idx >= _packet.bufferSize - 1){
        return;
    }
        _packet.buffer[_packet.idx] = getValue<input_B1>(ctx);
        _packet.idx++;
        emitValue<output_OUT>(ctx, _packet);
}