Sternum Linux SDK
sternum_sdk.h File Reference

Defines the SDK's API. More...

#include <stddef.h>
#include "device_type.h"
#include "error_codes.h"
#include "sternum_trace_api.h"
#include "sternum_settings.h"

Go to the source code of this file.

Functions

sternum_code_t sternum_sdk_initialize (const sternum_settings_t *settings)
 Initializes the Sternum SDK. More...
 
sternum_code_t sternum_sdk_relay_device_data (const device_type_e device_type, const void *data, size_t size)
 Transmit relayed data that was received from a remote device. More...
 
sternum_code_t sternum_sdk_flush (void)
 Flush transmission queue. More...
 
sternum_code_t sternum_daemon_flush (void)
 Requests the daemon to transmit accumulated traces to the cloud. More...
 
void sternum_sdk_close (void)
 Closes the Sternum SDK. More...
 

Detailed Description

Defines the SDK's API.

Function Documentation

◆ sternum_daemon_flush()

sternum_code_t sternum_daemon_flush ( void  )

Requests the daemon to transmit accumulated traces to the cloud.

Note
This is only implemented when the SDK is used in IPC mode, where traces are transmitted by the daemon.
This function has an effect only if the daemon is configured to wait for a flush command.
This function is non-blocking.
Returns
sternum_code_t Status code indicating the result of the request.

◆ sternum_sdk_close()

void sternum_sdk_close ( void  )

Closes the Sternum SDK.

Call initialize to reinitialize.

Note
Call sternum_sdk_flush before close to prevent data loss.
This function blocks until the ongoing transmission is finished, connection is closed and all resources are released.

◆ sternum_sdk_flush()

sternum_code_t sternum_sdk_flush ( void  )

Flush transmission queue.

Note
This function will block until all pending data is processed and saved to cache.
This function will trigger a transmission of data to the cloud. It does not block until the transmission is either started or completed.
Returns
sternum_code_t

◆ sternum_sdk_initialize()

sternum_code_t sternum_sdk_initialize ( const sternum_settings_t settings)

Initializes the Sternum SDK.

This function initializes the Sternum SDK with the provided settings. After successful initialization Sternum SDK is ready to use. The provided settings structure is copied internally for use within the program, ensuring that any changes to the original structure will not affect the functionality.

Parameters
settingsPointer to configured SDK settings structure.
Returns
code_t Status code indicating the success or failure of the initialization.
  • STERNUM_SDK_SUCCESS - initialization successful
  • STERNUM_SDK_INVALID_ARGUMENT - invalid settings provided

◆ sternum_sdk_relay_device_data()

sternum_code_t sternum_sdk_relay_device_data ( const device_type_e  device_type,
const void *  data,
size_t  size 
)

Transmit relayed data that was received from a remote device.

Parameters
device_typeeach device type as its own channel for relaying sternum traces. If you are relaying multiple devices in parallel, please make sure to assign each a different device type.
datadata to relay.
sizethe size of the data.
Note
This function does not block.
Returns
sternum_code_t