Functions
Messages
kvaDbLib

Add, delete and modify messages. More...

## Functions
KvaDbStatus | kvaDbGetFirstMsg (KvaDbHnd dh, KvaDbMessageHnd *mh)
KvaDbStatus | kvaDbGetNextMsg (KvaDbHnd dh, KvaDbMessageHnd *mh)
KvaDbStatus | kvaDbGetMsgById (KvaDbHnd dh, unsigned int id, KvaDbMessageHnd *mh)
KvaDbStatus | kvaDbGetMsgByName (KvaDbHnd dh, const char *msg_name, KvaDbMessageHnd *mh)
KvaDbStatus | kvaDbGetMsgName (KvaDbMessageHnd mh, char *buf, size_t buflen)
KvaDbStatus | kvaDbGetMsgQualifiedName (KvaDbMessageHnd mh, char *buf, size_t buflen)
KvaDbStatus | kvaDbGetMsgComment (KvaDbMessageHnd mh, char *buf, size_t buflen)
KvaDbStatus | kvaDbGetMsgId (KvaDbMessageHnd mh, unsigned int *id, unsigned int *flags)
KvaDbStatus | kvaDbGetMsgIdEx (KvaDbMessageHnd mh, unsigned int *id)
KvaDbStatus | kvaDbGetMsgFlags (KvaDbMessageHnd mh, unsigned int *flags)
KvaDbStatus | kvaDbGetMsgDlc (KvaDbMessageHnd mh, int *dlc)
KvaDbStatus | kvaDbGetMsgSendNode (KvaDbMessageHnd mh, KvaDbNodeHnd *nh)
KvaDbStatus | kvaDbAddMsg (KvaDbHnd dh, KvaDbMessageHnd *mh)
KvaDbStatus | kvaDbDeleteMsg (KvaDbHnd dh, KvaDbMessageHnd mh)
KvaDbStatus | kvaDbSetMsgName (KvaDbMessageHnd mh, char *buf)
KvaDbStatus | kvaDbSetMsgComment (KvaDbMessageHnd mh, char *buf)
KvaDbStatus | kvaDbSetMsgId (KvaDbMessageHnd mh, unsigned int id, unsigned int flags)
KvaDbStatus | kvaDbSetMsgIdEx (KvaDbMessageHnd mh, unsigned int id)
KvaDbStatus | kvaDbSetMsgFlags (KvaDbMessageHnd mh, unsigned int flags)
KvaDbStatus | kvaDbSetMsgDlc (KvaDbMessageHnd mh, int dlc)
KvaDbStatus | kvaDbSetMsgSendNode (KvaDbMessageHnd mh, KvaDbNodeHnd nh)
KvaDbStatus | kvaDbGetMsgMux (KvaDbMessageHnd mh, KvaDbSignalHnd *sh)
KvaDbStatus | kvaDbMsgDlcToBytes (KvaDbProtocolType prot, unsigned int dlc, unsigned int *numBytes)
KvaDbStatus | kvaDbBytesToMsgDlc (KvaDbProtocolType prot, unsigned int numBytes, unsigned int *dlc)

## Detailed Description

Add, delete and modify messages.

## Function Documentation

## ◆ kvaDbAddMsg()

KvaDbStatus kvaDbAddMsg | ( | KvaDbHnd | dh,
|  | KvaDbMessageHnd * | mh
| ) |  |

Add a new message to a database.

Parameters

  [in] | dh | A database handle
  [out] | mh | A handle to the new message

Returns
  kvaDbOK (zero) if success
  kvaDbErr_xxx (negative) if failure

See also
  kvaDbDeleteMsg()

Examples:
  candb_sample.c.

## ◆ kvaDbBytesToMsgDlc()

KvaDbStatus kvaDbBytesToMsgDlc | ( | KvaDbProtocolType | prot,
|  | unsigned int | numBytes,
|  | unsigned int * | dlc
| ) |  |

Translates number of bytes to message dlc for a given protocol

Parameters

  [in] | prot | A protocol type
  [in] | numBytes | Number of bytes
  [out] | dlc | Raw message dlc

