CANopenNode
CO_error_msgs.h
1 /*
2  * Definitions for CANopenNode Linux socketCAN Error handling.
3  *
4  * @file CO_Error_msgs.h
5  * @author Martin Wagner
6  * @copyright 2020 Neuberger Gebaeudeautomation GmbH
7  *
8  *
9  * This file is part of CANopenNode, an opensource CANopen Stack.
10  * Project home page is <https://github.com/CANopenNode/CANopenNode>.
11  * For more information on CANopen see <http://www.can-cia.org/>.
12  *
13  * Licensed under the Apache License, Version 2.0 (the "License");
14  * you may not use this file except in compliance with the License.
15  * You may obtain a copy of the License at
16  *
17  * http://www.apache.org/licenses/LICENSE-2.0
18  *
19  * Unless required by applicable law or agreed to in writing, software
20  * distributed under the License is distributed on an "AS IS" BASIS,
21  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22  * See the License for the specific language governing permissions and
23  * limitations under the License.
24  */
25 
26 
27 #ifndef CO_ERROR_MSGS_H
28 #define CO_ERROR_MSGS_H
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 
35 /*
36  * Message definitions for Linux CANopen socket driver (notice and errors)
37  */
38 #define CAN_NOT_FOUND "(%s) CAN Interface \"%s\" not found", __func__
39 #define CAN_INIT_FAILED "(%s) CAN Interface \"%s\" Init failed", __func__
40 #define CAN_BINDING_FAILED "(%s) Binding CAN Interface \"%s\" failed", __func__
41 #define CAN_ERROR_FILTER_FAILED "(%s) Setting CAN Interface \"%s\" error filter failed", __func__
42 #define CAN_FILTER_FAILED "(%s) Setting CAN Interface \"%s\" message filter failed", __func__
43 #define CAN_NAMETOINDEX "CAN Interface \"%s\" -> Index %d"
44 #define CAN_SOCKET_BUF_SIZE "CAN Interface \"%s\" Buffer set to %d messages (%d Bytes)"
45 #define CAN_RX_SOCKET_QUEUE_OVERFLOW "CAN Interface \"%s\" has lost %d messages"
46 #define CAN_BUSOFF "CAN Interface \"%s\" changed to \"Bus Off\". Switching to Listen Only mode..."
47 #define CAN_NOACK "CAN Interface \"%s\" no \"ACK\" received. Switching to Listen Only mode..."
48 #define CAN_RX_PASSIVE "CAN Interface \"%s\" changed state to \"Rx Passive\""
49 #define CAN_TX_PASSIVE "CAN Interface \"%s\" changed state to \"Tx Passive\""
50 #define CAN_TX_LEVEL_ACTIVE "CAN Interface \"%s\" changed state to \"Active\""
51 #define CAN_RX_BUF_OVERFLOW "CAN Interface \"%s\" Rx buffer overflow. Message dropped"
52 #define CAN_TX_BUF_OVERFLOW "CAN Interface \"%s\" Tx buffer overflow. Message dropped"
53 #define CAN_RX_LEVEL_WARNING "CAN Interface \"%s\" reached Rx Warning Level"
54 #define CAN_TX_LEVEL_WARNING "CAN Interface \"%s\" reached Tx Warning Level"
55 
56 
57 /*
58  * Message definitions for debugging
59  */
60 #define DBG_GENERAL "(%s) Error: %s%d", __func__
61 #define DBG_ERRNO "(%s) OS error \"%s\" in %s", __func__, strerror(errno)
62 #define DBG_CO_DEBUG "(%s) CO_DEBUG: %s", __func__
63 #define DBG_CAN_TX_FAILED "(%s) Transmitting CAN msg OID 0x%08x failed(%s)", __func__
64 #define DBG_CAN_RX_PARAM_FAILED "(%s) Setting CAN rx buffer failed (%s)", __func__
65 #define DBG_CAN_RX_FAILED "(%s) Receiving CAN msg failed (%s)", __func__
66 #define DBG_CAN_ERROR_GENERAL "(%s) Socket error msg ID: 0x%08x, Data[0..7]: 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x (%s)", __func__
67 #define DBG_CAN_RX_EPOLL "(%s) CAN Epoll error (0x%02x - %s)", __func__
68 #define DBG_CAN_SET_LISTEN_ONLY "(%s) %s Set Listen Only", __func__
69 #define DBG_CAN_CLR_LISTEN_ONLY "(%s) %s Leave Listen Only", __func__
70 
71 /* mainline */
72 #define DBG_EMERGENCY_RX "CANopen Emergency message from node 0x%02X: errorCode=0x%04X, errorRegister=0x%02X, errorBit=0x%02X, infoCode=0x%08X"
73 #define DBG_NMT_CHANGE "CANopen NMT state changed to: \"%s\" (%d)"
74 #define DBG_HB_CONS_NMT_CHANGE "CANopen Remote node ID = 0x%02X (index = %d): NMT state changed to: \"%s\" (%d)"
75 #define DBG_ARGUMENT_UNKNOWN "(%s) Unknown %s argument: \"%s\"", __func__
76 #define DBG_NOT_TCP_PORT "(%s) -c argument \"%s\" is not a valid tcp port", __func__
77 #define DBG_WRONG_NODE_ID "(%s) Wrong node ID \"%d\"", __func__
78 #define DBG_WRONG_PRIORITY "(%s) Wrong RT priority \"%d\"", __func__
79 #define DBG_NO_CAN_DEVICE "(%s) Can't find CAN device \"%s\"", __func__
80 #define DBG_OBJECT_DICTIONARY "(%s) Error in Object Dictionary \"%s\"", __func__
81 #define DBG_OD_ENTRY "(%s) Error in Object Dictionary entry: 0x%X", __func__
82 #define DBG_CAN_OPEN "(%s) CANopen error in %s, err=%d", __func__
83 #define DBG_CAN_OPEN_INFO "CANopen device, Node ID = 0x%02X, %s"
84 
85 /* CO_epoll_interface */
86 #define DBG_EPOLL_UNKNOWN "(%s) CAN Epoll error, events=0x%02x, fd=%d", __func__
87 #define DBG_COMMAND_LOCAL_BIND "(%s) Can't bind local socket to path \"%s\"", __func__
88 #define DBG_COMMAND_TCP_BIND "(%s) Can't bind tcp socket to port \"%d\"", __func__
89 #define DBG_COMMAND_STDIO_INFO "CANopen command interface on \"standard IO\" started"
90 #define DBG_COMMAND_LOCAL_INFO "CANopen command interface on local socket \"%s\" started"
91 #define DBG_COMMAND_TCP_INFO "CANopen command interface on tcp port \"%d\" started"
92 
93 
94 #ifdef __cplusplus
95 }
96 #endif /* __cplusplus */
97 
98 #endif /* CO_ERROR_MSGS_H */