CosmicSDK class

This page describes the CosmicSDK C++ class and its generic public methods. For each specific protocol APIs, please refer to the corresponding sections.

group CosmicSDK C++ blocking API

High-level blocking C++ interface to Binho devices.

This module provides the main blocking C++ API used to connect to a Binho host adapter, configure it, and perform different operations to interact with downstream devices over different interfaces and protocols such as I2C, I3C, SPI, UART and GPIOs.

class CosmicSDK
#include <CosmicSDK.hpp>

This class provides a blocking C++ interface. This means that each method call will wait for the operation to complete before returning. The returned values are passed directly back to the caller through a return value and output parameters.

Public Types

using NotificationCallback = std::function<void(const Notification&)>

Type definition for notification callback functions.

Public Functions

CosmicSDK(int timeout = -1)

Construct a new Cosmic SDK object.

Parameters:

timeout – Timeout in milliseconds for operations. Use -1 for no timeout

~CosmicSDK()

Destructor: cleans up the CosmicSDK and its components.

uint16_t getUsbString(std::vector<uint8_t> &outData, uint8_t subCmd)

Gets the Usb String object.

Parameters:
  • outData – The data received from the device

  • subCmd – The sub-command to be sent to the device

Returns:

The status code of the operation

struct DeviceInfo
#include <CosmicSDK.hpp>

Structure to hold device information.

Public Members

std::string manufacturer

Manufacturer string.

std::string productName

Product name string.

std::string serialNumber

Device serial number string.

std::string fwVersion

Firmware version string.

std::string hwVersion

Hardware version string.