# Get thermal autoshutdown mode updates

This sample app demonstrates how to get thermal autoshutdown mode updates.

1. Implement IThermalShutdownListener interface

class MyThermalShutdownModeListener : public IThermalShutdownListener {
    public:
        void onShutdownEnabled() override;
        void onShutdownDisabled() override;
        void onImminentShutdownEnablement(uint32_t imminentDuration) override;
        void onServiceStatusChange(ServiceStatus status) override;
    };
    Copy to clipboard

2. Get thermal factory instance

auto &thermalFactory = telux::therm::ThermalFactory::getInstance();
    Copy to clipboard

3. Prepare initialization callback

std::promise<telux::common::ServiceStatus> p;
    auto initCb = [&p](telux::common::ServiceStatus status) {
         std::cout << "Received service status: " << static_cast<int>(status) << std::endl;
         p.set_value(status);
    };
    Copy to clipboard

4. Get thermal shutdown manager instance

thermShutdownMgr_ = thermalFactory.getThermalShutdownManager(initCb);
    if(thermShutdownMgr_ == NULL)
    {
        std::cout << APP_NAME << " *** ERROR - Failed to get manager instance" << std::endl;
        return -1;
    }
    Copy to clipboard

5. Wait for the initialization callback and check the service status

telux::common::ServiceStatus serviceStatus = p.get_future().get();
    if(serviceStatus == telux::common::ServiceStatus::SERVICE_AVAILABLE) {
       std::cout << APP_NAME << " Thermal-Shutdown management services are ready !" << std::endl;
    } else {
       std::cout << APP_NAME << " *** ERROR - Unable to initialize Thermal-Shutdown management "
                                "services" << std::endl;
       return -1;
    }
    Copy to clipboard

6. Instantiate MyThermalStateListener

auto myThermalModeListener = std::make_shared<MyThermalShutdownModeListener>();
    Copy to clipboard

7. Register for updates on thermal autoshutdown mode and its management service status

thermShutdownMgr_->registerListener(myThermalModeListener);
    Copy to clipboard

8. Wait for the Thermal auto shutdown mode updates

// Avoid long blocking calls when handling notifications
    void MyThermalShutdownModeListener::onShutdownEnabled() {
         std::cout << std::endl << "**** Thermal auto shutdown mode enabled ****" << std::endl;
    }
    void MyThermalShutdownModeListener::onShutdownDisabled() {
         std::cout << std::endl << "**** Thermal auto shutdown mode disabled ****" << std::endl;
    }
    void MyThermalShutdownModeListener::onImminentShutdownEnablement(uint32_t imminentDuration) {
         std::cout << std::endl << "**** Thermal auto shutdown mode will be enabled in "
             << imminentDuration << " seconds ****" << std::endl;
    }
    Copy to clipboard

9. Implement onServiceStatusChange callback to know when thermal shutdown management service goes down

// When the thermal management service goes down, this API is invoked
    // with status UNAVAILABLE. All thermal auto shutdown mode notifications
    // stopped until the status becomes AVAILABLE again.
    void MyThermalShutdownModeListener::onServiceStatusChange(ServiceStatus status) {
         std::cout << std::endl << "**** Thermal-Shutdown management service status update ****" << std::endl;
         // Avoid long blocking calls when handling notifications
    }
    Copy to clipboard

Last Published: Apr 14, 2026

[Previous Topic
Get thermal zones, cooling devices and thermal notifications](https://docs.qualcomm.com/bundle/publicresource/80-PF458-1/topics/thermal_manager.md) [Next Topic
Get/Set autoshutdown modes](https://docs.qualcomm.com/bundle/publicresource/80-PF458-1/topics/send_thermal_shutdown_mode_commands.md)