diff options
author | Sven Gothel <[email protected]> | 2020-06-09 21:44:46 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-06-09 21:44:46 +0200 |
commit | f40e35e61b500194791eaa24c83ee62fc3b71271 (patch) | |
tree | a82b82eef88d465776ad6d5f38b58de22a0e724a /api | |
parent | 5446c1ad212f3cdf4a8445194a438fca1d605474 (diff) |
DBTDevice (C++/Java): Expose getLastDiscoveryTimestamp() and rename lastUpdate: getLastUpdateTimestamp()
For performance measurement discovery -> gatt complete,
we need to use the last discovery timestamp, since the device could have been created earlier.
Diffstat (limited to 'api')
-rw-r--r-- | api/direct_bt/DBTDevice.hpp | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/api/direct_bt/DBTDevice.hpp b/api/direct_bt/DBTDevice.hpp index c915ae18..db670b2b 100644 --- a/api/direct_bt/DBTDevice.hpp +++ b/api/direct_bt/DBTDevice.hpp @@ -55,10 +55,9 @@ namespace direct_bt { friend GATTHandler; // may issue detailed disconnect(..) private: - static const int to_connect_ms = 5000; - DBTAdapter & adapter; - uint64_t ts_update; + uint64_t ts_last_discovery; + uint64_t ts_last_update; std::string name; int8_t rssi = 127; // The core spec defines 127 as the "not available" value int8_t tx_power = 127; // The core spec defines 127 as the "not available" value @@ -111,13 +110,30 @@ namespace direct_bt { std::shared_ptr<DBTDevice> getSharedInstance() const; /** - * Returns the timestamp in monotonic milliseconds when this device instance has been created, either via discovery or direct connection. + * Returns the timestamp in monotonic milliseconds when this device instance has been created, + * either via its initial discovery or its initial direct connection. * @see BasicTypes::getCurrentMilliseconds() */ uint64_t getCreationTimestamp() const { return ts_creation; } - uint64_t getUpdateTimestamp() const { return ts_update; } - uint64_t getLastUpdateAge(const uint64_t ts_now) const { return ts_now - ts_update; } + /** + * Returns the timestamp in monotonic milliseconds when this device instance has + * discovered or connected directly the last time. + * @see BasicTypes::getCurrentMilliseconds() + */ + uint64_t getLastDiscoveryTimestamp() const { return ts_last_discovery; } + + /** + * Returns the timestamp in monotonic milliseconds when this device instance underlying data + * has been updated the last time. + * @see BasicTypes::getCurrentMilliseconds() + */ + uint64_t getLastUpdateTimestamp() const { return ts_last_update; } + + /** + * @see getLastUpdateTimestamp() + */ + uint64_t getLastUpdateAge(const uint64_t ts_now) const { return ts_now - ts_last_update; } EUI48 const & getAddress() const { return address; } std::string getAddressString() const { return address.toString(); } |