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

kstars

indi_lpi.cpp

Go to the documentation of this file.
00001 /*
00002     Meade LPI Experimental driver
00003     Copyright (C) 2005 by Jasem Mutlaq
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 "v4ldriver.h"
00022 
00023 class Meade_LPI : public V4L_Driver
00024 {
00025   public:
00026     Meade_LPI();
00027    ~Meade_LPI();
00028 
00029   #ifdef HAVE_LINUX_VIDEODEV2_H
00030   void connectCamera(void);
00031   #endif
00032 
00033 };
00034 
00035 Meade_LPI::Meade_LPI() : V4L_Driver()
00036 {
00037 }
00038 
00039 Meade_LPI::~Meade_LPI()
00040 {
00041 }
00042 
00043 #ifdef HAVE_LINUX_VIDEODEV2_H
00044 void Meade_LPI::connectCamera()
00045 {
00046   char errmsg[ERRMSGSIZ];
00047 
00048   switch (PowerS[0].s)
00049   {
00050      case ISS_ON:
00051       if (v4l_base->connectCam(PortT[0].text, errmsg, V4L2_PIX_FMT_SBGGR8, 352, 288) < 0)
00052       {
00053       PowerSP.s = IPS_IDLE;
00054       PowerS[0].s = ISS_OFF;
00055       PowerS[1].s = ISS_ON;
00056       IDSetSwitch(&PowerSP, "Error: unable to open device");
00057       IDLog("Error: %s\n", errmsg);
00058       return;
00059       }
00060       
00061       /* Sucess! */
00062       PowerS[0].s = ISS_ON;
00063       PowerS[1].s = ISS_OFF;
00064       PowerSP.s = IPS_OK;
00065       IDSetSwitch(&PowerSP, "Meade LPI is online. Retrieving basic data.");
00066 
00067       v4l_base->registerCallback(newFrame, this);
00068       
00069       V4LFrame->compressedFrame = (unsigned char *) malloc (sizeof(unsigned char) * 1);
00070       
00071       IDLog("Meade LPI is online. Retrieving basic data.\n");
00072       getBasicData();
00073       
00074       break;
00075       
00076     case ISS_OFF:
00077       PowerS[0].s = ISS_OFF;
00078       PowerS[1].s = ISS_ON;
00079       PowerSP.s = IPS_IDLE;
00080       
00081       free(V4LFrame->compressedFrame);
00082       V4LFrame->compressedFrame = NULL;
00083       v4l_base->disconnectCam();
00084       
00085       IDSetSwitch(&PowerSP, "Meade LPI is offline.");
00086       
00087       break;
00088      }
00089 
00090 }
00091 #endif
00092 
00093 Meade_LPI *MainCam = NULL;      /* Main and only camera */
00094 
00095 /* send client definitions of all properties */
00096 void ISInit()
00097 {
00098   if (MainCam == NULL)
00099   {
00100     MainCam = new Meade_LPI();
00101     MainCam->initProperties("Meade LPI");
00102     MainCam->initCamBase();
00103   }
00104 }
00105     
00106 void ISGetProperties (const char *dev)
00107 { 
00108    ISInit();
00109   
00110   MainCam->ISGetProperties(dev);
00111 }
00112 
00113 
00114 void ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n)
00115 {
00116     
00117   ISInit();
00118   
00119   MainCam->ISNewSwitch(dev, name, states, names, n);
00120 }
00121 
00122 void ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n)
00123 {
00124   
00125    ISInit();
00126    
00127    MainCam->ISNewText(dev, name, texts, names, n);
00128 }
00129 
00130 
00131 void ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n)
00132 {
00133       
00134   ISInit();
00135   
00136   MainCam->ISNewNumber(dev, name, values, names, n);
00137 }
00138 
00139 void ISNewBLOB (const char */*dev*/, const char */*name*/, int */*sizes[]*/, char **/*blobs[]*/, char **/*formats[]*/, char **/*names[]*/, int /*n*/)
00140 {
00141 
00142   // We use this if we're receving binary data from the client. Most likely we won't for this driver.
00143 
00144 }
00145 
00146 

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