1 | libindi v0.6.2 |
---|
2 | ============== |
---|
3 | |
---|
4 | The code here demonstrates the use of INDI, an Instrument-Neutral Device |
---|
5 | Interface protocol. See http://www.clearskyinstitute.com/INDI/INDI.pdf. |
---|
6 | |
---|
7 | Architecture: |
---|
8 | |
---|
9 | Typical INDI Client / Server / Driver / Device connectivity: |
---|
10 | |
---|
11 | |
---|
12 | INDI Client 1 ----| |---- INDI Driver A ---- Dev X |
---|
13 | | | |
---|
14 | INDI Client 2 ----| |---- INDI Driver B ---- Dev Y |
---|
15 | | | | |
---|
16 | ... |--- indiserver ---| |-- Dev Z |
---|
17 | | | |
---|
18 | | | |
---|
19 | INDI Client n ----| |---- INDI Driver C ---- Dev T |
---|
20 | |
---|
21 | |
---|
22 | Client INET Server UNIX Driver Hardware |
---|
23 | processes sockets process pipes processes devices |
---|
24 | |
---|
25 | |
---|
26 | |
---|
27 | Indiserver is the public network access point where one or more INDI Clients |
---|
28 | may contact one or more INDI Drivers. Indiserver launches each driver |
---|
29 | process and arranges for it to receive the INDI protocol from Clients on |
---|
30 | its stdin and expects to find commands destined for Clients on the |
---|
31 | driver's stdout. Anything arriving from a driver process' stderr is copied |
---|
32 | to indiserver's stderr. |
---|
33 | |
---|
34 | Indiserver only provides convenient port, fork and data steering services. |
---|
35 | If desired, a Client may run and connect to INDI Drivers directly. |
---|
36 | |
---|
37 | Construction: |
---|
38 | |
---|
39 | An INDI driver typically consists of one .c file, eg, mydriver.c, which |
---|
40 | #includes indiapi.h to access the reference API declarations. It is |
---|
41 | compiled then linked with indidrivermain.o, eventloop.o and liblilxml.a to |
---|
42 | form an INDI process. These supporting files contain the implementation of |
---|
43 | the INDI Driver API and need not be changed in any way. Note that |
---|
44 | evenloop.[ch] provide a nice callback facility independent of INDI which |
---|
45 | may be used in other projects if desired. |
---|
46 | |
---|
47 | The driver implementation, again in our example mydriver.c, does not |
---|
48 | contain a main() but is expected to operate as an event-driver program. |
---|
49 | The driver must implement each ISxxx() function but never call them. The |
---|
50 | IS() functions are called by the reference implementation main() as messages |
---|
51 | arrive from Clients. Within each IS function the driver performs the |
---|
52 | desired tasks then may report back to the Client by calling the IDxxx() |
---|
53 | functions. |
---|
54 | |
---|
55 | The reference API provides IE() functions to allow the driver to add its |
---|
56 | own callback functions if desired. The driver can arrange for functions to |
---|
57 | be called when reading a file descriptor will not block; when a time |
---|
58 | interval has expired; or when there is no other client traffic in progress. |
---|
59 | |
---|
60 | The sample indiserver is a stand alone process that may be used to run one |
---|
61 | or more INDI-compliant drivers. It takes the names of each driver process |
---|
62 | to run in its command line args. |
---|
63 | |
---|
64 | To build indiserver type 'make indiserver'; |
---|
65 | to build all the sample drivers type 'make drivers'; |
---|
66 | to run the sample server with all drivers type 'make run'. |
---|
67 | Killing indiserver will also kill all the drivers it started. |
---|
68 | |
---|
69 | Secure remote operation: |
---|
70 | |
---|
71 | Suppose we want to run indiserver and its clients on a remote machine, r, |
---|
72 | and connect them to our favorite INDI client, XEphem, running on the |
---|
73 | local machine. |
---|
74 | |
---|
75 | From the local machine log onto the remote machine, r, by typing: |
---|
76 | |
---|
77 | ssh2 -L 7624:s:7624 r |
---|
78 | |
---|
79 | after logging in, run indiserver on the remote machine: |
---|
80 | |
---|
81 | make run |
---|
82 | |
---|
83 | Back on the local machine, start XEphem, then open Views -> Sky View -> |
---|
84 | Telescope -> INDI panel. XEphem will connect to the remote INDI server |
---|
85 | securely and automatically begin running. Sweet. |
---|
86 | |
---|
87 | Testing: |
---|
88 | |
---|
89 | A low-level way to test the socket, forking and data steering abilities of |
---|
90 | indiserver is to use the 'hose' command from the netpipes collection |
---|
91 | (http://web.purplefrog.com/~thoth/netpipes/netpipes.html): |
---|
92 | |
---|
93 | 1. start indiserver using UNIX' cat program as the only INDI "device": |
---|
94 | |
---|
95 | % indiserver cat & |
---|
96 | |
---|
97 | 2. use hose to connect to the "cat" device driver which just copies back: |
---|
98 | |
---|
99 | % hose localhost 7624 --slave |
---|
100 | hello world |
---|
101 | hello world |
---|
102 | more stuff |
---|
103 | more stuff |
---|
104 | |
---|
105 | ! For RCS Only -- Do Not Edit |
---|
106 | ! @(#) $RCSfile$ $Date: 2004-02-03 09:34:32 +0300 (Tue, 03 Feb 2004) $ $Revision: 284704 $ $Name: $ |
---|