Local configuration

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_noCAN channel number
[out]profile_number
Returns
kvrOK on success or any other kvrStatus on failure.

◆ kvrConfigActiveProfileSet()

kvrStatus kvrConfigActiveProfileSet ( int32_t  can_channel_no,
int32_t  profile_number 
)

Set active profile. See Local Configuration.

Parameters
[in]can_channel_noCAN channel number
[in]profile_number
Returns
kvrOK on success or any other kvrStatus on failure.
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]handleA configuration handle.
Returns
kvrOK on success or any other kvrStatus on failure.

◆ kvrConfigClose()

void kvrConfigClose ( kvrConfigHandle  handle)

Closes the device's configuration area without programming it. Programming is done with kvrConfigSet().

Parameters
[in]handleA 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]handleA configuration handle.
[out]xml_bufferA pointer to the data buffer.
[in]xml_buffer_sizeThe buffer size.
Returns
kvrOK on success or any other kvrStatus on failure.
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_noCAN channel number.
[in]profile_noProfile number
[out]xml_bufferA pointer to the data buffer.
[in]xml_buffer_sizeThe 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_noCAN channel number
[out]no_profiles
Returns
kvrOK on success or any other kvrStatus on failure.

◆ 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_noCAN channel number.
[in]modeCan be set to one of kvrConfigMode_xxx
[in]passwordThe password as a C string. Use an empty string, i.e. "", if no password is required.
[out]handleA configuration handle
Returns
kvrOK on success or any other kvrStatus on failure.
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_noCAN channel number
[in]modeCan be set to one of kvrConfigMode_xxx
[in]passwordThe password as a C string. Use an empty string, i.e. "", if no password is required.
[out]handleA configuration handle
[in]profile_noProfile number
Returns
kvrOK on success or any other kvrStatus on failure.
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]handleA configuration handle.
[in]xml_bufferA pointer to a C string containing a valid XML config.
Returns
kvrOK on success or any other kvrStatus on failure.
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_bufferA pointer to a C string containing an XML configuration.
[out]err_bufferA pointer to a buffer that will hold any error messages.
[in]err_buffer_sizeThe buffer size. Maximum size needed is 2048 bytes.
Returns
kvrOK on success or any other kvrStatus on failure.
Examples:
example/c/kvrConfig.c.