Device Data Hub C API
Macros | Typedefs | Functions
common.h File Reference

Common types and utilities for Device Data Hub C Client API. More...

#include <stdbool.h>
#include <stdint.h>
Include dependency graph for common.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define DH_ERR_INVALID_PARAMS   ((DHErrorCode)0)
 Invalid or empty parameters provided to the API.
 
#define DH_ERROR_DATA_TOO_BIG   ((DHErrorCode)1)
 Request exceeds the maximum allowed size.
 
#define DH_ERR_NOT_CONNECTED    ((DHErrorCode)2)
 Operation requires connection but client is not connected.
 
#define DH_ERR_ALREADY_CONNECTED   ((DHErrorCode)3)
 Attempt to connect when already connected.
 
#define DH_ERR_UNKNOWN_ERROR   ((DHErrorCode)4)
 Unspecified or unknown error occurred.
 
#define DH_ERR_INTERNAL_ERROR   ((DHErrorCode)5)
 Internal library error or unexpected condition.
 
#define DH_ERR_INVALID_ID    ((DHErrorCode)6)
 Invalid identifier provided (subscription, production, etc.)
 
#define DH_ERR_INVALID_TOPIC   ((DHErrorCode)7)
 Topic with the given name does not exist.
 
#define DH_ERR_NOT_INITIALIZED   ((DHErrorCode)8)
 Component or resource not properly initialized.
 
#define DH_ERR_MAX_CLIENTS    ((DHErrorCode)9)
 Maximum number of clients for the server has been reached.
 
#define DH_ERR_MAX_CONNECTIONS    ((DHErrorCode)10)
 Maximum number of connections for this username exceeded.
 
#define DH_ERR_AUTHENTICATION_FAILED   ((DHErrorCode)11)
 Authentication process failed.
 
#define DH_ERR_TOPIC_EXISTS   ((DHErrorCode)12)
 Attempt to create a topic that already exists.
 
#define DH_ERR_MAX_TOPIC   ((DHErrorCode)13)
 Maximum number of topics exceeded.
 
#define DH_ERR_CONNECTION_ERROR   ((DHErrorCode)14)
 Network or communication connection error.
 
#define DH_ERR_INVALID_DATA   ((DHErrorCode)15)
 Invalid data format or content provided.
 
#define DH_ERR_INVALID_INSTANCE   ((DHErrorCode)16)
 Instance does not exist.
 
#define DH_ERR_INVALID_KEYS   ((DHErrorCode)17)
 Invalid instance keys provided.
 
#define DH_ERR_INVALID_SUBSCRIPTION   ((DHErrorCode)18)
 Subscription does not exist.
 
#define DH_ERR_INSTANCE_EXISTS    ((DHErrorCode)19)
 Attempt to create an instance that already exists.
 
#define DH_ERR_INSTANCES_NOT_SUPPORTED   ((DHErrorCode)20)
 Topic does not support instances.
 
#define DH_ERR_MAX_INSTANCES    ((DHErrorCode)21)
 Maximum number of instances exceeded for the topic.
 
#define DH_ERR_MAX_SUBSCRIPTIONS    ((DHErrorCode)22)
 Maximum number of subscriptions exceeded for this client.
 
#define DH_ERR_AUTHORIZATION_FAILED    ((DHErrorCode)23)
 Insufficient permissions for the requested operation.
 
#define DH_ERR_MAX_PRODUCTIONS    ((DHErrorCode)24)
 Maximum number of data productions exceeded for this client.
 
#define DH_ERR_INVALID_PRODUCTION    ((DHErrorCode)25)
 Production ID not found or not registered with RegisterProduction()
 
#define DH_ERR_INVALID_REQUEST   ((DHErrorCode)26)
 Malformed or invalid request.
 
#define DH_ERR_CREDENTIAL_ERROR   ((DHErrorCode)27)
 Invalid or missing credentials.
 

Typedefs

typedef uint32_t DHErrorCode
 API error codes enumeration. More...
 
