summaryrefslogtreecommitdiff
path: root/include/asi/ASICamera2.h
blob: 93a873c66cffcb76538549fd4ec75b261f4f7311 (plain)
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
/**************************************************
this is the second version of release ASI Camera ASIs
any question feel free contact us:sam.wen@zwoptical.com

here is the suggested procedure to operate the camera.

--> ASIGetNumOfConnectedCameras
----> ASIGetCameraProperty for each camera

--> ASIOpenCamera
--> ASIInitCamera
--> ASIGetNumOfControls
----> ASIGetControlCaps for each contronl and set or get value from them

--> ASISetROIFormat

--> ASISetCameraMode

--> ASIStartVideoCapture

//this is recommended to do in another thread
while(1)
{
	ASIGetVideoData
	...
}


***************************************************/
#ifndef ASICAMERA2_H
#define ASICAMERA2_H




#ifdef _WINDOWS
	#define ASICAMERA_API __declspec(dllexport)
#else
	#define ASICAMERA_API 
#endif

#define ASICAMERA_ID_MAX 128

typedef enum ASI_BAYER_PATTERN{
	ASI_BAYER_RG=0,
	ASI_BAYER_BG,
	ASI_BAYER_GR,
	ASI_BAYER_GB
}ASI_BAYER_PATTERN;

typedef enum ASI_IMG_TYPE{ //Supported Video Format 
	ASI_IMG_RAW8 = 0,
	ASI_IMG_RGB24,
	ASI_IMG_RAW16,
	ASI_IMG_Y8,
	ASI_IMG_END = -1

}ASI_IMG_TYPE;

typedef enum ASI_GUIDE_DIRECTION{ //Guider Direction
	ASI_GUIDE_NORTH=0,
	ASI_GUIDE_SOUTH,
	ASI_GUIDE_EAST,
	ASI_GUIDE_WEST
}ASI_GUIDE_DIRECTION;



typedef enum ASI_FLIP_STATUS {
	ASI_FLIP_NONE = 0,//: original
	ASI_FLIP_HORIZ,//: horizontal flip
	ASI_FLIP_VERT,// vertical flip
	ASI_FLIP_BOTH,//:both horizontal and vertical flip

}ASI_FLIP_STATUS;

typedef enum ASI_CAMERA_MODE {
	ASI_MODE_NORMAL = 0,
	ASI_MODE_TRIG_SOFT_EDGE,
	ASI_MODE_TRIG_RISE_EDGE,
	ASI_MODE_TRIG_FALL_EDGE,
	ASI_MODE_TRIG_SOFT_LEVEL,
	ASI_MODE_TRIG_HIGH_LEVEL,
	ASI_MODE_TRIG_LOW_LEVEL,
	ASI_MODE_END = -1
}ASI_CAMERA_MODE;

typedef enum ASI_ERROR_CODE{ //ASI ERROR CODE
	ASI_SUCCESS=0,
	ASI_ERROR_INVALID_INDEX, //no camera connected or index value out of boundary
	ASI_ERROR_INVALID_ID, //invalid ID
	ASI_ERROR_INVALID_CONTROL_TYPE, //invalid control type
	ASI_ERROR_CAMERA_CLOSED, //camera didn't open
	ASI_ERROR_CAMERA_REMOVED, //failed to find the camera, maybe the camera has been removed
	ASI_ERROR_INVALID_PATH, //cannot find the path of the file
	ASI_ERROR_INVALID_FILEFORMAT, 
	ASI_ERROR_INVALID_SIZE, //wrong video format size
	ASI_ERROR_INVALID_IMGTYPE, //unsupported image formate
	ASI_ERROR_OUTOF_BOUNDARY, //the startpos is out of boundary
	ASI_ERROR_TIMEOUT, //timeout
	ASI_ERROR_INVALID_SEQUENCE,//stop capture first
	ASI_ERROR_BUFFER_TOO_SMALL, //buffer size is not big enough
	ASI_ERROR_VIDEO_MODE_ACTIVE,
	ASI_ERROR_EXPOSURE_IN_PROGRESS,
	ASI_ERROR_GENERAL_ERROR,//general error, eg: value is out of valid range
	ASI_ERROR_INVALID_MODE,//the current mode is wrong
	ASI_ERROR_END
}ASI_ERROR_CODE;

