This guide walks through defining a stream in streams.json, describing its data blocks, and picking/configuring the right driver for your hardware or network interface.
1. Understand the streams.json structure
APIC uses streams.json to define how data flows between LRUs, simulations, hardware drivers, and network interfaces. Each stream contains a blocks list and a driver configuration:
{
"streams": {
"[StreamName]": {
"blocks": [ ... ],
"driver": { ... }
}
}
}
In APICCenter (project page streams.json) every key shows a short description and its unit; keys with fixed values are lists
(interfaceAPILib per driver, e.g. UVCGadgetDeviceAPI / UVCGadgetAPI3 / UVCGadgetGigEAPI; UVC / GigE
format mjpeg, yu12, yuyv, nv12, rgb, mono8, mono16; serial PlayLoop; StorageDriver report 0 / 1 / 2; ...).
The GenICam format, width, height and fps lists also take a typed value, and null (keep the camera's value).
+ on a driver section adds the keys of its template; nothing is written before Save.
2. Define the blocks array
Each block describes one data element flowing in or out of the stream:
{
"raw": "LRU_Seeker.VideoFrame",
"direction": "in",
"framePerMS": -1,
"rawcounterbyte": 4,
"headerMarker": "534f_2A",
"model": "modelName"
}
| Field | Description |
|---|---|
raw | Block path: LRU.BlockName. |
direction | "in" = input stream (read from device), "out" = output stream (write to device). |
framePerMS | Stream rate. Numeric value = frames per millisecond; append hz postfix for Hertz (e.g. 100hz). Set to 0 to disable both transmission and reception. For "direction": "in" use -1 (see the note below). |
rawcounterbyte (optional) | Byte position of a block counter to automatically increment on send or receive. |
headerMarker (optional) | Unique identifier placed at the start of a data block to mark its beginning. An underscore (_) means ignore the value. |
model (optional) | Model name to execute (invokes modelName::OnRun()) when block data is received. The model's periodic scheduler is suspended during this mode. |
framePerMS for input blocks (all drivers): when "direction": "in",
framePerMS should usually be -1. The stream then checks for available input every minor frame.
0 disables the block. A number checks input only at that rate: if the receiving period is longer than the sender's period,
data is lost and a warning is shown. A number is reasonable only when the receive is blocking and the
system needs to be synchronized with it. Exception: a serial driver reading a "file" instead of a COM port — there a number is the right choice, it sets the replay rate and nothing is lost. See the streams reference.
3. Choose and configure a driver
The driver object determines which transport the stream uses. Pick the driver that matches your interface:
Sniffer Driver (network capture)
Captures packets from network interfaces using SnifferDriver. Supports local, remote, or both directions, and optional pcap filters.
"driver": {
"name": "SnifferDriver",
"active": true,
"adapter": "\\Device\\NPF_Loopback",
"filter": "udp",
"remoteIP": "127.0.0.1",
"remotePort": 0,
"localIP": "127.0.0.1",
"localPort": 3021,
"source": "remote",
"destination": "remote"
}
| Field | Description |
|---|---|
adapter | Network adapter name; available names are listed on application startup. |
filter | pcap capture filter string. |
remoteIP / remotePort | Filter messages to/from a remote address; can be empty/zero. |
localIP / localPort | Filter messages to/from a local address; can be empty/zero. |
source | "remote", "local", or "both" — which side to capture from. |
destination | "remote", "local", or "both" — which side to capture to. |
NI65xx Driver (NIDAQ)
Interfaces with NI DAQ cards, supporting multiple ports, read/write configuration, raw types, and power-up states.
"driver": {
"name": "NI65xxDriver",
"active": true,
"CardType": "MX",
"DeviceID": 1,
"PortNum": 2,
"PowerUpState": "low",
"RawType": "U",
"LinesPerPort": 16,
"Port0": "R",
"Port1": "W"
}
| Field | Values | Description |
|---|---|---|
CardType | e.g. "MX" | Hardware card type. |
DeviceID | integer | Unique device ID of the card. |
PortNum | integer | Number of ports available. |
PowerUpState | low / high / TriState / NA | Output line state after power-up. |
RawType | BI / BU / U / F | Binary signed, binary unsigned, unsigned integer, or 64-bit float. |
LinesPerPort | 16 / 32 / 64 | I/O lines per port. |
Port0..PortX | R / W | Direction per port: Read or Write. |
Socket Drivers (UDP / TCP)
Handles UDP and TCP sockets with multiple IN/OUT blocks, optional header markers, and raw counter bytes.
"driver": {
"name": "UDPSocketDriver",
"active": true,
"remoteIP": "172.30.176.2",
"sendFromIP": "172.30.192.1",
"sendFromPort": 8081,
"remotePort": 8081,
"localIP": "172.30.192.1",
"localPort": 8081
}
Use "name": "TCPSocketDriver" for TCP. sendFromIP/sendFromPort (UDP; formerly remoteIPBind/remotePortBind, still accepted) bind the send socket: the source IP/adapter and port the datagrams leave with. remoteIP/remotePort are the destination. localIP/localPort define where the driver listens; when they equal sendFrom* one socket does both. Socket buffer sizes, broadcast, multicast and Linux bindToDevice keys are listed in streams.html.
remoteIP or localIP contains ?, the driver reports the available network adapters/IPs on the machine and is discarded — it does not load. Use this only to discover the correct address, then replace it with the real IP.
XDMA Driver (FPGA high-speed streaming)
Handles high-speed FPGA streaming: video frames, frame sync, metadata, and static/dynamic modes.
"driver": {
"name": "XDMADriver",
"DeviceGuid": "{74c7e4a9-6d5d-4a70-bc0d-20691dff9e9d}",
"userBaseAddress": "0x00020000",
"DDR_BASE": "0x88000000",
"DeviceIndex": 0,
"FrameWidth": 640,
"FrameHeight": 512,
"BPP": 2,
"FrameRateUs": 200000,
"FrameSyncDelayMs": 10,
"AddMetadata": "Yes",
"StreamingMode": "Static",
"SyncSource": "External"
}
| Field | Description |
|---|---|
DeviceGuid | Unique identifier of the XDMA PCIe device. |
userBaseAddress / DDR_BASE | Base addresses for control/buffer mapping and DDR frame transfer. |
DeviceIndex | Index of the XDMA device when multiple are present. |
FrameWidth / FrameHeight / BPP | Image frame dimensions and bytes per pixel. |
FrameRateUs | Frame interval in microseconds (e.g. 200000 = 5 FPS). |
FrameSyncDelayMs | Delay before frame sync signal is sent/processed. |
AddMetadata | "Yes"/"No" — append metadata to each frame. |
StreamingMode | "Static" (fixed memory) or "Dynamic" (continuous stream). |
SyncSource | "Internal", "External", or "Sim" — frame timing source. |
CIGI Driver
Implements the CIGI protocol:
"driver": {
"name": "CIGIDriver",
"remoteIP": "127.0.0.1",
"remotePort": 8015,
"localIP": "",
"localPort": 8014
}
Serial Driver
Drives a serial port for telemetry, commands, and sensors. Configurable COM port, baud rate, parity, stop bits, and buffer sizes.
"driver": {
"name": "SerialDriver",
"file": "c:/data/serialData.txt",
"comPort": "\\\\.\\COM10",
"baudRate": 921600,
"parity": 0,
"stopBits": 1,
"byteSize": 8,
"latency": 1,
"flowcontrol": "none",
"overlapping": "yes",
"totalTimeoutConstant": 10,
"InBufferSize": "auto",
"OutBufferSize": "4096"
}
| Field | Description |
|---|---|
file | Optional — read/write from a file instead of a serial port; when set, comPort is ignored. |
comPort | Serial port name/path, e.g. \\\\.\\COM101; with SerialMOXACommAPI also "moxa", "moxa:1" (index) or "moxa:<usb serial>". If it contains ?, the driver reports the available COM ports instead and is discarded — see the note below. |
baudRate | Communication speed in bits per second. |
parity | 0=None, 1=Odd, 2=Even, 3=Mark, 4=Space. |
stopBits | Typically 1 or 2. |
byteSize | Data bits per character (usually 8). |
latency | USB-to-serial latency timer: -1 = only print the port's current latency, 0 = keep the driver/OS default (16 ms on Windows adapters), >0 = set it to that many ms. Use 1 for 115200 baud and above. See below. |
features | Optional object of library features, e.g. {"InterfaceMode": "rs485", "Latency": 1}, applied in file order after the port opens; the first one that fails closes the port. Latency, Dtr, Rts for every library, InterfaceMode for SerialMOXACommAPI, UsbTransferSize for SerialFTDICommAPI. See the Serial Driver reference. |
flowcontrol | "none" (default choice), "hardware" (RTS/CTS — needs the wires), "software" (XON/XOFF — ASCII only, corrupts binary data). |
overlapping | "yes" = asynchronous I/O; recommended for high baud rates. |
totalTimeoutConstant | Read/write timeout in ms. Keep it small (0–10) so a read never stalls the minor frame. |
InBufferSize / OutBufferSize | Buffer sizes in bytes, or "auto" for system default. |
comPort contains ?, the driver is discarded and not loaded — it only prints the list of available COM ports. Use this only to discover the correct port name, then replace it with the real port before running for real.
Serial interfaces (interfaceAPILib)
The serial driver reaches the port through an API library selected with interfaceAPILib:
SerialCommAPI (default; the operating system's serial API — Win32 COM ports / Linux termios) or
SerialFTDICommAPI (FTDI D2XX, direct access to FTDI chips for the lowest latency; on Linux the kernel ftdi_sio driver is unbound automatically, which needs root: start the application with root privilege the first time;
multi-channel chips are opened as <serial>A, <serial>B...; on Windows it needs ftd2xx.dll from FTDI's driver, see serial/api/FTDI/install.txt) or
SerialHumandataCommAPI (HuMANDATA converters such as the USB-010, an FTDI chip with HuMANDATA's USB id; the same D2XX code as the FTDI library, so no COM / tty port is needed; open by index "0" / "1" or loc:, see serial/api/Humandata/install.txt) or
SerialMOXACommAPI (MOXA UPort 1100 series, Windows and Linux: install MOXA's driver first, then use "comPort": "moxa", which finds the port by the MOXA USB vendor id whatever its COM / ttyUSB number; "?" prints the full features report of the MOXA devices; options after the port select the interface type and latency: "moxa;mode=rs232;latency=1" — the open fails if the driver cannot set the requested mode).
Latency
USB-to-serial adapters (FTDI, CP210x, CH340) hold received bytes for a latency timer before delivering them to the application — commonly
16 ms on Windows. That is harmless for logging but turns a steady stream into delayed bursts for time-critical traffic: at high baud rates
the buffer can overflow, and messages arrive split or late. Set "latency": 1 for baud rates of 115200 and above, command/response and hardware-in-the-loop links;
leave 0 for slow or bulk streams; use -1 once to read the current value. Lower latency costs more USB traffic and a little CPU.
Latency that is too high (or an input block read slower than the data arrives) is a common cause of the
"message size mismatched … Unknown header" error — see Serial troubleshooting.
"framePerMS": -1 so the port is read every minor frame. Problems and fixes: Troubleshoot: Serial Driver.
The UEI Serial Driver ("name": "UEISerialDriver") is a serial channel of a UEI SL-501 / SL-508 layer: the same serial settings
(baud rate, parity, stop bits, byte size, header markers) plus the rack keys ip and slot, and channel and lineMode instead of comPort.
Not sure of the slot? Start once with "slot": "?" (or run ueirack list <ip>): the layers of the rack are printed.
Rack and PC network setup: CoreEng/core/interfaces/Drivers/UEI/install.txt. Example and keys: UEI drivers.
"driver": {
"name": "UEISerialDriver",
"ip": "192.168.100.102",
"slot": 3,
"channel": 0,
"lineMode": "rs232",
"baudRate": 115200,
"parity": 0,
"stopBits": 1,
"byteSize": 8
}
Analog and digital layers of the same rack use UEIAIDriver, UEIAODriver and UEIDIODriver (keys); all UEI streams of a rack share one connection.
FFMpeg and GenICam video drivers
Both stream video from a camera. FFMpeg example:
"driver": {
"name": "FFMPegDriver",
"cameraName": "Lenovo FHD Webcam",
"format": "yuvj422p",
"fps": 30,
"width": 640,
"height": 480,
"bufferSizeMB": 10
}
If cameraName is missing or empty, a list of available connected devices is shown on startup. bufferSizeMB sizes the buffer for incoming frames not yet processed.
GenICam adds hardware trigger support via externalSync (line, activation: RisingEdge/FallingEdge), numOfPreAllocatedBuffers, and waitForFrameTimeout_us (0 = event-driven async mode). Note: setting fps overrides the external sync properties.
GenICam cameras are reached through an API library (interfaceAPILib):
"GenICamGeneralUSBAPI"– default, USB3 Vision through Aravis, no vendor software needed."GenICamUSBAPI"– USB3 Vision through the vendor's GenTL producer (.cti)."GenICamGigEAPI"– GigE Vision through a GenTL producer.
The producer is set with "apiOptions": { "producer": "..." } or found through the GENICAM_GENTL64_PATH environment variable. Any camera feature can be set with "features": { "GevSCPSPacketSize": 9000 }.
GenICam USB3 Vision through Aravis
"driver": {
"name": "GenICamDriver",
"interfaceAPILib": "GenICamGeneralUSBAPI",
"cameraName": "VID164C_PID5533_FF020440",
"format": "YUV422_8",
"width": 640, "height": 480, "fps": 30,
"features": { "ExposureTime": 5000 },
"externalSync": { "line": "Line4", "activation": "RisingEdge" },
"waitForFrameTimeout_us": 0
}
- Default interface (used when
interfaceAPILibis omitted). NoapiOptions. - Use
"cameraName": "?"once to get the list of connected cameras, then copy the id. - USB bandwidth is shared by all cameras on the same host controller.
GenICam USB3 Vision through a GenTL producer
"driver": {
"name": "GenICamDriver",
"interfaceAPILib": "GenICamUSBAPI",
"apiOptions": { "producer": "C:/Program Files/Balluff/ImpactAcquire/bin/x64/mvGenTLProducer.cti" },
"cameraName": "mvBlueFOX3-2051dC",
"format": "YUV422_8",
"width": 640, "height": 480, "fps": 30,
"waitForFrameTimeout_us": 0
}
- Works like the GigE library below (same options, camera name matching and error reports), but only with USB3 Vision cameras.
- Use it when the camera vendor's producer is installed. A mixed producer (GigE + USB, like the Balluff one) can serve a GigE stream and a USB stream at the same time.
cameraNamecan be the device ID, serial number, user defined name, display name or model;"?"lists the attached USB3 Vision cameras.
GenICam GigE Vision
"driver": {
"name": "GenICamDriver",
"interfaceAPILib": "GenICamGigEAPI",
"apiOptions": {
"producer": "C:/Program Files/Balluff/ImpactAcquire/bin/x64/mvGenTLProducer.cti",
"discoveryTimeoutMs": 1000
},
"cameraName": "22104455",
"format": "Mono8",
"fps": 30,
"features": { "GevSCPSPacketSize": 9000 },
"waitForFrameTimeout_us": 0
}
produceris the vendor's GenTL.ctifile (or a folder to search). If omitted,GENICAM_GENTL64_PATHis searched and the first GigE Vision producer is used.discoveryTimeoutMsis the discovery wait per network interface (default 1000); raise it if no camera is found.cameraNamecan be the device ID, serial number, user defined name, display name or model."format": null,"width": null,"height": null,"fps": nullkeep what is set in the camera (each on its own:"width": 2592, "height": nullchanges only the width). Withoutformatthe driver lists the camera's formats and does not start.- Use a dedicated NIC, jumbo frames (
GevSCPSPacketSizeand the NIC setting) and the same subnet as the camera. Only one application can own the camera. - The producer doesn't have to come from the camera's vendor: the Balluff
mvGenTLProducer.ctiworks with a FLIR Blackfly GigE camera (the FLIR Spinnaker producer can be used too).
Finding cameras and their features
Put a ? in cameraName to only report, without opening the camera:
"cameraName": "?"lists every attached camera (ID, model, vendor, serial number, transport) and the features of each one."cameraName": "22175251?"lists the features of that camera only. If that camera isn't attached, the driver says so and lists the features of the cameras it found.
Each feature line shows the type, access mode, GenICam name and current value, e.g. Float : [RO] 'Gain' = 18.0275 dB. Copy the names into features.
Remove the ? to stream.
GigE camera checklist
- Run with
"cameraName": "?". If the report saysNo Device found, the PC port is usually on a different subnet than the camera (e.g. PC169.254.95.2, camera192.168.0.2). - Give the PC port a static IP in the camera's subnet (e.g.
192.168.0.10/24), allow inbound UDP from that subnet in Windows Firewall, and check thatpingto the camera works. - Run
"?"again: the camera and its features are listed. SetcameraNameto its serial number. - If every frame is reported as
Incomplete frame (missing packets), reduce the camera bandwidth (DeviceLinkThroughputLimit,GevSCPD,fps) or use a PCIe NIC with jumbo frames. Example: a FLIR Blackfly on a USB 1 GbE adapter needs"features": { "DeviceLinkThroughputLimit": 50024000 }(32 fps). The value must be the camera's Min + n × Inc; a value off that grid is rejected with an error that shows Min and Inc.
See listing cameras and features and GigE network troubleshooting.
GenICam read errors
A camera read returns the frame size, eNoIO when no new frame is ready, or a negative GenICam error code:
eIncompleteFrame(-102) – the frame lost packets and was dropped (network bandwidth).eBufferTooSmall(-103) – the frame doesn't fit the buffer passed toRecv; size it withGetFrameSize().eNotStarted(-101) – the camera isn't open or streaming (check the startup report),eNotLoaded(-100) – the API library didn't load.eTransportError(-104) – other buffer / transport errors;eNotSupported(-105) –Send, a camera has no output.
Test for failure with result < CDriverBase::EIOResult::eNoIO, and for a specific code with
CGenICamDriver::IsResult(result, EGenICamIOResult::eIncompleteFrame). GetLastCaptureError() gives the details for the report.
See read results and error codes for a model example.
Both interfaces use the same externalSync trigger sequence (TriggerSelector=FrameStart, TriggerMode=On, source, activation).
A missing cameraName or format is reported with the list of devices or supported pixel formats. See
the full GenICam reference and interfaceAPILib.
UVC Gadget and GigE camera emulator (the board is the camera)
The UVCGadgetDeviceDriver turns the board into a camera for another computer; the model fills each frame in a callback.
The API library picks the kind of camera:
"UVCGadgetAPI3"– a USB webcam (USB device port, Linux, root): MJPEG / YU12 / YUYV."UVCGadgetGigEAPI"– a GigE Vision camera on the network (Linux or Windows, no root): Mono8 / Mono16 / YUV422_8 / RGB8. A GenTL producer, theGenICamDriver(GenICamGigEAPI) or any GigE Vision viewer opens it like a real camera.
1. Build: in the project CMakeLists.txt before add_subdirectory(core):
set(INCLUDE_UVCGADGET ON) and set(INCLUDE_UVCGADGET_GIGE ON) (USB camera: INCLUDE_UVCGADGET_USB3).
Register CUVCGadgetDeviceDriver in Drivers/DriversProj.cpp. The library UVCGadgetGigEAPI
(libUVCGadgetGigEAPI.so on Linux) must be in the working directory or next to the program.
2. streams.json (the BlackKite example, the board answers as camera BlackKite):
"GigECamera": {
"blocks": [],
"driver": {
"name": "UVCGadgetDeviceDriver",
"interfaceAPILib": "UVCGadgetGigEAPI",
"cameraName": "BlackKite",
"product": "BlackKite GigE Camera",
"networkInterface": "",
"format": "mono16", "width": 640, "height": 512, "fps": 30,
"formats": [
{ "format": "mono16", "resolutions": [ { "width": 640, "height": 512, "fps": [30, 60] },
{ "width": 1280, "height": 1024, "fps": [30] } ] },
{ "format": "mono8" }, { "format": "yuyv" }, { "format": "rgb" }
]
}
}
3. Model: set up the camera once (e.g. in the first OnRun) and fill the frames in the callback, in the format and size the client picked:
auto pCamera = dynamic_cast<CUVCGadgetDeviceDriver*>(CDrivers::FindDriver("GigECamera"));
pCamera->SetupCamera(); // the camera answers on the network from here on
pCamera->StartCamera();
pCamera->SetCallback([pCamera](void* buffer, size_t size) -> int {
uint32_t w, h;
pCamera->GetNegotiatedSize(w, h);
switch (pCamera->GetNegotiatedFormat()) {
case IUVCGadgetDeviceDriver::EFormat::MONO16: /* w * h * 2 bytes, little endian */ break;
case IUVCGadgetDeviceDriver::EFormat::MONO8: /* w * h bytes */ break;
case IUVCGadgetDeviceDriver::EFormat::YUYV: /* w * h * 2 bytes, Y U Y V */ break;
case IUVCGadgetDeviceDriver::EFormat::RGB3: /* w * h * 3 bytes */ break;
default: break;
}
return (int)size; // bytes written; 0 = no frame this time
});
The callback runs on the library's stream thread at the client's AcquisitionFrameRate, only while a client streams
(IsStreaming()). BlackKite's Models/FCSwitch.cpp feeds the same video to its USB camera and its GigE camera this way.
4. Client side, e.g. another simD program on the PC:
"driver": {
"name": "GenICamDriver",
"interfaceAPILib": "GenICamGigEAPI",
"apiOptions": { "producer": "C:/Program Files/Balluff/ImpactAcquire/bin/x64/mvGenTLProducer.cti" },
"cameraName": "BlackKite",
"format": "Mono16", "width": 640, "height": 512, "fps": 30
}
5. Check: the program prints UVCGadgetGigEAPI: GigE Vision camera 'BlackKite' ... on <interface> <address> ... discoverable now;
board and PC must be in one subnet. "cameraName": "?" on the client lists what it finds. The test programs in
UVCGadget/api/GigE/tests run the camera alone (gigeapitest) or a minimal client (gigeclient).
Reference: GigE Vision camera keys; problems: troubleshooting.
Shmem Driver (shared memory)
"driver": {
"name": "ShmemDriver",
"filename": "sharememFilename",
"size": 2048
}
INET Driver (HTTP/SFTP)
"driver": {
"name": "INETDriver",
"protocol": "http",
"IP": "127.0.0.1",
"port": 30000,
"URL": "/api/v0/{1}",
"header": {
"Content-Type": "application/json",
"Accept": "text/json",
"Accept-Language": "en-US",
"Cache-Control": "no-cache"
}
}
protocol is "http" or "sftp"; URL can include indexed placeholders. The header object defines custom HTTP headers sent with each request.
GDL90 Driver
Implements the GDL90 protocol for aviation entity display (e.g. ADS-B data between airborne and ground systems):
"driver": {
"name": "GDL90Driver",
"active": true,
"remoteIP": "127.0.0.1",
"remotePort": 4000,
"localIP": "",
"localPort": 4001
}
Input Device Driver (joystick / HOTAS / gamepad)
Maps a joystick's axes, buttons, and POV hats directly onto ICD elements. Always direction: "in" — no output/force-feedback support.
"blocks": [{
"raw": "JoystickData.JoystickData1",
"direction": "in",
"framePerMS": -1,
"XAxis": "XaxisPos",
"YAxis": "YaxisPos",
"ZRotation": { "element": "RaxisPos", "deadzone": 0.05 },
"Sliders": "Slider",
"POV0": "POV",
"Buttons": "ButtonStatus"
}],
"driver": {
"name": "InputDeviceDriver",
"interfaceAPILib": "InputDeviceAPI",
"device": "X-56 Rhino Throttle",
"reconnectMS": 1000,
"listDevices": true,
"listInputs": true
}
See the full reference for every block key (XAxis, Button0..127, collective Buttons/Axes/POVs, etc.) and driver field.
listDevices/listInputs to true the first time you wire up a device — the log tells you the exact device string and config key for every axis/button/POV, so you don't have to guess.
External Model Driver (MATLAB / Python)
Calls a live MATLAB or Python function once per stream read, passing an input block's raw bytes in and writing the returned bytes into an output block — useful for an algorithm still under development that you don't want to compile to C++ yet:
"blocks": [{
"raw": "LRU_Algo.AlgoInputs",
"rawout": "LRU_Algo.AlgoOutputs",
"direction": "in",
"framePerMS": -1,
"function": "runAlgo"
}],
"driver": {
"name": "ExternalModelDriver",
"interfaceAPILib": "MatlabDeviceAPI",
"moduleName": "myAlgoModule"
}
Use "interfaceAPILib": "PythonDeviceAPI" for Python instead — moduleName is then the Python module to
import. The function is called as rawOut = function(rawIn, rawInSize) (MATLAB) or
result = function(rawIn, rawInSize) (Python); it must unpack/pack the blocks' raw bytes itself. See
the full reference for details, and
How to Integrate a MATLAB Algorithm as a CoreEngine Model for the compiled-C++ alternative.
Matlab Driver
The MATLAB driver is the MatlabDeviceAPI mode of the External Model Driver above. It needs the MATLAB Engine API for C++,
starts its own MATLAB session, and the function must be on MATLAB's path and return a uint8 array. Calls go through the
MATLAB engine, so use it for development only. See the full reference.
Stream Block Hooks (PreSend / PostReceiveAccept / Receive)
A model can hook a block's raw bytes before an outgoing send, before an incoming stream is accepted (return false to reject it),
and after it is accepted. They run synchronously on the stream I/O path, so keep them to microseconds — no allocation, logging or blocking.
See when each is called, with a usage example.
4. Apply tips and best practices
- Use
headerMarkerfor reliable frame detection in UDP/TCP streams. - Set
rawcounterbyteto detect lost frames. - Ensure blocks generated by DBSimGenerator match the driver's endian and bit ordering.
- For serial streams, enable overlapping mode for high-throughput.
- Multiple blocks per stream can mix directions (IN/OUT).