Instrument Neutral Distributed Interface INDI  1.5.0
indiguiderinterface.cpp
Go to the documentation of this file.
1 /*
2  Guider Interface
3  Copyright (C) 2011 Jasem Mutlaq (mutlaqja@ikarustech.com)
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, Boston, MA 02110-1301 USA
18 
19 */
20 
21 #include "indiguiderinterface.h"
22 
23 #include <cstring>
24 
26 {
27 }
28 
30 {
31 }
32 
33 void INDI::GuiderInterface::initGuiderProperties(const char *deviceName, const char *groupName)
34 {
35  IUFillNumber(&GuideNSN[DIRECTION_NORTH], "TIMED_GUIDE_N", "North (ms)", "%.f", 0, 60000, 100, 0);
36  IUFillNumber(&GuideNSN[DIRECTION_SOUTH], "TIMED_GUIDE_S", "South (ms)", "%.f", 0, 60000, 100, 0);
37  IUFillNumberVector(&GuideNSNP, GuideNSN, 2, deviceName, "TELESCOPE_TIMED_GUIDE_NS", "Guide N/S", groupName, IP_RW,
38  60, IPS_IDLE);
39 
40  IUFillNumber(&GuideWEN[DIRECTION_WEST], "TIMED_GUIDE_W", "West (ms)", "%.f", 0, 60000, 100, 0);
41  IUFillNumber(&GuideWEN[DIRECTION_EAST], "TIMED_GUIDE_E", "East (ms)", "%.f", 0, 60000, 100, 0);
42  IUFillNumberVector(&GuideWENP, GuideWEN, 2, deviceName, "TELESCOPE_TIMED_GUIDE_WE", "Guide E/W", groupName, IP_RW,
43  60, IPS_IDLE);
44 }
45 
46 void INDI::GuiderInterface::processGuiderProperties(const char *name, double values[], char *names[], int n)
47 {
48  if (strcmp(name, GuideNSNP.name) == 0)
49  {
50  // We are being asked to send a guide pulse north/south on the st4 port
51  IUUpdateNumber(&GuideNSNP, values, names, n);
52 
53  if (GuideNSN[DIRECTION_NORTH].value != 0)
54  {
57  }
58  else if (GuideNSN[DIRECTION_SOUTH].value != 0)
60 
61  IDSetNumber(&GuideNSNP, nullptr);
62  return;
63  }
64 
65  if (strcmp(name, GuideWENP.name) == 0)
66  {
67  // We are being asked to send a guide pulse north/south on the st4 port
68  IUUpdateNumber(&GuideWENP, values, names, n);
69 
70  if (GuideWEN[DIRECTION_WEST].value != 0)
71  {
74  }
75  else if (GuideWEN[DIRECTION_EAST].value != 0)
77 
78  IDSetNumber(&GuideWENP, nullptr);
79  return;
80  }
81 }
82 
84 {
85  switch (axis)
86  {
87  case AXIS_DE:
89  IDSetNumber(&GuideNSNP, nullptr);
90  break;
91 
92  case AXIS_RA:
94  IDSetNumber(&GuideWENP, nullptr);
95  break;
96  }
97 }
virtual IPState GuideNorth(float ms)=0
Guide north for ms milliseconds.
void IUFillNumberVector(INumberVectorProperty *nvp, INumber *np, int nnp, const char *dev, const char *name, const char *label, const char *group, IPerm p, double timeout, IPState s)
Assign attributes for a number vector property. The vector&#39;s auxiliary elements will be set to NULL...
Definition: indidriver.c:545
int IUUpdateNumber(INumberVectorProperty *nvp, double values[], char *names[], int n)
Update all numbers in a number vector property.
Definition: indidriver.c:283
INumberVectorProperty GuideNSNP
Definition: indiapi.h:157
const char * name
Definition: indiserver.c:112
virtual IPState GuideSouth(float ms)=0
Guide south for ms milliseconds.
void IDSetNumber(const INumberVectorProperty *n, const char *msg,...)
Tell client to update an existing number vector property.
Definition: indidriver.c:1838
char name[MAXINDINAME]
Definition: indiapi.h:294
void initGuiderProperties(const char *deviceName, const char *groupName)
Initilize guider properties. It is recommended to call this function within initProperties() of your ...
void IUFillNumber(INumber *np, const char *name, const char *label, const char *format, double min, double max, double step, double value)
Assign attributes for a number property. The number&#39;s auxiliary elements will be set to NULL...
Definition: indidriver.c:420
virtual IPState GuideWest(float ms)=0
Guide west for ms milliseconds.
INDI_EQ_AXIS
Definition: indibasetypes.h:32
void processGuiderProperties(const char *name, double values[], char *names[], int n)
Call this function whenever client updates GuideNSNP or GuideWSP properties in the primary device...
virtual IPState GuideEast(float ms)=0
Guide east for ms milliseconds.
INumberVectorProperty GuideWENP
virtual void GuideComplete(INDI_EQ_AXIS axis)
Call GuideComplete once the guiding pulse is complete.
double value
Definition: indiapi.h:261