1 /**************************************************
2 this is the second version of release SVB Camera SVBs
3 any question feel free contact us
4 
5 here is the suggested procedure to operate the camera.
6 
7 --> SVBGetNumOfConnectedCameras
8 ----> SVBGetCameraProperty for each camera
9 
10 --> SVBOpenCamera
11 --> SVBGetNumOfControls
12 ----> SVBGetControlCaps for each contronl and set or get value from them
13 
14 --> SVBSetROIFormat
15 
16 --> SVBSetCameraMode
17 
18 --> SVBStartVideoCapture
19 
20 //this is recommended to do in another thread
21 while(1)
22 {
23 	SVBGetVideoData
24 	...
25 }
26 
27 --> SVBStopVideoCapture
28 --> SVBCloseCamera
29 
30 ***************************************************/
31 #ifndef SVBCAMERA2_H
32 #define SVBCAMERA2_H
33 
34 
35 
36 
37 #ifdef _WINDOWS
38 #ifdef SVBCAMERA_EXPORTS
39 	#define SVBCAMERA_API __declspec(dllexport)
40 #else
41 	#define SVBCAMERA_API __declspec(dllimport)
42 #endif
43 #else
44 	#define SVBCAMERA_API
45 #endif
46 
47 #define SVBCAMERA_ID_MAX 128
48 
49 typedef enum SVB_BAYER_PATTERN{
50 	SVB_BAYER_RG=0,
51 	SVB_BAYER_BG,
52 	SVB_BAYER_GR,
53 	SVB_BAYER_GB
54 }SVB_BAYER_PATTERN;
55 
56 typedef enum SVB_IMG_TYPE{ //Supported Video Format
57 	SVB_IMG_RAW8 = 0,
58 	SVB_IMG_RAW10,
59 	SVB_IMG_RAW12,
60 	SVB_IMG_RAW14,
61 	SVB_IMG_RAW16,
62 	SVB_IMG_Y8,
63 	SVB_IMG_Y10,
64 	SVB_IMG_Y12,
65 	SVB_IMG_Y14,
66 	SVB_IMG_Y16,
67 	SVB_IMG_RGB24,
68 	SVB_IMG_RGB32,
69 	SVB_IMG_END = -1
70 
71 }SVB_IMG_TYPE;
72 
73 typedef enum SVB_GUIDE_DIRECTION{ //Guider Direction
74 	SVB_GUIDE_NORTH=0,
75 	SVB_GUIDE_SOUTH,
76 	SVB_GUIDE_EAST,
77 	SVB_GUIDE_WEST
78 }SVB_GUIDE_DIRECTION;
79 
80 
81 
82 typedef enum SVB_FLIP_STATUS {
83 	SVB_FLIP_NONE = 0,//: original
84 	SVB_FLIP_HORIZ,//: horizontal flip
85 	SVB_FLIP_VERT,// vertical flip
86 	SVB_FLIP_BOTH,//:both horizontal and vertical flip
87 
88 }SVB_FLIP_STATUS;
89 
90 typedef enum SVB_CAMERA_MODE {
91 	SVB_MODE_NORMAL = 0,
92 	SVB_MODE_TRIG_SOFT,
93 	SVB_MODE_TRIG_RISE_EDGE,
94 	SVB_MODE_TRIG_FALL_EDGE,
95 	SVB_MODE_TRIG_DOUBLE_EDGE,
96 	SVB_MODE_TRIG_HIGH_LEVEL,
97 	SVB_MODE_TRIG_LOW_LEVEL,
98 	SVB_MODE_END = -1
99 }SVB_CAMERA_MODE;
100 
101 typedef enum SVB_TRIG_OUTPUT {
102 	SVB_TRIG_OUTPUT_PINA = 0,//: Only Pin A output
103 	SVB_TRIG_OUTPUT_PINB,//: Only Pin B output
104 	SVB_TRIG_OUTPUT_NONE = -1
105 }SVB_TRIG_OUTPUT_PIN;
106 
107 typedef enum SVB_ERROR_CODE{ //SVB ERROR CODE
108 	SVB_SUCCESS=0,
109 	SVB_ERROR_INVALID_INDEX, //no camera connected or index value out of boundary
110 	SVB_ERROR_INVALID_ID, //invalid ID
111 	SVB_ERROR_INVALID_CONTROL_TYPE, //invalid control type
112 	SVB_ERROR_CAMERA_CLOSED, //camera didn't open
113 	SVB_ERROR_CAMERA_REMOVED, //failed to find the camera, maybe the camera has been removed
114 	SVB_ERROR_INVALID_PATH, //cannot find the path of the file
115 	SVB_ERROR_INVALID_FILEFORMAT,
116 	SVB_ERROR_INVALID_SIZE, //wrong video format size
117 	SVB_ERROR_INVALID_IMGTYPE, //unsupported image formate
118 	SVB_ERROR_OUTOF_BOUNDARY, //the startpos is out of boundary
119 	SVB_ERROR_TIMEOUT, //timeout
120 	SVB_ERROR_INVALID_SEQUENCE,//stop capture first
121 	SVB_ERROR_BUFFER_TOO_SMALL, //buffer size is not big enough
122 	SVB_ERROR_VIDEO_MODE_ACTIVE,
123 	SVB_ERROR_EXPOSURE_IN_PROGRESS,
124 	SVB_ERROR_GENERAL_ERROR,//general error, eg: value is out of valid range
125 	SVB_ERROR_INVALID_MODE,//the current mode is wrong
126 	SVB_ERROR_INVALID_DIRECTION,//invalid guide direction
127 	SVB_ERROR_UNKNOW_SENSOR_TYPE,//unknow sensor type
128 	SVB_ERROR_END
129 }SVB_ERROR_CODE;
130 
131 typedef enum SVB_BOOL{
132 	SVB_FALSE =0,
133 	SVB_TRUE
134 }SVB_BOOL;
135 
136 typedef struct SVB_CAMERA_INFO
137 {
138 	char FriendlyName[32];
139 	char CameraSN[32];
140 	char PortType[32];
141 	unsigned int DeviceID;
142 	int CameraID;
143 } SVB_CAMERA_INFO;
144 
145 typedef struct SVB_CAMERA_PROPERTY
146 {
147 	long MaxHeight; //the max height of the camera
148 	long MaxWidth;	//the max width of the camera
149 
150 	SVB_BOOL IsColorCam;
151 	SVB_BAYER_PATTERN BayerPattern;
152 	int SupportedBins[16]; //1 means bin1 which is supported by every camera, 2 means bin 2 etc.. 0 is the end of supported binning method
153 	SVB_IMG_TYPE SupportedVideoFormat[8];
154 
155 	int MaxBitDepth;
156 	SVB_BOOL IsTriggerCam;
157 }SVB_CAMERA_PROPERTY;
158 
159 #define SVB_BRIGHTNESS SVB_OFFSET
160 #define SVB_AUTO_MAX_BRIGHTNESS SVB_AUTO_TARGET_BRIGHTNESS
161 
162 typedef enum SVB_CONTROL_TYPE{ //Control type//
163 	SVB_GAIN = 0,
164 	SVB_EXPOSURE,
165 	SVB_GAMMA,
166 	SVB_GAMMA_CONTRAST,
167 	SVB_WB_R,
168 	SVB_WB_G,
169 	SVB_WB_B,
170 	SVB_FLIP,//reference: enum SVB_FLIP_STATUS
171 	SVB_FRAME_SPEED_MODE,//0:low speed, 1:medium speed, 2:high speed
172 	SVB_CONTRAST,
173 	SVB_SHARPNESS,
174 	SVB_SATURATION,
175 
176 	SVB_AUTO_TARGET_BRIGHTNESS,
177 	SVB_BLACK_LEVEL, //black level offset
178 }SVB_CONTROL_TYPE;
179 
180 typedef struct _SVB_CONTROL_CAPS
181 {
182 	char Name[64]; //the name of the Control like Exposure, Gain etc..
183 	char Description[128]; //description of this control
184 	long MaxValue;
185 	long MinValue;
186 	long DefaultValue;
187 	SVB_BOOL IsAutoSupported; //support auto set 1, don't support 0
188 	SVB_BOOL IsWritable; //some control like temperature can only be read by some cameras
189 	SVB_CONTROL_TYPE ControlType;//this is used to get value and set value of the control
190 	char Unused[32];
191 } SVB_CONTROL_CAPS;
192 
193 typedef enum SVB_EXPOSURE_STATUS {
194 	SVB_EXP_IDLE = 0,//: idle states, you can start exposure now
195 	SVB_EXP_WORKING,//: exposing
196 	SVB_EXP_SUCCESS,//: exposure finished and waiting for download
197 	SVB_EXP_FAILED,//:exposure failed, you need to start exposure again
198 
199 }SVB_EXPOSURE_STATUS;
200 
201 typedef struct _SVB_ID{
202 	unsigned char id[64];
203 }SVB_ID;
204 
205 typedef SVB_ID SVB_SN;
206 
207 typedef struct _SVB_SUPPORTED_MODE{
208 	SVB_CAMERA_MODE SupportedCameraMode[16];// this array will content with the support camera mode type.SVB_MODE_END is the end of supported camera mode
209 }SVB_SUPPORTED_MODE;
210 
211 
212 
213 #ifndef __cplusplus
214 #define SVB_CONTROL_TYPE int
215 #define SVB_BOOL int
216 #define SVB_ERROR_CODE int
217 #define SVB_FLIP_STATUS int
218 #define SVB_IMG_TYPE int
219 #define SVB_GUIDE_DIRECTION int
220 #define SVB_BAYER_PATTERN int
221 #endif
222 
223 #ifdef __cplusplus
224 extern "C" {
225 #endif
226 
227 /***************************************************************************
228 Descriptions:
229 this should be the first API to be called
230 get number of connected SVB cameras,
231 
232 Paras:
233 
234 return:number of connected SVB cameras. 1 means 1 camera connected.
235 ***************************************************************************/
236 SVBCAMERA_API  int SVBGetNumOfConnectedCameras();
237 
238 /***************************************************************************
239 Descriptions:
240 get the information of the connected cameras, you can do this without open the camera.
241 here is the sample code:
242 
243 int iNumofConnectCameras = SVBGetNumOfConnectedCameras();
244 SVB_CAMERA_INFO **ppSVBCameraInfo = (SVB_CAMERA_INFO **)malloc(sizeof(SVB_CAMERA_INFO *)*iNumofConnectCameras);
245 for(int i = 0; i < iNumofConnectCameras; i++)
246 {
247 ppSVBCameraInfo[i] = (SVB_CAMERA_INFO *)malloc(sizeof(SVB_CAMERA_INFO ));
248 SVBGetCameraInfo(ppSVBCameraInfo[i], i);
249 }
250 
251 Paras:
252 	SVB_CAMERA_INFO *pSVBCameraInfo: Pointer to structure containing the information of camera
253 									user need to malloc the buffer
254 	int iCameraIndex: 0 means the first connect camera, 1 means the second connect camera
255 
256 return:
257 	SVB_SUCCESS: Operation is successful
258 	SVB_ERROR_INVALID_INDEX  :no camera connected or index value out of boundary
259 
260 ***************************************************************************/
261 SVBCAMERA_API SVB_ERROR_CODE SVBGetCameraInfo(SVB_CAMERA_INFO *pSVBCameraInfo, int iCameraIndex);
262 
263 /***************************************************************************
264 Descriptions:
265 get the property of the connected cameras
266 here is the sample code:
267 
268 Paras:
269 int CameraID: this is get from the camera property use the API SVBGetCameraProperty
270 SVB_CAMERA_PROPERTY *pCameraProperty: Pointer to structure containing the property of camera
271 								user need to malloc the buffer
272 
273 return:
274 SVB_SUCCESS: Operation is successful
275 SVB_ERROR_INVALID_INDEX  :no camera connected or index value out of boundary
276 
277 ***************************************************************************/
278 SVBCAMERA_API SVB_ERROR_CODE SVBGetCameraProperty(int iCameraID, SVB_CAMERA_PROPERTY *pCameraProperty);
279 
280 
281 /***************************************************************************
282 Descriptions:
283 	open the camera before any operation to the camera, this will not affect the camera which is capturing
284 	All APIs below need to open the camera at first.
285 
286 Paras:
287 	int CameraID: this is get from the camera property use the API SVBGetCameraInfo
288 
289 return:
290 SVB_SUCCESS: Operation is successful
291 SVB_ERROR_INVALID_ID  : no camera of this ID is connected or ID value is out of boundary
292 SVB_ERROR_CAMERA_REMOVED: failed to find the camera, maybe camera has been removed
293 
294 ***************************************************************************/
295 SVBCAMERA_API  SVB_ERROR_CODE SVBOpenCamera(int iCameraID);
296 
297 
298 
299 /***************************************************************************
300 Descriptions:
301 you need to close the camera to free all the resource
302 
303 
304 Paras:
305 int CameraID: this is get from the camera property use the API SVBGetCameraInfo
306 
307 return:
308 SVB_SUCCESS :it will return success even the camera already closed
309 SVB_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
310 
311 ***************************************************************************/
312 SVBCAMERA_API  SVB_ERROR_CODE SVBCloseCamera(int iCameraID);
313 
314 
315 
316 
317 /***************************************************************************
318 Descriptions:
319 Get number of controls available for this camera. the camera need be opened at first.
320 
321 
322 
323 Paras:
324 int CameraID: this is get from the camera property use the API SVBGetCameraInfo
325 int * piNumberOfControls: pointer to an int to save the number of controls
326 
327 return:
328 SVB_SUCCESS : Operation is successful
329 SVB_ERROR_CAMERA_CLOSED : camera didn't open
330 SVB_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
331 ***************************************************************************/
332 SVBCAMERA_API SVB_ERROR_CODE SVBGetNumOfControls(int iCameraID, int * piNumberOfControls);
333 
334 
335 /***************************************************************************
336 Descriptions:
337 Get controls property available for this camera. the camera need be opened at first.
338 user need to malloc and maintain the buffer.
339 
340 
341 
342 Paras:
343 int CameraID: this is get from the camera property use the API SVBGetCameraInfo
344 int iControlIndex: index of control, NOT control type
345 SVB_CONTROL_CAPS * pControlCaps: Pointer to structure containing the property of the control
346 user need to malloc the buffer
347 
348 return:
349 SVB_SUCCESS : Operation is successful
350 SVB_ERROR_CAMERA_CLOSED : camera didn't open
351 SVB_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
352 ***************************************************************************/
353 SVBCAMERA_API SVB_ERROR_CODE SVBGetControlCaps(int iCameraID, int iControlIndex, SVB_CONTROL_CAPS * pControlCaps);
354 
355 /***************************************************************************
356 Descriptions:
357 Get controls property value and auto value
358 note:the value of the temperature is the float value * 10 to convert it to long type, control name is "Temperature"
359 because long is the only type for control(except cooler's target temperature, because it is an integer)
360 
361 Paras:
362 int CameraID: this is get from the camera property use the API SVBGetCameraInfo
363 int ControlType: this is get from control property use the API SVBGetControlCaps
364 long *plValue: pointer to the value you want to save the value get from control
365 SVB_BOOL *pbAuto: pointer to the SVB_BOOL type
366 
367 return:
368 SVB_SUCCESS : Operation is successful
369 SVB_ERROR_CAMERA_CLOSED : camera didn't open
370 SVB_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
371 SVB_ERROR_INVALID_CONTROL_TYPE, //invalid Control type
372 ***************************************************************************/
373 SVBCAMERA_API SVB_ERROR_CODE SVBGetControlValue(int  iCameraID, SVB_CONTROL_TYPE  ControlType, long *plValue, SVB_BOOL *pbAuto);
374 
375 /***************************************************************************
376 Descriptions:
377 Set controls property value and auto value
378 it will return success and set the max value or min value if the value is beyond the boundary
379 
380 
381 Paras:
382 int CameraID: this is get from the camera property use the API SVBGetCameraInfo
383 int ControlType: this is get from control property use the API SVBGetControlCaps
384 long lValue: the value set to the control
385 SVB_BOOL bAuto: set the control auto
386 
387 return:
388 SVB_SUCCESS : Operation is successful
389 SVB_ERROR_CAMERA_CLOSED : camera didn't open
390 SVB_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
391 SVB_ERROR_INVALID_CONTROL_TYPE, //invalid Control type
392 SVB_ERROR_GENERAL_ERROR,//general error, eg: value is out of valid range; operate to camera hareware failed
393 ***************************************************************************/
394 SVBCAMERA_API SVB_ERROR_CODE SVBSetControlValue(int  iCameraID, SVB_CONTROL_TYPE  ControlType, long lValue, SVB_BOOL bAuto);
395 
396 /***************************************************************************
397 Descriptions:
398 Get the output image type.
399 
400 Paras:
401 int CameraID: this is get from the camera property use the API SVBGetCameraInfo
402 SVB_IMG_TYPE *pImageType: pointer to current image type.
403 
404 return:
405 SVB_SUCCESS : Operation is successful
406 SVB_ERROR_CAMERA_CLOSED : camera didn't open
407 SVB_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
408 SVB_ERROR_GENERAL_ERROR,//general error, eg: value is out of valid range; operate to camera hareware failed
409 ***************************************************************************/
410 SVBCAMERA_API SVB_ERROR_CODE SVBGetOutputImageType(int iCameraID, SVB_IMG_TYPE *pImageType);
411 
412 /***************************************************************************
413 Descriptions:
414 Set the output image type, The value set must be the type supported by the SVBGetCameraProperty function.
415 
416 Paras:
417 int CameraID: this is get from the camera property use the API SVBGetCameraInfo
418 SVB_IMG_TYPE *pImageType: pointer to current image type.
419 
420 return:
421 SVB_SUCCESS : Operation is successful
422 SVB_ERROR_CAMERA_CLOSED : camera didn't open
423 SVB_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
424 SVB_ERROR_INVALID_IMGTYPE, //invalid image type
425 SVB_ERROR_GENERAL_ERROR,//general error, eg: value is out of valid range; operate to camera hareware failed
426 ***************************************************************************/
427 SVBCAMERA_API SVB_ERROR_CODE SVBSetOutputImageType(int iCameraID, SVB_IMG_TYPE ImageType);
428 
429 /***************************************************************************
430 Descriptions:
431 set the ROI area before capture.
432 you must stop capture before call it.
433 the width and height is the value after binning.
434 ie. you need to set width to 640 and height to 480 if you want to run at 640X480@BIN2
435 SVB120's data size must be times of 1024 which means width*height%1024=0SVBSetStartPos
436 Paras:
437 int CameraID: this is get from the camera property use the API SVBGetCameraInfo
438 int iWidth,  the width of the ROI area. Make sure iWidth%8 = 0.
439 int iHeight,  the height of the ROI area. Make sure iHeight%2 = 0,
440 further, for USB2.0 camera SVB120, please make sure that iWidth*iHeight%1024=0.
441 int iBin,   binning method. bin1=1, bin2=2
442 
443 return:
444 SVB_SUCCESS : Operation is successful
445 SVB_ERROR_CAMERA_CLOSED : camera didn't open
446 SVB_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
447 SVB_ERROR_INVALID_SIZE, //wrong video format size
448 SVB_ERROR_INVALID_IMGTYPE, //unsupported image format, make sure iWidth and iHeight and binning is set correct
449 ***************************************************************************/
450 SVBCAMERA_API  SVB_ERROR_CODE SVBSetROIFormat(int iCameraID, int iStartX, int iStartY, int iWidth, int iHeight, int iBin);
451 
452 
453 /***************************************************************************
454 Descriptions:
455 Get the current ROI area setting .
456 
457 Paras:
458 int CameraID: this is get from the camera property use the API SVBGetCameraInfo
459 int *piWidth,  pointer to the width of the ROI area
460 int *piHeight, pointer to the height of the ROI area.
461 int *piBin,   pointer to binning method. bin1=1, bin2=2
462 
463 return:
464 SVB_SUCCESS : Operation is successful
465 SVB_ERROR_CAMERA_CLOSED : camera didn't open
466 SVB_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
467 
468 ***************************************************************************/
469 SVBCAMERA_API  SVB_ERROR_CODE SVBGetROIFormat(int iCameraID, int *piStartX, int *piStartY, int *piWidth, int *piHeight,  int *piBin);
470 
471 /***************************************************************************
472 Descriptions:
473 Get the droped frames .
474 drop frames happen when USB is traffic or harddisk write speed is slow
475 it will reset to 0 after stop capture
476 
477 Paras:
478 int CameraID: this is get from the camera property use the API SVBGetCameraInfo
479 int *piDropFrames pointer to drop frames
480 
481 return:
482 SVB_SUCCESS : Operation is successful
483 SVB_ERROR_CAMERA_CLOSED : camera didn't open
484 SVB_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
485 
486 ***************************************************************************/
487 SVBCAMERA_API  SVB_ERROR_CODE SVBGetDroppedFrames(int iCameraID,int *piDropFrames);
488 
489 
490 /***************************************************************************
491 Descriptions:
492 Start video capture
493 then you can get the data from the API SVBGetVideoData
494 
495 
496 Paras:
497 int CameraID: this is get from the camera property use the API SVBGetCameraInfo
498 
499 return:
500 SVB_SUCCESS : Operation is successful, it will return success if already started
501 SVB_ERROR_CAMERA_CLOSED : camera didn't open
502 SVB_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
503 SVB_ERROR_EXPOSURE_IN_PROGRESS: snap mode is working, you need to stop snap first
504 ***************************************************************************/
505 SVBCAMERA_API  SVB_ERROR_CODE SVBStartVideoCapture(int iCameraID);
506 
507 /***************************************************************************
508 Descriptions:
509 Stop video capture
510 
511 
512 Paras:
513 int CameraID: this is get from the camera property use the API SVBGetCameraInfo
514 
515 return:
516 SVB_SUCCESS : Operation is successful, it will return success if already stopped
517 SVB_ERROR_CAMERA_CLOSED : camera didn't open
518 SVB_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
519 
520 ***************************************************************************/
521 SVBCAMERA_API  SVB_ERROR_CODE SVBStopVideoCapture(int iCameraID);
522 
523 /***************************************************************************
524 Descriptions:
525 get data from the video buffer.the buffer is very small
526 you need to call this API as fast as possible, otherwise frame will be discarded
527 so the best way is maintain one buffer loop and call this API in a loop
528 please make sure the buffer size is biger enough to hold one image
529 otherwise the this API will crash
530 
531 
532 Paras:
533 int CameraID: this is get from the camera property use the API SVBGetCameraInfo
534 unsigned char* pBuffer, caller need to malloc the buffer, make sure the size is big enough
535 		the size in byte:
536 		8bit mono:width*height
537 		16bit mono:width*height*2
538 		RGB24:width*height*3
539 
540 int iWaitms, this API will block and wait iWaitms to get one image. the unit is ms
541 		-1 means wait forever. this value is recommend set to exposure*2+500ms
542 
543 return:
544 SVB_SUCCESS : Operation is successful
545 SVB_ERROR_CAMERA_CLOSED : camera didn't open
546 SVB_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
547 SVB_ERROR_TIMEOUT: no image get and timeout
548 ***************************************************************************/
549 SVBCAMERA_API  SVB_ERROR_CODE SVBGetVideoData(int iCameraID, unsigned char* pBuffer, long lBuffSize, int iWaitms);
550 
551 /***************************************************************************
552 Descriptions:
553 White balance once time. If success(return SVB_SUCCESS), please get SVB_WB_R, SVB_WB_G and SVB_WB_B values to update UI display.
554 Paras:
555 
556 int CameraID: this is get from the camera property use the API SVBGetCameraInfo
557 
558 return:
559 SVB_SUCCESS : Operation is successful
560 SVB_ERROR_CAMERA_CLOSED : camera didn't open
561 SVB_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
562 SVB_ERROR_GENERAL_ERROR : white balance failed
563 ***************************************************************************/
564 SVBCAMERA_API SVB_ERROR_CODE SVBWhiteBalanceOnce(int iCameraID);
565 
566 /***************************************************************************
567 Descriptions:
568 get version string, like "1, 13, 0503"
569 ***************************************************************************/
570 SVBCAMERA_API const char* SVBGetSDKVersion();
571 
572 /***************************************************************************
573 Description:
574 Get the camera supported mode, only need to call when the IsTriggerCam in the CameraInfo is true.
575 Paras:
576 int CameraID: this is get from the camera property use the API SVBGetCameraInfo
577 SVB_SUPPORTED_MODE: the camera supported mode
578 
579 return:
580 SVB_SUCCESS : Operation is successful
581 SVB_ERROR_CAMERA_CLOSED : camera didn't open
582 SVB_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
583 ***************************************************************************/
584 SVBCAMERA_API SVB_ERROR_CODE  SVBGetCameraSupportMode(int iCameraID, SVB_SUPPORTED_MODE* pSupportedMode);
585 
586 /***************************************************************************
587 Description:
588 Get the camera current mode, only need to call when the IsTriggerCam in the CameraInfo is true
589 Paras:
590 int CameraID: this is get from the camera property use the API SVBGetCameraInfo
591 SVB_CAMERA_MODE *mode: the current camera mode
592 
593 return:
594 SVB_SUCCESS : Operation is successful
595 SVB_ERROR_CAMERA_CLOSED : camera didn't open
596 SVB_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
597 ***************************************************************************/
598 SVBCAMERA_API SVB_ERROR_CODE  SVBGetCameraMode(int iCameraID, SVB_CAMERA_MODE* mode);
599 
600 /***************************************************************************
601 Description:
602 Set the camera mode, only need to call when the IsTriggerCam in the CameraInfo is true
603 Paras:
604 int CameraID: this is get from the camera property use the API SVBGetCameraInfo
605 SVB_CAMERA_MODE: this is get from the camera property use the API SVBGetCameraProperty
606 
607 return:
608 SVB_SUCCESS : Operation is successful
609 SVB_ERROR_CAMERA_CLOSED : camera didn't open
610 SVB_ERROR_INVALID_SEQUENCE : camera is in capture now, need to stop capture first.
611 SVB_ERROR_INVALID_MODE  : mode is out of boundary or this camera do not support this mode
612 ***************************************************************************/
613 SVBCAMERA_API SVB_ERROR_CODE  SVBSetCameraMode(int iCameraID, SVB_CAMERA_MODE mode);
614 
615 /***************************************************************************
616 Description:
617 Send out a softTrigger. For edge trigger, it only need to set true which means send a
618 rising trigger to start exposure. For level trigger, it need to set true first means
619 start exposure, and set false means stop exposure.it only need to call when the
620 IsTriggerCam in the CameraInfo is true
621 Paras:
622 int CameraID: this is get from the camera property use the API SVBGetCameraInfo
623 
624 return:
625 SVB_SUCCESS : Operation is successful
626 SVB_ERROR_CAMERA_CLOSED : camera didn't open
627 ***************************************************************************/
628 SVBCAMERA_API SVB_ERROR_CODE  SVBSendSoftTrigger(int iCameraID);
629 
630 /***************************************************************************
631 Description:
632 Get a serial number from a camera.
633 Paras:
634 int CameraID: this is get from the camera property use the API SVBGetCameraInfo
635 SVB_SN* pSN: pointer to SN
636 
637 return:
638 SVB_SUCCESS : Operation is successful
639 SVB_ERROR_CAMERA_CLOSED : camera didn't open
640 SVB_ERROR_GENERAL_ERROR : camera does not have Serial Number
641 ***************************************************************************/
642 SVBCAMERA_API SVB_ERROR_CODE  SVBGetSerialNumber(int iCameraID, SVB_SN* pSN);
643 
644 /***************************************************************************
645 Description:
646 Config the output pin (A or B) of Trigger port. If lDuration <= 0, this output pin will be closed.
647 Only need to call when the IsTriggerCam in the CameraInfo is true
648 
649 Paras:
650 int CameraID: this is get from the camera property use the API SVBGetCameraInfo.
651 SVB_TRIG_OUTPUT_STATUS pin: Select the pin for output
652 SVB_BOOL bPinAHigh: If true, the selected pin will output a high level as a signal
653 					when it is effective. Or it will output a low level as a signal.
654 long lDelay: the time between the camera receive a trigger signal and the output
655 			of the valid level.From 0 microsecond to 2000*1000*1000 microsecond.
656 long lDuration: the duration time of the valid level output.From 0 microsecond to
657 			2000*1000*1000 microsecond.
658 
659 return:
660 SVB_SUCCESS : Operation is successful
661 SVB_ERROR_CAMERA_CLOSED : camera didn't open
662 SVB_ERROR_GENERAL_ERROR : the parameter is not right
663 ***************************************************************************/
664 SVBCAMERA_API SVB_ERROR_CODE  SVBSetTriggerOutputIOConf(int iCameraID, SVB_TRIG_OUTPUT_PIN pin, SVB_BOOL bPinHigh, long lDelay, long lDuration);
665 
666 
667 /***************************************************************************
668 Description:
669 Get the output pin configuration, only need to call when the IsTriggerCam in the CameraInfo is true
670 Paras:
671 int CameraID: this is get from the camera property use the API SVBGetCameraInfo.
672 SVB_TRIG_OUTPUT_STATUS pin: Select the pin for getting the configuration
673 SVB_BOOL *bPinAHigh: Get the current status of valid level.
674 long *lDelay: get the time between the camera receive a trigger signal and the output of the valid level.
675 long *lDuration: get the duration time of the valid level output.
676 
677 return:
678 SVB_SUCCESS : Operation is successful
679 SVB_ERROR_CAMERA_CLOSED : camera didn't open
680 SVB_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
681 SVB_ERROR_GENERAL_ERROR : the parameter is not right
682 ***************************************************************************/
683 SVBCAMERA_API SVB_ERROR_CODE  SVBGetTriggerOutputIOConf(int iCameraID, SVB_TRIG_OUTPUT_PIN pin, SVB_BOOL *bPinHigh, long *lDelay, long *lDuration);
684 
685 /***************************************************************************
686 Description:
687 Send a PulseGuide command to camera to control the telescope
688 Paras:
689 int CameraID: this is get from the camera property use the API SVBGetCameraInfo.
690 SVB_GUIDE_DIRECTION direction: the direction
691 int duration: the duration of pulse, unit is milliseconds
692 
693 return:
694 SVB_SUCCESS : Operation is successful
695 SVB_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
696 SVB_ERROR_GENERAL_ERROR : the parameter is not right
697 SVB_ERROR_INVALID_DIRECTION : invalid guide direction
698 ***************************************************************************/
699 SVBCAMERA_API SVB_ERROR_CODE  SVBPulseGuide(int iCameraID, SVB_GUIDE_DIRECTION direction, int duration);
700 
701 /***************************************************************************
702 Description:
703 Get sensor pixel size in microns
704 Paras:
705 int CameraID: this is get from the camera property use the API SVBGetCameraInfo.
706 float *fPixelSize: sensor pixel size in microns
707 
708 return:
709 SVB_SUCCESS : Operation is successful
710 SVB_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
711 SVB_ERROR_UNKNOW_SENSOR_TYPE : unknow sensor type
712 ***************************************************************************/
713 SVBCAMERA_API SVB_ERROR_CODE  SVBGetSensorPixelSize(int iCameraID, float *fPixelSize);
714 
715 /***************************************************************************
716 Description:
717 Get whether to support pulse guide
718 Paras:
719 int CameraID: this is get from the camera property use the API SVBGetCameraInfo.
720 SVB_BOOL *pIsSupportPulseGuide: if SVB_TRUE then support pulse guide
721 
722 return:
723 SVB_SUCCESS : Operation is successful
724 SVB_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
725 ***************************************************************************/
726 SVBCAMERA_API SVB_ERROR_CODE SVBCanPulseGuide(int iCameraID, SVB_BOOL *pCanPulseGuide);
727 
728 /***************************************************************************
729 Description:
730 Whether to save the parameter file automatically
731 Paras:
732 int CameraID: this is get from the camera property use the API SVBGetCameraInfo.
733 SVB_BOOL enable: if SVB_TRUE then save the parameter file automatically.
734 
735 return:
736 SVB_SUCCESS : Operation is successful
737 SVB_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
738 ***************************************************************************/
739 SVBCAMERA_API SVB_ERROR_CODE SVBSetAutoSaveParam(int iCameraID, SVB_BOOL enable);
740 
741 #ifdef __cplusplus
742 }
743 #endif
744 
745 #endif
746