Merge pull request #158 from LiyouZhou/hotfix_Gap_AddressType
Hotfix for backward compatibility
This commit is contained in:
commit
a7d97ae5c4
3 changed files with 48 additions and 3 deletions
22
ble/Gap.h
22
ble/Gap.h
|
@ -24,6 +24,7 @@
|
|||
#include "GapEvents.h"
|
||||
#include "CallChainOfFunctionPointersWithContext.h"
|
||||
#include "FunctionPointerWithContext.h"
|
||||
#include "deprecate.h"
|
||||
|
||||
/* Forward declarations for classes that will only be used for pointers or references in the following. */
|
||||
class GapAdvertisingParams;
|
||||
|
@ -51,13 +52,13 @@ public:
|
|||
|
||||
/**
|
||||
* Address-type for BLEProtocol addresses.
|
||||
* @note: deprecated. Use BLEProtocol::AddressType_t instead.
|
||||
* \deprecated: Use BLEProtocol::AddressType_t instead.
|
||||
*
|
||||
* DEPRECATION ALERT: The following constants have been left in their
|
||||
* deprecated state to transparenly support existing applications which may
|
||||
* have used Gap::ADDR_TYPE_*.
|
||||
*/
|
||||
enum {
|
||||
enum DeprecatedAddressType_t {
|
||||
ADDR_TYPE_PUBLIC = BLEProtocol::AddressType::PUBLIC,
|
||||
ADDR_TYPE_RANDOM_STATIC = BLEProtocol::AddressType::RANDOM_STATIC,
|
||||
ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE = BLEProtocol::AddressType::RANDOM_PRIVATE_RESOLVABLE,
|
||||
|
@ -275,6 +276,23 @@ public:
|
|||
return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a connection (GAP Link Establishment).
|
||||
*
|
||||
* \deprecated: This funtion overloads Gap::connect(const BLEProtocol::Address_t peerAddr,
|
||||
BLEProtocol::AddressType_t peerAddrType,
|
||||
const ConnectionParams_t *connectionParams,
|
||||
const GapScanningParams *scanParams)
|
||||
* to maintain backward compatibility for change from Gap::AddressType_t to BLEProtocol::AddressType_t
|
||||
*/
|
||||
ble_error_t connect(const BLEProtocol::Address_t peerAddr,
|
||||
DeprecatedAddressType_t peerAddrType,
|
||||
const ConnectionParams_t *connectionParams,
|
||||
const GapScanningParams *scanParams)
|
||||
__deprecated_message("Gap::DeprecatedAddressType_t is deprecated, use BLEProtocol::AddressType_t instead") {
|
||||
return connect(peerAddr, (BLEProtocol::AddressType_t) peerAddrType, connectionParams, scanParams);
|
||||
}
|
||||
|
||||
/**
|
||||
* This call initiates the disconnection procedure, and its completion will
|
||||
* be communicated to the application with an invocation of the
|
||||
|
|
26
ble/deprecate.h
Normal file
26
ble/deprecate.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2006-2013 ARM Limited
|
||||
*
|
||||
* 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 __DEPRECATE_H__
|
||||
#define __DEPRECATE_H__
|
||||
|
||||
#ifdef YOTTA_CFG_MBED_OS
|
||||
#include "compiler-polyfill/attributes.h"
|
||||
#else
|
||||
#define __deprecated_message(msg)
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -35,7 +35,8 @@
|
|||
"mbed-classic": "~0.0.1"
|
||||
},
|
||||
"mbed-os": {
|
||||
"mbed-drivers": "*"
|
||||
"mbed-drivers": "*",
|
||||
"compiler-polyfill": "^1.2.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue