C API

This page describes the basic functions of the C API interface. For each specific protocol APIs, please refer to the corresponding sections.

group CosmicSDK C binding blocking API.

C bindings for the CosmicSDK blocking API.

This module exposes a C API suitable for C applications.

Typedefs

typedef struct CosmicSDK_Handle CosmicSDK_Handle

Opaque handle for CosmicSDK instance.

Functions

CosmicSDK_Handle *CosmicSDK_Create(int timeout_ms)

Creates a new CosmicSDK instance.

Parameters:
  • timeout_ms – Timeout in milliseconds for operations.

Returns:

Handle to the created instance

void CosmicSDK_Destroy(CosmicSDK_Handle *handle)

Destroys a CosmicSDK instance and frees associated resources.

Parameters:
  • handle – Handle to the instance to destroy

struct C_DeviceInfo
#include <CosmicSDK_API_c.h>

Structure to hold device information from C API.

Public Members

char *manufacturer

Null-terminated manufacturer string.

size_t manufacturerLength

Manufacturer string length, excluding null terminator.

char *productName

Null-terminated product name string.

size_t productNameLength

Product name string length, excluding null terminator.

char *serialNumber

Null-terminated device serial number string.

size_t serialNumberLength

Serial number string length, excluding null terminator.

char *fwVersion

Null-terminated firmware version string.

size_t fwVersionLength

Firmware version string length, excluding null terminator.

char *hwVersion

Null-terminated hardware version string.

size_t hwVersionLength

Hardware version string length, excluding null terminator.