typedef enum ASI_BOOL{
	ASI_FALSE =0,
	ASI_TRUE
}ASI_BOOL;

typedef struct _ASI_CAMERA_INFO
{
	char Name[64]; //the name of the camera, you can display this to the UI
	int CameraID; //this is used to control everything of the camera in other functions.Start from 0.
	long MaxHeight; //the max height of the camera
	long MaxWidth;	//the max width of the camera

	ASI_BOOL IsColorCam; 
	ASI_BAYER_PATTERN BayerPattern;

	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
	ASI_IMG_TYPE SupportedVideoFormat[8]; //this array will content with the support output format type.IMG_END is the end of supported video format

	double PixelSize; //the pixel size of the camera, unit is um. such like 5.6um
	ASI_BOOL MechanicalShutter;
	ASI_BOOL ST4Port;
	ASI_BOOL IsCoolerCam;
	ASI_BOOL IsUSB3Host;
	ASI_BOOL IsUSB3Camera;
	float ElecPerADU;
	int BitDepth;
	ASI_BOOL IsTriggerCam;

	char Unused[16];
} ASI_CAMERA_INFO;

#define ASI_BRIGHTNESS ASI_OFFSET
#define ASI_AUTO_MAX_BRIGHTNESS ASI_AUTO_TARGET_BRIGHTNESS

typedef enum ASI_CONTROL_TYPE{ //Control type//
	ASI_GAIN = 0,
	ASI_EXPOSURE,
	ASI_GAMMA,
	ASI_WB_R,
	ASI_WB_B,
	ASI_OFFSET,
	ASI_BANDWIDTHOVERLOAD,	
	ASI_OVERCLOCK,
	ASI_TEMPERATURE,// return 10*temperature
	ASI_FLIP,
	ASI_AUTO_MAX_GAIN,
	ASI_AUTO_MAX_EXP,//micro second
	ASI_AUTO_TARGET_BRIGHTNESS,//target brightness
	ASI_HARDWARE_BIN,
	ASI_HIGH_SPEED_MODE,
	ASI_COOLER_POWER_PERC,
	ASI_TARGET_TEMP,// not need *10
	ASI_COOLER_ON,
	ASI_MONO_BIN,//lead to less grid at software bin mode for color camera
	ASI_FAN_ON,
	ASI_PATTERN_ADJUST,
	ASI_ANTI_DEW_HEATER,

}ASI_CONTROL_TYPE;

typedef struct _ASI_CONTROL_CAPS
{
	char Name[64]; //the name of the Control like Exposure, Gain etc..
	char Description[128]; //description of this control
	long MaxValue;
	long MinValue;
	long DefaultValue;
	ASI_BOOL IsAutoSupported; //support auto set 1, don't support 0
	ASI_BOOL IsWritable; //some control like temperature can only be read by some cameras 
	ASI_CONTROL_TYPE ControlType;//this is used to get value and set value of the control
	char Unused[32];
} ASI_CONTROL_CAPS;

typedef enum ASI_EXPOSURE_STATUS {
	ASI_EXP_IDLE = 0,//: idle states, you can start exposure now
	ASI_EXP_WORKING,//: exposing
	ASI_EXP_SUCCESS,//: exposure finished and waiting for download
	ASI_EXP_FAILED,//:exposure failed, you need to start exposure again

}ASI_EXPOSURE_STATUS;

typedef struct _ASI_ID{
	unsigned char id[8];
}ASI_ID;

