How to use the onvif client library API event subscription?

Manually add devices using the code example below:

// Define an ONVIF_DEVICE variable
ONVIF_DEVICE g_device;

// open log file
log_init("log.txt");
log_set_level(LOG_DBG);

// init system buffer
sys_buf_init(10 * MAX_DEV_NUMS);

// init http message buffer
http_msg_buf_init(10 * MAX_DEV_NUMS);

// init event handler
// bind the http server to 0.0.0.0:30100
onvif_event_init(0, 30100, MAX_DEV_NUMS);

// set event callback
onvif_set_event_notify_cb(eventNotifyCallback, 0);

// set event subscribe disconnect callback
onvif_set_subscribe_disconnect_cb(subscribeDisconnectCallback, 0);

// init g_device
memset(&g_device, 0, sizeof(g_device));

g_device.binfo.XAddr.https = 0; // If using an HTTPS connection, set it to 1
g_device.binfo.XAddr.port = 8000; // Specify the ONVIF service port of the device
strcpy(g_device.binfo.XAddr.host, "192.168.1.3"); // Specify the IP address of the device
strcpy(g_device.binfo.XAddr.url, "/onvif/device_service");

// set device login information
onvif_SetAuthInfo(&g_device, "admin", "admin");
// set auth method
onvif_SetAuthMethod(&g_device, AuthMethod_UsernameToken);
// set request timeout
onvif_SetReqTimeout(&g_device, 5000);

// Next you can call other API interfaces.

if (!GetSystemDateAndTime(&g_device))
{
    printf("%s, GetSystemDateAndTime failed\r\n", g_device.binfo.XAddr.host);
}

if (!GetCapabilities(&g_device))
{
    printf("%s, GetCapabilities failed\r\n", g_device.binfo.XAddr.host);
}

if (!GetServices(&g_device))
{
    printf("%s, GetServices failed\r\n", g_device.binfo.XAddr.host);
}

if (!GetDeviceInformation(&g_device))
{
    printf("%s, GetDeviceInformation failed\r\n", g_device.binfo.XAddr.host);
}

// Device supports ONVIF event service
if (g_device.Capabilities.events.support == 1)
{
    if (Subscribe(&g_device, getDeviceIndex(&g_device)))
    {
        printf("Subscribe successful!\r\n");
    }
    else
    {
        printf("Subscribe failed!\r\n");
    }
}

The eventNotifyCallback callback function is defined as follows:

void eventNotifyCallback(Notify_REQ * p_req, void * p_data);

The subscribeDisconnectCallback callback function is defined as follows

void subscribeDisconnectCallback(ONVIF_DEVICE * p_dev, void * p_data)