typedef struct DHError_t DHError
 Opaque error. More...
 
typedef struct DHTimestamp_t DHTimestamp
 Opaque UTC timestamp. More...
 
typedef struct DHTopic_t DHTopic
 Opaque topic. More...
 
typedef struct DHTopicData_t DHTopicData
 Opaque topic data. More...
 
typedef struct DHInstanceKeys_t DHInstanceKeys
 Opaque instance keys. More...
 
typedef struct DHTopicInstance_t DHTopicInstance
 Opaque topic instance. More...
 
typedef struct DHTopicSample_t DHTopicSample
 Opaque topic sample. More...
 
typedef struct DHTopicList_t DHTopicList
 Opaque topic list. More...
 
typedef struct DHTopicInstanceList_t DHTopicInstanceList
 Opaque topic instance list. More...
 

Functions

const char * dh_error_get_message (const DHError *err)
 Gets the error message from an error object. More...
 
DHErrorCode dh_error_get_code (const DHError *err)
 Gets the error code from an error object. More...
 
const char * dh_error_code_to_string (DHErrorCode code)
 Converts an error code to its string representation. More...
 
const char * dh_error_to_string (const DHError *err)
 Gets a string representation of the complete error. More...
 
void dh_error_destroy (DHError *err)
 Destroys an error object. More...
 
DHTimestamp * dh_timestamp_create (void)
 Creates a timestamp set to the current time. More...
 
void dh_timestamp_set_with_sec (DHTimestamp *timestamp, int64_t seconds)
 Sets the timestamp from a Unix epoch value in seconds. More...
 
void dh_timestamp_set_with_ms (DHTimestamp *timestamp, int64_t milliseconds)
 Sets the timestamp from a Unix epoch value in milliseconds. More...
 
void dh_timestamp_set_current (DHTimestamp *timestamp)
 Updates the timestamp to the current time. More...
 
int64_t dh_timestamp_get_as_sec (const DHTimestamp *timestamp)
 Gets the timestamp value as seconds since Unix epoch. More...
 
int64_t dh_timestamp_get_as_ms (const DHTimestamp *timestamp)
 Gets the timestamp value as milliseconds since Unix epoch. More...
 
void dh_timestamp_destroy (DHTimestamp *timestamp)
 Destroys a timestamp. More...
 
const char * dh_topic_get_name (const DHTopic *topic)
 Gets the name of a topic. More...
 
const char * dh_topic_get_json_definition (const DHTopic *topic, DHError **error)
 Gets the topic definition as a JSON string. More...
 
void dh_topic_destroy (DHTopic *topic)
 Destroys a topic. More...
 
DHTopicData * dh_topic_data_create (void)
 Creates an empty topic data object. More...
 
void dh_topic_data_destroy (DHTopicData *topic_data)
 Destroys a topic data object. More...
 
bool dh_topic_data_set_json_data (DHTopicData *topic_data, const char *json_str, DHError **error)
 Sets the value of topic data from JSON string. More...
 
const char * dh_topic_data_get_json_data (const DHTopicData *topic_data)
 Gets the topic data value as a JSON string. More...
 
const char * dh_topic_sample_get_topic_name (const DHTopicSample *topic_sample)
 Gets the topic name from a sample. More...
 
uint64_t dh_topic_sample_get_sample_id (const DHTopicSample *topic_sample)
 Gets the sample ID. More...
 
bool dh_topic_sample_is_historical (const DHTopicSample *topic_sample)
 Checks if the sample is historical data. More...
 
const DHTimestamp * dh_topic_sample_get_timestamp (const DHTopicSample *topic_sample)
 Gets the source timestamp. More...
 
const DHTopicData * dh_topic_sample_get_data (const DHTopicSample *topic_sample)
 Gets the topic data from a sample. More...
 
DHInstanceKeys * dh_instance_keys_create (void)
 Creates an empty instance keys object. More...
 
