In-App Scripting API

This section describes the API provided to the transmit scripts, i.e. the code you write and run inside the Script pane.

// global variables

log.Writer* const g_logWriter;

// global functions

void clearLog();
bool errorcode connect();
void disconnect();

size_t errorcode transmit(
    void const* p,
    size_t size
);

size_t errorcode transmit(string_t text);

size_t errorcode receive(
    void* p,
    size_t size,
    uint_t timeout = -1
);

bool errorcode unreceive(
    void const* p,
    size_t size
);

size_t errorcode transmitAll(
    void const* p,
    size_t size
);

size_t errorcode transmitAll(string_t text);

size_t errorcode receiveAll(
    void* p,
    size_t size
);

size_t errorcode receiveAll(
    void* p,
    size_t size,
    uint_t timeout
);

bool errorcode dispatch(
    uint_t code,
    variant_t in = null,
    variant_t* out = null
);

variant_t dispatchGet(
    uint_t code,
    variant_t in = null
);

void main();

void pretransmit(
    void const* p,
    size_t size
);

void onLogRecord(
    uint64_t timestamp,
    uint64_t recordCode,
    void const* p,
    size_t size
);