Tange Cloud for Device
 Rev.345
载入中...
搜索中...
未找到
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/** 呼叫设备,等待用户应答. 需要发送正应答后才才能拉流和对讲 req: Tcis_CallReq; resp: 要以 @ref extended_general_response "扩展的通用状态应答" 方式返回 Tcis_CallResp */
60#define TCI_CMD_CALL 0x0302
61
62
63#define TCI_CMD_TESTSPEED 0x0200
64//#define TCI_CMD_TESTSPEED_DATA 0x0201
65
66
67#define TCI_CMD_SPEAKERSTART 0x0350
68#define TCI_CMD_SPEAKERSTOP 0x0351 ///< WARNING: 这个命令值为奇数
69#define TCI_CMD_START_TALK 0x0332 ///< 代替 TCI_CMD_SPEAKERSTART
70
71#define TCI_CMD_SETSTREAMCTRL_REQ 0x0320
72#define TCI_CMD_SETSTREAMCTRL_RESP 0x0321
73#define TCI_CMD_GETSTREAMCTRL_REQ 0x0322
74#define TCI_CMD_GETSTREAMCTRL_RESP 0x0323
75
76#define TCI_CMD_DEVINFO_REQ 0x0330
77#define TCI_CMD_DEVINFO_RESP 0x0331
78
79#define TCI_CMD_ENTER_SETUP 0x0338 ///< 进入设置页. 无参数无应答
80#define TCI_CMD_LEAVE_SETUP 0x0336 ///< 离开设置页. 无参数无应答
81
82/** @struct Tcis_AVStream
83 TCI_CMD_VIDEOSTART = 0x01FF,
84 TCI_CMD_VIDEOSTOP = 0x02FF,
85 TCI_CMD_AUDIOSTART = 0x0300,
86 TCI_CMD_AUDIOSTOP = 0x0301,
87 TCI_CMD_SPEAKERSTART = 0x0350,
88 TCI_CMD_SPEAKERSTOP = 0x0351,
89 TCI_CMD_START_TALK 0x0332 //代替 TCI_CMD_SPEAKERSTART
90 */
91
92__BEGIN_PACKED__
93
94typedef struct
95{
96 unsigned int avIndex; ///< avIndex
97 unsigned int channel; ///< Camera Index
98} __PACKED__ Tcis_AVStream;
99
100#if 0
101/** @struct Tcis_GetStreamCtrlReq
102 TCI_CMD_GETSTREAMCTRL_REQ = 0x0322,
103 */
104typedef struct
105{
106 unsigned int channel; ///< Camera Index
107 unsigned char reserved[4];
108} __PACKED__ Tcis_GetStreamCtrlReq;
109#endif
110
111typedef struct Tcis_GetMediaInfo {
112 int type; ///< 0: get type
113 int dummy;
114} __PACKED__ Tcis_GetMediaInfo;
115
116typedef struct Tcis_MediaInfo {
117 int type;
118 union {
119 struct {
120 int n_achn;
121 int n_vchn, n_streams_per_vchn;
122 unsigned char types[32];
123 } mt;
124 } u;
125} __PACKED__ Tcis_MediaInfo;
126
127/**
128 TCI_CMD_SETSTREAMCTRL_REQ = 0x0320,
129 TCI_CMD_GETSTREAMCTRL_RESP = 0x0323,
130 * @struct Tcis_SetStreamCtrlReq, Tcis_GetStreamCtrlResp
131 */
132typedef struct
133{
134 unsigned int channel; ///< Camera Index
135 unsigned char quality; //refer to @ref ENUM_QUALITY_LEVEL
136 unsigned char reserved[3];
138
139/** @struct Tcis_SetStreamCtrlResp
140 TCI_CMD_SETSTREAMCTRL_RESP = 0x0321,
141 */
142typedef struct
143{
144 int result; ///< 0: success; otherwise: failed.
145 unsigned char reserved[4];
146} __PACKED__ Tcis_SetStreamCtrlResp;
147
148/** @struct Tcis_GetRecordReq
149 TCI_CMD_GETRECORD_REQ = 0x0312,
150 */
151typedef struct
152{
153 unsigned int channel; ///< Camera Index
154 unsigned char reserved[4];
155} __PACKED__ Tcis_GetRecordReq;
156
157/** @struct Tcis_DeviceInfoReq
158 TCI_CMD_DEVINFO_REQ = 0x0330,
159 */
160typedef struct
161{
162 unsigned char reserved[4];
163} __PACKED__ Tcis_DeviceInfoReq;
164
165
166/** @struct Tcis_DeviceInfoResp
167 TCI_CMD_DEVINFO_RESP = 0x0331,
168 */
169typedef struct
170{
171 char model[16]; ///< IPCam mode
172 char vendor[16]; ///< IPCam manufacturer
173 unsigned int version; ///< IPCam firmware version ex. v1.2.3.4 => 0x01020304; v1.0.0.2 => 0x01000002
174 unsigned int channel; ///< Camera index
175 unsigned int total; ///< 0: No cards been detected or an unrecognizeable sdcard that could not be re-formatted.
176 ///< -1: if camera detect an unrecognizable sdcard, and could be re-formatted
177 ///< otherwise: return total space size of sdcard (MBytes)
178
179 unsigned int free; ///< Free space size of sdcard (MBytes)
180 unsigned char reserved[8]; ///< reserved
181} __PACKED__ Tcis_DeviceInfoResp;
182
183#define TCI_CMD_GETGPSINFO_REQ 0x0334
184typedef struct Tcis_GetGpsInfoReq {
185 int flags; ///< 0: Request/Answer方式取一次, 忽略avIndex;
186 ///< 1: 流式,在avIndex通道上发送. 暂时只支持R/A方式
187
188 int avIndex; ///< flags==1时为流式发送的p2p通道
189} __PACKED__ Tcis_GetGpsInfoReq;
190
191
192#define TCI_CMD_GETGPSINFO_RESP 0x0335
193/** gps information */
194typedef struct TcisGpsInfo {
195 uint32_t time; ///< 采集时间,utc
196 uint32_t signal_strength; ///< 0-未知; 1-弱; 2-一般; 3-强
197 double longitude, latitude; ///< 经/纬度
198 double speed; ///< 速度: km/h
199 int32_t angle; ///< 相对于正北的方位角(度): 0~359
200} __PACKED__ TcisGpsInfo;
201typedef struct TcisGpsInfo Tcis_GetGpsInfoResp;
202
203#define TCI_CMD_PASSWORD_REQ 0X8002
204typedef struct Tcis_ExPassWordReq
205{
206 STimeDay livetime; ///< 配网时清0. AP直连时设为手机的时间
207 char password[48];
208 unsigned char reserved[4];
209 char timezone[0]; ///< 结构长度大于60时存在timezone成员。以'\0'结尾
210} __PACKED__ Tcis_ExPassWordReq;
211
212#define TCI_CMD_PASSWORD_RESP 0x8003
213typedef struct {
214 unsigned int result; //0 pass -1 no pass
215 unsigned char reserved[4];
216} __PACKED__ Tcis_ExPassWordResp;
217
218#define TCI_CMD_SETPASSWORD_REQ 0x8004
219/** 设置直连模式密码请求参数结构体.
220 @ref TCI_CMD_SETPASSWORD_REQ = 0x8004,
221 */
222typedef struct
223{
224 char oldpasswd[32]; ///< The old security code
225 char newpasswd[32]; ///< The new security code
226} __PACKED__ Tcis_SetPasswdReq;
227
228
229#define TCI_CMD_APLINK_SETWIFI_REQ 0X8006
230//req: _TG_IPC_REGISTER_INFO_AP;
231#define TCI_CMD_APLINK_SETWIFI_RESP 0X8007 //resp: Tcis_SetWifiResp;
232#if 0 //defined in TgCloudCmd.h
233typedef struct Tcis_SetWifiResp {
234 int result; ///< 0: wifi connected; 1: failed to connect
235 unsigned char reserved[4];
236} __PACKED__ Tcis_SetWifiResp;
237#endif
238
239#define TCI_CMD_AP_PREVIEW_REQ 0X8008
240typedef struct Tcis_ExApPreviewReq {
241 unsigned int option;
242 char account[48];
243 char password[48];
244 unsigned char reserved[4];
245} __PACKED__ Tcis_ExApPreviewReq;
246
247#define TCI_CMD_AP_PREVIEW_RESP 0x8009
248
249typedef struct Tcis_ExApPreviewResp {
250 unsigned int result; ///< 1: pass , !1: no pass
251 unsigned char reserved[4];
252} __PACKED__ Tcis_ExApPreviewResp;
253
254
255
256/***************** 查询设备硬件能力 **************/
257#define TCI_CMD_GET_FEATURE_REQ 0x8024
258typedef struct {
259 char feature[4]; ///< Ignored. No parameters required
260} __PACKED__ Tcis_GetFeatureReq;
261
262#define TCI_CMD_GET_FEATURE_RESP 0x8025
263typedef struct {
264 char feature[1]; ///< json string of features
265} __PACKED__ Tcis_GetFeatureResp;
266
267#define TCI_CMD_SET_CLOUD_VIDEO_QUALITY_REQ 0x8028
268typedef struct
269{
270 unsigned int channel; ///< Camera Index
271 unsigned int quality; ///< 0: HD; 1: SD
272 unsigned char reserved[4];
274
275#define TCI_CMD_SET_CLOUD_VIDEO_QUALITY_RESP 0x8029
276typedef struct
277{
278 unsigned int result; ///< 1 ok , !1 no ok
279 unsigned char reserved[4]; ///< reserved, all zeros
281
282
283/** request of TCI_CMD_CALL */
284typedef
285struct Tcis_CallReq {
286 int call; ///< 1:call; 0:cancel
287 //以下成员在 call==1 时才需要
288 int flavor; ///< @ref ECALLFLAVOR
289 char name[36]; ///< null 结束的字符串, 长度不限
290} __PACKED__ Tcis_CallReq;
291
292/** response of TCI_CMD_CALL.
293 * 本响应必须通过 @ref extended_general_response "扩展通用状态应答" 的方式返回.
294 */
295typedef struct Tcis_CallResp {
296 /** - -1: 忙或无人接听
297 *
298 * 或 @ref ECALLFLAVOR:
299 * - 0: 拒接
300 * - 1: 接听(仅语音)
301 * - 2: 接听(音视频)
302 */
304 int reserved; ///< 0
305} __PACKED__ Tcis_CallResp;
306
307__END_PACKED__
308#endif
309
int result
0: wifi connected; 1: failed to connect
时间的表示方法
设置WiFi应答命令的参数结构体.
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直连时设为手机的时间
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,