-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
errormanager.h
136 lines (130 loc) · 3.99 KB
/
errormanager.h
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#ifndef ERRORMANAGER_H
#define ERRORMANAGER_H
#include <QString>
#include <QObject>
class ErrorManager
{
public:
ErrorManager();
static QString error_codes (QString Source, unsigned int errcode) {
QString errtxt;
switch (errcode) {
case 0:
errtxt=QObject::tr("No error");
break;
case 1:
errtxt=QObject::tr("Illegal input parameter");
break;
case 2:
errtxt=QObject::tr("Calling reference error (function are supposed to be called in another order).");
break;
case 3:
errtxt=QObject::tr("Set timer failure");
break;
case 4:
errtxt=QObject::tr("Video decoding failure");
break;
case 5:
errtxt=QObject::tr(" Audio decoding failure");
break;
case 6:
errtxt=QObject::tr("Memory allocation failure");
break;
case 7:
errtxt=QObject::tr("File operation failure");
break;
case 8:
errtxt=QObject::tr("Create thread failure");
break;
case 9:
errtxt=QObject::tr("Create directDraw failure");
break;
case 10:
errtxt=QObject::tr("Create off-screen failure");
break;
case 11:
errtxt=QObject::tr("Buffer overflow, input stream failure");
break;
case 12:
errtxt=QObject::tr("Create sound device failure");
break;
case 13:
errtxt=QObject::tr("Set volume failure");
break;
case 14:
errtxt=QObject::tr("This API can only be called in file decoding mode");
break;
case 15:
errtxt=QObject::tr("This API can only be called in stream decoding mode");
break;
case 16:
//errtxt=QObject::tr("System not support, the SDK can only work with CPU above Pentium 3");
break;
case 17:
errtxt=QObject::tr("Missing file header");
break;
case 18:
errtxt=QObject::tr("Version mismatch between encoder and decoder");
break;
case 19:
errtxt=QObject::tr("Initialize decoder failure");
break;
case 20:
errtxt=QObject::tr("File too short or unrecognizable stream");
break;
case 21:
errtxt=QObject::tr("Initialize timer failure");
break;
case 22:
errtxt=QObject::tr("BLT failure");
break;
case 23:
errtxt=QObject::tr("Update overlay surface failure");
break;
case 24:
errtxt=QObject::tr("Open video & audio stream failure");
break;
case 25:
errtxt=QObject::tr("Open video stream failure");
break;
case 26:
errtxt=QObject::tr("JPEG compression failure");
break;
case 27:
errtxt=QObject::tr("File type not supported");
break;
case 28:
errtxt=QObject::tr("Data error");
break;
case 29:
errtxt=QObject::tr("Secret key error");
break;
case 30:
errtxt=QObject::tr("Key frame decoding failure");
break;
case 31:
errtxt=QObject::tr("NEED_MORE_DATA");
break;
case 32:
errtxt=QObject::tr("INVALID_PORT");
break;
case 33:
errtxt=QObject::tr("NOT_FIND");
break;
case 34:
errtxt=QObject::tr("NEED_LARGER_BUFFER");
break;
case 99:
errtxt=QObject::tr("FAIL_UNKNOWN");
break;
}
if (errcode > 0 && errcode != 16) {
printf("---Hik Sdk error response :from %s : %s\r\n", Source.toUtf8().data(), errtxt.toUtf8().data());
}
if (errcode != 16 && errtxt == "") {
printf("---Hik Sdk error unknow response :from %s : %u\r\n", Source.toUtf8().data(), errcode);
}
return errtxt;
}
};
#endif // ERRORMANAGER_H