ProtoCore
v1.0.16
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
utmc.h
Go to the documentation of this file.
1
// ProtoCore v1.0.16 - Copyright (C) 2026 Douglas Quigg (dstroy0) <dquigg123@gmail.com>
2
// SPDX-License-Identifier: AGPL-3.0-or-later
3
4
/**
5
* @file utmc.h
6
* @brief UTMC (Urban Traffic Management and Control) common-database codec (PROTOCORE_ENABLE_UTMC).
7
*
8
* UTMC is the UK/EU modular framework for sharing traffic data across heterogeneous municipal systems.
9
* Its common-database exchange is an HTTP + XML message set: a client requests the value of an object
10
* (a detector, a sign, a signal) by its UTMC object id, and the server replies with the object's value
11
* + a data-quality flag + a timestamp. This builds the two documents over the existing HTTP stack:
12
*
13
* - **request**: `<UTMCRequest><object id="..."/></UTMCRequest>`.
14
* - **response**: `<UTMCResponse><object id=".." value=".." quality=".." timestamp=".."/></UTMCResponse>`.
15
*
16
* Values are XML-escaped. Pure text framing, zero heap, no stdlib, host-testable; the HTTP transport is
17
* the shipped server.
18
*/
19
20
#ifndef PROTOCORE_UTMC_H
21
#define PROTOCORE_UTMC_H
22
23
#include "
protocore_config.h
"
// the entry point: protocore_types.h for the widths
24
25
#if PROTOCORE_ENABLE_UTMC
26
27
PROTOCORE_BEGIN_DECLS
28
29
/** @brief UTMC data-quality flags. */
30
// UTMC value-quality codes: wire values compared, so integer constants in a namespacing struct.
31
#define UTMC_QUALITY_GOOD 0
///< the value is good.
32
#define UTMC_QUALITY_SUSPECT 1
///< the value is suspect.
33
#define UTMC_QUALITY_ABSENT 2
///< no value available.
34
35
/**
36
* @brief Build a UTMC request document for one object id. @return length written, or 0 on overflow.
37
*/
38
size_t
protocore_utmc_request(
const
char
*object_id,
char
*out,
size_t
cap);
39
40
/**
41
* @brief Build a UTMC response document for one object.
42
* @param object_id the UTMC object id (escaped).
43
* @param value the object value text (escaped).
44
* @param quality a UTMC_QUALITY_* flag.
45
* @param timestamp an ISO-8601 timestamp (escaped).
46
* @return length written, or 0 on overflow.
47
*/
48
size_t
protocore_utmc_response(
const
char
*object_id,
const
char
*value, uint8_t quality,
const
char
*timestamp,
49
char
*out,
size_t
cap);
50
51
/**
52
* @brief Extract the object id from a UTMC request document into @p out.
53
* @return the id length, or 0 if no `<object id="..."/>` is found.
54
*/
55
size_t
protocore_utmc_parse_request(
const
char
*xml,
size_t
len,
char
*out,
size_t
cap);
56
57
PROTOCORE_END_DECLS
58
59
#endif
// PROTOCORE_ENABLE_UTMC
60
61
#endif
// PROTOCORE_UTMC_H
protocore_config.h
PROTOCORE_BEGIN_DECLS
#define PROTOCORE_BEGIN_DECLS
Give a header's declarations C linkage, so their symbol names carry no parameter types.
Definition
types.h:96
PROTOCORE_END_DECLS
#define PROTOCORE_END_DECLS
Definition
types.h:97
src
services
transportation
utmc
utmc.h
Generated by
1.9.8