Skip to content

Commit 4fe0771

Browse files
authored
Add BridgeLink plugin (#365)
* Add BridgeLink plugin * Make compile
1 parent 97d2865 commit 4fe0771

File tree

9 files changed

+1575
-0
lines changed

9 files changed

+1575
-0
lines changed

BridgeLink/BridgeLink.conf.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
startmode = "Deactivated"
2+
3+
configuration = JSON()
4+
5+
configuration.add("interval", 10)
6+
configuration.add("retries", 255)
7+
configuration.add("source", "@PLUGIN_BRIDGELINK_SOURCE@")
8+

BridgeLink/BridgeLink.cpp

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#include "BridgeLink.h"
2+
3+
namespace Thunder
4+
{
5+
namespace Plugin {
6+
7+
namespace {
8+
9+
static Metadata<BridgeLink> metadata(
10+
// Version
11+
1, 0, 0,
12+
// Preconditions
13+
{},
14+
// Terminations
15+
{},
16+
// Controls
17+
{}
18+
);
19+
}
20+
21+
/* virtual */ const string BridgeLink::Initialize(PluginHost::IShell* service)
22+
{
23+
ASSERT (service != nullptr);
24+
string message;
25+
Config config;
26+
config.FromString(service->ConfigLine());
27+
_skipURL = static_cast<uint8_t>(service->WebPrefix().length());
28+
29+
if (config.Source.Value().empty() == true) {
30+
message = _T("There is no address we can link to");
31+
}
32+
else {
33+
_link.Initialize(config.Source.Value(), config.Retries.Value(), config.Interval.Value());
34+
_callsign = service->Callsign();
35+
}
36+
return (EMPTY_STRING);
37+
}
38+
39+
/* virtual */ void BridgeLink::Deinitialize(PluginHost::IShell* service VARIABLE_IS_NOT_USED)
40+
{
41+
_link.Deinitialize(Core::infinite);
42+
_callsign.clear();
43+
}
44+
45+
/* virtual */ string BridgeLink::Information() const
46+
{
47+
// No additional info to report.
48+
return (string());
49+
}
50+
} // namespace Plugin
51+
} // namespace Thunder

0 commit comments

Comments
 (0)