Returns
  kvaDbOK (zero) if success
  kvaDbErr_xxx (negative) if failure

See also
  kvaDbGetProtocol()

## ◆ kvaDbDeleteMsg()

KvaDbStatus kvaDbDeleteMsg | ( | KvaDbHnd | dh,
|  | KvaDbMessageHnd | mh
| ) |  |

Delete a message from a database.

Parameters

  [in] | dh | A database handle
  [in] | mh | A handle to the message that will be deleted

Returns
  kvaDbOK (zero) if success
  kvaDbErr_xxx (negative) if failure

See also
  kvaDbAddMsg()

Examples:
  candb_sample.c.

## ◆ kvaDbGetFirstMsg()

KvaDbStatus kvaDbGetFirstMsg | ( | KvaDbHnd | dh,
|  | KvaDbMessageHnd * | mh
| ) |  |

Get the first message in a database.

Parameters

  [in] | dh | A handle to a database
  [out] | mh | A handle to the first message

Returns
  kvaDbOK (zero) if success
  kvaDbErr_xxx (negative) if failure

See also
  kvaDbGetNextMsg()

Examples:
  candb_sample.c.

## ◆ kvaDbGetMsgById()

KvaDbStatus kvaDbGetMsgById | ( | KvaDbHnd | dh,
|  | unsigned int | id,
|  | KvaDbMessageHnd * | mh
| ) |  |

Get a handle to a message with a specific identifier.

Parameters

  [in] | dh | A database handle
  [in] | id | The selected message identifier
  [out] | mh | A message handle

Returns
  kvaDbOK (zero) if success
  kvaDbErr_xxx (negative) if failure

See also
  kvaDbGetMsgByName()

Examples:
  candb_sample.c.

## ◆ kvaDbGetMsgByName()

KvaDbStatus kvaDbGetMsgByName | ( | KvaDbHnd | dh,
|  | const char * | msg_name,
|  | KvaDbMessageHnd * | mh
| ) |  |

Get a handle to a message with a specific name.

Parameters

  [in] | dh | A databse handle
  [in] | msg_name | The message name to search for
  [out] | mh | A message handle

Returns
  kvaDbOK (zero) if success
  kvaDbErr_xxx (negative) if failure

See also
  kvaDbGetMsgById()

Examples:
  candb_sample.c.

## ◆ kvaDbGetMsgComment()

KvaDbStatus kvaDbGetMsgComment | ( | KvaDbMessageHnd | mh,
|  | char * | buf,
|  | size_t | buflen
| ) |  |

Get the message comment.

Parameters

  [in] | mh | A message handle
  [out] | buf | The buffer that will hold the message comment
  [in] | buflen | The length of the buffer

Returns
  kvaDbOK (zero) if success
  kvaDbErr_xxx (negative) if failure

See also
  kvaDbSetMsgComment()

Examples:
  candb_sample.c.

## ◆ kvaDbGetMsgDlc()

KvaDbStatus kvaDbGetMsgDlc | ( | KvaDbMessageHnd | mh,
|  | int * | dlc
| ) |  |

Get the data length code for a message.

Parameters

  [in] | mh | A message handle
  [out] | dlc | The data length code

Returns
  kvaDbOK (zero) if success
  kvaDbErr_xxx (negative) if failure

See also
  kvaDbSetMsgDlc()

Examples:
  candb_sample.c.

## ◆ kvaDbGetMsgFlags()

KvaDbStatus kvaDbGetMsgFlags | ( | KvaDbMessageHnd | mh,
|  | unsigned int * | flags
| ) |  |

Set the message flags, KVADB_MESSAGE_xxx

Parameters

  [in] | mh | A message handle
  [out] | flags | The message flags, KVADB_MESSAGE_xxx

Returns
  kvaDbOK (zero) if success
  kvaDbErr_xxx (negative) if failure

See also
  kvaDbSetMsgFlags()

## ◆ kvaDbGetMsgId()

KvaDbStatus kvaDbGetMsgId | ( | KvaDbMessageHnd | mh,
|  | unsigned int * | id,
|  | unsigned int * | flags
| ) |  |

