kvrlib.h File Reference
Library for interacting with remote devices. (Currently Windows only) More...
#include <windows.h>#include <stdint.h>Go to the source code of this file.
Data Structures | |
| struct | kvrAddress |
| struct | kvrCipherInfoElement |
| struct | kvrDeviceInfo |
| Holds information about a discovered device. More... | |
Typedefs | |
| typedef int32_t | kvrConfigHandle |
| typedef int32_t | kvrRssiHistory |
| typedef uint32_t | kvrRttHistory |
| typedef int32_t | kvrDiscoveryHandle |
Enumerations | |
| enum | kvrStatus { kvrOK = 0, kvrERR_NOT_INITIALIZED = -1, kvrERR_GENERIC = -2, kvrERR_CHECKSUM = -3, kvrERR_PARAMETER = -4, kvrERR_PASSWORD = -5, kvrERR_BLANK = -6, kvrERR_NO_DEVICE = -7, kvrERR_NO_ANSWER = -8, kvrERR_NOT_IMPLEMENTED = -9, kvrERR_PERMISSION_DENIED = -10, kvrERR_OUT_OF_SPACE = -11, kvrERR_NO_SERVICE = -12, kvrERR_DUPLICATED_DEVICE = -13, kvrERR_XML_VALIDATION = -14, kvrERR_BUFFER_TOO_SMALL = -15 } |
Functions | |
| kvrStatus | kvrConfigOpen (int32_t can_channel_no, int32_t mode, const char *password, kvrConfigHandle *handle) |
| kvrStatus | kvrConfigActiveProfileSet (int32_t can_channel_no, int32_t profile_number) |
| kvrStatus | kvrConfigActiveProfileGet (int32_t can_channel_no, int32_t *profile_number) |
| kvrStatus | kvrConfigNoProfilesGet (int32_t can_channel_no, int32_t *no_profiles) |
| kvrStatus | kvrConfigOpenEx (int32_t can_channel_no, int32_t mode, const char *password, kvrConfigHandle *handle, uint32_t profile_no) |
| void | kvrConfigClose (kvrConfigHandle handle) |
| kvrStatus | kvrConfigVerifyXml (const char *xml_buffer, char *err_buffer, uint32_t err_buffer_size) |
| kvrStatus | kvrConfigSet (kvrConfigHandle handle, const char *xml_buffer) |
| kvrStatus | kvrConfigGet (kvrConfigHandle handle, char *xml_buffer, uint32_t xml_buffer_size) |
| kvrStatus | kvrConfigInfoGet (int32_t can_channel_no, int32_t profile_no, char *xml_buffer, uint32_t xml_buffer_size) |
| kvrStatus | kvrConfigClear (kvrConfigHandle handle) |
| kvrStatus | kvrNetworkConnectionTest (kvrConfigHandle handle, int32_t active) |
| kvrStatus | kvrNetworkGetRssiRtt (kvrConfigHandle handle, kvrRssiHistory *rssi, uint32_t rssi_size, uint32_t *rssi_count, kvrRttHistory *rtt, uint32_t rtt_size, uint32_t *rtt_count) |
| kvrStatus | kvrWlanStartScan (kvrConfigHandle handle, int32_t active, int32_t bss_type, int32_t domain) |
| kvrStatus | kvrWlanGetScanResults (kvrConfigHandle handle, int32_t *rssi, int32_t *channel, kvrAddress *mac, int32_t *bss_type, char *ssid, uint32_t *capability, uint32_t *type_wpa, kvrCipherInfoElement *wpa_info, kvrCipherInfoElement *rsn_info) |
| kvrStatus | kvrNetworkGetHostName (kvrConfigHandle handle, char *buffer, uint32_t buffer_size) |
| kvrStatus | kvrHostName (uint32_t ean_hi, uint32_t ean_lo, uint32_t ser_no, char *buffer, uint32_t buffer_size) |
| kvrStatus | kvrNetworkGetConnectionStatus (kvrConfigHandle handle, int32_t *state, int32_t *tx_rate, int32_t *rx_rate, int32_t *channel, int32_t *rssi, int32_t *tx_power) |
| kvrStatus | kvrNetworkGetAddressInfo (kvrConfigHandle handle, kvrAddress *address1, kvrAddress *address2, kvrAddress *netmask, kvrAddress *gateway, int32_t *dhcp) |
| 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) |
| kvrStatus | kvrGetErrorText (kvrStatus error, char *buffer, uint32_t buffer_size) |
| uint16_t | kvrGetVersion (void) |
| kvrStatus | kvrStringFromAddress (char *buffer, uint32_t buffer_size, const kvrAddress *address) |
| kvrStatus | kvrAddressFromString (int32_t address_type, kvrAddress *address, const char *address_string) |
| kvrStatus | kvrWlanGetSecurityText (char *security_string, uint32_t security_string_size, uint32_t capability, uint32_t type_wpa, const kvrCipherInfoElement *wpa_info, const kvrCipherInfoElement *rsn_info) |
| kvrStatus | kvrNetworkGenerateWepKeys (const char *pass_phrase, char *key64_1, char *key64_2, char *key64_3, char *key64_4, char *key128) |
| kvrStatus | kvrNetworkGenerateWpaKeys (const char *pass_phrase, const char *ssid, char *key) |
| void | kvrInitializeLibrary (void) |
| void | kvrUnloadLibrary (void) |
| kvrStatus | kvrServiceQuery (int *status) |
| kvrStatus | kvrServiceStart (int *status) |
| kvrStatus | kvrServiceStop (int *status) |
Detailed Description
Library for interacting with remote devices. (Currently Windows only)
Data Structure Documentation
kvrAddress
| struct kvrAddress |
Device address.
- Examples:
- example/c/kvrConfig.c, and example/c/kvrConnect.c.
| Data Fields | ||
|---|---|---|
| uint8_t | address[20] |
IP or MAC address. |
| uint32_t | type | |
kvrCipherInfoElement
| struct kvrCipherInfoElement |
Capability of a WLAN AP. These are values from the standard 802.11 beacon.
To convert the security information into a more human readable form, use kvrWlanGetSecurityText().
- Examples:
- example/c/kvrConfig.c.
kvrDeviceInfo
| struct kvrDeviceInfo |
Holds information about a discovered device.
The information in here is returned when a device is discovered. For a WLAN connected device, device_address and client_address are IP addresses, and base_station_id is the ethernet MAC address of the AP.
Depending on the "availability" flag, not all fields may be used. If "availability" includes the flag kvrAvailability_STORED the following fields are set: ean_hi, ean_lo, ser_no, device_address, request_connection, name and accessibility_pwd.
If the field "availability" includes the flag kvrAvailability_FOUND_BY_SCAN, the following fields are set: fw_major_ver, fw_minor_ver, fw_build_ver, usage, accessibility, host_name and client_address.
- Examples:
- example/c/kvrConnect.c.
| Data Fields | ||
|---|---|---|
| int32_t | accessibility | |
| char | accessibility_pwd[256] |
Accessibility password or empty. |
| int32_t | availability |
The device availability. One or more kvrAvailability_xxx flags. |
| kvrAddress | base_station_id |
Unique ID of base station, if any. |
| kvrAddress | client_address |
Address of connected client, if any. |
| kvrAddress | device_address |
Address of remote device. |
| uint32_t | ean_hi |
High part of EAN. |
| uint32_t | ean_lo |
Low part of EAN. |
| char | encryption_key[32] |
Encryption key. |
| int32_t | fw_build_ver |
Firmware build version. |
| int32_t | fw_major_ver |
Major firmware version. |
| int32_t | fw_minor_ver |
Minor firmware version. |
| char | host_name[256] |
DNS hostname or empty. |
| char | name[256] |
User-defined name. |
| int32_t | request_connection |
Activate or deactivate a request for connection to a specified device. Activation means that the device will be connected to when it appears in the future. |
| char | reserved1[256] | |
| char | reserved2[256] | |
| uint32_t | ser_no |
Serial number. |
| uint32_t | struct_size |
Size of struct, used for compatibility. |
| int32_t | usage | |
Macro Definition Documentation
kvrAccessibility_PRIVATE
| #define kvrAccessibility_PRIVATE 3 |
Private (invisible, password needed to connect).
kvrAccessibility_PROTECTED
| #define kvrAccessibility_PROTECTED 2 |
Protected (visible for all, password needed to connect).
kvrAccessibility_PUBLIC
| #define kvrAccessibility_PUBLIC 1 |
Public (visible for all, no password required to connect).
kvrAccessibility_UNKNOWN
| #define kvrAccessibility_UNKNOWN 0 |
Unknown (e.g., no reply from device).
kvrAddressType_IPV4
| #define kvrAddressType_IPV4 1 |
IP v.4 address.
- Examples:
- example/c/kvrConnect.c.
kvrAddressType_IPV4_PORT
| #define kvrAddressType_IPV4_PORT 3 |
IP v.4 address with tcp-port.
kvrAddressType_IPV6
| #define kvrAddressType_IPV6 2 |
IP v.6 address.
kvrAddressType_MAC
| #define kvrAddressType_MAC 4 |
Ethernet MAC address.
kvrAddressType_UNKNOWN
| #define kvrAddressType_UNKNOWN 0 |
Unknown (e.g., no reply from device).
kvrAddressTypeFlag_ALL
| #define kvrAddressTypeFlag_ALL 0xff |
All defined below
- Examples:
- example/c/kvrConnect.c.
kvrAddressTypeFlag_BROADCAST
| #define kvrAddressTypeFlag_BROADCAST 0x01 |
Broadcast addresses
kvrAddressTypeFlag_STORED
| #define kvrAddressTypeFlag_STORED 0x02 |
Previously stored addresses
kvrAvailability_FOUND_BY_SCAN
| #define kvrAvailability_FOUND_BY_SCAN 1 |
Device was found by scan.
- Examples:
- example/c/kvrConnect.c.
kvrAvailability_NONE
| #define kvrAvailability_NONE 0 |
Manually added.
kvrAvailability_STORED
| #define kvrAvailability_STORED 2 |
Device was stored.
- Examples:
- example/c/kvrConnect.c.
kvrBss_ANY
| #define kvrBss_ANY 2 |
Any.
- Examples:
- example/c/kvrConfig.c.
kvrBss_INDEPENDENT
| #define kvrBss_INDEPENDENT 1 |
Ad-hoc network.
kvrBss_INFRASTRUCTURE
| #define kvrBss_INFRASTRUCTURE 0 |
Network with AP.
kvrConfigMode_ERASE
| #define kvrConfigMode_ERASE 2 |
Erase and write.
kvrConfigMode_R
| #define kvrConfigMode_R 0 |
Read only.
- Examples:
- example/c/kvrConfig.c, and example/c/kvrNetworkConnectionTest.c.
kvrConfigMode_RW
| #define kvrConfigMode_RW 1 |
Read/write.
- Examples:
- example/c/kvrConfig.c.
kvrDeviceUsage_CONFIG
| #define kvrDeviceUsage_CONFIG 4 |
Device is being configured via USB.
- Examples:
- example/c/kvrConnect.c.
kvrDeviceUsage_FREE
| #define kvrDeviceUsage_FREE 1 |
Not in use.
- Examples:
- example/c/kvrConnect.c.
kvrDeviceUsage_REMOTE
| #define kvrDeviceUsage_REMOTE 2 |
Connected to a PC (as a remote device).
- Examples:
- example/c/kvrConnect.c.
kvrDeviceUsage_UNKNOWN
| #define kvrDeviceUsage_UNKNOWN 0 |
Unknown (e.g., no reply from device).
- Examples:
- example/c/kvrConnect.c.
kvrDeviceUsage_USB
| #define kvrDeviceUsage_USB 3 |
Connected via USB cable.
- Examples:
- example/c/kvrConnect.c.
kvrNetworkState_AUTHENTICATING
| #define kvrNetworkState_AUTHENTICATING 8 |
EAPOL handshake ongoing.
kvrNetworkState_AUTHENTICATION_FAILED
| #define kvrNetworkState_AUTHENTICATION_FAILED 9 |
Authentication have failed.
kvrNetworkState_CONNECTED
| #define kvrNetworkState_CONNECTED 7 |
Network is reached.
kvrNetworkState_CONNECTING
| #define kvrNetworkState_CONNECTING 6 |
Waiting for connections (ad-hoc).
kvrNetworkState_CONNECTION_DELAY
| #define kvrNetworkState_CONNECTION_DELAY 5 |
Delay during connection (ad-hoc).
kvrNetworkState_FAILED_MIC
| #define kvrNetworkState_FAILED_MIC 11 |
MIC verification (EAPOL-key) failed.
kvrNetworkState_INITIALIZING
| #define kvrNetworkState_INITIALIZING 3 |
Started, waiting for initialization.
kvrNetworkState_INVALID
| #define kvrNetworkState_INVALID 1 |
Network hardware has been disabled.
kvrNetworkState_NOT_CONNECTED
| #define kvrNetworkState_NOT_CONNECTED 4 |
No connection (may auto-connect).
kvrNetworkState_ONLINE
| #define kvrNetworkState_ONLINE 10 |
Authentication completed.
kvrNetworkState_STARTUP
| #define kvrNetworkState_STARTUP 2 |
Configuring network hardware.
kvrNetworkState_UNKNOWN
| #define kvrNetworkState_UNKNOWN 0 |
Bad state, should never be reported.
kvrRegulatoryDomain_CHINA_MII
| #define kvrRegulatoryDomain_CHINA_MII 4 |
MII
kvrRegulatoryDomain_EUROPE_ETSI
| #define kvrRegulatoryDomain_EUROPE_ETSI 1 |
ETSI
kvrRegulatoryDomain_JAPAN_TELEC
| #define kvrRegulatoryDomain_JAPAN_TELEC 0 |
TELEC
kvrRegulatoryDomain_NORTH_AMERICA_FCC
| #define kvrRegulatoryDomain_NORTH_AMERICA_FCC 2 |
FCC
kvrRegulatoryDomain_WORLD
| #define kvrRegulatoryDomain_WORLD 3 |
WORLD
- Examples:
- example/c/kvrConfig.c.
kvrRemoteState_AVAILABLE
| #define kvrRemoteState_AVAILABLE 1 |
Tries to ping known device.
kvrRemoteState_CLOSING
| #define kvrRemoteState_CLOSING 10 |
Will stop communication.
kvrRemoteState_CONFIG_CHANGED
| #define kvrRemoteState_CONFIG_CHANGED 13 |
Same as UNWILLING.
kvrRemoteState_CONNECTION_DOWN
| #define kvrRemoteState_CONNECTION_DOWN 5 |
Will try and restore connection.
kvrRemoteState_CONNECTION_UP
| #define kvrRemoteState_CONNECTION_UP 6 |
Device connected, heartbeat up.
kvrRemoteState_DISCOVERED
| #define kvrRemoteState_DISCOVERED 2 |
Currently not used.
kvrRemoteState_INSTALLING
| #define kvrRemoteState_INSTALLING 15 |
Driver installation is in progress.
kvrRemoteState_REDISCOVER
| #define kvrRemoteState_REDISCOVER 7 |
Trying to talk to device.
kvrRemoteState_REDISCOVER_PENDING
| #define kvrRemoteState_REDISCOVER_PENDING 9 |
Will do rediscover in a moment.
kvrRemoteState_REMOVE_ME
| #define kvrRemoteState_REMOVE_ME 11 |
Device removed, it will be stopped.
kvrRemoteState_STANDBY
| #define kvrRemoteState_STANDBY 12 |
Known device, but unused.
kvrRemoteState_STARTED
| #define kvrRemoteState_STARTED 4 |
Currently not used.
kvrRemoteState_STARTING
| #define kvrRemoteState_STARTING 3 |
Initializes for new device.
kvrRemoteState_STOPPING
| #define kvrRemoteState_STOPPING 14 |
Tries to stop device.
kvrRemoteState_UNWILLING
| #define kvrRemoteState_UNWILLING 8 |
Device turned down connection req.
kvrRemoteState_VOID
| #define kvrRemoteState_VOID 0 |
Marked as not in list.
kvrServiceState_AVAILABLE
| #define kvrServiceState_AVAILABLE 1 |
Device available
kvrServiceState_CLOSING
| #define kvrServiceState_CLOSING 10 |
Closing device
kvrServiceState_CONFIG_CHANGED
| #define kvrServiceState_CONFIG_CHANGED 13 |
Configuration has changed
kvrServiceState_CONNECTION_DOWN
| #define kvrServiceState_CONNECTION_DOWN 5 |
Connection is currently down
kvrServiceState_CONNECTION_UP
| #define kvrServiceState_CONNECTION_UP 6 |
Connection is corrently up. The device should be showing up in Kvaser Hardware and be ready to be used from CANlib.
kvrServiceState_DISCOVERED
| #define kvrServiceState_DISCOVERED 2 |
Device discovered
kvrServiceState_INSTALLING
| #define kvrServiceState_INSTALLING 15 |
Device is currently being installed
kvrServiceState_REDISCOVER
| #define kvrServiceState_REDISCOVER 7 |
We've lost the device - rediscover it
kvrServiceState_REDISCOVER_PENDING
| #define kvrServiceState_REDISCOVER_PENDING 9 |
Rediscover is pending
kvrServiceState_REMOVE_ME
| #define kvrServiceState_REMOVE_ME 11 |
Removing the device
kvrServiceState_STANDBY
| #define kvrServiceState_STANDBY 12 |
Standby, the service is not taking any actions against this device
kvrServiceState_STARTED
| #define kvrServiceState_STARTED 4 |
Device is started
kvrServiceState_STARTING
| #define kvrServiceState_STARTING 3 |
Device is starting, other devices may inhibit this device from being started at the moment (e.g. by installing).
kvrServiceState_STOPPING
| #define kvrServiceState_STOPPING 14 |
Stopping device
kvrServiceState_UNWILLING
| #define kvrServiceState_UNWILLING 8 |
Unwilling, see sub state for reason
kvrServiceState_VOID
| #define kvrServiceState_VOID 0 |
Void
kvrStartInfo_ERR_CONFIGURING
| #define kvrStartInfo_ERR_CONFIGURING 5 |
I'm being configured so won't start
kvrStartInfo_ERR_ENCRYPTION_PWD
| #define kvrStartInfo_ERR_ENCRYPTION_PWD 7 |
Wrong encryption password.
kvrStartInfo_ERR_IN_USE
| #define kvrStartInfo_ERR_IN_USE 2 |
Already connected to someone else
kvrStartInfo_ERR_NOTME
| #define kvrStartInfo_ERR_NOTME 4 |
This start is not for me
kvrStartInfo_ERR_PARAM
| #define kvrStartInfo_ERR_PARAM 6 |
Invalid parameters in QRV (non matching versions)
kvrStartInfo_ERR_PWD
| #define kvrStartInfo_ERR_PWD 3 |
Wrong connection pwd
kvrStartInfo_NONE
| #define kvrStartInfo_NONE 0 |
No information available
kvrStartInfo_START_OK
| #define kvrStartInfo_START_OK 1 |
Started OK
Typedef Documentation
kvrConfigHandle
| typedef int32_t kvrConfigHandle |
A configuration handle. Created by calling kvrConfigOpen() or kvrConfigOpenEx().
kvrDiscoveryHandle
| typedef int32_t kvrDiscoveryHandle |
Handle used for discovery.
kvrRssiHistory
| typedef int32_t kvrRssiHistory |
Receive Signal Strength Indicator (RSSI).
kvrRttHistory
| typedef uint32_t kvrRttHistory |
Round-trip delay time (RTT).
Enumeration Type Documentation
kvrStatus
| enum kvrStatus |
Return type of kvrlib functions.
Function Documentation
kvrInitializeLibrary()
| void kvrInitializeLibrary | ( | void | ) |
Initializes library stuff. Call this function before calling any other kvr function.
kvrServiceQuery()
| kvrStatus kvrServiceQuery | ( | int * | status | ) |
Queries the status of the helper service. The helper service is installed as a part of the driver package and is normally set to automatic start.
- Note
- This API call requires read access to the service.
- Parameters
-
[out] status Win32 status code on failure.
kvrServiceStart()
| kvrStatus kvrServiceStart | ( | int * | status | ) |
Starts the helper service. The helper service is installed as a part of the driver package and is normally set to automatic start.
- Note
- This API call requires control access to the service.
- Parameters
-
[out] status Win32 status code on failure.
kvrServiceStop()
| kvrStatus kvrServiceStop | ( | int * | status | ) |
Stops the helper service. The helper service is installed as a part of the driver package and is normally set to automatic start.
- Note
- This API call requires control access to the service.
- Parameters
-
[out] status Win32 status code on failure.
kvrUnloadLibrary()
| void kvrUnloadLibrary | ( | void | ) |
Unloads library stuff. Call this function after calling all other kvr functions.
- Examples:
- example/c/kvrConfig.c, and example/c/kvrConnect.c.