Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Commit e028aa1

Browse files
author
Sebastien Guiriec
committed
clang-format: Update all the reference code with coding styles.
This patch is updating the full plugin source code according to Parameter Framework coding rules with clang-format tool. Signed-off-by: Sebastien Guiriec <[email protected]>
1 parent ecd3485 commit e028aa1

27 files changed

+182
-291
lines changed

base/AlsaCtlPortConfig.cpp

+8-16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011-2015, Intel Corporation
2+
* Copyright (c) 2011-2017, Intel Corporation
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without modification,
@@ -42,20 +42,14 @@ using std::string;
4242

4343
AlsaCtlPortConfig::AlsaCtlPortConfig(const string &mappingValue,
4444
CInstanceConfigurableElement *instanceConfigurableElement,
45-
const CMappingContext &context,
46-
core::log::Logger& logger,
45+
const CMappingContext &context, core::log::Logger &logger,
4746
const PortConfig &defaultPortConfig)
48-
: base(mappingValue,
49-
instanceConfigurableElement,
50-
context,
51-
logger),
52-
_device(context.getItemAsInteger(AlsaCtlDevice)),
53-
_portConfig(defaultPortConfig)
47+
: base(mappingValue, instanceConfigurableElement, context, logger),
48+
_device(context.getItemAsInteger(AlsaCtlDevice)), _portConfig(defaultPortConfig)
5449
{
55-
5650
}
5751

58-
bool AlsaCtlPortConfig::receiveFromHW(string &/*error*/)
52+
bool AlsaCtlPortConfig::receiveFromHW(string & /*error*/)
5953
{
6054
blackboardWrite(&_portConfig, sizeof(_portConfig));
6155

@@ -144,21 +138,19 @@ void AlsaCtlPortConfig::closeStream(StreamDirection streamDirection)
144138
}
145139

146140
string AlsaCtlPortConfig::formatAlsaError(StreamDirection streamDirection,
147-
const string &functionName,
148-
const string &error)
141+
const string &functionName, const string &error)
149142
{
150143
std::ostringstream stringStream;
151144

152-
stringStream << (streamDirection ? "Capture" : "Playback") << " " <<
153-
functionName << " error: " << error;
145+
stringStream << (streamDirection ? "Capture" : "Playback") << " " << functionName
146+
<< " error: " << error;
154147

155148
return stringStream.str();
156149
}
157150

158151
bool AlsaCtlPortConfig::isStreamEnabled(StreamDirection streamDirection) const
159152
{
160153
return _portConfig.isStreamEnabled[streamDirection] != 0;
161-
162154
}
163155

164156
bool AlsaCtlPortConfig::isDeviceUpdateNeeded(const PortConfig &portConfig) const

base/AlsaCtlPortConfig.hpp

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011-2015, Intel Corporation
2+
* Copyright (c) 2011-2017, Intel Corporation
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without modification,
@@ -45,23 +45,22 @@ class AlsaCtlPortConfig : public AlsaSubsystemObject
4545
struct PortConfig
4646
{
4747
uint8_t isStreamEnabled[2]; /**< [1] == Capture stream, [0] == Playback stream */
48-
uint8_t format; /**< S16LE,... */
49-
uint8_t channelNumber; /**< 1 == Mono.. */
50-
uint16_t sampleRate; /**< 16000, 48000... */
48+
uint8_t format; /**< S16LE,... */
49+
uint8_t channelNumber; /**< 1 == Mono.. */
50+
uint16_t sampleRate; /**< 16000, 48000... */
5151
} __attribute__((packed));
5252

5353
public:
5454
/** Structure to convert alsa formats in tinyalsa formats */
5555
struct FormatTranslation
5656
{
57-
uint8_t formatAsNumerical; /**< Tiny alsa format value */
57+
uint8_t formatAsNumerical; /**< Tiny alsa format value */
5858
std::string formatAsString; /**< Litteral value */
5959
};
6060

6161
AlsaCtlPortConfig(const std::string &mappingValue,
6262
CInstanceConfigurableElement *instanceConfigurableElement,
63-
const CMappingContext &contVext,
64-
core::log::Logger& logger,
63+
const CMappingContext &contVext, core::log::Logger &logger,
6564
const PortConfig &defaultPortConfig);
6665

6766
protected:
@@ -120,9 +119,8 @@ class AlsaCtlPortConfig : public AlsaSubsystemObject
120119
*
121120
* @return the string containing the error formatted
122121
*/
123-
std::string formatAlsaError(StreamDirection streamDirection,
124-
const std::string &functionName,
125-
const std::string &error);
122+
std::string formatAlsaError(StreamDirection streamDirection, const std::string &functionName,
123+
const std::string &error);
126124

