evalINDI ======== Name ---- evalINDI − evaluate an expression of INDI property values Synopsis -------- :: evalINDI [options] [exp] Description ----------- evalINDI connects to an indiserver and listens for the values of properties to evaluate an arithmetic expression. Each property is specified using three components enclosed in double quotes in the following form: :: "device.property.element" The last component of the property specification is usually the element name, but may be a reserved name to indicate an attribute of the property as a whole. These reserved names are as follows: .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html
.. raw:: html .. raw:: html

\_STATE .. raw:: html

.. raw:: html
.. raw:: html

the state attribute, where for the purposes of evaluation the usual keywords Idle, Ok, Busy and Alert are converted to the numeric values of 0, 1, 2 and 3 respectively. .. raw:: html

.. raw:: html
.. raw:: html .. raw:: html

\_TS .. raw:: html

.. raw:: html
.. raw:: html

evaluate the timestamp attribute as the number of UNIX seconds from epoch .. raw:: html

.. raw:: html
Switch vectors evalute to 0 or 1 based on the state values of Off and On, respectively. Light vectors evaluate to 0-3 similarly to the keywords described above for \_STATE. The arithmetic expression, *exp,* follows the form of that used in the C programming language. The operators supported include: :: ! + - * / && || > >= == != < <= and the mathematical functions supported include: ``sin(rad)`` ``cos(rad)`` ``tan(rad)`` ``asin(x)`` ``acos(x)`` ``atan(x)`` ``atan2(y,x)`` ``abs(x)`` ``degrad(deg)`` ``raddeg(rad)`` ``floor(x)`` ``log(x)`` ``log10(x)`` ``exp(x)`` ``sqrt(x)`` ``pow(x,exp)`` The value of PI can be specified using a constant named “pi”. Options ------- .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: html
.. raw:: html .. raw:: html

-b .. raw:: html

.. raw:: html
.. raw:: html

Ring the terminal bell when expression evaluates as true. .. raw:: html

.. raw:: html
.. raw:: html .. raw:: html

-d .. raw:: html

.. raw:: html
.. raw:: html

use file descriptor f already open as a socket to the indiserver. This is useful for scripts to make a session connection one time then reuse it for each invocation. If the file descriptor seems to be being closed, check that the close-on-exec flag is off; for example in perl use something like: .. raw:: html

``#!/usr/bin/perl``\ ``use Socket;``\ ``use Fcntl;``\ ``socket(SOCK, PF_INET, SOCK_STREAM, getprotobyname(’tcp’));``\ ``connect(SOCK, sockaddr_in(7624,inet_aton(’localhost’)));``\ ``fcntl(SOCK,F_SETFD,0);``\ ``$directfd = fileno(SOCK);``\ ``&runindi ("./evalINDI", "-d", "$directfd", "\"x.y.z\"==1");``\ ``sub runindi { if (fork()) { wait(); } else { exec @_; } }``\ .. raw:: html
.. raw:: html .. raw:: html

-e .. raw:: html

.. raw:: html
.. raw:: html

print each updated expression value after each evaluation .. raw:: html

.. raw:: html
.. raw:: html .. raw:: html

-f .. raw:: html

.. raw:: html
.. raw:: html

print the final expression value .. raw:: html

.. raw:: html
.. raw:: html .. raw:: html

-h .. raw:: html

.. raw:: html
.. raw:: html

connect to alternate host h; the default is localhost. .. raw:: html

.. raw:: html
.. raw:: html .. raw:: html

-i .. raw:: html

.. raw:: html
.. raw:: html

read the expression from stdin .. raw:: html

.. raw:: html
.. raw:: html .. raw:: html

-o .. raw:: html

.. raw:: html
.. raw:: html

print each operand each time it changes value in the form property=value .. raw:: html

.. raw:: html
.. raw:: html .. raw:: html

-p

.. raw:: html

.. raw:: html
.. raw:: html

connect using alternate port p; the default is 7624. .. raw:: html

.. raw:: html
.. raw:: html .. raw:: html

-t .. raw:: html

.. raw:: html
.. raw:: html

wait no longer than t seconds to gather the initial values for all the specified properties; 0 means forever, the default is 2 seconds. .. raw:: html

.. raw:: html
.. raw:: html .. raw:: html

-v .. raw:: html

.. raw:: html
.. raw:: html

generate additional information on stderr. This is cumulative in that specifying more -v options will generate more output. .. raw:: html

.. raw:: html
.. raw:: html .. raw:: html

-w .. raw:: html

.. raw:: html
.. raw:: html

evaluate the expression as many times as necessary until it evaluates to a value other than zero. .. raw:: html

.. raw:: html
Exit Status ----------- The evalINDI program exits with a statis of 0 if the expression evaluates to non-0. It exits with 1 if the expression evaluated to 0. It exits with 2 if there was some other error such as not being able to connect to the indiserver. Examples -------- Print 0/1 whether the Front or Rear elements of the Security property are in a state of Alert: :: evalINDI -f ’"Security.Security.Front"==3 || "Security.Security.Rear"==3’ Exit 0 if the Security property as a whole is in a state of Ok: :: evalINDI ’"Security.Security._STATE"==1’ Wait forever for RA and Dec to be near zero and watch their values as they change: :: evalINDI -t 0 -wo ’abs("Mount.EqJ2K.RA")<.01 && abs("Mount.EqJ2K.Dec")<.01’ Wait forever for the wind speed to become larger than 50: :: evalINDI -t 0 -w ’"Weather.Wind.Speed">50’ See Also -------- - `getINDI <./getINDI>`__ - `setINDI <./setINDI>`__ - `indiserver <./indiserver>`__ - The `INDI specification v. 1.7 `__ -------------- This evalINDI.md generated from the man documentation with the commands: :: groff -mandoc -Thtml evalINDI.man > evalINDI.html pandoc -t markdown_github evalINDI.html > evalINDI.md and then tweaked for presentation.