void dh_instance_keys_destroy (DHInstanceKeys *keys)
 Destroys an instance keys object. More...
 
bool dh_instance_keys_add_string (DHInstanceKeys *keys, const char *name, const char *value, DHError **error)
 Adds a string key-value pair. More...
 
bool dh_instance_keys_add_integer (DHInstanceKeys *keys, const char *name, int64_t value, DHError **error)
 Adds an integer key-value pair. More...
 
bool dh_instance_keys_has_key (const DHInstanceKeys *keys, const char *name)
 Checks whether a key exists. More...
 
bool dh_instance_keys_get_string (const DHInstanceKeys *keys, const char *name, const char **out_value, DHError **error)
 Gets the string value of a key. More...
 
bool dh_instance_keys_get_integer (const DHInstanceKeys *keys, const char *name, int64_t *out_value, DHError **error)
 Gets the integer value of a key. More...
 
bool dh_instance_keys_remove (DHInstanceKeys *keys, const char *name, DHError **error)
 Removes a key. More...
 
const char * dh_topic_instance_get_topic_name (const DHTopicInstance *topic_instance)
 Gets the topic name of an instance. More...
 
const DHInstanceKeys * dh_topic_instance_get_keys (const DHTopicInstance *topic_instance)
 Gets the instance keys. More...
 
const char * dh_topic_instance_get_info (const DHTopicInstance *topic_instance)
 Gets the instance information. More...
 
void dh_topic_instance_destroy (DHTopicInstance *topic_instance)
 Destroys a topic instance. More...
 
uint32_t dh_topic_list_get_count (const DHTopicList *list)
 Gets the number of topics in the list. More...
 
const char * dh_topic_list_get_name (const DHTopicList *list, uint32_t index)
 Gets a topic name by index. More...
 
void dh_topic_list_destroy (DHTopicList *topic_list)
 Frees a topic list. More...
 
uint32_t dh_topic_instance_list_get_count (const DHTopicInstanceList *list)
 Gets the number of instances in the list. More...
 
const DHTopicInstance * dh_topic_instance_list_get (const DHTopicInstanceList *list, uint32_t index)
 Gets a topic instance by index. More...
 
void dh_topic_instance_list_destroy (DHTopicInstanceList *instance_list)
 Frees a topic instance list. More...
 

Detailed Description

Common types and utilities for Device Data Hub C Client API.

This file contains fundamental types, structures, and utility functions used throughout the Device Data Hub C Client library. It provides the core data structures for topics, samples, instances, and error handling.

The data model is designed around topics which are units of information used to exchange data between decoupled components (consumer/producer). Each topic can have a subset of data groups called instances, and each instance can have samples as historical data.

Error handling is centralized through the DHError structure which provides both error codes and human-readable messages.

All data values are represented as JSON strings to provide structured data handling capabilities.

Typedef Documentation

◆ DHError

typedef struct DHError_t DHError

Opaque error.

Represents an error condition with both an error code and descriptive message. This structure encapsulates error information with both an error code and message.

◆ DHErrorCode

typedef uint32_t DHErrorCode

API error codes enumeration.

Defines all possible error conditions that can occur when using the Device Data Hub C Client API.

◆ DHInstanceKeys

typedef struct DHInstanceKeys_t DHInstanceKeys

Opaque instance keys.

Represents a set of typed key-value pairs that uniquely identify a topic instance. Keys can hold either string or integer values

◆ DHTimestamp

typedef struct DHTimestamp_t DHTimestamp

Opaque UTC timestamp.

Represents a point in time with nanosecond precision. Use dh_timestamp_get_as_sec() or dh_timestamp_get_as_ms() to retrieve the value.

◆ DHTopic

typedef struct DHTopic_t DHTopic

Opaque topic.

Represents a topic on the Device Data Hub. Topics are units of information used to exchange data between components. Each topic has a definition that describes its name, payload structure, QoS settings, etc.

◆ DHTopicData

typedef struct DHTopicData_t DHTopicData

Opaque topic data.

