Echo

Echo

Requires: com.ioninja.layer
Status: ENABLED (all requirements are satisifed)

The Echo plugin is quite possibly the simplest layer you could imagine. Whatever is received, is sent back immediately (hence, the tennis ball on the icon).

In fact, here's the entire code for the plugin:

class EchoLayer: doc.Layer
{
    construct (doc.PluginHost* pluginHost)
    {
        basetype.construct (pluginHost);
        pluginHost.m_log.attachListener (onLogRecord @ pluginHost.m_mainThreadScheduler);
    }

    onLogRecord (
        uint64_t timestamp,
        uint_t recordCode,
        void const* p,
        size_t size
        )
    {
        if (recordCode == log.StdRecordCode.Rx)
            try transmit (p, size);
    }
}

And that's it!

As simple as it looks, it's pretty useful for testing purposes. Also, it might be your starting point for building a more sophisiticated testing utility.