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
-
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.
-
struct BulkGroupSupport
- #include <CosmicSDK.hpp>
One command group’s bulk-transfer support, as reported by the connected device.
One entry per protocol group (I2C, SPI, I3C, …) the connected device knows about. Populated inside BulkCapabilities::groups by getBulkCapabilities.
Public Members
-
uint8_t group = {0}
Protocol group id the entry describes (e.g. I2C = 2, SPI = 3; see the
GROUP_*constants in definitions.h).
-
uint16_t maxPayloadLength = {0}
Largest payload, in bytes, this device accepts for a single bulk command in the group. 0 if the group is not supported.
-
uint32_t commandMask = {0}
Bit N set when the command whose 7-bit value field equals N is implemented for this group.
-
uint8_t group = {0}
-
struct BulkCapabilities
- #include <CosmicSDK.hpp>
Snapshot of the connected device’s bulk-transport capabilities.
Populated by getBulkCapabilities, which queries the device once per connection and caches the result. Firmware that predates the capabilities command does not answer the query; that is reported as
supported == falsewith an empty groups list, which is the safe interpretation — treat an unqueryable device as having no bulk support rather than guessing a payload ceiling it may not honor.Public Members
-
bool queried = {false}
True once the device has answered the query for this connection. Stays false after an unanswered query, which is retried on the next call.
-
uint8_t structVersion = {0}
Wire format version of the capabilities reply, as reported by the device.
-
bool supported = {false}
True if the connected device implements the bulk-capabilities query at all.
-
std::vector<BulkGroupSupport> groups
One entry per protocol group the device reported support for.
-
bool queried = {false}
-
using NotificationCallback = std::function<void(const Notification&)>
-
class CosmicSDK