TwiceAsNice  2019-02-18
Macros | Functions | Variables
trutech_wheel.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <cstring>
#include <stdarg.h>
#include <cmath>
#include <unistd.h>
#include <ctime>
#include <fcntl.h>
#include <cerrno>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include "indidevapi.h"
#include "eventloop.h"
#include "indicom.h"
Include dependency graph for trutech_wheel.c:

Macros

#define mydev   "TruTech Wheel"
 
#define MAIN_GROUP   "Main Control"
 
#define currentFilter   FilterPositionN[0].value
 
#define POLLMS   3000
 
#define DEFAULT_FILTER_COUNT   5
 
#define MAX_FILTER_COUNT   10
 
#define ERRMSG_SIZE   1024
 
#define CMD_SIZE   5
 
#define CMD_JUNK   64
 
#define CMD_RESP   15
 
#define FILTER_TIMEOUT   15 /* 15 Seconds before timeout */
 
#define FIRST_FILTER   1
 
#define DEBUG_ON   0
 
#define SIMULATION_ON   0
 

Functions

void ISInit (void)
 Send client definitions of all properties. More...
 
void getBasicData (void)
 
void ISPoll (void *)
 Used to read periodically the data from the device. More...
 
void handleExposure (void *)
 
void connectFilter (void)
 
int manageDefaults (char errmsg[])
 
int checkPowerS (ISwitchVectorProperty *sp)
 
int checkPowerN (INumberVectorProperty *np)
 
int checkPowerT (ITextVectorProperty *tp)
 
int getOnSwitch (ISwitchVectorProperty *sp)
 
int isFilterConnected (void)
 
void ISGetProperties (const char *dev)
 Get Device Properties. More...
 
void ISNewBLOB (const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n)
 Update data of an existing blob vector property. More...
 
void ISSnoopDevice (XMLEle *root)
 Function defined by Drivers that is called when another Driver it is snooping (by having previously called IDSnoopDevice()) sent any INDI message. More...
 
void ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n)
 Update the value of an existing switch vector property. More...
 
void ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n)
 Update the value of an existing text vector property. More...
 
void ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n)
 

Variables

static int targetFilter
 
static int fd
 
const unsigned char COMM_PRE = 0x01
 
const unsigned char COMM_INIT = 0xA5
 
const unsigned char COMM_FILL = 0x20
 
static ISwitch PowerS [] = { { "CONNECT", "Connect", ISS_OFF, 0, 0 }, { "DISCONNECT", "Disconnect", ISS_ON, 0, 0 } }
 
static ISwitchVectorProperty PowerSP
 
static IText PortT [] = { { "PORT", "Port", 0, 0, 0, 0 } }
 
static ITextVectorProperty PortTP
 
static ISwitch HomeS [] = { { "Find", "", ISS_OFF, 0, 0 } }
 
static ISwitchVectorProperty HomeSP
 
static INumber FilterCountN [] = { { "Count", "", "%2.0f", 0, MAX_FILTER_COUNT, 1, DEFAULT_FILTER_COUNT, 0, 0, 0 } }
 
static INumberVectorProperty FilterCountNP
 
static INumber FilterPositionN []
 
static INumberVectorProperty FilterPositionNP
 

Macro Definition Documentation

◆ CMD_JUNK

#define CMD_JUNK   64

◆ CMD_RESP

#define CMD_RESP   15

◆ CMD_SIZE

#define CMD_SIZE   5

◆ currentFilter

#define currentFilter   FilterPositionN[0].value

◆ DEBUG_ON

#define DEBUG_ON   0

◆ DEFAULT_FILTER_COUNT

#define DEFAULT_FILTER_COUNT   5

◆ ERRMSG_SIZE

#define ERRMSG_SIZE   1024

◆ FILTER_TIMEOUT

#define FILTER_TIMEOUT   15 /* 15 Seconds before timeout */

◆ FIRST_FILTER

#define FIRST_FILTER   1

◆ MAIN_GROUP

#define MAIN_GROUP   "Main Control"

◆ MAX_FILTER_COUNT

#define MAX_FILTER_COUNT   10

◆ mydev

#define mydev   "TruTech Wheel"

◆ POLLMS

#define POLLMS   3000

◆ SIMULATION_ON

#define SIMULATION_ON   0

Function Documentation

◆ checkPowerN()

int checkPowerN ( INumberVectorProperty np)

◆ checkPowerS()

int checkPowerS ( ISwitchVectorProperty sp)

◆ checkPowerT()

int checkPowerT ( ITextVectorProperty tp)

◆ connectFilter()

void connectFilter ( void  )

◆ getBasicData()

void getBasicData ( void  )

◆ getOnSwitch()

int getOnSwitch ( ISwitchVectorProperty sp)

◆ handleExposure()

void handleExposure ( void *  )

◆ isFilterConnected()

int isFilterConnected ( void  )

◆ ISInit()

void ISInit ( void  )

