Skip to main content

SDK Integration

This guide combines the SDK surface, build integration, backend loading, and runtime integration checklist for teams embedding the generic EdgeEmbed runtime into an embedded platform.

SDK Deliverables

edgeembed-runtime-sdk/
include/
edgeembed.h
edgeembed_types.h
edgeembed_backend_abi.h
edgeembed_config.h
lib/
libedgeembed.so
libmock_hal.so
robotics_bundle/
manifest.json
events.json
intents.json
actions.json
action_mapping.json
policy.json
resources.json
concurrency.json
backends/
robot_mock_plugin.so
robot_mock_plugin.manifest.json
examples/
docs/
AssetPurpose
include/edgeembed.hRuntime lifecycle, bundle loading, symbol resolution, event input, resource updates, callbacks, diagnostics
include/edgeembed_types.hPublic enums, structs, trace fields, runtime config, payloads, completion records
include/edgeembed_backend_abi.hABI for platform backend plugin implementations
include/edgeembed_config.hBuild-time pool and timing override macros; the public runtime API does not depend on it
lib/libedgeembed.soIn-process runtime library
lib/libmock_hal.soReference mock backend for deterministic evaluation

Integration Layers

LayerIntegrator ownsSDK owns
Event sourcesMap platform signals to bundle event names such as evt_cliff_detected, evt_obstacle_close, and evt_path_clearValidate, normalize, queue, coalesce
Resource stateReport facts about resources such as drive_base, speaker, and led_ringMaintain point-in-time resource snapshots
PolicyDefine event-to-intent rules in policy.jsonEvaluate policy deterministically
ConcurrencyDefine resource-class conflicts for class_drive and class_hmiEnforce group behavior before actions
Action mappingDefine intent-to-action templates for intent_safe_stop, intent_slow_down, and intent_resumeBuild ordered plans and dependencies
Platform backendImplement the backend plugin ABI for act_drive_stop, act_drive_slow, and act_drive_resumeDispatch actions through edgeembed_backend_ops_t
Fallback pathProvide any independent platform fallback required by the productReport state, diagnostics, trace fields

Build Integration

cmake_minimum_required(VERSION 3.16)
project(my_robot_controller C)

set(EDGEEMBED_SDK_DIR "/opt/edgeembed-runtime-sdk" CACHE PATH "SDK root")

add_executable(my_app main.c)
target_include_directories(my_app PRIVATE ${EDGEEMBED_SDK_DIR}/include)
target_link_libraries(my_app PRIVATE ${EDGEEMBED_SDK_DIR}/lib/libedgeembed.so pthread m)
set_target_properties(my_app PROPERTIES BUILD_RPATH ${EDGEEMBED_SDK_DIR}/lib)
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release \
-DEDGEEMBED_SDK_DIR=/opt/edgeembed-runtime-sdk
cmake --build build --parallel

Minimal Runtime Flow

#include <edgeembed.h>

static void event_cb(edgeembed_event_id_t id,
edgeembed_event_status_t status,
const edgeembed_trace_t* trace,
void* user_data) {
(void)id;
(void)status;
(void)trace;
(void)user_data;
}

int main(void) {
edgeembed_config_t cfg = {
.default_namespace = "robotics_bundle",
};

edgeembed_t* runtime = NULL;
edgeembed_result_t rc = edgeembed_init(&runtime, &cfg);
if (rc != EDGEEMBED_OK) {
return 1;
}

rc = edgeembed_load_bundle(runtime, "robotics_bundle");
if (rc != EDGEEMBED_OK) {
edgeembed_shutdown(runtime);
return 1;
}

edgeembed_set_event_callback(runtime, event_cb, NULL);

rc = edgeembed_start(runtime);
if (rc != EDGEEMBED_OK) {
edgeembed_shutdown(runtime);
return 1;
}

edgeembed_payload_t payload = {
.urgency = 1.0f,
.confidence = 0.95f,
.ttl_ms = 2500u,
};

edgeembed_event_id_t id = 0;
rc = edgeembed_submit_event(runtime, "evt_cliff_detected", &payload, &id);

edgeembed_stop(runtime);
edgeembed_shutdown(runtime);
return rc == EDGEEMBED_OK ? 0 : 1;
}

For hot paths, resolve names once with edgeembed_resolve_symbol() and submit with edgeembed_submit_event_by_id().

Backend Loading

The runtime never links concrete platform code. edgeembed_load_bundle() reads the bundle directory, validates manifest.json and the vocabulary files, loads backend shared objects from backends/, resolves edgeembed_backend_entry(), and queries capabilities through the returned edgeembed_backend_ops_t.

If a bundle is invalid, edgeembed_load_bundle() returns an error such as EDGEEMBED_ERR_BUNDLE_INVALID, EDGEEMBED_ERR_PLUGIN_LOAD, or EDGEEMBED_ERR_BACKEND_ABI_MISMATCH. Use edgeembed_get_last_config_errors() to retrieve the last structured bundle validation report.

Latency Target

StageBudget
Event enqueue50 microseconds or less
Decision thread wakeup100 microseconds or less
Policy evaluation200 microseconds or less
Action planning100 microseconds or less
Backend dispatch500 microseconds or less
Library-mode target10 ms p99 on production target

Latency is measured from event receipt to backend dispatch using edgeembed_trace_t, trace callbacks, and records drained through edgeembed_drain_trace(). Backend ACK time belongs to the platform backend contract and is outside the core runtime SLA.

Integration Checklist

  • Load the bundle with edgeembed_load_bundle() before entering RUNNING.
  • Keep callbacks short and non-blocking.
  • Never submit or cancel events from inside an event callback.
  • Use edgeembed_update_resource_state() for actual resource-state facts, not for direct control commands.
  • Preserve any independent platform fallback required when runtime state is EDGEEMBED_RUNTIME_STATE_ERROR.
  • Replace the reference mock backend with a production backend before deployment validation.