Sternum iOS SDK
sternum_trace_api.h
Go to the documentation of this file.
1 
8 #ifndef __STERNUM_TRACE_API_H__
9 #define __STERNUM_TRACE_API_H__
10 
11 #ifdef __cplusplus
12  extern "C" {
13 #endif
14 
15 #include <stdint.h>
16 #include <stdbool.h>
17 
18 #include "trace_protocol_user_definition.h"
19 #include "error_codes.h"
20 #include "device_type.h"
21 
22 
96 #define STERNUM_ADS_TRACE(TRACE, ...) sternum_trace_dynamic(TRACE, ## __VA_ARGS__, END_OF_ARGUMENTS)
121 #define STERNUM_ADS_TRACEF(TRACE, ARG_ROLE, MAX_LENGTH, FORMAT, ...) sternum_trace_string_format(TRACE, ARG_ROLE, MAX_LENGTH, FORMAT, ## __VA_ARGS__)
122 
123 
124 #define END_OF_ARGUMENTS 0
125 #define POINTER_DEREFERENCE_INDICATOR 0x8000
126 #define UNSIGNED_INTEGER_TYPE 0
127 #define SIGNED_INTEGER_TYPE 1
128 #define FLOAT_TYPE 2
129 #define POINTER_TYPE 3
130 #define BLOB_TYPE (4 | POINTER_DEREFERENCE_INDICATOR)
131 #define STRING_TYPE (5 | POINTER_DEREFERENCE_INDICATOR)
132 
133 #define ARGUMENT_STRING(ARG_ROLE, MAX_SIZE, ARG_VALUE) (unsigned int)ARG_ROLE, (unsigned int)STRING_TYPE, (unsigned int)MAX_SIZE, (char*)(ARG_VALUE)
134 #define ARGUMENT_BLOB(ARG_ROLE, SIZE, ARG_VALUE) (unsigned int)ARG_ROLE, (unsigned int)BLOB_TYPE, (unsigned int)SIZE, (uint8_t*)(ARG_VALUE)
135 #define ARGUMENT_INTEGER(ARG_ROLE, ARG_VALUE) (unsigned int)ARG_ROLE, (unsigned int)SIGNED_INTEGER_TYPE, (unsigned int)sizeof(ARG_VALUE), (ARG_VALUE)
136 #define ARGUMENT_UINTEGER(ARG_ROLE, ARG_VALUE) (unsigned int)ARG_ROLE, (unsigned int)UNSIGNED_INTEGER_TYPE, (unsigned int)sizeof(ARG_VALUE), (ARG_VALUE)
137 #define ARGUMENT_POINTER(ARG_ROLE, ARG_VALUE) (unsigned int)ARG_ROLE, (unsigned int)POINTER_TYPE, (unsigned int)sizeof(ARG_VALUE), (ARG_VALUE)
138 #define ARGUMENT_FLOAT(ARG_ROLE, ARG_VALUE) (unsigned int)ARG_ROLE, (unsigned int)FLOAT_TYPE, (unsigned int)sizeof(ARG_VALUE), (ARG_VALUE)
139 
140 sternum_code_t sternum_trace_dynamic(int trace_event_type, ...);
141 sternum_code_t sternum_trace_string_format(uint16_t trace_event_type, uint16_t argument_role_type, uint16_t max_length, const char* format, ...);
142 
143 /***********************************************************************************************
144  * Predefined traces definitions
145  **********************************************************************************************/
146 
153 void trace_battery_health(unsigned int capacity_percent, unsigned int voltage_mV);
154 
163 void trace_error(unsigned int error_code, const char* message, const char* file_name, unsigned int line);
164 
175 #define STERNUM_ADS_TRACE_ERROR(error_code, message) trace_error(error_code, message, __FILE__, __LINE__)
176 
186 void trace_firmware_update_start(const char* firmware_version, const char* firmware_hash, const char* hash_algorithm);
187 
194 
200 void trace_reboot_reason(const char* reboot_reason);
201 
208 void trace_signal_strength_report(unsigned int communication_type, int signal_strength);
209 
210 
211 #ifdef __cplusplus
212 }
213 #endif
214 
215 #endif /* __STERNUM_TRACE_API_H__ */
void trace_reboot_reason(const char *reboot_reason)
Trace reboot reason.
void trace_firmware_update_finish(void)
Trace firmware update finished.
void trace_battery_health(unsigned int capacity_percent, unsigned int voltage_mV)
Trace battery health.
void trace_firmware_update_start(const char *firmware_version, const char *firmware_hash, const char *hash_algorithm)
Trace firmware update start.
void trace_signal_strength_report(unsigned int communication_type, int signal_strength)
Trace signal strength.
void trace_error(unsigned int error_code, const char *message, const char *file_name, unsigned int line)
Trace error.