Skip to content

Commit

Permalink
[BluetoothControl] Update to .json-free interface
Browse files Browse the repository at this point in the history
  • Loading branch information
sebaszm committed Oct 30, 2024
1 parent 4f6a380 commit a2ab588
Show file tree
Hide file tree
Showing 2 changed files with 378 additions and 456 deletions.
15 changes: 5 additions & 10 deletions BluetoothControl/BluetoothControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@

namespace Thunder {

ENUM_CONVERSION_BEGIN(Plugin::BluetoothControl::Config::adaptertype)
{ Plugin::BluetoothControl::Config::CLASSIC, _TXT("classic") },
{ Plugin::BluetoothControl::Config::LOW_ENERGY, _TXT("lowenergy") },
{ Plugin::BluetoothControl::Config::DUAL, _TXT("dual") },
ENUM_CONVERSION_END(Plugin::BluetoothControl::Config::adaptertype)

namespace Plugin {

namespace {
Expand Down Expand Up @@ -66,8 +60,9 @@ namespace Plugin {
result = Core::ToString(driverMessage);
}
else {
const bool supportsClassic((_config.Type.IsSet() == false) || (_config.Type == Config::CLASSIC) || (_config.Type == Config::DUAL));
const bool supportsLowEnergy((_config.Type.IsSet() == false) || (_config.Type == Config::LOW_ENERGY) || (_config.Type == Config::DUAL));
const bool isDual = ((_config.Type.IsSet() == false) || (_config.Type == JBluetoothControl::adaptertype::DUAL));
const bool supportsClassic(isDual || (_config.Type == JBluetoothControl::adaptertype::CLASSIC));
const bool supportsLowEnergy(isDual || (_config.Type == JBluetoothControl::adaptertype::LOW_ENERGY));
uint32_t deviceClass(_config.Class.Value());

ASSERT(supportsClassic || supportsLowEnergy);
Expand Down Expand Up @@ -213,7 +208,7 @@ namespace Plugin {

service->Register(this);

Exchange::JBluetoothControl::Register<JSONRPCImplementation>(*this, _jsonrpcImplementation);
Exchange::JSONRPC::JBluetoothControl::Register(*this, &_jsonrpcImplementation, &_jsonrpcImplementation);

// Bluetooth is ready!
PluginHost::ISubSystem* subSystems(service->SubSystems());
Expand All @@ -235,7 +230,7 @@ namespace Plugin {

if (Connector().IsOpen() == true) {

Exchange::JBluetoothControl::Unregister(*this);
Exchange::JSONRPC::JBluetoothControl::Unregister(*this);

service->Unregister(this);

Expand Down
Loading

0 comments on commit a2ab588

Please sign in to comment.