×

INDI Library v2.0.6 is Released (02 Feb 2024)

Bi-monthly release with minor bug fixes and improvements

getDriverInterface returns only 0

  • Posts: 35
  • Thank you received: 1
Hey,
it's pretty much the title. I can't figure out what devices I'm receiving. Of course I know, but my client only sees, driver interface is 0, so it's useless. Am I doing anything wrong?
void client::newDevice(INDI::BaseDevice* dp)
{
  log("CLI:\tnew device: %s", dp->getDeviceName());
 
  uint16_t driver_interface = dp->getDriverInterface();
  log("driver_interface: %d", driver_interface);
  if( driver_interface & INDI::BaseDevice::DRIVER_INTERFACE::TELESCOPE_INTERFACE )
  {
    if (int_telescope==NULL && ( !strcmp(dp->getDeviceName(), TELE) || !strcmp(dp->getDeviceName(), TELE_SIM) ))
    {
      log("CLI:\tReceived Telescope:\t%s...", dp->getDeviceName());
  //     telescope = dp;
      int_telescope = new cl_TelescopeInterface(dp, this);
    }
    else if(int_telescope==NULL && !strcmp(dp->getDeviceName(), TELE_STAN))
    {
      log("CLI:\tReceived Telescope:\t%s...", dp->getDeviceName());
  //     telescope = dp;
  //     int_telescope = new cl_TelescopeInterface(dp, this);
      int_telescope = new cl_TelescopeHondelage(dp, this);
 
    }
 
    connect(int_telescope, SIGNAL(reachedTarget()), this, SLOT(reachedTarget()));
//     connect(int_telescope, SIGNAL(reachedTarget()), this, SLOT(setNewTransit()));
    connect(int_telescope, SIGNAL(reachedTarget()), this, SLOT(writeImageInfo2File()));
    connect(int_telescope, SIGNAL(slewingError()), this, SLOT(slewingError()));
  }
  else if( driver_interface & INDI::BaseDevice::DRIVER_INTERFACE::CCD_INTERFACE)
  {
    addCamera(dp);
  }
  else if( driver_interface & INDI::BaseDevice::DRIVER_INTERFACE::AUX_INTERFACE)
  {
    if (int_joystick==NULL && (!strcmp(dp->getDeviceName(), JOYSTICK)))
    {
      log("CLI:\tReceived Joystick:\t%s...", dp->getDeviceName());
      int_joystick = new cl_JoystickWingman(dp, this);
    }
}
  }

that second log statement always returns zero. I tried so far a few simulator drivers and the lx200gps and they all returned zero when asked for their interface.

Thanks in advance!

Cheers
Erik


INDI Library: 1.8.2
Code 1.8.2-tgz. Protocol 1.7.
4 years 1 month ago #49400

Please Log in or Create an account to join the conversation.

So you probably need to wait until that property is defined first. So in newProperty, check for DRIVER_INFO property. This is what I use in KStars:
if (!strcmp(prop->getName(), "DRIVER_INFO"))
    {
        ITextVectorProperty *tvp = prop->getText();
        if (tvp)
        {
            IText *tp = IUFindText(tvp, "DRIVER_INTERFACE");
            if (tp)
            {
                driverInterface = static_cast<uint32_t>(atoi(tp->text));
                emit interfaceDefined();
            }
 
            tp = IUFindText(tvp, "DRIVER_VERSION");
            if (tp)
            {
                driverVersion = QString(tp->text);
            }
        }
    }
The following user(s) said Thank You: erik
4 years 1 month ago #49951

Please Log in or Create an account to join the conversation.

Time to create page: 0.409 seconds