-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpredef.h
More file actions
211 lines (163 loc) · 4.14 KB
/
predef.h
File metadata and controls
211 lines (163 loc) · 4.14 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
#ifndef _PREDEF_
#define _PREDEF_
#ifdef __linux__
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <linux/usbdevice_fs.h>
#elif defined(_WIN32) || defined(_WIN64)
#include <conio.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <utime.h>
#include <sys/time.h>
#include <string>
#include <ctime>
#include <deque>
#include <vector>
#include "memdb.h"
#include "logger.h"
using namespace std;
#define thread_local __thread
//////////////////////////////////////////////////////////////////////////
#include <gphoto2/gphoto2-camera.h>
#include <gphoto2/gphoto2-abilities-list.h>
#include <gphoto2/gphoto2-context.h>
#include <gphoto2/gphoto2-port-log.h>
#include <gphoto2/gphoto2-setting.h>
#include <gphoto2/gphoto2-filesys.h>
#include <gphoto2/gphoto2-port-result.h>
typedef struct _GPParams GPParams;
struct _GPParams
{
std::string name;
Camera* camera;
GPContext* context;
GPPortInfoList* portinfo_list;
CameraAbilitiesList* _abilities_list;
_GPParams()
{
camera = NULL;
GPContext* context = NULL;
portinfo_list = NULL;
_abilities_list = NULL;
}
};
enum wait_type
{
WAIT_TIME,
WAIT_EVENTS,
WAIT_FRAMES,
WAIT_STRING,
};
enum download_type { DT_NO_DOWNLOAD, DT_DOWNLOAD };
struct waitparams
{
union
{
int milliseconds;
int events;
int frames;
char* str;
} u;
enum wait_type type;
enum download_type downloadtype;
};
//////////////////////////////////////////////////////////////////////////
#include <curl/curl.h>
struct WriteThis
{
int camnum;
char* readptr;
size_t totalsize;
size_t sizeleft;
WriteThis()
{
camnum = -1;
readptr = NULL;
totalsize = 0;
sizeleft = 0;
}
};
//////////////////////////////////////////////////////////////////////////
#define CAPTURE_TO_RAM 0 // "Internal RAM"
#define CAPTURE_TO_SDCARD 1 // "Memory card"
// 카메라 최대 8개
#define MAX_CAMERA 8
// 카메라 상태
enum CAMERA_STATE
{
STATE_NONE,
STATE_STARTCONNECT,
STATE_CONNECTION,
STATE_CONNECT_ERROR,
STATE_READY,
STATE_FOCUSING,
STATE_SHOT,
STATE_UPLOAD,
STATE_UPLOADING,
};
//////////////////////////////////////////////////////////////////////////
//#define USE_NONEBLOCK
#define PATCHDOWNLOADDIR "./tempdownload"
#define PATCHSERVER_ADD "http://127.0.0.1:8000/patch/patch.xml"
#define PATCHFILENAME "patch.xml"
#define SERVER_ADD "192.168.29.103"
#define SERVER_PORT 8888
#define SERVER_UDP_PORT 11000
#define SOCKET_BUFFER 4096
#define TCP_BUFFER 8
#define UDP_BUFFER 8
//#define I_AM_SERVER
////////////////////////////////////////////////////////////////////////// network packet
// response packet
#define RESPONSE_OK 0x05
#define RESPONSE_FAIL 0x06
// Log packet
#define CLIENT_LOG_INFO 0x0a
#define CLIENT_LOG_WARN 0x0b
#define CLIENT_LOG_ERR 0x0c
// Packet
#define PACKET_TRY_CONNECT 0x05 // connect to server
#define PACKET_SHOT 0x10 // shot picture
#define PACKET_HALFPRESS 0x20 // auto focus
#define PACKET_HALFRELEASE 0x21 // auto focus cancel
#define PACKET_ISO 0x31
#define PACKET_APERTURE 0x32
#define PACKET_SHUTTERSPEED 0x33
#define PACKET_FORCE_UPLOAD 0x40 // for test
#define PACKET_UPLOAD_PROGRESS 0x41
#define PACKET_UPLOAD_DONE 0x42
#define PACKET_AUTOFOCUS_RESULT 0x50
#define DEFAULT_CAPTURENAME "capt0000.jpg"
//////////////////////////////////////////////////////////////////////////
enum CAMERA_PARAM
{
ISO,
SHUTTERSPEED,
APERTURE
};
#define ISO_VALUE 3 // 400
#define SHUTTERSPEED_VALUE 36 // 1 / 100
//#define SHUTTERSPEED_VALUE 46 // 1/1000
#define APERTURE_VALUE 5 // 9
/*
#define ISO_VALUE "400"
#define SHUTTERSPEED_VALUE "1/100"
//#define SHUTTERSPEED_VALUE 46 // 1/1000
#define APERTURE_VALUE "9"
*/
extern string iso;
extern string aperture;
extern string shutterspeed;
extern string apertureString[];
extern string isoString[];
extern string shutterspeedString[];
extern string serveraddress;
extern string camera_id;
#endif