diff --git a/services/tunnelbroker/src/Database/DeviceSessionItem.h b/services/tunnelbroker/src/Database/DeviceSessionItem.h --- a/services/tunnelbroker/src/Database/DeviceSessionItem.h +++ b/services/tunnelbroker/src/Database/DeviceSessionItem.h @@ -17,6 +17,7 @@ std::string appVersion; std::string deviceOs; int64_t checkpointTime = 0; + bool isOnline = false; void validate() const override; @@ -30,6 +31,7 @@ static const std::string FIELD_DEVICE_OS; static const std::string FIELD_CHECKPOINT_TIME; static const std::string FIELD_EXPIRE; + static const std::string FIELD_IS_ONLINE; PrimaryKeyDescriptor getPrimaryKeyDescriptor() const override; PrimaryKeyValue getPrimaryKeyValue() const override; @@ -42,6 +44,7 @@ std::string getAppVersion() const; std::string getDeviceOs() const; int64_t getCheckpointTime() const; + bool getIsOnline() const; DeviceSessionItem() { } diff --git a/services/tunnelbroker/src/Database/DeviceSessionItem.cpp b/services/tunnelbroker/src/Database/DeviceSessionItem.cpp --- a/services/tunnelbroker/src/Database/DeviceSessionItem.cpp +++ b/services/tunnelbroker/src/Database/DeviceSessionItem.cpp @@ -17,6 +17,7 @@ const std::string DeviceSessionItem::FIELD_DEVICE_OS = "DeviceOS"; const std::string DeviceSessionItem::FIELD_CHECKPOINT_TIME = "CheckpointTime"; const std::string DeviceSessionItem::FIELD_EXPIRE = "Expire"; +const std::string DeviceSessionItem::FIELD_IS_ONLINE = "IsOnline"; DeviceSessionItem::DeviceSessionItem( const std::string sessionID, @@ -71,6 +72,8 @@ std::string( itemFromDB.at(DeviceSessionItem::FIELD_CHECKPOINT_TIME).GetS()) .c_str()); + this->isOnline = + itemFromDB.at(DeviceSessionItem::FIELD_IS_ONLINE).GetBool(); } catch (std::logic_error &e) { throw std::runtime_error( "Invalid device session database value " + std::string(e.what())); @@ -123,6 +126,10 @@ return this->checkpointTime; } +bool DeviceSessionItem::getIsOnline() const { + return this->isOnline; +} + } // namespace database } // namespace network } // namespace comm