typedef struct _ASI_SUPPORTED_MODE{
	ASI_CAMERA_MODE SupportedCameraMode[16];// this array will content with the support camera mode type.ASI_MODE_END is the end of supported camera mode
}ASI_SUPPORTED_MODE;

#ifndef __cplusplus
#define ASI_CONTROL_TYPE int
#define ASI_BOOL int
#define ASI_ERROR_CODE int
#define ASI_FLIP_STATUS int
#define ASI_IMG_TYPE int
#define ASI_GUIDE_DIRECTION int
#define ASI_BAYER_PATTERN int
#endif

#ifdef __cplusplus
extern "C" {
#endif

/***************************************************************************
Descriptions£º 
this should be the first API to be called
get number of connected ASI cameras,

Paras£º 

return£ºnumber of connected ASI cameras. 1 means 1 camera connected.
***************************************************************************/
ASICAMERA_API  int ASIGetNumOfConnectedCameras(); 

/***************************************************************************
Descriptions:
get the product ID of each supported camera, at first set pPIDs as 0 and get length and then malloc a buffer to contain the PIDs

Paras:
int* pPIDs: pointer to array of PIDs

Return: length of the array.
***************************************************************************/
ASICAMERA_API int ASIGetProductIDs(int* pPIDs);

/***************************************************************************
Descriptions£º
get the property of the connected cameras, you can do this without open the camera.
here is the sample code:

int iNumofConnectCameras = ASIGetNumOfConnectedCameras();
ASI_CAMERA_INFO **ppASICameraInfo = (ASI_CAMERA_INFO **)malloc(sizeof(ASI_CAMERA_INFO *)*iNumofConnectCameras);
for(int i = 0; i < iNumofConnectCameras; i++)
{
ppASICameraInfo[i] = (ASI_CAMERA_INFO *)malloc(sizeof(ASI_CAMERA_INFO ));
ASIGetCameraProperty(ppASICameraInfo[i], i);
}
				
Paras£º		
	ASI_CAMERA_INFO *pASICameraInfo: Pointer to structure containing the property of camera
									user need to malloc the buffer
	int iCameraIndex: 0 means the first connect camera, 1 means the second connect camera

return£º
	ASI_SUCCESS: Operation is successful
	ASI_ERROR_INVALID_INDEX  :no camera connected or index value out of boundary

***************************************************************************/
ASICAMERA_API ASI_ERROR_CODE ASIGetCameraProperty(ASI_CAMERA_INFO *pASICameraInfo, int iCameraIndex);

/***************************************************************************
Descriptions£º
	open the camera before any operation to the camera, this will not affect the camera which is capturing
	All APIs below need to open the camera at first.

Paras£º		
	int CameraID: this is get from the camera property use the API ASIGetCameraProperty

return£º
ASI_SUCCESS: Operation is successful
ASI_ERROR_INVALID_ID  : no camera of this ID is connected or ID value is out of boundary
ASI_ERROR_CAMERA_REMOVED: failed to find the camera, maybe camera has been removed

***************************************************************************/
ASICAMERA_API  ASI_ERROR_CODE ASIOpenCamera(int iCameraID);

/***************************************************************************
Descriptions

	Initialise the camera after open, this function may take some while, this will affect the camera which is capturing

Paras£º		
	int CameraID: this is get from the camera property use the API ASIGetCameraProperty

return:
ASI_SUCCESS : Operation is successful
ASI_ERROR_CAMERA_CLOSED : camera didn't open
ASI_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
***************************************************************************/
ASICAMERA_API  ASI_ERROR_CODE ASIInitCamera(int iCameraID);

/***************************************************************************
Descriptions£º
you need to close the camera to free all the resource


Paras£º		
int CameraID: this is get from the camera property use the API ASIGetCameraProperty

return£º
ASI_SUCCESS :it will return success even the camera already closed
ASI_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary

***************************************************************************/
ASICAMERA_API  ASI_ERROR_CODE ASICloseCamera(int iCameraID);




/***************************************************************************
Descriptions£º
Get number of controls available for this camera. the camera need be opened at first.



Paras£º		
int CameraID: this is get from the camera property use the API ASIGetCameraProperty
int * piNumberOfControls: pointer to an int to save the number of controls

return:
ASI_SUCCESS : Operation is successful
ASI_ERROR_CAMERA_CLOSED : camera didn't open
ASI_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
***************************************************************************/
ASICAMERA_API ASI_ERROR_CODE ASIGetNumOfControls(int iCameraID, int * piNumberOfControls);


/***************************************************************************
Descriptions£º
Get controls property available for this camera. the camera need be opened at first.
user need to malloc and maintain the buffer.



Paras£º		
int CameraID: this is get from the camera property use the API ASIGetCameraProperty
int iControlIndex: index of control, NOT control type
ASI_CONTROL_CAPS * pControlCaps: Pointer to structure containing the property of the control
user need to malloc the buffer

return:
ASI_SUCCESS : Operation is successful
ASI_ERROR_CAMERA_CLOSED : camera didn't open
ASI_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
***************************************************************************/
ASICAMERA_API ASI_ERROR_CODE ASIGetControlCaps(int iCameraID, int iControlIndex, ASI_CONTROL_CAPS * pControlCaps);

/***************************************************************************
Descriptions£º
Get controls property value and auto value
note:the value of the temperature is the float value * 10 to convert it to long type, control name is "Temperature"
because long is the only type for control(except cooler's target temperature, because it is an integer)

Paras£º		
int CameraID: this is get from the camera property use the API ASIGetCameraProperty
int ControlType: this is get from control property use the API ASIGetControlCaps
long *plValue: pointer to the value you want to save the value get from control
ASI_BOOL *pbAuto: pointer to the ASI_BOOL type

return:
ASI_SUCCESS : Operation is successful
ASI_ERROR_CAMERA_CLOSED : camera didn't open
ASI_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
ASI_ERROR_INVALID_CONTROL_TYPE, //invalid Control type
***************************************************************************/
ASICAMERA_API ASI_ERROR_CODE ASIGetControlValue(int  iCameraID, ASI_CONTROL_TYPE  ControlType, long *plValue, ASI_BOOL *pbAuto);

/***************************************************************************
Descriptions£º
Set controls property value and auto value
it will return success and set the max value or min value if the value is beyond the boundary


Paras£º		
int CameraID: this is get from the camera property use the API ASIGetCameraProperty
int ControlType: this is get from control property use the API ASIGetControlCaps
long lValue: the value set to the control
ASI_BOOL bAuto: set the control auto

return:
ASI_SUCCESS : Operation is successful
ASI_ERROR_CAMERA_CLOSED : camera didn't open
ASI_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
ASI_ERROR_INVALID_CONTROL_TYPE, //invalid Control type
ASI_ERROR_GENERAL_ERROR,//general error, eg: value is out of valid range; operate to camera hareware failed
***************************************************************************/
ASICAMERA_API ASI_ERROR_CODE ASISetControlValue(int  iCameraID, ASI_CONTROL_TYPE  ControlType, long lValue, ASI_BOOL bAuto);

 

/***************************************************************************
Descriptions£º
set the ROI area before capture.
you must stop capture before call it.
the width and height is the value after binning.
ie. you need to set width to 640 and height to 480 if you want to run at 640X480@BIN2
ASI120's data size must be times of 1024 which means width*height%1024=0
Paras£º		
int CameraID: this is get from the camera property use the API ASIGetCameraProperty
int iWidth,  the width of the ROI area. Make sure iWidth%8 = 0. 
int iHeight,  the height of the ROI area. Make sure iHeight%2 = 0, 
further, for USB2.0 camera ASI120, please make sure that iWidth*iHeight%1024=0. 
int iBin,   binning method. bin1=1, bin2=2
ASI_IMG_TYPE Img_type: the output format you want 

return:
ASI_SUCCESS : Operation is successful
ASI_ERROR_CAMERA_CLOSED : camera didn't open
ASI_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
ASI_ERROR_INVALID_SIZE, //wrong video format size
ASI_ERROR_INVALID_IMGTYPE, //unsupported image format, make sure iWidth and iHeight and binning is set correct
***************************************************************************/
ASICAMERA_API  ASI_ERROR_CODE ASISetROIFormat(int iCameraID, int iWidth, int iHeight,  int iBin, ASI_IMG_TYPE Img_type); 


/***************************************************************************
Descriptions£º
Get the current ROI area setting .

Paras£º		
int CameraID: this is get from the camera property use the API ASIGetCameraProperty
int *piWidth,  pointer to the width of the ROI area   
int *piHeight, pointer to the height of the ROI area.
int *piBin,   pointer to binning method. bin1=1, bin2=2
ASI_IMG_TYPE *pImg_type: pointer to the output format

return:
ASI_SUCCESS : Operation is successful
ASI_ERROR_CAMERA_CLOSED : camera didn't open
ASI_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary

***************************************************************************/
ASICAMERA_API  ASI_ERROR_CODE ASIGetROIFormat(int iCameraID, int *piWidth, int *piHeight,  int *piBin, ASI_IMG_TYPE *pImg_type); 


/***************************************************************************
Descriptions£º
Set the start position of the ROI area.
you can call this API to move the ROI area when video is streaming
the camera will set the ROI area to the center of the full image as default
at bin2 or bin3 mode, the position is relative to the image after binning


Paras£º		
int CameraID: this is get from the camera property use the API ASIGetCameraProperty
int iStartX, pointer to the start X
int iStartY  pointer to the start Y

return:
ASI_SUCCESS : Operation is successful
ASI_ERROR_CAMERA_CLOSED : camera didn't open
ASI_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
ASI_ERROR_OUTOF_BOUNDARY: the start x and start y make the image out of boundary

***************************************************************************/
ASICAMERA_API  ASI_ERROR_CODE ASISetStartPos(int iCameraID, int iStartX, int iStartY); 

/***************************************************************************
Descriptions£º
Get the start position of current ROI area .

Paras£º		
int CameraID: this is get from the camera property use the API ASIGetCameraProperty
int *piStartX, pointer to the start X
int *piStartY  pointer to the start Y

return:
ASI_SUCCESS : Operation is successful
ASI_ERROR_CAMERA_CLOSED : camera didn't open
ASI_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary

***************************************************************************/
ASICAMERA_API  ASI_ERROR_CODE ASIGetStartPos(int iCameraID, int *piStartX, int *piStartY); 

/***************************************************************************
Descriptions£º
Get the droped frames .
drop frames happen when USB is traffic or harddisk write speed is slow
it will reset to 0 after stop capture

Paras£º		
int CameraID: this is get from the camera property use the API ASIGetCameraProperty
int *piDropFrames pointer to drop frames

return:
ASI_SUCCESS : Operation is successful
ASI_ERROR_CAMERA_CLOSED : camera didn't open
ASI_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary

***************************************************************************/
ASICAMERA_API  ASI_ERROR_CODE ASIGetDroppedFrames(int iCameraID,int *piDropFrames); 

/***************************************************************************
Descriptions£º
provide a dark file's path to the function and enable dark subtract
this is used when there is hot pixel or need to do long exposure
you'd better make this dark file from the  "dark subtract" funtion 
of the "video capture filter" directshow page.
the dark file's size should be the same of camera's max width and height 
and should be RGB8 raw format.it will on even you changed the ROI setting
it only correct the hot pixels if out put isn't 16bit.

it will be remembered in registry. so "Dark subtract" is on next time if you close your app.


Paras£º		
int CameraID: this is get from the camera property use the API ASIGetCameraProperty
char *pcBMPPath: the path to the bmp dark file. 
return£º
ASI_SUCCESS : Operation is successful
ASI_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
ASI_ERROR_CAMERA_CLOSED : camera didn't open
ASI_ERROR_INVALID_PATH, //cannot find the path of the file
ASI_ERROR_INVALID_FILEFORMAT, //the dark file's size should be the same of camera's max width and height  

***************************************************************************/
ASICAMERA_API ASI_ERROR_CODE ASIEnableDarkSubtract(int iCameraID, char *pcBMPPath);

/***************************************************************************
Descriptions£º
Disable the dark subtract function.
you'd better call it at start if you don't want to use it.
because dark subtract function is remembered on windows platform


Paras£º		
int CameraID: this is get from the camera property use the API ASIGetCameraProperty

return:
ASI_SUCCESS : Operation is successful
ASI_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
ASI_ERROR_CAMERA_CLOSED : camera didn't open
***************************************************************************/
ASICAMERA_API ASI_ERROR_CODE ASIDisableDarkSubtract(int iCameraID);

/***************************************************************************
Descriptions£º
Start video capture
then you can get the data from the API ASIGetVideoData


Paras£º		
int CameraID: this is get from the camera property use the API ASIGetCameraProperty

return:
ASI_SUCCESS : Operation is successful, it will return success if already started
ASI_ERROR_CAMERA_CLOSED : camera didn't open
ASI_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
ASI_ERROR_EXPOSURE_IN_PROGRESS: snap mode is working, you need to stop snap first
***************************************************************************/
ASICAMERA_API  ASI_ERROR_CODE ASIStartVideoCapture(int iCameraID);

/***************************************************************************
Descriptions£º
Stop video capture


Paras£º		
int CameraID: this is get from the camera property use the API ASIGetCameraProperty

return:
ASI_SUCCESS : Operation is successful, it will return success if already stopped
ASI_ERROR_CAMERA_CLOSED : camera didn't open
ASI_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary

***************************************************************************/
ASICAMERA_API  ASI_ERROR_CODE ASIStopVideoCapture(int iCameraID);

/***************************************************************************
Descriptions£º
get data from the video buffer.the buffer is very small 
you need to call this API as fast as possible, otherwise frame will be discarded
so the best way is maintain one buffer loop and call this API in a loop
please make sure the buffer size is biger enough to hold one image
otherwise the this API will crash


Paras£º		
int CameraID: this is get from the camera property use the API ASIGetCameraProperty
unsigned char* pBuffer, caller need to malloc the buffer, make sure the size is big enough
		the size in byte:
		8bit mono:width*height
		16bit mono:width*height*2
		RGB24:width*height*3

int iWaitms, this API will block and wait iWaitms to get one image. the unit is ms
		-1 means wait forever. this value is recommend set to exposure*2+500ms

return:
ASI_SUCCESS : Operation is successful
ASI_ERROR_CAMERA_CLOSED : camera didn't open
ASI_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
ASI_ERROR_TIMEOUT: no image get and timeout
***************************************************************************/
ASICAMERA_API  ASI_ERROR_CODE ASIGetVideoData(int iCameraID, unsigned char* pBuffer, long lBuffSize, int iWaitms);


/***************************************************************************
Descriptions£º
PulseGuide of the ST4 port on. this function only work on the module which have ST4 port


Paras£º		
int CameraID: this is get from the camera property use the API ASIGetCameraProperty
ASI_GUIDE_DIRECTION direction the direction of guider

return:
ASI_SUCCESS : Operation is successful
ASI_ERROR_CAMERA_CLOSED : camera didn't open
ASI_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary

***************************************************************************/
ASICAMERA_API ASI_ERROR_CODE ASIPulseGuideOn(int iCameraID, ASI_GUIDE_DIRECTION direction);

/***************************************************************************
Descriptions£º
PulseGuide of the ST4 port off. this function only work on the module which have ST4 port
make sure where is ASIPulseGuideOn and there is ASIPulseGuideOff

Paras£º		
int CameraID: this is get from the camera property use the API ASIGetCameraProperty
ASI_GUIDE_DIRECTION direction the direction of guider

return:
ASI_SUCCESS : Operation is successful
ASI_ERROR_CAMERA_CLOSED : camera didn't open
ASI_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary

***************************************************************************/
ASICAMERA_API ASI_ERROR_CODE ASIPulseGuideOff(int iCameraID, ASI_GUIDE_DIRECTION direction);


/***************************************************************************
Descriptions£º
Start camera exposure. the following 4 API is usually used when long exposure required
start exposure  and check the exposure status then get the data


Paras£º		
int CameraID: this is get from the camera property use the API ASIGetCameraProperty
ASI_BOOL bIsDark: means dark frame if there is mechanical shutter on the camera. otherwise useless

return:
ASI_SUCCESS : Operation is successful
ASI_ERROR_CAMERA_CLOSED : camera didn't open
ASI_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
ASI_ERROR_VIDEO_MODE_ACTIVE: video mode is working, you need to stop video capture first
***************************************************************************/
ASICAMERA_API ASI_ERROR_CODE  ASIStartExposure(int iCameraID, ASI_BOOL bIsDark);

/***************************************************************************
Descriptions£º
to cancel the long exposure which is on.


Paras£º		
int CameraID: this is get from the camera property use the API ASIGetCameraProperty


return:
ASI_SUCCESS : Operation is successful
ASI_ERROR_CAMERA_CLOSED : camera didn't open
ASI_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary

***************************************************************************/
ASICAMERA_API ASI_ERROR_CODE  ASIStopExposure(int iCameraID);

/***************************************************************************
Descriptions£º
to get the exposure status, work with ASIStartExposure.
you can read the data if get ASI_EXP_SUCCESS. or have to restart exposure again
if get ASI_EXP_FAILED

Paras£º		
int CameraID: this is get from the camera property use the API ASIGetCameraProperty
ASI_EXPOSURE_STATUS *pExpStatus: the exposure status


return:
ASI_SUCCESS : Operation is successful
ASI_ERROR_CAMERA_CLOSED : camera didn't open
ASI_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary

***************************************************************************/

ASICAMERA_API ASI_ERROR_CODE  ASIGetExpStatus(int iCameraID, ASI_EXPOSURE_STATUS *pExpStatus);

/***************************************************************************
Descriptions£º
get data after exposure.
please make sure the buffer size is biger enough to hold one image
otherwise the this API will crash


Paras£º		
int CameraID: this is get from the camera property use the API ASIGetCameraProperty
unsigned char* pBuffer, caller need to malloc the buffer, make sure the size is big enough
the size in byte:
8bit mono:width*height
16bit mono:width*height*2
RGB24:width*height*3


return:
ASI_SUCCESS : Operation is successful
ASI_ERROR_CAMERA_CLOSED : camera didn't open
ASI_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
ASI_ERROR_TIMEOUT: no image get and timeout
***************************************************************************/
ASICAMERA_API  ASI_ERROR_CODE ASIGetDataAfterExp(int iCameraID, unsigned char* pBuffer, long lBuffSize);

/***************************************************************************
Descriptions£º
get camera id stored in flash, only available for USB3.0 camera

Paras£º		
int CameraID: this is get from the camera property use the API ASIGetCameraProperty
ASI_ID* pID: pointer to ID

return:
ASI_SUCCESS : Operation is successful
ASI_ERROR_CAMERA_CLOSED : camera didn't open
ASI_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
***************************************************************************/
ASICAMERA_API  ASI_ERROR_CODE ASIGetID(int iCameraID, ASI_ID* pID);

/***************************************************************************
Descriptions£º
write camera id to flash, only available for USB3.0 camera

Paras£º		
int CameraID: this is get from the camera property use the API ASIGetCameraProperty
ASI_ID ID: ID

return:
ASI_SUCCESS : Operation is successful
ASI_ERROR_CAMERA_CLOSED : camera didn't open
ASI_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
***************************************************************************/
ASICAMERA_API  ASI_ERROR_CODE ASISetID(int iCameraID, ASI_ID ID);

/***************************************************************************
Descriptions£º
get pre-setting parameter
Paras£º		
int CameraID: this is get from the camera property use the API ASIGetCameraProperty
Offset_HighestDR: offset at highest dynamic range, 
Offset_UnityGain: offset at unity gain
int *Gain_LowestRN, *Offset_LowestRN: gain and offset at lowest read noise

return:
ASI_SUCCESS : Operation is successful
ASI_ERROR_CAMERA_CLOSED : camera didn't open
ASI_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
***************************************************************************/
ASICAMERA_API ASI_ERROR_CODE ASIGetGainOffset(int iCameraID, int *pOffset_HighestDR, int *pOffset_UnityGain, int *pGain_LowestRN, int *pOffset_LowestRN);

/***************************************************************************
Descriptions£º
get version string, like "1, 13, 0503"
***************************************************************************/
ASICAMERA_API char* ASIGetSDKVersion();

/***************************************************************************
Description:
Get the camera supported mode, only need to call when the IsTriggerCam in the CameraInfo is true.
Paras:
int CameraID: this is get from the camera property use the API ASIGetCameraProperty
ASI_SUPPORTED_MODE: the camera supported mode

return:
ASI_SUCCESS : Operation is successful
ASI_ERROR_CAMERA_CLOSED : camera didn't open
ASI_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
***************************************************************************/
ASICAMERA_API ASI_ERROR_CODE  ASIGetCameraSupportMode(int iCameraID, ASI_SUPPORTED_MODE* pSupportedMode);

/***************************************************************************
Description:
Get the camera current mode, only need to call when the IsTriggerCam in the CameraInfo is true 
Paras:
int CameraID: this is get from the camera property use the API ASIGetCameraProperty
ASI_CAMERA_MODE: the current camera mode

return:
ASI_SUCCESS : Operation is successful
ASI_ERROR_CAMERA_CLOSED : camera didn't open
ASI_ERROR_INVALID_ID  :no camera of this ID is connected or ID value is out of boundary
***************************************************************************/
ASICAMERA_API ASI_ERROR_CODE  ASIGetCameraMode(int iCameraID, ASI_CAMERA_MODE* mode);

/***************************************************************************
Description:
Set the camera mode, only need to call when the IsTriggerCam in the CameraInfo is true 
Paras:
int CameraID: this is get from the camera property use the API ASIGetCameraProperty
ASI_CAMERA_MODE: this is get from the camera property use the API ASIGetCameraProperty

return:
ASI_SUCCESS : Operation is successful
ASI_ERROR_CAMERA_CLOSED : camera didn't open
ASI_ERROR_INVALID_SEQUENCE : camera is in capture now, need to stop capture first.
ASI_ERROR_INVALID_MODE  : mode is out of boundary or this camera do not support this mode
***************************************************************************/
ASICAMERA_API ASI_ERROR_CODE  ASISetCameraMode(int iCameraID, ASI_CAMERA_MODE mode);

/***************************************************************************
Description:
Send out a softTrigger. For edge trigger, it only need to set true which means send a
rising trigger to start exposure. For level trigger, it need to set true first means 
start exposure, and set false means stop exposure.it only need to call when the 
IsTriggerCam in the CameraInfo is true
Paras:
int CameraID: this is get from the camera property use the API ASIGetCameraProperty
ASI_BOOL starts:send a softTrigger start/stop signal
***************************************************************************/
ASICAMERA_API ASI_ERROR_CODE  ASISendSoftTrigger(int iCameraID, ASI_BOOL bStart);
#ifdef __cplusplus
}
#endif

#endif