source: pacpussensors/trunk/CanGateway/driver/kvaser/windows/kvadblib.h@ 135

Last change on this file since 135 was 93, checked in by DHERBOMEZ Gérald, 9 years ago

move files in windows folder

File size: 45.2 KB
Line 
1/**
2 * \section LICENSE
3 * Copyright 2002-2011 by KVASER AB, SWEDEN
4 *
5 * WWW: http://www.kvaser.com
6 *
7 * This software is furnished under a license and may be used and copied
8 * only in accordance with the terms of such license.
9 *
10 * \section DESCRIPTION
11 *
12 * Definitions for the CAN Database API.
13 *
14 * \file kvaDBlib.h
15 * \author Kvaser AB
16 *
17 */
18
19#ifndef KVADBLIB_H
20#define KVADBLIB_H
21
22/**
23 * \defgroup CANDB CAN Database
24 * @{
25 */
26
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32
33/**
34 *
35 * \name kvaDbErr_xxx
36 * \anchor kvaDbErr_xxx
37 *
38 * The following codes are returned by most CANDB API calls.
39 *
40 * \note Error codes are always negative.
41 * @{
42 */
43typedef enum {
44 kvaDbOK = 0, ///< OK - no error
45 kvaDbErr_Fail = -1, ///< General failure
46 kvaDbErr_NoDatabase = -2, ///< No database was found
47 kvaDbErr_Param = -3, ///< One or more of the parameters in call is erronous
48 kvaDbErr_NoMsg = -4, ///< No message was found
49 kvaDbErr_NoSignal = -5, ///< No signal was found
50 kvaDbErr_Internal = -6, ///< An internal error occured in the library
51 kvaDbErr_DbFileOpen = -7, ///< Could not open the database file
52 kvaDbErr_DatabaseInternal = -8, ///< An internal error occured in the database handler
53 kvaDbErr_NoNode = -9, ///< Could not find the database node
54 kvaDbErr_NoAttrib = -10, ///< No attribute found
55 kvaDbErr_OnlyOneAllowed = -11, ///< Only one CANdb structure is allowed
56} KvaDbStatus;
57/** @} */
58
59/**
60 * \name Kvaser Database Message Flags
61 * \anchor KVADB_MESSAGE_xxx
62 *
63 * The following flags are never used.
64 *
65 * \todo Why are they never used?
66 * @{
67 */
68#define KVADB_MESSAGE_EXT 0x80000000 ///< Message is an extended CAN message
69#define KVADB_MESSAGE_J1939 0x00000001 ///< Message uses J1939 protocol
70#define KVADB_MESSAGE_WAKEUP 0x00000002 ///< Message is a wake-up frame, Id/msg/dlc are undefined
71/** @} */
72
73/**
74 * \name CANDBSignalEncoding API Signal Encoding
75 *
76 * The following values are used by kvaDbGetSignalEncoding() and
77 * kvaDbSetSignalEncoding()
78 * @{
79 */
80typedef enum {
81 kvaDb_Intel = 0, ///< Intel
82 kvaDb_Motorola = 1, ///< kvaDb_Motorola
83} KvaDbSignalEncoding;
84/** @} */
85
86/**
87 * \name CANDBSignalRepresentation API Signal Representation
88 *
89 * The type ::KvaDbSignalType is used by e.g. kvaDbGetSignalRepresentationType().
90 * @{
91 */
92typedef enum {
93 kvaDb_Invalid, ///< Invalid representation
94 kvaDb_Signed, ///< Signed integer
95 kvaDb_Unsigned, ///< Unsigned integer
96 kvaDb_Float, ///< Float
97 kvaDb_Double ///< Double
98} KvaDbSignalType;
99/** @} */
100
101/**
102 * \name CANDBAttributeRepresentation API Attribute Representation
103 *
104 * The type ::KvaDbAttributeType is used by e.g. kvaDbGetAttributeDefinitionType()
105 * and kvaDbGetAttributeType().
106 * @{
107 */
108typedef enum {
109 kvaDb_AttributeInvalid = 0, ///< Invalid attribute
110 kvaDb_AttributeInteger = 1, ///< Integer attribute
111 kvaDb_AttributeFloat = 3, ///< Float attribute
112 kvaDb_AttributeEnumeration = 4, ///< Enumeration attribute
113 kvaDb_AttributeString = 5, ///< String attribute
114} KvaDbAttributeType;
115/** @} */
116
117/**
118 * \name CANDBAttributeOwner API Attribute Owner
119 *
120 * The type ::KvaDbAttributeOwnerType is used by e.g. kvaDbGetAttributeDefinitionOwner(),
121 * @{
122 */
123typedef enum {
124 kvaDb_AttributeOwnerInvalid = 0, ///< Invalid owner
125 kvaDb_AttributeOwnerDb = 1, ///< Database owner
126 kvaDb_AttributeOwnerMessage = 2, ///< Message owner
127 kvaDb_AttributeOwnerNode = 3, ///< Node owner
128 kvaDb_AttributeOwnerSignal = 4, ///< Signal owner
129 kvaDb_AttributeOwnerEnv = 5, ///< Environment owner
130} KvaDbAttributeOwner;
131/** @} */
132
133// Database flags
134
135/**
136 * \name CANDBDatabaseFlags API Database Flags
137 * \anchor KVADB_DATABASE_xxx
138 *
139 * The following value is used by kvaDbGetFlags().
140 * @{
141 */
142#define KVADB_DATABASE_J1939 0x0001 ///< The database uses the J1939 protocol
143
144typedef void* KvaDbHnd; ///< Database handle
145typedef void* KvaDbMessageHnd; ///< Message handle
146typedef void* KvaDbSignalHnd; ///< Signal handle
147typedef void* KvaDbNodeHnd; ///< Node handle
148typedef void* KvaDbAttributeHnd; ///< Attribute handle
149typedef void* KvaDbAttributeDefHnd; ///< Attribute definition handle
150/** @} */
151
152/**
153 * \name Kvaser Database Multiplexer Mode values
154 * \anchor KVADB_MUX_xxx
155 * @{
156*/
157#define KVADB_MUX_SIGNAL -2 ///< Multiplex mode value of a multiplexer signal
158#define KVADB_MUX_INDEPENDENT -1 ///< Miltiplex mode value of an independent signal
159/** @} */
160
161/**
162 * This function creates a new database handle.
163 *
164 * \param[out] dh A handle to a new database
165 *
166 * \return ::kvaDbOK (zero) if success
167 * \return \ref kvaDbErr_xxx (negative) if failure
168 *
169 * \sa kvaDbClose()
170 */
171KvaDbStatus WINAPI kvaDbOpen(KvaDbHnd *dh);
172
173/**
174 * This loads a database file into a handle created with kvaDbOpen().
175 *
176 * \note This function is deprecated and will be replaced by kvaDbCreate()
177 *
178 * \param[in] dh A handle database handle
179 * \param[in] filename A database file
180 *
181 * \return ::kvaDbOK (zero) if success
182 * \return \ref kvaDbErr_xxx (negative) if failure
183 *
184 * \sa kvaDbCreate()
185 */
186KvaDbStatus WINAPI kvaDbAddFile(KvaDbHnd dh, const char *filename);
187
188/**
189 * This function creates a new database in a handle created with
190 * kvaDbOpen(). It is used when there is no file to read data from.
191 *
192 * \note This function is deprecated and will be replaced by kvaDbCreate().
193 *
194 * \param[in] dh A database handle
195 * \param[in] filename The the dummy filename to use for this database
196 *
197 * \return ::kvaDbOK (zero) if success
198 * \return \ref kvaDbErr_xxx (negative) if failure
199 *
200 * \sa kvaDbCreate()
201 */
202KvaDbStatus WINAPI kvaDbSetDummyFileName(KvaDbHnd dh, const char *filename);
203
204/**
205 * This function creates a new database in a handle created with
206 * kvaDbOpen(). There are three ways to call this function:
207 *
208 * \li To load data from an existing database file, set \a localName to \c NULL
209 * and set \a filename to the database file.
210 *
211 * \li To add an empty database, set \a localName to any name and set \a
212 * filename to \c NULL.
213 *
214 * \li To load data from an existing database file and give it a new name, set
215 * \a localName to the new name and set \a filename to the database file.
216 *
217 * \param[in] dh A database handle
218 * \param[in] localName The name of the database or \c NULL
219 * \param[in] filename The database file or \c NULL
220 *
221 * \return ::kvaDbOK (zero) if success
222 * \return \ref kvaDbErr_xxx (negative) if failure
223 *
224 * \sa kvaDbOpen()
225 */
226KvaDbStatus WINAPI kvaDbCreate(KvaDbHnd dh, const char *localName, const char *filename);
227
228/**
229 * This function closes an open database handle.
230 *
231 * \param[in] dh A handle to a database
232 *
233 * \return ::kvaDbOK (zero) if success
234 * \return \ref kvaDbErr_xxx (negative) if failure
235 *
236 * \sa kvaDbOpen()
237 */
238KvaDbStatus WINAPI kvaDbClose(KvaDbHnd dh);
239
240/**
241 * Write a database to file.
242 *
243 * \param[in] dh A handle to a database
244 * \param[in] filename The name of the database file
245 *
246 * \return ::kvaDbOK (zero) if success
247 * \return \ref kvaDbErr_xxx (negative) if failure
248 *
249 * \sa kvaDbReadFile()
250 */
251KvaDbStatus WINAPI kvaDbWriteFile(KvaDbHnd dh, char* filename);
252
253/**
254 * Load a database from file into a handle created with kvaDbOpen().
255 *
256 * \param[out] dh A handle to a database
257 * \param[in] filename The name of the database file.
258 *
259 * \return ::kvaDbOK (zero) if success
260 * \return \ref kvaDbErr_xxx (negative) if failure
261 *
262 * \sa kvaDbCreate()
263 */
264KvaDbStatus WINAPI kvaDbReadFile(KvaDbHnd dh, char* filename);
265
266/**
267 * Get the database flags.
268 *
269 * \param[in] dh A handle to a database
270 * \param[out] flags The database flags, \ref KVADB_DATABASE_xxx
271 *
272 * \return ::kvaDbOK (zero) if success
273 * \return \ref kvaDbErr_xxx (negative) if failure
274 *
275 * \sa kvaDbReadFile()
276 *
277 * \todo check kvaDbReadFile(), we should perhaps link to kvaDbCreate()?
278 */
279KvaDbStatus WINAPI kvaDbGetFlags(KvaDbHnd dh, unsigned int *flags);
280
281/**
282 * Get the first message in a database.
283 *
284 * \param[in] dh A handle to a database
285 * \param[out] mh A handle to the first message
286 *
287 * \return ::kvaDbOK (zero) if success
288 * \return \ref kvaDbErr_xxx (negative) if failure
289 *
290 * \sa kvaDbGetNextMsg()
291 */
292KvaDbStatus WINAPI kvaDbGetFirstMsg(KvaDbHnd dh, KvaDbMessageHnd *mh);
293
294/**
295 * Get a handle to the next message in a database. Should be called after
296 * kvaDbGetFirstMsg().
297 *
298 * \param[in] dh A database handle
299 * \param[out] mh A message handle
300 *
301 * \return ::kvaDbOK (zero) if success
302 * \return \ref kvaDbErr_xxx (negative) if failure
303 *
304 * \sa kvaDbGetFirstMsg()
305 */
306KvaDbStatus WINAPI kvaDbGetNextMsg(KvaDbHnd dh, KvaDbMessageHnd *mh);
307
308/**
309 * Get a handle to a message with a specific identifier.
310 *
311 * \param[in] dh A database handle
312 * \param[in] id The selected message identifier
313 * \param[out] mh A message handle
314 *
315 * \return ::kvaDbOK (zero) if success
316 * \return \ref kvaDbErr_xxx (negative) if failure
317 *
318 * \sa kvaDbGetMsgByName()
319 */
320KvaDbStatus WINAPI kvaDbGetMsgById(KvaDbHnd dh,
321 unsigned int id,
322 KvaDbMessageHnd *mh);
323
324/**
325 * Get a handle to a message with a specific name.
326 *
327 * \param[in] dh A databse handle
328 * \param[in] msg_name The message name to search for
329 * \param[out] mh A message handle
330 *
331 * \return ::kvaDbOK (zero) if success
332 * \return \ref kvaDbErr_xxx (negative) if failure
333 *
334 * \sa kvaDbGetMsgById()
335 */
336KvaDbStatus WINAPI kvaDbGetMsgByName(KvaDbHnd dh,
337 const char *msg_name,
338 KvaDbMessageHnd *mh);
339
340/**
341 * Get the message name.
342 *
343 * \param[in] mh A message handle
344 * \param[out] buf The buffer that will hold the message name
345 * \param[in] buflen The length of the buffer.
346 *
347 * \return ::kvaDbOK (zero) if success
348 * \return \ref kvaDbErr_xxx (negative) if failure
349 *
350 * \sa kvaDbSetMsgName(), kvaDbGetMsgQualifiedName()
351 */
352KvaDbStatus WINAPI kvaDbGetMsgName(KvaDbMessageHnd mh, char *buf, size_t buflen);
353
354/**
355 * Get the qualified message name, which is the database name and the message
356 * name separated by a dot.
357 *
358 * \param[in] mh A message handle
359 * \param[out] buf The buffer that will hold the qualified message name
360 * \param[in] buflen The length of the buffer
361 *
362 * \return ::kvaDbOK (zero) if success
363 * \return \ref kvaDbErr_xxx (negative) if failure
364 *
365 * \sa kvaDbGetMsgName()
366 */
367KvaDbStatus WINAPI kvaDbGetMsgQualifiedName(KvaDbMessageHnd mh, char *buf, size_t buflen);
368
369/**
370 * Get the message comment.
371 *
372 * \param[in] mh A message handle
373 * \param[out] buf The buffer that will hold the message comment
374 * \param[in] buflen The length of the buffer
375 *
376 * \return ::kvaDbOK (zero) if success
377 * \return \ref kvaDbErr_xxx (negative) if failure
378 *
379 * \sa kvaDbSetMsgComment()
380 */
381KvaDbStatus WINAPI kvaDbGetMsgComment(KvaDbMessageHnd mh, char *buf, size_t buflen);
382
383/**
384 * Get message identifier and flags.
385 *
386 * \param[in] mh A message handle.
387 * \param[out] id The identifier.
388 * \param[out] flags The flags, \ref KVADB_MESSAGE_xxx
389 *
390 * \return ::kvaDbOK (zero) if success
391 * \return \ref kvaDbErr_xxx (negative) if failure
392 *
393 * \todo "flags" contains extended? or use 0x80000000 convention?
394 * could also contain J1939 flag, wakeup etc. qqq
395 *
396 * \sa kvaDbSetMsgId()
397 */
398KvaDbStatus WINAPI kvaDbGetMsgId(KvaDbMessageHnd mh,
399 unsigned int *id,
400 unsigned int *flags);
401
402/**
403 * Get the data length code for a message.
404 *
405 * \param[in] mh A message handle
406 * \param[out] dlc The data length code
407 *
408 * \return ::kvaDbOK (zero) if success
409 * \return \ref kvaDbErr_xxx (negative) if failure
410 *
411 * \sa kvaDbSetMsgDlc()
412 */
413KvaDbStatus WINAPI kvaDbGetMsgDlc(KvaDbMessageHnd mh, int *dlc);
414
415/**
416 * Add a new message to a database.
417 *
418 * \param[in] dh A database handle
419 * \param[out] mh A handle to the new message
420 *
421 * \return ::kvaDbOK (zero) if success
422 * \return \ref kvaDbErr_xxx (negative) if failure
423 *
424 * \sa kvaDbDeleteMsg()
425 */
426KvaDbStatus WINAPI kvaDbAddMsg(KvaDbHnd dh, KvaDbMessageHnd *mh);
427
428/**
429 * Delete a message from a database.
430 *
431 * \param[in] dh A database handle
432 * \param[in] mh A handle to the message that will be deleted
433 *
434 * \return ::kvaDbOK (zero) if success
435 * \return \ref kvaDbErr_xxx (negative) if failure
436 *
437 * \sa kvaDbAddMsg()
438 */
439KvaDbStatus WINAPI kvaDbDeleteMsg(KvaDbHnd dh, KvaDbMessageHnd mh);
440
441/**
442 * Set the database flags.
443 *
444 * \note This feature is currently not enabled.
445 *
446 * \param[in] dh A database handle
447 * \param[in] flags The flags to set, \ref KVADB_MESSAGE_xxx
448 *
449 * \return ::kvaDbOK (zero) if success
450 * \return \ref kvaDbErr_xxx (negative) if failure
451 *
452 * \sa kvaDbGetFlags()
453 */
454KvaDbStatus WINAPI kvaDbSetFlags(KvaDbHnd dh, unsigned int flags);
455
456/**
457 * Set the message name.
458 *
459 * \param[in] mh A message handle
460 * \param[in] buf The buffer that contains the message name.
461 *
462 * \return ::kvaDbOK (zero) if success
463 * \return \ref kvaDbErr_xxx (negative) if failure
464 *
465 * \sa kvaDbGetMsgName()
466 */
467KvaDbStatus WINAPI kvaDbSetMsgName(KvaDbMessageHnd mh, char *buf);
468
469/**
470 * Set the message comment.
471 *
472 * \param[in] mh A message handle
473 * \param[in] buf The buffer that contains the message comment
474 *
475 * \return ::kvaDbOK (zero) if success
476 * \return \ref kvaDbErr_xxx (negative) if failure
477 *
478 * \sa kvaDbGetMsgComment()
479 */
480KvaDbStatus WINAPI kvaDbSetMsgComment(KvaDbMessageHnd mh, char *buf);
481
482/**
483 * Set the message identifier and flags.
484 *
485 * \param[in] mh A message handle
486 * \param[in] id The message identifier
487 * \param[in] flags The message flags, \ref KVADB_MESSAGE_xxx
488 *
489 * \return ::kvaDbOK (zero) if success
490 * \return \ref kvaDbErr_xxx (negative) if failure
491 *
492 * \todo "flags" contains extended? or use 0x80000000 convention?
493 * could also contain J1939 flag, wakeup etc. qqq
494 *
495 * \sa kvaDbGetMsgId()
496 */
497KvaDbStatus WINAPI kvaDbSetMsgId(KvaDbMessageHnd mh, unsigned int id, unsigned int flags);
498
499/**
500 * Set the data length code for a message.
501 *
502 * \param[in] mh A message handle
503 * \param[in] dlc The data length code
504 *
505 * \return ::kvaDbOK (zero) if success
506 * \return \ref kvaDbErr_xxx (negative) if failure
507 *
508 * \sa kvaDbGetMsgDlc()
509 */
510KvaDbStatus WINAPI kvaDbSetMsgDlc(KvaDbMessageHnd mh, int dlc);
511
512// qqq pragma för att sätta sizeof(enum) till 4? annars skippa enum...
513
514// J1939 fungerar hur? Helt enkelt genom att id == PGN? Hur hantera
515// SA, DA, etc? qqq
516
517/**
518 * Returns handle to a multiplexer signal of a given message
519 *
520 * \param[in] mh A message handle
521 * \param[out] shh Multiplexer signal handle
522 *
523 * \return ::kvaDbOK (zero if success
524 * \return \ref kvaDbErr_xxx (negative) if failure
525 */
526
527KvaDbStatus WINAPI kvaDbGetMsgMux(KvaDbMessageHnd mh, KvaDbSignalHnd *shh);
528
529/**
530 * Get the first signal in a message.
531 *
532 * \param[in] mh A message handle
533 * \param[out] sh A handle to the first signal
534 *
535 * \return ::kvaDbOK (zero) if success
536 * \return \ref kvaDbErr_xxx (negative) if failure
537 *
538 * \sa kvaDbGetNextSignal()
539 */
540
541KvaDbStatus WINAPI kvaDbGetFirstSignal(KvaDbMessageHnd mh, KvaDbSignalHnd *sh);
542
543/**
544 * Get the next signal in a message. Should be called after
545 * kvaDbGetFirstSignal().
546 *
547 * \param[in] mh A message handle
548 * \param[out] sh A handle to the next signal
549 *
550 * \return ::kvaDbOK (zero) if success
551 * \return \ref kvaDbErr_xxx (negative) if failure
552 *
553 * \sa kvaDbGetFirstSignal
554 */
555KvaDbStatus WINAPI kvaDbGetNextSignal(KvaDbMessageHnd mh, KvaDbSignalHnd *sh);
556
557/**
558 * Get a signal handle by seaching for the signals's name.
559 *
560 * \param[in] mh A message handle
561 * \param[in] buf The buffer that contains the name of the signal to search for
562 * \param[out] sh A handle to the signal
563 *
564 * \return ::kvaDbOK (zero) if success
565 * \return \ref kvaDbErr_xxx (negative) if failure
566 *
567 * \sa kvaDbGetFirstMsg()
568 */
569KvaDbStatus WINAPI kvaDbGetSignalByName(KvaDbMessageHnd mh, char *buf, KvaDbSignalHnd *sh);
570
571/**
572 * Sets signal's multiplex mode. If value is equal to KVADB_MUX_SIGNAL, marks signal as a multiplexer.
573 *
574 * \param[in] sh A signal handle
575 * \param[in] mux Signal's multiplex mode
576 *
577 * \return ::kvaDbOK (zero if success
578 * \return \ref kvaDbErr_xxx (negative) if failure
579 * \sa \ref KVADB_MUX_xxx
580 */
581
582KvaDbStatus WINAPI kvaDbSetSignalMode(KvaDbSignalHnd sh, int mux);
583
584/**
585 * Sets mux to multiplexer mode value of given signal.
586 * See \ref KVADB_MUX_xxx for special (negative) values of multiplexer mode.
587 *
588 * \param[in] sh A signal handle
589 * \param[out] mux Signal's multiplex mode
590 *
591 * \return ::kvaDbOK (zero if success
592 * \return \ref kvaDbErr_xxx (negative) if failure
593 * \sa \ref KVADB_MUX_xxx
594*/
595
596KvaDbStatus WINAPI kvaDbGetSignalMode(KvaDbSignalHnd sh, int *mux);
597
598/**
599 * Convert data to a signal's physical (floating-point) value.
600 *
601 * \param[in] sh A signal handle
602 * \param[out] f The converted value
603 * \param[in] data The data buffer to be converted
604 * \param[in] len The length of the data buffer
605 *
606 * \return ::kvaDbOK (zero) if success
607 * \return \ref kvaDbErr_xxx (negative) if failure
608 *
609 * \sa kvaDbStoreSignalValuePhys()
610 */
611
612KvaDbStatus WINAPI kvaDbGetSignalValueFloat(KvaDbSignalHnd sh, double *f, void *data, size_t len);
613
614/**
615 * Convert data to a signal's raw (integer) value.
616 *
617 * \param[in] sh A signal handle
618 * \param[out] f The converted value
619 * \param[in] data The data buffer to be converted
620 * \param[in] len The length of the data buffer
621 *
622 * \return ::kvaDbOK (zero) if success
623 * \return \ref kvaDbErr_xxx (negative) if failure
624 *
625 * \sa kvaDbStoreSignalValueRaw()
626 */
627
628KvaDbStatus WINAPI kvaDbGetSignalValueInteger(KvaDbSignalHnd sh, int *f, void *data, size_t len);
629
630/**
631 * Get the minimum and maximum values from a signal.
632 *
633 * \param[in] sh A signal handle
634 * \param[out] minval The minimum value
635 * \param[out] maxval The maximum value
636 *
637 * \return ::kvaDbOK (zero) if success
638 * \return \ref kvaDbErr_xxx (negative) if failure
639 *
640 * \sa kvaDbSetSignalValueLimits()
641 */
642KvaDbStatus WINAPI kvaDbGetSignalValueLimits(KvaDbSignalHnd sh, double *minval, double *maxval);
643
644/**
645 * Get the scale factor and offset from a signal.
646 *
647 * \param[in] sh A signal handle
648 * \param[out] factor The signal scale factor
649 * \param[out] offset The signal offset
650 *
651 * \return ::kvaDbOK (zero) if success
652 * \return \ref kvaDbErr_xxx (negative) if failure
653 *
654 * \sa kvaDbSetSignalValueScaling()
655 */
656KvaDbStatus WINAPI kvaDbGetSignalValueScaling(KvaDbSignalHnd sh, double *factor, double *offset);
657
658/**
659 * Get the size and position of the signal value.
660 *
661 * \param[in] sh A signal handle
662 * \param[out] startbit The bit where the signal value starts
663 * \param[out] length The length of the signal value in bits
664 *
665 * \return ::kvaDbOK (zero) if success
666 * \return \ref kvaDbErr_xxx (negative) if failure
667 *
668 * \sa kvaDbSetSignalValueSize()
669 */
670KvaDbStatus WINAPI kvaDbGetSignalValueSize(KvaDbSignalHnd sh, int *startbit, int *length);
671
672/**
673 * Get the signal name.
674 *
675 * \param[in] sh A signal handle
676 * \param[out] buf The signal name
677 * \param[in] buflen The length of the buffer that will hold the signal name
678 *
679 * \return ::kvaDbOK (zero) if success
680 * \return \ref kvaDbErr_xxx (negative) if failure
681 *
682 * \sa kvaDbSetSignalName()
683 */
684KvaDbStatus WINAPI kvaDbGetSignalName(KvaDbSignalHnd sh, char *buf, size_t buflen);
685
686/**
687 * Get the qualified signal name. which is the database, message ans signal
688 * names separated by dots.
689 *
690 * \param[in] sh A signal handle
691 * \param[out] buf The qualified signal name
692 * \param[in] buflen The length of the buffer that will hold the qualified
693 * signal name
694 *
695 * \return ::kvaDbOK (zero) if success
696 * \return \ref kvaDbErr_xxx (negative) if failure
697 *
698 * \sa kvaDbGetSignalName()
699 */
700KvaDbStatus WINAPI kvaDbGetSignalQualifiedName(KvaDbSignalHnd sh, char *buf, size_t buflen);
701
702/**
703 * Get the signal comment.
704 *
705 * \param[in] sh A signal handle
706 * \param[out] buf The signal comment
707 * \param[in] buflen The length of the buffer that will hold the signal comment
708 *
709 * \return ::kvaDbOK (zero) if success
710 * \return \ref kvaDbErr_xxx (negative) if failure
711 *
712 * \sa kvaDbSetSignalComment()
713 */
714KvaDbStatus WINAPI kvaDbGetSignalComment(KvaDbSignalHnd sh, char *buf, size_t buflen);
715
716/**
717 * Get the signal unit.
718 *
719 * \param[in] sh A signal handle
720 * \param[out] buf The signal unit
721 * \param[in] buflen The length of the buffer that will hold the signal unit
722 *
723 * \return ::kvaDbOK (zero) if success
724 * \return \ref kvaDbErr_xxx (negative) if failure
725 *
726 * \sa kvaDbSetSignalUnit()
727 */
728KvaDbStatus WINAPI kvaDbGetSignalUnit(KvaDbSignalHnd sh, char *buf, size_t buflen);
729
730/**
731 * Get the signal encoding.
732 *
733 * \param[in] sh A signal handle
734 * \param[out] e The signal encoding, Intel or Motorola, ::KvaDbSignalEncoding
735 *
736 * \return ::kvaDbOK (zero) if success
737 * \return \ref kvaDbErr_xxx (negative) if failure
738 *
739 * \sa kvaDbSetSignalEncoding()
740 */
741KvaDbStatus WINAPI kvaDbGetSignalEncoding(KvaDbSignalHnd sh, KvaDbSignalEncoding *e);
742
743/**
744 * Get the signal representation type.
745 *
746 * \param[in] sh A signal handle
747 * \param[out] t The signal representation type, ::KvaDbSignalType
748 *
749 * \return ::kvaDbOK (zero) if success
750 * \return \ref kvaDbErr_xxx (negative) if failure
751 *
752 * \sa kvaDbSetSignalRepresentationType()
753 */
754KvaDbStatus WINAPI kvaDbGetSignalRepresentationType(KvaDbSignalHnd sh, KvaDbSignalType *t);
755
756/**
757 * Get the signal representation type.
758 *
759 * \note This function is deprecated and will be replaced by
760 * kvaDbGetSignalRepresentationType()
761 *
762 * \param[in] sh
763 * \param[out] t The signal representation type, ::KvaDbSignalType
764 *
765 * \return ::kvaDbOK (zero) if success
766 * \return \ref kvaDbErr_xxx (negative) if failure
767 *
768 * \sa kvaDbSetSignalRepresentationType()
769 */
770KvaDbStatus WINAPI kvaDbGetSignalPresentationType(KvaDbSignalHnd sh, KvaDbSignalType *t);
771
772/**
773 * Add a new signal to a message.
774 *
775 * \param[in] mh A message handle
776 * \param[out] sh A handle to the new signal
777 *
778 * \return ::kvaDbOK (zero) if success
779 * \return \ref kvaDbErr_xxx (negative) if failure
780 *
781 * \sa kvaDbDeleteSignal()
782 */
783KvaDbStatus WINAPI kvaDbAddSignal(KvaDbMessageHnd mh, KvaDbSignalHnd *sh);
784
785/**
786 * Delete a signal from a message.
787 *
788 * \param[in] mh A message handle
789 * \param[in] sh A handle to the signal to delete
790 *
791 * \return ::kvaDbOK (zero) if success
792 * \return \ref kvaDbErr_xxx (negative) if failure
793 *
794 * \sa kvaDbAddSignal()
795 */
796KvaDbStatus WINAPI kvaDbDeleteSignal(KvaDbMessageHnd mh, KvaDbSignalHnd sh);
797
798/**
799 * Set the value limits for a signal.
800 *
801 * \param[in] sh A signal handle
802 * \param[in] minval The minimum signal value
803 * \param[in] maxval The maximum signal value
804 *
805 * \return ::kvaDbOK (zero) if success
806 * \return \ref kvaDbErr_xxx (negative) if failure
807 *
808 * \sa kvaDbGetSignalValueLimits()
809 */
810KvaDbStatus WINAPI kvaDbSetSignalValueLimits(KvaDbSignalHnd sh,
811 double minval,
812 double maxval);
813
814/**
815 * Set the scale factor and offset for a signal.
816 *
817 * \param[in] sh A signal handle
818 * \param[in] factor The scale factor for the signal value
819 * \param[in] offset The offset for the signal value
820 *
821 * \return ::kvaDbOK (zero) if success
822 * \return \ref kvaDbErr_xxx (negative) if failure
823 *
824 * \sa kvaDbGetSignalValueScaling()
825 */
826KvaDbStatus WINAPI kvaDbSetSignalValueScaling(KvaDbSignalHnd sh,
827 double factor,
828 double offset);
829
830/**
831 * Set the value position and size for a signal.
832 *
833 * \param[in] sh A signal handle
834 * \param[in] startbit The starting bit of the signal's value
835 * \param[in] length The length of the value in bits
836 *
837 * \return ::kvaDbOK (zero) if success
838 * \return \ref kvaDbErr_xxx (negative) if failure
839 *
840 * \sa kvaDbGetSignalValueSize()
841 */
842KvaDbStatus WINAPI kvaDbSetSignalValueSize(KvaDbSignalHnd sh,
843 int startbit,
844 int length);
845
846/**
847 * Set the signal name.
848 *
849 * \param[in] sh A signal handle
850 * \param[in] buf The buffer that contains the signal name
851 *
852 * \return ::kvaDbOK (zero) if success
853 * \return \ref kvaDbErr_xxx (negative) if failure
854 *
855 * \sa kvaDbGetSignalName()
856 */
857KvaDbStatus WINAPI kvaDbSetSignalName(KvaDbSignalHnd sh, char *buf);
858
859/**
860 * Set the signal comment.
861 *
862 * \param[in] sh A signal handle
863 * \param[in] buf The buffer that contains the signal comment
864 *
865 * \return ::kvaDbOK (zero) if success
866 * \return \ref kvaDbErr_xxx (negative) if failure
867 *
868 * \sa kvaDbGetSignalComment()
869 */
870KvaDbStatus WINAPI kvaDbSetSignalComment(KvaDbSignalHnd sh, char *buf);
871
872/**
873 * Set the signal unit.
874 *
875 * \param[in] sh A signal handle
876 * \param[in] buf The buffer that contains the unit for the signal
877 *
878 * \return ::kvaDbOK (zero) if success
879 * \return \ref kvaDbErr_xxx (negative) if failure
880 *
881 * \sa kvaDbGetSignalUnit()
882 */
883KvaDbStatus WINAPI kvaDbSetSignalUnit(KvaDbSignalHnd sh, char *buf);
884
885/**
886 * Set the signal encoding.
887 *
888 * \param[in] sh A signal handle
889 * \param[in] e The signal encoding, Intel or Motorola, ::KvaDbSignalEncoding
890 *
891 * \return ::kvaDbOK (zero) if success
892 * \return \ref kvaDbErr_xxx (negative) if failure
893 *
894 * \sa kvaDbGetSignalEncoding()
895 */
896KvaDbStatus WINAPI kvaDbSetSignalEncoding(KvaDbSignalHnd sh, KvaDbSignalEncoding e);
897
898/**
899 * Set the signal representation type.
900 *
901 * \param[in] sh A signal handle
902 * \param[in] t The signal representation type, ::KvaDbSignalType
903 *
904 * \return ::kvaDbOK (zero) if success
905 * \return \ref kvaDbErr_xxx (negative) if failure
906 *
907 * \sa kvaDbGetSignalRepresentationType()
908 */
909KvaDbStatus WINAPI kvaDbSetSignalRepresentationType(KvaDbSignalHnd sh, KvaDbSignalType t);
910
911/**
912 * Get the first node.
913 *
914 * \param[in] dh A database handle
915 * \param[out] nh A node handle
916 *
917 * \return ::kvaDbOK (zero) if success
918 * \return \ref kvaDbErr_xxx (negative) if failure
919 *
920 * \sa kvaDbGetNextNode()
921 */
922KvaDbStatus WINAPI kvaDbGetFirstNode(KvaDbHnd dh, KvaDbNodeHnd *nh);
923
924/**
925 * Get the next node. Should be called after kvaDbGetFirstNode().
926 *
927 * \param[in] dh A database handle
928 * \param[out] nh A handle to the next node
929 *
930 * \return ::kvaDbOK (zero) if success
931 * \return \ref kvaDbErr_xxx (negative) if failure
932 *
933 * \sa kvaDbGetNodeByName()
934 */
935KvaDbStatus WINAPI kvaDbGetNextNode(KvaDbHnd dh, KvaDbNodeHnd *nh);
936
937/**
938 * Get a node by seaching for the node's name.
939 *
940 * \param[in] dh A database handle
941 * \param[in] node_name The buffer that contains the node name to search for
942 * \param[out] nh A node handle
943 *
944 * \return ::kvaDbOK (zero) if success
945 * \return \ref kvaDbErr_xxx (negative) if failure
946 *
947 * \sa kvaDbGetNodeAttributeIntByName()
948 */
949KvaDbStatus WINAPI kvaDbGetNodeByName(KvaDbHnd dh, const char *node_name, KvaDbNodeHnd *nh);
950
951/**
952 * Get the value of a node attribute as an integer.
953 *
954 * \param[in] nh A node handle
955 * \param[in] attrName The buffer that contains the attribute name
956 * \param[out] val The value of the attribute
957 *
958 * \return ::kvaDbOK (zero) if success
959 * \return \ref kvaDbErr_xxx (negative) if failure
960 *
961 * \sa kvaDbGetFirstNode()
962 */
963KvaDbStatus WINAPI kvaDbGetNodeAttributeIntByName(KvaDbNodeHnd nh, const char *attrName, int *val);
964
965/**
966 * Add a new node to a database.
967 *
968 * \param[in] dh A database handle
969 * \param[out] nh A handle to the new node
970 *
971 * \return ::kvaDbOK (zero) if success
972 * \return \ref kvaDbErr_xxx (negative) if failure
973 */
974KvaDbStatus WINAPI kvaDbAddNode(KvaDbHnd dh, KvaDbNodeHnd *nh);
975
976/**
977 * Delete a node from a database.
978 *
979 * \param[in] dh A database handle
980 * \param[in] nh A handle to the node that will be deleted
981 *
982 * \return ::kvaDbOK (zero) if success
983 * \return \ref kvaDbErr_xxx (negative) if failure
984 */
985KvaDbStatus WINAPI kvaDbDeleteNode(KvaDbHnd dh, KvaDbNodeHnd nh);
986
987/**
988 * Set the node name.
989 *
990 * \param[in] nh A node handle
991 * \param[in] buf The buffer that contains the node name
992 *
993 * \return ::kvaDbOK (zero) if success
994 * \return \ref kvaDbErr_xxx (negative) if failure
995 */
996KvaDbStatus WINAPI kvaDbSetNodeName(KvaDbNodeHnd nh, char *buf);
997
998/**
999 * Get the node name.
1000 *
1001 * \param[in] nh A node handle
1002 * \param[out] buf The buffer that will contain the node name
1003 * \param[in] buflen The length of the data buffer
1004 *
1005 * \return ::kvaDbOK (zero) if success
1006 * \return \ref kvaDbErr_xxx (negative) if failure
1007 */
1008KvaDbStatus WINAPI kvaDbGetNodeName(KvaDbNodeHnd nh, char *buf, size_t buflen);
1009
1010/**
1011 * Set the node comment.
1012 *
1013 * \param[in] nh A node handle
1014 * \param[in] buf The buffer that contains the node comment
1015 *
1016 * \return ::kvaDbOK (zero) if success
1017 * \return \ref kvaDbErr_xxx (negative) if failure
1018 */
1019KvaDbStatus WINAPI kvaDbSetNodeComment(KvaDbNodeHnd nh, char *buf);
1020
1021/**
1022 * Add a receiving node to a signal.
1023 *
1024 * \param[in] sh A signal handle
1025 * \param[in] nh A node handle
1026 *
1027 * \return ::kvaDbOK (zero) if success
1028 * \return \ref kvaDbErr_xxx (negative) if failure
1029 */
1030KvaDbStatus WINAPI kvaDbAddReceiveNodeToSignal(KvaDbSignalHnd sh, KvaDbNodeHnd nh);
1031
1032/**
1033 * Remove a receiving node from a signal.
1034 *
1035 * \param[in] sh A signal handle
1036 * \param[in] nh A node handle
1037 *
1038 * \return ::kvaDbOK (zero) if success
1039 * \return \ref kvaDbErr_xxx (negative) if failure
1040 */
1041KvaDbStatus WINAPI kvaDbRemoveReceiveNodeFromSignal(KvaDbSignalHnd sh, KvaDbNodeHnd nh);
1042
1043/**
1044 * Convert a physical signal value to data bytes.
1045 *
1046 * \param[in] sh A signal handle
1047 * \param[out] can_data The buffer that will hold the converted value
1048 * \param[in] dlc The length of the data buffer
1049 * \param[in] value The physical signal value to convert
1050 *
1051 * \return ::kvaDbOK (zero) if success
1052 * \return \ref kvaDbErr_xxx (negative) if failure
1053 *
1054 * \sa kvaDbGetSignalValueFloat()
1055 */
1056KvaDbStatus WINAPI kvaDbStoreSignalValuePhys(KvaDbSignalHnd sh, unsigned char *can_data, int dlc, double value);
1057
1058/**
1059 * Convert a raw signal value to data bytes.
1060 *
1061 * \param[in] sh A signal handle
1062 * \param[out] can_data The buffer that will hold the converted value
1063 * \param[in] dlc The length of the data buffer
1064 * \param[in] value The raw signal value to convert
1065 *
1066 * \return ::kvaDbOK (zero) if success
1067 * \return \ref kvaDbErr_xxx (negative) if failure
1068 *
1069 * \sa kvaDbGetSignalValueInteger()
1070 */
1071KvaDbStatus WINAPI kvaDbStoreSignalValueRaw(KvaDbSignalHnd sh, unsigned char *can_data, int dlc, int value);
1072
1073/**
1074 * Get a handle to the first attribute defined in the database.
1075 *
1076 * \param[in] dh A handle to a database
1077 * \param[out] adh An attribute definition handle
1078 *
1079 * \return ::kvaDbOK (zero) if success
1080 * \return \ref kvaDbErr_xxx (negative) if failure
1081 *
1082 * \sa kvaDbGetNextAttributeDefinition()
1083 */
1084KvaDbStatus WINAPI kvaDbGetFirstAttributeDefinition(KvaDbHnd dh, KvaDbAttributeDefHnd *adh);
1085
1086/**
1087 * Get a handle to an attribute definition with specified name.
1088 *
1089 * \param[in] dh A handle to a database
1090 * \param[in] attrName The attribute name to search for
1091 * \param[out] adh An attribute definition handle
1092 *
1093 * \return ::kvaDbOK (zero) if success
1094 * \return \ref kvaDbErr_xxx (negative) if failure
1095 */
1096KvaDbStatus WINAPI kvaDbGetAttributeDefinitionByName(KvaDbHnd dh, const char *attrName, KvaDbAttributeDefHnd *adh);
1097
1098/**
1099 * Get a handle to the following attribute defined.
1100 *
1101 * \param[in] adh A handle to an attribute definition database
1102 * \param[out] nadh An attribute definition handle
1103 *
1104 * \return ::kvaDbOK (zero) if success
1105 * \return \ref kvaDbErr_xxx (negative) if failure
1106 *
1107 * \sa kvaDbGetFirstAttributeDefinition()
1108 */
1109KvaDbStatus WINAPI kvaDbGetNextAttributeDefinition(KvaDbAttributeDefHnd adh, KvaDbAttributeDefHnd *nadh);
1110
1111/**
1112 * Get the type for an attribute definition.
1113 *
1114 * \param[in] adh A handle to an attribute definition
1115 * \param[out] at The type of the attribute definition
1116 *
1117 * \return ::kvaDbOK (zero) if success
1118 * \return \ref kvaDbErr_xxx (negative) if failure
1119 *
1120 * \sa kvaDbGetAttributeDefinitionOwner()
1121 */
1122KvaDbStatus WINAPI kvaDbGetAttributeDefinitionType(KvaDbAttributeDefHnd adh, KvaDbAttributeType *at);
1123
1124/**
1125 * Get the type for an attribute definition.
1126 *
1127 * \param[in] adh A handle to an attribute definition
1128 * \param[out] ao The owner of the attribute definition
1129 *
1130 * \return ::kvaDbOK (zero) if success
1131 * \return \ref kvaDbErr_xxx (negative) if failure
1132 *
1133 * \sa kvaDbGetAttributeDefinitionType()
1134 */
1135KvaDbStatus WINAPI kvaDbGetAttributeDefinitionOwner(KvaDbAttributeDefHnd adh, KvaDbAttributeOwner *ao);
1136
1137/**
1138 * Get the name for an attribute definition.
1139 *
1140 * \param[in] adh A handle to an attribute
1141 * \param[out] buf The buffer that will hold the attribute name
1142 * \param[in] buflen The length of the buffer.
1143 *
1144 * \return ::kvaDbOK (zero) if success
1145 * \return \ref kvaDbErr_xxx (negative) if failure
1146 *
1147 * \sa kvaDbGetAttributeDefinitionType()
1148 */
1149KvaDbStatus WINAPI kvaDbGetAttributeDefinitionName(KvaDbAttributeDefHnd adh, char *buf, size_t buflen);
1150
1151/**
1152 * Get the values for an attribute definition of type integer.
1153 *
1154 * \param[in] adh A handle to an attribute definition
1155 * \param[out] def The default value of the attribute definition
1156 * \param[out] min The min value of the attribute definition
1157 * \param[out] max The max value of the attribute definition
1158 *
1159 * \return ::kvaDbOK (zero) if success
1160 * \return \ref kvaDbErr_xxx (negative) if failure
1161 */
1162KvaDbStatus WINAPI kvaDbGetAttributeDefinitionInt(KvaDbAttributeDefHnd adh, int *def, int *min, int *max);
1163
1164/**
1165 * Get the values for an attribute definition of type float.
1166 *
1167 * \param[in] adh A handle to an attribute definition
1168 * \param[out] def The default value of the attribute definition
1169 * \param[out] min The min value of the attribute definition
1170 * \param[out] max The max value of the attribute definition
1171 *
1172 * \return ::kvaDbOK (zero) if success
1173 * \return \ref kvaDbErr_xxx (negative) if failure
1174 */
1175KvaDbStatus WINAPI kvaDbGetAttributeDefinitionFloat(KvaDbAttributeDefHnd adh, float *def, float *min, float *max);
1176
1177/**
1178 * Get the value for an attribute definition of type string.
1179 *
1180 * \param[in] adh A handle to an attribute definition
1181 * \param[out] buf The buffer that holds the default value of the attribute
1182 * \param[out] buflen The length of the buffer.
1183 *
1184 * \return ::kvaDbOK (zero) if success
1185 * \return \ref kvaDbErr_xxx (negative) if failure
1186 */
1187KvaDbStatus WINAPI kvaDbGetAttributeDefinitionString(KvaDbAttributeDefHnd adh, char *buf, int buflen);
1188
1189/**
1190 * Get the value for an attribute definition of type enumeration.
1191 *
1192 * \param[in] adh A handle to an attribute definition
1193 * \param[out] def The default value of the attribute definition
1194 *
1195 * \return ::kvaDbOK (zero) if success
1196 * \return \ref kvaDbErr_xxx (negative) if failure
1197 */
1198KvaDbStatus WINAPI kvaDbGetAttributeDefinitionEnumeration(KvaDbAttributeDefHnd adh, int *def);
1199
1200/**
1201 * Add an attribute to a message.
1202 *
1203 * \param[in] mh A handle to a message
1204 * \param[in] adh A handle to an attribute definition
1205 * \param[out] ah An attribute handle
1206 *
1207 * \return ::kvaDbOK (zero) if success
1208 * \return \ref kvaDbErr_xxx (negative) if failure
1209 *
1210 * \sa kvaDbDeleteMsgAttribute()
1211 */
1212KvaDbStatus WINAPI kvaDbAddMsgAttribute(KvaDbMessageHnd mh, KvaDbAttributeDefHnd adh, KvaDbAttributeHnd *ah);
1213
1214/**
1215 * Delete an attribute from a message.
1216 *
1217 * \param[in] mh A handle to a message
1218 * \param[in] ah A handle to an attribute
1219 *
1220 * \return ::kvaDbOK (zero) if success
1221 * \return \ref kvaDbErr_xxx (negative) if failure
1222 *
1223 * \sa kvaDbAddMsgAttribute()
1224 */
1225KvaDbStatus WINAPI kvaDbDeleteMsgAttribute(KvaDbMessageHnd mh, KvaDbAttributeHnd ah);
1226
1227/**
1228 * Add an attribute to a signal.
1229 *
1230 * \param[in] sh A handle to a signal
1231 * \param[in] adh A handle to an attribute definition
1232 * \param[out] ah An attribute handle
1233 *
1234 * \return ::kvaDbOK (zero) if success
1235 * \return \ref kvaDbErr_xxx (negative) if failure
1236 *
1237 * \sa kvaDbDeleteSignalAttribute()
1238 */
1239KvaDbStatus WINAPI kvaDbAddSignalAttribute(KvaDbSignalHnd sh, KvaDbAttributeDefHnd adh, KvaDbAttributeHnd *ah);
1240
1241/**
1242 * Delete an attribute from a signal.
1243 *
1244 * \param[in] sh A handle to a signal
1245 * \param[in] ah A handle to an attribute
1246 *
1247 * \return ::kvaDbOK (zero) if success
1248 * \return \ref kvaDbErr_xxx (negative) if failure
1249 *
1250 * \sa kvaDbAddSignalAttribute()
1251 */
1252KvaDbStatus WINAPI kvaDbDeleteSignalAttribute(KvaDbSignalHnd sh, KvaDbAttributeHnd ah);
1253
1254/**
1255 * Add an attribute to a signal.
1256 *
1257 * \param[in] nh A handle to a node
1258 * \param[in] adh A handle to an attribute definition
1259 * \param[out] ah An attribute handle
1260 *
1261 * \return ::kvaDbOK (zero) if success
1262 * \return \ref kvaDbErr_xxx (negative) if failure
1263 *
1264 * \sa kvaDbDeleteNodeAttribute()
1265 */
1266KvaDbStatus WINAPI kvaDbAddNodeAttribute(KvaDbNodeHnd nh, KvaDbAttributeDefHnd adh, KvaDbAttributeHnd *ah);
1267
1268/**
1269 * Delete an attribute from a signal.
1270 *
1271 * \param[in] nh A handle to a node
1272 * \param[in] ah A handle to an attribute
1273 *
1274 * \return ::kvaDbOK (zero) if success
1275 * \return \ref kvaDbErr_xxx (negative) if failure
1276 *
1277 * \sa kvaDbAddNodeAttribute()
1278 */
1279KvaDbStatus WINAPI kvaDbDeleteNodeAttribute(KvaDbNodeHnd nh, KvaDbAttributeHnd ah);
1280
1281/**
1282 * Get a handle to the first attribute for a message.
1283 *
1284 * \param[in] mh A handle to a message
1285 * \param[out] ah An attribute definition handle
1286 *
1287 * \return ::kvaDbOK (zero) if success
1288 * \return \ref kvaDbErr_xxx (negative) if failure
1289 *
1290 * \sa kvaDbGetNextAttribute()
1291 */
1292KvaDbStatus WINAPI kvaDbGetFirstMsgAttribute(KvaDbMessageHnd mh, KvaDbAttributeHnd *ah);
1293
1294/**
1295 * Get a handle to an attribute with specified name for a message.
1296 *
1297 * \param[in] mh A handle to a message
1298 * \param[in] attrName The attribute name to search for
1299 * \param[out] ah An attribute definition handle
1300 *
1301 * \return ::kvaDbOK (zero) if success
1302 * \return \ref kvaDbErr_xxx (negative) if failure
1303 */
1304KvaDbStatus WINAPI kvaDbGetMsgAttributeByName(KvaDbMessageHnd mh, const char *attrName, KvaDbAttributeHnd *ah);
1305
1306/**
1307 * Get a handle to the first attribute for a signal.
1308 *
1309 * \param[in] sh A handle to a signal
1310 * \param[out] ah An attribute definition handle
1311 *
1312 * \return ::kvaDbOK (zero) if success
1313 * \return \ref kvaDbErr_xxx (negative) if failure
1314 *
1315 * \sa kvaDbGetNextAttribute()
1316 */
1317KvaDbStatus WINAPI kvaDbGetFirstSignalAttribute(KvaDbSignalHnd sh, KvaDbAttributeHnd *ah);
1318
1319/**
1320 * Get a handle to an attribute with specified name for a signal.
1321 *
1322 * \param[in] sh A handle to a signal
1323 * \param[in] attrName The attribute name to search for
1324 * \param[out] ah An attribute definition handle
1325 *
1326 * \return ::kvaDbOK (zero) if success
1327 * \return \ref kvaDbErr_xxx (negative) if failure
1328 */
1329KvaDbStatus WINAPI kvaDbGetSignalAttributeByName(KvaDbSignalHnd sh, const char *attrName, KvaDbAttributeHnd *ah);
1330
1331/**
1332 * Get a handle to the first attribute for a node.
1333 *
1334 * \param[in] nh A handle to a node
1335 * \param[out] ah An attribute definition handle
1336 *
1337 * \return ::kvaDbOK (zero) if success
1338 * \return \ref kvaDbErr_xxx (negative) if failure
1339 *
1340 * \sa kvaDbGetNextAttribute()
1341 */
1342KvaDbStatus WINAPI kvaDbGetFirstNodeAttribute(KvaDbNodeHnd nh, KvaDbAttributeHnd *ah);
1343
1344/**
1345 * Get a handle to an attribute with specified name for a node.
1346 *
1347 * \param[in] nh A handle to a node
1348 * \param[in] attrName The attribute name to search for
1349 * \param[out] ah An attribute definition handle
1350 *
1351 * \return ::kvaDbOK (zero) if success
1352 * \return \ref kvaDbErr_xxx (negative) if failure
1353 */
1354KvaDbStatus WINAPI kvaDbGetNodeAttributeByName(KvaDbNodeHnd nh, const char *attrName, KvaDbAttributeHnd *ah);
1355
1356/**
1357 * Get a handle to the following attribute.
1358 *
1359 * \param[in] ah A handle to an attribute
1360 * \param[out] nah An attribute handle
1361 *
1362 * \return ::kvaDbOK (zero) if success
1363 * \return \ref kvaDbErr_xxx (negative) if failure
1364 *
1365 * \sa kvaDbGetFirstMsgAttribute()
1366 * \sa kvaDbGetFirstSignalAttribute()
1367 * \sa kvaDbGetFirstNodeAttribute()
1368 */
1369KvaDbStatus WINAPI kvaDbGetNextAttribute(KvaDbAttributeHnd ah, KvaDbAttributeHnd *nah);
1370
1371/**
1372 * Get the type for an attribute.
1373 *
1374 * \param[in] ah A handle to an attribute
1375 * \param[out] at The type of the attribute
1376 *
1377 * \return ::kvaDbOK (zero) if success
1378 * \return \ref kvaDbErr_xxx (negative) if failure
1379 *
1380 * \sa kvaDbGetAttributeName()
1381 */
1382KvaDbStatus WINAPI kvaDbGetAttributeType(KvaDbAttributeHnd ah, KvaDbAttributeType *at);
1383
1384/**
1385 * Get the name for an attribute.
1386 *
1387 * \param[in] ah A handle to an attribute
1388 * \param[out] buf The buffer that will hold the attribute name
1389 * \param[in] buflen The length of the buffer.
1390 *
1391 * \return ::kvaDbOK (zero) if success
1392 * \return \ref kvaDbErr_xxx (negative) if failure
1393 *
1394 * \sa kvaDbGetAttributeType()
1395 */
1396KvaDbStatus WINAPI kvaDbGetAttributeName(KvaDbAttributeHnd adh, char *buf, size_t buflen);
1397
1398/**
1399 * Set the value for an attribute of type integer.
1400 *
1401 * \param[in] ah A handle to an attribute
1402 * \param[in] val The value to set
1403 *
1404 * \return ::kvaDbOK (zero) if success
1405 * \return \ref kvaDbErr_xxx (negative) if failure
1406 *
1407 * \sa kvaDbGetAttributeValueInt()
1408 */
1409KvaDbStatus WINAPI kvaDbSetAttributeValueInt(KvaDbAttributeHnd ah, int val);
1410
1411/**
1412 * Get the value for an attribute of type integer.
1413 *
1414 * \param[in] ah A handle to an attribute
1415 * \param[out] val The value of the attribute
1416 *
1417 * \return ::kvaDbOK (zero) if success
1418 * \return \ref kvaDbErr_xxx (negative) if failure
1419 *
1420 * \sa kvaDbSetAttributeValueInt()
1421 */
1422KvaDbStatus WINAPI kvaDbGetAttributeValueInt(KvaDbAttributeHnd ah, int *val);
1423
1424/**
1425 * Set the value for an attribute of type float.
1426 *
1427 * \param[in] ah A handle to an attribute
1428 * \param[in] val The value to set
1429 *
1430 * \return ::kvaDbOK (zero) if success
1431 * \return \ref kvaDbErr_xxx (negative) if failure
1432 *
1433 * \sa kvaDbGetAttributeValueFloat()
1434 */
1435KvaDbStatus WINAPI kvaDbSetAttributeValueFloat(KvaDbAttributeHnd ah, float val);
1436
1437/**
1438 * Get the value for an attribute of type float.
1439 *
1440 * \param[in] ah A handle to an attribute
1441 * \param[out] val The value of the attribute
1442 *
1443 * \return ::kvaDbOK (zero) if success
1444 * \return \ref kvaDbErr_xxx (negative) if failure
1445 *
1446 * \sa kvaDbSetAttributeValueFloat()
1447 */
1448KvaDbStatus WINAPI kvaDbGetAttributeValueFloat(KvaDbAttributeHnd ah, float *val);
1449
1450/**
1451 * Set the value for an attribute of type string.
1452 *
1453 * \param[in] ah A handle to an attribute
1454 * \param[in] buf The buffer that holds the attribute value
1455 * \param[in] buflen The length of the buffer.
1456 *
1457 * \return ::kvaDbOK (zero) if success
1458 * \return \ref kvaDbErr_xxx (negative) if failure
1459 *
1460 * \sa kvaDbGetAttributeValueString()
1461 */
1462KvaDbStatus WINAPI kvaDbSetAttributeValueString(KvaDbAttributeHnd ah, const char *buf, int buflen);
1463
1464/**
1465 * Get the value for an attribute of type string.
1466 *
1467 * \param[in] ah A handle to an attribute
1468 * \param[out] buf The buffer that holds the attribute value
1469 * \param[out] buflen The length of the buffer.
1470 *
1471 * \return ::kvaDbOK (zero) if success
1472 * \return \ref kvaDbErr_xxx (negative) if failure
1473 *
1474 * \sa kvaDbSetAttributeValueString()
1475 */
1476KvaDbStatus WINAPI kvaDbGetAttributeValueString(KvaDbAttributeHnd ah, char *buf, size_t buflen);
1477
1478/**
1479 * Set the value for an attribute of type enumeration.
1480 *
1481 * \param[in] ah A handle to an attribute
1482 * \param[in] val The value to set
1483 *
1484 * \return ::kvaDbOK (zero) if success
1485 * \return \ref kvaDbErr_xxx (negative) if failure
1486 *
1487 * \sa kvaDbGetAttributeValueEnumeration()
1488 */
1489KvaDbStatus WINAPI kvaDbSetAttributeValueEnumeration(KvaDbAttributeHnd ah, int val);
1490
1491/**
1492 * Get the value for an attribute of type enumeration.
1493 *
1494 * \param[in] ah A handle to an attribute
1495 * \param[out] val The value of the attribute
1496 *
1497 * \return ::kvaDbOK (zero) if success
1498 * \return \ref kvaDbErr_xxx (negative) if failure
1499 *
1500 * \sa kvaDbSetAttributeValueEnumeration()
1501 */
1502KvaDbStatus WINAPI kvaDbGetAttributeValueEnumeration(KvaDbAttributeHnd ah, int *val);
1503
1504
1505
1506#ifdef __cplusplus
1507}
1508#endif
1509
1510/** @} */
1511
1512#endif //KVADBLIB_H
Note: See TracBrowser for help on using the repository browser.