diff --git a/Source/WPEFramework/Controller.cpp b/Source/WPEFramework/Controller.cpp index 15cc523cd1..b866145213 100644 --- a/Source/WPEFramework/Controller.cpp +++ b/Source/WPEFramework/Controller.cpp @@ -23,6 +23,7 @@ #include "JsonData_SystemManagement.h" #include "JsonData_LifeTime.h" #include "JsonData_Discovery.h" +#include "JsonData_Metadata.h" #include "JDiscovery.h" #include "JConfiguration.h" @@ -78,9 +79,9 @@ namespace Plugin { _resumes.clear(); _service = service; - + RPC::ConnectorController::Instance().Announce(service); - + _skipURL = static_cast(_service->WebPrefix().length()); Config config; @@ -280,11 +281,11 @@ namespace Plugin { return result; } - Core::hresult Controller::Environment(const string& index, string& environment) const + Core::hresult Controller::Environment(const string& variable, string& value) const { Core::hresult result = Core::ERROR_UNKNOWN_KEY; - if (Core::SystemInfo::GetEnvironment(index, environment) == true) { + if (Core::SystemInfo::GetEnvironment(variable, value) == true) { result = Core::ERROR_NONE; } @@ -450,7 +451,7 @@ namespace Plugin { } else { Core::NumberType threadIndex(index.Current()); - + Core::ProxyType>> response = jsonBodyCallstackFactory.Element(); Callstack(_pluginServer->WorkerPool().Id(threadIndex.Value()), *response); result->Body(Core::ProxyType(response)); @@ -472,7 +473,13 @@ namespace Plugin { Probe::Iterator index(_probe->Instances()); while (index.Next() == true) { - PluginHost::MetaData::Bridge newElement((*index).URL().Text(), (*index).Latency(), (*index).Model(), (*index).IsSecure()); + PluginHost::MetaData::Bridge newElement; + newElement.Locator = (*index).URL().Text(); + newElement.Latency = (*index).Latency(); + if ((*index).Model().empty() == false) { + newElement.Model = (*index).Model(); + } + newElement.Secure = (*index).IsSecure(); response->Bridges.Add(newElement); } @@ -627,7 +634,7 @@ namespace Plugin { result->Message = _T("Discovery cycle initiated"); } } else if (index.Current() == _T("Persist")) { - + _pluginServer->Persist(); result->ErrorCode = Web::STATUS_OK; @@ -723,9 +730,9 @@ namespace Plugin { for (const auto& proxy : proxies) { PluginHost::MetaData::COMRPC::Proxy& info(entry.Proxies.Add()); - info.InstanceId = proxy->Implementation(); - info.InterfaceId = proxy->InterfaceId(); - info.RefCount = proxy->ReferenceCount(); + info.Instance = proxy->Implementation(); + info.Interface = proxy->InterfaceId(); + info.Count = proxy->ReferenceCount(); } } ); @@ -798,7 +805,7 @@ namespace Plugin { if (callsign.empty() || (callsign == PluginHost::JSONRPC::Callsign())) { result = PluginHost::JSONRPC::Invoke(channelId, id, token, method, parameters, response); - } + } else { Core::ProxyType service; @@ -1031,14 +1038,6 @@ namespace Plugin { return Persist(); } - Core::hresult Controller::Proxies(string& response) const - { - Core::JSON::ArrayType jsonResponse; - Proxies(jsonResponse); - jsonResponse.ToString(response); - return(Core::ERROR_NONE); - } - Core::hresult Controller::StartDiscovery(const uint8_t& ttl) { if (_probe != nullptr) { @@ -1048,122 +1047,341 @@ namespace Plugin { return Core::ERROR_NONE; } - Core::hresult Controller::Status(const string& index, string& response) const + Core::hresult Controller::DiscoveryResults(IDiscovery::Data::IDiscoveryResultsIterator*& outResults) const { - Core::hresult result = Core::ERROR_UNKNOWN_KEY; + std::list results; - Core::JSON::ArrayType jsonResponse; - Core::ProxyType service; + if (_probe != nullptr) { + Probe::Iterator index(_probe->Instances()); - ASSERT(_pluginServer != nullptr); + while (index.Next() == true) { + results.push_back({ (*index).URL().Text(), (*index).Latency(), (*index).Model(), (*index).IsSecure() }); + } + } - if (index.empty() == true) { - _pluginServer->Services().GetMetaData(jsonResponse); - result = Core::ERROR_NONE; + if (results.empty() == false) { + using Iterator = IDiscovery::Data::IDiscoveryResultsIterator; + + outResults = Core::Service>::Create(results); + ASSERT(outResults != nullptr); } else { - if (_pluginServer->Services().FromIdentifier(index, service) == Core::ERROR_NONE) { + outResults = nullptr; + } + + return (Core::ERROR_NONE); + } + + Core::hresult Controller::Services(const string& callsign, IMetadata::Data::IServicesIterator*& outServices) const + { + Core::hresult result = Core::ERROR_UNKNOWN_KEY; + + std::list services; + + auto _Populate = [&services, this](const string& callsign) -> uint32_t { + + Core::hresult result = Core::ERROR_UNKNOWN_KEY; + Core::ProxyType service; + + ASSERT(_pluginServer != nullptr); + + if (_pluginServer->Services().FromIdentifier(callsign, service) == Core::ERROR_NONE) { ASSERT(service.IsValid()); + string info; - result = Core::ERROR_BAD_REQUEST; if (service->Metadata(info) == Core::ERROR_NONE) { - PluginHost::MetaData::Service status; - status.FromString(info); - jsonResponse.Add(status); - result = Core::ERROR_NONE; + PluginHost::MetaData::Service meta; + meta.FromString(info); + + IMetadata::Data::Service service{}; + + service.Callsign = meta.Callsign; + service.Locator = meta.Locator; + service.ClassName = meta.ClassName; + service.Module = meta.Module; + service.StartMode = meta.Startup; + service.AutoStart = meta.AutoStart; + service.State = meta.JSONState; + service.Version = meta.ServiceVersion; + service.Communicator = meta.Communicator; + service.PersistentPathPostfix = meta.PersistentPathPostfix; + service.VolatilePathPostfix = meta.VolatilePathPostfix; + service.SystemRootPath = meta.SystemRootPath; + service.AutoStart = meta.AutoStart; + service.Configuration = meta.Configuration; + service.Precondition = meta.Precondition; + service.Termination = meta.Termination; + +#if THUNDER_RESTFULL_API + service.Observers = meta.Observers; +#endif + +#if THUNDER_RUNTIME_STATISTICS + service.ProcessedRequests = meta.ProcessedRequests; + service.ProcessedObjects = meta.ProcessedObjects; +#endif + + services.push_back(service); } + + result = Core::ERROR_NONE; + } + + return (result); + }; + + if (callsign.empty() == true) { + auto it = _pluginServer->Services().Services(); + + while (it.Next() == true) { + _Populate(it.Current()->Callsign()); } + + result = Core::ERROR_NONE; + } + else { + result = _Populate(callsign); } - jsonResponse.ToString(response); - return result; + if (services.empty() == false) { + using Iterator = IMetadata::Data::IServicesIterator; + + outServices = Core::Service>::Create(services); + ASSERT(outServices != nullptr); + } + else { + outServices = nullptr; + } + + return (result); } - Core::hresult Controller::CallStack(const string& index, string& callstack) const + Core::hresult Controller::CallStack(const uint8_t thread, IMetadata::Data::ICallStackIterator*& outCallStack) const { - Core::JSON::ArrayType jsonResponse; Core::hresult result = Core::ERROR_UNKNOWN_KEY; - if (index.empty() == true) { - uint8_t indexValue = Core::NumberType(Core::TextFragment(index)).Value(); + std::list callStackInfo; - result = Core::ERROR_NONE; + ASSERT(_pluginServer != nullptr); + + ::DumpCallStack(_pluginServer->WorkerPool().Id(thread), callStackInfo); + + if (callStackInfo.empty() == false) { + + std::list callstack; + + for (const Core::callstack_info& entry : callStackInfo) { + callstack.push_back({ reinterpret_cast(entry.address), entry.function, entry.module, + (entry.line != static_cast(~0)? entry.line : 0) }); + } - Callstack(_pluginServer->WorkerPool().Id(indexValue), jsonResponse); + using Iterator = IMetadata::Data::ICallStackIterator; + + outCallStack = Core::Service>::Create(callstack); + ASSERT(outCallStack != nullptr); + + result = Core::ERROR_NONE; + } + else { + outCallStack = nullptr; } - jsonResponse.ToString(callstack); - return result; + return (result); } - Core::hresult Controller::Links(string& response) const + Core::hresult Controller::Links(IMetadata::Data::ILinksIterator*& outLinks) const { - Core::JSON::ArrayType jsonResponse; + Core::JSON::ArrayType meta; + ASSERT(_pluginServer != nullptr); - _pluginServer->Dispatcher().GetMetaData(jsonResponse); - _pluginServer->Services().GetMetaData(jsonResponse); - jsonResponse.ToString(response); + _pluginServer->Dispatcher().GetMetaData(meta); + _pluginServer->Services().GetMetaData(meta); - return Core::ERROR_NONE; + if (meta.Length() > 0) { + std::list links; + + auto it = meta.Elements(); + + while (it.Next() == true) { + auto const& entry = it.Current(); + links.push_back({ entry.Remote.Value(), entry.JSONState.Value(), entry.Name.Value(), entry.ID.Value(), entry.Activity.Value() }); + } + + using Iterator = IMetadata::Data::ILinksIterator; + + outLinks = Core::Service>::Create(links); + ASSERT(outLinks != nullptr); + } + else { + outLinks = nullptr; + } + + return (Core::ERROR_NONE); } - Core::hresult Controller::ProcessInfo(string& response) const + Core::hresult Controller::Proxies(const uint32_t& linkId, IMetadata::Data::IProxiesIterator*& outProxies) const { - PluginHost::MetaData::Server jsonResponse; - WorkerPoolMetaData(jsonResponse); - jsonResponse.ToString(response); + Core::hresult result = Core::ERROR_UNKNOWN_KEY; - return Core::ERROR_NONE; + Core::JSON::ArrayType meta; + _pluginServer->Services().GetMetaData(meta); + + Core::JSON::ArrayType comrpc; + Proxies(comrpc); + + string link; + std::list proxies; + + auto it = meta.Elements(); + + while (it.Next() == true) { + + if (it.Current().ID.Value() == linkId) { + link = it.Current().Remote.Value(); + break; + } + } + + if (link.empty() == false) { + auto it = comrpc.Elements(); + + while (it.Next() == true) { + + if (it.Current().Remote.Value() == link) { + auto it2 = it.Current().Proxies.Elements(); + + while (it2.Next() == true) { + auto const& entry = it2.Current(); + + proxies.push_back({ entry.Interface.Value(), entry.Instance.Value(), entry.Count.Value() }); + } + + break; + } + } + } + + if (proxies.empty() == false) { + using Iterator = IMetadata::Data::IProxiesIterator; + + outProxies = Core::Service>::Create(proxies); + ASSERT(outProxies != nullptr); + + result = Core::ERROR_NONE; + } + else { + outProxies = nullptr; + } + + return (result); } - Core::hresult Controller::Subsystems(string& response) const + Core::hresult Controller::Threads(IMetadata::Data::IThreadsIterator*& outThreads) const { - Core::JSON::ArrayType jsonResponse; -ASSERT(_service != nullptr); - PluginHost::ISubSystem* subSystem = _service->SubSystems(); + PluginHost::MetaData::Server meta; - if (subSystem != nullptr) { - uint8_t i = 0; - while (i < PluginHost::ISubSystem::END_LIST) { - PluginHost::ISubSystem::subsystem current(static_cast(i)); - SubsystemsData status; - status.Subsystem = current; - status.Active = subSystem->IsActive(current); - jsonResponse.Add(status); - ++i; + WorkerPoolMetaData(meta); + + if (meta.ThreadPoolRuns.Length() > 0) { + + std::list threads; + + auto it = meta.ThreadPoolRuns.Elements(); + + while (it.Next() == true) { + auto const& entry = it.Current(); + threads.push_back({ entry.Id.Value(), entry.Job.Value(), entry.Runs.Value() }); } - subSystem->Release(); + + using Iterator = IMetadata::Data::IThreadsIterator; + + outThreads = Core::Service>::Create(threads); + ASSERT(outThreads != nullptr); + } + else { + outThreads = nullptr; } - jsonResponse.ToString(response); + return (Core::ERROR_NONE); + } - return Core::ERROR_NONE; + Core::hresult Controller::PendingRequests(IMetadata::Data::IPendingRequestsIterator*& outRequests) const + { + PluginHost::MetaData::Server meta; + + WorkerPoolMetaData(meta); + + if (meta.PendingRequests.Length() > 0) { + + std::list requests; + + auto it = meta.PendingRequests.Elements(); + + while (it.Next() == true) { + requests.push_back(it.Current().Value()); + } + + using Iterator = IMetadata::Data::IPendingRequestsIterator; + + outRequests = Core::Service>::Create(requests); + ASSERT(outRequests != nullptr); + } + else { + outRequests = nullptr; + } + + return (Core::ERROR_NONE); } - Core::hresult Controller::DiscoveryResults(string& response) const + + + Core::hresult Controller::Subsystems(IMetadata::Data::ISubsystemsIterator*& outSubsystems) const { - Core::JSON::ArrayType jsonResponse; - if (_probe != nullptr) { - Probe::Iterator index(_probe->Instances()); + ASSERT(_service != nullptr); - while (index.Next() == true) { - PluginHost::MetaData::Bridge element((*index).URL().Text(), (*index).Latency(), (*index).Model(), (*index).IsSecure()); - jsonResponse.Add(element); + PluginHost::ISubSystem* subSystem = _service->SubSystems(); + + if (subSystem != nullptr) { + std::list subsystems; + + std::underlying_type::type i = 0; + + while (i < PluginHost::ISubSystem::END_LIST) { + + const PluginHost::ISubSystem::subsystem subsystem = static_cast(i); + + subsystems.push_back({ subsystem, subSystem->IsActive(subsystem)}); + + i++; } + + subSystem->Release(); + + using Iterator = IMetadata::Data::ISubsystemsIterator; + + outSubsystems = Core::Service>::Create(subsystems); + ASSERT(outSubsystems != nullptr); + } + else { + outSubsystems = nullptr; } - jsonResponse.ToString(response); - return Core::ERROR_NONE; + return (Core::ERROR_NONE); } - Core::hresult Controller::Version(string& response) const + Core::hresult Controller::Version(IMetadata::Data::Version& version) const { - PluginHost::MetaData::Version jsonResponse; - _pluginServer->Metadata(jsonResponse); - jsonResponse.ToString(response); + PluginHost::MetaData::Version ver; - return Core::ERROR_NONE; + _pluginServer->Metadata(ver); + + version.Hash = ver.Hash; + version.Major = ver.Major; + version.Minor = ver.Minor; + version.Patch = ver.Patch; + + return (Core::ERROR_NONE); } void Controller::NotifyStateChange(const string& callsign, const PluginHost::IShell::state& state, const PluginHost::IShell::reason& reason) @@ -1181,7 +1399,6 @@ ASSERT(_service != nullptr); // also notify the JSON RPC listeners (if any) Exchange::Controller::JLifeTime::Event::StateChange(*this, callsign, state, reason); - } } } diff --git a/Source/WPEFramework/Controller.h b/Source/WPEFramework/Controller.h index 41437be306..1e6a4827c0 100644 --- a/Source/WPEFramework/Controller.h +++ b/Source/WPEFramework/Controller.h @@ -324,11 +324,11 @@ namespace Plugin { // ------------------------------------------------------------------------------------------------------- Core::hresult Delete(const string& path) override; Core::hresult Reboot() override; - Core::hresult Environment(const string& index, string& environment) const override; - Core::hresult Clone(const string& callsign, const string& newcallsign, string& response /* @out */) override; + Core::hresult Environment(const string& variable, string& value) const override; + Core::hresult Clone(const string& callsign, const string& newcallsign, string& response) override; Core::hresult StartDiscovery(const uint8_t& ttl) override; - Core::hresult DiscoveryResults(string& response) const override; + Core::hresult DiscoveryResults(IDiscovery::Data::IDiscoveryResultsIterator*& results) const override; Core::hresult Persist() override; Core::hresult Configuration(const string& callsign, string& configuration) const override; @@ -342,15 +342,17 @@ namespace Plugin { Core::hresult Unavailable(const string& callsign) override; Core::hresult Suspend(const string& callsign) override; Core::hresult Resume(const string& callsign) override; - Core::hresult Hibernate(const string& callsign, const Core::hresult timeout); - - Core::hresult Proxies(string& response) const override; - Core::hresult Status(const string& index, string& response) const override; - Core::hresult CallStack(const string& index, string& callstack) const override; - Core::hresult Links(string& response) const override; - Core::hresult ProcessInfo(string& response) const override; - Core::hresult Subsystems(string& response) const override; - Core::hresult Version(string& response) const override; + Core::hresult Hibernate(const string& callsign, const uint32_t timeout); + + // IMetadata overrides + Core::hresult Links(IMetadata::Data::ILinksIterator*& links) const override; + Core::hresult Proxies(const uint32_t& linkId, IMetadata::Data::IProxiesIterator*& proxies) const override; + Core::hresult Services(const string& callsign, IMetadata::Data::IServicesIterator*& services) const override; + Core::hresult CallStack(const uint8_t threadId, IMetadata::Data::ICallStackIterator*& callstack) const override; + Core::hresult Threads(IMetadata::Data::IThreadsIterator*& threads) const override; + Core::hresult PendingRequests(IMetadata::Data::IPendingRequestsIterator*& requests) const override; + Core::hresult Subsystems(IMetadata::Data::ISubsystemsIterator*& subsystems) const override; + Core::hresult Version(IMetadata::Data::Version& version) const override; // IUnknown methods // ------------------------------------------------------------------------------------------------------- diff --git a/Source/WPEFramework/ControllerPlugin.json b/Source/WPEFramework/ControllerPlugin.json new file mode 100644 index 0000000000..136c458217 --- /dev/null +++ b/Source/WPEFramework/ControllerPlugin.json @@ -0,0 +1,17 @@ +{ + "$schema": "plugin.schema.json", + "info": { + "title": "Controller Plugin", + "callsign": "Controller", + "locator": "(built-in)", + "status": "production", + "version": "1.0", + "acronyms": { + "FQDN": "Fully-Qualified Domain Name", + "SSDP": "Simple Service Discovery Protocol" + } + }, + "interface": [ + { "$cppref": "{cppinterfacedir}/IController.h" } + ] +} diff --git a/Source/WPEFramework/PluginHost.cpp b/Source/WPEFramework/PluginHost.cpp index 4bee987865..407f4b4aa0 100644 --- a/Source/WPEFramework/PluginHost.cpp +++ b/Source/WPEFramework/PluginHost.cpp @@ -716,9 +716,9 @@ POP_WARNING() for (const auto& proxy : proxies) { MetaData::COMRPC::Proxy& info(entry.Proxies.Add()); - info.InstanceId = proxy->Implementation(); - info.InterfaceId = proxy->InterfaceId(); - info.RefCount = proxy->ReferenceCount(); + info.Instance = proxy->Implementation(); + info.Interface = proxy->InterfaceId(); + info.Count = proxy->ReferenceCount(); } } ); @@ -733,8 +733,8 @@ POP_WARNING() Core::JSON::ArrayType::Iterator loop(index.Current().Proxies.Elements()); while (loop.Next() == true) { - uint64_t instanceId = loop.Current().InstanceId.Value(); - printf("InstanceId: 0x%" PRIx64 ", RefCount: %d, InterfaceId %d [0x%X]\n", instanceId, loop.Current().RefCount.Value(), loop.Current().InterfaceId.Value(), loop.Current().InterfaceId.Value()); + uint64_t instanceId = loop.Current().Instance.Value(); + printf("InstanceId: 0x%" PRIx64 ", RefCount: %d, InterfaceId %d [0x%X]\n", instanceId, loop.Current().Count.Value(), loop.Current().Interface.Value(), loop.Current().Interface.Value()); } printf("\n"); } diff --git a/Source/WPEFramework/PluginServer.cpp b/Source/WPEFramework/PluginServer.cpp index d9d42f3cb8..1ca42e842e 100644 --- a/Source/WPEFramework/PluginServer.cpp +++ b/Source/WPEFramework/PluginServer.cpp @@ -219,7 +219,7 @@ namespace PluginHost newInfo.Activity = client->HasActivity(); newInfo.Remote = client->RemoteId(); - newInfo.JSONState = (client->IsWebSocket() ? ((client->State() != PluginHost::Channel::RAW) ? MetaData::Channel::RAWSOCKET : MetaData::Channel::WEBSOCKET) : (client->IsWebServer() ? MetaData::Channel::WEBSERVER : MetaData::Channel::SUSPENDED)); + newInfo.JSONState = (client->IsWebSocket() ? ((client->State() != PluginHost::Channel::RAW) ? MetaData::Channel::state::RAWSOCKET : MetaData::Channel::state::WEBSOCKET) : (client->IsWebServer() ? MetaData::Channel::state::WEBSERVER : MetaData::Channel::state::SUSPENDED)); string name = client->Name(); if (name.empty() == false) { diff --git a/Source/WPEFramework/bridge.vcxproj b/Source/WPEFramework/bridge.vcxproj old mode 100644 new mode 100755 diff --git a/Source/WPEFramework/doc/ControllerPlugin.md b/Source/WPEFramework/doc/ControllerPlugin.md index 6d59751568..5697a4aa3a 100644 --- a/Source/WPEFramework/doc/ControllerPlugin.md +++ b/Source/WPEFramework/doc/ControllerPlugin.md @@ -11,7 +11,6 @@ Controller plugin for Thunder framework. ### Table of Contents - [Introduction](#head.Introduction) -- [Description](#head.Description) - [Configuration](#head.Configuration) - [Interfaces](#head.Interfaces) - [Methods](#head.Methods) @@ -24,7 +23,7 @@ Controller plugin for Thunder framework. ## Scope -This document describes purpose and functionality of the Controller plugin. It includes detailed specification about its configuration, methods and properties provided, as well as notifications sent. +This document describes purpose and functionality of the Controller plugin. It includes detailed specification about its configuration, methods and properties as well as sent notifications. ## Case Sensitivity @@ -39,12 +38,11 @@ The table below provides and overview of acronyms used in this document and thei | Acronym | Description | | :-------- | :-------- | | API | Application Programming Interface | -| FQDN | Fully Qualified Domain Name | +| FQDN | Fully-Qualified Domain Name | | HTTP | Hypertext Transfer Protocol | | JSON | JavaScript Object Notation; a data interchange format | | JSON-RPC | A remote procedure call protocol encoded in JSON | | SSDP | Simple Service Discovery Protocol | -| URL | Uniform Resource Locator | The table below provides and overview of terms and abbreviations used in this document and their definitions. @@ -62,13 +60,6 @@ The table below provides and overview of terms and abbreviations used in this do | [JSON](http://www.json.org/) | JSON specification | | [Thunder](https://github.com/WebPlatformForEmbedded/Thunder/blob/master/doc/WPE%20-%20API%20-%20WPEFramework.docx) | Thunder API Reference | - -# Description - -The Controller plugin controls (activates and deactivates) the configured plugins. The plugin is part of the framework and cannot be activated or deactivated itself, thus as well cannot not be unloaded. - -The plugin is designed to be loaded and executed within the Thunder framework. For more information about the framework refer to [[Thunder](#ref.Thunder)]. - # Configuration @@ -76,60 +67,68 @@ The table below lists configuration options of the plugin. | Name | Type | Description | | :-------- | :-------- | :-------- | -| callsign | string | *(optional)* Instance name of the plugin (default: *Controller*) | -| autostart | boolean | *(optional)* Determines if the plugin is to be started along with the framework (always *true* as Controller is a part of the framework) | -| configuration | object | *(optional)* Custom plugin configuration: | -| configuration?.downloadstore | string | *(optional)* Path within persistent storage to hold file downloads | -| configuration?.ttl | number | *(optional)* TTL to be set on the broadcast package for framework discovery in the network (default: 1) | -| configuration?.resumes | array | *(optional)* List of callsigns that have an *IStateControl* interface and need a resume at startup | -| configuration?.resumes[#] | string | *(optional)* Plugin callsign | -| configuration?.subsystems | array | *(optional)* List of subsystems configured for the system | -| configuration?.subsystems[#] | string | *(optional)* Subsystem name | +| callsign | string | Plugin instance name (default: *Controller*) | +| classname | string | Class name: *Controller* | +| locator | string | Library name: *(built-in)* | +| autostart | boolean | Determines if the plugin shall be started automatically along with the framework | # Interfaces This plugin implements the following interfaces: -- [Controller.json](https://github.com/rdkcentral/Thunder/blob/master/Source/WPEFramework/json/Controller.json) (version 1.0.0) +- ISystemManagement ([IController.h](https://github.com/rdkcentral/ThunderInterfaces/blob/master/interfaces/IController.h)) (version 1.0.0) (compliant format) +- IDiscovery ([IController.h](https://github.com/rdkcentral/ThunderInterfaces/blob/master/interfaces/IController.h)) (version 1.0.0) (compliant format) +- IConfiguration ([IController.h](https://github.com/rdkcentral/ThunderInterfaces/blob/master/interfaces/IController.h)) (version 1.0.0) (uncompliant-extended format) +- ILifeTime ([IController.h](https://github.com/rdkcentral/ThunderInterfaces/blob/master/interfaces/IController.h)) (version 1.0.0) (compliant format) +- IMetadata ([IController.h](https://github.com/rdkcentral/ThunderInterfaces/blob/master/interfaces/IController.h)) (version 1.0.0) (compliant format) # Methods The following methods are provided by the Controller plugin: -Controller interface methods: +SystemManagement interface methods: | Method | Description | | :-------- | :-------- | -| [activate](#method.activate) | Activates a plugin | -| [deactivate](#method.deactivate) | Deactivates a plugin | -| [resume](#method.resume) | Resumes a plugin | -| [suspend](#method.suspend) | Suspends a plugin | -| [unavailable](#method.unavailable) | Set a plugin unavailable for interaction | -| [startdiscovery](#method.startdiscovery) | Starts the network discovery | -| [storeconfig](#method.storeconfig) | Stores the configuration | +| [reboot](#method.reboot) / [harakiri](#method.reboot) | Reboots the device | | [delete](#method.delete) | Removes contents of a directory from the persistent storage | -| [harakiri](#method.harakiri) | Reboots the device | +| [clone](#method.clone) | Creates a clone of given plugin to requested new callsign | +Discovery interface methods: - -## *activate [method](#head.Methods)* +| Method | Description | +| :-------- | :-------- | +| [startdiscovery](#method.startdiscovery) | Starts the network discovery | + +Configuration interface methods: + +| Method | Description | +| :-------- | :-------- | +| [persist](#method.persist) / [storeconfig](#method.persist) | Stores the configuration to persistent memory | + +LifeTime interface methods: -Activates a plugin. +| Method | Description | +| :-------- | :-------- | +| [activate](#method.activate) | Activates a plugin, | +| [deactivate](#method.deactivate) | Deactivates a plugin, | +| [unavailable](#method.unavailable) | Sets a plugin unavailable for interaction | +| [hibernate](#method.hibernate) | Sets a plugin in Hibernate state | +| [suspend](#method.suspend) | Suspends a plugin | +| [resume](#method.resume) | Resumes a plugin | -### Description + +## *reboot [method](#head.Methods)* -Use this method to activate a plugin, i.e. move from Deactivated, via Activating to Activated state. If a plugin is in the Activated state, it can handle JSON-RPC requests that are coming in. The plugin is loaded into memory only if it gets activated. +Reboots the device. -Also see: [statechange](#event.statechange) +> ``harakiri`` is an alternative name for this method. ### Parameters -| Name | Type | Description | -| :-------- | :-------- | :-------- | -| params | object | | -| params.callsign | string | Plugin callsign | +This method takes no parameters. ### Result @@ -137,29 +136,15 @@ Also see: [statechange](#event.statechange) | :-------- | :-------- | :-------- | | result | null | Always null | -### Errors - -| Code | Message | Description | -| :-------- | :-------- | :-------- | -| 31 | ```ERROR_PENDING_CONDITIONS``` | The plugin will be activated once its activation preconditions are met | -| 12 | ```ERROR_INPROGRESS``` | The plugin is currently being activated | -| 22 | ```ERROR_UNKNOWN_KEY``` | The plugin does not exist | -| 6 | ```ERROR_OPENING_FAILED``` | Failed to activate the plugin | -| 5 | ```ERROR_ILLEGAL_STATE``` | Current state of the plugin does not allow activation | -| 24 | ```ERROR_PRIVILEGED_REQUEST``` | Activation of the plugin is not allowed (e.g. Controller) | - ### Example #### Request ```json { - "jsonrpc": "2.0", - "id": 42, - "method": "Controller.1.activate", - "params": { - "callsign": "DeviceInfo" - } + "jsonrpc": "2.0", + "id": 42, + "method": "Controller.1.reboot" } ``` @@ -167,29 +152,23 @@ Also see: [statechange](#event.statechange) ```json { - "jsonrpc": "2.0", - "id": 42, - "result": null + "jsonrpc": "2.0", + "id": 42, + "result": null } ``` - -## *deactivate [method](#head.Methods)* - -Deactivates a plugin. - -### Description - -Use this method to deactivate a plugin, i.e. move from Activated, via Deactivating to Deactivated state. If a plugin is Deactivated, the actual plugin (.so) is no longer loaded into the memory of the process. In a deactivated state, the plugin will not respond to any JSON-RPC requests. + +## *delete [method](#head.Methods)* -Also see: [statechange](#event.statechange) +Removes contents of a directory from the persistent storage. ### Parameters | Name | Type | Description | | :-------- | :-------- | :-------- | | params | object | | -| params.callsign | string | Callsign of the plugin | +| params.path | string | | ### Result @@ -197,28 +176,18 @@ Also see: [statechange](#event.statechange) | :-------- | :-------- | :-------- | | result | null | Always null | -### Errors - -| Code | Message | Description | -| :-------- | :-------- | :-------- | -| 12 | ```ERROR_INPROGRESS``` | The plugin is currently being deactivated | -| 22 | ```ERROR_UNKNOWN_KEY``` | The plugin does not exist | -| 5 | ```ERROR_ILLEGAL_STATE``` | Current state of the plugin does not allow deactivation | -| 19 | ```ERROR_CLOSING_FAILED``` | Failed to activate the plugin | -| 24 | ```ERROR_PRIVILEGED_REQUEST``` | Deactivation of the plugin is not allowed (e.g. Controller) | - ### Example #### Request ```json { - "jsonrpc": "2.0", - "id": 42, - "method": "Controller.1.deactivate", - "params": { - "callsign": "DeviceInfo" - } + "jsonrpc": "2.0", + "id": 42, + "method": "Controller.1.delete", + "params": { + "path": "..." + } } ``` @@ -226,46 +195,30 @@ Also see: [statechange](#event.statechange) ```json { - "jsonrpc": "2.0", - "id": 42, - "result": null + "jsonrpc": "2.0", + "id": 42, + "result": null } ``` - -## *resume [method](#head.Methods)* - -Resumes a plugin. - -### Description - -This is a more intelligent method, compared to the Activate, on the controller to move a plugin to a *resumed* state depending on its current state. If required, it will activate and move to the resumed state, regardless of the flags in the config (AutoStart/Resumed) + +## *clone [method](#head.Methods)* -Also see: [statechange](#event.statechange) +Creates a clone of given plugin to requested new callsign. ### Parameters | Name | Type | Description | | :-------- | :-------- | :-------- | | params | object | | -| params.callsign | string | Plugin callsign | +| params.callsign | string | | +| params.newcallsign | string | | ### Result | Name | Type | Description | | :-------- | :-------- | :-------- | -| result | null | Always null | - -### Errors - -| Code | Message | Description | -| :-------- | :-------- | :-------- | -| 31 | ```ERROR_PENDING_CONDITIONS``` | The plugin will be activated once its activation preconditions are met | -| 12 | ```ERROR_INPROGRESS``` | The plugin is currently being activated | -| 22 | ```ERROR_UNKNOWN_KEY``` | The plugin does not exist | -| 6 | ```ERROR_OPENING_FAILED``` | Failed to activate the plugin | -| 5 | ```ERROR_ILLEGAL_STATE``` | Current state of the plugin does not allow activation | -| 24 | ```ERROR_PRIVILEGED_REQUEST``` | Activation of the plugin is not allowed (e.g. Controller) | +| response | string | | ### Example @@ -273,12 +226,13 @@ Also see: [statechange](#event.statechange) ```json { - "jsonrpc": "2.0", - "id": 42, - "method": "Controller.1.resume", - "params": { - "callsign": "Netflix" - } + "jsonrpc": "2.0", + "id": 42, + "method": "Controller.1.clone", + "params": { + "callsign": "...", + "newcallsign": "..." + } } ``` @@ -286,29 +240,23 @@ Also see: [statechange](#event.statechange) ```json { - "jsonrpc": "2.0", - "id": 42, - "result": null + "jsonrpc": "2.0", + "id": 42, + "result": "..." } ``` - -## *suspend [method](#head.Methods)* - -Suspends a plugin. - -### Description - -This is a more intelligent method, compared to the Deactivate, on the controller to move a plugin to a *suspended* state depending on its current state. Depending on the AutoStart flag, this method will Deactivate the plugin [AutoStart == false] or only Suspend the plugin [AutoStart == true] + +## *startdiscovery [method](#head.Methods)* -Also see: [statechange](#event.statechange) +Starts the network discovery. Use this method to initiate SSDP network discovery process. ### Parameters | Name | Type | Description | | :-------- | :-------- | :-------- | | params | object | | -| params.callsign | string | Callsign of the plugin | +| params.ttl | integer | | ### Result @@ -316,28 +264,18 @@ Also see: [statechange](#event.statechange) | :-------- | :-------- | :-------- | | result | null | Always null | -### Errors - -| Code | Message | Description | -| :-------- | :-------- | :-------- | -| 12 | ```ERROR_INPROGRESS``` | The plugin is currently being deactivated | -| 22 | ```ERROR_UNKNOWN_KEY``` | The plugin does not exist | -| 5 | ```ERROR_ILLEGAL_STATE``` | Current state of the plugin does not allow deactivation | -| 19 | ```ERROR_CLOSING_FAILED``` | Failed to activate the plugin | -| 24 | ```ERROR_PRIVILEGED_REQUEST``` | Deactivation of the plugin is not allowed (e.g. Controller) | - ### Example #### Request ```json { - "jsonrpc": "2.0", - "id": 42, - "method": "Controller.1.suspend", - "params": { - "callsign": "Amazon" - } + "jsonrpc": "2.0", + "id": 42, + "method": "Controller.1.startdiscovery", + "params": { + "ttl": 0 + } } ``` @@ -345,29 +283,22 @@ Also see: [statechange](#event.statechange) ```json { - "jsonrpc": "2.0", - "id": 42, - "result": null + "jsonrpc": "2.0", + "id": 42, + "result": null } ``` - -## *unavailable [method](#head.Methods)* - -Set a plugin unavailable for interaction. + +## *persist [method](#head.Methods)* -### Description +Stores the configuration to persistent memory. -Use this method to mark a plugin as unavailable, i.e. move from Deactivated to Unavailable state. If a plugin is Unavailable, the actual plugin (.so) is no longer loaded into the memory of the process. The plugin will not respond to any JSON-RPC requests and it can not be startedunless it is first deactivated (which triggers a state transition. - -Also see: [statechange](#event.statechange) +> ``storeconfig`` is an alternative name for this method. ### Parameters -| Name | Type | Description | -| :-------- | :-------- | :-------- | -| params | object | | -| params.callsign | string | Callsign of the plugin | +This method takes no parameters. ### Result @@ -375,27 +306,15 @@ Also see: [statechange](#event.statechange) | :-------- | :-------- | :-------- | | result | null | Always null | -### Errors - -| Code | Message | Description | -| :-------- | :-------- | :-------- | -| 22 | ```ERROR_UNKNOWN_KEY``` | The plugin does not exist | -| 5 | ```ERROR_ILLEGAL_STATE``` | Current state of the plugin does not allow setting to Unavailable | -| 19 | ```ERROR_CLOSING_FAILED``` | Failed to activate the plugin | -| 24 | ```ERROR_PRIVILEGED_REQUEST``` | Marking the plugin as unavailable is not allowed (e.g. Controller) | - ### Example #### Request ```json { - "jsonrpc": "2.0", - "id": 42, - "method": "Controller.1.unavailable", - "params": { - "callsign": "DeviceInfo" - } + "jsonrpc": "2.0", + "id": 42, + "method": "Controller.1.persist" } ``` @@ -403,27 +322,23 @@ Also see: [statechange](#event.statechange) ```json { - "jsonrpc": "2.0", - "id": 42, - "result": null + "jsonrpc": "2.0", + "id": 42, + "result": null } ``` - -## *startdiscovery [method](#head.Methods)* - -Starts the network discovery. - -### Description + +## *activate [method](#head.Methods)* -Use this method to initiate SSDP network discovery process. +Activates a plugin, i.e. move from Deactivated, via Activating to Activated state. ### Parameters | Name | Type | Description | | :-------- | :-------- | :-------- | | params | object | | -| params.ttl | number | TTL (time to live) parameter for SSDP discovery | +| params.callsign | string | | ### Result @@ -437,12 +352,12 @@ Use this method to initiate SSDP network discovery process. ```json { - "jsonrpc": "2.0", - "id": 42, - "method": "Controller.1.startdiscovery", - "params": { - "ttl": 1 - } + "jsonrpc": "2.0", + "id": 42, + "method": "Controller.1.activate", + "params": { + "callsign": "..." + } } ``` @@ -450,24 +365,23 @@ Use this method to initiate SSDP network discovery process. ```json { - "jsonrpc": "2.0", - "id": 42, - "result": null + "jsonrpc": "2.0", + "id": 42, + "result": null } ``` - -## *storeconfig [method](#head.Methods)* - -Stores the configuration. - -### Description + +## *deactivate [method](#head.Methods)* -Use this method to save the current configuration to persistent memory. +Deactivates a plugin, i.e. move from Activated, via Deactivating to Deactivated state. ### Parameters -This method takes no parameters. +| Name | Type | Description | +| :-------- | :-------- | :-------- | +| params | object | | +| params.callsign | string | | ### Result @@ -475,21 +389,18 @@ This method takes no parameters. | :-------- | :-------- | :-------- | | result | null | Always null | -### Errors - -| Code | Message | Description | -| :-------- | :-------- | :-------- | -| 1 | ```ERROR_GENERAL``` | Failed to store the configuration | - ### Example #### Request ```json { - "jsonrpc": "2.0", - "id": 42, - "method": "Controller.1.storeconfig" + "jsonrpc": "2.0", + "id": 42, + "method": "Controller.1.deactivate", + "params": { + "callsign": "..." + } } ``` @@ -497,27 +408,23 @@ This method takes no parameters. ```json { - "jsonrpc": "2.0", - "id": 42, - "result": null + "jsonrpc": "2.0", + "id": 42, + "result": null } ``` - -## *delete [method](#head.Methods)* - -Removes contents of a directory from the persistent storage. - -### Description + +## *unavailable [method](#head.Methods)* -Use this method to recursively delete contents of a directory +Sets a plugin unavailable for interaction. ### Parameters | Name | Type | Description | | :-------- | :-------- | :-------- | | params | object | | -| params.path | string | Path to directory (within the persistent storage) to delete contents of | +| params.callsign | string | | ### Result @@ -525,25 +432,18 @@ Use this method to recursively delete contents of a directory | :-------- | :-------- | :-------- | | result | null | Always null | -### Errors - -| Code | Message | Description | -| :-------- | :-------- | :-------- | -| 22 | ```ERROR_UNKNOWN_KEY``` | The given path was incorrect | -| 24 | ```ERROR_PRIVILEGED_REQUEST``` | The path points outside of persistent directory or some files/directories couldn't have been deleted | - ### Example #### Request ```json { - "jsonrpc": "2.0", - "id": 42, - "method": "Controller.1.delete", - "params": { - "path": "test/test.txt" - } + "jsonrpc": "2.0", + "id": 42, + "method": "Controller.1.unavailable", + "params": { + "callsign": "..." + } } ``` @@ -551,24 +451,24 @@ Use this method to recursively delete contents of a directory ```json { - "jsonrpc": "2.0", - "id": 42, - "result": null + "jsonrpc": "2.0", + "id": 42, + "result": null } ``` - -## *harakiri [method](#head.Methods)* - -Reboots the device. - -### Description + +## *hibernate [method](#head.Methods)* -Use this method to reboot the device. Depending on the device, this call may not generate a response. +Sets a plugin in Hibernate state. ### Parameters -This method takes no parameters. +| Name | Type | Description | +| :-------- | :-------- | :-------- | +| params | object | | +| params.callsign | string | | +| params.timeout | integer | | ### Result @@ -576,23 +476,19 @@ This method takes no parameters. | :-------- | :-------- | :-------- | | result | null | Always null | -### Errors - -| Code | Message | Description | -| :-------- | :-------- | :-------- | -| 2 | ```ERROR_UNAVAILABLE``` | Rebooting procedure is not available on the device | -| 24 | ```ERROR_PRIVILEGED_REQUEST``` | Insufficient privileges to reboot the device | -| 1 | ```ERROR_GENERAL``` | Failed to reboot the device | - ### Example #### Request ```json { - "jsonrpc": "2.0", - "id": 42, - "method": "Controller.1.harakiri" + "jsonrpc": "2.0", + "id": 42, + "method": "Controller.1.hibernate", + "params": { + "callsign": "...", + "timeout": 0 + } } ``` @@ -600,263 +496,150 @@ This method takes no parameters. ```json { - "jsonrpc": "2.0", - "id": 42, - "result": null + "jsonrpc": "2.0", + "id": 42, + "result": null } ``` - -# Properties - -The following properties are provided by the Controller plugin: - -Controller interface properties: - -| Property | Description | -| :-------- | :-------- | -| [status](#property.status) RO | Information about plugins, including their configurations | -| [links](#property.links) RO | Information about active connections | -| [processinfo](#property.processinfo) RO | Information about the framework process | -| [subsystems](#property.subsystems) RO | Status of the subsystems | -| [discoveryresults](#property.discoveryresults) RO | SSDP network discovery results | -| [environment](#property.environment) RO | Value of an environment variable | -| [configuration](#property.configuration) | Configuration object of a service | -| [version](#property.version) | version of the controller | -| [prefix](#property.prefix) | prefix | -| [idletime](#property.idletime) | idle time | -| [latitude](#property.latitude) | latitude | -| [longitude](#property.longitude) | longitude | - + +## *suspend [method](#head.Methods)* - -## *status [property](#head.Properties)* +Suspends a plugin. -Provides access to the information about plugins, including their configurations. +### Parameters -> This property is **read-only**. +| Name | Type | Description | +| :-------- | :-------- | :-------- | +| params | object | | +| params.callsign | string | | -### Value +### Result | Name | Type | Description | | :-------- | :-------- | :-------- | -| (property) | array | A list of loaded plugins | -| (property)[#] | object | (a plugin entry) | -| (property)[#].callsign | string | Instance name of the plugin | -| (property)[#].locator | string | Library name | -| (property)[#].classname | string | Class name | -| (property)[#].autostart | string | Determines if the plugin is to be started automatically along with the framework | -| (property)[#]?.precondition | array | *(optional)* List of subsystems the plugin depends on | -| (property)[#]?.precondition[#] | string | *(optional)* (a subsystem entry) (must be one of the following: *Platform*, *Network*, *Security*, *Identifier*, *Internet*, *Location*, *Time*, *Provisioning*, *Decryption*, *Graphics*, *WebSource*, *Streaming*) | -| (property)[#]?.configuration | string | *(optional)* Custom configuration properties of the plugin | -| (property)[#].state | string | State of the plugin (must be one of the following: *Deactivated*, *Deactivation*, *Activated*, *Activation*, *Suspended*, *Resumed*, *Precondition*) | -| (property)[#].processedrequests | number | Number of API requests that have been processed by the plugin | -| (property)[#].processedobjects | number | Number of objects that have been processed by the plugin | -| (property)[#].observers | number | Number of observers currently watching the plugin (WebSockets) | -| (property)[#]?.module | string | *(optional)* Name of the plugin from a module perspective (used e.g. in tracing) | -| (property)[#]?.hash | string | *(optional)* SHA256 hash identifying the sources from which this plugin was build | - -> The *callsign* argument shall be passed as the index to the property, e.g. *Controller.1.status@DeviceInfo*. If the *callsign* is omitted, then status of all plugins is returned. - -### Errors - -| Code | Message | Description | -| :-------- | :-------- | :-------- | -| 22 | ```ERROR_UNKNOWN_KEY``` | The plugin does not exist | +| result | null | Always null | ### Example -#### Get Request +#### Request ```json { - "jsonrpc": "2.0", - "id": 42, - "method": "Controller.1.status@DeviceInfo" + "jsonrpc": "2.0", + "id": 42, + "method": "Controller.1.suspend", + "params": { + "callsign": "..." + } } ``` -#### Get Response +#### Response ```json { - "jsonrpc": "2.0", - "id": 42, - "result": [ - { - "callsign": "DeviceInfo", - "locator": "libWPEFrameworkDeviceInfo", - "classname": "DeviceInfo", - "autostart": "True", - "precondition": [ - "Platform" - ], - "configuration": "...", - "state": "Activated", - "processedrequests": 2, - "processedobjects": 0, - "observers": 0, - "module": "Plugin_DeviceInfo", - "hash": "custom" - } - ] + "jsonrpc": "2.0", + "id": 42, + "result": null } ``` - -## *links [property](#head.Properties)* - -Provides access to the information about active connections. + +## *resume [method](#head.Methods)* -> This property is **read-only**. +Resumes a plugin. -### Value +### Parameters | Name | Type | Description | | :-------- | :-------- | :-------- | -| (property) | array | List of active connections | -| (property)[#] | object | (a connection entry) | -| (property)[#].remote | string | IP address (or FQDN) of the other side of the connection | -| (property)[#].state | string | State of the link (must be one of the following: *WebServer*, *WebSocket*, *RawSocket*, *Closed*, *Suspended*) | -| (property)[#].activity | boolean | Denotes if there was any activity on this connection | -| (property)[#].id | number | A unique number identifying the connection | -| (property)[#]?.name | string | *(optional)* Name of the connection | - -### Example - -#### Get Request - -```json -{ - "jsonrpc": "2.0", - "id": 42, - "method": "Controller.1.links" -} -``` - -#### Get Response - -```json -{ - "jsonrpc": "2.0", - "id": 42, - "result": [ - { - "remote": "localhost:52116", - "state": "RawSocket", - "activity": false, - "id": 1, - "name": "Controller" - } - ] -} -``` - - -## *processinfo [property](#head.Properties)* - -Provides access to the information about the framework process. - -> This property is **read-only**. +| params | object | | +| params.callsign | string | | -### Value +### Result | Name | Type | Description | | :-------- | :-------- | :-------- | -| (property) | object | Information about the framework process | -| (property).threads | array | Thread pool | -| (property).threads[#] | number | (a thread entry) | -| (property).pending | number | Pending requests | -| (property).occupation | number | Pool occupation | +| result | null | Always null | ### Example -#### Get Request +#### Request ```json { - "jsonrpc": "2.0", - "id": 42, - "method": "Controller.1.processinfo" + "jsonrpc": "2.0", + "id": 42, + "method": "Controller.1.resume", + "params": { + "callsign": "..." + } } ``` -#### Get Response +#### Response ```json { - "jsonrpc": "2.0", - "id": 42, - "result": { - "threads": [ - 0 - ], - "pending": 0, - "occupation": 2 - } + "jsonrpc": "2.0", + "id": 42, + "result": null } ``` - -## *subsystems [property](#head.Properties)* + +# Properties -Provides access to the status of the subsystems. +The following properties are provided by the Controller plugin: -> This property is **read-only**. +SystemManagement interface properties: -### Value +| Property | Description | +| :-------- | :-------- | +| [environment](#property.environment) (read-only) | Provides the value of request environment variable | -| Name | Type | Description | -| :-------- | :-------- | :-------- | -| (property) | array | Status of the subsystems | -| (property)[#] | object | | -| (property)[#].subsystem | string | Subsystem name (must be one of the following: *Platform*, *Network*, *Security*, *Identifier*, *Internet*, *Location*, *Time*, *Provisioning*, *Decryption*, *Graphics*, *WebSource*, *Streaming*) | -| (property)[#].active | boolean | Denotes whether the subsystem is active (true) | +Discovery interface properties: -### Example +| Property | Description | +| :-------- | :-------- | +| [discoveryresults](#property.discoveryresults) (read-only) | Provides SSDP network discovery results | -#### Get Request +Configuration interface properties: -```json -{ - "jsonrpc": "2.0", - "id": 42, - "method": "Controller.1.subsystems" -} -``` +| Property | Description | +| :-------- | :-------- | +| [configuration](#property.configuration) | Provides configuration value of a request service | -#### Get Response +Metadata interface properties: -```json -{ - "jsonrpc": "2.0", - "id": 42, - "result": [ - { - "subsystem": "Platform", - "active": true - } - ] -} -``` +| Property | Description | +| :-------- | :-------- | +| [services](#property.services) / [status](#property.services) (read-only) | Provides status of a service, including their configurations | +| [links](#property.links) (read-only) | Provides active connections details | +| [proxies](#property.proxies) (read-only) | Provides details of a proxy | +| [subsystems](#property.subsystems) (read-only) | Provides status of subsystems | +| [version](#property.version) (read-only) | Provides version and hash of WPEFramework | +| [threads](#property.threads) (read-only) | Provides information on workerpool threads | +| [pendingrequests](#property.pendingrequests) (read-only) | Provides information on pending requests | +| [callstack](#property.callstack) (read-only) | Provides callstack associated with the given thread | - -## *discoveryresults [property](#head.Properties)* + +## *environment [property](#head.Properties)* -Provides access to the SSDP network discovery results. +Provides access to the provides the value of request environment variable. > This property is **read-only**. ### Value +> The *variable* argument shall be passed as the index to the property, e.g. ``Controller.1.environment@xyz``. + +### Result + | Name | Type | Description | | :-------- | :-------- | :-------- | -| (property) | array | List of network discovery results | -| (property)[#] | object | (a discovery result entry) | -| (property)[#].locator | string | | -| (property)[#].latency | number | | -| (property)[#].model | string | | -| (property)[#].secure | boolean | | +| result | string | Provides the value of request environment variable | ### Example @@ -864,9 +647,9 @@ Provides access to the SSDP network discovery results. ```json { - "jsonrpc": "2.0", - "id": 42, - "method": "Controller.1.discoveryresults" + "jsonrpc": "2.0", + "id": 42, + "method": "Controller.1.environment@xyz" } ``` @@ -874,39 +657,31 @@ Provides access to the SSDP network discovery results. ```json { - "jsonrpc": "2.0", - "id": 42, - "result": [ - { - "locator": "...", - "latency": 0, - "model": "...", - "secure": true - } - ] + "jsonrpc": "2.0", + "id": 42, + "result": "..." } ``` - -## *environment [property](#head.Properties)* + +## *discoveryresults [property](#head.Properties)* -Provides access to the value of an environment variable. +Provides access to the provides SSDP network discovery results. > This property is **read-only**. ### Value -| Name | Type | Description | -| :-------- | :-------- | :-------- | -| (property) | string | Value of an environment variable | - -> The *variable* argument shall be passed as the index to the property, e.g. *Controller.1.environment@SHELL*. - -### Errors +### Result -| Code | Message | Description | +| Name | Type | Description | | :-------- | :-------- | :-------- | -| 22 | ```ERROR_UNKNOWN_KEY``` | The variable is not defined | +| result | array | Provides SSDP network discovery results | +| result[#] | object | | +| result[#].locator | string | | +| result[#].latency | integer | | +| result[#]?.model | string | *(optional)* | +| result[#].secure | boolean | | ### Example @@ -914,9 +689,9 @@ Provides access to the value of an environment variable. ```json { - "jsonrpc": "2.0", - "id": 42, - "method": "Controller.1.environment@SHELL" + "jsonrpc": "2.0", + "id": 42, + "method": "Controller.1.discoveryresults" } ``` @@ -924,31 +699,37 @@ Provides access to the value of an environment variable. ```json { - "jsonrpc": "2.0", - "id": 42, - "result": "/bin/sh" + "jsonrpc": "2.0", + "id": 42, + "result": [ + { + "locator": "...", + "latency": 0, + "model": "...", + "secure": false + } + ] } ``` ## *configuration [property](#head.Properties)* -Provides access to the configuration object of a service. +Provides access to the provides configuration value of a request service. ### Value | Name | Type | Description | | :-------- | :-------- | :-------- | -| (property) | object | The configuration JSON object | +| (property) | opaque object | Provides configuration value of a request service | -> The *callsign* argument shall be passed as the index to the property, e.g. *Controller.1.configuration@WebKitBrowser*. +> The *callsign* argument shall be passed as the index to the property, e.g. ``Controller.1.configuration@xyz``. -### Errors +### Result -| Code | Message | Description | +| Name | Type | Description | | :-------- | :-------- | :-------- | -| 22 | ```ERROR_UNKNOWN_KEY``` | The service does not exist | -| 1 | ```ERROR_GENERAL``` | Failed to update the configuration | +| result | opaque object | Provides configuration value of a request service | ### Example @@ -956,9 +737,9 @@ Provides access to the configuration object of a service. ```json { - "jsonrpc": "2.0", - "id": 42, - "method": "Controller.1.configuration@WebKitBrowser" + "jsonrpc": "2.0", + "id": 42, + "method": "Controller.1.configuration@xyz" } ``` @@ -966,9 +747,9 @@ Provides access to the configuration object of a service. ```json { - "jsonrpc": "2.0", - "id": 42, - "result": {} + "jsonrpc": "2.0", + "id": 42, + "result": {} } ``` @@ -976,10 +757,10 @@ Provides access to the configuration object of a service. ```json { - "jsonrpc": "2.0", - "id": 42, - "method": "Controller.1.configuration@WebKitBrowser", - "params": {} + "jsonrpc": "2.0", + "id": 42, + "method": "Controller.1.configuration@xyz", + "params": {} } ``` @@ -993,22 +774,47 @@ Provides access to the configuration object of a service. } ``` - -## *version [property](#head.Properties)* + +## *services [property](#head.Properties)* -Provides access to the version of the controller. +Provides access to the provides status of a service, including their configurations. + +> This property is **read-only**. + +> ``status`` is an alternative name for this property. ### Value -| Name | Type | Description | -| :-------- | :-------- | :-------- | -| (property) | string | version of the controller | +> The *callsign* argument shall be passed as the index to the property, e.g. ``Controller.1.services@xyz``. -### Errors +### Result -| Code | Message | Description | +| Name | Type | Description | | :-------- | :-------- | :-------- | -| 1 | ```ERROR_GENERAL``` | Failed to get/update the version | +| result | array | Provides status of a service, including their configurations
*If only one element is present the array will be omitted.* | +| result[#] | object | | +| result[#].autostart | boolean | Determines if the plugin is to be started automatically along with the framework | +| result[#].callsign | string | Plugin callsign | +| result[#].locator | string | Shared library path | +| result[#].classname | string | Plugin class name | +| result[#].module | string | Module name | +| result[#].state | string | Current state (must be one of the following: unavailable, deactivated, deactivation, activated, activation, destroyed, precondition, hibernated, suspended, resumed) | +| result[#].startmode | string | Startup mode (must be one of the following: Unavailable, Deactivated, Activated) | +| result[#].version | object | | +| result[#].version.hash | string | SHA256 hash identifying the source code | +| result[#].version.major | integer | Major number | +| result[#].version.minor | integer | Minor number | +| result[#].version.patch | integer | Patch number | +| result[#]?.communicator | string | *(optional)* | +| result[#]?.persistentpathpostfix | string | *(optional)* | +| result[#]?.volatilepathpostfix | string | *(optional)* | +| result[#]?.systemrootpath | string | *(optional)* | +| result[#]?.precondition | opaque object | *(optional)* Activate conditons | +| result[#]?.termination | opaque object | *(optional)* Deactivate conditions | +| result[#]?.configuration | opaque object | *(optional)* Plugin configuration | +| result[#]?.observers | integer | *(optional)* Number or observers | +| result[#]?.processedrequests | integer | *(optional)* Number of API requests that have been processed by the plugin | +| result[#]?.processedobjects | integer | *(optional)* Number of objects that have been processed by the plugin | ### Example @@ -1016,9 +822,9 @@ Provides access to the version of the controller. ```json { - "jsonrpc": "2.0", - "id": 42, - "method": "Controller.1.version" + "jsonrpc": "2.0", + "id": 42, + "method": "Controller.1.services@xyz" } ``` @@ -1026,49 +832,58 @@ Provides access to the version of the controller. ```json { - "jsonrpc": "2.0", - "id": 42, - "result": "1.0" -} -``` - -#### Set Request - -```json -{ - "jsonrpc": "2.0", - "id": 42, - "method": "Controller.1.version", - "params": "1.0" + "jsonrpc": "2.0", + "id": 42, + "result": [ + { + "autostart": false, + "callsign": "...", + "locator": "...", + "classname": "...", + "module": "...", + "state": "unavailable", + "startmode": "Unavailable", + "version": { + "hash": "...", + "major": 0, + "minor": 0, + "patch": 0 + }, + "communicator": "...", + "persistentpathpostfix": "...", + "volatilepathpostfix": "...", + "systemrootpath": "...", + "precondition": {}, + "termination": {}, + "configuration": {}, + "observers": 0, + "processedrequests": 0, + "processedobjects": 0 + } + ] } ``` -#### Set Response - -```json -{ - "jsonrpc": "2.0", - "id": 42, - "result": "null" -} -``` + +## *links [property](#head.Properties)* - -## *prefix [property](#head.Properties)* +Provides access to the provides active connections details. -Provides access to the prefix. +> This property is **read-only**. ### Value -| Name | Type | Description | -| :-------- | :-------- | :-------- | -| (property) | string | prefix | - -### Errors +### Result -| Code | Message | Description | +| Name | Type | Description | | :-------- | :-------- | :-------- | -| 1 | ```ERROR_GENERAL``` | Failed to update the prefix | +| result | array | Provides active connections details | +| result[#] | object | | +| result[#].remote | string | IP address (or FQDN) of the other side of the connection | +| result[#].state | string | State of the link (must be one of the following: Closed, WebServer, WebSocket, RawSocket, COMRPC, Suspended) | +| result[#]?.name | string | *(optional)* Name of the connection | +| result[#].id | integer | A unique number identifying the connection | +| result[#].activity | boolean | Denotes if there was any activity on this connection | ### Example @@ -1076,9 +891,9 @@ Provides access to the prefix. ```json { - "jsonrpc": "2.0", - "id": 42, - "method": "Controller.1.prefix" + "jsonrpc": "2.0", + "id": 42, + "method": "Controller.1.links" } ``` @@ -1086,49 +901,40 @@ Provides access to the prefix. ```json { - "jsonrpc": "2.0", - "id": 42, - "result": "prefix" -} -``` - -#### Set Request - -```json -{ - "jsonrpc": "2.0", - "id": 42, - "method": "Controller.1.prefix", - "params": "prefix" + "jsonrpc": "2.0", + "id": 42, + "result": [ + { + "remote": "...", + "state": "Closed", + "name": "...", + "id": 0, + "activity": false + } + ] } ``` -#### Set Response - -```json -{ - "jsonrpc": "2.0", - "id": 42, - "result": "null" -} -``` + +## *proxies [property](#head.Properties)* - -## *idletime [property](#head.Properties)* +Provides access to the provides details of a proxy. -Provides access to the idle time. +> This property is **read-only**. ### Value -| Name | Type | Description | -| :-------- | :-------- | :-------- | -| (property) | number | idle time | +> The *linkid* argument shall be passed as the index to the property, e.g. ``Controller.1.proxies@0``. -### Errors +### Result -| Code | Message | Description | +| Name | Type | Description | | :-------- | :-------- | :-------- | -| 1 | ```ERROR_GENERAL``` | Failed to update the idletime | +| result | array | Provides details of a proxy | +| result[#] | object | | +| result[#].interface | integer | Interface ID | +| result[#].instance | instanceid | Instance ID | +| result[#].count | integer | Reference count | ### Example @@ -1136,9 +942,9 @@ Provides access to the idle time. ```json { - "jsonrpc": "2.0", - "id": 42, - "method": "Controller.1.idletime" + "jsonrpc": "2.0", + "id": 42, + "method": "Controller.1.proxies@0" } ``` @@ -1146,49 +952,81 @@ Provides access to the idle time. ```json { - "jsonrpc": "2.0", - "id": 42, - "result": 1 + "jsonrpc": "2.0", + "id": 42, + "result": [ + { + "interface": 0, + "instance": "0x...", + "count": 0 + } + ] } ``` -#### Set Request + +## *subsystems [property](#head.Properties)* + +Provides access to the provides status of subsystems. + +> This property is **read-only**. + +### Value + +### Result + +| Name | Type | Description | +| :-------- | :-------- | :-------- | +| result | array | Provides status of subsystems | +| result[#] | object | | +| result[#].subsystem | string | Subsystem name (must be one of the following: Platform, Security, Network, Identifier, Graphics, Internet, Location, Time, Provisioning, Decryption, WebSource, Streaming, Bluetooth, Cryptography) | +| result[#].active | boolean | Denotes if currently active | + +### Example + +#### Get Request ```json { - "jsonrpc": "2.0", - "id": 42, - "method": "Controller.1.idletime", - "params": 1 + "jsonrpc": "2.0", + "id": 42, + "method": "Controller.1.subsystems" } ``` -#### Set Response +#### Get Response ```json { - "jsonrpc": "2.0", - "id": 42, - "result": "null" + "jsonrpc": "2.0", + "id": 42, + "result": [ + { + "subsystem": "Platform", + "active": false + } + ] } ``` - -## *latitude [property](#head.Properties)* + +## *version [property](#head.Properties)* -Provides access to the latitude. +Provides access to the provides version and hash of WPEFramework. -### Value +> This property is **read-only**. -| Name | Type | Description | -| :-------- | :-------- | :-------- | -| (property) | number | latitude | +### Value -### Errors +### Result -| Code | Message | Description | +| Name | Type | Description | | :-------- | :-------- | :-------- | -| 1 | ```ERROR_GENERAL``` | Failed to update the latitude | +| result | object | Provides version and hash of WPEFramework | +| result.hash | string | SHA256 hash identifying the source code | +| result.major | integer | Major number | +| result.minor | integer | Minor number | +| result.patch | integer | Patch number | ### Example @@ -1196,9 +1034,9 @@ Provides access to the latitude. ```json { - "jsonrpc": "2.0", - "id": 42, - "method": "Controller.1.latitude" + "jsonrpc": "2.0", + "id": 42, + "method": "Controller.1.version" } ``` @@ -1206,49 +1044,79 @@ Provides access to the latitude. ```json { - "jsonrpc": "2.0", - "id": 42, - "result": 100 + "jsonrpc": "2.0", + "id": 42, + "result": { + "hash": "...", + "major": 0, + "minor": 0, + "patch": 0 + } } ``` -#### Set Request + +## *threads [property](#head.Properties)* + +Provides access to the provides information on workerpool threads. + +> This property is **read-only**. + +### Value + +### Result + +| Name | Type | Description | +| :-------- | :-------- | :-------- | +| result | array | Provides information on workerpool threads | +| result[#] | object | | +| result[#].id | instanceid | | +| result[#].job | string | | +| result[#].runs | integer | | + +### Example + +#### Get Request ```json { - "jsonrpc": "2.0", - "id": 42, - "method": "Controller.1.latitude", - "params": 100 + "jsonrpc": "2.0", + "id": 42, + "method": "Controller.1.threads" } ``` -#### Set Response +#### Get Response ```json { - "jsonrpc": "2.0", - "id": 42, - "result": "null" + "jsonrpc": "2.0", + "id": 42, + "result": [ + { + "id": "0x...", + "job": "...", + "runs": 0 + } + ] } ``` - -## *longitude [property](#head.Properties)* + +## *pendingrequests [property](#head.Properties)* -Provides access to the longitude. +Provides access to the provides information on pending requests. -### Value +> This property is **read-only**. -| Name | Type | Description | -| :-------- | :-------- | :-------- | -| (property) | number | longitude | +### Value -### Errors +### Result -| Code | Message | Description | +| Name | Type | Description | | :-------- | :-------- | :-------- | -| 1 | ```ERROR_GENERAL``` | Failed to update the longitude | +| result | array | Provides information on pending requests | +| result[#] | string | | ### Example @@ -1256,9 +1124,9 @@ Provides access to the longitude. ```json { - "jsonrpc": "2.0", - "id": 42, - "method": "Controller.1.longitude" + "jsonrpc": "2.0", + "id": 42, + "method": "Controller.1.pendingrequests" } ``` @@ -1266,129 +1134,103 @@ Provides access to the longitude. ```json { - "jsonrpc": "2.0", - "id": 42, - "result": 200 + "jsonrpc": "2.0", + "id": 42, + "result": [ + "..." + ] } ``` -#### Set Request + +## *callstack [property](#head.Properties)* + +Provides access to the provides callstack associated with the given thread. + +> This property is **read-only**. + +### Value + +> The *thread* argument shall be passed as the index to the property, e.g. ``Controller.1.callstack@0``. + +### Result + +| Name | Type | Description | +| :-------- | :-------- | :-------- | +| result | array | Provides callstack associated with the given thread | +| result[#] | object | | +| result[#].address | instanceid | Address | +| result[#].module | string | Module name | +| result[#]?.function | string | *(optional)* Function name | +| result[#]?.line | integer | *(optional)* Line number | + +### Example + +#### Get Request ```json { - "jsonrpc": "2.0", - "id": 42, - "method": "Controller.1.longitude", - "params": 200 + "jsonrpc": "2.0", + "id": 42, + "method": "Controller.1.callstack@0" } ``` -#### Set Response +#### Get Response ```json { - "jsonrpc": "2.0", - "id": 42, - "result": "null" + "jsonrpc": "2.0", + "id": 42, + "result": [ + { + "address": "0x...", + "module": "...", + "function": "...", + "line": 0 + } + ] } ``` # Notifications -Notifications are autonomous events, triggered by the internals of the implementation, and broadcasted via JSON-RPC to all registered observers. Refer to [[Thunder](#ref.Thunder)] for information on how to register for a notification. +Notifications are autonomous events triggered by the internals of the implementation and broadcasted via JSON-RPC to all registered observers. Refer to [[Thunder](#ref.Thunder)] for information on how to register for a notification. The following events are provided by the Controller plugin: -Controller interface events: +LifeTime interface events: | Event | Description | | :-------- | :-------- | -| [all](#event.all) | Signals each and every event in the system | -| [statechange](#event.statechange) | Signals a plugin state change | -| [subsystemchange](#event.subsystemchange) | Signals a subsystem state change | - - - -## *all [event](#head.Notifications)* - -Signals each and every event in the system. The Controller plugin is an aggregator of all the events triggered by a specific plugin. All notifications send by any plugin are forwarded over the Controller socket as an event. - -### Parameters - -| Name | Type | Description | -| :-------- | :-------- | :-------- | -| params | object | | -| params.callsign | string | Callsign of the originator plugin of the event | -| params.data | object | Object that was broadcasted as an event by the originator plugin | - -### Example - -```json -{ - "jsonrpc": "2.0", - "method": "client.events.1.all", - "params": { - "callsign": "WebKitBrowser", - "data": {} - } -} -``` +| [statechange](#event.statechange) | Notifies a plugin state change | ## *statechange [event](#head.Notifications)* -Signals a plugin state change. +Notifies a plugin state change. ### Parameters | Name | Type | Description | | :-------- | :-------- | :-------- | | params | object | | -| params.callsign | string | Callsign of the plugin that changed state | -| params.state | string | State of the plugin (must be one of the following: *Deactivated*, *Deactivation*, *Activated*, *Activation*, *Suspended*, *Resumed*, *Precondition*) | -| params.reason | string | Cause of the state change (must be one of the following: *Requested*, *Automatic*, *Failure*, *MemoryExceeded*, *Startup*, *Shutdown*) | - -### Example - -```json -{ - "jsonrpc": "2.0", - "method": "client.events.1.statechange", - "params": { - "callsign": "WebKitBrowser", - "state": "Activated", - "reason": "Requested" - } -} -``` - - -## *subsystemchange [event](#head.Notifications)* - -Signals a subsystem state change. - -### Parameters - -| Name | Type | Description | -| :-------- | :-------- | :-------- | -| params | array | | -| params[#] | object | | -| params[#].subsystem | string | Subsystem name (must be one of the following: *Platform*, *Network*, *Security*, *Identifier*, *Internet*, *Location*, *Time*, *Provisioning*, *Decryption*, *Graphics*, *WebSource*, *Streaming*) | -| params[#].active | boolean | Denotes whether the subsystem is active (true) | +| params.callsign | string | Plugin callsign | +| params.state | string | New state of the plugin (must be one of the following: Unavailable, Deactivated, Deactivation, Activated, Activation, Precondition, Hibernated, Destroyed) | +| params.reason | string | Reason of state change (must be one of the following: Requested, Automatic, Failure, MemoryExceeded, Startup, Shutdown, Conditions, WatchdogExpired, InitializationFailed) | ### Example ```json { - "jsonrpc": "2.0", - "method": "client.events.1.subsystemchange", - "params": [ - { - "subsystem": "Platform", - "active": true - } - ] + "jsonrpc": "2.0", + "method": "client.events.1.statechange", + "params": { + "callsign": "...", + "state": "Unavailable", + "reason": "Requested" + } } ``` diff --git a/Source/WPEProcess/comprocess.vcxproj b/Source/WPEProcess/comprocess.vcxproj old mode 100644 new mode 100755 index be85fbfb18..c59a0d16d9 --- a/Source/WPEProcess/comprocess.vcxproj +++ b/Source/WPEProcess/comprocess.vcxproj @@ -110,7 +110,7 @@ __CORE_MESSAGING__;_CRT_SECURE_NO_WARNINGS;_WINDOWS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true pch.h - $(FrameworkPath);$(WindowsPath);$(WindowsPath)zlib + $(FrameworkPath);$(FrameworkPath)plugins\generated\json;$(WindowsPath);$(WindowsPath)zlib true @@ -131,7 +131,7 @@ __CORE_MESSAGING__;_CRT_SECURE_NO_WARNINGS;_WINDOWS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true pch.h - $(FrameworkPath);$(WindowsPath);$(WindowsPath)zlib + $(FrameworkPath);$(FrameworkPath)plugins\generated\json;$(WindowsPath);$(WindowsPath)zlib true @@ -150,7 +150,7 @@ __CORE_MESSAGING__;_CRT_SECURE_NO_WARNINGS;_WINDOWS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true pch.h - $(FrameworkPath);$(WindowsPath);$(WindowsPath)zlib + $(FrameworkPath);$(FrameworkPath)plugins\generated\json;$(WindowsPath);$(WindowsPath)zlib true @@ -171,7 +171,7 @@ __CORE_MESSAGING__;_CRT_SECURE_NO_WARNINGS;_WINDOWS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true pch.h - $(FrameworkPath);$(WindowsPath);$(WindowsPath)zlib + $(FrameworkPath);$(FrameworkPath)plugins\generated\json;$(WindowsPath);$(WindowsPath)zlib true @@ -186,4 +186,4 @@ - + \ No newline at end of file diff --git a/Source/com/Ids.h b/Source/com/Ids.h index cf20603339..fbbe6ef3d8 100644 --- a/Source/com/Ids.h +++ b/Source/com/Ids.h @@ -36,11 +36,18 @@ namespace RPC { ID_MONITORABLE_PROCESS = (ID_OFFSET_INTERNAL + 0x0007), ID_CONTROLLER_CONFIGURATION = (ID_OFFSET_INTERNAL + 0x0008), ID_CONTROLLER_DISCOVERY = (ID_OFFSET_INTERNAL + 0x0009), - ID_CONTROLLER_SYSTEMINFO = (ID_OFFSET_INTERNAL + 0x000A), - ID_CONTROLLER_LIFETIME = (ID_OFFSET_INTERNAL + 0x000B), - ID_CONTROLLER_LIFETIME_NOTIFICATION = (ID_OFFSET_INTERNAL + 0x000C), - ID_CONTROLLER_METADATA = (ID_OFFSET_INTERNAL + 0x000D), - ID_CONTROLLER_SYSTEM_MANAGEMENT = (ID_OFFSET_INTERNAL + 0x000E), + ID_CONTROLLER_DISCOVERY_DISCOVERYRESULTS_ITERATOR = (ID_OFFSET_INTERNAL + 0x000A), + ID_CONTROLLER_SYSTEMINFO = (ID_OFFSET_INTERNAL + 0x000B), + ID_CONTROLLER_LIFETIME = (ID_OFFSET_INTERNAL + 0x000C), + ID_CONTROLLER_LIFETIME_NOTIFICATION = (ID_OFFSET_INTERNAL + 0x000D), + ID_CONTROLLER_METADATA = (ID_OFFSET_INTERNAL + 0x000E), + ID_CONTROLLER_METADATA_SERVICES_ITERATOR = (ID_OFFSET_INTERNAL + 0x000F), + ID_CONTROLLER_METADATA_LINKS_ITERATOR = (ID_OFFSET_INTERNAL + 0x0010), + ID_CONTROLLER_METADATA_PROXIES_ITERATOR = (ID_OFFSET_INTERNAL + 0x0011), + ID_CONTROLLER_METADATA_THREADS_ITERATOR = (ID_OFFSET_INTERNAL + 0x0012), + ID_CONTROLLER_METADATA_SUBSYSTEMS_ITERATOR = (ID_OFFSET_INTERNAL + 0x0013), + ID_CONTROLLER_METADATA_CALLSTACK_ITERATOR = (ID_OFFSET_INTERNAL + 0x0014), + ID_CONTROLLER_SYSTEM_MANAGEMENT = (ID_OFFSET_INTERNAL + 0x0015), ID_CONTROLLER = (ID_OFFSET_INTERNAL + 0x0020), ID_PLUGIN = (ID_OFFSET_INTERNAL + 0x0021), diff --git a/Source/plugins/CMakeLists.txt b/Source/plugins/CMakeLists.txt index 4d362d545b..87df02631e 100644 --- a/Source/plugins/CMakeLists.txt +++ b/Source/plugins/CMakeLists.txt @@ -31,6 +31,9 @@ ProxyStubGenerator(NAMESPACE "WPEFramework::PluginHost" INPUT "${CMAKE_CURRENT_S JsonGenerator(CODE NAMESPACE WPEFramework::Exchange::Controller INPUT ${CMAKE_CURRENT_SOURCE_DIR}/IController.h OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/generated/jsonrpc" INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/.." NO_INCLUDES) +file(GLOB JSON_ENUM_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/generated/jsonrpc/JsonEnum_*.cpp") +file(GLOB JSON_DATA_HEADERS "${CMAKE_CURRENT_BINARY_DIR}/generated/jsonrpc/JsonData_*.h") + add_library(${TARGET} SHARED Channel.cpp JSONRPC.cpp @@ -42,6 +45,7 @@ add_library(${TARGET} SHARED SubSystem.cpp VirtualInput.cpp System.cpp + ${JSON_ENUM_SOURCES} ) file(GLOB PROXY_STUB_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/generated/ProxyStubs*.cpp") @@ -74,6 +78,7 @@ set(PUBLIC_HEADERS VirtualInput.h IVirtualInput.h Module.h + ${JSON_DATA_HEADERS} ) target_link_libraries(${TARGET} @@ -110,6 +115,7 @@ target_include_directories( ${TARGET} $ $ $ + $ ) target_include_directories( ${TARGET_PROXYSTUBS} diff --git a/Source/plugins/IController.h b/Source/plugins/IController.h index 58c0ce3ca1..8b119eaff5 100644 --- a/Source/plugins/IController.h +++ b/Source/plugins/IController.h @@ -24,6 +24,8 @@ #include "IControllerDeprecated.h" // @stubgen:include +// @stubgen:include +// @stubgen:include namespace WPEFramework { @@ -34,27 +36,36 @@ namespace Controller { struct EXTERNAL ISystemManagement : virtual public Core::IUnknown { enum { ID = RPC::ID_CONTROLLER_SYSTEM_MANAGEMENT }; - ~ISystemManagement() override = default; - // @alt harakiri - // @brief Reboot the device + // @brief Reboots the device virtual Core::hresult Reboot() = 0; // @brief Removes contents of a directory from the persistent storage. virtual Core::hresult Delete(const string& path) = 0; - // @brief Create a clone of given plugin to requested new callsign + + // @brief Creates a clone of given plugin to requested new callsign virtual Core::hresult Clone(const string& callsign, const string& newcallsign, string& response /* @out */) = 0; + // @property // @brief Provides the value of request environment variable. // @return Environment value - virtual Core::hresult Environment(const string& index /* @index */, string& environment /* @out @opaque */ ) const = 0; - + virtual Core::hresult Environment(const string& variable /* @index */, string& value /* @out */ ) const = 0; }; /* @json */ struct EXTERNAL IDiscovery : virtual public Core::IUnknown { enum { ID = RPC::ID_CONTROLLER_DISCOVERY }; - ~IDiscovery() override = default; + + struct Data { + struct DiscoveryResult { + string Locator; + uint32_t Latency; + string Model /* @optional */; + bool Secure; + }; + + using IDiscoveryResultsIterator = RPC::IIteratorType; + }; // @brief Starts the network discovery. Use this method to initiate SSDP network discovery process. // @param TTL (time to live) parameter for SSDP discovery @@ -63,7 +74,7 @@ namespace Controller { // @property // @brief Provides SSDP network discovery results. // @return SSDP network discovery results - virtual Core::hresult DiscoveryResults(string& response /* @out @opaque */) const = 0; + virtual Core::hresult DiscoveryResults(Data::IDiscoveryResultsIterator*& results /* @out */) const = 0; }; /* @json */ @@ -71,15 +82,13 @@ namespace Controller { struct EXTERNAL IConfiguration : virtual public Core::IUnknown { enum { ID = RPC::ID_CONTROLLER_CONFIGURATION }; - ~IConfiguration() override = default; - // @alt storeconfig // @brief Stores the configuration to persistent memory virtual Core::hresult Persist() = 0; // @property // @brief Provides configuration value of a request service. - virtual Core::hresult Configuration(const string& callsign /* @index */, string& configuration /* @out @opaque */) const = 0; + virtual Core::hresult Configuration(const string& callsign /* @index @optional */, string& configuration /* @out @opaque */) const = 0; virtual Core::hresult Configuration(const string& callsign /* @index */, const string& configuration /* @opaque */) = 0; }; @@ -90,60 +99,172 @@ namespace Controller { // @event struct EXTERNAL INotification : virtual public Core::IUnknown { enum { ID = RPC::ID_CONTROLLER_LIFETIME_NOTIFICATION }; - ~INotification() override = default; + // @brief Notifies a plugin state change + // @param callsign Plugin callsign + // @param state New state of the plugin + // @param reason Reason of state change virtual void StateChange(const string& callsign, const PluginHost::IShell::state& state, const PluginHost::IShell::reason& reason) = 0; }; - ~ILifeTime() override = default; - - // Pushing notifications to interested sinks virtual Core::hresult Register(INotification* sink) = 0; virtual Core::hresult Unregister(INotification* sink) = 0; - // @brief Activate a plugin, i.e. move from Deactivated, via Activating to Activated state + // @brief Activates a plugin, i.e. move from Deactivated, via Activating to Activated state virtual Core::hresult Activate(const string& callsign) = 0; - // @brief Deactivate a plugin, i.e. move from Activated, via Deactivating to Deactivated state + + // @brief Deactivates a plugin, i.e. move from Activated, via Deactivating to Deactivated state virtual Core::hresult Deactivate(const string& callsign) = 0; - // @brief Set a plugin unavailable for interaction. + + // @brief Sets a plugin unavailable for interaction. virtual Core::hresult Unavailable(const string& callsign) = 0; - // @brief Set a plugin in Hibernate state - virtual Core::hresult Hibernate(const string& callsign, const Core::hresult timeout) = 0; - // @brief Suspend a plugin + + // @brief Sets a plugin in Hibernate state + virtual Core::hresult Hibernate(const string& callsign, const uint32_t timeout) = 0; + + // @brief Suspends a plugin virtual Core::hresult Suspend(const string& callsign) = 0; + // @brief Resumes a plugin virtual Core::hresult Resume(const string& callsign) = 0; }; /* @json */ struct EXTERNAL IMetadata : virtual public Core::IUnknown { + enum { ID = RPC::ID_CONTROLLER_METADATA }; - ~IMetadata() override = default; + + struct Data { + struct Version { + string Hash /* @brief SHA256 hash identifying the source code */; + uint8_t Major /* @brief Major number */; + uint8_t Minor /* @brief Minor number */; + uint8_t Patch /* @brief Patch number */; + }; + + struct Subsystem { + PluginHost::ISubSystem::subsystem Subsystem /* @brief Subsystem name */; + bool Active /* @brief Denotes if currently active */; + }; + + struct CallStack { + Core::instance_id Address /* @brief Address */; + string Module /* @brief Module name */; + string Function /* @optional @brief Function name */; + uint32_t Line /* @optional @brief Line number */; + }; + + struct Thread { + Core::instance_id Id; + string Job; + uint32_t Runs; + }; + + struct Proxy { + uint32_t Interface /* @brief Interface ID */; + Core::instance_id Instance /* @brief Instance ID */; + uint32_t Count /* @brief Reference count */; + }; + + struct Link { + enum state : uint8_t { + CLOSED, + WEBSERVER /* @text WebServer */, + WEBSOCKET /* @text WebSocket */, + RAWSOCKET /* @text RawSocket */, + COMRPC /* @text COMRPC */, + SUSPENDED + }; + + string Remote /* @brief IP address (or FQDN) of the other side of the connection */; + state State /* @brief State of the link */; + string Name /* @optional @brief Name of the connection */; + uint32_t Id /* @brief A unique number identifying the connection */; + bool Activity /* @brief Denotes if there was any activity on this connection */; + }; + + struct Service { + enum state : uint32_t { + UNAVAILABLE = PluginHost::IShell::UNAVAILABLE /* @text unavailable */, + DEACTIVATED = PluginHost::IShell::DEACTIVATED /* @text deactivated */, + DEACTIVATION = PluginHost::IShell::DEACTIVATION /* @text deactivation */, + ACTIVATED = PluginHost::IShell::ACTIVATED /* @text activated */, + ACTIVATION = PluginHost::IShell::ACTIVATION /* @text activation */, + DESTROYED = PluginHost::IShell::DESTROYED /* @text destroyed */, + PRECONDITION = PluginHost::IShell::PRECONDITION /* @text precondition */, + HIBERNATED = PluginHost::IShell::HIBERNATED /* @text hibernated */, + SUSPENDED /* @text suspended */, + RESUMED /* @text resumed */ + }; + + bool AutoStart /* @brief Determines if the plugin is to be started automatically along with the framework */; + string Callsign /* @brief Plugin callsign */; + string Locator /* @brief Shared library path */; + string ClassName /* @brief Plugin class name */; + string Module /* @brief Module name */; + state State /* @brief Current state */; + PluginHost::IShell::startup StartMode /* @brief Startup mode */; + Data::Version Version /* @brief Version */; + + string Communicator /* @optional */; + + string PersistentPathPostfix /* @optional */; + string VolatilePathPostfix /* @optional */; + string SystemRootPath /* @optional */; + + string Precondition /* @opaque @optional @brief Activate conditons */; + string Termination /* @opaque @optional @brief Deactivate conditions */; + + string Configuration /* @opaque @optional @brief Plugin configuration */; + + uint16_t Observers /* @optional @brief Number or observers*/; + uint32_t ProcessedRequests /* @optional @brief Number of API requests that have been processed by the plugin */; + uint32_t ProcessedObjects /* @optional @brief Number of objects that have been processed by the plugin */; + }; + + using ISubsystemsIterator = RPC::IIteratorType; + using ICallStackIterator = RPC::IIteratorType; + using IThreadsIterator = RPC::IIteratorType; + using IPendingRequestsIterator = RPC::IIteratorType; + using ILinksIterator = RPC::IIteratorType; + using IProxiesIterator = RPC::IIteratorType; + using IServicesIterator = RPC::IIteratorType; + }; + + // @property @alt status + // @brief Provides status of a service, including their configurations + virtual Core::hresult Services(const string& callsign /* @index @optional */, Data::IServicesIterator*& services /* @out @extract */) const = 0; // @property - // @brief Provides currenlty running proxy details - virtual Core::hresult Proxies(string& response /* @out @opaque */) const = 0; + // @brief Provides active connections details + virtual Core::hresult Links(Data::ILinksIterator*& links /* @out */) const = 0; + // @property - // @brief Provides status of a plugin, including their configurations - virtual Core::hresult Status(const string& index /* @index */, string& response /* @out @opaque */) const = 0; + // @brief Provides details of a proxy + virtual Core::hresult Proxies(const uint32_t& linkId /* @index */, Data::IProxiesIterator*& proxies /* @out */) const = 0; + // @property - // @brief Provides active connection details - virtual Core::hresult Links(string& response /* @out @opaque */) const = 0; + // @brief Provides status of subsystems + virtual Core::hresult Subsystems(Data::ISubsystemsIterator*& subsystems /* @out */) const = 0; + // @property - // @brief Provides framework process info, like worker pools details - virtual Core::hresult ProcessInfo(string& response /* @out @opaque */) const = 0; + // @brief Provides version and hash of WPEFramework + virtual Core::hresult Version(Data::Version& version /* @out */) const = 0; + // @property - // @brief Provides currently active subsystem details - virtual Core::hresult Subsystems(string& response /* @out @opaque */) const = 0; + // @brief Provides information on workerpool threads + virtual Core::hresult Threads(Data::IThreadsIterator*& threads /* @out */) const = 0; + // @property - // @brief Provides version of WPEFramework hash and in human readable - virtual Core::hresult Version(string& response /* @out @opaque */) const = 0; + // @brief Provides information on pending requests + virtual Core::hresult PendingRequests(Data::IPendingRequestsIterator*& requests /* @out */) const = 0; + // @property - // @brief callstack - Information the callstack associated with the given index 0 - - virtual Core::hresult CallStack(const string& index /* @index */, string& callstack /* @out @opaque */) const = 0; + // @brief Provides callstack associated with the given thread + virtual Core::hresult CallStack(const uint8_t thread /* @index */, Data::ICallStackIterator*& callstack /* @out */) const = 0; }; } } // namespace Exchange -} // namespace WPEFramework +} diff --git a/Source/plugins/ISubSystem.h b/Source/plugins/ISubSystem.h index 9e671f1646..d7d4e6ed7e 100644 --- a/Source/plugins/ISubSystem.h +++ b/Source/plugins/ISubSystem.h @@ -54,28 +54,28 @@ namespace PluginHost { TIME, // Time has been synchronized. PROVISIONING, // Provisioning information is available. DECRYPTION, // Decryption functionality is available. - WEBSOURCE, // Content exposed via a local web server is available. + WEBSOURCE /* @text WebSource */, // Content exposed via a local web server is available. STREAMING, // Content can be streamed. BLUETOOTH, // The bluetooth subsystem is up and running. CRYPTOGRAPHY, // Cryptographic functionality is available. - END_LIST, + END_LIST /* @end */, // Also define a "negative" value. NEGATIVE_START = 0x80000000, - NOT_PLATFORM = NEGATIVE_START, // platform is NOT available. - NOT_SECURITY, // A security system can validate external requests (JSONRPC/WebRequest) - NOT_NETWORK, // Network connectivity has NOT been established. - NOT_IDENTIFIER, // System identification has NOT been accomplished. - NOT_GRAPHICS, // Graphics screen EGL is NOT available. - NOT_INTERNET, // Network connectivity to the outside world has been established. - NOT_LOCATION, // Location of the device has NOT been set. - NOT_TIME, // Time has been NOT synchronized. - NOT_PROVISIONING, // Provisioning information is NOT available. - NOT_DECRYPTION, // Decryption functionality is NOT available. - NOT_WEBSOURCE, // Content exposed via a local web server is NOT available. - NOT_STREAMING, // Content can NOT be streamed. - NOT_BLUETOOTH, // The Bluetooth communication system is NOT available. - NOT_CRYPTOGRAPHY // Cryptographic functionality is NOT available. + NOT_PLATFORM = NEGATIVE_START /* @text:!Platform */, // platform is NOT available. + NOT_SECURITY /* @text !Security */, // A security system can validate external requests (JSONRPC/WebRequest) + NOT_NETWORK /* @text !Network */, // Network connectivity has NOT been established. + NOT_IDENTIFIER /* @text !Identifier */, // System identification has NOT been accomplished. + NOT_GRAPHICS /* @text !Graphics */, // Graphics screen EGL is NOT available. + NOT_INTERNET /* @text !Internet */, // Network connectivity to the outside world has been established. + NOT_LOCATION /* @text !Location */, // Location of the device has NOT been set. + NOT_TIME /* @text !Time */, // Time has been NOT synchronized. + NOT_PROVISIONING /* @text !Provisioning */, // Provisioning information is NOT available. + NOT_DECRYPTION /* @text !Decryption */, // Decryption functionality is NOT available. + NOT_WEBSOURCE /* @text !WebSource */, // Content exposed via a local web server is NOT available. + NOT_STREAMING /* @text !Streaming */, // Content can NOT be streamed. + NOT_BLUETOOTH /* @text !Bluetooth */, // The Bluetooth communication system is NOT available. + NOT_CRYPTOGRAPHY /* @text !Cryptography */ // Cryptographic functionality is NOT available. }; struct EXTERNAL INotification : virtual public Core::IUnknown { diff --git a/Source/plugins/MetaData.cpp b/Source/plugins/MetaData.cpp index bd708e479e..26eb689dbd 100644 --- a/Source/plugins/MetaData.cpp +++ b/Source/plugins/MetaData.cpp @@ -24,31 +24,6 @@ namespace WPEFramework { -ENUM_CONVERSION_BEGIN(PluginHost::MetaData::Channel::state) - - { PluginHost::MetaData::Channel::state::WEBSERVER, _TXT("WebServer") }, - { PluginHost::MetaData::Channel::state::WEBSOCKET, _TXT("WebSocket") }, - { PluginHost::MetaData::Channel::state::RAWSOCKET, _TXT("RawSocket") }, - { PluginHost::MetaData::Channel::state::CLOSED, _TXT("Closed") }, - { PluginHost::MetaData::Channel::state::COMRPC, _TXT("COMRPC") }, - { PluginHost::MetaData::Channel::state::SUSPENDED, _TXT("Suspended") }, - - ENUM_CONVERSION_END(PluginHost::MetaData::Channel::state) - - ENUM_CONVERSION_BEGIN(PluginHost::MetaData::Service::state) - - { PluginHost::MetaData::Service::UNAVAILABLE, _TXT("unavailable") }, - { PluginHost::MetaData::Service::DEACTIVATED, _TXT("deactivated") }, - { PluginHost::MetaData::Service::DEACTIVATION, _TXT("deactivation") }, - { PluginHost::MetaData::Service::ACTIVATED, _TXT("activated") }, - { PluginHost::MetaData::Service::ACTIVATION, _TXT("activation") }, - { PluginHost::MetaData::Service::SUSPENDED, _TXT("suspended") }, - { PluginHost::MetaData::Service::RESUMED, _TXT("resumed") }, - { PluginHost::MetaData::Service::PRECONDITION, _TXT("precondition") }, - { PluginHost::MetaData::Service::HIBERNATED, _TXT("hibernated") }, - - ENUM_CONVERSION_END(PluginHost::MetaData::Service::state) - ENUM_CONVERSION_BEGIN(PluginHost::ISubSystem::IInternet::network_type) { PluginHost::ISubSystem::IInternet::UNKNOWN, _TXT("Unknown") }, @@ -74,7 +49,7 @@ namespace PluginHost PluginHost::IStateControl* mode = const_cast(RHS)->QueryInterface(); if (mode != nullptr) { - Core::JSON::EnumType::operator=(mode->State() == PluginHost::IStateControl::RESUMED ? RESUMED : SUSPENDED); + Core::JSON::EnumType::operator=(mode->State() == PluginHost::IStateControl::RESUMED ? state::RESUMED : state::SUSPENDED); mode->Release(); } } @@ -226,45 +201,6 @@ namespace PluginHost return (*this); } - MetaData::Bridge::Bridge() - : Core::JSON::Container() - { - Add(_T("locator"), &Locator); - Add(_T("latency"), &Latency); - Add(_T("model"), &Model); - Add(_T("secure"), &Secure); - } - MetaData::Bridge::Bridge(const string& text, const uint32_t latency, const string& model, const bool secure) - : Core::JSON::Container() - { - Add(_T("locator"), &Locator); - Add(_T("latency"), &Latency); - Add(_T("model"), &Model); - Add(_T("secure"), &Secure); - - Locator = text; - Latency = latency; - Secure = secure; - if (model.empty() == false) { - Model = model; - } - } - MetaData::Bridge::Bridge(const Bridge& copy) - : Core::JSON::Container() - , Locator(copy.Locator) - , Latency(copy.Latency) - , Model(copy.Model) - , Secure(copy.Secure) - { - Add(_T("locator"), &Locator); - Add(_T("latency"), &Latency); - Add(_T("model"), &Model); - Add(_T("secure"), &Secure); - } - MetaData::Bridge::~Bridge() - { - } - MetaData::Server::Minion::Minion() : Core::JSON::Container() , Id(0) diff --git a/Source/plugins/MetaData.h b/Source/plugins/MetaData.h index 206b4f6d38..0e86d52ea3 100644 --- a/Source/plugins/MetaData.h +++ b/Source/plugins/MetaData.h @@ -23,6 +23,11 @@ #include "Module.h" #include "Configuration.h" +#include "IController.h" +#include "JsonData_Metadata.h" +#include "JsonData_Discovery.h" + + namespace WPEFramework { namespace PluginHost { @@ -30,65 +35,11 @@ namespace PluginHost { // this class holds interesting information that can be requested from the Server class EXTERNAL MetaData : public Core::JSON::Container { public: - class EXTERNAL Version : public Core::JSON::Container { - public: - Version(Version&&) = delete; - - Version() - : Core::JSON::Container() - , Hash() - , Major(1) - , Minor(0) - , Patch(0) { - Add(_T("hash"), &Hash); - Add(_T("major"), &Major); - Add(_T("minor"), &Minor); - Add(_T("patch"), &Patch); - } - Version(const Version& copy) - : Core::JSON::Container() - , Hash(copy.Hash) - , Major(copy.Major) - , Minor(copy.Minor) - , Patch(copy.Patch) { - Add(_T("hash"), &Hash); - Add(_T("major"), &Major); - Add(_T("minor"), &Minor); - Add(_T("patch"), &Patch); - } + using Version = JsonData::Metadata::VersionInfo; - Version& operator= (const Version& rhs) { - - Hash = rhs.Hash; - Major = rhs.Major; - Minor = rhs.Minor; - Patch = rhs.Patch; - - return (*this); - } - ~Version() override = default; - - public: - Core::JSON::String Hash; - Core::JSON::DecUInt8 Major; - Core::JSON::DecUInt8 Minor; - Core::JSON::DecUInt8 Patch; - }; - class EXTERNAL Service : public Plugin::Config { public: - enum state { - UNAVAILABLE = PluginHost::IShell::UNAVAILABLE, - DEACTIVATED = PluginHost::IShell::DEACTIVATED, - DEACTIVATION = PluginHost::IShell::DEACTIVATION, - ACTIVATED = PluginHost::IShell::ACTIVATED, - ACTIVATION = PluginHost::IShell::ACTIVATION, - DESTROYED = PluginHost::IShell::DESTROYED, - PRECONDITION = PluginHost::IShell::PRECONDITION, - HIBERNATED = PluginHost::IShell::HIBERNATED, - SUSPENDED, - RESUMED - }; + using state = Exchange::Controller::IMetadata::Data::Service::state; class EXTERNAL State : public Core::JSON::EnumType { public: @@ -136,14 +87,8 @@ namespace PluginHost { class EXTERNAL Channel : public Core::JSON::Container { public: - enum state { - CLOSED, - WEBSERVER, - WEBSOCKET, - RAWSOCKET, - COMRPC, - SUSPENDED - }; + using state = Exchange::Controller::IMetadata::Data::Link::state; + class EXTERNAL State : public Core::JSON::EnumType { public: inline State() @@ -180,21 +125,7 @@ namespace PluginHost { Core::JSON::String Name; }; - class EXTERNAL Bridge : public Core::JSON::Container { - public: - Bridge& operator=(const Bridge&) = delete; - - Bridge(); - Bridge(const string& text, const uint32_t latency, const string& model, const bool secure); - Bridge(const Bridge& copy); - ~Bridge(); - - public: - Core::JSON::String Locator; - Core::JSON::DecUInt32 Latency; - Core::JSON::String Model; - Core::JSON::Boolean Secure; - }; + using Bridge = JsonData::Discovery::DiscoveryResultData; class EXTERNAL Server : public Core::JSON::Container { public: @@ -264,35 +195,7 @@ namespace PluginHost { }; class EXTERNAL COMRPC : public Core::JSON::Container { public: - class EXTERNAL Proxy : public Core::JSON::Container { - public: - Proxy& operator=(const Proxy&) = delete; - - Proxy() - : Core::JSON::Container() - , InterfaceId() - , InstanceId() - , RefCount() { - Add(_T("interface"), &InterfaceId); - Add(_T("instance"), &InstanceId); - Add(_T("count"), &RefCount); - } - Proxy(const Proxy& copy) - : Core::JSON::Container() - , InterfaceId(copy.InterfaceId) - , InstanceId(copy.InstanceId) - , RefCount(copy.RefCount) { - Add(_T("interface"), &InterfaceId); - Add(_T("instance"), &InstanceId); - Add(_T("count"), &RefCount); - } - ~Proxy() override = default; - - public: - Core::JSON::DecUInt32 InterfaceId; - Core::JSON::InstanceId InstanceId; - Core::JSON::DecUInt32 RefCount; - }; + using Proxy = JsonData::Metadata::ProxyData; public: COMRPC& operator= (const COMRPC&) = delete; diff --git a/Source/plugins/Shell.cpp b/Source/plugins/Shell.cpp index d93d940087..f6e5015e83 100644 --- a/Source/plugins/Shell.cpp +++ b/Source/plugins/Shell.cpp @@ -23,39 +23,6 @@ namespace WPEFramework { -ENUM_CONVERSION_BEGIN(PluginHost::IShell::state) - - { PluginHost::IShell::UNAVAILABLE, _TXT("Unavailable") }, - { PluginHost::IShell::DEACTIVATED, _TXT("Deactivated") }, - { PluginHost::IShell::DEACTIVATION, _TXT("Deactivation") }, - { PluginHost::IShell::ACTIVATED, _TXT("Activated") }, - { PluginHost::IShell::ACTIVATION, _TXT("Activation") }, - { PluginHost::IShell::PRECONDITION, _TXT("Precondition") }, - { PluginHost::IShell::DESTROYED, _TXT("Destroyed") }, - -ENUM_CONVERSION_END(PluginHost::IShell::state) - -ENUM_CONVERSION_BEGIN(PluginHost::IShell::reason) - - { PluginHost::IShell::REQUESTED, _TXT("Requested") }, - { PluginHost::IShell::AUTOMATIC, _TXT("Automatic") }, - { PluginHost::IShell::FAILURE, _TXT("Failure") }, - { PluginHost::IShell::MEMORY_EXCEEDED, _TXT("MemoryExceeded") }, - { PluginHost::IShell::STARTUP, _TXT("Startup") }, - { PluginHost::IShell::SHUTDOWN, _TXT("Shutdown") }, - { PluginHost::IShell::CONDITIONS, _TXT("Conditions") }, - { PluginHost::IShell::WATCHDOG_EXPIRED, _TXT("WatchdogExpired") }, - -ENUM_CONVERSION_END(PluginHost::IShell::reason) - -ENUM_CONVERSION_BEGIN(PluginHost::IShell::startup) - - { PluginHost::IShell::startup::UNAVAILABLE, _TXT("Unavailable") }, - { PluginHost::IShell::startup::DEACTIVATED, _TXT("Deactivated") }, - { PluginHost::IShell::startup::ACTIVATED, _TXT("Activated") }, - -ENUM_CONVERSION_END(PluginHost::IShell::startup) - namespace PluginHost { void* IShell::Root(uint32_t & pid, const uint32_t waitTime, const string className, const uint32_t interface, const uint32_t version) diff --git a/Source/plugins/SubSystem.cpp b/Source/plugins/SubSystem.cpp index a66de55159..a1d6f2536b 100644 --- a/Source/plugins/SubSystem.cpp +++ b/Source/plugins/SubSystem.cpp @@ -22,50 +22,4 @@ namespace WPEFramework { -ENUM_CONVERSION_BEGIN(PluginHost::ISubSystem::subsystem) - - { PluginHost::ISubSystem::subsystem::PLATFORM, _TXT("Platform") }, - { PluginHost::ISubSystem::subsystem::NOT_PLATFORM, _TXT("!Platform") }, - - { PluginHost::ISubSystem::subsystem::NETWORK, _TXT("Network") }, - { PluginHost::ISubSystem::subsystem::NOT_NETWORK, _TXT("!Network") }, - - { PluginHost::ISubSystem::subsystem::SECURITY, _TXT("Security") }, - { PluginHost::ISubSystem::subsystem::NOT_SECURITY, _TXT("!Security") }, - - { PluginHost::ISubSystem::subsystem::IDENTIFIER, _TXT("Identifier") }, - { PluginHost::ISubSystem::subsystem::NOT_IDENTIFIER, _TXT("!Identifier") }, - - { PluginHost::ISubSystem::subsystem::INTERNET, _TXT("Internet") }, - { PluginHost::ISubSystem::subsystem::NOT_INTERNET, _TXT("!Internet") }, - - { PluginHost::ISubSystem::subsystem::LOCATION, _TXT("Location") }, - { PluginHost::ISubSystem::subsystem::NOT_LOCATION, _TXT("!Location") }, - - { PluginHost::ISubSystem::subsystem::TIME, _TXT("Time") }, - { PluginHost::ISubSystem::subsystem::NOT_TIME, _TXT("!Time") }, - - { PluginHost::ISubSystem::subsystem::PROVISIONING, _TXT("Provisioning") }, - { PluginHost::ISubSystem::subsystem::NOT_PROVISIONING, _TXT("!Provisioning") }, - - { PluginHost::ISubSystem::subsystem::DECRYPTION, _TXT("Decryption") }, - { PluginHost::ISubSystem::subsystem::NOT_DECRYPTION, _TXT("!Decryption") }, - - { PluginHost::ISubSystem::subsystem::GRAPHICS, _TXT("Graphics") }, - { PluginHost::ISubSystem::subsystem::NOT_GRAPHICS, _TXT("!Graphics") }, - - { PluginHost::ISubSystem::subsystem::WEBSOURCE, _TXT("WebSource") }, - { PluginHost::ISubSystem::subsystem::NOT_WEBSOURCE, _TXT("!WebSource") }, - - { PluginHost::ISubSystem::subsystem::STREAMING, _TXT("Streaming") }, - { PluginHost::ISubSystem::subsystem::NOT_STREAMING, _TXT("!Streaming") }, - - { PluginHost::ISubSystem::subsystem::BLUETOOTH, _TXT("Bluetooth") }, - { PluginHost::ISubSystem::subsystem::NOT_BLUETOOTH, _TXT("!Bluetooth") }, - - { PluginHost::ISubSystem::subsystem::CRYPTOGRAPHY, _TXT("Cryptography") }, - { PluginHost::ISubSystem::subsystem::NOT_CRYPTOGRAPHY, _TXT("!Cryptography") }, - - ENUM_CONVERSION_END(PluginHost::ISubSystem::subsystem) - } // namespace WPEFramework diff --git a/Source/plugins/definitions.h b/Source/plugins/definitions.h new file mode 100644 index 0000000000..7e90d2b400 --- /dev/null +++ b/Source/plugins/definitions.h @@ -0,0 +1,25 @@ +/* + * If not stated otherwise in this file or this component's LICENSE file the + * following copyright and licenses apply: + * + * Copyright 2023 Metrological + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +// Generated files include this + +#include +#include \ No newline at end of file diff --git a/Source/plugins/plugins.vcxproj b/Source/plugins/plugins.vcxproj old mode 100644 new mode 100755 index 0769f2b3b9..c968489781 --- a/Source/plugins/plugins.vcxproj +++ b/Source/plugins/plugins.vcxproj @@ -20,6 +20,8 @@ + + @@ -136,7 +138,7 @@ true __CORE_MESSAGING__;_CRT_SECURE_NO_WARNINGS;NDEBUG;PLUGINS_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) true - .;$(FrameworkPath);$(WindowsPath);$(WindowsPath)zlib + .;$(FrameworkPath)plugins\generated\json;$(FrameworkPath);$(WindowsPath);$(WindowsPath)zlib true @@ -159,7 +161,7 @@ true __CORE_MESSAGING__;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;PLUGINS_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) true - .;$(FrameworkPath);$(WindowsPath);$(WindowsPath)zlib + .;$(FrameworkPath)plugins\generated\json;$(FrameworkPath);$(WindowsPath);$(WindowsPath)zlib true @@ -180,7 +182,7 @@ true __CORE_MESSAGING__;_CRT_SECURE_NO_WARNINGS;_DEBUG;PLUGINS_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) true - .;$(FrameworkPath);$(WindowsPath);$(WindowsPath)zlib + .;$(FrameworkPath)plugins\generated\json;$(FrameworkPath);$(WindowsPath);$(WindowsPath)zlib true @@ -203,7 +205,7 @@ true __CORE_MESSAGING__;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;PLUGINS_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) true - .;$(FrameworkPath);$(WindowsPath);$(WindowsPath)zlib + .;$(FrameworkPath)plugins\generated\json;$(FrameworkPath);$(WindowsPath);$(WindowsPath)zlib true diff --git a/Source/plugins/plugins.vcxproj.filters b/Source/plugins/plugins.vcxproj.filters old mode 100644 new mode 100755 index 3fac1626c7..f7742fa329 --- a/Source/plugins/plugins.vcxproj.filters +++ b/Source/plugins/plugins.vcxproj.filters @@ -31,6 +31,12 @@ Source Files + + Source Files\generated + + + Source Files\generated + @@ -101,6 +107,9 @@ {4ca8a196-74dd-4e20-98ef-051e5a446b67} + + {2ef8c592-a7e4-4c2e-9d00-d54599022486} +