Represents the structured data content of a topic. The data is stored internally as JSON and can be manipulated using the topic_data_* functions.

◆ DHTopicInstance

typedef struct DHTopicInstance_t DHTopicInstance

Opaque topic instance.

Represents a specific instance of a topic. Instances are identified by a combination of key-value pairs and allow topics to contain multiple separate data streams (e.g., multiple detected objects, multiple I/O ports). TopicInstance objects represent specific instances of topics identified by their keys.

◆ DHTopicInstanceList

typedef struct DHTopicInstanceList_t DHTopicInstanceList

Opaque topic instance list.

Contains an array of topic instances returned by instance listing operations. Must be freed using dh_topic_instance_list_destroy().

◆ DHTopicList

typedef struct DHTopicList_t DHTopicList

Opaque topic list.

Contains an array of topic names returned by topic listing operations. Must be freed using dh_topic_list_destroy().

◆ DHTopicSample

typedef struct DHTopicSample_t DHTopicSample

Opaque topic sample.

Represents a single data sample within a topic or topic instance. Samples contain the actual data along with metadata like timestamps.

Function Documentation

◆ dh_error_code_to_string()

const char* dh_error_code_to_string ( DHErrorCode  code)

Converts an error code to its string representation.

Returns a human-readable string name for the given error code. For example, DH_ERR_INVALID_PARAMS returns "DH_ERR_INVALID_PARAMS".

Parameters
codeThe error code to convert
Returns
The error code name as a string, or "DH_ERR_UNKNOWN_ERROR" if code is not recognized

◆ dh_error_destroy()

void dh_error_destroy ( DHError *  err)

Destroys an error object.

Frees all resources associated with the error object.

Parameters
errThe error object to destroy (can be NULL)

◆ dh_error_get_code()

DHErrorCode dh_error_get_code ( const DHError *  err)

Gets the error code from an error object.

Returns the specific error code that identifies the type of error.

Parameters
errThe error object (must not be NULL)
Returns
The error code, or DH_ERR_INVALID_PARAMS if err is invalid

◆ dh_error_get_message()

const char* dh_error_get_message ( const DHError *  err)

Gets the error message from an error object.

Returns a human-readable description of the error condition.

Parameters
errThe error object (must not be NULL)
Returns
The error message string, or NULL if err is invalid

◆ dh_error_to_string()

const char* dh_error_to_string ( const DHError *  err)

Gets a string representation of the complete error.

Returns a formatted string containing both the error code and message. The returned string is owned by the error object and should not be freed.

Parameters
errThe error object (must not be NULL)
Returns
Formatted error string, or NULL if err is invalid

◆ dh_instance_keys_add_integer()

bool dh_instance_keys_add_integer ( DHInstanceKeys *  keys,
const char *  name,
int64_t  value,
DHError **  error 
)

Adds an integer key-value pair.

Parameters
keysThe DHInstanceKeys (must not be NULL)
nameThe key name (must not be NULL)
valueThe integer value
errorOutput parameter for error details on failure (can be NULL to ignore)
Returns
true on success, false on failure

◆ dh_instance_keys_add_string()

bool dh_instance_keys_add_string ( DHInstanceKeys *  keys,
const char *  name,
const char *  value,
DHError **  error 
)

Adds a string key-value pair.

Parameters
keysThe DHInstanceKeys (must not be NULL)
nameThe key name (must not be NULL)
valueThe string value (must not be NULL)
errorOutput parameter for error details on failure (can be NULL to ignore)
Returns
true on success, false on failure

◆ dh_instance_keys_create()

DHInstanceKeys* dh_instance_keys_create ( void  )

Creates an empty instance keys object.

Returns
New DHInstanceKeys with no keys set, or NULL on memory allocation failure

◆ dh_instance_keys_destroy()

void dh_instance_keys_destroy ( DHInstanceKeys *  keys)

Destroys an instance keys object.

Parameters
keysThe DHInstanceKeys to destroy (can be NULL)

