Configuring a locally connected device. More...
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) |
Detailed Description
Configuring a locally connected device.
Function Documentation
kvrConfigActiveProfileGet()
| kvrStatus kvrConfigActiveProfileGet | ( | int32_t | can_channel_no, |
| int32_t * | profile_number | ||
| ) |
Get active profile. See Local Configuration.
- Parameters
-
[in] can_channel_no CAN channel number [out] profile_number
kvrConfigActiveProfileSet()
| kvrStatus kvrConfigActiveProfileSet | ( | int32_t | can_channel_no, |
| int32_t | profile_number | ||
| ) |
Set active profile. See Local Configuration.
- Parameters
-
[in] can_channel_no CAN channel number [in] profile_number
- Note
- A pause of ~2 seconds is needed after kvrConfigActiveProfileSet(), to allow CANlib time to discard the device.
kvrConfigClear()
| kvrStatus kvrConfigClear | ( | kvrConfigHandle | handle | ) |
Clear the device configuration area. This will also clear any previously set device password. The handle must be opened kvrConfigMode_ERASE and closed with kvrConfigClose().
- Parameters
-
[in] handle A configuration handle.
kvrConfigClose()
| void kvrConfigClose | ( | kvrConfigHandle | handle | ) |
Closes the device's configuration area without programming it. Programming is done with kvrConfigSet().
- Parameters
-
[in] handle A configuration handle
- Note
- When using kvrConfigMode_RW or kvrConfigMode_ERASE, a pause of ~2 seconds is needed after kvrConfigClose(), to allow CANlib time to discard the device.
- Examples:
- example/c/kvrConfig.c, and example/c/kvrNetworkConnectionTest.c.
kvrConfigGet()
| kvrStatus kvrConfigGet | ( | kvrConfigHandle | handle, |
| char * | xml_buffer, | ||
| uint32_t | xml_buffer_size | ||
| ) |
Reads the device configuration. On successful return, the buffer will contain a valid C string with the configuration in XML format. The handle must be opened kvrConfigMode_R or kvrConfigMode_RW and closed with kvrConfigClose().
- Parameters
-
[in] handle A configuration handle. [out] xml_buffer A pointer to the data buffer. [in] xml_buffer_size The buffer size.
- Examples:
- example/c/kvrConfig.c.
kvrConfigInfoGet()
| kvrStatus kvrConfigInfoGet | ( | int32_t | can_channel_no, |
| int32_t | profile_no, | ||
| char * | xml_buffer, | ||
| uint32_t | xml_buffer_size | ||
| ) |
Reads a simplified version of A device configuration PROFILE. On successful return, the buffer will contain a valid C string of this in XML format. Since the function takes a CAN channel rather than a kvrConfigHandle, it is not necessary to know the configuration password. Note that the partial XML data returned is not enough to reconfigure a device.
- Parameters
-
[in] can_channel_no CAN channel number. [in] profile_no Profile number [out] xml_buffer A pointer to the data buffer. [in] xml_buffer_size The buffer size.
- Returns
- kvrOK on success, kvrERR_BLANK when the profile is empty, or any other kvrStatus on failure.
kvrConfigNoProfilesGet()
| kvrStatus kvrConfigNoProfilesGet | ( | int32_t | can_channel_no, |
| int32_t * | no_profiles | ||
| ) |
Get the maximum number of profile(s) the device can store. See Local Configuration.
- Parameters
-
[in] can_channel_no CAN channel number [out] no_profiles
kvrConfigOpen()
| kvrStatus kvrConfigOpen | ( | int32_t | can_channel_no, |
| int32_t | mode, | ||
| const char * | password, | ||
| kvrConfigHandle * | handle | ||
| ) |
Open a configuration handle to the device. It should later be closed with kvrConfigClose().
This configuration handle is used both for changing the device configuration, reading status information, e.g. kvrNetworkGetConnectionStatus(), and issuing some other commands such as e.g. kvrNetworkConnectionTest() and kvrWlanStartScan().
To change the configuration, you need to open the configuration with kvrConfigMode_RW before calling kvrConfigSet().
To read the configuration, you can open the configuration with either kvrConfigMode_RW or kvrConfigMode_R before calling kvrConfigGet().
Setting a password is done through the configuration (with kvrConfigSet()). Resetting a password can be done by erasing the whole configuration with kvrConfigClear(), while first opening the configuration with kvrConfigMode_ERASE and supplying an empty password.
Before calling any other function, you must open the configuration with kvrConfigMode_R.
- Parameters
-
[in] can_channel_no CAN channel number. [in] mode Can be set to one of kvrConfigMode_xxx [in] password The password as a C string. Use an empty string, i.e. "", if no password is required. [out] handle A configuration handle
- Note
- kvrConfigOpen() will operate on the active profile. See Local Configuration.
- When using kvrConfigMode_RW or kvrConfigMode_ERASE, a pause of ~2 seconds is needed after kvrConfigClose(), to allow CANlib time to discard the device.
- See also
- kvrConfigOpenEx()
- Examples:
- example/c/kvrConfig.c, and example/c/kvrNetworkConnectionTest.c.
kvrConfigOpenEx()
| kvrStatus kvrConfigOpenEx | ( | int32_t | can_channel_no, |
| int32_t | mode, | ||
| const char * | password, | ||
| kvrConfigHandle * | handle, | ||
| uint32_t | profile_no | ||
| ) |
Open a configuration handle to the device. It should later be closed with kvrConfigClose().
This configuration handle is used both for changing the device configuration, reading status information, e.g. kvrNetworkGetConnectionStatus(), and issuing some other commands such as e.g. kvrNetworkConnectionTest() and kvrWlanStartScan().
To change the configuration, you need to open the configuration with kvrConfigMode_RW before calling kvrConfigSet().
To read the configuration, you can open the configuration with either kvrConfigMode_RW or kvrConfigMode_R before calling kvrConfigGet().
Setting a password is done through the configuration (with kvrConfigSet()). Resetting a password can be done by erasing the whole configuration with kvrConfigClear(), while first opening the configuration with kvrConfigMode_ERASE and supplying an empty password.
Before calling any other function, you must open the configuration with kvrConfigMode_R.
The profile number is used to open a specific profile. See Local Configuration.
- Parameters
-
[in] can_channel_no CAN channel number [in] mode Can be set to one of kvrConfigMode_xxx [in] password The password as a C string. Use an empty string, i.e. "", if no password is required. [out] handle A configuration handle [in] profile_no Profile number
- Note
- When using kvrConfigMode_RW or kvrConfigMode_ERASE, a pause of ~2 seconds is needed after kvrConfigClose(), to allow CANlib time to discard the device.
- See also
- kvrConfigOpen()
kvrConfigSet()
| kvrStatus kvrConfigSet | ( | kvrConfigHandle | handle, |
| const char * | xml_buffer | ||
| ) |
Set the device configuration. The area is erased before it is programmed. The handle must be opened kvrConfigMode_RW and closed with kvrConfigClose() afterward. If the XML input creates any errors, kvrERR_PARAMETER will be returned.
- Parameters
-
[in] handle A configuration handle. [in] xml_buffer A pointer to a C string containing a valid XML config.
- Examples:
- example/c/kvrConfig.c.
kvrConfigVerifyXml()
| kvrStatus kvrConfigVerifyXml | ( | const char * | xml_buffer, |
| char * | err_buffer, | ||
| uint32_t | err_buffer_size | ||
| ) |
Verify that the xml buffer complies with both the DTD and internal restrictions.
If the XML input creates any errors and err_buffer is to small to hold the resulting error message, kvrERR_BUFFER_TOO_SMALL will be returned and err_buffer will hold a truncated error message. If the err_buffer is big enough, kvrERR_XML_VALIDATION will be returned.
- Parameters
-
[in] xml_buffer A pointer to a C string containing an XML configuration. [out] err_buffer A pointer to a buffer that will hold any error messages. [in] err_buffer_size The buffer size. Maximum size needed is 2048 bytes.
- Examples:
- example/c/kvrConfig.c.