127125
private:
128126
/**

base/AlsaMappingKeys.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011-2014, Intel Corporation
2+
* Copyright (c) 2011-2017, Intel Corporation
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without modification,
@@ -44,4 +44,4 @@ enum AlsaItemType
4444
NbAlsaItemTypes
4545
};
4646

47-
static const int gNbAlsaAmends (AlsaAmendEnd - AlsaAmend1 + 1);
47+
static const int gNbAlsaAmends(AlsaAmendEnd - AlsaAmend1 + 1);

base/AlsaSubsystem.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011-2015, Intel Corporation
2+
* Copyright (c) 2011-2017, Intel Corporation
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without modification,
@@ -41,7 +41,7 @@
4141
class AlsaSubsystem : public CSubsystem
4242
{
4343
public:
44-
AlsaSubsystem(const std::string &name, core::log::Logger& logger) : CSubsystem(name, logger)
44+
AlsaSubsystem(const std::string &name, core::log::Logger &logger) : CSubsystem(name, logger)
4545
{
4646
// Provide mapping keys to upper layer
4747
addContextMappingKey("Card");

base/AlsaSubsystemObject.cpp

+5-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011-2015, Intel Corporation
2+
* Copyright (c) 2011-2017, Intel Corporation
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without modification,
@@ -46,26 +46,20 @@ const char AlsaSubsystemObject::_soundCardPath[] = "/proc/asound/";
4646

4747
AlsaSubsystemObject::AlsaSubsystemObject(const string &mappingValue,
4848
CInstanceConfigurableElement *instanceConfigurableElement,
49-
const CMappingContext &context,
50-
core::log::Logger& logger)
51-
: base(instanceConfigurableElement, logger, mappingValue),
52-
_cardName(context.getItem(AlsaCard)),
49+
const CMappingContext &context, core::log::Logger &logger)
50+
: base(instanceConfigurableElement, logger, mappingValue), _cardName(context.getItem(AlsaCard)),
5351
_cardIndex(getCardNumberByName(context.getItem(AlsaCard)))
5452
{
55-
5653
}
5754

5855
AlsaSubsystemObject::AlsaSubsystemObject(const string &mappingValue,
5956
CInstanceConfigurableElement *instanceConfigurableElement,
60-
core::log::Logger& logger,
61-
uint32_t firstAmendKey,
62-
uint32_t nbAmendKeys,
63-
const CMappingContext &context)
57+
core::log::Logger &logger, uint32_t firstAmendKey,
58+
uint32_t nbAmendKeys, const CMappingContext &context)
6459
: base(instanceConfigurableElement, logger, mappingValue, firstAmendKey, nbAmendKeys, context),
6560
_cardName(context.getItem(AlsaCard)),
6661
_cardIndex(getCardNumberByName(context.getItem(AlsaCard)))
6762
{
68-
6963
}
7064
int32_t AlsaSubsystemObject::getCardNumberByName(const string &cardName)
7165
{

base/AlsaSubsystemObject.hpp

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011-2015, Intel Corporation
2+
* Copyright (c) 2011-2017, Intel Corporation
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without modification,
@@ -42,13 +42,10 @@ class AlsaSubsystemObject : public CFormattedSubsystemObject
4242
public:
4343
AlsaSubsystemObject(const std::string &mappingValue,
4444
CInstanceConfigurableElement *instanceConfigurableElement,
45-
const CMappingContext &context,
46-
core::log::Logger& logger);
45+
const CMappingContext &context, core::log::Logger &logger);
4746
AlsaSubsystemObject(const std::string &strMappingValue,
4847
CInstanceConfigurableElement *instanceConfigurableElement,
49-
core::log::Logger& logger,
50-
uint32_t firstAmendKey,
51-
uint32_t nbAmendKeys,
48+
core::log::Logger &logger, uint32_t firstAmendKey, uint32_t nbAmendKeys,
5249
const CMappingContext &context);
5350

5451
protected:

base/AmixerControl.cpp

+7-17
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011-2015, Intel Corporation
2+
* Copyright (c) 2011-2017, Intel Corporation
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without modification,
@@ -44,14 +44,9 @@
4444

4545
AmixerControl::AmixerControl(const std::string &mappingValue,
4646
CInstanceConfigurableElement *instanceConfigurableElement,
47-
const CMappingContext &context,
48-
core::log::Logger& logger)
49-
: base(mappingValue, instanceConfigurableElement, logger,
50-
AlsaAmend1,
51-
gNbAlsaAmends,
52-
context),
53-
_scalarSize(0),
54-
_hasWrongElementTypeError(false),
47+
const CMappingContext &context, core::log::Logger &logger)
48+
: base(mappingValue, instanceConfigurableElement, logger, AlsaAmend1, gNbAlsaAmends, context),
49+
_scalarSize(0), _hasWrongElementTypeError(false),
5550
_isDebugEnabled(context.iSet(AlsaDebugEnable))
5651
{
5752
// Check we are able to handle elements (no exception support, defer the error)
@@ -78,15 +73,10 @@ AmixerControl::AmixerControl(const std::string &mappingValue,
7873

7974
AmixerControl::AmixerControl(const std::string &mappingValue,
8075
CInstanceConfigurableElement *instanceConfigurableElement,
81-
const CMappingContext &context,
82-
core::log::Logger& logger,
76+
const CMappingContext &context, core::log::Logger &logger,
8377
uint32_t scalarSize)
84-
: base(mappingValue, instanceConfigurableElement, logger,
85-
AlsaAmend1,
86-
gNbAlsaAmends,
87-
context),
88-
_scalarSize(scalarSize),
89-
_hasWrongElementTypeError(false),
78+
: base(mappingValue, instanceConfigurableElement, logger, AlsaAmend1, gNbAlsaAmends, context),
79+
_scalarSize(scalarSize), _hasWrongElementTypeError(false),
9080
_isDebugEnabled(context.iSet(AlsaDebugEnable))
9181
{
9282
}

base/AmixerControl.hpp

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011-2015, Intel Corporation
2+
* Copyright (c) 2011-2017, Intel Corporation
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without modification,
@@ -52,8 +52,7 @@ class AmixerControl : public AlsaSubsystemObject
5252
*/
5353
AmixerControl(const std::string &mappingValue,
5454
CInstanceConfigurableElement *instanceConfigurableElement,
55-
const CMappingContext &context,
56-
core::log::Logger& logger);
55+
const CMappingContext &context, core::log::Logger &logger);
5756

