forked from indilib/indi-3rdparty
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUSB2ST4_Conv.h
162 lines (122 loc) · 4.72 KB
/
USB2ST4_Conv.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
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
/**************************************************
this is the ZWO USB2ST4 converter SDK
any question feel free contact us:[email protected]
here is the suggested procedure.
--> USB2ST4GetNum
--> USB2ST4GetID for each converter
--> USB2ST4Open
--> USB2ST4PulseGuide
...
--> USB2ST4Close
***************************************************/
#ifndef USB2ST4_FILTER_H
#define USB2ST4_FILTER_H
#ifdef _WINDOWS
#define USB2ST4_API __declspec(dllexport)
#else
#define USB2ST4_API
#endif
#define USB2ST4_ID_MAX 128
typedef enum USB2ST4_DIRECTION{ //Direction
USB2ST4_NORTH=0,
USB2ST4_SOUTH,
USB2ST4_EAST,
USB2ST4_WEST
}USB2ST4_DIRECTION;
typedef enum _USB2ST4_ERROR_CODE{
USB2ST4_SUCCESS = 0,
USB2ST4_ERROR_INVALID_INDEX,
USB2ST4_ERROR_INVALID_ID,
USB2ST4_ERROR_INVALID_VALUE,
USB2ST4_ERROR_REMOVED, //failed to find the converter, maybe the converter has been removed
USB2ST4_ERROR_ERROR_STATE,//converter is in error state
USB2ST4_ERROR_GENERAL_ERROR,//other error
USB2ST4_ERROR_CLOSED,
USB2ST4_ERROR_END = -1
}USB2ST4_ERROR_CODE;
#ifdef __cplusplus
extern "C" {
#endif
/***************************************************************************
Descriptions:
this should be the first API to be called
get number of connected USB2ST4 converter, call this API to refresh device list if USB2ST4 is connected
or disconnected
Return: number of connected USB2ST4 converter. 1 means 1 converter is connected.
***************************************************************************/
USB2ST4_API int USB2ST4GetNum();
/***************************************************************************
Descriptions:
get the product ID of each wheel, at first set pPIDs as 0 and get length and then malloc a buffer to load the PIDs
Paras:
int* pPIDs: pointer to array of PIDs
Return: length of the array.
***************************************************************************/
USB2ST4_API int USB2ST4GetProductIDs(int* pPIDs);
/***************************************************************************
Descriptions:
get ID of converter
Paras:
int index: the index of converter, from 0 to N - 1, N is returned by GetNum()
int* ID: pointer to ID. the ID is a unique integer, between 0 to USB2ST4_ID_MAX - 1, after opened,
all the operation is base on this ID, the ID will not change.
Return:
USB2ST4_ERROR_INVALID_INDEX: index value is invalid
USB2ST4_SUCCESS: operation succeeds
***************************************************************************/
USB2ST4_API USB2ST4_ERROR_CODE USB2ST4GetID(int index, int* ID);
/***************************************************************************
Descriptions:
determine if the converter is opened
Paras:
int ID: the ID of converter
Return:
USB2ST4_ERROR_INVALID_ID: invalid ID value
USB2ST4_ERROR_CLOSED: not opened
USB2ST4_SUCCESS: operation succeeds
USB2ST4_ERROR_INVALID_VALUE: Position value is invalid
USB2ST4_ERROR_ERROR_STATE: converter is in error state
USB2ST4_ERROR_REMOVED: converter is removed
***************************************************************************/
USB2ST4_API USB2ST4_ERROR_CODE USB2ST4IsOpened(int ID);
/***************************************************************************
Descriptions:
open converter
Paras:
int ID: the ID of converter
Return:
USB2ST4_ERROR_INVALID_ID: invalid ID value
USB2ST4_ERROR_GENERAL_ERROR: number of opened converter reaches the maximum value.
USB2ST4_ERROR_REMOVED: the converter is removed.
USB2ST4_SUCCESS: operation succeeds
***************************************************************************/
USB2ST4_API USB2ST4_ERROR_CODE USB2ST4Open(int ID);
/***************************************************************************
Descriptions:
pulse guide in the given direction
Paras:
int ID: the ID of converter
bool bSet: true is on, false is off
Return:
USB2ST4_ERROR_INVALID_ID: invalid ID value
USB2ST4_ERROR_CLOSED: not opened
USB2ST4_SUCCESS: operation succeeds
USB2ST4_ERROR_INVALID_VALUE: Position value is invalid
USB2ST4_ERROR_ERROR_STATE: converter is in error state
USB2ST4_ERROR_REMOVED: converter is removed
***************************************************************************/
USB2ST4_API USB2ST4_ERROR_CODE USB2ST4PulseGuide(int ID, USB2ST4_DIRECTION Dirction, bool bSet);
/***************************************************************************
Descriptions:
close converter
Paras:
int ID: the ID of converter
Return:
USB2ST4_ERROR_INVALID_ID: invalid ID value
USB2ST4_SUCCESS: operation succeeds
***************************************************************************/
USB2ST4_API USB2ST4_ERROR_CODE USB2ST4Close(int ID);
#ifdef __cplusplus
}
#endif
#endif