What requestCapture() sets up for you

Capturing an image covers requestCapture() itself. This page is about something that comes bundled with it for free, with nothing to call: a generic exposure progress bar and timeout watchdog, shared by every imager module instead of each one hand-rolling its own.

captureprogress: created lazily, on the first capture

The first time requestCapture() runs on a given module, it creates a dedicated captureprogress property if one doesn’t exist yet — same lazy-creation style as Creating properties dynamically:

// libs/indimodule.cpp, requestCapture()
// Issue #276: shared exposure progress, generic across every imager
// module instead of each one hand-rolling its own (Sequencer still
// keeps its own sequence-wide one on top of this, see newExp()). Its
// own property, not an element on "image" - that one also carries
// the actual jpeg, and the frontend reloads the image on every
// update to the property it belongs to, so a per-frame progress tick
// was making the preview flicker on every update.
if (!getStore().contains("captureprogress"))
{
    OST::PropertyMulti* dynprop = new OST::PropertyMulti("captureprogress", "Capture progress", OST::ReadOnly,
            "Control", "", "000Control2225", false, false);
    createProperty(dynprop);
}

It’s a property of its own specifically so it’s not an element on image — the comment explains why: the frontend reloads the preview on every update to whatever property carries it, so ticking progress on the same property as the jpeg itself would make the preview flicker on every tick.

The watchdog: CCD_EXPOSURE for progress, CCD1 to clear it, a timer in between

Entirely driven from IndiModule::updateProperty() — CCD_EXPOSURE’s own value drives exposureprogress’s percentage and label while an exposure is outstanding; CCD1 (the image BLOB arriving) stops the timer and resets to idle; if neither happens before exposure time plus a 5-second margin, the timer fires a timeout that reports an error and resets the bar:

// libs/indimodule.cpp
// Issue #276 - CCD1 never arrived within exposure duration + 5s margin.
void IndiModule::onCaptureTimeout()
{
    logError("%1 - exposure timeout on %2", {QString("requestCapture"), mCaptureDeviceName});
    getEltPrg("captureprogress", "exposureprogress")->setPrgValue(0.0, false);
    getEltPrg("captureprogress", "exposureprogress")->setDynLabel("Timeout", true);
    setStateEvent(OST::Error, "timeout", "capturetimeout", "exposure timeout");
}

None of this — onCaptureTimeout(), abortCapture(), formatCaptureDuration() — is callable by a module: all three are private. There is genuinely nothing to call here; the only thing a module author needs to know is the one way to accidentally lose it.

The one way to lose it: overriding updateProperty() without chaining up

The device picker and standard INDI vectors already flags updateProperty() as the one callback a module overrides directly (instead of onUpdateProperty()) when it needs earlier access — a BLOB capture being the main case. Forgetting to chain up loses the devices.* LOV refresh and this watchdog, since both live in the same base method. Dofassistant spells out both reasons at once, right where it overrides it:

// src/modules/dofassistant/dofassistant.cpp
void Dofassistant::updateProperty(INDI::Property property)
{
    // Chain up: IndiModule::updateProperty() refreshes devices.*'s own LOV
    // on a CONNECTION change, and runs the shared captureprogress/timeout
    // watchdog (issue #276) - skipping this silently loses both.
    IndiModule::updateProperty(property);
    ...