Tange Cloud for Device
 Rev.355
载入中...
搜索中...
未找到
TgCloudCmd_internal.h
浏览该文件的文档.
1/** \file TgCloudCmd_internal.h
2 *
3 * 内部命令,仅限SDK和App使用.
4 */
5
6#ifndef __TgCloudCmd_internal_h__
7#define __TgCloudCmd_internal_h__
8
9#include "basedef.h"
10
11#define TCI_CMD_TELNET 0x0004
12typedef struct TcisSubControl {
13 int subcmd; ///< SUB_CTRL_xxx
15#define SUB_CTRL_TELNET_OPEN 0
16 //for resp: the encryption key of 16-bytes using to encrypt the data to send to remote
17 uint8_t encrypt_key[16];
18
19#define SUB_CTRL_TELNET_CLOSE 1
20
21#define SUB_CTRL_TELNET_DATA 2 //data from/to telnetd
22#define SUB_CTRL_FILE_BLOCK 8 //file block from/to app
23#define SUB_CTRL_LAST_FILE_BLOCK 10 //last file block from/to app
24 uint8_t data[1]; ///<
25
26#define SUB_CTRL_PUT_FILE 4
28 uint32_t flen;
29 uint8_t md5[16];
30 char path[1];
31 } __PACKED__ putfile;
32
33#define SUB_CTRL_PUT_FILE_RESP 5
34 int putfile_result; ///< 收到请求返回101, 开始发送文件。接收中或接收完发一次状态码(200:ok; >=500:error)
35
36#define SUB_CTRL_GET_FILE 6
38 char path[1];
39 } __PACKED__ getfile;
40
41#define SUB_CTRL_GET_FILE_RESP 7
43 int status; ///< error flag
44 int flen; ///< status=0; >=0: length of file; -1:chucked
45 uint8_t md5[16];
46 } __PACKED__ getfileresp;
47 } u;
48
49} __PACKED__ TcisSubControl;
50
51
52#define TCI_CMD_GET_MEDIAINFO 0x01FC ///< req: Tcis_GetMediaInfo; resp Tcis_MediaInfo
53//定义在 TgCloudCmdEx.h
54//#define TCI_CMD_VIDEOSTART 0x01FF ///< WARNING: 命令为奇数
55//#define TCI_CMD_VIDEOSTOP 0x02FF ///< WARNING: 命令为奇数
56//#define TCI_CMD_AUDIOSTART 0x0300
57//#define TCI_CMD_AUDIOSTOP 0x0301 ///< WARNING: 命令为奇数
58
59/** 呼叫设备,等待用户应答.
60 * 需要发送正应答后才才能拉流和对讲.
61 *
62 * req: Tcis_CallReq; resp: 要以 @ref extended_general_response "扩展的通用状态应答" 方式返回 Tcis_CallResp
63 *
64 * 接听后设备端挂断通话(TciHangup()), App会在命令通道上收到 @ref RTM_GOINGTO_SLEEP 消息.
65 * App挂断在TCI_CMD_ANSWERCALL 命令里发送 CALLSTATE_HANGUP 状态.
66 *
67 * 访问端要在新连接上执行呼叫, 通话结束或呼叫失败都要关掉连接.
68 *
69 * 能力描述: 在 @ref Feature_Profile 中加入 \c Callee 属性
70 */
71#define TCI_CMD_CALL 0x0302
72
73
74#define TCI_CMD_TESTSPEED 0x0200
75//#define TCI_CMD_TESTSPEED_DATA 0x0201
76
77
78#define TCI_CMD_SPEAKERSTART 0x0350
79#define TCI_CMD_SPEAKERSTOP 0x0351 ///< WARNING: 这个命令值为奇数
80#define TCI_CMD_START_TALK 0x0332 ///< 代替 TCI_CMD_SPEAKERSTART
81
82#define TCI_CMD_SETSTREAMCTRL_REQ 0x0320
83#define TCI_CMD_SETSTREAMCTRL_RESP 0x0321
84#define TCI_CMD_GETSTREAMCTRL_REQ 0x0322
85#define TCI_CMD_GETSTREAMCTRL_RESP 0x0323
86
87#define TCI_CMD_DEVINFO_REQ 0x0330
88#define TCI_CMD_DEVINFO_RESP 0x0331
89
90#define TCI_CMD_ENTER_SETUP 0x0338 ///< 进入设置页. 无参数无应答
91#define TCI_CMD_LEAVE_SETUP 0x0336 ///< 离开设置页. 无参数无应答
92
93/** @struct Tcis_AVStream
94 TCI_CMD_VIDEOSTART = 0x01FF,
95 TCI_CMD_VIDEOSTOP = 0x02FF,
96 TCI_CMD_AUDIOSTART = 0x0300,
97 TCI_CMD_AUDIOSTOP = 0x0301,
98 TCI_CMD_SPEAKERSTART = 0x0350,
99 TCI_CMD_SPEAKERSTOP = 0x0351,
100 TCI_CMD_START_TALK 0x0332 //代替 TCI_CMD_SPEAKERSTART
101 */
102
103__BEGIN_PACKED__
104
105typedef struct
106{
107 unsigned int avIndex; ///< avIndex
108 unsigned int channel; ///< Camera Index
109} __PACKED__ Tcis_AVStream;
110
111#if 0
112/** @struct Tcis_GetStreamCtrlReq
113 TCI_CMD_GETSTREAMCTRL_REQ = 0x0322,
114 */
115typedef struct
116{
117 unsigned int channel; ///< Camera Index
118 unsigned char reserved[4];
119} __PACKED__ Tcis_GetStreamCtrlReq;
120#endif
121
122typedef struct Tcis_GetMediaInfo {
123 int type; ///< 0: get type
124 int dummy;
125} __PACKED__ Tcis_GetMediaInfo;
126
127typedef struct Tcis_MediaInfo {
128 int type;
129 union {
130 struct {
131 int n_achn;
132 int n_vchn, n_streams_per_vchn;
133 unsigned char types[32];
134 } mt;
135 } u;
136} __PACKED__ Tcis_MediaInfo;
137
138/** 视频质量表示*/
140{
141 TCIC_QUALITY_AUTO = 0x00, ///< 自适应码流(需要设备支持 @ref Feature_Resolutions)
142 TCIC_QUALITY_MAX = 0x01, ///< 最高质量
143 TCIC_QUALITY_HIGH = 0x02,
144 TCIC_QUALITY_MIDDLE = 0x03,
145 TCIC_QUALITY_LOW = 0x04,
146 TCIC_QUALITY_MIN = 0x05, ///< 最低质量
148
149/**
150 TCI_CMD_SETSTREAMCTRL_REQ = 0x0320,
151 TCI_CMD_GETSTREAMCTRL_RESP = 0x0323,
152 * @struct Tcis_SetStreamCtrlReq, @struct Tcis_GetStreamCtrlResp
153 */
154typedef struct
155{
156 unsigned int channel; ///< Camera Index
157 unsigned char quality; //refer to @ref ENUM_QUALITY_LEVEL
158 unsigned char reserved[3];
160
161/** @struct Tcis_SetStreamCtrlResp
162 TCI_CMD_SETSTREAMCTRL_RESP = 0x0321,
163 */
164typedef struct
165{
166 int result; ///< 0: success; otherwise: failed.
167 unsigned char reserved[4];
168} __PACKED__ Tcis_SetStreamCtrlResp;
169
170/** @struct Tcis_GetRecordReq
171 TCI_CMD_GETRECORD_REQ = 0x0312,
172 */
173typedef struct
174{
175 unsigned int channel; ///< Camera Index
176 unsigned char reserved[4];
177} __PACKED__ Tcis_GetRecordReq;
178
179/** @struct Tcis_DeviceInfoReq
180 TCI_CMD_DEVINFO_REQ = 0x0330,
181 */
182typedef struct
183{
184 unsigned char reserved[4];
185} __PACKED__ Tcis_DeviceInfoReq;
186
187
188/** @struct Tcis_DeviceInfoResp
189 TCI_CMD_DEVINFO_RESP = 0x0331,
190 */
191typedef struct
192{
193 char model[16]; ///< IPCam mode
194 char vendor[16]; ///< IPCam manufacturer
195 unsigned int version; ///< IPCam firmware version ex. v1.2.3.4 => 0x01020304; v1.0.0.2 => 0x01000002
196 unsigned int channel; ///< Camera index
197 unsigned int total; ///< 0: No cards been detected or an unrecognizeable sdcard that could not be re-formatted.
198 ///< -1: if camera detect an unrecognizable sdcard, and could be re-formatted
199 ///< otherwise: return total space size of sdcard (MBytes)
200
201 unsigned int free; ///< Free space size of sdcard (MBytes)
202 unsigned char reserved[8]; ///< reserved
203} __PACKED__ Tcis_DeviceInfoResp;
204
205#define TCI_CMD_GETGPSINFO_REQ 0x0334
206typedef struct Tcis_GetGpsInfoReq {
207 int flags; ///< 0: Request/Answer方式取一次, 忽略avIndex;
208 ///< 1: 流式,在avIndex通道上发送. 暂时只支持R/A方式
209
210 int avIndex; ///< flags==1时为流式发送的p2p通道
211} __PACKED__ Tcis_GetGpsInfoReq;
212
213
214#define TCI_CMD_GETGPSINFO_RESP 0x0335
215/** gps information */
216typedef struct TcisGpsInfo {
217 uint32_t time; ///< 采集时间,utc
218 uint32_t signal_strength; ///< 0-未知; 1-弱; 2-一般; 3-强
219 double longitude, latitude; ///< 经/纬度
220 double speed; ///< 速度: km/h
221 int32_t angle; ///< 相对于正北的方位角(度): 0~359
222} __PACKED__ TcisGpsInfo;
223typedef struct TcisGpsInfo Tcis_GetGpsInfoResp;
224
225#define TCI_CMD_PASSWORD_REQ 0X8002
226typedef struct Tcis_ExPassWordReq
227{
228 STimeDay livetime; ///< 配网时清0. AP直连时设为手机的时间
229 char password[48];
230 unsigned char reserved[4];
231 char timezone[0]; ///< 结构长度大于60时存在timezone成员。以'\0'结尾
232} __PACKED__ Tcis_ExPassWordReq;
233
234#define TCI_CMD_PASSWORD_RESP 0x8003
235typedef struct {
236 unsigned int result; //0 pass -1 no pass
237 unsigned char reserved[4];
238} __PACKED__ Tcis_ExPassWordResp;
239
240#define TCI_CMD_SETPASSWORD_REQ 0x8004
241/** 设置直连模式密码请求参数结构体.
242 @ref TCI_CMD_SETPASSWORD_REQ = 0x8004,
243 */
244typedef struct
245{
246 char oldpasswd[32]; ///< The old security code
247 char newpasswd[32]; ///< The new security code
248} __PACKED__ Tcis_SetPasswdReq;
249
250
251#define TCI_CMD_APLINK_SETWIFI_REQ 0X8006
252//req: _TG_IPC_REGISTER_INFO_AP;
253#define TCI_CMD_APLINK_SETWIFI_RESP 0X8007 //resp: Tcis_SetWifiResp;
254#if 0 //defined in TgCloudCmd.h
255typedef struct Tcis_SetWifiResp {
256 int result; ///< 0: wifi connected; 1: failed to connect
257 unsigned char reserved[4];
258} __PACKED__ Tcis_SetWifiResp;
259#endif
260
261#define TCI_CMD_AP_PREVIEW_REQ 0X8008
262typedef struct Tcis_ExApPreviewReq {
263 unsigned int option;
264 char account[48];
265 char password[48];
266 unsigned char reserved[4];
267} __PACKED__ Tcis_ExApPreviewReq;
268
269#define TCI_CMD_AP_PREVIEW_RESP 0x8009
270
271typedef struct Tcis_ExApPreviewResp {
272 unsigned int result; ///< 1: pass , !1: no pass
273 unsigned char reserved[4];
274} __PACKED__ Tcis_ExApPreviewResp;
275
276
277
278/***************** 查询设备硬件能力 **************/
279#define TCI_CMD_GET_FEATURE_REQ 0x8024
280typedef struct {
281 char feature[4]; ///< Ignored. No parameters required
282} __PACKED__ Tcis_GetFeatureReq;
283
284#define TCI_CMD_GET_FEATURE_RESP 0x8025
285typedef struct {
286 char feature[1]; ///< json string of features
287} __PACKED__ Tcis_GetFeatureResp;
288
289#define TCI_CMD_SET_CLOUD_VIDEO_QUALITY_REQ 0x8028
290typedef struct
291{
292 unsigned int channel; ///< Camera Index
293 unsigned int quality; ///< 0: HD; 1: SD
294 unsigned char reserved[4];
296
297#define TCI_CMD_SET_CLOUD_VIDEO_QUALITY_RESP 0x8029
298typedef struct
299{
300 unsigned int result; ///< 1 ok , !1 no ok
301 unsigned char reserved[4]; ///< reserved, all zeros
303
304
305/** request of TCI_CMD_CALL */
306typedef
307struct Tcis_CallReq {
308 int call; ///< 1:call; 0:cancel
309 //以下成员在 call==1 时才需要
310 int flavor; ///< @ref ECALLFLAVOR
311 /** null 结束的字符串, 长度不限. \n
312 * 如果是普通字符串,内容为呼叫都标志; 如果是json格式(以'{'开头),内容由通话双方自定义
313 */
314 char name[36];
315} __PACKED__ Tcis_CallReq;
316
317/** 呼叫响应码 */
318typedef enum {
319 CRC_BUSY = -2, ///< 占线
320 CRC_MISSED = -1, ///< 无人接听
321 CRC_REJECT = 0, ///< 拒接
322 CRC_FLAVOR_VOICE = 1, ///< 语音通话
323 CRC_FLAVOR_VIDEO = 2 ///< 视频通话
325
326/** response of TCI_CMD_CALL.
327 * 本响应必须通过 @ref extended_general_response "扩展通用状态应答" 的方式返回.
328 */
329typedef struct Tcis_CallResp {
330 /** 参见 @ref ECALLRESPCODE. */
332 int reserved; ///< 0
333} __PACKED__ Tcis_CallResp;
334
335__END_PACKED__
336#endif
337
int result
0: wifi connected; 1: failed to connect
时间的表示方法
设置WiFi应答命令的参数结构体.
ENUM_QUALITY_LEVEL
视频质量表示
@ TCIC_QUALITY_MIN
最低质量
@ TCIC_QUALITY_MAX
最高质量
@ TCIC_QUALITY_AUTO
自适应码流(需要设备支持 Resolutions)
unsigned int version
IPCam firmware version ex. v1.2.3.4 => 0x01020304; v1.0.0.2 => 0x01000002
int call
1:call; 0:cancel
unsigned int avIndex
avIndex
char timezone[0]
结构长度大于60时存在timezone成员。以'\0'结尾
int result
0: success; otherwise: failed.
char name[36]
null 结束的字符串, 长度不限.
double latitude
经/纬度
int avIndex
flags==1时为流式发送的p2p通道
uint32_t time
采集时间,utc
unsigned int channel
Camera Index
int flen
status=0; >=0: length of file; -1:chucked
unsigned int result
1: pass , !1: no pass
double speed
速度: km/h
uint32_t signal_strength
0-未知; 1-弱; 2-一般; 3-强
STimeDay livetime
配网时清0. AP直连时设为手机的时间
ECALLRESPCODE
呼叫响应码
@ CRC_MISSED
无人接听
@ CRC_BUSY
占线
@ CRC_FLAVOR_VIDEO
视频通话
@ CRC_REJECT
拒接
@ CRC_FLAVOR_VOICE
语音通话
int status
参见 ECALLRESPCODE.
unsigned int channel
Camera index
unsigned int free
Free space size of sdcard (MBytes)
unsigned int total
0: No cards been detected or an unrecognizeable sdcard that could not be re-formatted.
unsigned int channel
Camera Index
int putfile_result
收到请求返回101, 开始发送文件。接收中或接收完发一次状态码(200:ok; >=500:error)
int flags
0: Request/Answer方式取一次, 忽略avIndex; 1: 流式,在avIndex通道上发送.
unsigned int channel
Camera Index
int32_t angle
相对于正北的方位角(度): 0~359
TCI_CMD_VIDEOSTART = 0x01FF, TCI_CMD_VIDEOSTOP = 0x02FF, TCI_CMD_AUDIOSTART = 0x0300,...
request of TCI_CMD_CALL
response of TCI_CMD_CALL.
TCI_CMD_DEVINFO_REQ = 0x0330,
TCI_CMD_DEVINFO_RESP = 0x0331,
TCI_CMD_GETRECORD_REQ = 0x0312,
设置直连模式密码请求参数结构体.
TCI_CMD_SETSTREAMCTRL_REQ = 0x0320, TCI_CMD_GETSTREAMCTRL_RESP = 0x0323,
TCI_CMD_SETSTREAMCTRL_RESP = 0x0321,