Skip to content

Commit

Permalink
[Controller] Reduce opaqueness of JSON-RPC API (rdkcentral#1466)
Browse files Browse the repository at this point in the history
* [Controller] Reduce opaqueness of JSON-RPC API

* Fix windows build

* Update Controller documentation

* Install JsonData headers

* Remove debug

---------

Co-authored-by: Pierre Wielders <[email protected]>
  • Loading branch information
2 people authored and bramoosterhuis committed Apr 26, 2024
1 parent 46ec55c commit 8cb5dc3
Show file tree
Hide file tree
Showing 19 changed files with 1,144 additions and 1,136 deletions.
387 changes: 302 additions & 85 deletions Source/WPEFramework/Controller.cpp

Large diffs are not rendered by default.

26 changes: 14 additions & 12 deletions Source/WPEFramework/Controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
// -------------------------------------------------------------------------------------------------------
Expand Down
17 changes: 17 additions & 0 deletions Source/WPEFramework/ControllerPlugin.json
Original file line number Diff line number Diff line change
@@ -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" }
]
}
10 changes: 5 additions & 5 deletions Source/WPEFramework/PluginHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
);
Expand All @@ -733,8 +733,8 @@ POP_WARNING()
Core::JSON::ArrayType<MetaData::COMRPC::Proxy>::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");
}
Expand Down
2 changes: 1 addition & 1 deletion Source/WPEFramework/PluginServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Empty file modified Source/WPEFramework/bridge.vcxproj
100644 → 100755
Empty file.
Loading

0 comments on commit 8cb5dc3

Please sign in to comment.