Skip to content

Commit

Permalink
[BTRemoteControl] Update after interface changes (#854)
Browse files Browse the repository at this point in the history
* [BTRemoteControl] Update after interface changes

* Remove REST api

* Update documentation

---------

Co-authored-by: Pierre Wielders <[email protected]>
  • Loading branch information
sebaszm and pwielders authored Jan 16, 2025
1 parent 58aaad3 commit 85ba92a
Show file tree
Hide file tree
Showing 11 changed files with 803 additions and 888 deletions.
12 changes: 6 additions & 6 deletions BluetoothRemoteControl/4ModDecoders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class ADPCM : public Decoders::IDecoder {
};

public:
static constexpr Exchange::IVoiceProducer::IProfile::codec DecoderType = Exchange::IVoiceProducer::IProfile::codec::ADPCM;
static const TCHAR* Name;
static constexpr Exchange::IBluetoothRemoteControl::codectype DecoderType = Exchange::IBluetoothRemoteControl::codectype::IMA_ADPCM;
static const TCHAR* Name;

public:
ADPCM() = delete;
Expand Down Expand Up @@ -118,7 +118,7 @@ class ADPCM : public Decoders::IDecoder {

::memcpy(_package, &(dataIn[3]), _offset);
}
else if ((lengthIn + _offset) < sizeof(_package)) {
else if ((lengthIn + _offset) < sizeof(_package)) {
::memcpy(&(_package[_offset]), dataIn, lengthIn);
_offset += lengthIn;
}
Expand Down Expand Up @@ -146,7 +146,7 @@ class ADPCM : public Decoders::IDecoder {
_frame = 0;
_offset = 0;
}

return ( sendFrame );
}

Expand All @@ -166,7 +166,7 @@ static Decoders::DecoderFactory<ADPCM> _adpcmFactory;

class PCM : public ADPCM {
public:
static constexpr Exchange::IVoiceProducer::IProfile::codec DecoderType = Exchange::IVoiceProducer::IProfile::codec::PCM;
static constexpr Exchange::IBluetoothRemoteControl::codectype DecoderType = Exchange::IBluetoothRemoteControl::codectype::PCM;

public:
PCM() = delete;
Expand Down Expand Up @@ -290,4 +290,4 @@ class PCM : public ADPCM {

static Decoders::DecoderFactory<PCM> _pcmFactory;

} // namespace
} // namespace
10 changes: 5 additions & 5 deletions BluetoothRemoteControl/Administrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Key {
Key(const Key&) = delete;
Key& operator= (const Key&) = delete;

Key(const TCHAR name[], const Exchange::IVoiceProducer::IProfile::codec codec)
Key(const TCHAR name[], const Exchange::IBluetoothRemoteControl::codectype codec)
: _name(name)
, _codec(codec) {
}
Expand All @@ -45,15 +45,15 @@ class Key {
bool operator!= (const Key& RHS) const {
return (!operator==(RHS));
}

private:
const string _name;
Exchange::IVoiceProducer::IProfile::codec _codec;
Exchange::IBluetoothRemoteControl::codectype _codec;
};

static std::map<Key, IDecoder::IFactory*> _factories;

/* static */ IDecoder* IDecoder::Instance(const TCHAR name[], Exchange::IVoiceProducer::IProfile::codec codec, const string& configuration)
/* static */ IDecoder* IDecoder::Instance(const TCHAR name[], Exchange::IBluetoothRemoteControl::codectype codec, const string& configuration)
{
IDecoder* result = nullptr;
std::map<Key, IDecoder::IFactory*>::iterator index = _factories.find(Key(name, codec));
Expand All @@ -63,7 +63,7 @@ static std::map<Key, IDecoder::IFactory*> _factories;
return (result);
}

/* static */ void IDecoder::Announce(const TCHAR name[], Exchange::IVoiceProducer::IProfile::codec codec, IDecoder::IFactory* factory)
/* static */ void IDecoder::Announce(const TCHAR name[], Exchange::IBluetoothRemoteControl::codectype codec, IDecoder::IFactory* factory)
{
// uses pair's piecewise constructor
_factories.emplace(std::piecewise_construct,
Expand Down
6 changes: 3 additions & 3 deletions BluetoothRemoteControl/Administrator.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include "Module.h"

#include <interfaces/IVoiceHandler.h>
#include <interfaces/IBluetoothRemoteControl.h>

namespace Thunder {

Expand All @@ -35,8 +35,8 @@ namespace Decoders {
virtual IDecoder* Factory(const string& configuration) = 0;
};

static void Announce(const TCHAR name[], Exchange::IVoiceProducer::IProfile::codec codec, IFactory* factory);
static IDecoder* Instance(const TCHAR name[], Exchange::IVoiceProducer::IProfile::codec codec, const string& configuration);
static void Announce(const TCHAR name[], Exchange::IBluetoothRemoteControl::codectype, IFactory* factory);
static IDecoder* Instance(const TCHAR name[], Exchange::IBluetoothRemoteControl::codectype codec, const string& configuration);

virtual uint32_t Frames() const = 0;
virtual uint32_t Dropped() const = 0;
Expand Down
14 changes: 9 additions & 5 deletions BluetoothRemoteControl/BluetoothRemoteControl.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@ configuration.add("controller", "BluetoothControl")
configuration.add("keyingest", "true")
configuration.add("recorder", "off")
configuration.add("keymap", "bluetooth")
configuration.add("codec", "pcm")
configuration.add("samplerate", "16000")
configuration.add("channels", "1")
configuration.add("resolution", "16")
configuration.add("configuration", None)
configuration.add("serviceuuid", "f0e0d000-a000-b000-c000-987654321000")
configuration.add("commanduuid", "f0e0d001-a000-b000-c000-987654321000")
configuration.add("datauuid", "f0e0d002-a000-b000-c000-987654321000")
configuration.add("audiobuffersize", 0)
configuration.add("firstaudiochunksize", 40)
configuration.add("audiochunksize", 40)

audioprofile = JSON()
audioprofile.add("codec", "pcm")
audioprofile.add("samplerate", "16000")
audioprofile.add("channels", "1")
audioprofile.add("resolution", "16")
audioprofile.add("configuration", "")

configuration.add("audioprofile", audioprofile)
Loading

0 comments on commit 85ba92a

Please sign in to comment.