RtnCode.cs
3.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JAKA
{
/// <summary>
/// 接口调用返回值
/// </summary>
internal class RtnCode
{
/// <summary>
/// 调用成功
/// </summary>
public const int ERR_SUCC = 0;
/// <summary>
/// 异常调用,调用接口异常,控制器不支持
/// </summary>
public const int ERR_FUCTION_CALL_ERROR = 2;
/// <summary>
/// 无效的控制句柄
/// </summary>
public const int ERR_INVALID_HANDLER = -1;
/// <summary>
/// 无效的参数
/// </summary>
public const int ERR_INVALID_PARAMETER = -2;
/// <summary>
/// 通信连接错误
/// </summary>
public const int ERR_COMMUNICATION_ERR = -3;
/// <summary>
/// 逆解失败
/// </summary>
public const int ERR_KINE_INVERSE_ERR = -4;
/// <summary>
/// 急停开关被按下
/// </summary>
public const int ERR_EMERGENCY_PRESSED = -5;
/// <summary>
/// 机器人未上电
/// </summary>
public const int ERR_NOT_POWERED = -6;
/// <summary>
/// 机器人未使能
/// </summary>
public const int ERR_NOT_ENABLED = -7;
/// <summary>
/// 机器人没有进入 servo 模式
/// </summary>
public const int ERR_DISABLE_SERVOMODE = -8;
/// <summary>
/// 机器人没有关闭使能
/// </summary>
public const int ERR_NOT_OFF_ENABLE = -9;
/// <summary>
/// 程序正在运行,不允许操作
/// </summary>
public const int ERR_PROGRAM_IS_RUNNING = -10;
/// <summary>
/// 无法打开文件,文件不存在
/// </summary>
public const int ERR_CANNOT_OPEN_FILE = -11;
/// <summary>
/// 获取编码含义
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
public static string GetStrByCode(int code)
{
string str = "";
switch (code)
{
case ERR_SUCC:
str = "调用成功";
break;
case ERR_FUCTION_CALL_ERROR:
str = "调用接口异常,控制器不支持";
break;
case ERR_INVALID_HANDLER:
str = "无效的控制句柄";
break;
case ERR_INVALID_PARAMETER:
str = "无效的参数";
break;
case ERR_COMMUNICATION_ERR:
str = "通信连接错误";
break;
case ERR_KINE_INVERSE_ERR:
str = "逆解失败";
break;
case ERR_EMERGENCY_PRESSED:
str = "急停开关被按下";
break;
case ERR_NOT_POWERED:
str = "机器人未上电";
break;
case ERR_NOT_ENABLED:
str = "机器人未使能";
break;
case ERR_DISABLE_SERVOMODE:
str = "机器人没有进入 servo 模式";
break;
case ERR_NOT_OFF_ENABLE:
str = "机器人没有关闭使能";
break;
case ERR_PROGRAM_IS_RUNNING:
str = "程序正在运行,不允许操作";
break;
case ERR_CANNOT_OPEN_FILE:
str = "无法打开文件,文件不存在";
break;
default:
str = $"不存在的接口调用返回值:{code}";
break;
}
return str;
}
}
}