aboutsummaryrefslogtreecommitdiff
path: root/drive-sdk/src/eir.h
blob: 8f434bd354dc4ac11c9a9d57a32b5dc6cba5d7db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
 * Copyright (c) 2014 Anki, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef INCLUDE_eir_h
#define INCLUDE_eir_h

#include <stdint.h>
#include <stddef.h>

#include "common.h"

ANKI_BEGIN_DECL

#define BLE_ADV_RECORD_MAX_LEN  32
struct ble_adv_record {
    uint8_t type;
    uint8_t length;
    uint8_t data[30];
};
typedef struct ble_adv_record ble_adv_record_t;

/*
 * These Advertising Data types are required for parsing Anki Drive vehicle records.
 *
 * This is an incomplete list.
 * See https://www.bluetooth.org/en-us/specification/assigned-numbers/generic-access-profile
 * for all supported values
 */ 
enum ble_adv_record_type {
    ADV_TYPE_INVALID = 0,
    ADV_TYPE_FLAGS = 0x1,
    ADV_TYPE_UUID_128 = 0x7,
    ADV_TYPE_LOCAL_NAME = 0x9,
    ADV_TYPE_TX_POWER = 0xa,
    ADV_TYPE_MANUFACTURER_DATA = 0xff
};
typedef uint8_t ble_adv_record_type_t;

int ble_adv_parse_scan(const uint8_t *data, const size_t data_len, size_t *record_count, ble_adv_record_t records[]);

ANKI_END_DECL

#endif