Get message identifier and flags. If message is of extended CAN format, its id will contain KVADB_MESSAGE_EXT flag. This call is deprecated. Consider using kvaDbGetMsgIdEx() and kvaDbGetMsgFlags() instead.

Parameters

  [in] | mh | A message handle.
  [out] | id | The identifier.
  [out] | flags | The flags, KVADB_MESSAGE_xxx

Returns
  kvaDbOK (zero) if success
  kvaDbErr_xxx (negative) if failure

See also
  kvaDbSetMsgId()

Examples:
  candb_sample.c.

## ◆ kvaDbGetMsgIdEx()

KvaDbStatus kvaDbGetMsgIdEx | ( | KvaDbMessageHnd | mh,
|  | unsigned int * | id
| ) |  |

Get the message identifier.

Parameters

  [in] | mh | A message handle
  [out] | id | The message identifier

Returns
  kvaDbOK (zero) if success
  kvaDbErr_xxx (negative) if failure

See also
  kvaDbSetMsgIdEx()

## ◆ kvaDbGetMsgMux()

KvaDbStatus kvaDbGetMsgMux | ( | KvaDbMessageHnd | mh,
|  | KvaDbSignalHnd * | sh
| ) |  |

Returns handle to a multiplexer signal of a given message. If there are no multiplexer signal, KvaDbOk will be returned and *sh will be `NULL`.

Parameters

  [in] | mh | A message handle
  [out] | sh | Multiplexer signal handle

Returns
  kvaDbOK (zero) if success
  kvaDbErr_xxx (negative) if failure

## ◆ kvaDbGetMsgName()

KvaDbStatus kvaDbGetMsgName | ( | KvaDbMessageHnd | mh,
|  | char * | buf,
|  | size_t | buflen
| ) |  |

Get the message name.

Parameters

  [in] | mh | A message handle
  [out] | buf | The buffer that will hold the message name
  [in] | buflen | The length of the buffer.

Returns
  kvaDbOK (zero) if success
  kvaDbErr_xxx (negative) if failure

See also
  kvaDbSetMsgName(), kvaDbGetMsgQualifiedName()

Examples:
  candb_sample.c.

## ◆ kvaDbGetMsgQualifiedName()

KvaDbStatus kvaDbGetMsgQualifiedName | ( | KvaDbMessageHnd | mh,
|  | char * | buf,
|  | size_t | buflen
| ) |  |

Get the qualified message name, which is the database name and the message name separated by a dot.

Parameters

  [in] | mh | A message handle
  [out] | buf | The buffer that will hold the qualified message name
  [in] | buflen | The length of the buffer

Returns
  kvaDbOK (zero) if success
  kvaDbErr_xxx (negative) if failure

See also
  kvaDbGetMsgName()

Examples:
  candb_sample.c.

## ◆ kvaDbGetMsgSendNode()

KvaDbStatus kvaDbGetMsgSendNode | ( | KvaDbMessageHnd | mh,
|  | KvaDbNodeHnd * | nh
| ) |  |

Get send node for a message

Parameters

  [in] | mh | A message handle
  [out] | nh | A node handle

Returns
  kvaDbOK (zero) if success
  kvaDbErr_xxx (negative) if failure

See also
  kvaDbSetMsgSendNode()

## ◆ kvaDbGetNextMsg()

KvaDbStatus kvaDbGetNextMsg | ( | KvaDbHnd | dh,
|  | KvaDbMessageHnd * | mh
| ) |  |

Get a handle to the next message in a database. Should be called after kvaDbGetFirstMsg().

Parameters

  [in] | dh | A database handle
  [out] | mh | A message handle

Returns
  kvaDbOK (zero) if success
  kvaDbErr_xxx (negative) if failure

See also
  kvaDbGetFirstMsg()

Examples:
  candb_sample.c.

## ◆ kvaDbMsgDlcToBytes()

KvaDbStatus kvaDbMsgDlcToBytes | ( | KvaDbProtocolType | prot,
|  | unsigned int | dlc,
|  | unsigned int * | numBytes
| ) |  |

