Skip to content

Commit

Permalink
DELIA-46698: Introduce JGraphicsProperties
Browse files Browse the repository at this point in the history
Reason for change: JGraphicsProperties will
register the totalgpuram and freegpuram properties, so that
these 2 properties will become available to DisplayInfo plugin.
Updated readme file also
Test Procedure: use curl commands, check compilation
Risks: None
Signed-off-by: Vinod Jacob <[email protected]>
  • Loading branch information
vinod-jacob committed Nov 25, 2020
1 parent 985910d commit 3155c4c
Show file tree
Hide file tree
Showing 4 changed files with 176 additions and 32 deletions.
45 changes: 28 additions & 17 deletions DisplayInfo/DisplayInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,23 @@ namespace Plugin {
if (_connectionProperties != nullptr) {

_graphicsProperties = _connectionProperties->QueryInterface<Exchange::IGraphicsProperties>();
_hdrProperties = _connectionProperties->QueryInterface<Exchange::IHDRProperties>();
if (_graphicsProperties == nullptr) {

_connectionProperties->Release();
_connectionProperties = nullptr;
} else {
_notification.Initialize(_connectionProperties);
Exchange::JConnectionProperties::Register(*this, _connectionProperties);
Exchange::JHDRProperties::Register(*this, _hdrProperties);
_hdrProperties = _connectionProperties->QueryInterface<Exchange::IHDRProperties>();
if (_hdrProperties == nullptr) {
_connectionProperties->Release();
_connectionProperties = nullptr;
_graphicsProperties->Release();
_graphicsProperties = nullptr;
} else {
_notification.Initialize(_connectionProperties);
Exchange::JGraphicsProperties::Register(*this, _graphicsProperties);
Exchange::JConnectionProperties::Register(*this, _connectionProperties);
Exchange::JHDRProperties::Register(*this, _hdrProperties);
}
}
}

Expand Down Expand Up @@ -132,11 +140,6 @@ namespace Plugin {

void DisplayInfo::Info(JsonData::DisplayInfo::DisplayinfoData& displayInfo) const
{
bool boolean;
uint32_t value;
Exchange::IHDRProperties::HDRType hdrType;
Exchange::IConnectionProperties::HDCPProtectionType hdcpType;

uint64_t ram = 0;
if (_graphicsProperties->TotalGpuRam(ram) == Core::ERROR_NONE) {
displayInfo.Totalgpuram = ram;
Expand All @@ -146,26 +149,34 @@ namespace Plugin {
displayInfo.Freegpuram = ram;
}

if (_connectionProperties->IsAudioPassthrough(boolean) == Core::ERROR_NONE) {
displayInfo.Audiopassthrough = boolean;
bool status = false;
if (_connectionProperties->IsAudioPassthrough(status) == Core::ERROR_NONE) {
displayInfo.Audiopassthrough = status;
}
if (_connectionProperties->Connected(boolean) == Core::ERROR_NONE) {
displayInfo.Connected = boolean;
status = false;
if (_connectionProperties->Connected(status) == Core::ERROR_NONE) {
displayInfo.Connected = status;
}

uint32_t value = 0;
if (_connectionProperties->Width(value) == Core::ERROR_NONE) {
displayInfo.Width = value;
}
value = 0;
if (_connectionProperties->Height(value) == Core::ERROR_NONE) {
displayInfo.Height = value;
}

if (static_cast<const Exchange::IConnectionProperties*>(_connectionProperties)->HDCPProtection(hdcpType) == Core::ERROR_NONE) {
displayInfo.Hdcpprotection = static_cast<JsonData::DisplayInfo::DisplayinfoData::HdcpprotectionType>(hdcpType);
Exchange::IConnectionProperties::HDCPProtectionType hdcpProtection(Exchange::IConnectionProperties::HDCPProtectionType::HDCP_Unencrypted);
if (_connectionProperties->HDCPProtection(hdcpProtection) == Core::ERROR_NONE) {
displayInfo.Hdcpprotection = static_cast<JsonData::DisplayInfo::DisplayinfoData::HdcpprotectionType>(hdcpProtection);
}
if ((_hdrProperties != nullptr) && (_hdrProperties->HDRSetting(hdrType) == Core::ERROR_NONE)) {

Exchange::IHDRProperties::HDRType hdrType(Exchange::IHDRProperties::HDRType::HDR_OFF);
if (_hdrProperties->HDRSetting(hdrType) == Core::ERROR_NONE) {
displayInfo.Hdrtype = static_cast<JsonData::DisplayInfo::DisplayinfoData::HdrtypeType>(hdrType);
}
}

} // namespace Plugin
} // namespace WPEFramework
} // namespace WPEFramework
6 changes: 3 additions & 3 deletions DisplayInfo/DisplayInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include "Module.h"
#include <interfaces/json/JsonData_DisplayInfo.h>
#include <interfaces/json/JGraphicsProperties.h>
#include <interfaces/json/JConnectionProperties.h>
#include <interfaces/json/JHDRProperties.h>

Expand All @@ -34,6 +35,7 @@ namespace Plugin {
Notification() = delete;
Notification(const Notification&) = delete;
Notification& operator=(const Notification&) = delete;

public:
explicit Notification(DisplayInfo* parent)
: _parent(*parent)
Expand Down Expand Up @@ -113,8 +115,6 @@ namespace Plugin {
virtual Core::ProxyType<Web::Response> Process(const Web::Request& request) override;

private:
// JsonRpc
uint32_t get_displayinfo(JsonData::DisplayInfo::DisplayinfoData&) const;

void Info(JsonData::DisplayInfo::DisplayinfoData&) const;

Expand All @@ -128,4 +128,4 @@ namespace Plugin {
};

} // namespace Plugin
} // namespace WPEFramework
} // namespace WPEFramework
Loading

0 comments on commit 3155c4c

Please sign in to comment.