Device Discovery

Finding your remote device. More...

Functions

kvrStatus kvrDiscoveryGetDefaultAddresses (kvrAddress address_list[], uint32_t address_list_size, uint32_t *address_list_count, uint32_t address_type_flags)
 
kvrStatus kvrDiscoveryOpen (kvrDiscoveryHandle *handle)
 
kvrStatus kvrDiscoveryClose (kvrDiscoveryHandle handle)
 
kvrStatus kvrDiscoverySetAddresses (kvrDiscoveryHandle handle, const kvrAddress address_list[], uint32_t address_list_size)
 
kvrStatus kvrDiscoveryStart (kvrDiscoveryHandle handle, uint32_t delay_ms, uint32_t timeout_ms)
 
kvrStatus kvrDiscoveryStartEx (kvrDiscoveryHandle handle, uint32_t delay_ms, uint32_t timeout_ms, int add_stored)
 
kvrStatus kvrDiscoveryGetResults (kvrDiscoveryHandle handle, kvrDeviceInfo *device_info)
 
kvrStatus kvrDiscoveryStoreDevices (const kvrDeviceInfo device_info_list[], uint32_t device_info_list_size)
 
kvrStatus kvrDiscoveryClearDevicesAtExit (int onoff)
 
kvrStatus kvrDiscoverySetPassword (kvrDeviceInfo *device_info, const char *password)
 
kvrStatus kvrDiscoverySetEncryptionKey (kvrDeviceInfo *device_info, const char *key)
 
kvrStatus kvrDeviceGetServiceStatusText (const kvrDeviceInfo *device_info, char *buffer, uint32_t buffer_size)
 
kvrStatus kvrDeviceGetServiceStatus (const kvrDeviceInfo *device_info, int32_t *state, int32_t *start_info)
 

Detailed Description

Finding your remote device.

Function Documentation

◆ kvrDeviceGetServiceStatus()

kvrStatus kvrDeviceGetServiceStatus ( const kvrDeviceInfo device_info,
int32_t *  state,
int32_t *  start_info 
)

Returns local connection status of the selected device.

Parameters
[in]device_infoThe device to request the status information from.
[out]stateThe service state as a kvrServiceState_xxx
[out]start_infoThe start information as a kvrStartInfo_xxx
Returns
kvrOK on success or any other kvrStatus on failure.
Examples:
example/c/kvrConnect.c.

◆ kvrDeviceGetServiceStatusText()

kvrStatus kvrDeviceGetServiceStatusText ( const kvrDeviceInfo device_info,
char *  buffer,
uint32_t  buffer_size 
)

Returns local connection status of the selected device as ASCII text.

Parameters
[in]device_infoThe device to request the status information from.
[out]bufferThe service status as a C string.
[in]buffer_sizeThe service status buffer size.
Returns
kvrOK on success or any other kvrStatus on failure.
Examples:
example/c/kvrConnect.c.

◆ kvrDiscoveryClearDevicesAtExit()

kvrStatus kvrDiscoveryClearDevicesAtExit ( int  onoff)

Turn automatic clearing of the stored devices on/off.

Parameters
[in]onoffTurn auto-clear on/off. TRUE: Stored devices will be cleared automatically when the application exits, even if the application terminates abnormally. FALSE: Stored devices will be stored until removed.
Returns
kvrOK on success or any other kvrStatus on failure.

◆ kvrDiscoveryClose()

kvrStatus kvrDiscoveryClose ( kvrDiscoveryHandle  handle)

Closes the discovery handle opened with kvrDiscoveryOpen().

Parameters
[in]handleDiscovery handle.
Returns
kvrOK on success or any other kvrStatus on failure.
Examples:
example/c/kvrConnect.c.

◆ kvrDiscoveryGetDefaultAddresses()

kvrStatus kvrDiscoveryGetDefaultAddresses ( kvrAddress  address_list[],
uint32_t  address_list_size,
uint32_t *  address_list_count,
uint32_t  address_type_flags 
)

Read out the list of default broadcast addresses. If address_type_flags is set to kvrAddressTypeFlag_ALL the returned list will contain all found addresses (both broadcast addresses and earlier stored addresses).

Parameters
[out]address_listAn array of addresses.
[in]address_list_sizeNumber of entries in address_list.
[out]address_list_countNumber of addresses returned.
[in]address_type_flagsWhich kvrAddressTypeFlag_xxx types of addresses to return
Returns
kvrOK on success or any other kvrStatus on failure.
Examples:
example/c/kvrConnect.c.

◆ kvrDiscoveryGetResults()

kvrStatus kvrDiscoveryGetResults ( kvrDiscoveryHandle  handle,
kvrDeviceInfo device_info 
)

Call this after calling kvrDiscoveryStart(). The first call will return the first result, second call will return the second etc. Will return found devices until kvrERR_BLANK is returned.

