This seems like a really basic question, but it has me stumped.

In my BaseClient subclass, I'm trying to get a list of all the Telescope and Cameras registered with the server. If I have this code:

void IndiClient::newDevice(INDI::BaseDevice baseDevice)
{
    auto interface = baseDevice->getDriverInterface();
    if (interface == INDI::BaseDevice::TELESCOPE_INTERFACE)
    {
        IDLog("New Device: %s\n", baseDevice->getDeviceName());
    }
}

The interface always comes back as 0 (GENERAL_INTERFACE). I never get anything specific.

I've also tried using getDevices() after receiving the serverConnected() notification:
void IndiClient::serverConnected()
{
    IDLog("Server Connected\n\n");    
    
    IDLog("Listing mounts:\n");
    std::vector<INDI::BaseDevice> mounts;
    getDevices(mounts, INDI::BaseDevice::TELESCOPE_INTERFACE);
    for (INDI::BaseDevice *device : mounts)
        printf("Mount Name: %s\n", device->getDeviceName());
    
    IDLog("Listing cameras:\n");
    std::vector<INDI::BaseDevice> cameras;
    getDevices(cameras, INDI::BaseDevice::CCD_INTERFACE);
    for (INDI::BaseDevice *device : cameras)
        printf("Camera Name: %s\n", device->getDeviceName());
}

This doesn't return any mounts or cameras. However, if I wait a second of so after connecting and make the getDevices() calls, then it works. But it is unclear how long I need to wait for the info be be valid.

How am I supposed to accomplish what I need?

Read More...