Translates message dlc to number of bytes for a given protocol

Parameters

  [in] | prot | A protocol type
  [in] | dlc | Raw message dlc
  [out] | numBytes | Number of bytes

Returns
  kvaDbOK (zero) if success
  kvaDbErr_xxx (negative) if failure

See also
  kvaDbGetProtocol()

## ◆ kvaDbSetMsgComment()

KvaDbStatus kvaDbSetMsgComment | ( | KvaDbMessageHnd | mh,
|  | char * | buf
| ) |  |

Set the message comment.

Parameters

  [in] | mh | A message handle
  [in] | buf | The buffer that contains the message comment

Returns
  kvaDbOK (zero) if success
  kvaDbErr_xxx (negative) if failure

See also
  kvaDbGetMsgComment()

Examples:
  candb_sample.c.

## ◆ kvaDbSetMsgDlc()

KvaDbStatus kvaDbSetMsgDlc | ( | KvaDbMessageHnd | mh,
|  | int | dlc
| ) |  |

Set the data length code for a message.

Parameters

  [in] | mh | A message handle
  [in] | dlc | The data length code

Returns
  kvaDbOK (zero) if success
  kvaDbErr_xxx (negative) if failure

See also
  kvaDbGetMsgDlc()

Examples:
  candb_sample.c.

## ◆ kvaDbSetMsgFlags()

KvaDbStatus kvaDbSetMsgFlags | ( | KvaDbMessageHnd | mh,
|  | unsigned int | flags
| ) |  |

Set the message flags, KVADB_MESSAGE_xxx

Parameters

  [in] | mh | A message handle
  [in] | flags | The message flags, KVADB_MESSAGE_xxx

Returns
  kvaDbOK (zero) if success
  kvaDbErr_xxx (negative) if failure

See also
  kvaDbGetMsgFlags()

## ◆ kvaDbSetMsgId()

KvaDbStatus kvaDbSetMsgId | ( | KvaDbMessageHnd | mh,
|  | unsigned int | id,
|  | unsigned int | flags
| ) |  |

Set the message identifier and flags. If message is of extended CAN format, its id should contain KVADB_MESSAGE_EXT flag. This call is deprecated, consider using kvaDbSetMsgIdEx() and kvaDbSetMsgFlags() instead.

Parameters

  [in] | mh | A message handle
  [in] | id | The message identifier
  [in] | flags | The message flags, KVADB_MESSAGE_xxx

Returns
  kvaDbOK (zero) if success
  kvaDbErr_xxx (negative) if failure

See also
  kvaDbGetMsgId()

Examples:
  candb_sample.c.

## ◆ kvaDbSetMsgIdEx()

KvaDbStatus kvaDbSetMsgIdEx | ( | KvaDbMessageHnd | mh,
|  | unsigned int | id
| ) |  |

Set the message identifier.

Parameters

  [in] | mh | A message handle
  [in] | id | The message identifier

Returns
  kvaDbOK (zero) if success
  kvaDbErr_xxx (negative) if failure

See also
  kvaDbGetMsgIdEx()

## ◆ kvaDbSetMsgName()

KvaDbStatus kvaDbSetMsgName | ( | KvaDbMessageHnd | mh,
|  | char * | buf
| ) |  |

Set the message name.

Parameters

  [in] | mh | A message handle
  [in] | buf | The buffer that contains the message name.

Returns
  kvaDbOK (zero) if success
  kvaDbErr_xxx (negative) if failure

See also
  kvaDbGetMsgName()

Examples:
  candb_sample.c.

## ◆ kvaDbSetMsgSendNode()

KvaDbStatus kvaDbSetMsgSendNode | ( | KvaDbMessageHnd | mh,
|  | KvaDbNodeHnd | nh
| ) |  |

Set send node for a message

Parameters

  [in] | mh | A message handle
  [in] | nh | A node handle

Returns
  kvaDbOK (zero) if success
  kvaDbErr_xxx (negative) if failure

See also
  kvaDbGetMsgSendNode()