Service Manager
Component registry: espressif/brookesia_service_manager
Public header:
#include "brookesia/service_manager.hpp"
Overview
brookesia_service_manager is the core service framework for lifecycle management, function and event registration, local calls, and event subscriptions.
Features
Lifecycle: Centralized init, start, stop, and deinit.
Local calls: In-process function calls without network transport.
Unified model: Function definitions, registries, events, and subscriptions.
Thread safety: Local runners and schedulers for safe execution.
Decoupling: Apps call through a stable API without depending on provider details.
Communication Architecture
Apps bind services through ServiceManager, then use ServiceBase and service helpers to access function and event registries with minimal overhead.
flowchart TD
A["App / User Code"]
B["**ServiceManager**<br/>· Service discovery<br/>· Lifecycle coordination<br/>· Binding entry"]
C["**ServiceBinding**<br/>· Holds service reference<br/>· Provides access wrapper<br/>· Manages call context"]
D["**ServiceBase**<br/>· Service instance base<br/>· Function and event containers<br/>· Permission check entry"]
E["**Function Registry**<br/>· Named functions<br/>· Argument schema<br/>· Sync/async execution"]
F["**Event Registry**<br/>· Event names<br/>· Subscriber list<br/>· Notification dispatch"]
A -->|"bind()"| B
B -->|"Returns binding"| C
C -->|"get_service()"| D
D -->|"Registers functions"| E
D -->|"Registers events"| F
Modules
Service Runtime
Lifecycle, dispatch, binding, and local execution built on ServiceBase, ServiceManager, and LocalTestRunner.
Function System
Defines callable interfaces, validates parameters, and dispatches to handlers through the function model and registry.
Event System
Event definitions, validation, and dispatch to local subscribers.
Common
Shared types and macros for the service manager.