1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 20 #ifndef H_BLE_EDDYSTONE_ 21 #define H_BLE_EDDYSTONE_ 22 23 /** 24 * @brief Eddystone - BLE beacon from Google 25 * @defgroup bt_eddystone Eddystone - BLE beacon from Google 26 * @ingroup bt_host 27 * @{ 28 */ 29 30 #include <inttypes.h> 31 #ifdef __cplusplus 32 extern "C" { 33 #endif 34 35 struct ble_hs_adv_fields; 36 37 #define BLE_EDDYSTONE_MAX_UUIDS16 3 38 #define BLE_EDDYSTONE_URL_MAX_LEN 17 39 40 #define BLE_EDDYSTONE_URL_SCHEME_HTTP_WWW 0 41 #define BLE_EDDYSTONE_URL_SCHEME_HTTPS_WWW 1 42 #define BLE_EDDYSTONE_URL_SCHEME_HTTP 2 43 #define BLE_EDDYSTONE_URL_SCHEME_HTTPS 3 44 45 #define BLE_EDDYSTONE_URL_SUFFIX_COM_SLASH 0x00 46 #define BLE_EDDYSTONE_URL_SUFFIX_ORG_SLASH 0x01 47 #define BLE_EDDYSTONE_URL_SUFFIX_EDU_SLASH 0x02 48 #define BLE_EDDYSTONE_URL_SUFFIX_NET_SLASH 0x03 49 #define BLE_EDDYSTONE_URL_SUFFIX_INFO_SLASH 0x04 50 #define BLE_EDDYSTONE_URL_SUFFIX_BIZ_SLASH 0x05 51 #define BLE_EDDYSTONE_URL_SUFFIX_GOV_SLASH 0x06 52 #define BLE_EDDYSTONE_URL_SUFFIX_COM 0x07 53 #define BLE_EDDYSTONE_URL_SUFFIX_ORG 0x08 54 #define BLE_EDDYSTONE_URL_SUFFIX_EDU 0x09 55 #define BLE_EDDYSTONE_URL_SUFFIX_NET 0x0a 56 #define BLE_EDDYSTONE_URL_SUFFIX_INFO 0x0b 57 #define BLE_EDDYSTONE_URL_SUFFIX_BIZ 0x0c 58 #define BLE_EDDYSTONE_URL_SUFFIX_GOV 0x0d 59 #define BLE_EDDYSTONE_URL_SUFFIX_NONE 0xff 60 61 /** 62 * Configures the device to advertise Eddystone UID beacons. 63 * 64 * @param adv_fields The base advertisement fields to transform into 65 * an eddystone beacon. All configured fields 66 * are preserved; you probably want to clear 67 * this struct before calling this function. 68 * @param uid The 16-byte UID to advertise. 69 * @param measured_power The Measured Power (RSSI value at 0 Meter). 70 * 71 * @return 0 on success; 72 * BLE_HS_EBUSY if advertising is in progress; 73 * BLE_HS_EMSGSIZE if the specified data is too 74 * large to fit in an advertisement; 75 * Other nonzero on failure. 76 */ 77 int ble_eddystone_set_adv_data_uid(struct ble_hs_adv_fields *adv_fields, 78 void *uid, int8_t measured_power); 79 80 /** 81 * Configures the device to advertise Eddystone URL beacons. 82 * 83 * @param adv_fields The base advertisement fields to transform into 84 * an eddystone beacon. All configured fields 85 * are preserved; you probably want to clear 86 * this struct before calling this function. 87 * @param url_scheme The prefix of the URL; one of the 88 * BLE_EDDYSTONE_URL_SCHEME values. 89 * @param url_body The middle of the URL. Don't include the 90 * suffix if there is a suitable suffix code. 91 * @param url_body_len The string length of the url_body argument. 92 * @param url_suffix The suffix of the URL; one of the 93 * BLE_EDDYSTONE_URL_SUFFIX values; use 94 * BLE_EDDYSTONE_URL_SUFFIX_NONE if the suffix 95 * is embedded in the body argument. 96 * @param measured_power The Measured Power (RSSI value at 0 Meter). 97 * 98 * @return 0 on success; 99 * BLE_HS_EBUSY if advertising is in progress; 100 * BLE_HS_EMSGSIZE if the specified data is too 101 * large to fit in an advertisement; 102 * Other nonzero on failure. 103 */ 104 int ble_eddystone_set_adv_data_url(struct ble_hs_adv_fields *adv_fields, 105 uint8_t url_scheme, char *url_body, 106 uint8_t url_body_len, uint8_t suffix, 107 int8_t measured_power); 108 109 #ifdef __cplusplus 110 } 111 #endif 112 113 /** 114 * @} 115 */ 116 117 #endif 118