5857
/**
5958
* AmixerControl Class constructor
@@ -65,9 +64,7 @@ class AmixerControl : public AlsaSubsystemObject
6564
*/
6665
AmixerControl(const std::string &mappingValue,
6766
CInstanceConfigurableElement *instanceConfigurableElement,
68-
const CMappingContext &context,
69-
core::log::Logger& logger,
70-
uint32_t scalarSize);
67+
const CMappingContext &context, core::log::Logger &logger, uint32_t scalarSize);
7168

7269
protected:
7370
virtual bool accessHW(bool receive, std::string &error) = 0;

base/AmixerMutableVolume.hpp

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011-2015, Intel Corporation
2+
* Copyright (c) 2011-2017, Intel Corporation
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without modification,
@@ -74,8 +74,7 @@ class AmixerMutableVolume : public SubsystemObjectBase
7474
*/
7575
AmixerMutableVolume(const std::string &mappingValue,
7676
CInstanceConfigurableElement *instConfigElement,
77-
const CMappingContext &context,
78-
core::log::Logger& logger)
77+
const CMappingContext &context, core::log::Logger &logger)
7978
: SubsystemObjectBase(mappingValue, instConfigElement, context, logger),
8079
_volumeLevelConfigurableElement(NULL)
8180
{
@@ -113,9 +112,7 @@ int AmixerMutableVolume<SubsystemObjectBase>::fromBlackboard()
113112
assert(volumeSize <= sizeof(MutableVolume));
114113

115114
// Be aware that this code does not work in big endian if volumeSize < sizeof(MutableVolume)
116-
MutableVolume volume = {
117-
false, 0
118-
};
115+
MutableVolume volume = {false, 0};
119116
this->blackboardRead(&volume, volumeSize);
120117

121118
// Take care of sign extension
@@ -130,8 +127,6 @@ void AmixerMutableVolume<SubsystemObjectBase>::toBlackboard(int volumeLevel)
130127
assert(volumeSize <= sizeof(MutableVolume));
131128

132129
// Be aware that this code does not work in big endian if volumeSize < sizeof(MutableVolume)
133-
const MutableVolume volume = {
134-
false, volumeLevel
135-
};
130+
const MutableVolume volume = {false, volumeLevel};
136131
this->blackboardWrite(&volume, volumeSize);
137132
}

