MRTKLIB 0.7.14
Modernized GNSS Positioning Library
Loading...
Searching...
No Matches
mrtk_trace.h
Go to the documentation of this file.
1/*------------------------------------------------------------------------------
2 * mrtk_trace.h : debug trace and logging functions
3 *
4 * Copyright (C) 2026 H.SHIONO (MRTKLIB Project)
5 * Copyright (C) 2023-2025 Cabinet Office, Japan
6 * Copyright (C) 2024-2025 Lighthouse Technology & Consulting Co. Ltd.
7 * Copyright (C) 2023-2025 Japan Aerospace Exploration Agency
8 * Copyright (C) 2023-2025 TOSHIBA ELECTRONIC TECHNOLOGIES CORPORATION
9 * Copyright (C) 2015- Mitsubishi Electric Corp.
10 * Copyright (C) 2014 Geospatial Information Authority of Japan
11 * Copyright (C) 2014 T.SUZUKI
12 * Copyright (C) 2007-2023 T.TAKASU
13 *
14 * SPDX-License-Identifier: BSD-2-Clause
15 *----------------------------------------------------------------------------*/
16/**
17 * @file mrtk_trace.h
18 * @brief MRTKLIB Trace Module — debug trace and logging functions.
19 *
20 * All trace functions accept an explicit mrtk_ctx_t pointer as their first
21 * argument. When ctx is NULL, the global g_mrtk_ctx is used as a fallback.
22 *
23 * @note Functions declared here are implemented in mrtk_trace.c.
24 */
25#ifndef MRTK_TRACE_H
26#define MRTK_TRACE_H
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32#include <stdint.h>
33
35#include "mrtklib/mrtk_nav.h"
36#include "mrtklib/mrtk_obs.h"
37
38/*============================================================================
39 * Debug Trace Functions
40 *===========================================================================*/
41
42/**
43 * @brief Open trace output (initializes tick counter for tracet).
44 * @param[in] ctx Runtime context (NULL = use global)
45 * @param[in] file Trace file path (opened for writing)
46 */
47void traceopen(mrtk_ctx_t* ctx, const char* file);
48
49/**
50 * @brief Close trace output.
51 * @param[in] ctx Runtime context (NULL = use global)
52 */
53void traceclose(mrtk_ctx_t* ctx);
54
55/**
56 * @brief Set trace level.
57 * @param[in] ctx Runtime context (NULL = use global)
58 * @param[in] level Trace level (0:off, 1:error, 2:warn, 3:info, 4-5:debug)
59 */
60void tracelevel(mrtk_ctx_t* ctx, int level);
61
62/**
63 * @brief Output trace message.
64 * @param[in] ctx Runtime context (NULL = use global)
65 * @param[in] level Trace level
66 * @param[in] format printf-style format string
67 * @param[in] ... Format arguments
68 */
69void trace(mrtk_ctx_t* ctx, int level, const char* format, ...);
70
71/**
72 * @brief Output trace message with elapsed time.
73 * @param[in] ctx Runtime context (NULL = use global)
74 * @param[in] level Trace level
75 * @param[in] format printf-style format string
76 * @param[in] ... Format arguments
77 */
78void tracet(mrtk_ctx_t* ctx, int level, const char* format, ...);
79
80/**
81 * @brief Output trace matrix.
82 * @param[in] ctx Runtime context (NULL = use global)
83 * @param[in] level Trace level
84 * @param[in] A Matrix data (column-major)
85 * @param[in] n Number of rows
86 * @param[in] m Number of columns
87 * @param[in] p Total field width
88 * @param[in] q Decimal places
89 */
90void tracemat(mrtk_ctx_t* ctx, int level, const double* A, int n, int m, int p, int q);
91
92/**
93 * @brief Output trace observation data.
94 * @param[in] ctx Runtime context (NULL = use global)
95 * @param[in] level Trace level
96 * @param[in] obs Observation data array
97 * @param[in] n Number of observations
98 */
99void traceobs(mrtk_ctx_t* ctx, int level, const obsd_t* obs, int n);
100
101/**
102 * @brief Output trace navigation data (GPS ephemeris).
103 * @param[in] ctx Runtime context (NULL = use global)
104 * @param[in] level Trace level
105 * @param[in] nav Navigation data
106 */
107void tracenav(mrtk_ctx_t* ctx, int level, const nav_t* nav);
108
109/**
110 * @brief Output trace GLONASS navigation data.
111 * @param[in] ctx Runtime context (NULL = use global)
112 * @param[in] level Trace level
113 * @param[in] nav Navigation data
114 */
115void tracegnav(mrtk_ctx_t* ctx, int level, const nav_t* nav);
116
117/**
118 * @brief Output trace SBAS navigation data.
119 * @param[in] ctx Runtime context (NULL = use global)
120 * @param[in] level Trace level
121 * @param[in] nav Navigation data
122 */
123void tracehnav(mrtk_ctx_t* ctx, int level, const nav_t* nav);
124
125/**
126 * @brief Output trace precise ephemeris data.
127 * @param[in] ctx Runtime context (NULL = use global)
128 * @param[in] level Trace level
129 * @param[in] nav Navigation data
130 */
131void tracepeph(mrtk_ctx_t* ctx, int level, const nav_t* nav);
132
133/**
134 * @brief Output trace precise clock data.
135 * @param[in] ctx Runtime context (NULL = use global)
136 * @param[in] level Trace level
137 * @param[in] nav Navigation data
138 */
139void tracepclk(mrtk_ctx_t* ctx, int level, const nav_t* nav);
140
141/**
142 * @brief Output trace binary data.
143 * @param[in] ctx Runtime context (NULL = use global)
144 * @param[in] level Trace level
145 * @param[in] p Binary data
146 * @param[in] n Data length (bytes)
147 */
148void traceb(mrtk_ctx_t* ctx, int level, const uint8_t* p, int n);
149
150#ifdef __cplusplus
151}
152#endif
153
154#endif /* MRTK_TRACE_H */
MRTKLIB Context — runtime context for processing, trace, and error handling.
struct nav_s nav_t
Definition mrtk_eph.h:40
MRTKLIB Navigation Module — Navigation data types and satellite/nav utility functions.
MRTKLIB Observation Module — Observation data types and utility functions.
void tracegnav(mrtk_ctx_t *ctx, int level, const nav_t *nav)
Output trace GLONASS navigation data.
Definition mrtk_trace.c:166
void traceopen(mrtk_ctx_t *ctx, const char *file)
Open trace output (initializes tick counter for tracet).
Definition mrtk_trace.c:34
void tracenav(mrtk_ctx_t *ctx, int level, const nav_t *nav)
Output trace navigation data (GPS ephemeris).
Definition mrtk_trace.c:142
void tracehnav(mrtk_ctx_t *ctx, int level, const nav_t *nav)
Output trace SBAS navigation data.
Definition mrtk_trace.c:184
void traceobs(mrtk_ctx_t *ctx, int level, const obsd_t *obs, int n)
Output trace observation data.
Definition mrtk_trace.c:122
void tracelevel(mrtk_ctx_t *ctx, int level)
Set trace level.
Definition mrtk_trace.c:71
void tracepclk(mrtk_ctx_t *ctx, int level, const nav_t *nav)
Output trace precise clock data.
Definition mrtk_trace.c:224
void traceclose(mrtk_ctx_t *ctx)
Close trace output.
Definition mrtk_trace.c:60
void traceb(mrtk_ctx_t *ctx, int level, const uint8_t *p, int n)
Output trace binary data.
Definition mrtk_trace.c:243
void tracemat(mrtk_ctx_t *ctx, int level, const double *A, int n, int m, int p, int q)
Output trace matrix.
Definition mrtk_trace.c:106
void tracet(mrtk_ctx_t *ctx, int level, const char *format,...)
Output trace message with elapsed time.
Definition mrtk_trace.c:91
void tracepeph(mrtk_ctx_t *ctx, int level, const nav_t *nav)
Output trace precise ephemeris data.
Definition mrtk_trace.c:201
void trace(mrtk_ctx_t *ctx, int level, const char *format,...)
Output trace message.
Definition mrtk_trace.c:78
Runtime context for MRTKLIB processing.
Observation data record.
Definition mrtk_obs.h:44