◆ dh_instance_keys_get_integer()

bool dh_instance_keys_get_integer ( const DHInstanceKeys *  keys,
const char *  name,
int64_t *  out_value,
DHError **  error 
)

Gets the integer value of a key.

Parameters
keysThe DHInstanceKeys (must not be NULL)
nameThe key name (must not be NULL)
out_valueOutput pointer set to the integer value on success (must not be NULL)
errorOutput parameter for error details on failure (can be NULL to ignore)
Returns
true on success, false if the key does not exist or is not an integer

◆ dh_instance_keys_get_string()

bool dh_instance_keys_get_string ( const DHInstanceKeys *  keys,
const char *  name,
const char **  out_value,
DHError **  error 
)

Gets the string value of a key.

Parameters
keysThe DHInstanceKeys (must not be NULL)
nameThe key name (must not be NULL)
out_valueOutput pointer set to the string value on success (must not be NULL). The returned string is owned by the DHInstanceKeys and must not be freed.
errorOutput parameter for error details on failure (can be NULL to ignore)
Returns
true on success, false if the key does not exist or is not a string

◆ dh_instance_keys_has_key()

bool dh_instance_keys_has_key ( const DHInstanceKeys *  keys,
const char *  name 
)

Checks whether a key exists.

Parameters
keysThe DHInstanceKeys (must not be NULL)
nameThe key name to look up (must not be NULL)
Returns
true if the key exists, false otherwise

◆ dh_instance_keys_remove()

bool dh_instance_keys_remove ( DHInstanceKeys *  keys,
const char *  name,
DHError **  error 
)

Removes a key.

Parameters
keysThe DHInstanceKeys (must not be NULL)
nameThe key name to remove (must not be NULL)
errorOutput parameter for error details on failure (can be NULL to ignore)
Returns
true on success, false if the key does not exist

◆ dh_timestamp_create()

DHTimestamp* dh_timestamp_create ( void  )

Creates a timestamp set to the current time.

Returns
New DHTimestamp set to the current UTC time, or NULL on memory allocation failure

◆ dh_timestamp_destroy()

void dh_timestamp_destroy ( DHTimestamp *  timestamp)

Destroys a timestamp.

Frees all resources associated with the DHTimestamp.

Parameters
timestampThe timestamp to destroy (can be NULL)

◆ dh_timestamp_get_as_ms()

int64_t dh_timestamp_get_as_ms ( const DHTimestamp *  timestamp)

Gets the timestamp value as milliseconds since Unix epoch.

Parameters
timestampThe timestamp (must not be NULL)
Returns
Milliseconds since Unix epoch, or 0 if timestamp is NULL

◆ dh_timestamp_get_as_sec()

int64_t dh_timestamp_get_as_sec ( const DHTimestamp *  timestamp)

Gets the timestamp value as seconds since Unix epoch.

Parameters
timestampThe timestamp (must not be NULL)
Returns
Seconds since Unix epoch, or 0 if timestamp is NULL

◆ dh_timestamp_set_current()

void dh_timestamp_set_current ( DHTimestamp *  timestamp)

Updates the timestamp to the current time.

Parameters
timestampThe timestamp to update (must not be NULL)

◆ dh_timestamp_set_with_ms()

void dh_timestamp_set_with_ms ( DHTimestamp *  timestamp,
int64_t  milliseconds 
)

Sets the timestamp from a Unix epoch value in milliseconds.

Parameters
timestampThe timestamp to update (must not be NULL)
millisecondsMilliseconds since Unix epoch (1970-01-01 00:00:00 UTC)

◆ dh_timestamp_set_with_sec()

void dh_timestamp_set_with_sec ( DHTimestamp *  timestamp,
int64_t  seconds 
)

Sets the timestamp from a Unix epoch value in seconds.

Parameters
timestampThe timestamp to update (must not be NULL)
secondsSeconds since Unix epoch (1970-01-01 00:00:00 UTC)

◆ dh_topic_data_create()

