CosmicAsyncSDK class
This page describes the CosmicAsyncSDK C++ class and its generic public methods. For each specific protocol APIs, please refer to the corresponding sections.
- group CosmicSDK C++ non-blocking API
High-level non-blocking C++ interface to Binho devices.
This module provides a non-blocking C++ API. It allows users to connect to Binho devices and perform various operations asynchronously. Users must set up a response callback using the
onResponsemethod to handle incoming data from the device.Functions
-
uint16_t getAnalogMeasurements(uint16_t id)
Reads all analog voltage measurements from the host adapter in a single USB transaction.
Returns a response containing voltages for all protocol domains: the shared I2C/SPI/UART/GPIO rail, and the I3C HV and LV rails. Callers are responsible for extracting the relevant field from the response payload via the GetAnalogMeasurementsResponse structure.
- Parameters:
id – Command Id to identify the request. Values from 1 to 65535 are valid. 0 is reserved for notifications.
- Return values:
SUCCESS – The command was successfully sent to the host adapter.
SDK_ERROR_DISCONNECT – The device was disconnected or became unavailable during the operation.
-
class CosmicAsyncSDK
- #include <CosmicAsyncSDK.hpp>
This class provides a non-blocking C++ interface. It allows users to connect to Binho devices and perform various operations asynchronously. Users must set up a response callback using the onResponse method to handle incoming data from the device.
Public Functions
-
CosmicAsyncSDK()
Construct a new Cosmic Async SDK object.
-
~CosmicAsyncSDK()
Destroy the Cosmic Async SDK object.
-
uint16_t getUsbString(uint16_t id, uint8_t subCmd)
Get one USB String identified by the subcommand.
- Parameters:
id – uint16_t Command Id to identify the request. Values from 1 to 65535 are valid. 0 is reserved for notifications.
subCmd – unint8_t Subcommand to identify the USB String to be retrieved.
- Return values:
SUCCESS – The command was successfully sent to the host adapter.
SDK_ERROR_DISCONNECT – The device was disconnected or became unavailable during the operation.
-
CosmicAsyncSDK()
-
uint16_t getAnalogMeasurements(uint16_t id)