AndroidのBLEラジコンプロポアプリ「BLEPropo」と接続し、RCサーボとDCモータを制御するプログラムです。 BLE Nanoで動作を確認しています。 BLEPropo → https://github.com/lipoyang/BLEPropo

Dependencies:   BLE_API mbed

BLEを使ったAndroid用ラジコンプロポアプリ「BLEPropo」に対応するBLE Nano用ファームウェアです。
BLEPropoは、GitHubにて公開中。
https://github.com/lipoyang/BLEPropo
/media/uploads/lipoyang/blepropo_ui.png
ラジコンは、mbed HRM1017とRCサーボやDCモータを組み合わせて作ります。
/media/uploads/lipoyang/ministeer3.jpg
回路図
/media/uploads/lipoyang/ministeer3.pdf

Committer:
lipoyang
Date:
Sat Mar 14 12:02:48 2015 +0000
Revision:
5:7f89fca19a9e
-convert nRF51822 library to a folder

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lipoyang 5:7f89fca19a9e 1 /* mbed Microcontroller Library
lipoyang 5:7f89fca19a9e 2 * Copyright (c) 2006-2013 ARM Limited
lipoyang 5:7f89fca19a9e 3 *
lipoyang 5:7f89fca19a9e 4 * Licensed under the Apache License, Version 2.0 (the "License");
lipoyang 5:7f89fca19a9e 5 * you may not use this file except in compliance with the License.
lipoyang 5:7f89fca19a9e 6 * You may obtain a copy of the License at
lipoyang 5:7f89fca19a9e 7 *
lipoyang 5:7f89fca19a9e 8 * http://www.apache.org/licenses/LICENSE-2.0
lipoyang 5:7f89fca19a9e 9 *
lipoyang 5:7f89fca19a9e 10 * Unless required by applicable law or agreed to in writing, software
lipoyang 5:7f89fca19a9e 11 * distributed under the License is distributed on an "AS IS" BASIS,
lipoyang 5:7f89fca19a9e 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
lipoyang 5:7f89fca19a9e 13 * See the License for the specific language governing permissions and
lipoyang 5:7f89fca19a9e 14 * limitations under the License.
lipoyang 5:7f89fca19a9e 15 */
lipoyang 5:7f89fca19a9e 16
lipoyang 5:7f89fca19a9e 17 #include "custom_helper.h"
lipoyang 5:7f89fca19a9e 18
lipoyang 5:7f89fca19a9e 19 /*
lipoyang 5:7f89fca19a9e 20 * The current version of the soft-device doesn't handle duplicate 128-bit UUIDs
lipoyang 5:7f89fca19a9e 21 * very well. It is therefore necessary to filter away duplicates before
lipoyang 5:7f89fca19a9e 22 * passing long UUIDs to sd_ble_uuid_vs_add(). The following types and data
lipoyang 5:7f89fca19a9e 23 * structures involved in maintaining a local cache of 128-bit UUIDs.
lipoyang 5:7f89fca19a9e 24 */
lipoyang 5:7f89fca19a9e 25 typedef struct {
lipoyang 5:7f89fca19a9e 26 LongUUIDBytes_t uuid;
lipoyang 5:7f89fca19a9e 27 uint8_t type;
lipoyang 5:7f89fca19a9e 28 } converted_uuid_table_entry_t;
lipoyang 5:7f89fca19a9e 29 static const unsigned UUID_TABLE_MAX_ENTRIES = 8; /* This is the maximum number of 128-bit UUIDs with distinct bases that
lipoyang 5:7f89fca19a9e 30 * we expect to be in use; increase this limit if needed. */
lipoyang 5:7f89fca19a9e 31 static unsigned uuidTableEntries = 0; /* current usage of the table */
lipoyang 5:7f89fca19a9e 32 converted_uuid_table_entry_t convertedUUIDTable[UUID_TABLE_MAX_ENTRIES];
lipoyang 5:7f89fca19a9e 33
lipoyang 5:7f89fca19a9e 34 /**
lipoyang 5:7f89fca19a9e 35 * lookup the cache of previously converted 128-bit UUIDs to find a type value.
lipoyang 5:7f89fca19a9e 36 * @param uuid base 128-bit UUID
lipoyang 5:7f89fca19a9e 37 * @param recoveredType the type field of the 3-byte nRF's uuid.
lipoyang 5:7f89fca19a9e 38 * @return true if a match is found.
lipoyang 5:7f89fca19a9e 39 */
lipoyang 5:7f89fca19a9e 40 static bool
lipoyang 5:7f89fca19a9e 41 lookupConvertedUUIDTable(const LongUUIDBytes_t uuid, uint8_t *recoveredType)
lipoyang 5:7f89fca19a9e 42 {
lipoyang 5:7f89fca19a9e 43 unsigned i;
lipoyang 5:7f89fca19a9e 44 for (i = 0; i < uuidTableEntries; i++) {
lipoyang 5:7f89fca19a9e 45 if (memcmp(convertedUUIDTable[i].uuid, uuid, LENGTH_OF_LONG_UUID) == 0) {
lipoyang 5:7f89fca19a9e 46 *recoveredType = convertedUUIDTable[i].type;
lipoyang 5:7f89fca19a9e 47 return true;
lipoyang 5:7f89fca19a9e 48 }
lipoyang 5:7f89fca19a9e 49 }
lipoyang 5:7f89fca19a9e 50
lipoyang 5:7f89fca19a9e 51 return false;
lipoyang 5:7f89fca19a9e 52 }
lipoyang 5:7f89fca19a9e 53
lipoyang 5:7f89fca19a9e 54 static void
lipoyang 5:7f89fca19a9e 55 addToConvertedUUIDTable(const LongUUIDBytes_t uuid, uint8_t type)
lipoyang 5:7f89fca19a9e 56 {
lipoyang 5:7f89fca19a9e 57 if (uuidTableEntries == UUID_TABLE_MAX_ENTRIES) {
lipoyang 5:7f89fca19a9e 58 return; /* recovery needed; or at least the user should be warned about this fact.*/
lipoyang 5:7f89fca19a9e 59 }
lipoyang 5:7f89fca19a9e 60
lipoyang 5:7f89fca19a9e 61 memcpy(convertedUUIDTable[uuidTableEntries].uuid, uuid,LENGTH_OF_LONG_UUID);
lipoyang 5:7f89fca19a9e 62 convertedUUIDTable[uuidTableEntries].type = type;
lipoyang 5:7f89fca19a9e 63 uuidTableEntries++;
lipoyang 5:7f89fca19a9e 64 }
lipoyang 5:7f89fca19a9e 65
lipoyang 5:7f89fca19a9e 66 /**
lipoyang 5:7f89fca19a9e 67 * The nRF transport has its own 3-byte representation of a UUID. If the user-
lipoyang 5:7f89fca19a9e 68 * specified UUID is 128-bits wide, then the UUID base needs to be added to the
lipoyang 5:7f89fca19a9e 69 * soft-device and converted to a 3-byte handle before being used further. This
lipoyang 5:7f89fca19a9e 70 * function is responsible for this translation of user-specified UUIDs into
lipoyang 5:7f89fca19a9e 71 * nRF's representation.
lipoyang 5:7f89fca19a9e 72 *
lipoyang 5:7f89fca19a9e 73 * @param[in] uuid
lipoyang 5:7f89fca19a9e 74 * user-specified UUID
lipoyang 5:7f89fca19a9e 75 * @return nRF
lipoyang 5:7f89fca19a9e 76 * 3-byte UUID (containing a type and 16-bit UUID) representation
lipoyang 5:7f89fca19a9e 77 * to be used with SVC calls.
lipoyang 5:7f89fca19a9e 78 */
lipoyang 5:7f89fca19a9e 79 ble_uuid_t custom_convert_to_nordic_uuid(const UUID &uuid)
lipoyang 5:7f89fca19a9e 80 {
lipoyang 5:7f89fca19a9e 81 ble_uuid_t nordicUUID = {
lipoyang 5:7f89fca19a9e 82 .uuid = uuid.getShortUUID(),
lipoyang 5:7f89fca19a9e 83 .type = BLE_UUID_TYPE_UNKNOWN /* to be set below */
lipoyang 5:7f89fca19a9e 84 };
lipoyang 5:7f89fca19a9e 85
lipoyang 5:7f89fca19a9e 86 if (uuid.shortOrLong() == UUID::UUID_TYPE_SHORT) {
lipoyang 5:7f89fca19a9e 87 nordicUUID.type = BLE_UUID_TYPE_BLE;
lipoyang 5:7f89fca19a9e 88 } else {
lipoyang 5:7f89fca19a9e 89 if (!lookupConvertedUUIDTable(uuid.getBaseUUID(), &nordicUUID.type)) {
lipoyang 5:7f89fca19a9e 90 nordicUUID.type = custom_add_uuid_base(uuid.getBaseUUID());
lipoyang 5:7f89fca19a9e 91 addToConvertedUUIDTable(uuid.getBaseUUID(), nordicUUID.type);
lipoyang 5:7f89fca19a9e 92 }
lipoyang 5:7f89fca19a9e 93 }
lipoyang 5:7f89fca19a9e 94
lipoyang 5:7f89fca19a9e 95 return nordicUUID;
lipoyang 5:7f89fca19a9e 96 }
lipoyang 5:7f89fca19a9e 97
lipoyang 5:7f89fca19a9e 98 /**************************************************************************/
lipoyang 5:7f89fca19a9e 99 /*!
lipoyang 5:7f89fca19a9e 100 @brief Adds the base UUID to the custom service. All UUIDs used
lipoyang 5:7f89fca19a9e 101 by this service are based on this 128-bit UUID.
lipoyang 5:7f89fca19a9e 102
lipoyang 5:7f89fca19a9e 103 @note This UUID needs to be added to the SoftDevice stack before
lipoyang 5:7f89fca19a9e 104 adding the service's primary service via
lipoyang 5:7f89fca19a9e 105 'sd_ble_gatts_service_add'
lipoyang 5:7f89fca19a9e 106
lipoyang 5:7f89fca19a9e 107 @param[in] p_uuid_base A pointer to the 128-bit UUID array (8*16)
lipoyang 5:7f89fca19a9e 108
lipoyang 5:7f89fca19a9e 109 @returns The UUID type.
lipoyang 5:7f89fca19a9e 110 A return value of 0 should be considered an error.
lipoyang 5:7f89fca19a9e 111
lipoyang 5:7f89fca19a9e 112 @retval 0x00 BLE_UUID_TYPE_UNKNOWN
lipoyang 5:7f89fca19a9e 113 @retval 0x01 BLE_UUID_TYPE_BLE
lipoyang 5:7f89fca19a9e 114 @retval 0x02 BLE_UUID_TYPE_VENDOR_BEGIN
lipoyang 5:7f89fca19a9e 115
lipoyang 5:7f89fca19a9e 116 @section EXAMPLE
lipoyang 5:7f89fca19a9e 117 @code
lipoyang 5:7f89fca19a9e 118
lipoyang 5:7f89fca19a9e 119 // Take note that bytes 2/3 are blank since these are used to identify
lipoyang 5:7f89fca19a9e 120 // the primary service and individual characteristics
lipoyang 5:7f89fca19a9e 121 #define CFG_CUSTOM_UUID_BASE "\x6E\x40\x00\x00\xB5\xA3\xF3\x93\xE0\xA9\xE5\x0E\x24\xDC\xCA\x9E"
lipoyang 5:7f89fca19a9e 122
lipoyang 5:7f89fca19a9e 123 uint8_t uuid_type = custom_add_uuid_base(CFG_CUSTOM_UUID_BASE);
lipoyang 5:7f89fca19a9e 124 ASSERT(uuid_type > 0, ERROR_NOT_FOUND);
lipoyang 5:7f89fca19a9e 125
lipoyang 5:7f89fca19a9e 126 // We can now safely add the primary service and any characteristics
lipoyang 5:7f89fca19a9e 127 // for our custom service ...
lipoyang 5:7f89fca19a9e 128
lipoyang 5:7f89fca19a9e 129 @endcode
lipoyang 5:7f89fca19a9e 130 */
lipoyang 5:7f89fca19a9e 131 /**************************************************************************/
lipoyang 5:7f89fca19a9e 132 uint8_t custom_add_uuid_base(uint8_t const *const p_uuid_base)
lipoyang 5:7f89fca19a9e 133 {
lipoyang 5:7f89fca19a9e 134 ble_uuid128_t base_uuid;
lipoyang 5:7f89fca19a9e 135 uint8_t uuid_type = 0;
lipoyang 5:7f89fca19a9e 136
lipoyang 5:7f89fca19a9e 137 /* Reverse the bytes since ble_uuid128_t is LSB */
lipoyang 5:7f89fca19a9e 138 for (uint8_t i = 0; i<16; i++) {
lipoyang 5:7f89fca19a9e 139 base_uuid.uuid128[i] = p_uuid_base[15 - i];
lipoyang 5:7f89fca19a9e 140 }
lipoyang 5:7f89fca19a9e 141
lipoyang 5:7f89fca19a9e 142 ASSERT_INT( ERROR_NONE, sd_ble_uuid_vs_add( &base_uuid, &uuid_type ), 0);
lipoyang 5:7f89fca19a9e 143
lipoyang 5:7f89fca19a9e 144 return uuid_type;
lipoyang 5:7f89fca19a9e 145 }
lipoyang 5:7f89fca19a9e 146
lipoyang 5:7f89fca19a9e 147 /**************************************************************************/
lipoyang 5:7f89fca19a9e 148 /*!
lipoyang 5:7f89fca19a9e 149
lipoyang 5:7f89fca19a9e 150 */
lipoyang 5:7f89fca19a9e 151 /**************************************************************************/
lipoyang 5:7f89fca19a9e 152 error_t custom_decode_uuid_base(uint8_t const *const p_uuid_base,
lipoyang 5:7f89fca19a9e 153 ble_uuid_t *p_uuid)
lipoyang 5:7f89fca19a9e 154 {
lipoyang 5:7f89fca19a9e 155 LongUUIDBytes_t uuid_base_le;
lipoyang 5:7f89fca19a9e 156
lipoyang 5:7f89fca19a9e 157 /* Reverse the bytes since ble_uuid128_t is LSB */
lipoyang 5:7f89fca19a9e 158 for (uint8_t i = 0; i<16; i++) {
lipoyang 5:7f89fca19a9e 159 uuid_base_le[i] = p_uuid_base[15 - i];
lipoyang 5:7f89fca19a9e 160 }
lipoyang 5:7f89fca19a9e 161
lipoyang 5:7f89fca19a9e 162 ASSERT_STATUS( sd_ble_uuid_decode(16, uuid_base_le, p_uuid));
lipoyang 5:7f89fca19a9e 163
lipoyang 5:7f89fca19a9e 164 return ERROR_NONE;
lipoyang 5:7f89fca19a9e 165 }
lipoyang 5:7f89fca19a9e 166
lipoyang 5:7f89fca19a9e 167 /**************************************************************************/
lipoyang 5:7f89fca19a9e 168 /*!
lipoyang 5:7f89fca19a9e 169 @brief Adds a new characteristic to the custom service, assigning
lipoyang 5:7f89fca19a9e 170 properties, a UUID add-on value, etc.
lipoyang 5:7f89fca19a9e 171
lipoyang 5:7f89fca19a9e 172 @param[in] service_handle
lipoyang 5:7f89fca19a9e 173 @param[in] p_uuid The 16-bit value to add to the base UUID
lipoyang 5:7f89fca19a9e 174 for this characteristic (normally >1
lipoyang 5:7f89fca19a9e 175 since 1 is typically used by the primary
lipoyang 5:7f89fca19a9e 176 service).
lipoyang 5:7f89fca19a9e 177 @param[in] char_props The characteristic properties, as
lipoyang 5:7f89fca19a9e 178 defined by ble_gatt_char_props_t
lipoyang 5:7f89fca19a9e 179 @param[in] max_length The maximum length of this characeristic
lipoyang 5:7f89fca19a9e 180 @param[in] p_char_handle
lipoyang 5:7f89fca19a9e 181
lipoyang 5:7f89fca19a9e 182 @returns
lipoyang 5:7f89fca19a9e 183 @retval ERROR_NONE Everything executed normally
lipoyang 5:7f89fca19a9e 184 */
lipoyang 5:7f89fca19a9e 185 /**************************************************************************/
lipoyang 5:7f89fca19a9e 186 error_t custom_add_in_characteristic(uint16_t service_handle,
lipoyang 5:7f89fca19a9e 187 ble_uuid_t *p_uuid,
lipoyang 5:7f89fca19a9e 188 uint8_t properties,
lipoyang 5:7f89fca19a9e 189 uint8_t *p_data,
lipoyang 5:7f89fca19a9e 190 uint16_t min_length,
lipoyang 5:7f89fca19a9e 191 uint16_t max_length,
lipoyang 5:7f89fca19a9e 192 bool readAuthorization,
lipoyang 5:7f89fca19a9e 193 bool writeAuthorization,
lipoyang 5:7f89fca19a9e 194 ble_gatts_char_handles_t *p_char_handle)
lipoyang 5:7f89fca19a9e 195 {
lipoyang 5:7f89fca19a9e 196 /* Characteristic metadata */
lipoyang 5:7f89fca19a9e 197 ble_gatts_attr_md_t cccd_md;
lipoyang 5:7f89fca19a9e 198 ble_gatt_char_props_t char_props;
lipoyang 5:7f89fca19a9e 199
lipoyang 5:7f89fca19a9e 200 memcpy(&char_props, &properties, 1);
lipoyang 5:7f89fca19a9e 201
lipoyang 5:7f89fca19a9e 202 if (char_props.notify || char_props.indicate) {
lipoyang 5:7f89fca19a9e 203 /* Notification requires cccd */
lipoyang 5:7f89fca19a9e 204 memclr_( &cccd_md, sizeof(ble_gatts_attr_md_t));
lipoyang 5:7f89fca19a9e 205 cccd_md.vloc = BLE_GATTS_VLOC_STACK;
lipoyang 5:7f89fca19a9e 206 BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm);
lipoyang 5:7f89fca19a9e 207 BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.write_perm);
lipoyang 5:7f89fca19a9e 208 }
lipoyang 5:7f89fca19a9e 209
lipoyang 5:7f89fca19a9e 210 ble_gatts_char_md_t char_md = {0};
lipoyang 5:7f89fca19a9e 211
lipoyang 5:7f89fca19a9e 212 char_md.char_props = char_props;
lipoyang 5:7f89fca19a9e 213 char_md.p_cccd_md =
lipoyang 5:7f89fca19a9e 214 (char_props.notify || char_props.indicate) ? &cccd_md : NULL;
lipoyang 5:7f89fca19a9e 215
lipoyang 5:7f89fca19a9e 216 /* Attribute declaration */
lipoyang 5:7f89fca19a9e 217 ble_gatts_attr_md_t attr_md = {0};
lipoyang 5:7f89fca19a9e 218
lipoyang 5:7f89fca19a9e 219 attr_md.rd_auth = readAuthorization;
lipoyang 5:7f89fca19a9e 220 attr_md.wr_auth = writeAuthorization;
lipoyang 5:7f89fca19a9e 221
lipoyang 5:7f89fca19a9e 222 attr_md.vloc = BLE_GATTS_VLOC_STACK;
lipoyang 5:7f89fca19a9e 223 attr_md.vlen = (min_length == max_length) ? 0 : 1;
lipoyang 5:7f89fca19a9e 224
lipoyang 5:7f89fca19a9e 225 if (char_props.read || char_props.notify || char_props.indicate) {
lipoyang 5:7f89fca19a9e 226 BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.read_perm);
lipoyang 5:7f89fca19a9e 227 }
lipoyang 5:7f89fca19a9e 228
lipoyang 5:7f89fca19a9e 229 if (char_props.write || char_props.write_wo_resp) {
lipoyang 5:7f89fca19a9e 230 BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.write_perm);
lipoyang 5:7f89fca19a9e 231 }
lipoyang 5:7f89fca19a9e 232
lipoyang 5:7f89fca19a9e 233 ble_gatts_attr_t attr_char_value = {0};
lipoyang 5:7f89fca19a9e 234
lipoyang 5:7f89fca19a9e 235 attr_char_value.p_uuid = p_uuid;
lipoyang 5:7f89fca19a9e 236 attr_char_value.p_attr_md = &attr_md;
lipoyang 5:7f89fca19a9e 237 attr_char_value.init_len = min_length;
lipoyang 5:7f89fca19a9e 238 attr_char_value.max_len = max_length;
lipoyang 5:7f89fca19a9e 239 attr_char_value.p_value = p_data;
lipoyang 5:7f89fca19a9e 240
lipoyang 5:7f89fca19a9e 241 ASSERT_STATUS ( sd_ble_gatts_characteristic_add(service_handle,
lipoyang 5:7f89fca19a9e 242 &char_md,
lipoyang 5:7f89fca19a9e 243 &attr_char_value,
lipoyang 5:7f89fca19a9e 244 p_char_handle));
lipoyang 5:7f89fca19a9e 245
lipoyang 5:7f89fca19a9e 246 return ERROR_NONE;
lipoyang 5:7f89fca19a9e 247 }
lipoyang 5:7f89fca19a9e 248
lipoyang 5:7f89fca19a9e 249
lipoyang 5:7f89fca19a9e 250
lipoyang 5:7f89fca19a9e 251 /**************************************************************************/
lipoyang 5:7f89fca19a9e 252 /*!
lipoyang 5:7f89fca19a9e 253 @brief Adds a new descriptor to the custom service, assigning
lipoyang 5:7f89fca19a9e 254 value, a UUID add-on value, etc.
lipoyang 5:7f89fca19a9e 255
lipoyang 5:7f89fca19a9e 256 @param[in] char_handle
lipoyang 5:7f89fca19a9e 257 @param[in] p_uuid The 16-bit value to add to the base UUID
lipoyang 5:7f89fca19a9e 258 for this descriptor (normally >1
lipoyang 5:7f89fca19a9e 259 since 1 is typically used by the primary
lipoyang 5:7f89fca19a9e 260 service).
lipoyang 5:7f89fca19a9e 261 @param[in] max_length The maximum length of this descriptor
lipoyang 5:7f89fca19a9e 262
lipoyang 5:7f89fca19a9e 263 @returns
lipoyang 5:7f89fca19a9e 264 @retval ERROR_NONE Everything executed normally
lipoyang 5:7f89fca19a9e 265 */
lipoyang 5:7f89fca19a9e 266 /**************************************************************************/
lipoyang 5:7f89fca19a9e 267 error_t custom_add_in_descriptor(uint16_t char_handle,
lipoyang 5:7f89fca19a9e 268 ble_uuid_t *p_uuid,
lipoyang 5:7f89fca19a9e 269 uint8_t *p_data,
lipoyang 5:7f89fca19a9e 270 uint16_t min_length,
lipoyang 5:7f89fca19a9e 271 uint16_t max_length,
lipoyang 5:7f89fca19a9e 272 uint16_t *p_desc_handle)
lipoyang 5:7f89fca19a9e 273 {
lipoyang 5:7f89fca19a9e 274 /* Descriptor metadata */
lipoyang 5:7f89fca19a9e 275 ble_gatts_attr_md_t desc_md = {0};
lipoyang 5:7f89fca19a9e 276
lipoyang 5:7f89fca19a9e 277 desc_md.vloc = BLE_GATTS_VLOC_STACK;
lipoyang 5:7f89fca19a9e 278 desc_md.vlen = (min_length == max_length) ? 0 : 1;
lipoyang 5:7f89fca19a9e 279
lipoyang 5:7f89fca19a9e 280 /* Make it readable and writable */
lipoyang 5:7f89fca19a9e 281 BLE_GAP_CONN_SEC_MODE_SET_OPEN(&desc_md.read_perm);
lipoyang 5:7f89fca19a9e 282 BLE_GAP_CONN_SEC_MODE_SET_OPEN(&desc_md.write_perm);
lipoyang 5:7f89fca19a9e 283
lipoyang 5:7f89fca19a9e 284 ble_gatts_attr_t attr_desc = {0};
lipoyang 5:7f89fca19a9e 285
lipoyang 5:7f89fca19a9e 286 attr_desc.p_uuid = p_uuid;
lipoyang 5:7f89fca19a9e 287 attr_desc.p_attr_md = &desc_md;
lipoyang 5:7f89fca19a9e 288 attr_desc.init_len = min_length;
lipoyang 5:7f89fca19a9e 289 attr_desc.max_len = max_length;
lipoyang 5:7f89fca19a9e 290 attr_desc.p_value = p_data;
lipoyang 5:7f89fca19a9e 291
lipoyang 5:7f89fca19a9e 292 ASSERT_STATUS ( sd_ble_gatts_descriptor_add(char_handle,
lipoyang 5:7f89fca19a9e 293 &attr_desc,
lipoyang 5:7f89fca19a9e 294 p_desc_handle));
lipoyang 5:7f89fca19a9e 295
lipoyang 5:7f89fca19a9e 296 return ERROR_NONE;
lipoyang 5:7f89fca19a9e 297 }