mirror of
https://github.com/esphome/esphome.git
synced 2024-11-24 07:58:09 +01:00
fix lint
This commit is contained in:
parent
1227d4d924
commit
d355fecbaa
1 changed files with 11 additions and 10 deletions
|
@ -9,7 +9,7 @@ namespace media_player {
|
|||
|
||||
#define MEDIA_PLAYER_SIMPLE_COMMAND_ACTION(ACTION_CLASS, ACTION_COMMAND) \
|
||||
template<typename... Ts> \
|
||||
class(ACTION_CLASS) \
|
||||
class ACTION_CLASS /* NOLINT(bugprone-macro-parentheses)*/ \
|
||||
: public Action<Ts...>, \
|
||||
public Parented<MediaPlayer>{ \
|
||||
void play(Ts... x) override{this->parent_->make_call() \
|
||||
|
@ -20,15 +20,16 @@ namespace media_player {
|
|||
;
|
||||
|
||||
#define MEDIA_PLAYER_SIMPLE_STATE_TRIGGER(TRIGGER_CLASS, TRIGGER_STATE) \
|
||||
class(TRIGGER_CLASS) \
|
||||
: public Trigger<>{ \
|
||||
public: explicit TRIGGER_CLASS(MediaPlayer * player){player->add_on_state_callback([this, player]() { \
|
||||
if (player->state == MediaPlayerState::MEDIA_PLAYER_STATE_##TRIGGER_STATE) \
|
||||
this->trigger(); \
|
||||
}); \
|
||||
} \
|
||||
} \
|
||||
;
|
||||
class TRIGGER_CLASS /* NOLINT(bugprone-macro-parentheses)*/ \
|
||||
: public Trigger<> { \
|
||||
public: \
|
||||
explicit TRIGGER_CLASS(MediaPlayer *player) { \
|
||||
player->add_on_state_callback([this, player]() { \
|
||||
if (player->state == MediaPlayerState::MEDIA_PLAYER_STATE_##TRIGGER_STATE) \
|
||||
this->trigger(); \
|
||||
}); \
|
||||
} \
|
||||
};
|
||||
|
||||
MEDIA_PLAYER_SIMPLE_COMMAND_ACTION(PlayAction, PLAY)
|
||||
MEDIA_PLAYER_SIMPLE_COMMAND_ACTION(PauseAction, PAUSE)
|
||||
|
|
Loading…
Reference in a new issue