Send client definitions of all properties.

◆ ISNewNumber()

void ISNewNumber ( const char *  dev,
const char *  name,
double  values[],
char *  names[],
int  n 
)

◆ ISPoll()

void ISPoll ( void *  )

Used to read periodically the data from the device.

Parameters
pthe AAGCloudWatcher object

◆ manageDefaults()

int manageDefaults ( char  errmsg[])

Variable Documentation

◆ COMM_FILL

const unsigned char COMM_FILL = 0x20

◆ COMM_INIT

const unsigned char COMM_INIT = 0xA5

◆ COMM_PRE

const unsigned char COMM_PRE = 0x01

◆ fd

int fd
static

◆ FilterCountN

INumber FilterCountN[] = { { "Count", "", "%2.0f", 0, MAX_FILTER_COUNT, 1, DEFAULT_FILTER_COUNT, 0, 0, 0 } }
static

◆ FilterCountNP

INumberVectorProperty FilterCountNP
static
Initial value:
= { mydev, "Filter Count", "", MAIN_GROUP, IP_RW, 0, IPS_IDLE,
#define MAIN_GROUP
Definition: trutech_wheel.c:58
#define mydev
Definition: trutech_wheel.c:57
static INumber FilterCountN[]
Definition: trutech_wheel.c:93
Definition: indiapi.h:155
Definition: indiapi.h:178
#define NARRAY(a)
Handy macro to find the number of elements in array a[].
Definition: indiapi.h:492

◆ FilterPositionN

INumber FilterPositionN[]
static
Initial value:
= { { "FILTER_SLOT_VALUE", "Active Filter", "%2.0f", 1, DEFAULT_FILTER_COUNT, 1, 1, 0,
0, 0 } }
#define DEFAULT_FILTER_COUNT
Definition: trutech_wheel.c:61

◆ FilterPositionNP

INumberVectorProperty FilterPositionNP
static
Initial value:
= {
mydev, "FILTER_SLOT", "Filter", MAIN_GROUP, IP_RW, 0, IPS_IDLE, FilterPositionN, NARRAY(FilterPositionN), "", 0
}
static INumber FilterPositionN[]
Definition: trutech_wheel.c:98
#define MAIN_GROUP
Definition: trutech_wheel.c:58
#define mydev
Definition: trutech_wheel.c:57
Definition: indiapi.h:155
Definition: indiapi.h:178
#define NARRAY(a)
Handy macro to find the number of elements in array a[].
Definition: indiapi.h:492

◆ HomeS

ISwitch HomeS[] = { { "Find", "", ISS_OFF, 0, 0 } }
static

◆ HomeSP

ISwitchVectorProperty HomeSP
static
Initial value:
= { mydev, "HOME", "", MAIN_GROUP, IP_RW, ISR_1OFMANY,
60, IPS_IDLE, HomeS, NARRAY(HomeS), "", 0 }
#define MAIN_GROUP
Definition: trutech_wheel.c:58
#define mydev
Definition: trutech_wheel.c:57
static ISwitch HomeS[]
Definition: trutech_wheel.c:88
Definition: indiapi.h:155
Definition: indiapi.h:166
Definition: indiapi.h:178
#define NARRAY(a)
Handy macro to find the number of elements in array a[].
Definition: indiapi.h:492

◆ PortT

IText PortT[] = { { "PORT", "Port", 0, 0, 0, 0 } }
static

◆ PortTP

ITextVectorProperty PortTP
static
Initial value:
= { mydev, "DEVICE_PORT", "Ports", MAIN_GROUP, IP_RW, 0,
IPS_IDLE, PortT, NARRAY(PortT), "", 0 }
#define MAIN_GROUP
Definition: trutech_wheel.c:58
#define mydev
Definition: trutech_wheel.c:57
static IText PortT[]
Definition: trutech_wheel.c:83
Definition: indiapi.h:155
Definition: indiapi.h:178
#define NARRAY(a)
Handy macro to find the number of elements in array a[].
Definition: indiapi.h:492

◆ PowerS

ISwitch PowerS[] = { { "CONNECT", "Connect", ISS_OFF, 0, 0 }, { "DISCONNECT", "Disconnect", ISS_ON, 0, 0 } }
static

◆ PowerSP

ISwitchVectorProperty PowerSP
static
Initial value:
= { mydev, "CONNECTION", "Connection", MAIN_GROUP, IP_RW, ISR_1OFMANY,
60, IPS_IDLE, PowerS, NARRAY(PowerS), "", 0 }
#define MAIN_GROUP
Definition: trutech_wheel.c:58
#define mydev
Definition: trutech_wheel.c:57
Definition: indiapi.h:155
Definition: indiapi.h:166
Definition: indiapi.h:178
static ISwitch PowerS[]
Definition: trutech_wheel.c:78
#define NARRAY(a)
Handy macro to find the number of elements in array a[].
Definition: indiapi.h:492

◆ targetFilter

int targetFilter
static