.. _manual_tp_popup_response: tp_popup_response (Manual Mode) ------------------------------------------ This section explains how to use :ref:`tp_popup_response ` during **Manual (Teach)** operations. This function sends a response (POPUP_RESPONSE_RESUME or POPUP_RESPONSE_STOP) to a popup raised by a DRL program, which then resumes or stops. It allows the host application to remotely acknowledge or reject operator prompts. **Typical usage** - Automatically confirm or cancel popup prompts in specific teaching workflows. - Integrate TP prompts with external UIs or safety validation systems. - Use in combination with :ref:`set_on_tp_popup ` to manage two-way popup interaction. - Implement custom popup policies (e.g., auto-approve safe operations, require manual confirmation for high-risk ones). .. Note:: - Can only be called **after** the TP popup callback (:ref:`set_on_tp_popup `) has been triggered. **Example: Send popup response based on custom logic** .. code-block:: cpp // Popup callback: triggered when popup appears on TP void OnTpPopup(LPMESSAGE_POPUP tPopup) { printf("-------------------------------------------\n"); printf("[TP POPUP RECEIVED]\n"); printf("Message : %s\n", tPopup->_szText); printf("Level : %d\n", tPopup->_iLevel); printf("Button Type : %d\n", tPopup->_iBtnType); printf("-------------------------------------------\n"); // Example 1: Auto-approve if it's an information popup if (tPopup->_iLevel == MESSAGE_LEVEL_INFO && strstr(tPopup->_szText, "Continue") != nullptr) { drfl.tp_popup_response(POPUP_RESPONSE_RESUME); printf("[Host] RESUME sent to controller.\n"); } // Example 2: Stop if an alarm popup appears else if (tPopup->_iLevel == MESSAGE_LEVEL_ALARM) { drfl.tp_popup_response(POPUP_RESPONSE_STOP); printf("[Host] Alarm detected. Sent STOP response.\n"); } else { printf("[Host] Waiting for manual confirmation on TP.\n"); } } // Preconditions: // - drfl.open_connection("192.168.137.100"); // - Controller in Manual (Teach) mode drfl.set_on_tp_popup(OnTpPopup); printf("[Teach] Popup callback active. Ready to respond automatically.\n"); // Keep program running to receive TP popup events while (true) std::this_thread::sleep_for(std::chrono::seconds(1)); In this example, the host PC listens for **popup events** from the Teach Pendant (TP) and sends an automatic response based on popup level or content. For instance, information popups are answered with POPUP_RESPONSE_RESUME, alarm popups with POPUP_RESPONSE_STOP. This enables the host to **automate response handling** while still respecting safety-critical interactions. **Tips** - Always verify the popup **message level** before sending an automatic response. - For **critical operations** (e.g., tool change, safety override), require manual confirmation on the TP. - When testing DRL programs remotely, this function can help simulate **operator confirmation flows**. - Combine with :ref:`set_on_tp_get_user_input ` for integrated dialog-driven Manual mode automation.