Parameters
[in]handleDiscovery handle.
[out]device_infoDevice info.
Returns
kvrOK on success or any other kvrStatus on failure.
Examples:
example/c/kvrConnect.c.

◆ kvrDiscoveryOpen()

kvrStatus kvrDiscoveryOpen ( kvrDiscoveryHandle handle)

Create a handle for device discovery. Used by for instance kvrDiscoveryStart(). Close with kvrDiscoveryClose().

Parameters
[out]handleDiscovery handle.
Returns
kvrOK on success or any other kvrStatus on failure.
Examples:
example/c/kvrConnect.c.

◆ kvrDiscoverySetAddresses()

kvrStatus kvrDiscoverySetAddresses ( kvrDiscoveryHandle  handle,
const kvrAddress  address_list[],
uint32_t  address_list_size 
)

Set a list of addresses to use for discovery (overwrites any existing addresses). Setting address_list_size with size = 0 will cause kvrDiscoveryStart() to only return stored devices (no network traffic).

Parameters
[in]handleDiscovery handle.
[in]address_listAn array of addresses.
[in]address_list_sizeNumber of entries in address_list.
Returns
kvrOK on success or any other kvrStatus on failure.
Examples:
example/c/kvrConnect.c.

◆ kvrDiscoverySetEncryptionKey()

kvrStatus kvrDiscoverySetEncryptionKey ( kvrDeviceInfo device_info,
const char *  key 
)

Sets the encryption key to use when encrypting communication.

Parameters
[in]device_infoThe device to set the password for.
[in]keyThe key as a C string.
Returns
kvrOK on success or any other kvrStatus on failure.

◆ kvrDiscoverySetPassword()

kvrStatus kvrDiscoverySetPassword ( kvrDeviceInfo device_info,
const char *  password 
)

Sets the accessibility password to use when connecting to a device.

Parameters
[in]device_infoThe device to set the password for.
[in]passwordThe password as a C string.
Returns
kvrOK on success or any other kvrStatus on failure.
Examples:
example/c/kvrConnect.c.

◆ kvrDiscoveryStart()

kvrStatus kvrDiscoveryStart ( kvrDiscoveryHandle  handle,
uint32_t  delay_ms,
uint32_t  timeout_ms 
)

Start discovering devices on the addresses previously specified with kvrDiscoverySetAddresses(). A delay of delay_ms ms is inferred between each device address request. After the last device address is probed, one more delay of timeout_ms is added before returning.

This means that the function will return in (about) <address_list_size> * delay_ms + timeout_ms ms

The results can be retrieved using kvrDiscoveryGetResults(). A new call to kvrDiscoveryStart() will discard any results not yet retrieved by kvrDiscoveryGetResults().

To decide if an address is a broadcast address, the ip address and subnet mask for all availible network cards are considered.

Beside returning the devices discovered by scan, it will also return any devices previously stored with kvrDiscoveryStoreDevices().

Note
A remote device with accessibility set to "private" will not reply to a broadcast scan.
Parameters
[in]handleDiscovery handle.
[in]delay_msDelay (in ms) in between sending discovery messages to addresses in the address list.
[in]timeout_msStop waiting for device discovery after timeout_ms milliseconds.
Returns
kvrOK on success or any other kvrStatus on failure.
Examples:
example/c/kvrConnect.c.

◆ kvrDiscoveryStartEx()

kvrStatus kvrDiscoveryStartEx ( kvrDiscoveryHandle  handle,
uint32_t  delay_ms,
uint32_t  timeout_ms,
int  add_stored 
)

An extension of kvrDiscoveryStart() that allows to skip devices, which were previously stored by kvrDiscoveryStoreDevices(). If user specifies parameter show_stored as "true", subsequent kvrDiscoveryGetResults() calls will report only those devices that responded to the scan.

Note
A remote device with accessibility set to "private" will not reply to a broadcast scan.
If stored devices are ignored, information about them will be unrecoverable after subsequent call to kvrDiscoveryStoreDevices()
Parameters
[in]handleDiscovery handle.
[in]delay_msDelay (in ms) in between sending discovery messages to addresses in the address list.
[in]timeout_msStop waiting for device discovery after timeout_ms milliseconds.
[in]add_storedAn indication whether stored devices are to be discovered. TRUE: kvrDiscoveryGetResults() will report stored devices. FALSE: kvrDiscoveryGetResults() will not find stored devices.
Returns
kvrOK on success or any other kvrStatus on failure.

◆ kvrDiscoveryStoreDevices()

kvrStatus kvrDiscoveryStoreDevices ( const kvrDeviceInfo  device_info_list[],
uint32_t  device_info_list_size 
)

Store a list of devices that can be discovered later.

Parameters
[in]device_info_listA list of devices to remember.
[in]device_info_list_sizeThe number of elements in device_info_list.
Returns
kvrOK on success or any other kvrStatus on failure.
Examples:
example/c/kvrConnect.c.