• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kstars

lx200autostar.cpp

Go to the documentation of this file.
00001 /*
00002     LX200 Autostar
00003     Copyright (C) 2003 Jasem Mutlaq (mutlaqja@ikarustech.com)
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Lesser General Public
00007     License as published by the Free Software Foundation; either
00008     version 2.1 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Lesser General Public License for more details.
00014 
00015     You should have received a copy of the GNU Lesser General Public
00016     License along with this library; if not, write to the Free Software
00017     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00018 
00019 */
00020 
00021 #include <stdio.h>
00022 #include <stdlib.h>
00023 #include <string.h>
00024 #include <unistd.h>
00025 
00026 #include "lx200autostar.h"
00027 #include "lx200driver.h"
00028 
00029 #define FirmwareGroup "Firmware data"
00030 
00031 
00032 extern LX200Generic *telescope;
00033 extern int MaxReticleFlashRate;
00034 extern ITextVectorProperty Time;
00035 extern INumberVectorProperty SDTime;
00036 extern INumberVectorProperty eqNum;
00037 extern ISwitchVectorProperty ParkSP;
00038 extern ISwitchVectorProperty PowerSP;
00039 
00040 static IText   VersionT[] ={{ "Date", "", 0, 0, 0, 0} ,
00041                { "Time", "", 0, 0, 0, 0} ,
00042                { "Number", "", 0, 0, 0 ,0} ,
00043                { "Full", "", 0, 0, 0, 0} ,
00044                { "Name", "" ,0 ,0 ,0 ,0}};
00045 
00046 static ITextVectorProperty VersionInfo = {mydev, "Firmware Info", "", FirmwareGroup, IP_RO, 0, IPS_IDLE, VersionT, NARRAY(VersionT), "" ,0};
00047 
00048 void changeLX200AutostarDeviceName(const char *newName)
00049 {
00050   strcpy(VersionInfo.device, newName);
00051 }
00052 
00053 LX200Autostar::LX200Autostar() : LX200Generic()
00054 {
00055 
00056   //for (int i=0; i  < 5; i++)
00057      //strcpy(VersionInfo.t[i].text, "");
00058 
00059 }
00060 
00061 
00062 void LX200Autostar::ISGetProperties (const char *dev)
00063 {
00064 
00065 if (dev && strcmp (thisDevice, dev))
00066     return;
00067 
00068     LX200Generic::ISGetProperties(dev);
00069 
00070     IDDefText (&VersionInfo, NULL);
00071 
00072 }
00073 
00074 void LX200Autostar::ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n)
00075 {
00076         // ignore if not ours //
00077     if (strcmp (dev, thisDevice))
00078         return;
00079 
00080     // suppress warning
00081     n=n;
00082 
00083   LX200Generic::ISNewText (dev, name, texts, names, n);
00084 
00085 }
00086 
00087 
00088 void LX200Autostar::ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n)
00089 {
00090     LX200Generic::ISNewNumber (dev, name, values, names, n);
00091 }
00092 
00093  void LX200Autostar::ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n)
00094  {
00095  
00096    if (!strcmp(name, ParkSP.name))
00097    {
00098       if (checkPower(&ParkSP))
00099         return;
00100            
00101        ParkSP.s = IPS_IDLE;
00102        
00103       if (eqNum.s == IPS_BUSY)
00104       {
00105          abortSlew();
00106 
00107          // sleep for 200 mseconds
00108          usleep(200000);
00109       }
00110 
00111       slewToPark();
00112 
00113       ParkSP.s = IPS_OK;
00114       eqNum.s = IPS_IDLE;
00115       PowerSP.s   = IPS_IDLE;
00116       PowerSP.sp[0].s = ISS_OFF;
00117       PowerSP.sp[1].s = ISS_ON;
00118       IDSetNumber(&eqNum, NULL);
00119       IDSetSwitch(&ParkSP, "The telescope is slewing to park position. Turn off the telescope after park is complete. Disconnecting...");
00120       IDSetSwitch(&PowerSP, NULL);
00121       return;
00122     }
00123 
00124    LX200Generic::ISNewSwitch (dev, name, states, names,  n);
00125 
00126  }
00127 
00128  void LX200Autostar::ISPoll ()
00129  {
00130 
00131       LX200Generic::ISPoll();
00132 
00133  }
00134 
00135  void LX200Autostar::getBasicData()
00136  {
00137 
00138    VersionInfo.tp[0].text = new char[64];
00139    getVersionDate(VersionInfo.tp[0].text);
00140    VersionInfo.tp[1].text = new char[64];
00141    getVersionTime(VersionInfo.tp[1].text);
00142    VersionInfo.tp[2].text = new char[64];
00143    getVersionNumber(VersionInfo.tp[2].text);
00144    VersionInfo.tp[3].text = new char[128];
00145    getFullVersion(VersionInfo.tp[3].text);
00146    VersionInfo.tp[4].text = new char[128];
00147    getProductName(VersionInfo.tp[4].text);
00148 
00149    IDSetText(&VersionInfo, NULL);
00150    
00151    // process parent
00152    LX200Generic::getBasicData();
00153 
00154  }

kstars

Skip menu "kstars"
  • Main Page
  • Modules
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • keduca
  • kstars
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal