1 | /* |
---|
2 | MAGELLAN Driver |
---|
3 | Copyright (C) 2011 Onno Hommes (ohommes@alumni.cmu.edu) |
---|
4 | |
---|
5 | This library is free software; you can redistribute it and/or |
---|
6 | modify it under the terms of the GNU Lesser General Public |
---|
7 | License as published by the Free Software Foundation; either |
---|
8 | version 2.1 of the License, or (at your option) any later version. |
---|
9 | |
---|
10 | This library is distributed in the hope that it will be useful, |
---|
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
13 | Lesser General Public License for more details. |
---|
14 | |
---|
15 | You should have received a copy of the GNU Lesser General Public |
---|
16 | License along with this library; if not, write to the Free Software |
---|
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, |
---|
18 | Boston, MA 02110-1301 USA |
---|
19 | |
---|
20 | */ |
---|
21 | |
---|
22 | #ifndef MAGELLANDRIVER_H |
---|
23 | #define MAGELLANDRIVER_H |
---|
24 | |
---|
25 | /* Just use Default tracking for what ever telescope is feeding Magellan I */ |
---|
26 | enum TFreq { MAGELLAN_TRACK_DEFAULT, MAGELLAN_TRACK_LUNAR, MAGELLAN_TRACK_MANUAL}; |
---|
27 | |
---|
28 | /* Time Format */ |
---|
29 | enum TTimeFormat { MAGELLAN_24, MAGELLAN_AM, MAGELLAN_PM}; |
---|
30 | |
---|
31 | #define MAGELLAN_TIMEOUT 5 /* FD timeout in seconds */ |
---|
32 | #define MAGELLAN_ERROR -1 /* Default Error Code */ |
---|
33 | #define MAGELLAN_OK 0 /* Default Success Code */ |
---|
34 | #define MAGELLAN_ACK 'P' /* Default Success Code */ |
---|
35 | |
---|
36 | #define CENTURY_THRESHOLD 91 /* When to goto 21st Century */ |
---|
37 | #define CONNECTION_RETRIES 2 /* Retry Attempt cut-off */ |
---|
38 | |
---|
39 | /* GET formatted sexagisemal value from device, return as double */ |
---|
40 | #define getMAGELLANRA(fd, x) getCommandSexa(fd, x, "#:GR#") |
---|
41 | #define getMAGELLANDEC(fd, x) getCommandSexa(fd, x, "#:GD#") |
---|
42 | |
---|
43 | #ifdef __cplusplus |
---|
44 | extern "C" { |
---|
45 | #endif |
---|
46 | |
---|
47 | /************************************************************************** |
---|
48 | Diagnostics |
---|
49 | **************************************************************************/ |
---|
50 | char ACK(int fd); |
---|
51 | int check_magellan_connection(int fd); |
---|
52 | |
---|
53 | /************************************************************************** |
---|
54 | Get Commands: store data in the supplied buffer. Return 0 on success or -1 |
---|
55 | on failure |
---|
56 | **************************************************************************/ |
---|
57 | |
---|
58 | /* Get Double from Sexagisemal */ |
---|
59 | int getCommandSexa(int fd, double *value, const char *cmd); |
---|
60 | |
---|
61 | /* Get Calender data */ |
---|
62 | int getCalenderDate(int fd, char *date); |
---|
63 | |
---|
64 | #ifdef __cplusplus |
---|
65 | } |
---|
66 | #endif |
---|
67 | |
---|
68 | #endif |
---|