Add, delete and modify signals in messages.
More...
|
KvaDbStatus | kvaDbGetFirstSignal (KvaDbMessageHnd mh, KvaDbSignalHnd *sh) |
|
KvaDbStatus | kvaDbGetNextSignal (KvaDbMessageHnd mh, KvaDbSignalHnd *sh) |
|
KvaDbStatus | kvaDbGetSignalByName (KvaDbMessageHnd mh, char *buf, KvaDbSignalHnd *sh) |
|
KvaDbStatus | kvaDbSetSignalMode (KvaDbSignalHnd sh, int mux) |
|
KvaDbStatus | kvaDbGetSignalMode (KvaDbSignalHnd sh, int *mux) |
|
KvaDbStatus | kvaDbGetSignalMessage (KvaDbSignalHnd sh, KvaDbMessageHnd *mh) |
|
KvaDbStatus | kvaDbGetSignalValueFloat (KvaDbSignalHnd sh, double *f, void *data, size_t len) |
|
KvaDbStatus | kvaDbGetSignalValueInteger (KvaDbSignalHnd sh, int *f, void *data, size_t len) |
|
KvaDbStatus | kvaDbRetrieveSignalValuePhys (KvaDbSignalHnd sh, double *value, void *data, size_t len) |
|
KvaDbStatus | kvaDbRetrieveSignalValueRaw (KvaDbSignalHnd sh, int *value, void *data, size_t len) |
|
KvaDbStatus | kvaDbRetrieveSignalValueRaw64 (KvaDbSignalHnd sh, uint64_t *value, void *data, size_t len) |
|
KvaDbStatus | kvaDbGetSignalValueEnum (KvaDbSignalHnd sh, char *buf, size_t buflen, void *data, size_t len) |
|
KvaDbStatus | kvaDbGetSignalValueLimits (KvaDbSignalHnd sh, double *minval, double *maxval) |
|
KvaDbStatus | kvaDbGetSignalValueScaling (KvaDbSignalHnd sh, double *factor, double *offset) |
|
KvaDbStatus | kvaDbGetSignalValueSize (KvaDbSignalHnd sh, int *startbit, int *length) |
|
KvaDbStatus | kvaDbGetSignalName (KvaDbSignalHnd sh, char *buf, size_t buflen) |
|
KvaDbStatus | kvaDbGetSignalQualifiedName (KvaDbSignalHnd sh, char *buf, size_t buflen) |
|
KvaDbStatus | kvaDbGetSignalComment (KvaDbSignalHnd sh, char *buf, size_t buflen) |
|
KvaDbStatus | kvaDbGetSignalUnit (KvaDbSignalHnd sh, char *buf, size_t buflen) |
|
KvaDbStatus | kvaDbGetSignalEncoding (KvaDbSignalHnd sh, KvaDbSignalEncoding *e) |
|
KvaDbStatus | kvaDbGetSignalRepresentationType (KvaDbSignalHnd sh, KvaDbSignalType *t) |
|
KvaDbStatus | kvaDbGetSignalPresentationType (KvaDbSignalHnd sh, KvaDbSignalType *t) |
|
KvaDbStatus | kvaDbAddSignal (KvaDbMessageHnd mh, KvaDbSignalHnd *sh) |
|
KvaDbStatus | kvaDbDeleteSignal (KvaDbMessageHnd mh, KvaDbSignalHnd sh) |
|
KvaDbStatus | kvaDbSetSignalValueLimits (KvaDbSignalHnd sh, double minval, double maxval) |
|
KvaDbStatus | kvaDbSetSignalValueScaling (KvaDbSignalHnd sh, double factor, double offset) |
|
KvaDbStatus | kvaDbSetSignalValueSize (KvaDbSignalHnd sh, int startbit, int length) |
|
KvaDbStatus | kvaDbSetSignalName (KvaDbSignalHnd sh, char *buf) |
|
KvaDbStatus | kvaDbSetSignalComment (KvaDbSignalHnd sh, char *buf) |
|
KvaDbStatus | kvaDbSetSignalUnit (KvaDbSignalHnd sh, char *buf) |
|
KvaDbStatus | kvaDbSetSignalEncoding (KvaDbSignalHnd sh, KvaDbSignalEncoding e) |
|
KvaDbStatus | kvaDbSetSignalRepresentationType (KvaDbSignalHnd sh, KvaDbSignalType t) |
|
KvaDbStatus | kvaDbStoreSignalValuePhys (KvaDbSignalHnd sh, void *can_data, int len, double value) |
|
KvaDbStatus | kvaDbStoreSignalValueRaw (KvaDbSignalHnd sh, void *can_data, int len, int value) |
|
KvaDbStatus | kvaDbStoreSignalValueRaw64 (KvaDbSignalHnd sh, void *can_data, int len, uint64_t value) |
|
KvaDbStatus | kvaDbGetFirstEnumValue (KvaDbSignalHnd sh, KvaDbEnumValueHnd *eh) |
|
KvaDbStatus | kvaDbGetNextEnumValue (KvaDbSignalHnd sh, KvaDbEnumValueHnd *eh) |
|
KvaDbStatus | kvaDbGetEnumValue (KvaDbEnumValueHnd eh, int *val, char *buf, size_t buflen) |
|
KvaDbStatus | kvaDbGetFirstEnumValuePair (KvaDbSignalHnd sh, KvaDbEnumValueHnd *eh, int *val, char *buf, size_t buflen) |
|
KvaDbStatus | kvaDbGetNextEnumValuePair (KvaDbSignalHnd sh, KvaDbEnumValueHnd *eh, int *val, char *buf, size_t buflen) |
|
KvaDbStatus | kvaDbAddEnumValue (KvaDbSignalHnd sh, int val, const char *name) |
|
KvaDbStatus | kvaDbDeleteEnumValue (KvaDbSignalHnd sh, KvaDbEnumValueHnd eh) |
|
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:
+-------------------------+-------------------------+
| 7 6 5 4 3 2 1 0 | 15 14 13 12 11 10 9 8 | ...
+-------------------------+-------------------------+
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:
| 7 6 5 4 3 2 1 0
--+-------------------------
0 |<......lsb v Intel Standard
1 | msb.........
2 | | Motorola forward MSB/LSB
3 | v msb............
4 |<...............lsb
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).
◆ kvaDbAddEnumValue()
Add a new enumeration value to a signal.
- Parameters
-
[in] | sh | A signal handle |
[out] | val | The enumeration value |
[out] | name | The enumeration name |
- Returns
- kvaDbOK (zero) if success
-
kvaDbErr_xxx (negative) if failure
- See also
- kvaDbDeleteEnumValue()
◆ kvaDbAddSignal()
◆ kvaDbDeleteEnumValue()
Delete an enumeration value from a signal.
- Parameters
-
[in] | sh | A signal handle |
[in] | eh | An enumeration value handle |
- Returns
- kvaDbOK (zero) if success
-
kvaDbErr_xxx (negative) if failure
- See also
- kvaDbAddEnumValue()
◆ kvaDbDeleteSignal()
◆ kvaDbGetEnumValue()
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.
- Parameters
-
[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 |
- Returns
- kvaDbOK (zero) if success
-
kvaDbErr_xxx (negative) if failure
- See also
- kvaDbGetFirstEnumValue()
◆ kvaDbGetFirstEnumValue()
Get the first enumeration value in a signal.
- Parameters
-
[in] | sh | A signal handle |
[out] | eh | A handle to the first enumeration value |
- Returns
- kvaDbOK (zero) if success
-
kvaDbErr_xxx (negative) if failure
- See also
- kvaDbGetNextEnumValue()
◆ kvaDbGetFirstEnumValuePair()
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.
- Parameters
-
[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. |
- Returns
- kvaDbOK (zero) if success
-
kvaDbErr_xxx (negative) if failure
◆ kvaDbGetFirstSignal()
◆ kvaDbGetNextEnumValue()
◆ kvaDbGetNextEnumValuePair()
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().
- Parameters
-
[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. |
- Returns
- kvaDbOK (zero) if success
-
kvaDbErr_xxx (negative) if failure
◆ kvaDbGetNextSignal()
◆ kvaDbGetSignalByName()
Get a signal handle by seaching for the signals's name.
- Parameters
-
[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 |
- Returns
- kvaDbOK (zero) if success
-
kvaDbErr_xxx (negative) if failure
- See also
- kvaDbGetFirstMsg()
- Examples:
- example/c/candb_sample.c.
◆ kvaDbGetSignalComment()
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.
- Parameters
-
[in] | sh | A signal handle |
[out] | buf | The signal comment |
[in] | buflen | The length of the buffer that will hold the signal comment |
- Returns
- kvaDbOK (zero) if success
-
kvaDbErr_xxx (negative) if failure
- See also
- kvaDbSetSignalComment()
- Examples:
- example/c/candb_sample.c.
◆ kvaDbGetSignalEncoding()
◆ kvaDbGetSignalMessage()
◆ kvaDbGetSignalMode()
Gets mux from multiplexer mode value of given signal. See KVADB_MUX_xxx for special (negative) values of multiplexer mode.
- Parameters
-
[in] | sh | A signal handle |
[out] | mux | Signal's multiplex mode |
- Returns
- kvaDbOK (zero) if success
-
kvaDbErr_xxx (negative) if failure
- See also
- KVADB_MUX_xxx
◆ kvaDbGetSignalName()
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.
- Parameters
-
[in] | sh | A signal handle. |
[out] | buf | The signal name. |
[in] | buflen | The length of the buffer that will hold the signal name. |
- Returns
- kvaDbOK (zero) if success
-
kvaDbErr_xxx (negative) if failure
- See also
- kvaDbSetSignalName()
- Examples:
- example/c/candb_sample.c.
◆ kvaDbGetSignalPresentationType()
◆ kvaDbGetSignalQualifiedName()
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.
- Parameters
-
[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 |
- Returns
- kvaDbOK (zero) if success
-
kvaDbErr_xxx (negative) if failure
- See also
- kvaDbGetSignalName()
- Examples:
- example/c/candb_sample.c.
◆ kvaDbGetSignalRepresentationType()
◆ kvaDbGetSignalUnit()
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.
- Parameters
-
[in] | sh | A signal handle |
[out] | buf | The signal unit |
[in] | buflen | The length of the buffer that will hold the signal unit |
- Returns
- kvaDbOK (zero) if success
-
kvaDbErr_xxx (negative) if failure
- See also
- kvaDbSetSignalUnit()
- Examples:
- example/c/candb_sample.c.
◆ kvaDbGetSignalValueEnum()
Retrieve signal's enumeration (string) value from can data.
- Parameters
-
[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 |
- Returns
- kvaDbOK (zero) if success
-
kvaDbErr_xxx (negative) if failure
- See also
- kvaDbStoreSignalValueRaw()
◆ kvaDbGetSignalValueFloat()
◆ kvaDbGetSignalValueInteger()
◆ kvaDbGetSignalValueLimits()
◆ kvaDbGetSignalValueScaling()
◆ kvaDbGetSignalValueSize()
Get the size and position of the signal value.
- Parameters
-
[in] | sh | A signal handle |
[out] | startbit | The bit where the signal value starts |
[out] | length | The length of the signal value in bits |
- Returns
- kvaDbOK (zero) if success
-
kvaDbErr_xxx (negative) if failure
- Note
- In case of Motorola encoding,
startbit
is in Motorola forward LSB, in contrast to the DBC file format.
- See also
- kvaDbSetSignalValueSize()
- Examples:
- example/c/candb_sample.c.
◆ kvaDbRetrieveSignalValuePhys()
Retrieve signal's physical (floating-point) value from can data.
- Parameters
-
[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 |
- Returns
- kvaDbOK (zero) if success
-
kvaDbErr_xxx (negative) if failure
- See also
- kvaDbStoreSignalValuePhys()
◆ kvaDbRetrieveSignalValueRaw()
Retrieve signal's raw (integer) value from can data.
- Parameters
-
[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 |
- Returns
- kvaDbOK (zero) if success
-
kvaDbErr_xxx (negative) if failure
- See also
- kvaDbStoreSignalValueRaw()
◆ kvaDbRetrieveSignalValueRaw64()
Retrieve signal's raw (integer) value from can data.
- Parameters
-
[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 |
- Returns
- kvaDbOK (zero) if success
-
kvaDbErr_xxx (negative) if failure
- See also
- kvaDbStoreSignalValueRaw64()
◆ kvaDbSetSignalComment()
◆ kvaDbSetSignalEncoding()
◆ kvaDbSetSignalMode()
Sets signal's multiplex mode. If value is equal to KVADB_MUX_SIGNAL, marks signal as a multiplexer.
- Parameters
-
[in] | sh | A signal handle |
[in] | mux | Signal's multiplex mode |
- Returns
- kvaDbOK (zero) if success
-
kvaDbErr_xxx (negative) if failure
- See also
- KVADB_MUX_xxx
◆ kvaDbSetSignalName()
◆ kvaDbSetSignalRepresentationType()
◆ kvaDbSetSignalUnit()
◆ kvaDbSetSignalValueLimits()
◆ kvaDbSetSignalValueScaling()
◆ kvaDbSetSignalValueSize()
Set the value position and size for a signal.
- Parameters
-
[in] | sh | A signal handle |
[in] | startbit | The starting bit of the signal's value |
[in] | length | The length of the value in bits |
- Returns
- kvaDbOK (zero) if success
-
kvaDbErr_xxx (negative) if failure
- Note
- In case of Motorola encoding,
startbit
is in Motorola forward LSB, in contrast to the DBC file format.
- See also
- kvaDbGetSignalValueSize()
- Examples:
- example/c/candb_sample.c, and example/c/j1939_db.c.
◆ kvaDbStoreSignalValuePhys()
Convert a physical signal value to data bytes.
- Parameters
-
[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 |
- Returns
- kvaDbOK (zero) if success
-
kvaDbErr_xxx (negative) if failure
- See also
- kvaDbGetSignalValueFloat()
- Examples:
- example/c/candb_sample.c.
◆ kvaDbStoreSignalValueRaw()
Convert a raw signal value to data bytes.
- Parameters
-
[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 |
- Returns
- kvaDbOK (zero) if success
-
kvaDbErr_xxx (negative) if failure
- See also
- kvaDbRetrieveSignalValueRaw()
◆ kvaDbStoreSignalValueRaw64()
Convert a raw signal value to data bytes.
- Parameters
-
[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) |
- Returns
- kvaDbOK (zero) if success
-
kvaDbErr_xxx (negative) if failure
- See also
- kvaDbRetrieveSignalValueRaw64()