Vehicle Control Unit 0.01
This is the c library for controlling the car.
Loading...
Searching...
No Matches
Enumerations | Functions
MessageFormat.h File Reference
#include <stdio.h>
#include <stdarg.h>
Include dependency graph for MessageFormat.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  MessageType {
  MSG_SENSOR_VALUE , MSG_OUTPUT_VALUE , MSG_SYSTEM_STATUS , MSG_WARNING ,
  MSG_ERROR , MSG_DEBUG , MSG_CAN_TX , MSG_CAN_RX ,
  MSG_TIMER_STATS , MSG_CONFIG
}
 

Functions

void sendMessage (const char *sender, MessageType type, const char *format,...)
 

Enumeration Type Documentation

◆ MessageType

Enumerator
MSG_SENSOR_VALUE 
MSG_OUTPUT_VALUE 
MSG_SYSTEM_STATUS 
MSG_WARNING 
MSG_ERROR 
MSG_DEBUG 
MSG_CAN_TX 
MSG_CAN_RX 
MSG_TIMER_STATS 
MSG_CONFIG 

Definition at line 8 of file MessageFormat.h.

8 {
MessageType
Definition: MessageFormat.h:8
@ MSG_TIMER_STATS
Definition: MessageFormat.h:17
@ MSG_ERROR
Definition: MessageFormat.h:13
@ MSG_OUTPUT_VALUE
Definition: MessageFormat.h:10
@ MSG_DEBUG
Definition: MessageFormat.h:14
@ MSG_WARNING
Definition: MessageFormat.h:12
@ MSG_CONFIG
Definition: MessageFormat.h:18
@ MSG_SENSOR_VALUE
Definition: MessageFormat.h:9
@ MSG_CAN_RX
Definition: MessageFormat.h:16
@ MSG_CAN_TX
Definition: MessageFormat.h:15
@ MSG_SYSTEM_STATUS
Definition: MessageFormat.h:11

Function Documentation

◆ sendMessage()

void sendMessage ( const char *  sender,
MessageType  type,
const char *  format,
  ... 
)

Definition at line 5 of file MessageFormat.c.

5 {
6 const char* type_strings[] = {
7 "SENSOR_VALUE",
8 "OUTPUT_VALUE",
9 "SYSTEM_STATUS",
10 "WARNING",
11 "ERROR",
12 "DEBUG",
13 "CAN_TX",
14 "CAN_RX",
15 "TIMER_STATS",
16 "CONFIG"
17 };
18
19 printf("Sender:%s;InfoType:%s;Content:", sender, type_strings[type]);
20
21 va_list args;
22 va_start(args, format);
23 vprintf(format, args);
24 va_end(args);
25
26 printf("\r\n");
27}
Here is the caller graph for this function: