![]() |
Add, delete and modify signals in messages. More...
Add, delete and modify signals in messages.
Signal bit positions are numbered in a "sawtooth" manner, i.e. indices in a byte decrease from left to right:
Byte order formats determine the signal start bit notation and the direction it expands in. There are three of relevance to this API: Intel Standard and Motorola forward MSB/-LSB. The following example shows two signals:
The upper signal uses the "Intel" format and is 7 bits long.
The start bit position is that of the least-significant bit (=5).
The lower signal uses the "Motorola" format and is 11 bits long.
The DBC file format uses Motorola forward MSB where the start bit is the position of the most-significant bit (8*3 + 4 = 28), in contrast to the getters and setters of this API, which use Motorola forward LSB with the start bit being the position of the least-significant bit (8*4 + 2 = 34).
| KvaDbStatus kvaDbAddEnumValue | ( | KvaDbSignalHnd | sh, |
| int | val, | ||
| const char * | name | ||
| ) |
Add a new enumeration value to a signal.
| [in] | sh | A signal handle |
| [out] | val | The enumeration value |
| [out] | name | The enumeration name |
| KvaDbStatus kvaDbAddSignal | ( | KvaDbMessageHnd | mh, |
| KvaDbSignalHnd * | sh | ||
| ) |
Add a new signal to a message.
| [in] | mh | A message handle |
| [out] | sh | A handle to the new signal |
| KvaDbStatus kvaDbAddSignalMuxRange | ( | KvaDbSignalHnd | sh, |
| unsigned int | from, | ||
| unsigned int | to | ||
| ) |
Adds an extended multiplexor value range to a signal.
| [in] | sh | A signal handle |
| [in] | from | Lower bound, inclusive |
| [in] | to | Upper bound, inclusive |
| KvaDbStatus kvaDbClearSignalMuxRanges | ( | KvaDbSignalHnd | sh | ) |
Removes all extended multiplexor value ranges from a signal.
| [in] | sh | A signal handle |
| KvaDbStatus kvaDbDeleteEnumValue | ( | KvaDbSignalHnd | sh, |
| KvaDbEnumValueHnd | eh | ||
| ) |
Delete an enumeration value from a signal.
| [in] | sh | A signal handle |
| [in] | eh | An enumeration value handle |
| KvaDbStatus kvaDbDeleteSignal | ( | KvaDbMessageHnd | mh, |
| KvaDbSignalHnd | sh | ||
| ) |
Delete a signal from a message.
| [in] | mh | A message handle |
| [in] | sh | A handle to the signal to delete |
| KvaDbStatus kvaDbGetEnumValue | ( | KvaDbEnumValueHnd | eh, |
| int * | val, | ||
| char * | buf, | ||
| size_t | buflen | ||
| ) |
Get the enumeration value and name. The name is returned as a null-terminated string. If buf is to small, the name will be truncated and status will be kvaDbOK.
| [in] | eh | An enumeration value handle |
| [out] | val | The enumeration value |
| [out] | buf | The buffer that will hold the enumeration name |
| [in] | buflen | The length of the buffer |
| KvaDbStatus kvaDbGetFirstEnumValue | ( | KvaDbSignalHnd | sh, |
| KvaDbEnumValueHnd * | eh | ||
| ) |
Get the first enumeration value in a signal.
| [in] | sh | A signal handle |
| [out] | eh | A handle to the first enumeration value |
| KvaDbStatus kvaDbGetFirstEnumValuePair | ( | KvaDbSignalHnd | sh, |
| KvaDbEnumValueHnd * | eh, | ||
| int * | val, | ||
| char * | buf, | ||
| size_t | buflen | ||
| ) |
Get the enumeration value and name for the first enumeration value for a signal. The name is returned as a null-terminated string. If buf is to small, the name will be truncated and status will be kvaDbOK.
| [in] | sh | A signal handle. |
| [out] | eh | An enumeration value handle. |
| [out] | val | The enumeration value. |
| [out] | buf | The buffer that will hold the enumeration name. |
| [in] | buflen | The length of the buffer. |
| KvaDbStatus kvaDbGetFirstSignal | ( | KvaDbMessageHnd | mh, |
| KvaDbSignalHnd * | sh | ||
| ) |
Get the first signal in a message.
| [in] | mh | A message handle |
| [out] | sh | A handle to the first signal |
| KvaDbStatus kvaDbGetNextEnumValue | ( | KvaDbSignalHnd | sh, |
| KvaDbEnumValueHnd * | eh | ||
| ) |
Get the next enumeration value in a signal. Should be called after kvaDbGetFirstEnumValue().
| [in] | sh | A signal handle |
| [out] | eh | A handle to the next enumeration value |
| KvaDbStatus kvaDbGetNextEnumValuePair | ( | KvaDbSignalHnd | sh, |
| KvaDbEnumValueHnd * | eh, | ||
| int * | val, | ||
| char * | buf, | ||
| size_t | buflen | ||
| ) |
Get the enumeration value and name for the next enumeration value for a signal. The name is returned as a null-terminated string. If buf is to small, the name will be truncated and status will be kvaDbOK. Should be called after kvaDbGetFirstEnumValuePair().
| [in] | sh | A signal handle. |
| [out] | eh | An enumeration value handle. |
| [out] | val | The enumeration value. |
| [out] | buf | The buffer that will hold the enumeration name. |
| [in] | buflen | The length of the buffer. |
| KvaDbStatus kvaDbGetNextSignal | ( | KvaDbMessageHnd | mh, |
| KvaDbSignalHnd * | sh | ||
| ) |
Get the next signal in a message. Should be called after kvaDbGetFirstSignal().
| [in] | mh | A message handle |
| [out] | sh | A handle to the next signal |
| KvaDbStatus kvaDbGetSignalByName | ( | KvaDbMessageHnd | mh, |
| char * | buf, | ||
| KvaDbSignalHnd * | sh | ||
| ) |
Get a signal handle by seaching for the signals's name.
| [in] | mh | A message handle |
| [in] | buf | The buffer that contains the name of the signal to search for |
| [out] | sh | A handle to the signal |
| KvaDbStatus kvaDbGetSignalComment | ( | KvaDbSignalHnd | sh, |
| char * | buf, | ||
| size_t | buflen | ||
| ) |
Get the comment for a signal as a null-terminated string. A truncated string will be returned if buf is too small and status will be kvaDbOK.
| [in] | sh | A signal handle |
| [out] | buf | The signal comment |
| [in] | buflen | The length of the buffer that will hold the signal comment |
| KvaDbStatus kvaDbGetSignalEncoding | ( | KvaDbSignalHnd | sh, |
| KvaDbSignalEncoding * | e | ||
| ) |
Get the signal encoding.
| [in] | sh | A signal handle |
| [out] | e | The signal encoding, Intel or Motorola, KvaDbSignalEncoding |
| KvaDbStatus kvaDbGetSignalMessage | ( | KvaDbSignalHnd | sh, |
| KvaDbMessageHnd * | mh | ||
| ) |
Get handle to message, which given signal is associated with.
| [in] | sh | A signal handle |
| [out] | mh | Signal's message |
| KvaDbStatus kvaDbGetSignalMode | ( | KvaDbSignalHnd | sh, |
| int * | mux | ||
| ) |
Gets the legacy multiplex mode value of given signal. See KVADB_MUX_xxx for special (negative) values of multiplexer mode.
This function preserves the historical API contract. Any selector signal, including a signal of the form `m<N>M`, is reported as KVADB_MUX_SIGNAL. Use kvaDbGetSignalMuxState for the exact selector/dependent state.
| [in] | sh | A signal handle |
| [out] | mux | Signal's multiplex mode |
| KvaDbStatus kvaDbGetSignalMux | ( | KvaDbSignalHnd | sh, |
| KvaDbSignalHnd * | msh | ||
| ) |
Returns handle to the immediate parent selector signal used by an extended multiplexed signal. If the signal has no selector signal, KvaDbOk will be returned and *msh will be NULL.
| [in] | sh | A signal handle |
| [out] | msh | Selector signal handle |
| KvaDbStatus kvaDbGetSignalMuxRange | ( | KvaDbSignalHnd | sh, |
| size_t | index, | ||
| unsigned int * | from, | ||
| unsigned int * | to | ||
| ) |
Returns one extended multiplexor value range by index.
| [in] | sh | A signal handle |
| [in] | index | Zero-based value range index |
| [out] | from | Lower bound, inclusive |
| [out] | to | Upper bound, inclusive |
| KvaDbStatus kvaDbGetSignalMuxRangeCount | ( | KvaDbSignalHnd | sh, |
| size_t * | count | ||
| ) |
Returns the number of extended multiplexor value ranges associated with a signal.
| [in] | sh | A signal handle |
| [out] | count | Number of value ranges |
| KvaDbStatus kvaDbGetSignalMuxState | ( | KvaDbSignalHnd | sh, |
| int * | is_selector, | ||
| int * | mode | ||
| ) |
Gets the exact multiplexing state of a signal.
*is_selector is non-zero if the signal is a selector signal (`M` or `m<N>M` in DBC form). *mode is KVADB_MUX_INDEPENDENT if the signal is not mode-dependent, otherwise it is the dependent mode value (`m<N>` or `m<N>M` in DBC form).
| [in] | sh | A signal handle |
| [out] | is_selector | Non-zero if the signal is a selector signal |
| [out] | mode | KVADB_MUX_INDEPENDENT or the dependent mode value |
| KvaDbStatus kvaDbGetSignalName | ( | KvaDbSignalHnd | sh, |
| char * | buf, | ||
| size_t | buflen | ||
| ) |
Get the name of a signal as a null-terminated string. A truncated string will be returned if buf is too small and status will be kvaDbOK.
| [in] | sh | A signal handle. |
| [out] | buf | The signal name. |
| [in] | buflen | The length of the buffer that will hold the signal name. |
| KvaDbStatus kvaDbGetSignalPresentationType | ( | KvaDbSignalHnd | sh, |
| KvaDbSignalType * | t | ||
| ) |
Get the signal representation type.
| [in] | sh | |
| [out] | t | The signal representation type, KvaDbSignalType |
| KvaDbStatus kvaDbGetSignalQualifiedName | ( | KvaDbSignalHnd | sh, |
| char * | buf, | ||
| size_t | buflen | ||
| ) |
Get the qualified signal name, which is the database, message and signal names separated by dots, as a null-terminated string. An empty string will be returned if buf is too small and status will be kvaDbOK.
| [in] | sh | A signal handle |
| [out] | buf | The qualified signal name |
| [in] | buflen | The length of the buffer that will hold the qualified signal name |
| KvaDbStatus kvaDbGetSignalRepresentationType | ( | KvaDbSignalHnd | sh, |
| KvaDbSignalType * | t | ||
| ) |
Get the signal representation type.
| [in] | sh | A signal handle |
| [out] | t | The signal representation type, KvaDbSignalType |
| KvaDbStatus kvaDbGetSignalUnit | ( | KvaDbSignalHnd | sh, |
| char * | buf, | ||
| size_t | buflen | ||
| ) |
Get the signal unit as a null-terminated string. A truncated string will be returned if buf is too small and status will be kvaDbOK.
| [in] | sh | A signal handle |
| [out] | buf | The signal unit |
| [in] | buflen | The length of the buffer that will hold the signal unit |
| KvaDbStatus kvaDbGetSignalValueEnum | ( | KvaDbSignalHnd | sh, |
| char * | buf, | ||
| size_t | buflen, | ||
| void * | data, | ||
| size_t | len | ||
| ) |
Retrieve signal's enumeration (string) value from can data.
| [in] | sh | A signal handle |
| [out] | buf | The buffer that will hold the enumeration string |
| [in] | buflen | The length of the buffer. |
| [in] | data | The data buffer to be converted |
| [in] | len | The length of the data buffer |
| KvaDbStatus kvaDbGetSignalValueFloat | ( | KvaDbSignalHnd | sh, |
| double * | f, | ||
| void * | data, | ||
| size_t | len | ||
| ) |
Retrieve signal's physical (floating-point) value from can data.
This function is deprecated and should not be used. Consider kvaDbRetrieveSignalValuePhys() instead
| [in] | sh | A signal handle |
| [out] | f | The converted value |
| [in] | data | The data buffer to be converted |
| [in] | len | The length of the data buffer |
| KvaDbStatus kvaDbGetSignalValueInteger | ( | KvaDbSignalHnd | sh, |
| int * | f, | ||
| void * | data, | ||
| size_t | len | ||
| ) |
Retrieve signal's raw (integer) value from can data.
This function is deprecated and should not be used. Consider kvaDbRetrieveSignalValueRaw() instead
| [in] | sh | A signal handle |
| [out] | f | The converted value |
| [in] | data | The data buffer to be converted |
| [in] | len | The length of the data buffer |
| KvaDbStatus kvaDbGetSignalValueLimits | ( | KvaDbSignalHnd | sh, |
| double * | minval, | ||
| double * | maxval | ||
| ) |
Get the minimum and maximum values from a signal.
| [in] | sh | A signal handle |
| [out] | minval | The minimum value |
| [out] | maxval | The maximum value |
| KvaDbStatus kvaDbGetSignalValueScaling | ( | KvaDbSignalHnd | sh, |
| double * | factor, | ||
| double * | offset | ||
| ) |
Get the scale factor and offset from a signal.
| [in] | sh | A signal handle |
| [out] | factor | The signal scale factor |
| [out] | offset | The signal offset |
| KvaDbStatus kvaDbGetSignalValueSize | ( | KvaDbSignalHnd | sh, |
| int * | startbit, | ||
| int * | length | ||
| ) |
Get the size and position of the signal value.
| [in] | sh | A signal handle |
| [out] | startbit | The bit where the signal value starts |
| [out] | length | The length of the signal value in bits |
startbit is in Motorola forward LSB, in contrast to the DBC file format.| KvaDbStatus kvaDbRetrieveSignalValuePhys | ( | KvaDbSignalHnd | sh, |
| double * | value, | ||
| void * | data, | ||
| size_t | len | ||
| ) |
Retrieve signal's physical (floating-point) value from can data.
| [in] | sh | A signal handle |
| [out] | value | The converted value |
| [in] | data | The data buffer to be converted |
| [in] | len | The length of the data buffer |
| KvaDbStatus kvaDbRetrieveSignalValueRaw | ( | KvaDbSignalHnd | sh, |
| int * | value, | ||
| void * | data, | ||
| size_t | len | ||
| ) |
Retrieve signal's raw (integer) value from can data.
| [in] | sh | A signal handle |
| [out] | value | The converted value |
| [in] | data | The data buffer to be converted |
| [in] | len | The length of the data buffer |
| KvaDbStatus kvaDbRetrieveSignalValueRaw64 | ( | KvaDbSignalHnd | sh, |
| uint64_t * | value, | ||
| void * | data, | ||
| size_t | len | ||
| ) |
Retrieve signal's raw (integer) value from can data.
| [in] | sh | A signal handle |
| [out] | value | The converted value (64-bits) |
| [in] | data | The data buffer to be converted |
| [in] | len | The length of the data buffer |
| KvaDbStatus kvaDbSetSignalComment | ( | KvaDbSignalHnd | sh, |
| char * | buf | ||
| ) |
Set the signal comment.
| [in] | sh | A signal handle |
| [in] | buf | The buffer that contains the signal comment |
| KvaDbStatus kvaDbSetSignalEncoding | ( | KvaDbSignalHnd | sh, |
| KvaDbSignalEncoding | e | ||
| ) |
Set the signal encoding.
| [in] | sh | A signal handle |
| [in] | e | The signal encoding, Intel or Motorola, KvaDbSignalEncoding |
| KvaDbStatus kvaDbSetSignalMode | ( | KvaDbSignalHnd | sh, |
| int | mux | ||
| ) |
Sets signal's legacy multiplex mode. If value is equal to KVADB_MUX_SIGNAL, marks signal as a selector signal.
This function preserves the historical API contract, which can express only one of the selector/dependent aspects directly. For full extended multiplexing state, including signals of the form `m<N>M`, use kvaDbSetSignalMuxState.
| [in] | sh | A signal handle |
| [in] | mux | Signal's multiplex mode |
| KvaDbStatus kvaDbSetSignalMux | ( | KvaDbSignalHnd | sh, |
| KvaDbSignalHnd | msh | ||
| ) |
Sets the immediate parent selector signal for an extended multiplexed signal. Pass NULL in msh to clear the selector reference.
Both signals must belong to the same message.
| [in] | sh | A signal handle |
| [in] | msh | Selector signal handle, or NULL |
| KvaDbStatus kvaDbSetSignalMuxState | ( | KvaDbSignalHnd | sh, |
| int | is_selector, | ||
| int | mode | ||
| ) |
Sets the exact multiplexing state of a signal.
Pass non-zero in is_selector to mark the signal as a selector signal. Pass KVADB_MUX_INDEPENDENT in mode for a non-dependent signal, or a non-negative value for a dependent signal. This allows expressing `M`, `m<N>`, and `m<N>M`.
| [in] | sh | A signal handle |
| [in] | is_selector | Non-zero if the signal should act as a selector |
| [in] | mode | KVADB_MUX_INDEPENDENT or the dependent mode value |
| KvaDbStatus kvaDbSetSignalName | ( | KvaDbSignalHnd | sh, |
| char * | buf | ||
| ) |
Set the signal name.
| [in] | sh | A signal handle |
| [in] | buf | The buffer that contains the signal name |
| KvaDbStatus kvaDbSetSignalRepresentationType | ( | KvaDbSignalHnd | sh, |
| KvaDbSignalType | t | ||
| ) |
Set the signal representation type.
| [in] | sh | A signal handle |
| [in] | t | The signal representation type, KvaDbSignalType |
| KvaDbStatus kvaDbSetSignalUnit | ( | KvaDbSignalHnd | sh, |
| char * | buf | ||
| ) |
Set the signal unit.
| [in] | sh | A signal handle |
| [in] | buf | The buffer that contains the unit for the signal |
| KvaDbStatus kvaDbSetSignalValueLimits | ( | KvaDbSignalHnd | sh, |
| double | minval, | ||
| double | maxval | ||
| ) |
Set the value limits for a signal.
| [in] | sh | A signal handle |
| [in] | minval | The minimum signal value |
| [in] | maxval | The maximum signal value |
| KvaDbStatus kvaDbSetSignalValueScaling | ( | KvaDbSignalHnd | sh, |
| double | factor, | ||
| double | offset | ||
| ) |
Set the scale factor and offset for a signal.
| [in] | sh | A signal handle |
| [in] | factor | The scale factor for the signal value |
| [in] | offset | The offset for the signal value |
| KvaDbStatus kvaDbSetSignalValueSize | ( | KvaDbSignalHnd | sh, |
| int | startbit, | ||
| int | length | ||
| ) |
Set the value position and size for a signal.
| [in] | sh | A signal handle |
| [in] | startbit | The starting bit of the signal's value |
| [in] | length | The length of the value in bits |
startbit is in Motorola forward LSB, in contrast to the DBC file format.| KvaDbStatus kvaDbStoreSignalValuePhys | ( | KvaDbSignalHnd | sh, |
| void * | can_data, | ||
| int | len, | ||
| double | value | ||
| ) |
Convert a physical signal value to data bytes.
| [in] | sh | A signal handle |
| [out] | can_data | The buffer that will hold the converted value |
| [in] | len | The length of the data buffer |
| [in] | value | The physical signal value to convert |
| KvaDbStatus kvaDbStoreSignalValueRaw | ( | KvaDbSignalHnd | sh, |
| void * | can_data, | ||
| int | len, | ||
| int | value | ||
| ) |
Convert a raw signal value to data bytes.
| [in] | sh | A signal handle |
| [out] | can_data | The buffer that will hold the converted value |
| [in] | len | The length of the data buffer |
| [in] | value | The raw signal value to convert |
| KvaDbStatus kvaDbStoreSignalValueRaw64 | ( | KvaDbSignalHnd | sh, |
| void * | can_data, | ||
| int | len, | ||
| uint64_t | value | ||
| ) |
Convert a raw signal value to data bytes.
| [in] | sh | A signal handle |
| [out] | can_data | The buffer that will hold the converted value |
| [in] | len | The length of the data buffer |
| [in] | value | The raw signal value to convert (64-bits) |