Skip to content

Commit

Permalink
Merge branch 'development/docs-time' of github.com:rdkcentral/Thunder…
Browse files Browse the repository at this point in the history
… into development/docs-time
  • Loading branch information
msieben committed Oct 27, 2023
2 parents 1e7b29a + ea2e8b1 commit 06e11df
Show file tree
Hide file tree
Showing 30 changed files with 386 additions and 210 deletions.
9 changes: 0 additions & 9 deletions Source/WPEFramework/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,6 @@ namespace PluginHost {
, ExitReasons()
, Latitude(51832547) // Divider 1.000.000
, Longitude(5674899) // Divider 1.000.000
, MessagingPort(0)
#ifdef PROCESSCONTAINERS_ENABLED
, ProcessContainers()
#endif
Expand Down Expand Up @@ -418,7 +417,6 @@ namespace PluginHost {
Add(_T("exitreasons"), &ExitReasons);
Add(_T("latitude"), &Latitude);
Add(_T("longitude"), &Longitude);
Add(_T("messagingport"), &MessagingPort);
#ifdef PROCESSCONTAINERS_ENABLED
Add(_T("processcontainers"), &ProcessContainers);
#endif
Expand Down Expand Up @@ -462,7 +460,6 @@ namespace PluginHost {
Core::JSON::ArrayType<Core::JSON::EnumType<PluginHost::IShell::reason>> ExitReasons;
Core::JSON::DecSInt32 Latitude;
Core::JSON::DecSInt32 Longitude;
Core::JSON::DecUInt16 MessagingPort;
#ifdef PROCESSCONTAINERS_ENABLED
ProcessContainerConfig ProcessContainers;
#endif
Expand Down Expand Up @@ -617,7 +614,6 @@ PUSH_WARNING(DISABLE_WARNING_THIS_IN_MEMBER_INITIALIZER_LIST)
, _softKillCheckWaitTime(3)
, _hardKillCheckWaitTime(10)
, _stackSize(0)
, _messagingPort()
, _inputInfo()
, _processInfo()
, _plugins()
Expand Down Expand Up @@ -676,7 +672,6 @@ PUSH_WARNING(DISABLE_WARNING_THIS_IN_MEMBER_INITIALIZER_LIST)
if( config.Latitude.IsSet() || config.Longitude.IsSet() ) {
SYSLOG(Logging::Error, (_T("Support for Latitude and Longitude moved from Thunder configuration to plugin providing ILocation support")));
}
_messagingPort = config.MessagingPort.Value();

_messagingCategoriesFile = config.DefaultMessagingCategories.IsQuoted();
if (_messagingCategoriesFile == true) {
Expand Down Expand Up @@ -875,9 +870,6 @@ POP_WARNING()
inline string EthernetCard() const {
return _ethernetCard;
}
inline uint16_t MessagingPort() const {
return (_messagingPort);
}
inline const InputInfo& Input() const {
return(_inputInfo);
}
Expand Down Expand Up @@ -1048,7 +1040,6 @@ POP_WARNING()
uint8_t _softKillCheckWaitTime;
uint8_t _hardKillCheckWaitTime;
uint32_t _stackSize;
uint16_t _messagingPort;
InputInfo _inputInfo;
ProcessInfo _processInfo;
Core::JSON::ArrayType<Plugin::Config> _plugins;
Expand Down
39 changes: 18 additions & 21 deletions Source/WPEFramework/Controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,11 @@ namespace Plugin {
_service->DisableWebServer();
}

Register(this);
Exchange::IController::JConfiguration::Register(*this, this);
Exchange::IController::JDiscovery::Register(*this, this);
Exchange::IController::JSystemManagement::Register(*this, this);
Exchange::IController::JLifeTime::Register(*this, this);
Exchange::IController::JMetadata::Register(*this, this);
Exchange::Controller::JConfiguration::Register(*this, this);
Exchange::Controller::JDiscovery::Register(*this, this);
Exchange::Controller::JSystemManagement::Register(*this, this);
Exchange::Controller::JLifeTime::Register(*this, this);
Exchange::Controller::JMetadata::Register(*this, this);

// On succes return a name as a Callsign to be used in the URL, after the "service"prefix
return (_T(""));
Expand All @@ -144,11 +143,11 @@ namespace Plugin {
{
ASSERT(_service == service);

Exchange::IController::JConfiguration::Unregister(*this);
Exchange::IController::JDiscovery::Unregister(*this);
Exchange::IController::JSystemManagement::Unregister(*this);
Exchange::IController::JLifeTime::Unregister(*this);
Exchange::IController::JMetadata::Unregister(*this);
Exchange::Controller::JConfiguration::Unregister(*this);
Exchange::Controller::JDiscovery::Unregister(*this);
Exchange::Controller::JSystemManagement::Unregister(*this);
Exchange::Controller::JLifeTime::Unregister(*this);
Exchange::Controller::JMetadata::Unregister(*this);

// Detach the SubSystems, we are shutting down..
PluginHost::ISubSystem* subSystems(_service->SubSystems());
Expand All @@ -165,7 +164,6 @@ namespace Plugin {
_probe = nullptr;
}

Unregister(this);
_service->Unregister(&_systemInfoReport);

/* stop the file serving over http.... */
Expand Down Expand Up @@ -835,7 +833,7 @@ namespace Plugin {
return (result);
}

Core::hresult Controller::Register(Exchange::IController::ILifeTime::INotification* notification)
Core::hresult Controller::Register(Exchange::Controller::ILifeTime::INotification* notification)
{
_adminLock.Lock();

Expand All @@ -850,11 +848,11 @@ namespace Plugin {
return (Core::ERROR_NONE);
}

Core::hresult Controller::Unregister(Exchange::IController::ILifeTime::INotification* notification)
Core::hresult Controller::Unregister(Exchange::Controller::ILifeTime::INotification* notification)
{
_adminLock.Lock();

std::list<Exchange::IController::ILifeTime::INotification*>::iterator index(std::find(_observers.begin(), _observers.end(), notification));
std::list<Exchange::Controller::ILifeTime::INotification*>::iterator index(std::find(_observers.begin(), _observers.end(), notification));

// Make sure you do not unregister something you did not register !!!
ASSERT(index != _observers.end());
Expand Down Expand Up @@ -1168,23 +1166,22 @@ ASSERT(_service != nullptr);
return Core::ERROR_NONE;
}

void Controller::StateChange(const string& callsign, const PluginHost::IShell::state& state, const PluginHost::IShell::reason& reason)
{
Exchange::IController::JLifeTime::Event::StateChange(*this, callsign, state, reason);
}

void Controller::NotifyStateChange(const string& callsign, const PluginHost::IShell::state& state, const PluginHost::IShell::reason& reason)
{
_adminLock.Lock();

std::list<Exchange::IController::ILifeTime::INotification*>::const_iterator index = _observers.begin();
std::list<Exchange::Controller::ILifeTime::INotification*>::const_iterator index = _observers.begin();

while(index != _observers.end()) {
(*index)->StateChange(callsign, state, reason);
index++;
}

_adminLock.Unlock();

// also notify the JSON RPC listeners (if any)
Exchange::Controller::JLifeTime::Event::StateChange(*this, callsign, state, reason);

}
}
}
42 changes: 21 additions & 21 deletions Source/WPEFramework/Controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,17 @@
namespace WPEFramework {
namespace Plugin {

class Controller
PUSH_WARNING(DISABLE_WARNING_DEPRECATED_USE) // for now we must support the deprecated interface for backwards compatibility reasons
class Controller
: public PluginHost::IPlugin
, public PluginHost::IWeb
, public PluginHost::JSONRPC
, public Exchange::IController::IConfiguration
, public Exchange::IController::IDiscovery
, public Exchange::IController::ISystemManagement
, public Exchange::IController::IMetadata
, public Exchange::IController::ILifeTime
, public Exchange::IController::ILifeTime::INotification {
, public PluginHost::IController
, public Exchange::Controller::IConfiguration
, public Exchange::Controller::IDiscovery
, public Exchange::Controller::ISystemManagement
, public Exchange::Controller::IMetadata
, public Exchange::Controller::ILifeTime {
public:
class SubsystemsData : public Core::JSON::Container {
public:
Expand Down Expand Up @@ -333,8 +334,8 @@ namespace Plugin {
Core::hresult Configuration(const string& callsign, string& configuration) const override;
Core::hresult Configuration(const string& callsign, const string& configuration) override;

Core::hresult Register(Exchange::IController::ILifeTime::INotification* notification) override;
Core::hresult Unregister(Exchange::IController::ILifeTime::INotification* notification) override;
Core::hresult Register(Exchange::Controller::ILifeTime::INotification* notification) override;
Core::hresult Unregister(Exchange::Controller::ILifeTime::INotification* notification) override;

Core::hresult Activate(const string& callsign) override;
Core::hresult Deactivate(const string& callsign) override;
Expand All @@ -351,20 +352,18 @@ namespace Plugin {
Core::hresult Subsystems(string& response) const override;
Core::hresult Version(string& response) const override;

void StateChange(const string& callsign, const PluginHost::IShell::state& state, const PluginHost::IShell::reason& reason) override;

// IUnknown methods
// -------------------------------------------------------------------------------------------------------
BEGIN_INTERFACE_MAP(Controller)
INTERFACE_ENTRY(PluginHost::IPlugin)
INTERFACE_ENTRY(PluginHost::IWeb)
INTERFACE_ENTRY(PluginHost::IDispatcher)
INTERFACE_ENTRY(Exchange::IController::IConfiguration)
INTERFACE_ENTRY(Exchange::IController::IDiscovery)
INTERFACE_ENTRY(Exchange::IController::ISystemManagement)
INTERFACE_ENTRY(Exchange::IController::IMetadata)
INTERFACE_ENTRY(Exchange::IController::ILifeTime)
INTERFACE_ENTRY(Exchange::IController::ILifeTime::INotification)
INTERFACE_ENTRY(PluginHost::IPlugin)
INTERFACE_ENTRY(PluginHost::IWeb)
INTERFACE_ENTRY(PluginHost::IDispatcher)
INTERFACE_ENTRY(PluginHost::IController)
INTERFACE_ENTRY(Exchange::Controller::IConfiguration)
INTERFACE_ENTRY(Exchange::Controller::IDiscovery)
INTERFACE_ENTRY(Exchange::Controller::ISystemManagement)
INTERFACE_ENTRY(Exchange::Controller::IMetadata)
INTERFACE_ENTRY(Exchange::Controller::ILifeTime)
END_INTERFACE_MAP

private:
Expand Down Expand Up @@ -407,8 +406,9 @@ namespace Plugin {
std::list<string> _resumes;
uint32_t _lastReported;
std::vector<PluginHost::ISubSystem::subsystem> _externalSubsystems;
std::list<Exchange::IController::ILifeTime::INotification*> _observers;
std::list<Exchange::Controller::ILifeTime::INotification*> _observers;
};
POP_WARNING()
}
}

Expand Down
Loading

0 comments on commit 06e11df

Please sign in to comment.