kvrlib.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017 by KVASER AB, SWEDEN
3  *
4  * WWW: http://www.kvaser.com
5  *
6  * This software is furnished under a license and may be used and copied
7  * only in accordance with the terms of such license.
8  *
9 */
10 
11 #ifndef KVRLIB_H_
12 #define KVRLIB_H_
13 
14 
15 #include <windows.h>
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 #include <stdint.h>
22 
23 
36 typedef enum {
37  kvrOK = 0,
43  kvrERR_BLANK = -6,
53  /* Remember to update the list of errorstrings (error_text_array) in the library as well. */
54 } kvrStatus;
55 
59 typedef int32_t kvrConfigHandle;
60 
61 
68 #define kvrConfigMode_R 0
69 #define kvrConfigMode_RW 1
70 #define kvrConfigMode_ERASE 2
79 #define kvrServiceState_VOID 0
80 #define kvrServiceState_AVAILABLE 1
81 #define kvrServiceState_DISCOVERED 2
84 #define kvrServiceState_STARTING 3
85 #define kvrServiceState_STARTED 4
86 #define kvrServiceState_CONNECTION_DOWN 5
90 #define kvrServiceState_CONNECTION_UP 6
91 #define kvrServiceState_REDISCOVER 7
92 #define kvrServiceState_UNWILLING 8
93 #define kvrServiceState_REDISCOVER_PENDING 9
94 #define kvrServiceState_CLOSING 10
95 #define kvrServiceState_REMOVE_ME 11
97 #define kvrServiceState_STANDBY 12
98 #define kvrServiceState_CONFIG_CHANGED 13
99 #define kvrServiceState_STOPPING 14
100 #define kvrServiceState_INSTALLING 15
109 #define kvrStartInfo_NONE 0
110 #define kvrStartInfo_START_OK 1
111 #define kvrStartInfo_ERR_IN_USE 2
112 #define kvrStartInfo_ERR_PWD 3
113 #define kvrStartInfo_ERR_NOTME 4
114 #define kvrStartInfo_ERR_CONFIGURING 5
115 #define kvrStartInfo_ERR_PARAM 6
116 #define kvrStartInfo_ERR_ENCRYPTION_PWD 7
165 kvrStatus WINAPI kvrConfigOpen(int32_t can_channel_no,
166  int32_t mode,
167  const char *password,
168  kvrConfigHandle *handle);
169 
170 
182 kvrStatus WINAPI kvrConfigActiveProfileSet (int32_t can_channel_no, int32_t profile_number);
183 
192 kvrStatus WINAPI kvrConfigActiveProfileGet (int32_t can_channel_no, int32_t *profile_number);
193 
203 kvrStatus WINAPI kvrConfigNoProfilesGet(int32_t can_channel_no, int32_t *no_profiles);
204 
205 
247 kvrStatus WINAPI kvrConfigOpenEx(int32_t can_channel_no,
248  int32_t mode,
249  const char *password,
250  kvrConfigHandle *handle,
251  uint32_t profile_no);
252 
263 void WINAPI kvrConfigClose(kvrConfigHandle handle);
264 
279 kvrStatus WINAPI kvrConfigVerifyXml(const char *xml_buffer,
280  char *err_buffer,
281  uint32_t err_buffer_size);
282 
295 kvrStatus WINAPI kvrConfigSet(kvrConfigHandle handle, const char *xml_buffer);
296 
310 kvrStatus WINAPI kvrConfigGet(kvrConfigHandle handle,
311  char *xml_buffer,
312  uint32_t xml_buffer_size);
313 
332 kvrStatus WINAPI kvrConfigInfoGet(int32_t can_channel_no,
333  int32_t profile_no,
334  char *xml_buffer,
335  uint32_t xml_buffer_size);
336 
346 kvrStatus WINAPI kvrConfigClear(kvrConfigHandle handle);
347 
353 typedef struct {
354  uint32_t type;
355  uint8_t address[20];
356 } kvrAddress;
357 
358 
365 typedef struct {
366  uint32_t version;
367  uint32_t capability;
370  uint32_t group_cipher;
373  uint32_t list_cipher_auth;
382 
390 #define kvrAddressType_UNKNOWN 0
391 #define kvrAddressType_IPV4 1
392 #define kvrAddressType_IPV6 2
393 #define kvrAddressType_IPV4_PORT 3
394 #define kvrAddressType_MAC 4
400 typedef int32_t kvrRssiHistory;
401 
405 typedef uint32_t kvrRttHistory;
406 
413 #define kvrNetworkState_UNKNOWN 0
414 #define kvrNetworkState_INVALID 1
415 #define kvrNetworkState_STARTUP 2
416 #define kvrNetworkState_INITIALIZING 3
417 #define kvrNetworkState_NOT_CONNECTED 4
418 #define kvrNetworkState_CONNECTION_DELAY 5
419 #define kvrNetworkState_CONNECTING 6
420 #define kvrNetworkState_CONNECTED 7
421 #define kvrNetworkState_AUTHENTICATING 8
422 #define kvrNetworkState_AUTHENTICATION_FAILED 9
423 #define kvrNetworkState_ONLINE 10
424 #define kvrNetworkState_FAILED_MIC 11
433 #define kvrBss_INFRASTRUCTURE 0
434 #define kvrBss_INDEPENDENT 1
435 #define kvrBss_ANY 2
445 #define kvrRegulatoryDomain_JAPAN_TELEC 0
446 #define kvrRegulatoryDomain_EUROPE_ETSI 1
447 #define kvrRegulatoryDomain_NORTH_AMERICA_FCC 2
448 #define kvrRegulatoryDomain_WORLD 3
449 #define kvrRegulatoryDomain_CHINA_MII 4
470  kvrStatus WINAPI kvrNetworkConnectionTest(kvrConfigHandle handle,
471  int32_t active);
472 
488 kvrStatus WINAPI kvrNetworkGetRssiRtt(kvrConfigHandle handle,
489  kvrRssiHistory *rssi,
490  uint32_t rssi_size,
491  uint32_t *rssi_count,
492  kvrRttHistory *rtt,
493  uint32_t rtt_size,
494  uint32_t *rtt_count);
495 
514 kvrStatus WINAPI kvrWlanStartScan(kvrConfigHandle handle,
515  int32_t active,
516  int32_t bss_type,
517  int32_t domain);
518 
519 
547 kvrStatus WINAPI kvrWlanGetScanResults(kvrConfigHandle handle,
548  int32_t *rssi,
549  int32_t *channel,
550  kvrAddress *mac,
551  int32_t *bss_type,
552  char *ssid,
553  uint32_t *capability,
554  uint32_t *type_wpa,
555  kvrCipherInfoElement *wpa_info,
556  kvrCipherInfoElement *rsn_info);
557 
567 kvrStatus WINAPI kvrNetworkGetHostName(kvrConfigHandle handle,
568  char* buffer, uint32_t buffer_size);
569 
581 kvrStatus WINAPI kvrHostName(uint32_t ean_hi, uint32_t ean_lo, uint32_t ser_no,
582  char* buffer, uint32_t buffer_size);
583 
584 
598 kvrStatus WINAPI kvrNetworkGetConnectionStatus(kvrConfigHandle handle,
599  int32_t *state,
600  int32_t *tx_rate,
601  int32_t *rx_rate,
602  int32_t *channel,
603  int32_t *rssi,
604  int32_t *tx_power);
605 
621 kvrStatus WINAPI kvrNetworkGetAddressInfo(kvrConfigHandle handle,
622  kvrAddress *address1,
623  kvrAddress *address2,
624  kvrAddress *netmask,
625  kvrAddress *gateway,
626  int32_t *dhcp);
627 
637 #define kvrDeviceUsage_UNKNOWN 0
638 #define kvrDeviceUsage_FREE 1
639 #define kvrDeviceUsage_REMOTE 2
640 #define kvrDeviceUsage_USB 3
641 #define kvrDeviceUsage_CONFIG 4
650 #define kvrAccessibility_UNKNOWN 0
651 #define kvrAccessibility_PUBLIC 1
652 #define kvrAccessibility_PROTECTED 2
653 #define kvrAccessibility_PRIVATE 3
663 #define kvrRemoteState_VOID 0
664 #define kvrRemoteState_AVAILABLE 1
665 #define kvrRemoteState_DISCOVERED 2
666 #define kvrRemoteState_STARTING 3
667 #define kvrRemoteState_STARTED 4
668 #define kvrRemoteState_CONNECTION_DOWN 5
669 #define kvrRemoteState_CONNECTION_UP 6
670 #define kvrRemoteState_REDISCOVER 7
671 #define kvrRemoteState_UNWILLING 8
672 #define kvrRemoteState_REDISCOVER_PENDING 9
673 #define kvrRemoteState_CLOSING 10
674 #define kvrRemoteState_REMOVE_ME 11
675 #define kvrRemoteState_STANDBY 12
676 #define kvrRemoteState_CONFIG_CHANGED 13
677 #define kvrRemoteState_STOPPING 14
678 #define kvrRemoteState_INSTALLING 15
687 #define kvrAvailability_NONE 0
688 #define kvrAvailability_FOUND_BY_SCAN 1
689 #define kvrAvailability_STORED 2
710 typedef struct {
711  uint32_t struct_size;
712  uint32_t ean_hi;
713  uint32_t ean_lo;
714  uint32_t ser_no;
715  int32_t fw_major_ver;
716  int32_t fw_minor_ver;
717  int32_t fw_build_ver;
718  char name[256];
719  char host_name[256];
720  int32_t usage;
721  int32_t accessibility;
722  char accessibility_pwd[256];
729  int32_t availability;
730  char encryption_key[32];
731  char reserved1[256];
732  char reserved2[256];
733 } kvrDeviceInfo;
734 
738 typedef int32_t kvrDiscoveryHandle;
739 
740 
748 #define kvrAddressTypeFlag_ALL 0xff
749 #define kvrAddressTypeFlag_BROADCAST 0x01
750 #define kvrAddressTypeFlag_STORED 0x02
773 kvrStatus WINAPI kvrDiscoveryGetDefaultAddresses(kvrAddress address_list[],
774  uint32_t address_list_size,
775  uint32_t *address_list_count,
776  uint32_t address_type_flags);
777 
787 
796 
809  const kvrAddress address_list[],
810  uint32_t address_list_size);
811 
812 
842 kvrStatus WINAPI kvrDiscoveryStart(kvrDiscoveryHandle handle, uint32_t delay_ms,
843  uint32_t timeout_ms);
844 
845 
868 kvrStatus WINAPI kvrDiscoveryStartEx(kvrDiscoveryHandle handle, uint32_t delay_ms,
869  uint32_t timeout_ms, int add_stored);
870 
882  kvrDeviceInfo *device_info);
883 
892 kvrStatus WINAPI kvrDiscoveryStoreDevices(const kvrDeviceInfo device_info_list[],
893  uint32_t device_info_list_size);
894 
895 
905 kvrStatus WINAPI kvrDiscoveryClearDevicesAtExit(int onoff);
906 
916  const char *password);
917 
927  const char *key);
928 
929 
939 kvrStatus WINAPI kvrDeviceGetServiceStatusText(const kvrDeviceInfo *device_info,
940  char *buffer,
941  uint32_t buffer_size);
942 
952 kvrStatus WINAPI kvrDeviceGetServiceStatus(const kvrDeviceInfo *device_info,
953  int32_t *state, int32_t *start_info);
954 
974 kvrStatus WINAPI kvrGetErrorText(kvrStatus error, char *buffer,
975  uint32_t buffer_size);
976 
989 uint16_t WINAPI kvrGetVersion(void);
990 
1001 kvrStatus WINAPI kvrStringFromAddress(char *buffer, uint32_t buffer_size,
1002  const kvrAddress *address);
1003 
1025 kvrStatus WINAPI kvrAddressFromString(int32_t address_type, kvrAddress *address,
1026  const char *address_string);
1027 
1054 kvrStatus WINAPI kvrWlanGetSecurityText(char *security_string,
1055  uint32_t security_string_size,
1056  uint32_t capability,
1057  uint32_t type_wpa,
1058  const kvrCipherInfoElement *wpa_info,
1059  const kvrCipherInfoElement *rsn_info);
1060 
1075 kvrStatus WINAPI kvrNetworkGenerateWepKeys(const char *pass_phrase,
1076  char *key64_1,
1077  char *key64_2,
1078  char *key64_3,
1079  char *key64_4,
1080  char *key128);
1081 
1092 kvrStatus WINAPI kvrNetworkGenerateWpaKeys(const char *pass_phrase,
1093  const char *ssid,
1094  char *key);
1095 
1102 void WINAPI kvrInitializeLibrary(void);
1103 
1104 
1109 void WINAPI kvrUnloadLibrary(void);
1110 
1111 
1122 kvrStatus WINAPI kvrServiceQuery(int *status);
1123 
1135 kvrStatus WINAPI kvrServiceStart(int *status);
1136 
1148 kvrStatus WINAPI kvrServiceStop(int *status);
1149 
1150 
1266 #ifdef __cplusplus
1267 }
1268 #endif
1269 
1270 
1271 #endif
kvrStatus kvrConfigActiveProfileGet(int32_t can_channel_no, int32_t *profile_number)
Definition: kvrlib.h:353
kvrStatus kvrDiscoveryStart(kvrDiscoveryHandle handle, uint32_t delay_ms, uint32_t timeout_ms)
kvrStatus kvrServiceStart(int *status)
Definition: kvrlib.h:46
Definition: kvrlib.h:45
kvrStatus
Definition: kvrlib.h:36
uint32_t ean_lo
Definition: kvrlib.h:713
int32_t usage
Definition: kvrlib.h:720
uint32_t version
Definition: kvrlib.h:366
int32_t fw_build_ver
Definition: kvrlib.h:717
Definition: kvrlib.h:41
Definition: kvrlib.h:51
kvrStatus kvrDiscoveryOpen(kvrDiscoveryHandle *handle)
kvrStatus kvrConfigNoProfilesGet(int32_t can_channel_no, int32_t *no_profiles)
kvrStatus kvrDiscoveryClose(kvrDiscoveryHandle handle)
int32_t kvrRssiHistory
Definition: kvrlib.h:400
uint32_t kvrRttHistory
Definition: kvrlib.h:405
void kvrInitializeLibrary(void)
Definition: kvrlib.h:43
Definition: kvrlib.h:38
kvrStatus kvrDeviceGetServiceStatusText(const kvrDeviceInfo *device_info, char *buffer, uint32_t buffer_size)
Definition: kvrlib.h:52
kvrStatus kvrConfigInfoGet(int32_t can_channel_no, int32_t profile_no, char *xml_buffer, uint32_t xml_buffer_size)
kvrStatus kvrServiceQuery(int *status)
Definition: kvrlib.h:42
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 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)
uint32_t ean_hi
Definition: kvrlib.h:712
uint32_t ser_no
Definition: kvrlib.h:714
kvrStatus kvrDiscoveryStoreDevices(const kvrDeviceInfo device_info_list[], uint32_t device_info_list_size)
kvrStatus kvrDeviceGetServiceStatus(const kvrDeviceInfo *device_info, int32_t *state, int32_t *start_info)
Definition: kvrlib.h:44
uint32_t list_cipher_auth
Definition: kvrlib.h:373
int32_t fw_minor_ver
Definition: kvrlib.h:716
kvrStatus kvrGetErrorText(kvrStatus error, char *buffer, uint32_t buffer_size)
kvrStatus kvrConfigActiveProfileSet(int32_t can_channel_no, int32_t profile_number)
kvrStatus kvrHostName(uint32_t ean_hi, uint32_t ean_lo, uint32_t ser_no, char *buffer, uint32_t buffer_size)
kvrAddress base_station_id
Definition: kvrlib.h:725
Definition: kvrlib.h:47
int32_t kvrConfigHandle
Definition: kvrlib.h:59
kvrStatus kvrConfigGet(kvrConfigHandle handle, char *xml_buffer, uint32_t xml_buffer_size)
kvrStatus kvrNetworkGenerateWepKeys(const char *pass_phrase, char *key64_1, char *key64_2, char *key64_3, char *key64_4, char *key128)
Definition: kvrlib.h:48
uint32_t struct_size
Definition: kvrlib.h:711
void kvrConfigClose(kvrConfigHandle handle)
kvrStatus kvrConfigVerifyXml(const char *xml_buffer, char *err_buffer, uint32_t err_buffer_size)
uint32_t group_cipher
Definition: kvrlib.h:370
kvrStatus kvrDiscoveryClearDevicesAtExit(int onoff)
uint32_t capability
Definition: kvrlib.h:367
Definition: kvrlib.h:37
kvrStatus kvrConfigClear(kvrConfigHandle handle)
void kvrUnloadLibrary(void)
kvrStatus kvrConfigSet(kvrConfigHandle handle, const char *xml_buffer)
kvrStatus kvrConfigOpenEx(int32_t can_channel_no, int32_t mode, const char *password, kvrConfigHandle *handle, uint32_t profile_no)
kvrStatus kvrNetworkGenerateWpaKeys(const char *pass_phrase, const char *ssid, char *key)
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)
Definition: kvrlib.h:40
Definition: kvrlib.h:50
int32_t kvrDiscoveryHandle
Definition: kvrlib.h:738
Definition: kvrlib.h:39
uint32_t type
Definition: kvrlib.h:354
kvrStatus kvrServiceStop(int *status)
Definition: kvrlib.h:365
kvrStatus kvrDiscoverySetAddresses(kvrDiscoveryHandle handle, const kvrAddress address_list[], uint32_t address_list_size)
kvrStatus kvrNetworkGetHostName(kvrConfigHandle handle, char *buffer, uint32_t buffer_size)
kvrAddress device_address
Definition: kvrlib.h:723
uint16_t kvrGetVersion(void)
int32_t accessibility
Definition: kvrlib.h:721
kvrAddress client_address
Definition: kvrlib.h:724
kvrStatus kvrStringFromAddress(char *buffer, uint32_t buffer_size, const kvrAddress *address)
Holds information about a discovered device.
Definition: kvrlib.h:710
kvrStatus kvrNetworkGetAddressInfo(kvrConfigHandle handle, kvrAddress *address1, kvrAddress *address2, kvrAddress *netmask, kvrAddress *gateway, int32_t *dhcp)
kvrStatus kvrDiscoverySetEncryptionKey(kvrDeviceInfo *device_info, const char *key)
int32_t availability
Definition: kvrlib.h:729
int32_t request_connection
Definition: kvrlib.h:726
kvrStatus kvrDiscoverySetPassword(kvrDeviceInfo *device_info, const char *password)
kvrStatus kvrDiscoveryStartEx(kvrDiscoveryHandle handle, uint32_t delay_ms, uint32_t timeout_ms, int add_stored)
kvrStatus kvrWlanStartScan(kvrConfigHandle handle, int32_t active, int32_t bss_type, int32_t domain)
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 kvrDiscoveryGetResults(kvrDiscoveryHandle handle, kvrDeviceInfo *device_info)
int32_t fw_major_ver
Definition: kvrlib.h:715
Definition: kvrlib.h:49