Wirepas SDK
attribute_frames.h
Go to the documentation of this file.
1
/* Copyright 2017 Wirepas Ltd. All Rights Reserved.
2
*
3
* See file LICENSE.txt for full license details.
4
*
5
*/
6
7
#ifndef ATTRIBUTE_FRAMES_H_
8
#define ATTRIBUTE_FRAMES_H_
9
16
/* How much space is reserved for attributes in attribute related primitive */
17
#define WAPS_MAX_ATTR_LEN 16
18
20
typedef
struct
__attribute__ ((__packed__))
21
{
22
attr_t
attr_id
;
23
}
read_req_t
;
24
26
typedef
enum
27
{
28
ATTR_SUCCESS
= 0,
29
ATTR_UNSUPPORTED_ATTRIBUTE
= 1,
30
ATTR_INVALID_STACK_STATE
= 2,
31
ATTR_INV_LENGTH
= 3,
32
ATTR_INV_VALUE
= 4,
33
ATTR_WRITE_ONLY
= 5,
34
ATTR_ACCESS_DENIED
= 6,
35
}
attribute_result_e
;
36
38
typedef
struct
__attribute__ ((__packed__))
39
{
40
uint8_t
result
;
41
attr_t
attr_id
;
42
uint8_t
attr_len
;
43
uint8_t attr[
WAPS_MAX_ATTR_LEN
];
44
}
read_cnf_t
;
45
46
#define FRAME_READ_CNF_HEADER_SIZE \
47
(sizeof(read_cnf_t)-WAPS_MAX_ATTR_LEN)
48
50
typedef
struct
__attribute__ ((__packed__))
51
{
52
attr_t
attr_id
;
53
uint8_t
attr_len
;
54
uint8_t attr[
WAPS_MAX_ATTR_LEN
];
55
}
write_req_t
;
56
57
#define FRAME_WRITE_REQ_HEADER_SIZE \
58
(sizeof(write_req_t)-WAPS_MAX_ATTR_LEN)
59
61
typedef
struct
__attribute__ ((__packed__))
62
{
63
uint8_t
result
;
64
}
write_cnf_t
;
65
66
//assert_static(sizeof(read_cnf_t) == 20);
67
//assert_static(sizeof(read_req_t) == 2);
68
//assert_static(sizeof(write_req_t) == 19);
69
//assert_static(sizeof(write_cnf_t) == 1);
70
71
typedef
union
72
{
73
read_cnf_t
read_cnf
;
74
read_req_t
read_req
;
75
write_req_t
write_req
;
76
write_cnf_t
write_cnf
;
77
}
frame_attr
;
78
79
#endif
/* ATTRIBUTE_FRAMES_H_ */
ATTR_SUCCESS
@ ATTR_SUCCESS
Definition:
attribute_frames.h:28
ATTR_INV_VALUE
@ ATTR_INV_VALUE
Definition:
attribute_frames.h:32
read_req_t
Definition:
attribute_frames.h:20
ATTR_WRITE_ONLY
@ ATTR_WRITE_ONLY
Definition:
attribute_frames.h:33
read_cnf_t::result
uint8_t result
Definition:
attribute_frames.h:40
read_cnf_t
Definition:
attribute_frames.h:38
read_req_t::attr_id
attr_t attr_id
Definition:
attribute_frames.h:22
frame_attr::read_cnf
read_cnf_t read_cnf
Definition:
attribute_frames.h:73
write_req_t
Definition:
attribute_frames.h:50
ATTR_INVALID_STACK_STATE
@ ATTR_INVALID_STACK_STATE
Definition:
attribute_frames.h:30
frame_attr::write_req
write_req_t write_req
Definition:
attribute_frames.h:75
write_cnf_t
Definition:
attribute_frames.h:61
ATTR_INV_LENGTH
@ ATTR_INV_LENGTH
Definition:
attribute_frames.h:31
read_cnf_t::attr_len
uint8_t attr_len
Definition:
attribute_frames.h:42
attribute_result_e
attribute_result_e
Definition:
attribute_frames.h:26
frame_attr
Definition:
attribute_frames.h:71
WAPS_MAX_ATTR_LEN
#define WAPS_MAX_ATTR_LEN
Definition:
attribute_frames.h:17
frame_attr::read_req
read_req_t read_req
Definition:
attribute_frames.h:74
attr_t
uint16_t attr_t
Definition:
waps_frames.h:20
ATTR_UNSUPPORTED_ATTRIBUTE
@ ATTR_UNSUPPORTED_ATTRIBUTE
Definition:
attribute_frames.h:29
frame_attr::write_cnf
write_cnf_t write_cnf
Definition:
attribute_frames.h:76
ATTR_ACCESS_DENIED
@ ATTR_ACCESS_DENIED
Definition:
attribute_frames.h:34