Skip to content

Commit

Permalink
Merge branch 'master' into development/websocket
Browse files Browse the repository at this point in the history
  • Loading branch information
msieben authored Nov 22, 2024
2 parents d351981 + cd70ca5 commit 080e84a
Show file tree
Hide file tree
Showing 26 changed files with 241 additions and 130 deletions.
30 changes: 13 additions & 17 deletions .github/workflows/Build Thunder on MacOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,21 @@ on:
- 'ReleaseNotes/**'

jobs:
Thunder:
Thunder_MacOS:
uses: rdkcentral/Thunder/.github/workflows/MacOS build template.yml@master

# ThunderInterfaces:
# needs: Thunder
# uses: rdkcentral/ThunderInterfaces/.github/workflows/Linux build template.yml@master
ThunderInterfaces_MacOS:
needs: Thunder_MacOS
uses: rdkcentral/ThunderInterfaces/.github/workflows/MacOS build template.yml@master

# ThunderLibraries:
# needs: Thunder
# uses: WebPlatformForEmbedded/ThunderLibraries/.github/workflows/Linux build template.yml@main
ThunderClientLibraries_MacOS:
needs: ThunderInterfaces_MacOS
uses: rdkcentral/ThunderClientLibraries/.github/workflows/MacOS build template.yml@master

# ThunderClientLibraries:
# needs: ThunderInterfaces
# uses: rdkcentral/ThunderClientLibraries/.github/workflows/Linux build template.yml@master
ThunderNanoServices_MacOS:
needs: ThunderInterfaces_MacOS
uses: rdkcentral/ThunderNanoServices/.github/workflows/MacOS build template.yml@master

# ThunderNanoServices:
# needs: ThunderInterfaces
# uses: rdkcentral/ThunderNanoServices/.github/workflows/Linux build template.yml@master

# ThunderNanoServicesRDK:
# needs: ThunderInterfaces
# uses: WebPlatformForEmbedded/ThunderNanoServicesRDK/.github/workflows/Linux build template.yml@master
ThunderNanoServicesRDK_MacOS:
needs: ThunderInterfaces_MacOS
uses: WebPlatformForEmbedded/ThunderNanoServicesRDK/.github/workflows/MacOS build template.yml@master
2 changes: 1 addition & 1 deletion .github/workflows/Test Thunder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:

jobs:
Thunder:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

strategy:
matrix:
Expand Down
11 changes: 9 additions & 2 deletions Source/Thunder/Controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1216,22 +1216,27 @@ namespace Plugin {
return (Core::ERROR_NONE);
}

