|
@@ -25,11 +25,11 @@ namespace Plugin {
|
|
|
25
25
|
|
|
26
26
|
namespace {
|
|
27
27
|
|
|
28
|
-
static Metadata<OutOfProcessConfigPreconditions>metadata(
|
|
28
|
+
static Metadata<OutOfProcessConfigPreconditions> metadata(
|
|
29
29
|
// Version
|
|
30
30
|
1, 0, 0,
|
|
31
31
|
// Preconditions
|
|
32
|
-
{},
|
|
32
|
+
{ subsystem::GRAPHICS , subsystem::NOT_GRAPHICS , subsystem::TIME },
|
|
33
33
|
// Terminations
|
|
34
34
|
{},
|
|
35
35
|
// Controls
|
|
@@ -54,6 +54,7 @@ namespace Plugin {
|
|
|
54
54
|
if (_implBluetooth == nullptr) {
|
|
55
55
|
message = _T("Couldn't create instance of _implBluetooth");
|
|
56
56
|
} else {
|
|
57
|
+
_implBluetooth->Register(&_notification);
|
|
57
58
|
Exchange::IConfiguration* configuration = _implBluetooth->QueryInterface<Exchange::IConfiguration>();
|
|
58
59
|
ASSERT(configuration != nullptr);
|
|
59
60
|
if (configuration != nullptr) {
|
|
@@ -75,6 +76,7 @@ namespace Plugin {
|
|
|
75
76
|
_service->Unregister(static_cast<PluginHost::IShell::ICOMLink::INotification*>(&_notification));
|
|
76
77
|
|
|
77
78
|
if (_implBluetooth != nullptr) {
|
|
79
|
+
_implBluetooth->Unregister(&_notification);
|
|
78
80
|
|
|
79
81
|
RPC::IRemoteConnection* connection(service->RemoteConnection(_connectionId));
|
|
80
82
|
VARIABLE_IS_NOT_USED uint32_t result = _implBluetooth->Release();
|
|
@@ -118,25 +120,24 @@ namespace Plugin {
|
|
|
118
120
|
revokedInterface->Release();
|
|
119
121
|
}
|
|
120
122
|
}
|
|
121
|
-
}
|
|
122
123
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
124
|
+
if (interfaceId == Exchange::IBluetooth::INotification::ID) {
|
|
125
|
+
auto* revokedInterface = remote->QueryInterface<Exchange::IBluetooth::INotification>();
|
|
126
|
+
if (revokedInterface) {
|
|
127
|
+
_implBluetooth->Unregister(revokedInterface);
|
|
128
|
+
revokedInterface->Release();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (interfaceId == Exchange::IBluetooth::INotification::ID) {
|
|
133
|
+
auto* revokedInterface = remote->QueryInterface<Exchange::IBluetooth::INotification>();
|
|
134
|
+
if (revokedInterface) {
|
|
135
|
+
_implBluetooth->Unregister(revokedInterface);
|
|
136
|
+
revokedInterface->Release();
|
|
137
|
+
}
|
|
128
138
|
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
139
|
|
|
132
|
-
if (interfaceId == Exchange::IBluetooth::INotification::ID) {
|
|
133
|
-
auto* revokedInterface = remote->QueryInterface<Exchange::IBluetooth::INotification>();
|
|
134
|
-
if (revokedInterface) {
|
|
135
|
-
_implBluetooth->Unregister(revokedInterface);
|
|
136
|
-
revokedInterface->Release();
|
|
137
140
|
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
141
|
|
|
141
142
|
} // Plugin
|
|
142
143
|
} // Thunder
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
#pragma once
|
|
21
21
|
|
|
22
22
|
#include "Module.h"
|
|
23
|
-
#include <
|
|
23
|
+
#include <interfaces/IBluetooth.h>
|
|
24
24
|
|
|
25
25
|
namespace Thunder {
|
|
26
26
|
namespace Plugin {
|
|
@@ -42,6 +42,7 @@ namespace Plugin {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
~OutOfProcessConfigPreconditions() override = default;
|
|
45
|
+
private:
|
|
45
46
|
class Notification : public RPC::IRemoteConnection::INotification, public PluginHost::IShell::ICOMLink::INotification, public Exchange::IBluetooth::INotification, public Exchange::IBluetooth::INotification, public Exchange::IBluetooth::INotification {
|
|
46
47
|
public:
|
|
47
48
|
Notification(const Notification&) = delete;
|
|
@@ -73,15 +74,20 @@ namespace Plugin {
|
|
|
73
74
|
void Dangling(const Core::IUnknown* remote, const uint32_t interfaceId) override {
|
|
74
75
|
_parent.Dangling(remote, interfaceId);
|
|
75
76
|
}
|
|
76
|
-
void Update(IDevice
|
|
77
|
+
void Update(Exchange::IBluetooth::IDevice device) override {
|
|
78
|
+
// Intentionally left blank (non-@event notification).
|
|
77
79
|
}
|
|
78
80
|
void ScanningStateChanged() override {
|
|
81
|
+
// Intentionally left blank (non-@event notification).
|
|
79
82
|
}
|
|
80
83
|
void AdvertisingStateChanged() override {
|
|
84
|
+
// Intentionally left blank (non-@event notification).
|
|
81
85
|
}
|
|
82
86
|
void ScanningStateChanged() override {
|
|
87
|
+
// Intentionally left blank (non-@event notification).
|
|
83
88
|
}
|
|
84
89
|
void InquiryScanningStateChanged() override {
|
|
90
|
+
// Intentionally left blank (non-@event notification).
|
|
85
91
|
}
|
|
86
92
|
BEGIN_INTERFACE_MAP(Notification)
|
|
87
93
|
INTERFACE_ENTRY(RPC::IRemoteConnection::INotification)
|
|
@@ -18,12 +18,13 @@
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
#include "Module.h"
|
|
21
|
-
#include <
|
|
21
|
+
#include <interfaces/IBluetooth.h>
|
|
22
|
+
#include <interfaces/IConfiguration.h>
|
|
22
23
|
|
|
23
24
|
namespace Thunder {
|
|
24
25
|
namespace Plugin {
|
|
25
26
|
|
|
26
|
-
class OutOfProcessConfigPreconditionsImplementation : public Exchange::IBluetooth {
|
|
27
|
+
class OutOfProcessConfigPreconditionsImplementation : public Exchange::IConfiguration, public Exchange::IBluetooth {
|
|
27
28
|
public:
|
|
28
29
|
OutOfProcessConfigPreconditionsImplementation(const OutOfProcessConfigPreconditionsImplementation&) = delete;
|
|
29
30
|
OutOfProcessConfigPreconditionsImplementation& operator=(const OutOfProcessConfigPreconditionsImplementation&) = delete;
|
|
@@ -60,13 +61,13 @@ namespace Plugin {
|
|
|
60
61
|
public:
|
|
61
62
|
|
|
62
63
|
BEGIN_INTERFACE_MAP(OutOfProcessConfigPreconditionsImplementation)
|
|
64
|
+
INTERFACE_ENTRY(Exchange::IConfiguration)
|
|
63
65
|
INTERFACE_ENTRY(Exchange::IBluetooth)
|
|
64
66
|
END_INTERFACE_MAP
|
|
65
67
|
|
|
66
68
|
// IBluetooth methods
|
|
67
69
|
|
|
68
70
|
uint32_t Register(Exchange::IBluetooth::INotification* notification) override {
|
|
69
|
-
|
|
70
71
|
ASSERT(notification != nullptr);
|
|
71
72
|
|
|
72
73
|
_adminLock.Lock();
|
|
@@ -79,11 +80,10 @@ namespace Plugin {
|
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
_adminLock.Unlock();
|
|
82
|
-
|
|
83
|
+
return Core::ERROR_NONE;
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
uint32_t Unregister(const Exchange::IBluetooth::INotification* notification) override {
|
|
86
|
-
|
|
87
87
|
ASSERT(notification != nullptr);
|
|
88
88
|
|
|
89
89
|
_adminLock.Lock();
|
|
@@ -95,11 +95,11 @@ namespace Plugin {
|
|
|
95
95
|
notification->Release();
|
|
96
96
|
}
|
|
97
97
|
_adminLock.Unlock();
|
|
98
|
-
|
|
98
|
+
return Core::ERROR_NONE;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
bool IsScanning() const override {
|
|
102
|
-
return
|
|
102
|
+
return false;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
uint32_t Scan(const bool /* lowEnergy */, const uint16_t /* duration */ /* sec */) override {
|
|
@@ -111,16 +111,24 @@ namespace Plugin {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
IDevice* Device(const string& /* address */, const IDevice::type /* type */) override {
|
|
114
|
-
return
|
|
114
|
+
return nullptr;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
IDevice::IIterator* Devices() override {
|
|
118
|
-
return
|
|
118
|
+
return nullptr;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
uint32_t ForgetDevice(const string& /* address */, const IDevice::type /* type */) override {
|
|
122
122
|
return Core::ERROR_NONE;
|
|
123
123
|
}
|
|
124
|
+
|
|
125
|
+
uint32_t Configure(PluginHost::IShell* service) override {
|
|
126
|
+
ASSERT(service != nullptr);
|
|
127
|
+
Config config;
|
|
128
|
+
config.FromString(service->ConfigLine());
|
|
129
|
+
TRACE(Trace::Information, (_T("This is just an example: [%s]"), config.Example.Value.c_str()));
|
|
130
|
+
return Core::ERROR_NONE;
|
|
131
|
+
}
|
|
124
132
|
private:
|
|
125
133
|
using BluetoothNotificationContainer = std::vector<Exchange::IBluetooth::INotification*>;
|
|
126
134
|
|