moddef-c
Loading...
Searching...
No Matches
err.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2
3/* Error codes (spec §26.3/§26.4, §32). Every fallible call returns md_err_t;
4 * MD_OK is 0 so `if (err)` reads naturally. */
5#ifndef MODDEF_ERR_H
6#define MODDEF_ERR_H
7
8typedef enum md_err {
9 MD_OK = 0,
10 MD_ERR_TRANSPORT, /* transport callback reported failure */
11 MD_ERR_PARSE, /* malformed wire data */
12 MD_ERR_NOT_FOUND, /* device profile / point id not found */
13 MD_ERR_SHORT_READ, /* register window shorter than the point */
14 MD_ERR_BUFFER, /* caller buffer too small */
15 MD_ERR_UNRESOLVED_REF, /* scale_ref/selector_ref target not in context */
16 MD_ERR_ZERO_SCALE_DEN, /* scale denominator is zero (MDE405) */
17 MD_ERR_COMPOSED_BASE, /* composed base is zero (MDE406) */
18 MD_ERR_NOT_WRITABLE, /* access mode forbids writing */
19 MD_ERR_WRONG_TYPE, /* value kind does not match the point */
20 MD_ERR_UNSUPPORTED, /* composed/packed-field encode, bad space, ... */
21 MD_ERR_CONSTRAINT_MIN, /* §11.4 below min_value */
22 MD_ERR_CONSTRAINT_MAX, /* §11.4 above max_value */
23 MD_ERR_CONSTRAINT_STEP, /* §11.4 not a multiple of step */
24 MD_ERR_CONSTRAINT_ALLOWED, /* §11.4 not in allowed_values */
25 MD_ERR_DISCOVERY, /* SunS marker / model not found (§7.3) */
26 MD_ERR_UNAVAILABLE /* §8.4 sentinel hit (typed accessors) */
28
29/* Static human-readable name, e.g. "MD_ERR_SHORT_READ". */
30const char *md_err_str(md_err_t err);
31
32#endif /* MODDEF_ERR_H */
const char * md_err_str(md_err_t err)
md_err
Definition err.h:8
@ MD_ERR_CONSTRAINT_MAX
Definition err.h:22
@ MD_ERR_TRANSPORT
Definition err.h:10
@ MD_OK
Definition err.h:9
@ MD_ERR_NOT_FOUND
Definition err.h:12
@ MD_ERR_CONSTRAINT_MIN
Definition err.h:21
@ MD_ERR_PARSE
Definition err.h:11
@ MD_ERR_COMPOSED_BASE
Definition err.h:17
@ MD_ERR_UNAVAILABLE
Definition err.h:26
@ MD_ERR_CONSTRAINT_STEP
Definition err.h:23
@ MD_ERR_CONSTRAINT_ALLOWED
Definition err.h:24
@ MD_ERR_WRONG_TYPE
Definition err.h:19
@ MD_ERR_NOT_WRITABLE
Definition err.h:18
@ MD_ERR_UNSUPPORTED
Definition err.h:20
@ MD_ERR_SHORT_READ
Definition err.h:13
@ MD_ERR_BUFFER
Definition err.h:14
@ MD_ERR_UNRESOLVED_REF
Definition err.h:15
@ MD_ERR_ZERO_SCALE_DEN
Definition err.h:16
@ MD_ERR_DISCOVERY
Definition err.h:25
enum md_err md_err_t