Skip to content

Commit f4b7f32

Browse files
Merge pull request #49 from pan-/fix-privacy-backward-compatibility
Fix privacy backward compatibility
2 parents 80137be + cfe325c commit f4b7f32

File tree

21 files changed

+1314
-628
lines changed

21 files changed

+1314
-628
lines changed

features/FEATURE_BLE/ble/BLE.h

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -457,9 +457,7 @@ class BLE
457457
ble_error_t setAddress(
458458
BLEProtocol::AddressType_t type,
459459
const BLEProtocol::AddressBytes_t address
460-
) {
461-
return gap().setAddress(type, address);
462-
}
460+
);
463461

464462
/**
465463
* Fetch the Bluetooth Low Energy MAC address and type.
@@ -1009,9 +1007,7 @@ class BLE
10091007
ble_error_t connect(const BLEProtocol::AddressBytes_t peerAddr,
10101008
BLEProtocol::AddressType_t peerAddrType = BLEProtocol::AddressType::RANDOM_STATIC,
10111009
const Gap::ConnectionParams_t *connectionParams = NULL,
1012-
const GapScanningParams *scanParams = NULL) {
1013-
return gap().connect(peerAddr, peerAddrType, connectionParams, scanParams);
1014-
}
1010+
const GapScanningParams *scanParams = NULL);
10151011

10161012
/**
10171013
* This call initiates the disconnection procedure, and its completion is
@@ -1045,9 +1041,7 @@ class BLE
10451041
* connection.
10461042
*/
10471043
MBED_DEPRECATED("Use ble.gap().disconnect(...)")
1048-
ble_error_t disconnect(Gap::DisconnectionReason_t reason) {
1049-
return gap().disconnect(reason);
1050-
}
1044+
ble_error_t disconnect(Gap::DisconnectionReason_t reason);
10511045

10521046
/**
10531047
* Returns the current Gap state of the device using a bitmask that

features/FEATURE_BLE/ble/BLEProtocol.h

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -87,25 +87,7 @@ namespace BLEProtocol {
8787
* on RANDOM instead. Use Gap::getRandomAddressType to retrieve the
8888
* type of the random address.
8989
*/
90-
RANDOM_PRIVATE_NON_RESOLVABLE,
91-
92-
/**
93-
* Random address.
94-
*
95-
* Use Gap::getRandomAddressType to retrieve the type of the random
96-
* address.
97-
*/
98-
RANDOM,
99-
100-
/**
101-
* A Public address used as a device identity address.
102-
*/
103-
PUBLIC_IDENTITY,
104-
105-
/**
106-
* A Random static address used as a device identity address.
107-
*/
108-
RANDOM_STATIC_IDENTITY
90+
RANDOM_PRIVATE_NON_RESOLVABLE
10991
};
11092
};
11193

features/FEATURE_BLE/ble/BLETypes.h

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,49 @@ struct att_security_requirement_t : SafeEnum<att_security_requirement_t, uint8_t
529529
SafeEnum<att_security_requirement_t, uint8_t>(value) { }
530530
};
531531

532+
/**
533+
* Type that describes a peer device address type.
534+
*/
535+
struct peer_address_type_t :SafeEnum<peer_address_type_t, uint8_t> {
536+
/** struct scoped enum wrapped by the class */
537+
enum type {
538+
/**
539+
* Public device address.
540+
*/
541+
PUBLIC = 0,
542+
543+
/**
544+
* Random address.
545+
*
546+
* Use Gap::getRandomAddressType to retrieve the type of the random
547+
* address.
548+
*/
549+
RANDOM,
550+
551+
/**
552+
* A Public address used as a device identity address.
553+
*/
554+
PUBLIC_IDENTITY,
555+
556+
/**
557+
* A Random static address used as a device identity address.
558+
*/
559+
RANDOM_STATIC_IDENTITY
560+
};
561+
562+
/**
563+
* Construct a new instance of peer_address_type_t.
564+
*/
565+
peer_address_type_t(type value) :
566+
SafeEnum<peer_address_type_t, uint8_t>(value) { }
567+
568+
/**
569+
* Default initialization of peer_address_type_t.
570+
*/
571+
peer_address_type_t() :
572+
SafeEnum<peer_address_type_t, uint8_t>(PUBLIC) { }
573+
};
574+
532575
} // namespace ble
533576

534577
/**

0 commit comments

Comments
 (0)