Openwear requires RC oscillator to be used

Fork of nRF51822 by Nordic Semiconductor

Committer:
Rohit Grover
Date:
Wed Jul 16 10:53:07 2014 +0100
Revision:
45:3c4df37ed83e
Parent:
37:c29c330d942c
add cplusplus guards for the cases where C files include the headers

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 0:eff01767de02 1 /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
bogdanm 0:eff01767de02 2 *
bogdanm 0:eff01767de02 3 * The information contained herein is property of Nordic Semiconductor ASA.
bogdanm 0:eff01767de02 4 * Terms and conditions of usage are described in detail in NORDIC
bogdanm 0:eff01767de02 5 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
bogdanm 0:eff01767de02 6 *
bogdanm 0:eff01767de02 7 * Licensees are granted free, non-transferable use of the information. NO
bogdanm 0:eff01767de02 8 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
bogdanm 0:eff01767de02 9 * the file.
bogdanm 0:eff01767de02 10 *
bogdanm 0:eff01767de02 11 */
bogdanm 0:eff01767de02 12
bogdanm 0:eff01767de02 13 /** @file
bogdanm 0:eff01767de02 14 *
bogdanm 0:eff01767de02 15 * @defgroup ble_sdk_lib_advdata Advertising Data Encoder
bogdanm 0:eff01767de02 16 * @{
bogdanm 0:eff01767de02 17 * @ingroup ble_sdk_lib
bogdanm 0:eff01767de02 18 * @brief Function for encoding the advertising data and/or scan response data, and passing them to
bogdanm 0:eff01767de02 19 * the stack.
bogdanm 0:eff01767de02 20 */
bogdanm 0:eff01767de02 21
bogdanm 0:eff01767de02 22 #ifndef BLE_ADVDATA_H__
bogdanm 0:eff01767de02 23 #define BLE_ADVDATA_H__
bogdanm 0:eff01767de02 24
bogdanm 0:eff01767de02 25 #include <stdint.h>
bogdanm 0:eff01767de02 26 #include <stdbool.h>
bogdanm 0:eff01767de02 27 #include <string.h>
bogdanm 0:eff01767de02 28 #include "ble.h"
bogdanm 0:eff01767de02 29 #include "app_util.h"
bogdanm 0:eff01767de02 30
Rohit Grover 45:3c4df37ed83e 31 #ifdef __cplusplus
Rohit Grover 45:3c4df37ed83e 32 extern "C" {
Rohit Grover 45:3c4df37ed83e 33 #endif
Rohit Grover 45:3c4df37ed83e 34
bogdanm 0:eff01767de02 35 /**@brief Advertising data name type. This contains the options available for the device name inside
bogdanm 0:eff01767de02 36 * the advertising data. */
bogdanm 0:eff01767de02 37 typedef enum
bogdanm 0:eff01767de02 38 {
bogdanm 0:eff01767de02 39 BLE_ADVDATA_NO_NAME, /**< Include no device name in advertising data. */
bogdanm 0:eff01767de02 40 BLE_ADVDATA_SHORT_NAME, /**< Include short device name in advertising data. */
bogdanm 0:eff01767de02 41 BLE_ADVDATA_FULL_NAME /**< Include full device name in advertising data. */
bogdanm 0:eff01767de02 42 } ble_advdata_name_type_t;
bogdanm 0:eff01767de02 43
bogdanm 0:eff01767de02 44 /**@brief UUID list type. */
bogdanm 0:eff01767de02 45 typedef struct
bogdanm 0:eff01767de02 46 {
bogdanm 0:eff01767de02 47 uint16_t uuid_cnt; /**< Number of UUID entries. */
bogdanm 0:eff01767de02 48 ble_uuid_t * p_uuids; /**< Pointer to UUID array entries. */
bogdanm 0:eff01767de02 49 } ble_advdata_uuid_list_t;
bogdanm 0:eff01767de02 50
bogdanm 0:eff01767de02 51 /**@brief Connection interval range structure. */
bogdanm 0:eff01767de02 52 typedef struct
bogdanm 0:eff01767de02 53 {
bogdanm 0:eff01767de02 54 uint16_t min_conn_interval; /**< Minimum Connection Interval, in units of 1.25ms, range 6 to 3200 (i.e. 7.5ms to 4s). */
bogdanm 0:eff01767de02 55 uint16_t max_conn_interval; /**< Maximum Connection Interval, in units of 1.25ms, range 6 to 3200 (i.e. 7.5ms to 4s). Value of 0xFFFF indicates no specific maximum. */
bogdanm 0:eff01767de02 56 } ble_advdata_conn_int_t;
bogdanm 0:eff01767de02 57
bogdanm 0:eff01767de02 58 /**@brief Manufacturer specific data structure. */
bogdanm 0:eff01767de02 59 typedef struct
bogdanm 0:eff01767de02 60 {
bogdanm 0:eff01767de02 61 uint16_t company_identifier; /**< Company Identifier Code. */
bogdanm 0:eff01767de02 62 uint8_array_t data; /**< Additional manufacturer specific data. */
bogdanm 0:eff01767de02 63 } ble_advdata_manuf_data_t;
bogdanm 0:eff01767de02 64
bogdanm 0:eff01767de02 65 /**@brief Service data structure. */
bogdanm 0:eff01767de02 66 typedef struct
bogdanm 0:eff01767de02 67 {
bogdanm 0:eff01767de02 68 uint16_t service_uuid; /**< Service UUID. */
bogdanm 0:eff01767de02 69 uint8_array_t data; /**< Additional service data. */
bogdanm 0:eff01767de02 70 } ble_advdata_service_data_t;
bogdanm 0:eff01767de02 71
bogdanm 0:eff01767de02 72 /**@brief Advertising data structure. This contains all options and data needed for encoding and
bogdanm 0:eff01767de02 73 * setting the advertising data. */
bogdanm 0:eff01767de02 74 typedef struct
bogdanm 0:eff01767de02 75 {
bogdanm 0:eff01767de02 76 ble_advdata_name_type_t name_type; /**< Type of device name. */
bogdanm 0:eff01767de02 77 uint8_t short_name_len; /**< Length of short device name (if short type is specified). */
bogdanm 0:eff01767de02 78 bool include_appearance; /**< Determines if Appearance shall be included. */
bogdanm 0:eff01767de02 79 uint8_array_t flags; /**< Advertising data Flags field. */
bogdanm 0:eff01767de02 80 int8_t * p_tx_power_level; /**< TX Power Level field. */
bogdanm 0:eff01767de02 81 ble_advdata_uuid_list_t uuids_more_available; /**< List of UUIDs in the 'More Available' list. */
bogdanm 0:eff01767de02 82 ble_advdata_uuid_list_t uuids_complete; /**< List of UUIDs in the 'Complete' list. */
bogdanm 0:eff01767de02 83 ble_advdata_uuid_list_t uuids_solicited; /**< List of solcited UUIDs. */
bogdanm 0:eff01767de02 84 ble_advdata_conn_int_t * p_slave_conn_int; /**< Slave Connection Interval Range. */
bogdanm 0:eff01767de02 85 ble_advdata_manuf_data_t * p_manuf_specific_data; /**< Manufacturer specific data. */
bogdanm 0:eff01767de02 86 ble_advdata_service_data_t * p_service_data_array; /**< Array of Service data structures. */
bogdanm 0:eff01767de02 87 uint8_t service_data_count; /**< Number of Service data structures. */
bogdanm 0:eff01767de02 88 } ble_advdata_t;
bogdanm 0:eff01767de02 89
bogdanm 0:eff01767de02 90 /**@brief Function for encoding and setting the advertising data and/or scan response data.
bogdanm 0:eff01767de02 91 *
bogdanm 0:eff01767de02 92 * @details This function encodes advertising data and/or scan response data based on the selections
bogdanm 0:eff01767de02 93 * in the supplied structures, and passes the encoded data to the stack.
bogdanm 0:eff01767de02 94 *
bogdanm 0:eff01767de02 95 * @param[in] p_advdata Structure for specifying the content of the advertising data.
bogdanm 0:eff01767de02 96 * Set to NULL if advertising data is not to be set.
bogdanm 0:eff01767de02 97 * @param[in] p_srdata Structure for specifying the content of the scan response data.
bogdanm 0:eff01767de02 98 * Set to NULL if scan response data is not to be set.
bogdanm 0:eff01767de02 99 *
bogdanm 0:eff01767de02 100 * @return NRF_SUCCESS on success, NRF_ERROR_DATA_SIZE if not all the requested data could fit
bogdanm 0:eff01767de02 101 * into the advertising packet. The maximum size of the advertisement packet is @ref
bogdanm 0:eff01767de02 102 * BLE_GAP_ADV_MAX_SIZE.
bogdanm 0:eff01767de02 103 *
bogdanm 0:eff01767de02 104 * @warning This API may override application's request to use the long name and use a short name
bogdanm 0:eff01767de02 105 * instead. This truncation will occur in case the long name does not fit advertisement data size.
bogdanm 0:eff01767de02 106 * Application is permitted to specify a preferred short name length in case truncation is required.
Rohit Grover 45:3c4df37ed83e 107 * For example, if the complete device name is ABCD_HRMonitor, application can specify short name
bogdanm 0:eff01767de02 108 * length to 8 such that short device name appears as ABCD_HRM instead of ABCD_HRMo or ABCD_HRMoni
bogdanm 0:eff01767de02 109 * etc if available size for short name is 9 or 12 respectively to have more apporpriate short name.
bogdanm 0:eff01767de02 110 * However, it should be noted that this is just a preference that application can specify and
Rohit Grover 45:3c4df37ed83e 111 * if the preference too large to fit in Advertisement Data, this can be further truncated.
bogdanm 0:eff01767de02 112 */
bogdanm 0:eff01767de02 113 uint32_t ble_advdata_set(const ble_advdata_t * p_advdata, const ble_advdata_t * p_srdata);
bogdanm 0:eff01767de02 114
Rohit Grover 45:3c4df37ed83e 115 #ifdef __cplusplus
Rohit Grover 45:3c4df37ed83e 116 }
Rohit Grover 45:3c4df37ed83e 117 #endif
Rohit Grover 45:3c4df37ed83e 118
bogdanm 0:eff01767de02 119 #endif // BLE_ADVDATA_H__
bogdanm 0:eff01767de02 120
bogdanm 0:eff01767de02 121 /** @} */