AUBO SDK  0.26.0
载入中...
搜索中...
未找到
trace.h
浏览该文件的文档.
1/** @file trace.h
2 * \~chinese @brief 向控制器日志系统注入日志方面的接口 \~english @brief Interface for injecting logs into the controller's logging system
3 */
4#ifndef AUBO_SDK_TRACE_INTERFACE_H
5#define AUBO_SDK_TRACE_INTERFACE_H
6
7#include <string>
8#include <vector>
9#include <memory>
10#include <sstream>
11
12#include <aubo/global_config.h>
13#include <aubo/type_def.h>
14
15namespace arcs {
16namespace common_interface {
17
18/**
19 * \~chinese 提供给控制器扩展程序的日志记录系统 \~english provides a logging system for controller extension programs
20 */
21class ARCS_ABI_EXPORT Trace
22{
23public:
25 virtual ~Trace();
26
27 /**
28 * \~chinese 向 aubo_control 日志注入告警信息 \~english Injects alarm information into the aubo_control log
29 *
30 * TraceLevel: \n
31 * 0 - FATAL \n
32 * 1 - ERROR \n
33 * 2 - WARNING \n
34 * 3 - INFO \n
35 * 4 - DEBUG \n
36 *
37 * \~chinese code定义参考 error_stack \~english Code definitions refer to error_stack
38 *
39 * @param level
40 * @param code
41 * @param args
42 * @return
43 *
44 * \~chinese @par Python函数原型 \~english @par Python function prototype
45 * alarm(self: pyaubo_sdk.Trace, arg0: arcs::common_interface::TraceLevel,
46 * arg1: int, arg2: List[str]) -> int
47 *
48 * \~chinese @par Lua函数原型 \~english @par Lua function prototype
49 * alarm(level: number, code: number, args: table) -> nil
50 *
51 * \~chinese @par JSON-RPC请求示例 \~english @par JSON-RPC request example
52 * {"jsonrpc":"2.0","method":"rob1.Trace.alarm","params":["",1,["Error","Trajectory
53 * planning failed!","1"]],"id":1}
54 *
55 * \~chinese @par JSON-RPC响应示例 \~engish @par JSON-RPC response example
56 * {"id":1,"jsonrpc":"2.0","result":0}
57 *
58 */
59 int alarm(TraceLevel level, int code,
60 const std::vector<std::string> &args = {});
61
62 /**
63 * \chinese
64 * 打印文本信息到日志中
65 *
66 * @param msg 文本信息
67 * @return
68 *
69 * @par Python函数原型
70 * textmsg(self: pyaubo_sdk.Trace, arg0: str) -> int
71 *
72 * @par Lua函数原型
73 * textmsg(msg: string) -> nil
74 *
75 * @par JSON-RPC请求示例
76 * {"jsonrpc":"2.0","method":"rob1.Trace.textmsg","params":["test"],"id":1}
77 *
78 * @par JSON-RPC响应示例
79 * {"id":1,"jsonrpc":"2.0","result":0}
80 * \endchinese
81 * \english
82 * print message into log
83 *
84 * @param msg message information
85 * @return
86 *
87 * @par Python function prototype
88 * textmsg(self: pyaubo_sdk.Trace, arg0: str) -> int
89 *
90 * @par Lua function prototype
91 * textmsg(msg: string) -> nil
92 *
93 * @par JSON-RPC request example
94 * {"jsonrpc":"2.0","method":"rob1.Trace.textmsg","params":["test"],"id":1}
95 *
96 * @par JSON-RPC responose example
97 * {"id":1,"jsonrpc":"2.0","result":0}
98 * \endenglish
99 */
100 int textmsg(const std::string &msg);
101
102 /**
103 * \~chinese 通知上位机 \~english Notify the system
104 *
105 * @param msg
106 * @return
107 */
108 int notify(const std::string &msg);
109
110 /**
111 * \chinese
112 * 向连接的 RTDE 客户端发送弹窗请求
113 *
114 * @param level
115 * @param title
116 * @param msg
117 * @param mode 模式 \n
118 * 0: 普通模式 \n
119 * 1: 阻塞模式 \n
120 * 2: 输入模式 bool \n
121 * 3: 输入模式 int \n
122 * 4: 输入模式 double \n
123 * 5: 输入模式 string \n
124 * @return
125 *
126 * @par Python函数原型
127 * popup(self: pyaubo_sdk.Trace, arg0: arcs::common_interface::TraceLevel,
128 * arg1: str, arg2: str, arg3: int) -> int
129 *
130 * @par Lua函数原型
131 * popup(level: number, title: string, msg: string, mode: number) -> nil
132 *
133 * @par JSON-RPC请求示例
134 * {"jsonrpc":"2.0","method":"rob1.Trace.popup","params":["","Error","Trajectory
135 * planning failed!",1],"id":1}
136 *
137 * @par JSON-RPC响应示例
138 * {"id":1,"jsonrpc":"2.0","result":0}
139 * \endchinese
140 * \english
141 * Send a popup request to the connected RTDE client
142 *
143 * @param level
144 * @param title
145 * @param msg
146 * @param mode mode \n
147 * 0: normal mode \n
148 * 1: blocking mode \n
149 * 2: input mode bool \n
150 * 3: input mode int \n
151 * 4: input mode double \n
152 * 5: input mode string \n
153 * @return
154 *
155 * @par Python function prototype
156 * popup(self: pyaubo_sdk.Trace, arg0: arcs::common_interface::TraceLevel,
157 * arg1: str, arg2: str, arg3: int) -> int
158 *
159 * @par Lua function prototype
160 * popup(level: number, title: string, msg: string, mode: number) -> nil
161 *
162 * @par JSON-RPC request example
163 * {"jsonrpc":"2.0","method":"rob1.Trace.popup","params":["","Error","Trajectory
164 * planning failed!",1],"id":1}
165 *
166 * @par JSON-RPC response example
167 * {"id":1,"jsonrpc":"2.0","result":0}
168 * \endenglish
169 */
170 int popup(TraceLevel level, const std::string &title,
171 const std::string &msg, int mode);
172
173 /**
174 * \chinese
175 * peek最新的 AlarmInfo(上次一获取之后)
176 *
177 * last_time设置为0时,可以获取到所有的AlarmInfo
178 *
179 * @param num
180 * @param last_time
181 * @return
182 *
183 * @par Python函数原型
184 * peek(self: pyaubo_sdk.Trace, arg0: int, arg1: int) ->
185 * List[arcs::common_interface::RobotMsg]
186 *
187 * @par Lua函数原型
188 * peek(num: number, last_time: number) -> table
189 *
190 * @par JSON-RPC请求示例
191 * {"jsonrpc":"2.0","method":"rob1.Trace.peek","params":[1,0],"id":1}
192 *
193 * @par JSON-RPC响应示例
194 * {{"id":1,"jsonrpc":"2.0","result":[{"args":["RobotModeType.Running"],
195 * "code":30045,"level":"INFO","source":"rob1","timestamp":5102883064300}]}
196 * \endchinese
197 * \english
198 * peek the latest AlarmInfo (after the last retrieval)
199 *
200 * When last_time is set as 0, retrieve all AlarmInfo
201 *
202 * @param num
203 * @param last_time
204 * @return
205 *
206 * @par Python function prototype
207 * peek(self: pyaubo_sdk.Trace, arg0: int, arg1: int) ->
208 * List[arcs::common_interface::RobotMsg]
209 *
210 * @par Lua function prototype
211 * peek(num: number, last_time: number) -> table
212 *
213 * @par JSON-RPC request example
214 * {"jsonrpc":"2.0","method":"rob1.Trace.peek","params":[1,0],"id":1}
215 *
216 * @par JSON-RPC response example
217 * {{"id":1,"jsonrpc":"2.0","result":[{"args":["RobotModeType.Running"],
218 * "code":30045,"level":"INFO","source":"rob1","timestamp":5102883064300}]}
219 * \endenglish
220 */
221 RobotMsgVector peek(size_t num, uint64_t last_time = 0);
222
223protected:
224 void *d_;
225};
226
227using TracePtr = std::shared_ptr<Trace>;
228
229} // namespace common_interface
230} // namespace arcs
231#endif
提供给控制器扩展程序的日志记录系统
Definition trace.h:22
int popup(TraceLevel level, const std::string &title, const std::string &msg, int mode)
向连接的 RTDE 客户端发送弹窗请求
int alarm(TraceLevel level, int code, const std::vector< std::string > &args={})
向 aubo_control 日志注入告警信息 code定义参考 error_stack
RobotMsgVector peek(size_t num, uint64_t last_time=0)
peek最新的 AlarmInfo(上次一获取之后)
int textmsg(const std::string &msg)
打印文本信息到日志中
int notify(const std::string &msg)
通知上位机
std::shared_ptr< Trace > TracePtr
Definition trace.h:227
std::vector< RobotMsg > RobotMsgVector
Definition type_def.h:783
数据类型的定义