config changes
Fork of nRF51822 by
TARGET_NRF5/source/btle/custom/custom_helper.h@638:c90ae1400bf2, 2016-09-14 (annotated)
- Committer:
- Vincent Coubard
- Date:
- Wed Sep 14 14:39:43 2016 +0100
- Revision:
- 638:c90ae1400bf2
Sync with bdab10dc0f90748b6989c8b577771bb403ca6bd8 from ARMmbed/mbed-os.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Vincent Coubard |
638:c90ae1400bf2 | 1 | /* mbed Microcontroller Library |
Vincent Coubard |
638:c90ae1400bf2 | 2 | * Copyright (c) 2006-2013 ARM Limited |
Vincent Coubard |
638:c90ae1400bf2 | 3 | * |
Vincent Coubard |
638:c90ae1400bf2 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
Vincent Coubard |
638:c90ae1400bf2 | 5 | * you may not use this file except in compliance with the License. |
Vincent Coubard |
638:c90ae1400bf2 | 6 | * You may obtain a copy of the License at |
Vincent Coubard |
638:c90ae1400bf2 | 7 | * |
Vincent Coubard |
638:c90ae1400bf2 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
Vincent Coubard |
638:c90ae1400bf2 | 9 | * |
Vincent Coubard |
638:c90ae1400bf2 | 10 | * Unless required by applicable law or agreed to in writing, software |
Vincent Coubard |
638:c90ae1400bf2 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
Vincent Coubard |
638:c90ae1400bf2 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
Vincent Coubard |
638:c90ae1400bf2 | 13 | * See the License for the specific language governing permissions and |
Vincent Coubard |
638:c90ae1400bf2 | 14 | * limitations under the License. |
Vincent Coubard |
638:c90ae1400bf2 | 15 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 16 | |
Vincent Coubard |
638:c90ae1400bf2 | 17 | #ifndef _CUSTOM_HELPER_H_ |
Vincent Coubard |
638:c90ae1400bf2 | 18 | #define _CUSTOM_HELPER_H_ |
Vincent Coubard |
638:c90ae1400bf2 | 19 | |
Vincent Coubard |
638:c90ae1400bf2 | 20 | #include "common/common.h" |
Vincent Coubard |
638:c90ae1400bf2 | 21 | #include "nrf_ble.h" |
Vincent Coubard |
638:c90ae1400bf2 | 22 | #include "ble/UUID.h" |
Vincent Coubard |
638:c90ae1400bf2 | 23 | #include "ble/GattCharacteristic.h" |
Vincent Coubard |
638:c90ae1400bf2 | 24 | |
Vincent Coubard |
638:c90ae1400bf2 | 25 | #ifdef __cplusplus |
Vincent Coubard |
638:c90ae1400bf2 | 26 | extern "C" { |
Vincent Coubard |
638:c90ae1400bf2 | 27 | #endif |
Vincent Coubard |
638:c90ae1400bf2 | 28 | |
Vincent Coubard |
638:c90ae1400bf2 | 29 | #define UUID_TABLE_MAX_ENTRIES (4) /* This is the maximum number of 128-bit UUIDs with distinct bases that |
Vincent Coubard |
638:c90ae1400bf2 | 30 | * we expect to be in use; increase this limit if needed. */ |
Vincent Coubard |
638:c90ae1400bf2 | 31 | |
Vincent Coubard |
638:c90ae1400bf2 | 32 | /** |
Vincent Coubard |
638:c90ae1400bf2 | 33 | * Reset the table of 128bits uuids. |
Vincent Coubard |
638:c90ae1400bf2 | 34 | * This table is used to keep track of vendors uuids added to the softdevice. |
Vincent Coubard |
638:c90ae1400bf2 | 35 | * It is important to reset it before disabling the softdevice otherwise the |
Vincent Coubard |
638:c90ae1400bf2 | 36 | * next time the softdevice will be enabled, this table will not be synchronmized |
Vincent Coubard |
638:c90ae1400bf2 | 37 | * with the softdevice table. |
Vincent Coubard |
638:c90ae1400bf2 | 38 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 39 | void custom_reset_128bits_uuid_table(); |
Vincent Coubard |
638:c90ae1400bf2 | 40 | uint8_t custom_add_uuid_base(uint8_t const *const p_uuid_base); |
Vincent Coubard |
638:c90ae1400bf2 | 41 | error_t custom_decode_uuid(uint8_t const *const p_uuid_base, |
Vincent Coubard |
638:c90ae1400bf2 | 42 | ble_uuid_t *p_uuid); |
Vincent Coubard |
638:c90ae1400bf2 | 43 | ble_uuid_t custom_convert_to_nordic_uuid(const UUID &uuid); |
Vincent Coubard |
638:c90ae1400bf2 | 44 | |
Vincent Coubard |
638:c90ae1400bf2 | 45 | error_t custom_add_in_characteristic(uint16_t service_handle, |
Vincent Coubard |
638:c90ae1400bf2 | 46 | ble_uuid_t *p_uuid, |
Vincent Coubard |
638:c90ae1400bf2 | 47 | uint8_t properties, |
Vincent Coubard |
638:c90ae1400bf2 | 48 | SecurityManager::SecurityMode_t requiredSecurity, |
Vincent Coubard |
638:c90ae1400bf2 | 49 | uint8_t *p_data, |
Vincent Coubard |
638:c90ae1400bf2 | 50 | uint16_t length, |
Vincent Coubard |
638:c90ae1400bf2 | 51 | uint16_t max_length, |
Vincent Coubard |
638:c90ae1400bf2 | 52 | bool has_variable_len, |
Vincent Coubard |
638:c90ae1400bf2 | 53 | const uint8_t *userDescriptionDescriptorValuePtr, |
Vincent Coubard |
638:c90ae1400bf2 | 54 | uint16_t userDescriptionDescriptorValueLen, |
Vincent Coubard |
638:c90ae1400bf2 | 55 | bool readAuthorization, |
Vincent Coubard |
638:c90ae1400bf2 | 56 | bool writeAuthorization, |
Vincent Coubard |
638:c90ae1400bf2 | 57 | ble_gatts_char_handles_t *p_char_handle); |
Vincent Coubard |
638:c90ae1400bf2 | 58 | |
Vincent Coubard |
638:c90ae1400bf2 | 59 | error_t custom_add_in_descriptor(uint16_t char_handle, |
Vincent Coubard |
638:c90ae1400bf2 | 60 | ble_uuid_t *p_uuid, |
Vincent Coubard |
638:c90ae1400bf2 | 61 | uint8_t *p_data, |
Vincent Coubard |
638:c90ae1400bf2 | 62 | uint16_t length, |
Vincent Coubard |
638:c90ae1400bf2 | 63 | uint16_t max_length, |
Vincent Coubard |
638:c90ae1400bf2 | 64 | bool has_variable_len, |
Vincent Coubard |
638:c90ae1400bf2 | 65 | uint16_t *p_desc_handle); |
Vincent Coubard |
638:c90ae1400bf2 | 66 | |
Vincent Coubard |
638:c90ae1400bf2 | 67 | #ifdef __cplusplus |
Vincent Coubard |
638:c90ae1400bf2 | 68 | } |
Vincent Coubard |
638:c90ae1400bf2 | 69 | #endif |
Vincent Coubard |
638:c90ae1400bf2 | 70 | |
Vincent Coubard |
638:c90ae1400bf2 | 71 | #endif // ifndef _CUSTOM_HELPER_H_ |