Aruna
arunaTypes.h
Go to the documentation of this file.
1 //
2 // Created by noeel on 16-08-19.
3 //
4 
5 #ifndef ARUNA_ARUNATYPES_H
6 #define ARUNA_ARUNATYPES_H
7 
8 // TODO make optional to only include these if FreeRTOS+POSIX is loaded.
9 // might be even better to just include `pthread.h` but that results in issues.
10 //extern "C" {
11 // #include "FreeRTOS_POSIX_portable.h"
12 // #include <FreeRTOS_POSIX/pthread.h>
13 //};
14 
15 #include <cstdint>
16 #include "map"
17 
18 namespace aruna {
19  // state the status of the executed function, > 0 means no success
20  enum class err_t : uint8_t {
21  OK = 0,
22  UNDEFINED = 1,
23  FAIL = 100,
24 
25  // running status
26  NOT_STOPPED = 101,
27  NOT_STARTED = 102,
28  NOT_PAUSED = 103,
29  ALREADY_STARTED = 104, // TODO redundant because NOT_STOPPED is basicly the same thing
30 
31  // hardware
32  HARDWARE_FAILURE = 110,
33  NO_CONNECTION = 112,
34  NO_RESPONSE = 113,
35  PROTOCOL_ERROR = 114,
36  NO_HARDWARE_FOUND = 115,
37  NOT_SUPPORTED = 116,
38 
39  // config
40  BUFFER_OVERFLOW = 120,
41  INVALID_PARAMETERS = 121,
42  TASK_FAILED = 122,
43  BUFFER_UNDERFLOW = 123,
44 
45  // channel/driver registation
46  NO_CHANNEL = 130,
47  CHANNEL_EXISTS = 131,
48  NO_DRIVER = 132,
49  DRIVER_EXISTS = 133,
50  NO_ACTIVE_MODULES = 134,
51  MODE_NOT_ACTIVE = 135,
52 
53  };
54  const std::map<err_t, char *> err_to_char = {
55  {err_t::OK, (char *) "OK"},
56  {err_t::UNDEFINED, (char *) "UNDEFINED"},
57  {err_t::FAIL, (char *) "FAIL"},
58 
59  // running status
60  {err_t::NOT_STOPPED, (char *) "NOT_STOPPED"},
61  {err_t::NOT_STARTED, (char *) "NOT_STARTED"},
62  {err_t::NOT_PAUSED, (char *) "NOT_PAUSED"},
63  {err_t::ALREADY_STARTED, (char *) "ALREADY_STARTED"},
64 
65  // hardware
66  {err_t::HARDWARE_FAILURE, (char *) "HARDWARE_FAILURE"},
67  {err_t::NO_CONNECTION, (char *) "NO_CONNECTION"},
68  {err_t::NO_RESPONSE, (char *) "NO_RESPONSE"},
69  {err_t::PROTOCOL_ERROR, (char *) "PROTOCOL_ERROR"},
70  {err_t::NO_HARDWARE_FOUND, (char *) "NO_HARDWARE_FOUND"},
71  {err_t::NOT_SUPPORTED, (char *) "NOT_SUPPORTED"},
72 
73  // config
74  {err_t::BUFFER_OVERFLOW, (char *) "BUFFER_OVERFLOW"},
75  {err_t::INVALID_PARAMETERS, (char *) "INVALID_PARAMETERS"},
76  {err_t::TASK_FAILED, (char *) "TASK_FAILED"},
77  {err_t::BUFFER_UNDERFLOW, (char *) "BUFFER_UNDERFLOW"},
78 
79  // channel/driver registation
80  {err_t::NO_CHANNEL, (char *) "NO_CHANNEL"},
81  {err_t::CHANNEL_EXISTS, (char *) "CHANNEL_EXISTS"},
82  {err_t::NO_DRIVER, (char *) "NO_DRIVER"},
83  {err_t::DRIVER_EXISTS, (char *) "DRIVER_EXISTS"},
84  {err_t::NO_ACTIVE_MODULES, (char *) "NO_ACTIVE_MODULES"},
85  {err_t::MODE_NOT_ACTIVE, (char *) "MODE_NOT_ACTIVE"},
86  };
87 
88 }
89 
90 #endif //ARUNA_ARUNATYPES_H
Definition: comm.cpp:14
const std::map< err_t, char * > err_to_char
Definition: arunaTypes.h:54