legacy/LegacyAlsaCtlPortConfig.cpp

+13-25
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011-2015, Intel Corporation
2+
* Copyright (c) 2011-2017, Intel Corporation
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without modification,
@@ -38,20 +38,14 @@
3838
#define base AlsaCtlPortConfig
3939

4040
const AlsaCtlPortConfig::PortConfig LegacyAlsaCtlPortConfig::_defaultPortConfig = {
41-
{ false, false },
42-
SND_PCM_FORMAT_S16_LE,
43-
2,
44-
48000
45-
};
41+
{false, false}, SND_PCM_FORMAT_S16_LE, 2, 48000};
4642

4743
const uint32_t LegacyAlsaCtlPortConfig::_latencyMicroSeconds = 500000;
4844

4945
LegacyAlsaCtlPortConfig::LegacyAlsaCtlPortConfig(
50-
const std::string &mappingValue,
51-
CInstanceConfigurableElement *instanceConfigurableElement,
52-
const CMappingContext &context,
53-
core::log::Logger& logger)
54-
: base(mappingValue, instanceConfigurableElement, context, logger, _defaultPortConfig)
46+
const std::string &mappingValue, CInstanceConfigurableElement *instanceConfigurableElement,
47+
const CMappingContext &context, core::log::Logger &logger)
48+
: base(mappingValue, instanceConfigurableElement, context, logger, _defaultPortConfig)
5549
{
5650
// Init stream handle array
5751
_streamHandle[Playback] = NULL;
@@ -63,11 +57,10 @@ LegacyAlsaCtlPortConfig::LegacyAlsaCtlPortConfig(
6357
// Create device name
6458
std::ostringstream streamName;
6559

66-
streamName << "hw:" << snd_card_get_index(cardIndex.c_str())
67-
<< "," << context.getItem(AlsaCtlDevice);
60+
streamName << "hw:" << snd_card_get_index(cardIndex.c_str()) << ","
61+
<< context.getItem(AlsaCtlDevice);
6862

6963
_streamName = streamName.str();
70-
7164
}
7265

7366
bool LegacyAlsaCtlPortConfig::doOpenStream(StreamDirection streamDirection, std::string &error)
@@ -76,10 +69,9 @@ bool LegacyAlsaCtlPortConfig::doOpenStream(StreamDirection streamDirection, std:
7669
int32_t errorId;
7770

7871
if ((errorId = snd_pcm_open(
79-
&streamHandle,
80-
_streamName.c_str(),
81-
streamDirection == Capture ? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK,
82-
0)) < 0) {
72+
&streamHandle, _streamName.c_str(),
73+
streamDirection == Capture ? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK, 0)) <
74+
0) {
8375

8476
error = formatAlsaError(streamDirection, "open", snd_strerror(errorId));
8577

@@ -88,13 +80,9 @@ bool LegacyAlsaCtlPortConfig::doOpenStream(StreamDirection streamDirection, std:
8880

8981
const AlsaCtlPortConfig::PortConfig &portConfig = getPortConfig();
9082

91-
if ((errorId = snd_pcm_set_params(streamHandle,
92-
static_cast<_snd_pcm_format>(portConfig.format),
93-
SND_PCM_ACCESS_RW_INTERLEAVED,
94-
portConfig.channelNumber,
95-
portConfig.sampleRate,
96-
0,
97-
_latencyMicroSeconds)) < 0) {
83+
if ((errorId = snd_pcm_set_params(streamHandle, static_cast<_snd_pcm_format>(portConfig.format),
84+
SND_PCM_ACCESS_RW_INTERLEAVED, portConfig.channelNumber,
85+
portConfig.sampleRate, 0, _latencyMicroSeconds)) < 0) {
9886

9987
error = formatAlsaError(streamDirection, "set params", snd_strerror(errorId));
10088

legacy/LegacyAlsaCtlPortConfig.hpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011-2015, Intel Corporation
2+
* Copyright (c) 2011-2017, Intel Corporation
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without modification,
@@ -47,8 +47,7 @@ class LegacyAlsaCtlPortConfig : public AlsaCtlPortConfig
4747
*/
4848
LegacyAlsaCtlPortConfig(const std::string &mappingValue,
4949
CInstanceConfigurableElement *instanceConfigurableElement,
50-
const CMappingContext &context,
51-
core::log::Logger& logger);
50+
const CMappingContext &context, core::log::Logger &logger);
5251

5352
protected:
5453
// Stream operations

0 commit comments

Comments
 (0)