sbrcsr 3.2.0
ATOMAS sbrcsr
Startup and Shutdown

Global vars

Call the ato_si_set() method. This is used to set the content of the SoftwareInformation element in SBR documents submitted to SBR Core Services.

For example:

ato_si_set("Your Organisation Name Here", "SBR CSR Reference Client (C version)", "0.6", buildtime, hash);
ATO_EXPORT int ato_si_set(const char *organisation, const char *product, const char *version, const char *timestamp, const char *source, const char *hash)

Initialise

The following initialises the base SDK and the CSR SDK. The ".._INIT_.." flags control the underlying initialisation. However only the given values are currently supported.

int errcode = ATO_ERR_OK;
ato_Ctx *ctx = NULL;
// We need at least one context for the main thread prior to initialisation
// The following is required only if using the ATOAKM SDK
if (errcode == ATO_ERR_OK)
errcode = ato_akm_init(ctx, ATO_AKM_INIT_ALL);
// The following is required only if using the ATOSTM SDK
if (errcode == ATO_ERR_OK)
errcode = ato_stm_init(ctx, ATO_STM_INIT_ALL);
if (errcode == ATO_ERR_OK)
errcode = sbr_csr_init(ctx, SBR_CSR_INIT_ALL);
ATO_AKM_EXPORT int ato_akm_init(ato_Ctx *ctx, unsigned short flag)
#define ATO_AKM_INIT_ALL
ATO_EXPORT void ato_ctx_create(ato_Ctx **ctx, const char *id)
ATO_EXPORT int ato_base_init(ato_Ctx *ctx, unsigned short flag)
#define ATO_ERR_OK
#define ATO_BASE_INIT_ALL
struct _ato_Ctx ato_Ctx
ATO_STM_EXPORT int ato_stm_init(ato_Ctx *ctx, unsigned short flag)
#define ATO_STM_INIT_ALL
SBR_CSR_EXPORT int sbr_csr_init(ato_Ctx *ctx, unsigned short flag)
Initialise the SDK.
#define SBR_CSR_INIT_ALL
The SBR_CSR_INIT_... defines are used to control the initialisation that takes place.
Definition: types.h:60

Configuration

In order to do anything useful, we need to load a configuration as described in

Note
Most of the CSR settings are specific to the type of report that is being lodged. Most of these settings are therefore accessed using ato_ctx_itemid() where the id is the ServiceType. See the atodefcontexts.xml file for examples of this or Configuration.

Deinitialise

At the end of the program lifetime, and after all threads are finished, corresponding config/ctx free and deinitialisation methods must be called.

ato_cfgm_free(cfgmgr);
ato_stm_deinit(); // if using ATOAKM
ato_akm_deinit(); // if using ATOSTM
ATO_AKM_EXPORT void ato_akm_deinit(void)
ATO_EXPORT void ato_ctx_free(ato_Ctx *ctx)
ATO_EXPORT void ato_base_deinit(void)
ATO_STM_EXPORT void ato_stm_deinit(void)
SBR_CSR_EXPORT void sbr_csr_deinit(void)
Deinitialise the SDK.