nanobeacon 2.1.0.0
nanobeacon_adv.h
Go to the documentation of this file.
1#include "stdint.h"
2
3#define RET_OK 0
4#define RET_ERROR -1
5#define RET_INVALID_PARAMETER -2
6
7typedef struct
8{
10 uint8_t header_len;
11 uint8_t header[ 4 ];
12
13} pkt_f0_t;
14
15typedef union
16{
17 uint8_t timer_sel;
18 uint8_t rand_num_sel;
19 uint8_t sensor_idx;
20 uint8_t mts_offset;
21 uint8_t gpio_sel;
22 uint8_t plsdtct_sel;
23 uint16_t reg_addr;
24
26
27typedef struct
28{
29 uint8_t data_src;
30 uint8_t endian;
31 uint8_t encryption;
33
34 uint8_t length;
35 uint8_t msb_lsb_sel;
37
39
40 uint8_t data_offset;
41
43
44typedef union
45{
46 struct
47 {
48 uint8_t preamble : 1;
49 uint8_t num_fields : 4;
50 uint8_t sync_pattern_en : 1;
51 uint8_t rsv : 2;
52 } uni;
53 uint8_t data_buf;
54
56
57typedef union
58{
59 struct
60 {
61 uint8_t cte_en : 1;
62 uint8_t cte_len : 5;
63 uint8_t phy_rate : 2;
64 } uni;
65 uint8_t data_buf;
66
68
69typedef union
70{
71 struct
72 {
73 uint8_t eax_en : 1;
74 uint8_t key_sel : 2;
75 uint8_t rot_exp : 5;
76 } uni;
77 uint8_t data_buf;
78
80
94
95typedef union
96{
97 struct
98 {
99 uint8_t adv_type : 1;
100 uint8_t trig_source : 6;
101 } uni;
102 uint8_t data_buf;
103
105
106typedef union
107{
108 struct
109 {
110 uint8_t adv_trig_mode : 2;
111 uint8_t adv_ext_en : 1;
114 } uni;
115 uint8_t data_buf;
116
118
119typedef union
120{
121 struct
122 {
123 uint8_t adv_addr_type : 3;
124 uint8_t addr_key_sel : 5;
125 } uni;
126 uint8_t data_buf;
127
129
130typedef struct
131{
133 uint8_t gpio_source;
134 uint8_t byte2;
135 uint8_t adv_interval[ 3 ];
138 uint8_t evnt_wakeup_period[ 3 ];
139 uint8_t num_event_control[ 2 ];
141 uint8_t adv_addr[ 6 ];
142 uint8_t addr_gen_interval[ 2 ];
144
145} adv_ctl_t;
146
170
177
187
199
201
202void nanobeacon_adv_tx_set ( uint32_t tx_interval, adv_channel_ctl_t ch_ctl, adv_mode_t mode );
203
204void nanobeacon_adv_address_set ( address_type_t addr_type, uint8_t *mac_addr,
205 uint16_t addr_gen_interval, uint8_t key_idx );
206
207int32_t nanobeacon_adv_add_data ( uint8_t* data_in, uint8_t length, uint8_t encrypt_en );
208
209int32_t nanobeacon_adv_add_cnt ( uint8_t length, uint8_t big_endian, uint8_t encrypt_en );
210
211int32_t nanobeacon_adv_add_sec_cnt ( uint8_t length, uint8_t big_endian, uint8_t encrypt_en );
212
213int32_t nanobeacon_adv_add_100ms_cnt ( uint8_t length, uint8_t big_endian, uint8_t encrypt_en );
214
215int32_t nanobeacon_adv_add_gpio_stat ( uint8_t encrypt_en );
216
217int32_t nanobeacon_adv_add_vcc ( uint8_t length, uint8_t big_endian, uint8_t encrypt_en );
218
219int32_t nanobeacon_adv_add_temp ( uint8_t length, uint8_t big_endian, uint8_t encrypt_en );
220
221uint16_t nanobeacon_adv_data_to_raw ( uint8_t *buffer );
int32_t nanobeacon_adv_add_vcc(uint8_t length, uint8_t big_endian, uint8_t encrypt_en)
adv_mode_t
Definition nanobeacon_adv.h:172
@ ADV_MODE_EVENT
Definition nanobeacon_adv.h:174
@ ADV_MODE_CONTINUOUS
Definition nanobeacon_adv.h:173
adv_channel_ctl_t
Definition nanobeacon_adv.h:189
@ ADV_CH_39
Definition nanobeacon_adv.h:193
@ ADV_CH_37
Definition nanobeacon_adv.h:196
@ ADV_CH_38_39
Definition nanobeacon_adv.h:191
@ ADV_CH_37_38_39
Definition nanobeacon_adv.h:190
@ ADC_CH_37_38
Definition nanobeacon_adv.h:194
@ ADV_CH_38
Definition nanobeacon_adv.h:195
@ ADV_CH_37_39
Definition nanobeacon_adv.h:192
int32_t nanobeacon_adv_add_sec_cnt(uint8_t length, uint8_t big_endian, uint8_t encrypt_en)
adv_data_t
Definition nanobeacon_adv.h:148
@ ADV_DATA_TYPE_TAG
Definition nanobeacon_adv.h:155
@ ADV_DATA_TYPE_RAND
Definition nanobeacon_adv.h:151
@ ADV_DATA_TYPE_SENSOR
Definition nanobeacon_adv.h:154
@ ADV_DATA_TYPE_SLEEP_CNT
Definition nanobeacon_adv.h:163
@ ADV_DATA_TYPE_REG_DATA
Definition nanobeacon_adv.h:167
@ ADV_DATA_TYPE_PLSDTCT
Definition nanobeacon_adv.h:165
@ ADV_DATA_TYPE_PREDEF
Definition nanobeacon_adv.h:149
@ ADV_DATA_TYPE_TIMER
Definition nanobeacon_adv.h:150
@ ADV_DATA_TYPE_GPIO_VAL
Definition nanobeacon_adv.h:164
@ ADV_DATA_TYPE_ADV_EVNT_CNT
Definition nanobeacon_adv.h:161
@ ADV_DATA_TYPE_GPIO_CNT
Definition nanobeacon_adv.h:166
@ ADV_DATA_TYPE_TX_PWR_0M
Definition nanobeacon_adv.h:157
@ ADV_DATA_TYPE_INP_UUID
Definition nanobeacon_adv.h:158
@ ADV_DATA_TYPE_EID
Definition nanobeacon_adv.h:160
@ ADV_DATA_TYPE_VBAT
Definition nanobeacon_adv.h:153
@ ADV_DATA_TYPE_CUS_UUID
Definition nanobeacon_adv.h:159
@ ADV_DATA_TYPE_AUXPTR
Definition nanobeacon_adv.h:162
@ ADV_DATA_TYPE_MTS_DATA
Definition nanobeacon_adv.h:156
@ ADV_DATA_TYPE_TEMP
Definition nanobeacon_adv.h:152
int32_t nanobeacon_adv_add_cnt(uint8_t length, uint8_t big_endian, uint8_t encrypt_en)
int32_t nanobeacon_adv_add_100ms_cnt(uint8_t length, uint8_t big_endian, uint8_t encrypt_en)
address_type_t
Definition nanobeacon_adv.h:179
@ ADDR_PUBLIC
Definition nanobeacon_adv.h:180
@ ADDR_RANDOM_STATIC
Definition nanobeacon_adv.h:183
@ ADDR_RANDOM_NON_RESOLVABLE
Definition nanobeacon_adv.h:181
@ ADDR_NOT_PRESENT
Definition nanobeacon_adv.h:184
@ ADDR_RANDOM_RESOLVABLE
Definition nanobeacon_adv.h:182
void nanobeacon_adv_address_set(address_type_t addr_type, uint8_t *mac_addr, uint16_t addr_gen_interval, uint8_t key_idx)
int32_t nanobeacon_adv_add_temp(uint8_t length, uint8_t big_endian, uint8_t encrypt_en)
int32_t nanobeacon_adv_add_data(uint8_t *data_in, uint8_t length, uint8_t encrypt_en)
int32_t nanobeacon_adv_add_gpio_stat(uint8_t encrypt_en)
uint16_t nanobeacon_adv_data_to_raw(uint8_t *buffer)
void nanobeacon_adv_tx_set(uint32_t tx_interval, adv_channel_ctl_t ch_ctl, adv_mode_t mode)
void nanobeacon_adv_data_reset(void)
Definition nanobeacon_adv.h:131
uint8_t gpio_source
Definition nanobeacon_adv.h:133
uint8_t byte2
Definition nanobeacon_adv.h:134
adv_ctl_byte8_t byte8
Definition nanobeacon_adv.h:137
adv_ctl_byte0_t byte0
Definition nanobeacon_adv.h:132
uint16_t packet_table_location
Definition nanobeacon_adv.h:136
pkt_ctl_t pkt_ctl
Definition nanobeacon_adv.h:143
addr_private_data_t addr_private_data
Definition nanobeacon_adv.h:140
Definition nanobeacon_adv.h:82
uint32_t sync_pattern
Definition nanobeacon_adv.h:86
pkt_f0_t pkt_f0
Definition nanobeacon_adv.h:87
pkt_ctl_byte1_t byte1
Definition nanobeacon_adv.h:84
pkt_ctl_byte2_t byte2
Definition nanobeacon_adv.h:85
uint8_t * data_buffer
Definition nanobeacon_adv.h:90
pkt_ctl_byte0_t byte0
Definition nanobeacon_adv.h:83
uint8_t f1to7_cnt
Definition nanobeacon_adv.h:88
uint8_t cur_pos
Definition nanobeacon_adv.h:89
Definition nanobeacon_adv.h:8
uint8_t header_len
Definition nanobeacon_adv.h:10
uint8_t addr_not_present
Definition nanobeacon_adv.h:9
Definition nanobeacon_adv.h:28
uint8_t data_offset
Definition nanobeacon_adv.h:40
uint8_t encryption
Definition nanobeacon_adv.h:31
uint8_t endian
Definition nanobeacon_adv.h:30
uint8_t encryption_last
Definition nanobeacon_adv.h:32
uint8_t data_src
Definition nanobeacon_adv.h:29
uint8_t encryption_output_order
Definition nanobeacon_adv.h:36
uint8_t msb_lsb_sel
Definition nanobeacon_adv.h:35
uint8_t length
Definition nanobeacon_adv.h:34
pkt_fx_private_t uni
Definition nanobeacon_adv.h:38
Definition nanobeacon_adv.h:120
uint8_t addr_key_sel
Definition nanobeacon_adv.h:124
uint8_t adv_addr_type
Definition nanobeacon_adv.h:123
uint8_t data_buf
Definition nanobeacon_adv.h:126
Definition nanobeacon_adv.h:96
uint8_t adv_type
Definition nanobeacon_adv.h:99
uint8_t trig_source
Definition nanobeacon_adv.h:100
uint8_t data_buf
Definition nanobeacon_adv.h:102
Definition nanobeacon_adv.h:107
uint8_t adv_ext_en
Definition nanobeacon_adv.h:111
uint8_t adv_trig_mode
Definition nanobeacon_adv.h:110
uint8_t adv_channel_control
Definition nanobeacon_adv.h:113
uint8_t data_buf
Definition nanobeacon_adv.h:115
uint8_t secondary_adv_exist
Definition nanobeacon_adv.h:112
Definition nanobeacon_adv.h:45
uint8_t sync_pattern_en
Definition nanobeacon_adv.h:50
uint8_t rsv
Definition nanobeacon_adv.h:51
uint8_t preamble
Definition nanobeacon_adv.h:48
uint8_t num_fields
Definition nanobeacon_adv.h:49
uint8_t data_buf
Definition nanobeacon_adv.h:53
Definition nanobeacon_adv.h:58
uint8_t phy_rate
Definition nanobeacon_adv.h:63
uint8_t cte_en
Definition nanobeacon_adv.h:61
uint8_t data_buf
Definition nanobeacon_adv.h:65
uint8_t cte_len
Definition nanobeacon_adv.h:62
Definition nanobeacon_adv.h:70
uint8_t key_sel
Definition nanobeacon_adv.h:74
uint8_t data_buf
Definition nanobeacon_adv.h:77
uint8_t rot_exp
Definition nanobeacon_adv.h:75
uint8_t eax_en
Definition nanobeacon_adv.h:73
Definition nanobeacon_adv.h:16
uint16_t reg_addr
Definition nanobeacon_adv.h:23
uint8_t gpio_sel
Definition nanobeacon_adv.h:21
uint8_t timer_sel
Definition nanobeacon_adv.h:17
uint8_t mts_offset
Definition nanobeacon_adv.h:20
uint8_t rand_num_sel
Definition nanobeacon_adv.h:18
uint8_t sensor_idx
Definition nanobeacon_adv.h:19
uint8_t plsdtct_sel
Definition nanobeacon_adv.h:22