You're reading the documentation for an older, but still supported version (1.33.4).
For information on the latest version, please have a look at 1.33.5.

TOnTpGetUserInputCB

This callback is triggered when a DRL program requests user input with tp_get_user_input. The application shows the prompt and answers with tp_get_user_input_response.

See Rules for callback functions.

Defined in: DRFLEx.h

// typedef (DRFLEx.h)
typedef void (*TOnTpGetUserInputCB)(LPMESSAGE_INPUT);

// registration API (internal + wrapper)
DRFL_API void _set_on_tp_get_user_input(LPROBOTCONTROL pCtrl, TOnTpGetUserInputCB pCallbackFunc);

// user input message handler
void set_on_tp_get_user_input(TOnTpGetUserInputCB pCallbackFunc)
{
    _set_on_tp_get_user_input(_rbtCtrl, pCallbackFunc);
};

Parameter

Parameter Name

Data Type

Default Value

Description

tInput

MESSAGE_INPUT

Pointer to the input request: _szText is the prompt and _iType the expected type (0: int, 1: float, 2: string, 3: bool).

Return
None

Example

#include "DRFLEx.h"
#include <iostream>
#include <thread>
#include <chrono>
using namespace DRAFramework;
using namespace std;

// Callback triggered when a DRL program requests user input
void OnTpGetUserInputCB(LPMESSAGE_INPUT tInput)
{
    if (!tInput) return;

    cout << "[TP USER INPUT]" << endl;
    cout << "Prompt : " << tInput->_szText << endl;
    cout << "Type   : " << static_cast<int>(tInput->_iType) << endl;

    // Send the answer with tp_get_user_input_response()
}

int main()
{
    CDRFLEx drfl;

    // Connect to robot controller
    if (!drfl.open_connection("192.168.137.100")) {
        cout << "Failed to connect to controller." << endl;
        return -1;
    }

    // Register TP user input callback
    drfl.set_on_tp_get_user_input(OnTpGetUserInputCB);

    // Keep alive to monitor TP user inputs
    while (true)
        std::this_thread::sleep_for(std::chrono::seconds(1));

    drfl.close_connection();
    return 0;
}

Notes

  • Triggered when a DRL program calls tp_get_user_input. The callback receives the request, not the answer.

  • The MESSAGE_INPUT structure contains the prompt (_szText) and the expected input type (_iType).

  • Common use cases: operator prompts, manual confirmations, or parameter entry during DRL program execution.