How to use the onvif client library API to automatically discover devices?
Automatically discover devices using the code example below:
// 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);
// set probe callback
set_probe_cb(probeCallback, 0);
// start probe thread
start_probe(NULL, 30);
// You can specify the IP used to discover the device with the first parameter.
// Passing NULL means discovering devices on the default routed network interface
// The second parameter indicates the interval at which the sending device probe packet.
The probeCallback callback function is defined as follows:
void probeCallback(DEVICE_BINFO * p_res, void * p_data);
The first parameter is the discovered device basic information.
The second argument is the second argument passed to the set_probe_cb function.