DHTopicData* dh_topic_data_create ( void  )

Creates an empty topic data object.

Creates a new DHTopicData with an empty value.

Returns
New DHTopicData, or NULL on memory allocation failure

◆ dh_topic_data_destroy()

void dh_topic_data_destroy ( DHTopicData *  topic_data)

Destroys a topic data object.

Frees all resources associated with the DHTopicData.

Parameters
topic_dataThe DHTopicData to destroy (can be NULL)

◆ dh_topic_data_get_json_data()

const char* dh_topic_data_get_json_data ( const DHTopicData *  topic_data)

Gets the topic data value as a JSON string.

Returns the current topic data value as a JSON-formatted string. The returned string is owned by the DHTopicData object and should not be freed.

Parameters
topic_dataThe DHTopicData (must not be NULL)
Returns
JSON string representation, or NULL if invalid

◆ dh_topic_data_set_json_data()

bool dh_topic_data_set_json_data ( DHTopicData *  topic_data,
const char *  json_str,
DHError **  error 
)

Sets the value of topic data from JSON string.

Parses the JSON string and updates the topic data with the new value.

Parameters
topic_dataThe DHTopicData (must not be NULL)
json_strJSON string containing the new value (must not be NULL)
errorOutput parameter for error details on failure (can be NULL to ignore)
Returns
true on success, false if the input is not valid JSON

Possible error conditions:

  • Invalid JSON string (DH_ERR_INVALID_PARAMS)

◆ dh_topic_destroy()

void dh_topic_destroy ( DHTopic *  topic)

Destroys a topic.

Frees resources associated with a topic. Does not delete the topic from the Device Data Hub, only releases local resources.

Parameters
topicThe topic to destroy

◆ dh_topic_get_json_definition()

const char* dh_topic_get_json_definition ( const DHTopic *  topic,
DHError **  error 
)

Gets the topic definition as a JSON string.

Returns a reference to the topic definition as a string in JSON format. The returned string is owned by the topic object and should not be freed.

Parameters
topicThe topic (must not be NULL)
errorOutput parameter for error details on failure (can be NULL to ignore)
Returns
The topic definition JSON string, or NULL on error

◆ dh_topic_get_name()

const char* dh_topic_get_name ( const DHTopic *  topic)

Gets the name of a topic.

Returns the topic name as specified in the topic definition.

Parameters
topicThe topic (must not be NULL)
Returns
The topic name string, or NULL if invalid

◆ dh_topic_instance_destroy()

void dh_topic_instance_destroy ( DHTopicInstance *  topic_instance)

Destroys a topic instance.

Frees all resources associated with the DHTopicInstance.

Parameters
topic_instanceThe DHTopicInstance to destroy (can be NULL)

◆ dh_topic_instance_get_info()

const char* dh_topic_instance_get_info ( const DHTopicInstance *  topic_instance)

Gets the instance information.

Returns additional information associated with this instance, if any. The returned string is owned by the DHTopicInstance and should not be modified or freed.

Parameters
topic_instanceThe DHTopicInstance (must not be NULL)
Returns
The instance info string, or NULL if no info or invalid

◆ dh_topic_instance_get_keys()

const DHInstanceKeys* dh_topic_instance_get_keys ( const DHTopicInstance *  topic_instance)

Gets the instance keys.

Returns the key-value pairs that identify this specific instance. The returned DHInstanceKeys object is owned by the DHTopicInstance and should not be modified or freed.

Parameters
topic_instanceThe TopicInstance (must not be NULL)
Returns
DHInstanceKeys object containing keys, or NULL if invalid

◆ dh_topic_instance_get_topic_name()

const char* dh_topic_instance_get_topic_name ( const DHTopicInstance *  topic_instance)

Gets the topic name of an instance.

Returns the name of the topic that this instance belongs to.

Parameters
topic_instanceThe TopicInstance (must not be NULL)
Returns
Topic name string, or NULL if invalid

◆ dh_topic_instance_list_destroy()

