diff --git a/HdcpProfile/HdcpProfile.cpp b/HdcpProfile/HdcpProfile.cpp index bcfa8f63..f039b1aa 100644 --- a/HdcpProfile/HdcpProfile.cpp +++ b/HdcpProfile/HdcpProfile.cpp @@ -45,7 +45,8 @@ namespace WPEFramework SERVICE_REGISTRATION(HdcpProfile, API_VERSION_NUMBER_MAJOR, API_VERSION_NUMBER_MINOR, API_VERSION_NUMBER_PATCH); HdcpProfile::HdcpProfile() - : _service(nullptr) + : PluginHost::JSONRPCErrorAssessor(HdcpProfile::OnJSONRPCError) + ,_service(nullptr) , _connectionId(0) , _hdcpProfile(nullptr) , _hdcpProfileNotification(this) @@ -163,6 +164,16 @@ namespace WPEFramework return ("This HdcpProfile Plugin facilitates to persist event data for monitoring applications"); } + uint32_t HdcpProfile::OnJSONRPCError(const Core::JSONRPC::Context&, const string& method, const string& parameters, const uint32_t errorcode, string& errormessage) { + LOGINFO("DBG:OnJSONRPCERROR"); + if(method == _T("getHDCPStatus") && (errorcode >= static_cast(ERROR_BASE) && errorcode < static_cast(MAX_ERROR_CODE) )) + { + LOGINFO("DBG-Inside If"); + errormessage = ERROR_MESSAGE(errorcode); + } + return errorcode; + } + void HdcpProfile::Deactivated(RPC::IRemoteConnection *connection) { if (connection->Id() == _connectionId) diff --git a/HdcpProfile/HdcpProfile.h b/HdcpProfile/HdcpProfile.h index ddf5fd91..ea76d77f 100644 --- a/HdcpProfile/HdcpProfile.h +++ b/HdcpProfile/HdcpProfile.h @@ -32,7 +32,7 @@ namespace WPEFramework { namespace Plugin { - class HdcpProfile : public PluginHost::IPlugin, public PluginHost::JSONRPC + class HdcpProfile : public PluginHost::IPlugin, public PluginHost::JSONRPCErrorAssessor { private: class Notification : public RPC::IRemoteConnection::INotification, public Exchange::IHdcpProfile::INotification @@ -97,6 +97,7 @@ namespace WPEFramework { const string Initialize(PluginHost::IShell* service) override; void Deinitialize(PluginHost::IShell* service) override; string Information() const override; + static uint32_t OnJSONRPCError(const Core::JSONRPC::Context& context, const string& method, const string& parameters, const uint32_t errorcode, string& errormessage); private: void Deactivated(RPC::IRemoteConnection* connection); diff --git a/HdcpProfile/HdcpProfileImplementation.cpp b/HdcpProfile/HdcpProfileImplementation.cpp index 69b55a21..2d627c30 100644 --- a/HdcpProfile/HdcpProfileImplementation.cpp +++ b/HdcpProfile/HdcpProfileImplementation.cpp @@ -350,6 +350,23 @@ Core::hresult HdcpProfileImplementation::GetHDCPStatus(HDCPStatus& hdcpstatus,bool& success) { success = GetHDCPStatusInternal(hdcpstatus); + if(fopen("/opt/check1.txt","r")!=NULL) + { + return ERROR_FILE_IO; + } + else if(fopen("/opt/check2.txt","r")!=NULL) + { + return ERROR_PERMISSION_DENIED; + } + else if(fopen("/opt/check3.txt","r")!=NULL) + { + return ERROR_BASE; + } + else if(fopen("/opt/check4.txt","r")!=NULL) + { + return MAX_ERROR_CODE; + } + return Core::ERROR_NONE; return Core::ERROR_NONE; }