Core::hresult Controller::Proxies(const uint32_t linkId, IMetadata::Data::IProxiesIterator*& outProxies) const
Core::hresult Controller::Proxies(const Core::OptionalType<string>& linkId, IMetadata::Data::IProxiesIterator*& outProxies) const
{
Core::hresult result = Core::ERROR_UNKNOWN_KEY;

std::vector<IMetadata::Data::Proxy> collection;
bool proxySearch = RPC::Administrator::Instance().Allocations(linkId, [&collection](const std::vector<ProxyStub::UnknownProxy*>& proxies) {
bool proxySearch = RPC::Administrator::Instance().Allocations(linkId.IsSet() ? linkId.Value() : EMPTY_STRING, [&collection, &linkId](const string& origin, const std::vector<ProxyStub::UnknownProxy*>& proxies) {
for (const auto& proxy : proxies) {
IMetadata::Data::Proxy data;
data.Count = proxy->ReferenceCount();
data.Instance = proxy->Implementation();
data.Interface = proxy->InterfaceId();
data.Name = proxy->Name();
if (linkId.IsSet() == false) {
data.Origin = Core::NumberType<uint32_t>(proxy->ChannelId()).Text() + '@' + origin;
}
collection.emplace_back(std::move(data));
}
});

TRACE(Trace::Information, (_T("Found %d proxies to be listed and the search = [%s]"), collection.size(), proxySearch ? _T("true") : _T("false")));

if (proxySearch == true) {
using Iterator = IMetadata::Data::IProxiesIterator;

Expand Down Expand Up @@ -1440,6 +1445,8 @@ namespace Plugin {
buildInfo.ThreadPoolCount = THREADPOOL_COUNT;
#endif

buildInfo.COMRPCTimeOut = RPC::CommunicationTimeOut;

return (Core::ERROR_NONE);
}
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Thunder/Controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ namespace Plugin {

// 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 Proxies(const Core::OptionalType<string>& linkId, IMetadata::Data::IProxiesIterator*& proxies) const override;
Core::hresult Services(const Core::OptionalType<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;
Expand Down
30 changes: 12 additions & 18 deletions Source/Thunder/ExampleConfigWindows.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
"binding": "127.0.0.1",
"idletime": 60,
"ipv6": false,
"persistentpath": "C:/ThunderWin/artifacts/Persistent",
"volatilepath": "C:/ThunderWin/artifacts/temp",
"datapath": "C:/ThunderWin/artifacts/Debug/Plugins",
"systempath": "C:/ThunderWin/artifacts/Debug",
"proxystubpath": "C:/ThunderWin/artifacts/ProxyStubs/Debug",
"persistentpath": "D:/domotica/artifacts/Persistent",
"volatilepath": "D:/domotica//artifacts/temp",
"datapath": "D:/domotica/artifacts/Debug/Plugins",
"systempath": "D:/domotica/artifacts/Debug",
"proxystubpath": "D:/domotica/artifacts/ProxyStubs/Debug",
"communicator": "127.0.0.1:62000",
"redirect": "Service/Controller/UI",
"observe": {
"proxystubpath": "C:/ThunderWin/artifacts/dynamic/proxystubs",
"configpath": "C:/ThunderWin/artifacts/dynamic/config"
"proxystubpath": "D:/domotica/artifacts/dynamic/proxystubs",
"configpath": "D:/domotica/artifacts/dynamic/config"
},
"messaging": {
"port": 63000,
Expand Down Expand Up @@ -137,7 +137,7 @@
"callsign": "Butler",
"locator": "libButler.so",
"classname": "Butler",
"startmode": "Activated"
"startmode": "Deactivated"
},
{
"callsign": "ZigbeeControl",
Expand All @@ -154,10 +154,10 @@
"callsign": "ZWaveControl",
"locator": "libZWaveControl.so",
"classname": "ZWaveControl",
"startmode": "Activated",
"startmode": "Deactivated",
"configuration": {
"port": "\\\\.\\COM4",
"key": "ba:09:87:65:43:21:de:ad:be:ef:12:34:56:78:90:ab"
"key": "ba:09:87:65:43:21:de:ad:be:ef:12:34:56:78:90:ab"
}
},
{
Expand Down Expand Up @@ -401,7 +401,7 @@
"sleep": "5",
"single": false,
"crash": true,
"leak": true,
"leak": true,
"root": {
"mode": "Local"
}
Expand Down Expand Up @@ -458,7 +458,7 @@
"callsign": "WebServer",
"locator": "libWebServer.so",
"classname": "WebServer",
"startmode": "Deactivated",
"startmode": "Activated",
"communicator": "127.0.0.1:2349",
"configuration": {
"port": 8080,
Expand Down Expand Up @@ -571,12 +571,6 @@
"classname": "MessageControl",
"startmode": "Activated"
},
{
"callsign": "TraceControl",
"locator": "libtracecontrol.so",
"classname": "TraceControl",
"startmode": "Deactivated"
},
{
"callsign": "RemoteControl",
"locator": "libremotecontrol.so",
Expand Down
4 changes: 2 additions & 2 deletions Source/Thunder/PluginHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -712,10 +712,10 @@ POP_WARNING()
printf("Link: %s\n", index.Current().Remote.Value().c_str());
printf("------------------------------------------------------------\n");

RPC::Administrator::Instance().Allocations(index.Current().ID.Value(), [](const std::vector<ProxyStub::UnknownProxy*>& proxies) {
RPC::Administrator::Instance().Allocations(index.Current().Name.Value(), [](const string& origin, const std::vector<ProxyStub::UnknownProxy*>& proxies) {
for (const auto& proxy: proxies) {
Core::instance_id instanceId = proxy->Implementation();
printf("[%s] InstanceId: 0x%" PRIx64 ", RefCount: %d, InterfaceId %d [0x%X]\n", proxy->Name().c_str(), static_cast<uint64_t>(instanceId), proxy->ReferenceCount(), proxy->InterfaceId(), proxy->InterfaceId());
printf("[%s] InstanceId: 0x%" PRIx64 ", RefCount: %d, InterfaceId %d [0x%X], Origin: %s\n", proxy->Name().c_str(), static_cast<uint64_t>(instanceId), proxy->ReferenceCount(), proxy->InterfaceId(), proxy->InterfaceId(), origin.c_str());
}
printf("\n");
});
Expand Down
42 changes: 29 additions & 13 deletions Source/Thunder/PluginServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -532,10 +532,11 @@ namespace PluginHost {
ExternalAccess& operator=(const ExternalAccess&) = delete;

ExternalAccess(
const Core::NodeId& source,
const Core::NodeId& sourceNode,
const string& proxyStubPath,
const Core::ProxyType<RPC::InvokeServer>& handler)
: RPC::Communicator(source, proxyStubPath, Core::ProxyType<Core::IIPCServer>(handler))
const Core::ProxyType<RPC::InvokeServer>& handler,
const string& sourceName)
: RPC::Communicator(sourceNode, proxyStubPath, Core::ProxyType<Core::IIPCServer>(handler), sourceName.c_str())
, _plugin(nullptr) {
}
~ExternalAccess() override = default;
Expand Down Expand Up @@ -675,7 +676,6 @@ namespace PluginHost {
ControlData(const uint32_t maxRequests)
: _isExtended(false)
, _maxRequests(maxRequests)
, _state(0)
, _major(~0)
, _minor(~0)
, _patch(~0)
Expand Down Expand Up @@ -752,7 +752,6 @@ namespace PluginHost {
private:
bool _isExtended;
uint32_t _maxRequests;
VARIABLE_IS_NOT_USED uint8_t _state;
uint8_t _major;
uint8_t _minor;
uint8_t _patch;
Expand Down Expand Up @@ -802,9 +801,8 @@ namespace PluginHost {
Service& operator=(Service&&) = delete;
Service& operator=(const Service&) = delete;

Service(const PluginHost::Config& server, const Plugin::Config& plugin, ServiceMap& administrator, const mode type, const Core::ProxyType<RPC::InvokeServer>& handler)
Service(const PluginHost::Config& server, const Plugin::Config& plugin, ServiceMap& administrator, const mode /* type */, const Core::ProxyType<RPC::InvokeServer>& handler)
: PluginHost::Service(plugin, server.WebPrefix(), server.PersistentPath(), server.DataPath(), server.VolatilePath())
, _mode(type)
, _pluginHandling()
, _handler(nullptr)
, _extended(nullptr)
Expand All @@ -822,7 +820,7 @@ namespace PluginHost {
, _lastId(0)
, _metadata(plugin.MaxRequests.Value())
, _library()
, _external(PluginNodeId(server, plugin), server.ProxyStubPath(), handler)
, _external(PluginNodeId(server, plugin), server.ProxyStubPath(), handler, '/' + Callsign())
, _administrator(administrator)
, _composit(*this)
, _jobs(administrator)
Expand Down Expand Up @@ -855,6 +853,9 @@ namespace PluginHost {
}

public:
inline const RPC::Communicator& COMServer() const {
return (_external);
}
inline void Submit(Core::ProxyType<Core::IDispatch>&& job) {
_jobs.Push(std::move(job));
}
Expand Down Expand Up @@ -1622,7 +1623,6 @@ namespace PluginHost {
}

private:
VARIABLE_IS_NOT_USED const mode _mode;
mutable Core::CriticalSection _pluginHandling;

// The handlers that implement the actual logic behind the service
Expand All @@ -1642,7 +1642,9 @@ namespace PluginHost {
uint32_t _lastId;
ControlData _metadata;
Core::Library _library;
VARIABLE_IS_NOT_USED void* _hibernateStorage;
#ifdef HIBERNATE_SUPPORT_ENABLED
void* _hibernateStorage;
#endif
ExternalAccess _external;
ServiceMap& _administrator;
Core::SinkType<Composit> _composit;
Expand Down Expand Up @@ -2205,7 +2207,7 @@ namespace PluginHost {
const uint8_t hardKillCheckWaitTime,
const bool delegatedReleases,
const Core::ProxyType<RPC::InvokeServer>& handler)
: RPC::Communicator(node, ProxyStubPathCreator(proxyStubPath, observableProxyStubPath), Core::ProxyType<Core::IIPCServer>(handler))
: RPC::Communicator(node, ProxyStubPathCreator(proxyStubPath, observableProxyStubPath), Core::ProxyType<Core::IIPCServer>(handler), _T("/"))
, _parent(parent)
, _persistentPath(persistentPath)
, _systemPath(systemPath)
Expand Down Expand Up @@ -3203,10 +3205,24 @@ namespace PluginHost {

entry.Activity = element.Source().IsOpen();
entry.State = Metadata::Channel::state::COMRPC;
entry.Name = string("/" EXPAND_AND_QUOTE(APPLICATION_NAME) "/Communicator");
entry.Name = element.Extension().Origin();
entry.Remote = element.Source().RemoteId();
});
_adminLock.Unlock();

for (const auto& entry : _services) {
entry.second->COMServer().Visit([&](const RPC::Communicator::Client& element)
{
Metadata::Channel& entry = metaData.Add();
entry.ID = element.Extension().Id();

entry.Activity = element.Source().IsOpen();
entry.State = Metadata::Channel::state::COMRPC;
entry.Name = element.Extension().Origin();
entry.Remote = element.Source().RemoteId();
});
}

_adminLock.Unlock();
}
uint32_t FromIdentifier(const string& callSign, Core::ProxyType<IShell>& service)
{
Expand Down
Loading

0 comments on commit 080e84a

Please sign in to comment.