aboutsummaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2021-10-14 02:52:31 +0200
committerSven Gothel <[email protected]>2021-10-14 02:52:31 +0200
commit260387009516f4b59b39d8d598542b7834e78421 (patch)
treec7a4f59efaf6a8202320af483fb16c3c8e9f3c12 /api
parentfe52bfd97f770885534c21c2fdc680f379875e4f (diff)
Move BTGattChar::PropertyBitVal to_string() out of class and add free standing bit and equality operations
Diffstat (limited to 'api')
-rw-r--r--api/direct_bt/BTGattChar.hpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/api/direct_bt/BTGattChar.hpp b/api/direct_bt/BTGattChar.hpp
index 6edcb980..68efdfca 100644
--- a/api/direct_bt/BTGattChar.hpp
+++ b/api/direct_bt/BTGattChar.hpp
@@ -94,14 +94,7 @@ namespace direct_bt {
AuthSignedWrite = (1 << 6),
ExtProps = (1 << 7)
};
- /**
- * Returns string values as defined in <https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/gatt-api.txt>
- * <pre>
- * org.bluez.GattCharacteristic1 :: array{string} Flags [read-only]
- * </pre>
- */
- static std::string getPropertiesString(const PropertyBitVal properties) noexcept;
- static jau::darray<std::unique_ptr<std::string>> getPropertiesStringList(const PropertyBitVal properties) noexcept;
+ static std::string toPropertiesString(const PropertyBitVal properties) noexcept;
/**
* {@link BTGattChar} event listener for notification and indication events.
@@ -468,6 +461,23 @@ namespace direct_bt {
inline bool operator!=(const BTGattChar& lhs, const BTGattChar& rhs) noexcept
{ return !(lhs == rhs); }
+ constexpr uint8_t number(const BTGattChar::PropertyBitVal rhs) noexcept {
+ return static_cast<uint8_t>(rhs);
+ }
+ constexpr BTGattChar::PropertyBitVal operator |(const BTGattChar::PropertyBitVal lhs, const BTGattChar::PropertyBitVal rhs) noexcept {
+ return static_cast<BTGattChar::PropertyBitVal> ( number(lhs) | number(rhs) );
+ }
+ constexpr BTGattChar::PropertyBitVal operator &(const BTGattChar::PropertyBitVal lhs, const BTGattChar::PropertyBitVal rhs) noexcept {
+ return static_cast<BTGattChar::PropertyBitVal> ( number(lhs) & number(rhs) );
+ }
+ constexpr bool operator ==(const BTGattChar::PropertyBitVal lhs, const BTGattChar::PropertyBitVal rhs) noexcept {
+ return number(lhs) == number(rhs);
+ }
+ constexpr bool operator !=(const BTGattChar::PropertyBitVal lhs, const BTGattChar::PropertyBitVal rhs) noexcept {
+ return !( lhs == rhs );
+ }
+ std::string to_string(const BTGattChar::PropertyBitVal mask) noexcept;
+
/**
* {@link BTGattChar} event listener for notification and indication events.
* <p>