API Reference
Document Version: API v2.0 Classification: Developer Documentation Date: November 2025 Purpose: Complete API reference for GROOT FORCE / KLYRA OS platform
Table of Contents
- API Overview & Architecture
- System Service APIs
- Hardware Abstraction Layer (HAL) APIs
- Sensor APIs
- Display & HUD APIs
- Audio APIs
- Camera & Vision APIs
- AI Runtime APIs
- Memory & RAG APIs
- Skill Framework APIs
- Power & Thermal APIs
- Connectivity APIs
- Cloud & Sync APIs
- Security & Privacy APIs
- Developer SDK APIs
- Error Codes & Handling
API Overview & Architecture
1.1 PLATFORM ARCHITECTURE
GROOT FORCE uses a layered API architecture:
┌─────────────────────────────────────────────┐ │ Application Layer (Skills / Apps) │ ├─────────────────────────────────────────────┤ │ Skill Framework API │ ├─────────────────────────────────────────────┤ │ AI Runtime API │ ├─────────────────────────────────────────────┤ │ System Service API Layer │ │ (Display, Audio, Camera, etc.) │ ├─────────────────────────────────────────────┤ │ Hardware Abstraction Layer (HAL) │ ├─────────────────────────────────────────────┤ │ Linux Kernel / Android Framework │ ├─────────────────────────────────────────────┤ │ Hardware (Sensors, Display, etc.) │ └─────────────────────────────────────────────┘
1.2 API CONVENTIONS
Language Support:
- Primary: C/C++ (system level)
- Python (AI runtime, skills)
- Java/Kotlin (Android apps)
- JavaScript (web skills, optional)
Naming Convention:
- Namespaces: klyra::, gf::, hal::
- Functions: camelCase (getUserProfile, readSensorData)
- Constants: UPPER_SNAKE_CASE (MAX_BUFFER_SIZE)
- Classes: PascalCase (DisplayManager, SensorHub)
Error Handling:
- Return codes: 0 = success, negative = error
- Exceptions for critical failures (C++/Python)
- Detailed error codes (see Section 16)
Threading:
- Most APIs are thread-safe (documented per function)
- Callbacks may be on different threads
- Use provided synchronization primitives
1.3 API ACCESS LEVELS
Public APIs:
- Available to all skills and apps
- Documented and stable
- Versioned (semantic versioning)
Protected APIs:
- Require special permissions
- May access sensitive data or hardware
- Documented but usage restricted
Private APIs:
- System internal only
- Not available to third-party developers
- Subject to change without notice
1.4 PERMISSIONS SYSTEM
All APIs that access hardware or user data require permissions declared in skill manifest.
Permission Categories:
- HARDWARE (camera, microphone, sensors)
- DATA (user profile, memory, RAG)
- NETWORK (internet, cloud sync)
- SYSTEM (power management, firmware)
Example manifest:
{
"skill_name": "Navigation Assistant",
"version": "1.0.0",
"permissions": [
"CAMERA_READ",
"SENSOR_IMU",
"SENSOR_TOF",
"DISPLAY_HUD",
"AUDIO_OUTPUT"
]
}
═══════════════════════════════════════════════════════════════════
SYSTEM SERVICE APIs
2.1 SYSTEM MANAGER
namespace: klyra::system
Purpose: Core system control and status
2.1.1 getSystemInfo()
Description: Get system hardware and software information
Signature:
SystemInfo getSystemInfo()
Returns:
struct SystemInfo {
std::string device_model; // "GROOT FORCE GF-CL"
std::string serial_number; // "GF-251120-A-0001"
std::string os_version; // "KLYRA OS 2.0.1"
std::string firmware_version; // "FW-2.0.1-20251120"
int battery_percentage; // 0-100
float temperature_celsius; // Current device temp
uint64_t uptime_seconds; // Time since boot
std::string variant; // "CL" (Care & Joy edition)
}
Example:
auto info = klyra::system::getSystemInfo();
std::cout << "Device: " << info.device_model << std::endl;
std::cout << "Battery: " << info.battery_percentage << "%" << std::endl;
Permissions: PUBLIC (no permission required)
2.1.2 reboot()
Description: Reboot the device (requires system permission)
Signature:
int reboot(RebootMode mode)
Parameters:
- mode: NORMAL, RECOVERY, BOOTLOADER
Returns:
- 0 on success (device will reboot)
- ERROR_PERMISSION_DENIED if lacking permission
- ERROR_INVALID_MODE if mode unknown
Permissions: SYSTEM_REBOOT
2.1.3 shutdown()
Description: Shutdown the device
Signature:
int shutdown()
Returns:
- 0 on success (device will shutdown)
- ERROR_PERMISSION_DENIED if lacking permission
Permissions: SYSTEM_SHUTDOWN
2.1.4 registerSystemCallback()
Description: Register callback for system events
Signature:
int registerSystemCallback(SystemEventCallback callback, void* user_data)
Callback signature:
typedef void (*SystemEventCallback)(SystemEvent event, void* user_data)
enum SystemEvent {
EVENT_BATTERY_LOW, // Battery <15%
EVENT_BATTERY_CRITICAL, // Battery <5%
EVENT_THERMAL_WARNING, // Temp >45°C
EVENT_THERMAL_CRITICAL, // Temp >50°C
EVENT_SHUTDOWN_PENDING, // System shutting down soon
EVENT_OTA_AVAILABLE // Firmware update available
}
Example:
void onSystemEvent(SystemEvent event, void* user_data) {
if (event == EVENT_BATTERY_LOW) {
std::cout << "Battery low! Save your work." << std::endl;
}
}
klyra::system::registerSystemCallback(onSystemEvent, nullptr);
Permissions: PUBLIC
2.2 MODE MANAGER
namespace: klyra::mode
Purpose: Manage device operating modes (NDIS, Fitness, etc.)
2.2.1 getCurrentMode()
Description: Get current operating mode
Signature:
DeviceMode getCurrentMode()
Returns:
enum DeviceMode {
MODE_NORMAL,
MODE_NDIS_CARE, // Care & Joy mode
MODE_FITNESS, // Nick's Fitness mode
MODE_TRADE, // TradeForce mode
MODE_TRAVEL, // Traveller mode
MODE_VI_ASSIST, // Vision Assist mode
MODE_DI_ASSIST, // Deaf/HoH mode
MODE_ENTERPRISE, // Enterprise mode
MODE_GUEST // Guest mode (restricted)
}
Permissions: PUBLIC
2.2.2 setMode()
Description: Switch operating mode
Signature:
int setMode(DeviceMode mode)
Returns:
- 0 on success
- ERROR_INVALID_MODE if mode not supported by this variant
- ERROR_PERMISSION_DENIED if lacking permission
Permissions: MODE_CHANGE
2.2.3 registerModeCallback()
Description: Get notified when mode changes
Signature:
int registerModeCallback(ModeChangeCallback callback, void* user_data)
Callback:
typedef void (*ModeChangeCallback)(DeviceMode old_mode, DeviceMode new_mode, void* user_data)
Permissions: PUBLIC
═══════════════════════════════════════════════════════════════════
HARDWARE ABSTRACTION LAYER (HAL) APIs
3.1 HAL OVERVIEW
namespace: hal::
Purpose: Low-level hardware access (usually accessed via higher-level APIs, but available for advanced use cases)
3.1.1 initHardware()
Description: Initialize HAL (called automatically at boot)
Signature:
int hal::initHardware()
Returns:
- 0 on success
- ERROR_HARDWARE_FAILURE if critical hardware unavailable
Permissions: SYSTEM (private API)
3.1.2 getHardwareStatus()
Description: Get hardware component status
Signature:
HardwareStatus hal::getHardwareStatus(HardwareComponent component)
Parameters:
enum HardwareComponent {
HW_DISPLAY,
HW_CAMERA_MAIN,
HW_CAMERA_DEPTH,
HW_IMU,
HW_TOF,
HW_LIDAR,
HW_AUDIO_OUT,
HW_AUDIO_IN,
HW_BATTERY,
HW_PMIC,
HW_BLUETOOTH,
HW_WIFI,
HW_LTE
}
enum HardwareStatus {
HW_STATUS_OK,
HW_STATUS_ERROR,
HW_STATUS_DISABLED,
HW_STATUS_NOT_PRESENT
}
Example:
auto status = hal::getHardwareStatus(HW_CAMERA_MAIN);
if (status != HW_STATUS_OK) {
std::cerr << "Camera not available!" << std::endl;
}
Permissions: PUBLIC
═══════════════════════════════════════════════════════════════════
SENSOR APIs
4.1 IMU (INERTIAL MEASUREMENT UNIT)
namespace: klyra::sensors::imu
Purpose: Access 9-axis IMU (accelerometer, gyroscope, magnetometer)
4.1.1 initIMU()
Description: Initialize IMU sensor
Signature:
int initIMU(IMUConfig config)
Parameters:
struct IMUConfig {
int sample_rate_hz; // 50, 100, 200, 400, 1000
bool enable_accel;
bool enable_gyro;
bool enable_mag;
bool enable_fusion; // Enable sensor fusion (quaternion output)
}
Returns:
- 0 on success
- ERROR_SENSOR_NOT_AVAILABLE if IMU hardware failed
Permissions: SENSOR_IMU
4.1.2 readIMU()
Description: Read current IMU data
Signature:
IMUData readIMU()
Returns:
struct IMUData {
// Accelerometer (m/s²)
float accel_x, accel_y, accel_z;
// Gyroscope (rad/s)
float gyro_x, gyro_y, gyro_z;
// Magnetometer (μT)
float mag_x, mag_y, mag_z;
// Fused orientation (quaternion) - if fusion enabled
float quat_w, quat_x, quat_y, quat_z;
// Timestamp
uint64_t timestamp_us;
}
Example:
IMUConfig config = {100, true, true, true, true};
klyra::sensors::imu::initIMU(config);
auto data = klyra::sensors::imu::readIMU();
std::cout << "Accel: " << data.accel_x << ", "
<< data.accel_y << ", " << data.accel_z << std::endl;
Permissions: SENSOR_IMU
4.1.3 registerIMUCallback()
Description: Register callback for IMU data (streaming mode)
Signature:
int registerIMUCallback(IMUCallback callback, void* user_data)
Callback:
typedef void (*IMUCallback)(const IMUData& data, void* user_data)
Note: Callback called at configured sample rate. Be fast!
Permissions: SENSOR_IMU
4.2 TIME-OF-FLIGHT (TOF) SENSOR
namespace: klyra::sensors::tof
Purpose: Short-range depth sensing (0.1 - 4m)
4.2.1 initToF()
Description: Initialize ToF sensor
Signature:
int initToF(ToFConfig config)
Parameters:
struct ToFConfig {
int sample_rate_hz; // 1, 5, 10, 15, 30
ToFMode mode; // SHORT_RANGE, LONG_RANGE
bool enable_ambient; // Measure ambient light too
}
enum ToFMode {
TOF_SHORT_RANGE, // 0.1 - 1.3m, high accuracy
TOF_LONG_RANGE // 0.4 - 4.0m, lower accuracy
}
Returns:
- 0 on success
- ERROR_SENSOR_NOT_AVAILABLE
Permissions: SENSOR_TOF
4.2.2 readToF()
Description: Read ToF distance data
Signature:
ToFData readToF()
Returns:
struct ToFData {
// 8x8 zone array (VL53L5CX)
float distance_mm[8][8]; // Distance in millimeters
// Status per zone
uint8_t status[8][8]; // 0=valid, >0=error code
// Ambient light (if enabled)
uint16_t ambient[8][8]; // Raw ADC counts
uint64_t timestamp_us;
}
Example:
ToFConfig config = {15, TOF_SHORT_RANGE, false};
klyra::sensors::tof::initToF(config);
auto data = klyra::sensors::tof::readToF();
// Get center zone distance
float center_distance = data.distance_mm[4][4];
std::cout << "Distance: " << center_distance << " mm" << std::endl;
Permissions: SENSOR_TOF
4.2.3 registerToFCallback()
Description: Stream ToF data
Signature:
int registerToFCallback(ToFCallback callback, void* user_data)
Callback:
typedef void (*ToFCallback)(const ToFData& data, void* user_data)
Permissions: SENSOR_TOF
4.3 LIDAR SENSOR
namespace: klyra::sensors::lidar
Purpose: Long-range distance measurement (up to 12m)
4.3.1 initLiDAR()
Description: Initialize LiDAR sensor
Signature:
int initLiDAR(LiDARConfig config)
Parameters:
struct LiDARConfig {
int sample_rate_hz; // 1, 5, 10, 20, 100
float min_distance_m; // Minimum distance (0.1 - 0.5)
float max_distance_m; // Maximum distance (5.0 - 12.0)
}
Returns:
- 0 on success
- ERROR_SENSOR_NOT_AVAILABLE
Permissions: SENSOR_LIDAR
4.3.2 readLiDAR()
Description: Read LiDAR distance
Signature:
LiDARData readLiDAR()
Returns:
struct LiDARData {
float distance_m; // Distance in meters
float signal_strength; // 0-1 (quality indicator)
uint8_t status; // 0=valid, >0=error
uint64_t timestamp_us;
}
Permissions: SENSOR_LIDAR
4.4 ENVIRONMENTAL SENSOR (BME688)
namespace: klyra::sensors::env
Purpose: Temperature, humidity, pressure, VOC gas sensing
4.4.1 initEnvSensor()
Description: Initialize environmental sensor
Signature:
int initEnvSensor()
Returns:
- 0 on success
- ERROR_SENSOR_NOT_AVAILABLE
Permissions: SENSOR_ENV
4.4.2 readEnvSensor()
Description: Read environmental data
Signature:
EnvData readEnvSensor()
Returns:
struct EnvData {
float temperature_c; // Celsius
float humidity_percent; // 0-100%
float pressure_hpa; // hPa (hectopascals)
float gas_resistance_ohm; // VOC gas resistance (higher = cleaner air)
float iaq_index; // Indoor Air Quality index (0-500, calculated)
uint64_t timestamp_us;
}
Example:
klyra::sensors::env::initEnvSensor();
auto data = klyra::sensors::env::readEnvSensor();
std::cout << "Temp: " << data.temperature_c << "°C" << std::endl;
std::cout << "Humidity: " << data.humidity_percent << "%" << std::endl;
std::cout << "IAQ: " << data.iaq_index << std::endl;
Permissions: SENSOR_ENV
4.5 HEALTH SENSORS
namespace: klyra::sensors::health
Purpose: Heart rate, SpO2, temperature monitoring
4.5.1 initHealthSensor()
Description: Initialize health sensors (MAX30102 + MLX90614)
Signature:
int initHealthSensor(HealthSensorConfig config)
Parameters:
struct HealthSensorConfig {
bool enable_heart_rate;
bool enable_spo2;
bool enable_temp_ir;
int sample_rate_hz; // 25, 50, 100
}
Returns:
- 0 on success
- ERROR_SENSOR_NOT_AVAILABLE
Permissions: SENSOR_HEALTH
4.5.2 readHealthSensor()
Description: Read health data
Signature:
HealthData readHealthSensor()
Returns:
struct HealthData {
int heart_rate_bpm; // Beats per minute (0 if not detected)
int spo2_percent; // Blood oxygen (0-100%, 0 if not detected)
float temp_ir_c; // IR temperature (Celsius)
bool finger_detected; // Sensor contact status
uint64_t timestamp_us;
}
Example:
HealthSensorConfig config = {true, true, true, 50};
klyra::sensors::health::initHealthSensor(config);
auto data = klyra::sensors::health::readHealthSensor();
if (data.finger_detected) {
std::cout << "HR: " << data.heart_rate_bpm << " bpm" << std::endl;
std::cout << "SpO2: " << data.spo2_percent << "%" << std::endl;
}
Permissions: SENSOR_HEALTH
═══════════════════════════════════════════════════════════════════
DISPLAY & HUD APIs
5.1 DISPLAY MANAGER
namespace: klyra::display
Purpose: Control micro-OLED displays and HUD rendering
5.1.1 initDisplay()
Description: Initialize display system
Signature:
int initDisplay()
Returns:
- 0 on success
- ERROR_DISPLAY_NOT_AVAILABLE
Permissions: DISPLAY_HUD (auto-granted to all skills)
5.1.2 setBrightness()
Description: Set display brightness
Signature:
int setBrightness(float brightness)
Parameters:
- brightness: 0.0 (off) to 1.0 (max)
Returns:
- 0 on success
- ERROR_INVALID_PARAMETER if brightness out of range
Permissions: DISPLAY_HUD
5.1.3 showText()
Description: Display text on HUD
Signature:
int showText(const std::string& text, TextConfig config)
Parameters:
struct TextConfig {
float x, y; // Position (0-1 normalized)
float font_size; // 0.5 - 2.0 (1.0 = normal)
uint32_t color; // RGBA (0xRRGGBBAA)
TextAlignment align; // LEFT, CENTER, RIGHT
float duration_sec; // 0 = indefinite, >0 = auto-hide after duration
}
enum TextAlignment {
ALIGN_LEFT,
ALIGN_CENTER,
ALIGN_RIGHT
}
Returns:
- Text ID (use to update or hide later)
- Negative value on error
Example:
TextConfig config = {0.5, 0.5, 1.0, 0xFFFFFFFF, ALIGN_CENTER, 5.0};
int text_id = klyra::display::showText("Hello GROOT FORCE!", config);
Permissions: DISPLAY_HUD
5.1.4 hideText()
Description: Hide previously shown text
Signature:
int hideText(int text_id)
Parameters:
- text_id: ID returned from showText()
Returns:
- 0 on success
- ERROR_INVALID_ID if text_id not found
Permissions: DISPLAY_HUD
5.1.5 showImage()
Description: Display image on HUD
Signature:
int showImage(const uint8_t* image_data, ImageConfig config)
Parameters:
struct ImageConfig {
int width, height; // Image dimensions
float x, y; // Position (0-1 normalized)
float scale; // 0.1 - 2.0
ImageFormat format; // RGBA8888, RGB888, etc.
float duration_sec; // 0 = indefinite
}
enum ImageFormat {
IMAGE_RGBA8888,
IMAGE_RGB888,
IMAGE_GRAYSCALE
}
Returns:
- Image ID
- Negative value on error
Permissions: DISPLAY_HUD
5.1.6 showOverlay()
Description: Show AR overlay (e.g., navigation arrow, object label)
Signature:
int showOverlay(OverlayType type, OverlayConfig config)
Parameters:
enum OverlayType {
OVERLAY_ARROW, // Navigation arrow
OVERLAY_BOX, // Bounding box
OVERLAY_LABEL, // Text label
OVERLAY_ICON, // Icon/symbol
OVERLAY_RETICLE // Crosshair
}
struct OverlayConfig {
float x, y, z; // 3D position (world coords)
float scale;
uint32_t color;
void* type_specific_data; // Type-specific parameters
}
Returns:
- Overlay ID
- Negative value on error
Permissions: DISPLAY_HUD
5.1.7 clearDisplay()
Description: Clear all HUD elements
Signature:
int clearDisplay()
Returns:
- 0 on success
Permissions: DISPLAY_HUD
═══════════════════════════════════════════════════════════════════
AUDIO APIs
6.1 AUDIO OUTPUT
namespace: klyra::audio::output
Purpose: Play audio through bone conduction speakers
6.1.1 initAudio()
Description: Initialize audio system
Signature:
int initAudio(AudioConfig config)
Parameters:
struct AudioConfig {
int sample_rate; // 16000, 44100, 48000
int channels; // 1 (mono), 2 (stereo)
int buffer_size; // 256, 512, 1024 frames
}
Returns:
- 0 on success
- ERROR_AUDIO_NOT_AVAILABLE
Permissions: AUDIO_OUTPUT
6.1.2 playAudio()
Description: Play audio buffer
Signature:
int playAudio(const float* buffer, int num_frames, AudioFormat format)
Parameters:
- buffer: Audio data
- num_frames: Number of audio frames
- format: MONO_16, STEREO_16, MONO_F32, STEREO_F32
Returns:
- 0 on success
- ERROR_AUDIO_BUSY if already playing
Permissions: AUDIO_OUTPUT
6.1.3 playTTS()
Description: Play text-to-speech (uses Piper TTS engine)
Signature:
int playTTS(const std::string& text, TTSConfig config)
Parameters:
struct TTSConfig {
std::string voice_model; // "en_US-amy", "en_US-ryan", etc.
float speaking_rate; // 0.5 - 2.0 (1.0 = normal)
float pitch; // 0.5 - 2.0 (1.0 = normal)
float volume; // 0.0 - 1.0
}
Returns:
- 0 on success (audio queued, plays asynchronously)
- ERROR_TTS_ENGINE_BUSY if already speaking
Example:
TTSConfig config = {"en_US-amy", 1.0, 1.0, 0.8};
klyra::audio::output::playTTS("Hello, how can I help you?", config);
Permissions: AUDIO_OUTPUT
6.1.4 setVolume()
Description: Set audio output volume
Signature:
int setVolume(float volume)
Parameters:
- volume: 0.0 (mute) to 1.0 (max)
Returns:
- 0 on success
Permissions: AUDIO_OUTPUT
6.1.5 stopAudio()
Description: Stop currently playing audio
Signature:
int stopAudio()
Returns:
- 0 on success
Permissions: AUDIO_OUTPUT
6.2 AUDIO INPUT
namespace: klyra::audio::input
Purpose: Record audio from microphones
6.2.1 startRecording()
Description: Start recording audio
Signature:
int startRecording(RecordingConfig config)
Parameters:
struct RecordingConfig {
int sample_rate; // 16000, 44100, 48000
int channels; // 1-4 (number of mics)
bool enable_aec; // Acoustic echo cancellation
bool enable_ns; // Noise suppression
RecordingCallback callback;
}
typedef void (*RecordingCallback)(const float* buffer, int num_frames, void* user_data)
Returns:
- 0 on success
- ERROR_PERMISSION_DENIED if camera/mic privacy mode active
Permissions: AUDIO_INPUT
6.2.2 stopRecording()
Description: Stop recording
Signature:
int stopRecording()
Returns:
- 0 on success
Permissions: AUDIO_INPUT
6.2.3 runSTT()
Description: Run speech-to-text on audio (uses Whisper engine)
Signature:
std::string runSTT(const float* audio_buffer, int num_frames, STTConfig config)
Parameters:
struct STTConfig {
std::string model; // "tiny", "base", "small", "medium"
std::string language; // "en", "es", "fr", "auto"
bool translate_to_english; // Translate non-English to English
}
Returns:
- Transcribed text
- Empty string on error
Example:
// Record 3 seconds of audio
std::vector<float> audio_buffer;
// ... fill buffer with recorded audio ...
STTConfig config = {"base", "auto", false};
std::string text = klyra::audio::input::runSTT(audio_buffer.data(),
audio_buffer.size(), config);
std::cout << "You said: " << text << std::endl;
Permissions: AUDIO_INPUT, AI_RUNTIME
═══════════════════════════════════════════════════════════════════
CAMERA & VISION APIs
7.1 CAMERA MANAGER
namespace: klyra::camera
Purpose: Capture photos and video, run computer vision
7.1.1 initCamera()
Description: Initialize camera system
Signature:
int initCamera(CameraConfig config)
Parameters:
struct CameraConfig {
CameraMode mode; // PHOTO, VIDEO, PREVIEW
int resolution_width; // e.g., 1920, 3840
int resolution_height; // e.g., 1080, 2160
int fps; // 30, 60, 120
bool enable_hdr;
bool enable_stabilization;
}
enum CameraMode {
CAMERA_PHOTO,
CAMERA_VIDEO,
CAMERA_PREVIEW
}
Returns:
- 0 on success
- ERROR_CAMERA_NOT_AVAILABLE
Permissions: CAMERA_READ
7.1.2 capturePhoto()
Description: Capture a photo
Signature:
int capturePhoto(const std::string& filename, PhotoConfig config)
Parameters:
struct PhotoConfig {
ImageFormat format; // JPEG, PNG, RAW
int jpeg_quality; // 1-100 (for JPEG)
bool save_to_gallery; // Auto-save to user's gallery
}
Returns:
- 0 on success
- ERROR_CAMERA_BUSY if already capturing
Example:
CameraConfig cam_config = {CAMERA_PHOTO, 3840, 2160, 30, true, false};
klyra::camera::initCamera(cam_config);
PhotoConfig photo_config = {JPEG, 95, true};
klyra::camera::capturePhoto("/storage/photo.jpg", photo_config);
Permissions: CAMERA_READ, STORAGE_WRITE
7.1.3 startVideoRecording()
Description: Start video recording
Signature:
int startVideoRecording(const std::string& filename, VideoConfig config)
Parameters:
struct VideoConfig {
int bitrate_mbps; // 5, 10, 20, 50
VideoCodec codec; // H264, H265
bool record_audio;
}
enum VideoCodec {
CODEC_H264,
CODEC_H265
}
Returns:
- 0 on success
Permissions: CAMERA_READ, AUDIO_INPUT (if recording audio), STORAGE_WRITE
7.1.4 stopVideoRecording()
Description: Stop video recording
Signature:
int stopVideoRecording()
Returns:
- 0 on success
Permissions: CAMERA_READ
7.1.5 getPreviewFrame()
Description: Get current camera preview frame (for computer vision)
Signature:
CameraFrame getPreviewFrame()
Returns:
struct CameraFrame {
uint8_t* data; // Image data (depending on format)
int width, height;
ImageFormat format;
uint64_t timestamp_us;
}
Note: Frame data is valid until next getPreviewFrame() call
Permissions: CAMERA_READ
7.2 COMPUTER VISION
namespace: klyra::vision
Purpose: Run CV models on camera frames
7.2.1 detectObjects()
Description: Run object detection (YOLOv8)
Signature:
std::vector<Detection> detectObjects(const CameraFrame& frame, ObjectDetectionConfig config)
Parameters:
struct ObjectDetectionConfig {
std::string model; // "yolov8n", "yolov8s", "yolov8m"
float confidence_threshold;// 0.25 - 0.95
int max_detections; // 1 - 100
}
struct Detection {
std::string class_name; // "person", "car", "dog", etc.
float confidence; // 0-1
float x, y, width, height; // Bounding box (normalized 0-1)
}
Returns:
- List of detected objects
- Empty list if none detected
Example:
auto frame = klyra::camera::getPreviewFrame();
ObjectDetectionConfig config = {"yolov8n", 0.5, 10};
auto detections = klyra::vision::detectObjects(frame, config);
for (const auto& det : detections) {
std::cout << "Detected: " << det.class_name
<< " (" << (det.confidence * 100) << "%)" << std::endl;
}
Permissions: CAMERA_READ, AI_RUNTIME
7.2.2 runOCR()
Description: Extract text from image (Tesseract OCR)
Signature:
std::string runOCR(const CameraFrame& frame, OCRConfig config)
Parameters:
struct OCRConfig {
std::string language; // "eng", "spa", "fra", "deu", etc.
bool filter_numbers_only; // Extract only numbers (for receipts, etc.)
}
Returns:
- Extracted text
- Empty string if no text detected
Permissions: CAMERA_READ, AI_RUNTIME
7.2.3 detectFaces()
Description: Detect faces in frame (optional, privacy-sensitive)
Signature:
std::vector<FaceDetection> detectFaces(const CameraFrame& frame)
Returns:
struct FaceDetection {
float x, y, width, height; // Face bounding box
float confidence;
// Note: No face recognition, just detection
}
Note: No face embeddings or recognition. Detection only.
Permissions: CAMERA_READ, FACE_DETECTION (special permission)
═══════════════════════════════════════════════════════════════════
AI RUNTIME APIs
8.1 AI ENGINE
namespace: klyra::ai
Purpose: Run AI models (LLM, embeddings, etc.)
8.1.1 initAI()
Description: Initialize AI runtime
Signature:
int initAI()
Returns:
- 0 on success
- ERROR_AI_ENGINE_NOT_AVAILABLE
Permissions: AI_RUNTIME
8.1.2 loadModel()
Description: Load AI model into memory
Signature:
int loadModel(const std::string& model_name, ModelConfig config)
Parameters:
struct ModelConfig {
ModelType type; // LLM, EMBEDDING, VISION
int context_length; // For LLM (512, 1024, 2048, 4096)
int num_threads; // 1-8 (CPU threads)
bool use_gpu; // Use GPU acceleration if available
}
enum ModelType {
MODEL_LLM,
MODEL_EMBEDDING,
MODEL_VISION
}
Returns:
- Model handle (>0)
- Negative value on error
Example:
ModelConfig config = {MODEL_LLM, 2048, 4, true};
int model_handle = klyra::ai::loadModel("llama-3b-q4", config);
Permissions: AI_RUNTIME
8.1.3 runInference()
Description: Run inference on loaded model
Signature:
std::string runInference(int model_handle, const std::string& prompt, InferenceConfig config)
Parameters:
struct InferenceConfig {
int max_tokens; // Max tokens to generate (1-512)
float temperature; // 0.0-2.0 (0.7 typical)
float top_p; // 0.0-1.0 (nucleus sampling)
int top_k; // 1-100 (top-k sampling)
std::string stop_sequence; // Stop generation when this appears
}
Returns:
- Generated text
- Empty string on error
Example:
InferenceConfig config = {256, 0.7, 0.9, 40, "\n"};
std::string response = klyra::ai::runInference(model_handle,
"What is the weather like?", config);
std::cout << "AI: " << response << std::endl;
Permissions: AI_RUNTIME
8.1.4 runInferenceStreaming()
Description: Run inference with streaming output (token by token)
Signature:
int runInferenceStreaming(int model_handle, const std::string& prompt,
InferenceConfig config, TokenCallback callback)
Callback:
typedef void (*TokenCallback)(const std::string& token, bool is_final, void* user_data)
Parameters:
- token: Generated token
- is_final: True if this is the last token
Returns:
- 0 on success
- Negative value on error
Permissions: AI_RUNTIME
8.1.5 unloadModel()
Description: Unload model from memory
Signature:
int unloadModel(int model_handle)
Returns:
- 0 on success
Permissions: AI_RUNTIME
8.2 EMBEDDINGS
namespace: klyra::ai::embed
Purpose: Generate text embeddings for semantic search
8.2.1 generateEmbedding()
Description: Generate embedding vector for text
Signature:
std::vector<float> generateEmbedding(const std::string& text, const std::string& model)
Parameters:
- text: Input text
- model: "all-MiniLM-L6-v2", "paraphrase-multilingual", etc.
Returns:
- Embedding vector (typically 384 dimensions)
- Empty vector on error
Example:
auto embedding = klyra::ai::embed::generateEmbedding("Hello world", "all-MiniLM-L6-v2");
std::cout << "Embedding dimension: " << embedding.size() << std::endl;
Permissions: AI_RUNTIME
8.2.2 computeSimilarity()
Description: Compute cosine similarity between two embeddings
Signature:
float computeSimilarity(const std::vector<float>& embedding1,
const std::vector<float>& embedding2)
Returns:
- Similarity score: 0.0 (completely different) to 1.0 (identical)
Permissions: AI_RUNTIME
═══════════════════════════════════════════════════════════════════
MEMORY & RAG APIs
9.1 RAG (RETRIEVAL-AUGMENTED GENERATION)
namespace: klyra::rag
Purpose: Store and retrieve documents for AI context
9.1.1 initRAG()
Description: Initialize RAG system
Signature:
int initRAG(RAGConfig config)
Parameters:
struct RAGConfig {
std::string index_path; // Path to store FAISS index
std::string model; // Embedding model
int max_documents; // Max docs to store (1000-100000)
}
Returns:
- 0 on success
- ERROR_RAG_INIT_FAILED
Permissions: DATA_RAG
9.1.2 addDocument()
Description: Add document to RAG index
Signature:
int addDocument(const std::string& doc_id, const std::string& text,
const std::map<std::string, std::string>& metadata)
Parameters:
- doc_id: Unique document ID
- text: Document text (will be chunked automatically)
- metadata: Optional metadata (e.g., {"source": "manual.pdf", "page": "5"})
Returns:
- 0 on success
- Negative value on error
Example:
std::map<std::string, std::string> metadata = {
{"source", "manual.pdf"},
{"topic", "safety"}
};
klyra::rag::addDocument("doc_001", "Safety procedures: ...", metadata);
Permissions: DATA_RAG
9.1.3 searchDocuments()
Description: Search for relevant documents
Signature:
std::vector<RAGResult> searchDocuments(const std::string& query, int top_k)
Parameters:
- query: Search query (natural language)
- top_k: Number of results to return (1-20)
Returns:
struct RAGResult {
std::string doc_id;
std::string text_chunk;
float relevance_score; // 0-1
std::map<std::string, std::string> metadata;
}
Example:
auto results = klyra::rag::searchDocuments("How do I charge the device?", 5);
for (const auto& result : results) {
std::cout << "Doc: " << result.doc_id << std::endl;
std::cout << "Relevance: " << result.relevance_score << std::endl;
std::cout << "Text: " << result.text_chunk << std::endl;
}
Permissions: DATA_RAG
9.1.4 deleteDocument()
Description: Remove document from index
Signature:
int deleteDocument(const std::string& doc_id)
Returns:
- 0 on success
- ERROR_DOC_NOT_FOUND
Permissions: DATA_RAG
9.2 USER MEMORY
namespace: klyra::memory
Purpose: Store and retrieve user preferences, context, history
9.2.1 storeMemory()
Description: Store key-value memory
Signature:
int storeMemory(const std::string& key, const std::string& value, MemoryDomain domain)
Parameters:
enum MemoryDomain {
MEMORY_SHORT_TERM, // Cleared daily
MEMORY_MID_TERM, // Cleared weekly
MEMORY_LONG_TERM, // Persistent
MEMORY_CONVERSATION // Current conversation only
}
Example:
klyra::memory::storeMemory("user_name", "Alex", MEMORY_LONG_TERM);
klyra::memory::storeMemory("last_query", "weather", MEMORY_SHORT_TERM);
Permissions: DATA_MEMORY
9.2.2 retrieveMemory()
Description: Retrieve stored memory
Signature:
std::string retrieveMemory(const std::string& key, MemoryDomain domain)
Returns:
- Stored value
- Empty string if key not found
Permissions: DATA_MEMORY
9.2.3 clearMemory()
Description: Clear memories (by domain)
Signature:
int clearMemory(MemoryDomain domain)
Returns:
- 0 on success
Permissions: DATA_MEMORY
═══════════════════════════════════════════════════════════════════
SKILL FRAMEWORK APIs
10.1 SKILL MANAGER
namespace: klyra::skills
Purpose: Load, run, and manage third-party skills
10.1.1 loadSkill()
Description: Load a skill
Signature:
int loadSkill(const std::string& skill_path)
Parameters:
- skill_path: Path to skill directory (containing manifest.json)
Returns:
- Skill ID (>0)
- Negative value on error
Permissions: SYSTEM (private API, used by system only)
10.1.2 runSkill()
Description: Execute a skill
Signature:
int runSkill(int skill_id, const std::map<std::string, std::string>& parameters)
Parameters:
- skill_id: ID from loadSkill()
- parameters: Skill-specific parameters
Returns:
- 0 on success
- Negative value on error
Example:
int skill_id = klyra::skills::loadSkill("/skills/translator");
std::map<std::string, std::string> params = {
{"text", "Hello"},
{"from", "en"},
{"to", "es"}
};
klyra::skills::runSkill(skill_id, params);
Permissions: PUBLIC (skills run in sandboxed environment)
10.1.3 getSkillList()
Description: Get list of installed skills
Signature:
std::vector<SkillInfo> getSkillList()
Returns:
struct SkillInfo {
int skill_id;
std::string name;
std::string version;
std::string author;
std::vector<std::string> permissions;
}
Permissions: PUBLIC
10.2 SKILL DEVELOPMENT APIs
For skills written in Python:
from klyra_sdk import Skill, Event
class MySkill(Skill):
def on_start(self):
"""Called when skill starts"""
print("Skill started")
def on_voice(self, text):
"""Called when user speaks"""
print(f"User said: {text}")
self.speak(f"You said {text}")
def on_gesture(self, gesture_type):
"""Called on gesture detection"""
if gesture_type == "wave":
self.show_text("Hello!")
Key SDK functions:
self.speak(text)- TTS outputself.show_text(text, duration)- Display text on HUDself.get_sensor_data(sensor_type)- Read sensorself.run_ai(prompt, max_tokens)- Run AI inferenceself.capture_photo()- Capture photoself.search_rag(query)- Search RAG documents
═══════════════════════════════════════════════════════════════════
POWER & THERMAL APIs
11.1 POWER MANAGER
namespace: klyra::power
11.1.1 getBatteryStatus()
Description: Get battery status
Signature:
BatteryStatus getBatteryStatus()
Returns:
struct BatteryStatus {
int percentage; // 0-100
float voltage_v; // Actual voltage
int current_ma; // Current draw (mA)
bool is_charging;
int time_to_full_min; // Minutes to full charge (0 if not charging)
int time_to_empty_min; // Minutes to empty (0 if charging)
float temperature_c; // Battery temperature
}
Permissions: PUBLIC
11.1.2 setPowerMode()
Description: Set power management mode
Signature:
int setPowerMode(PowerMode mode)
Parameters:
enum PowerMode {
POWER_PERFORMANCE, // Max performance, faster battery drain
POWER_BALANCED, // Balance performance and battery life
POWER_SAVER // Extend battery life, reduced performance
}
Returns:
- 0 on success
Permissions: POWER_MANAGE
11.1.3 registerBatteryCallback()
Description: Get notified of battery events
Signature:
int registerBatteryCallback(BatteryCallback callback, void* user_data)
Callback:
typedef void (*BatteryCallback)(BatteryEvent event, void* user_data)
enum BatteryEvent {
BATTERY_LOW, // <15%
BATTERY_CRITICAL, // <5%
BATTERY_CHARGING,
BATTERY_FULL,
BATTERY_TEMP_HIGH // >45°C
}
Permissions: PUBLIC
11.2 THERMAL MANAGER
namespace: klyra::thermal
11.2.1 getTemperature()
Description: Get device temperature
Signature:
ThermalStatus getTemperature()
Returns:
struct ThermalStatus {
float cpu_temp_c;
float battery_temp_c;
float ambient_temp_c;
ThermalState state;
}
enum ThermalState {
THERMAL_NORMAL, // <42°C
THERMAL_WARM, // 42-45°C
THERMAL_HOT, // 45-48°C
THERMAL_CRITICAL // >48°C (throttling active)
}
Permissions: PUBLIC
11.2.2 registerThermalCallback()
Description: Get notified of thermal events
Signature:
int registerThermalCallback(ThermalCallback callback, void* user_data)
Callback:
typedef void (*ThermalCallback)(ThermalState state, void* user_data)
Permissions: PUBLIC
═══════════════════════════════════════════════════════════════════
CONNECTIVITY APIs
12.1 BLUETOOTH
namespace: klyra::bluetooth
12.1.1 scan()
Description: Scan for Bluetooth devices
Signature:
std::vector<BluetoothDevice> scan(int duration_sec)
Returns:
struct BluetoothDevice {
std::string name;
std::string address; // MAC address
int rssi; // Signal strength
bool paired;
}
Permissions: BLUETOOTH
12.1.2 pair()
Description: Pair with a Bluetooth device
Signature:
int pair(const std::string& address)
Returns:
- 0 on success
- ERROR_PAIRING_FAILED
Permissions: BLUETOOTH
12.1.3 connect()
Description: Connect to paired device
Signature:
int connect(const std::string& address, BluetoothProfile profile)
Parameters:
enum BluetoothProfile {
BT_PROFILE_A2DP, // Audio streaming
BT_PROFILE_HFP, // Hands-free
BT_PROFILE_BLE_GATT // BLE services
}
Returns:
- 0 on success
- ERROR_CONNECTION_FAILED
Permissions: BLUETOOTH
12.2 WI-FI
namespace: klyra::wifi
12.2.1 scan()
Description: Scan for Wi-Fi networks
Signature:
std::vector<WiFiNetwork> scan()
Returns:
struct WiFiNetwork {
std::string ssid;
int signal_strength; // 0-100
bool is_secured;
WiFiSecurity security_type;
}
enum WiFiSecurity {
WIFI_OPEN,
WIFI_WPA2,
WIFI_WPA3
}
Permissions: WIFI
12.2.2 connect()
Description: Connect to Wi-Fi network
Signature:
int connect(const std::string& ssid, const std::string& password)
Returns:
- 0 on success
- ERROR_WIFI_AUTH_FAILED if password incorrect
- ERROR_WIFI_NOT_FOUND if SSID not available
Permissions: WIFI
12.2.3 disconnect()
Description: Disconnect from Wi-Fi
Signature:
int disconnect()
Permissions: WIFI
12.2.4 getConnectionStatus()
Description: Check Wi-Fi connection status
Signature:
WiFiStatus getConnectionStatus()
Returns:
struct WiFiStatus {
bool is_connected;
std::string ssid;
int signal_strength;
std::string ip_address;
int link_speed_mbps;
}
Permissions: WIFI
12.3 INTERNET
namespace: klyra::net
12.3.1 httpGet()
Description: Perform HTTP GET request
Signature:
std::string httpGet(const std::string& url, const std::map<std::string, std::string>& headers)
Returns:
- Response body (as string)
- Empty string on error
Example:
auto response = klyra::net::httpGet("https://api.weather.com/current", {});
std::cout << "Response: " << response << std::endl;
Permissions: NETWORK_INTERNET
12.3.2 httpPost()
Description: Perform HTTP POST request
Signature:
std::string httpPost(const std::string& url, const std::string& body,
const std::map<std::string, std::string>& headers)
Permissions: NETWORK_INTERNET
═══════════════════════════════════════════════════════════════════
CLOUD & SYNC APIs
13.1 CLOUD STORAGE
namespace: klyra::cloud
13.1.1 uploadFile()
Description: Upload file to GROOT FORCE Cloud
Signature:
int uploadFile(const std::string& local_path, const std::string& cloud_path)
Returns:
- 0 on success
- ERROR_CLOUD_UPLOAD_FAILED
Permissions: CLOUD_SYNC
13.1.2 downloadFile()
Description: Download file from cloud
Signature:
int downloadFile(const std::string& cloud_path, const std::string& local_path)
Returns:
- 0 on success
- ERROR_CLOUD_DOWNLOAD_FAILED
Permissions: CLOUD_SYNC
13.1.3 syncRAG()
Description: Sync RAG index with cloud
Signature:
int syncRAG(SyncDirection direction)
Parameters:
enum SyncDirection {
SYNC_UPLOAD, // Local -> Cloud
SYNC_DOWNLOAD, // Cloud -> Local
SYNC_BIDIRECTIONAL // Merge both
}
Returns:
- 0 on success
Permissions: CLOUD_SYNC, DATA_RAG
13.2 OTA UPDATES
namespace: klyra::ota
13.2.1 checkForUpdate()
Description: Check if firmware update available
Signature:
OTAUpdateInfo checkForUpdate()
Returns:
struct OTAUpdateInfo {
bool update_available;
std::string version;
std::string release_notes;
int size_mb;
}
Permissions: PUBLIC
13.2.2 downloadUpdate()
Description: Download firmware update
Signature:
int downloadUpdate(UpdateCallback callback)
Callback:
typedef void (*UpdateCallback)(int progress_percent, void* user_data)
Returns:
- 0 on success (update ready to install)
Permissions: SYSTEM_OTA
13.2.3 installUpdate()
Description: Install downloaded update (requires reboot)
Signature:
int installUpdate()
Returns:
- 0 on success (device will reboot to install)
Permissions: SYSTEM_OTA
═══════════════════════════════════════════════════════════════════
SECURITY & PRIVACY APIs
14.1 PRIVACY MANAGER
namespace: klyra::privacy
14.1.1 setPrivacyMode()
Description: Enable/disable privacy features
Signature:
int setPrivacyMode(PrivacyMode mode)
Parameters:
enum PrivacyMode {
PRIVACY_NORMAL, // Standard operation
PRIVACY_GUEST, // Restricted access (no personal data)
PRIVACY_DEEP // Camera/mic disabled, no recording
}
Returns:
- 0 on success
Permissions: PRIVACY_CONTROL
14.1.2 getPrivacyStatus()
Description: Get current privacy status
Signature:
PrivacyStatus getPrivacyStatus()
Returns:
struct PrivacyStatus {
PrivacyMode mode;
bool camera_enabled;
bool mic_enabled;
bool location_enabled;
bool recording_active;
}
Permissions: PUBLIC
14.1.3 registerPrivacyCallback()
Description: Get notified when privacy settings change
Signature:
int registerPrivacyCallback(PrivacyCallback callback, void* user_data)
Callback:
typedef void (*PrivacyCallback)(PrivacyEvent event, void* user_data)
enum PrivacyEvent {
PRIVACY_CAMERA_DISABLED,
PRIVACY_MIC_DISABLED,
PRIVACY_MODE_CHANGED,
PRIVACY_RECORDING_STARTED
}
Permissions: PUBLIC
14.2 ENCRYPTION
namespace: klyra::crypto
14.2.1 encryptData()
Description: Encrypt data (AES-256-GCM)
Signature:
std::vector<uint8_t> encryptData(const std::vector<uint8_t>& plaintext,
const std::string& key_id)
Parameters:
- plaintext: Data to encrypt
- key_id: Encryption key identifier (managed by system)
Returns:
- Encrypted data
- Empty vector on error
Permissions: CRYPTO_ENCRYPT
14.2.2 decryptData()
Description: Decrypt data
Signature:
std::vector<uint8_t> decryptData(const std::vector<uint8_t>& ciphertext,
const std::string& key_id)
Returns:
- Decrypted data
- Empty vector on error
Permissions: CRYPTO_DECRYPT
═══════════════════════════════════════════════════════════════════
DEVELOPER SDK APIs
15.1 LOGGING
namespace: klyra::log
15.1.1 log()
Description: Write to system log
Signature:
void log(LogLevel level, const std::string& tag, const std::string& message)
Parameters:
enum LogLevel {
LOG_VERBOSE,
LOG_DEBUG,
LOG_INFO,
LOG_WARN,
LOG_ERROR
}
Example:
klyra::log::log(LOG_INFO, "MySkill", "Processing user request");
Permissions: PUBLIC
15.2 DEBUGGING
namespace: klyra::debug
15.2.1 getPerformanceMetrics()
Description: Get performance metrics
Signature:
PerformanceMetrics getPerformanceMetrics()
Returns:
struct PerformanceMetrics {
float cpu_usage_percent;
int memory_used_mb;
int memory_free_mb;
float fps; // Display FPS
int ai_inference_time_ms; // Last AI inference time
}
Permissions: DEBUG
═══════════════════════════════════════════════════════════════════
ERROR CODES & HANDLING
16.1 ERROR CODES
All API functions return int status codes. 0 = success, negative = error.
Common Error Codes:
// General #define ERROR_SUCCESS 0 #define ERROR_UNKNOWN -1 #define ERROR_INVALID_PARAMETER -2 #define ERROR_OUT_OF_MEMORY -3 #define ERROR_TIMEOUT -4 #define ERROR_NOT_IMPLEMENTED -5
// Permissions #define ERROR_PERMISSION_DENIED -100 #define ERROR_INVALID_PERMISSION -101
// Hardware #define ERROR_HARDWARE_FAILURE -200 #define ERROR_SENSOR_NOT_AVAILABLE -201 #define ERROR_DISPLAY_NOT_AVAILABLE -202 #define ERROR_CAMERA_NOT_AVAILABLE -203 #define ERROR_AUDIO_NOT_AVAILABLE -204
// AI #define ERROR_AI_ENGINE_NOT_AVAILABLE -300 #define ERROR_MODEL_LOAD_FAILED -301 #define ERROR_INFERENCE_FAILED -302 #define ERROR_AI_ENGINE_BUSY -303
// Network #define ERROR_NETWORK_UNAVAILABLE -400 #define ERROR_CONNECTION_FAILED -401 #define ERROR_WIFI_AUTH_FAILED -402 #define ERROR_CLOUD_UPLOAD_FAILED -403 #define ERROR_CLOUD_DOWNLOAD_FAILED -404
// System #define ERROR_SYSTEM_BUSY -500 #define ERROR_BATTERY_TOO_LOW -501 #define ERROR_THERMAL_LIMIT -502
16.2 ERROR HANDLING EXAMPLE
int result = klyra::camera::capturePhoto("/storage/photo.jpg", config);
if (result == ERROR_SUCCESS) {
std::cout << "Photo captured successfully!" << std::endl;
} else if (result == ERROR_CAMERA_NOT_AVAILABLE) {
std::cerr << "Camera not available. Check permissions." << std::endl;
} else if (result == ERROR_PERMISSION_DENIED) {
std::cerr << "Camera permission denied." << std::endl;
} else {
std::cerr << "Unknown error: " << result << std::endl;
}
16.3 EXCEPTION HANDLING
Some APIs (particularly Python SDK) throw exceptions:
try:
result = klyra.ai.run_inference(model, prompt, config)
print(f"AI Response: {result}")
except klyra.PermissionDenied:
print("AI permission denied. Check manifest.")
except klyra.AIEngineBusy:
print("AI engine busy. Try again later.")
except klyra.Error as e:
print(f"Error: {e}")
═══════════════════════════════════════════════════════════════════
APPENDIX A: COMPLETE API INDEX (Alphabetical)
A
- audio::input::runSTT()
- audio::input::startRecording()
- audio::input::stopRecording()
- audio::output::initAudio()
- audio::output::playAudio()
- audio::output::playTTS()
- audio::output::setVolume()
- audio::output::stopAudio()
B
- bluetooth::connect()
- bluetooth::pair()
- bluetooth::scan()
C
- camera::capturePhoto()
- camera::getPreviewFrame()
- camera::initCamera()
- camera::startVideoRecording()
- camera::stopVideoRecording()
- cloud::downloadFile()
- cloud::syncRAG()
- cloud::uploadFile()
- crypto::decryptData()
- crypto::encryptData()
D
- debug::getPerformanceMetrics()
- display::clearDisplay()
- display::hideText()
- display::initDisplay()
- display::setBrightness()
- display::showImage()
- display::showOverlay()
- display::showText()
H
- hal::getHardwareStatus()
- hal::initHardware()
L
- log::log()
M
- memory::clearMemory()
- memory::retrieveMemory()
- memory::storeMemory()
- mode::getCurrentMode()
- mode::registerModeCallback()
- mode::setMode()
N
- net::httpGet()
- net::httpPost()
O
- ota::checkForUpdate()
- ota::downloadUpdate()
- ota::installUpdate()
P
- power::getBatteryStatus()
- power::registerBatteryCallback()
- power::setPowerMode()
- privacy::getPrivacyStatus()
- privacy::registerPrivacyCallback()
- privacy::setPrivacyMode()
R
- rag::addDocument()
- rag::deleteDocument()
- rag::initRAG()
- rag::searchDocuments()
S
- sensors::env::initEnvSensor()
- sensors::env::readEnvSensor()
- sensors::health::initHealthSensor()
- sensors::health::readHealthSensor()
- sensors::imu::initIMU()
- sensors::imu::readIMU()
- sensors::imu::registerIMUCallback()
- sensors::lidar::initLiDAR()
- sensors::lidar::readLiDAR()
- sensors::tof::initToF()
- sensors::tof::readToF()
- sensors::tof::registerToFCallback()
- skills::getSkillList()
- skills::loadSkill()
- skills::runSkill()
- system::getSystemInfo()
- system::reboot()
- system::registerSystemCallback()
- system::shutdown()
T
- thermal::getTemperature()
- thermal::registerThermalCallback()
V
- vision::detectFaces()
- vision::detectObjects()
- vision::runOCR()
W
- wifi::connect()
- wifi::disconnect()
- wifi::getConnectionStatus()
- wifi::scan()
A
- ai::embed::computeSimilarity()
- ai::embed::generateEmbedding()
- ai::initAI()
- ai::loadModel()
- ai::runInference()
- ai::runInferenceStreaming()
- ai::unloadModel()
═══════════════════════════════════════════════════════════════════
APPENDIX B: QUICK START EXAMPLES
B.1 Display "Hello World" on HUD
#include <klyra/display.h>
int main() {
klyra::display::initDisplay();
TextConfig config = {0.5, 0.5, 1.0, 0xFFFFFFFF, ALIGN_CENTER, 5.0};
klyra::display::showText("Hello GROOT FORCE!", config);
// Text will disappear after 5 seconds
return 0;
}
B.2 Capture Photo & Run OCR
#include <klyra/camera.h>
#include <klyra/vision.h>
int main() {
// Initialize camera
CameraConfig cam_config = {CAMERA_PHOTO, 1920, 1080, 30, false, false};
klyra::camera::initCamera(cam_config);
// Capture photo
PhotoConfig photo_config = {JPEG, 85, false};
klyra::camera::capturePhoto("/storage/receipt.jpg", photo_config);
// Run OCR
auto frame = klyra::camera::getPreviewFrame();
OCRConfig ocr_config = {"eng", false};
std::string text = klyra::vision::runOCR(frame, ocr_config);
std::cout << "Extracted text: " << text << std::endl;
return 0;
}
B.3 Simple Voice Assistant
#include <klyra/audio.h>
#include <klyra/ai.h>
int main() {
// Init audio and AI
AudioConfig audio_config = {16000, 1, 512};
klyra::audio::output::initAudio(audio_config);
klyra::ai::initAI();
// Load AI model
ModelConfig model_config = {MODEL_LLM, 2048, 4, true};
int model = klyra::ai::loadModel("llama-3b-q4", model_config);
// Record audio (3 seconds)
std::vector<float> audio_buffer;
// ... (recording code omitted for brevity) ...
// Convert speech to text
STTConfig stt_config = {"base", "en", false};
std::string user_text = klyra::audio::input::runSTT(
audio_buffer.data(), audio_buffer.size(), stt_config);
// Run AI inference
InferenceConfig inf_config = {256, 0.7, 0.9, 40, ""};
std::string ai_response = klyra::ai::runInference(model, user_text, inf_config);
// Speak response
TTSConfig tts_config = {"en_US-amy", 1.0, 1.0, 0.8};
klyra::audio::output::playTTS(ai_response, tts_config);
return 0;
}
B.4 Object Detection & HUD Overlay
#include <klyra/camera.h>
#include <klyra/vision.h>
#include <klyra/display.h>
int main() {
// Init camera
CameraConfig config = {CAMERA_PREVIEW, 1920, 1080, 30, false, false};
klyra::camera::initCamera(config);
klyra::display::initDisplay();
while (true) {
// Get camera frame
auto frame = klyra::camera::getPreviewFrame();
// Run object detection
ObjectDetectionConfig det_config = {"yolov8n", 0.5, 10};
auto detections = klyra::vision::detectObjects(frame, det_config);
// Clear previous overlays
klyra::display::clearDisplay();
// Draw bounding boxes
for (const auto& det : detections) {
// Show label
TextConfig text_config = {det.x, det.y, 0.8, 0xFF00FFFF,
ALIGN_LEFT, 0.0};
klyra::display::showText(det.class_name, text_config);
}
// Sleep 100ms
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
return 0;
}
═══════════════════════════════════════════════════════════════════
APPENDIX C: PYTHON SDK QUICK REFERENCE
The Python SDK provides a simpler, higher-level interface:
from klyra_sdk import Skill, sensors, display, audio, ai, vision
class MyAssistant(Skill):
def on_start(self):
"""Initialize your skill"""
self.model = ai.load_model("llama-3b-q4")
display.show_text("Assistant Ready", duration=3)
def on_voice(self, text):
"""Handle voice input"""
response = ai.run_inference(self.model, text, max_tokens=256)
audio.speak(response)
def on_gesture(self, gesture):
"""Handle gestures"""
if gesture == "wave":
display.show_text("Hello!")
def on_button_press(self, button):
"""Handle button presses"""
if button == "capture":
photo = vision.capture_photo()
text = vision.run_ocr(photo)
audio.speak(f"I see: {text}")
# Run the skill
if __name__ == "__main__":
skill = MyAssistant()
skill.run()
═══════════════════════════════════════════════════════════════════
DOCUMENT APPROVAL
Prepared by: Software Engineering Team Approved by: [Name], VP Engineering Date: November 2025 Version: API v2.0 Next Review: May 2026
═══════════════════════════════════════════════════════════════════
END OF DOCUMENT