Dawn Framework 1.0
Universal data acquisition framework for embedded systems
uuid.cxx
1// dawn/src/io/uuid.cxx
2//
3// SPDX-License-Identifier: Apache-2.0
4//
5
6#include "dawn/io/uuid.hxx"
7
8#include <nuttx/board.h>
9
10using namespace dawn;
11
13{
15 {
16 DAWNERR("UUID requires DTYPE_UINT8\n");
17 return -EINVAL;
18 }
19
20 return OK;
21}
22
23size_t CIOUuid::getDataDim() const
24{
25 return CONFIG_BOARDCTL_UNIQUEID_SIZE;
26}
27
28int CIOUuid::getDataImpl(IODataCmn &data, size_t len)
29{
30 uint8_t *uuid_buf;
31 int ret;
32
33 // No batch supported
34
35 if (len != 1)
36 {
37 return -ENOTSUP;
38 }
39
40 // Get pointer to data buffer
41
42 uuid_buf = static_cast<uint8_t *>(data.getDataPtr());
43
44 // Get unique ID from board
45
46 ret = board_uniqueid(uuid_buf);
47 if (ret < 0)
48 {
49 return ret;
50 }
51
52 return OK;
53}
54
56{
57 UNUSED(data);
58
59 return -ENOTSUP;
60}
61
63{
64 // Return size in bytes (CONFIG_BOARDCTL_UNIQUEID_SIZE bytes of uint8_t)
65
66 return CONFIG_BOARDCTL_UNIQUEID_SIZE * sizeof(uint8_t);
67}
int getDataImpl(IODataCmn &data, size_t len)
Get data implementation (override in derived classes).
Definition uuid.cxx:28
int init()
One-time initialize object after bindings are resolved.
Definition uuid.cxx:12
size_t getDataSize() const
Get data size in bytes.
Definition uuid.cxx:62
int setDataImpl(IODataCmn &data)
Set data implementation (override in derived classes).
Definition uuid.cxx:55
size_t getDataDim() const
Get data vector dimension.
Definition uuid.cxx:23
uint8_t getDtype() const
Get data type field.
Definition object.cxx:175
Out-of-tree user-extension hooks for Dawn.
Definition bindable.hxx:13
Base interface for I/O data buffers (static and dynamic).
Definition idata.hxx:21
virtual void * getDataPtr(size_t batch=0)=0
Get pointer to data only (skips timestamp if present).
@ DTYPE_UINT8
Unsigned 8-bit integer (0 to 255).
Definition objectid.hxx:80