void dh_topic_instance_list_destroy ( DHTopicInstanceList *  instance_list)

Frees a topic instance list.

Releases memory allocated for an instance list returned by dh_client_get_topic_instances().

Parameters
instance_listThe instance list to free (can be NULL)

◆ dh_topic_instance_list_get()

const DHTopicInstance* dh_topic_instance_list_get ( const DHTopicInstanceList *  list,
uint32_t  index 
)

Gets a topic instance by index.

Returns the topic instance at the specified index. The returned pointer is owned by the DHTopicInstanceList and should not be freed.

Parameters
listThe DHTopicInstanceList (must not be NULL)
indexZero-based index into the list. Must be less than the value returned by dh_topic_instance_list_get_count()
Returns
The topic instance, or NULL if invalid or out of bounds

◆ dh_topic_instance_list_get_count()

uint32_t dh_topic_instance_list_get_count ( const DHTopicInstanceList *  list)

Gets the number of instances in the list.

Parameters
listThe DHTopicInstanceList (must not be NULL)
Returns
The number of instances, or 0 if invalid

◆ dh_topic_list_destroy()

void dh_topic_list_destroy ( DHTopicList *  topic_list)

Frees a topic list.

Releases memory allocated for a topic list returned by dh_client_get_topic_list().

Parameters
topic_listThe topic list to free (can be NULL)

◆ dh_topic_list_get_count()

uint32_t dh_topic_list_get_count ( const DHTopicList *  list)

Gets the number of topics in the list.

Parameters
listThe DHTopicList (must not be NULL)
Returns
The number of topics, or 0 if invalid

◆ dh_topic_list_get_name()

const char* dh_topic_list_get_name ( const DHTopicList *  list,
uint32_t  index 
)

Gets a topic name by index.

Returns the topic name at the specified index. The returned string is owned by the DHTopicList and should not be freed.

Parameters
listThe DHTopicList (must not be NULL)
indexZero-based index into the list. Must be less than the value returned by dh_topic_list_get_count()
Returns
The topic name string, or NULL if invalid or out of bounds

◆ dh_topic_sample_get_data()

const DHTopicData* dh_topic_sample_get_data ( const DHTopicSample *  topic_sample)

Gets the topic data from a sample.

Returns the topic data contained in this sample. The returned pointer is owned by the TopicSample and should not be freed.

Parameters
topic_sampleThe TopicSample (must not be NULL)
Returns
The topic data, or NULL if invalid

◆ dh_topic_sample_get_sample_id()

uint64_t dh_topic_sample_get_sample_id ( const DHTopicSample *  topic_sample)

Gets the sample ID.

Returns the unique identifier for this sample within its topic.

Parameters
topic_sampleThe TopicSample (must not be NULL)
Returns
The sample ID, or 0 if invalid

◆ dh_topic_sample_get_timestamp()

const DHTimestamp* dh_topic_sample_get_timestamp ( const DHTopicSample *  topic_sample)

Gets the source timestamp.

Returns the timestamp provided by the producing application when the data was written.

Parameters
topic_sampleThe TopicSample (must not be NULL)
Returns
The source timestamp, or NULL if invalid. The returned pointer is owned by the sample and must not be freed.

◆ dh_topic_sample_get_topic_name()

const char* dh_topic_sample_get_topic_name ( const DHTopicSample *  topic_sample)

Gets the topic name from a sample.

Returns the name of the topic this sample belongs to. The returned string is owned by the DHTopicSample and should not be freed.

Parameters
topic_sampleThe TopicSample (must not be NULL)
Returns
The topic name string, or NULL if invalid

◆ dh_topic_sample_is_historical()

bool dh_topic_sample_is_historical ( const DHTopicSample *  topic_sample)

Checks if the sample is historical data.

Returns whether this sample was received as part of cached history rather than as a live update.

Parameters
topic_sampleThe TopicSample (must not be NULL)
Returns
true if historical data, false otherwise or if invalid