MRTKLIB 0.7.14
Modernized GNSS Positioning Library
Loading...
Searching...
No Matches
mrtk_context.c File Reference
#include "mrtklib/mrtk_context.h"
#include <stdlib.h>
#include <string.h>
Include dependency graph for mrtk_context.c:

Go to the source code of this file.

Functions

mrtk_ctx_t * mrtk_ctx_create (void)
 Create a new runtime context.
void mrtk_ctx_destroy (mrtk_ctx_t *ctx)
 Destroy a runtime context.

Variables

mrtk_ctx_t * g_mrtk_ctx = NULL
 Global context pointer for transitional migration.

Function Documentation

◆ mrtk_ctx_create()

mrtk_ctx_t * mrtk_ctx_create ( void )

Create a new runtime context.

Allocates and zero-initialises a context. Default settings:

  • trace_level: 0 (off)
  • trace_fp: NULL (no trace output)
  • All other members: zero / NULL
Returns
Newly allocated context, or NULL on allocation failure.

Definition at line 31 of file mrtk_context.c.

References calloc, mrtk_ctx_t::cancel_requested, mrtk_ctx_t::cb_showmsg, mrtk_ctx_t::is_running, mrtk_ctx_t::last_err_code, mrtk_ctx_t::last_err_msg, MRTK_OK, mrtk_ctx_t::tick_trace, mrtk_ctx_t::trace_fp, mrtk_ctx_t::trace_level, and mrtk_ctx_t::user_data.

◆ mrtk_ctx_destroy()

void mrtk_ctx_destroy ( mrtk_ctx_t * ctx)

Destroy a runtime context.

Closes the trace file (unless stdout/stderr) and frees memory. Safe to call with NULL.

Parameters
[in]ctxContext to destroy, or NULL (no-op)

Definition at line 50 of file mrtk_context.c.

References free, and mrtk_ctx_t::trace_fp.

Variable Documentation

◆ g_mrtk_ctx

mrtk_ctx_t* g_mrtk_ctx = NULL

Global context pointer for transitional migration.

Functions that have not yet received an explicit ctx parameter use this global as a fallback. Applications should set this at startup and clear it at shutdown.

Note
This pointer will be removed once all modules have been migrated to explicit context passing.

Definition at line 25 of file mrtk_context.c.

Referenced by rtksvrstart().