Sternum iOS SDK
Loading...
Searching...
No Matches
sternum_sdk.m File Reference
import "sternum_sdk.h"
import "communication_module.h"
#include "include/init.h"
import <UIKit/UIKit.h>

Functions

static void init_cache_file_path (void)
 
static uint64_t load_or_generate_device_id (void)
 
char * settings_get_cache_path (void)
 
void init_sternum_ios_settings (sternum_ios_sdk_settings_t *settings)
 Initializes the SDK settings structure.
 
sternum_code_t sternum_ios_sdk_initialize (const sternum_ios_sdk_settings_t *sdk_settings)
 Initializes the Sternum SDK.
 
sternum_code_t sternum_sdk_initialize (const char *sternum_url, const char *firmware_version, bool relay_override_device_id, uint64_t access_token, bool is_production, size_t max_cache_size)
 Initializes the Sternum SDK (Legacy API).
 
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.
 
sternum_code_t sternum_sdk_flush (void)
 Flush transmission queue.
 
void sternum_sdk_close (void)
 Closes the Sternum SDK. Call initialize to reinitialize.
 

Macros

#define MAX_STERNUM_CACHE_PATH_LEN   4096
 
#define DEVICE_ID_ENTRY   @"jrLtcGwdCNwx"
 
#define CACHE_FILENAME   "/Documents/sternum_cache.bin"
 
#define CACHE_MAX_SIZE   1024 * 1024
 

Variables

char g_cache_path [MAX_STERNUM_CACHE_PATH_LEN] = {0}
 

Function Documentation

◆ init_cache_file_path()

static void init_cache_file_path ( void  )
static

◆ init_sternum_ios_settings()

void init_sternum_ios_settings ( sternum_ios_sdk_settings_t settings)

Initializes the SDK settings structure.

Parameters
settingsPointer to the sternum_ios_sdk_settings_t structure to be initialized.
Note
This sets all settings to default values, and should be used before assiging settings for future compatibility.

◆ load_or_generate_device_id()

static uint64_t load_or_generate_device_id ( void  )
static

◆ settings_get_cache_path()

char * settings_get_cache_path ( void  )

◆ sternum_ios_sdk_initialize()

sternum_code_t sternum_ios_sdk_initialize ( const sternum_ios_sdk_settings_t sdk_options)

Initializes the Sternum SDK.

Parameters
sdk_optionsPointer to a sternum_ios_sdk_settings_t structure containing the SDK configuration.
Note
See sternum_ios_sdk_settings_t and init_sternum_ios_settings for more details.
An ADS device ID is automatically generated for the importing application and saved in NSUserDefaults as a private record. The record is removed upon application deletion. For more info please visit https://developer.apple.com/documentation/foundation/nsuserdefaults
The cache file is saved inside the application private storage and is not accessible to other entities. The file is removed upon application deletion. For more info please visit https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html#//apple_ref/doc/uid/TP40010672-CH2-SW12
The recommended minimum cache size is 65KB to ensure that the biggest protocol payloads can be processed.
Returns
sternum_code_t

◆ sternum_sdk_close()

void sternum_sdk_close ( void  )

Closes the Sternum SDK. Call initialize to reinitialize.

Note
Call flush before close to prevent data loss
This function blocks until the 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 not ensure a transmission of data to the cloud.
Returns
sternum_code_t

◆ sternum_sdk_initialize()

sternum_code_t sternum_sdk_initialize ( const char *  sternum_url,
const char *  firmware_version,
bool  relay_override_device_id,
uint64_t  sdk_device_definition_id,
bool  is_production,
size_t  max_cache_size 
)

Initializes the Sternum SDK (Legacy API).

Parameters
sternum_urlyour Sternum dedicated transmission URL.
firmware_versiona string identifying client's application firmware version.
relay_override_device_idif a remote device that originated the relayed traces cannot have a random a device ID, set to true and the application's device ID will be used.
sdk_device_definition_ida device definition id for traces transmitted from the importing application.
is_productionindicate if the application is in production/development phase.
max_cache_sizedefines the maximum amount of bytes to store on disk when caching traces. Cache is automatically emptied when internet connection is available.
Note
This is an older API kept for backward compatibility. Would be deperecated in the future.
An ADS device ID is automatically generated for the importing application and saved in NSUserDefaults as a private record. The record is removed upon application deletion. For more info please visit https://developer.apple.com/documentation/foundation/nsuserdefaults
The cache file is saved inside the application private storage and is not accessible to other entities. The file is removed upon application deletion. For more info please visit https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html#//apple_ref/doc/uid/TP40010672-CH2-SW12
The recommended minimum cache size is 65KB to ensure that the biggest protocol payloads can be processed.
Returns
sternum_code_t

◆ 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

Macro Definition Documentation

◆ CACHE_FILENAME

#define CACHE_FILENAME   "/Documents/sternum_cache.bin"

◆ CACHE_MAX_SIZE

#define CACHE_MAX_SIZE   1024 * 1024

◆ DEVICE_ID_ENTRY

#define DEVICE_ID_ENTRY   @"jrLtcGwdCNwx"

◆ MAX_STERNUM_CACHE_PATH_LEN

#define MAX_STERNUM_CACHE_PATH_LEN   4096

Variable Documentation

◆ g_cache_path

char g_cache_path[MAX_STERNUM_CACHE_PATH_LEN] = {0}