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