-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathScreenCaptureApi.h
109 lines (94 loc) · 2.86 KB
/
ScreenCaptureApi.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
#ifndef __SCREENCAPTUREAPI_H__
#define __SCREENCAPTUREAPI_H__
#include "screencaptureapi_export.h"
struct ScreenCaptureSpi
{
/**
* @brief Response of connect
*
* @param imgWidth width of screen resolution
* @param imgHeight height of screen resolution
*/
virtual void onConnectRspRtn(int imgWidth, int imgHeight){};
/**
* @brief Response of startQueryScreenStream
*
* @param msg reply message
*/
virtual void onStartQueryScreenStreamRspRtn(const char *msg){};
/**
* @brief Response of stopQueryScreenStream
*
* @param msg reply message
*/
virtual void onStopQueryScreenStreamRspRtn(const char *msg){};
/**
* @brief Response of disconnect
*
* @param msg reply message
*/
virtual void onDisConnectRspRtn(const char *msg){};
/**
* @brief Screen image stream return
*
* @param data image data (after jpeg encode)
* @param length data length
*/
virtual void onStreamRtn(unsigned char *data, int length){};
/**
* @brief Single screenshot image return
*
* @param data image data (after jpeg encode)
* @param length data length
*/
virtual void onImageRtn(unsigned char *data, int length){};
virtual ~ScreenCaptureSpi(){};
};
struct ScreenCaptureApi
{
/**
* @brief Create instance of api
*
* @param spi your own SPI
* @return ScreenCaptureApi*
*/
SCREENCAPTUREAPI_EXPORT static ScreenCaptureApi *create(ScreenCaptureSpi &spi);
SCREENCAPTUREAPI_EXPORT virtual ~ScreenCaptureApi(){};
/**
* @brief connect to server
*
* @param ip server ip
* @param port server port
* @return error code 0 is success
*/
SCREENCAPTUREAPI_EXPORT virtual int connect(const char *ip, int port) = 0;
/**
* @brief query a single screenshot image
*
* @param targetWidth return image width, default -1(origin size)
* @param targetHeight return image height, default -1(origin size)
* @return error code 0 is success
*/
SCREENCAPTUREAPI_EXPORT virtual int queryScreenImage(int targetWidth = -1, int targetHeight = -1) = 0;
/**
* @brief start query screen image stream
*
* @param targetWidth return image width, default -1(origin size)
* @param targetHeight return image height, default -1(origin size)
* @return error code 0 is success
*/
SCREENCAPTUREAPI_EXPORT virtual int startQueryScreenStream(int targetWidth = -1, int targetHeight = -1) = 0;
/**
* @brief stop query screen image stream
*
* @return error code 0 is success
*/
SCREENCAPTUREAPI_EXPORT virtual int stopQueryScreenStream() = 0;
/**
* @brief disconnect to server
*
* @return error code 0 is success
*/
SCREENCAPTUREAPI_EXPORT virtual void disconnect() = 0;
};
#endif // __SCREENCAPTUREAPI_H__