2021-06-02 15:16:05 +00:00
|
|
|
#pragma once
|
2021-06-25 13:52:27 +00:00
|
|
|
#include "../irda-app-event.hpp"
|
2021-06-02 15:16:05 +00:00
|
|
|
#include <api-hal-irda.h>
|
|
|
|
#include "irda.h"
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
2021-06-25 13:52:27 +00:00
|
|
|
#include "../irda-app-brute-force.hpp"
|
|
|
|
|
2021-06-02 15:16:05 +00:00
|
|
|
|
|
|
|
class IrdaApp;
|
|
|
|
|
|
|
|
class IrdaAppScene {
|
|
|
|
public:
|
|
|
|
virtual void on_enter(IrdaApp* app) = 0;
|
|
|
|
virtual bool on_event(IrdaApp* app, IrdaAppEvent* event) = 0;
|
|
|
|
virtual void on_exit(IrdaApp* app) = 0;
|
|
|
|
virtual ~IrdaAppScene(){};
|
|
|
|
|
|
|
|
private:
|
|
|
|
};
|
|
|
|
|
|
|
|
class IrdaAppSceneStart : public IrdaAppScene {
|
|
|
|
public:
|
|
|
|
void on_enter(IrdaApp* app) final;
|
|
|
|
bool on_event(IrdaApp* app, IrdaAppEvent* event) final;
|
|
|
|
void on_exit(IrdaApp* app) final;
|
2021-06-09 13:04:49 +00:00
|
|
|
private:
|
|
|
|
uint32_t submenu_item_selected = 0;
|
2021-06-02 15:16:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class IrdaAppSceneUniversal : public IrdaAppScene {
|
|
|
|
public:
|
|
|
|
void on_enter(IrdaApp* app) final;
|
|
|
|
bool on_event(IrdaApp* app, IrdaAppEvent* event) final;
|
|
|
|
void on_exit(IrdaApp* app) final;
|
2021-06-09 13:04:49 +00:00
|
|
|
private:
|
|
|
|
uint32_t submenu_item_selected = 0;
|
2021-06-02 15:16:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class IrdaAppSceneLearn : public IrdaAppScene {
|
|
|
|
public:
|
|
|
|
void on_enter(IrdaApp* app) final;
|
|
|
|
bool on_event(IrdaApp* app, IrdaAppEvent* event) final;
|
|
|
|
void on_exit(IrdaApp* app) final;
|
|
|
|
};
|
|
|
|
|
|
|
|
class IrdaAppSceneLearnSuccess : public IrdaAppScene {
|
|
|
|
public:
|
|
|
|
void on_enter(IrdaApp* app) final;
|
|
|
|
bool on_event(IrdaApp* app, IrdaAppEvent* event) final;
|
|
|
|
void on_exit(IrdaApp* app) final;
|
|
|
|
};
|
|
|
|
|
|
|
|
class IrdaAppSceneLearnEnterName : public IrdaAppScene {
|
|
|
|
public:
|
|
|
|
void on_enter(IrdaApp* app) final;
|
|
|
|
bool on_event(IrdaApp* app, IrdaAppEvent* event) final;
|
|
|
|
void on_exit(IrdaApp* app) final;
|
|
|
|
};
|
|
|
|
|
|
|
|
class IrdaAppSceneLearnDone : public IrdaAppScene {
|
|
|
|
public:
|
|
|
|
void on_enter(IrdaApp* app) final;
|
|
|
|
bool on_event(IrdaApp* app, IrdaAppEvent* event) final;
|
|
|
|
void on_exit(IrdaApp* app) final;
|
|
|
|
};
|
|
|
|
|
|
|
|
class IrdaAppSceneLearnDoneAfter : public IrdaAppScene {
|
|
|
|
public:
|
|
|
|
void on_enter(IrdaApp* app) final;
|
|
|
|
bool on_event(IrdaApp* app, IrdaAppEvent* event) final;
|
|
|
|
void on_exit(IrdaApp* app) final;
|
|
|
|
};
|
|
|
|
|
|
|
|
class IrdaAppSceneRemote : public IrdaAppScene {
|
|
|
|
public:
|
|
|
|
void on_enter(IrdaApp* app) final;
|
|
|
|
bool on_event(IrdaApp* app, IrdaAppEvent* event) final;
|
|
|
|
void on_exit(IrdaApp* app) final;
|
|
|
|
private:
|
|
|
|
std::vector<std::string> buttons_names;
|
2021-06-09 13:04:49 +00:00
|
|
|
uint32_t buttonmenu_item_selected = 0;
|
2021-06-02 15:16:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class IrdaAppSceneRemoteList : public IrdaAppScene {
|
|
|
|
public:
|
|
|
|
void on_enter(IrdaApp* app) final;
|
|
|
|
bool on_event(IrdaApp* app, IrdaAppEvent* event) final;
|
|
|
|
void on_exit(IrdaApp* app) final;
|
2021-06-09 13:04:49 +00:00
|
|
|
private:
|
|
|
|
uint32_t submenu_item_selected = 0;
|
2021-06-02 15:16:05 +00:00
|
|
|
std::vector<std::string> remote_names;
|
|
|
|
};
|
|
|
|
|
|
|
|
class IrdaAppSceneEdit : public IrdaAppScene {
|
|
|
|
public:
|
|
|
|
void on_enter(IrdaApp* app) final;
|
|
|
|
bool on_event(IrdaApp* app, IrdaAppEvent* event) final;
|
|
|
|
void on_exit(IrdaApp* app) final;
|
2021-06-09 13:04:49 +00:00
|
|
|
private:
|
|
|
|
uint32_t submenu_item_selected = 0;
|
2021-06-02 15:16:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class IrdaAppSceneEditKeySelect : public IrdaAppScene {
|
|
|
|
public:
|
|
|
|
void on_enter(IrdaApp* app) final;
|
|
|
|
bool on_event(IrdaApp* app, IrdaAppEvent* event) final;
|
|
|
|
void on_exit(IrdaApp* app) final;
|
|
|
|
private:
|
|
|
|
std::vector<std::string> buttons_names;
|
|
|
|
};
|
|
|
|
|
|
|
|
class IrdaAppSceneEditRename : public IrdaAppScene {
|
|
|
|
public:
|
|
|
|
void on_enter(IrdaApp* app) final;
|
|
|
|
bool on_event(IrdaApp* app, IrdaAppEvent* event) final;
|
|
|
|
void on_exit(IrdaApp* app) final;
|
|
|
|
};
|
|
|
|
|
|
|
|
class IrdaAppSceneEditDelete : public IrdaAppScene {
|
|
|
|
public:
|
|
|
|
void on_enter(IrdaApp* app) final;
|
|
|
|
bool on_event(IrdaApp* app, IrdaAppEvent* event) final;
|
|
|
|
void on_exit(IrdaApp* app) final;
|
|
|
|
};
|
|
|
|
|
|
|
|
class IrdaAppSceneEditRenameDone : public IrdaAppScene {
|
|
|
|
public:
|
|
|
|
void on_enter(IrdaApp* app) final;
|
|
|
|
bool on_event(IrdaApp* app, IrdaAppEvent* event) final;
|
|
|
|
void on_exit(IrdaApp* app) final;
|
|
|
|
};
|
|
|
|
|
|
|
|
class IrdaAppSceneEditDeleteDone : public IrdaAppScene {
|
|
|
|
public:
|
|
|
|
void on_enter(IrdaApp* app) final;
|
|
|
|
bool on_event(IrdaApp* app, IrdaAppEvent* event) final;
|
|
|
|
void on_exit(IrdaApp* app) final;
|
|
|
|
};
|
|
|
|
|
2021-06-25 13:52:27 +00:00
|
|
|
class IrdaAppSceneUniversalCommon : public IrdaAppScene {
|
|
|
|
bool brute_force_started = false;
|
|
|
|
protected:
|
|
|
|
bool on_event(IrdaApp* app, IrdaAppEvent* event) final;
|
|
|
|
void on_exit(IrdaApp* app) final;
|
|
|
|
IrdaAppBruteForce brute_force;
|
|
|
|
void remove_popup(IrdaApp* app);
|
|
|
|
void show_popup(IrdaApp* app, int record_amount);
|
|
|
|
void progress_popup(IrdaApp* app);
|
|
|
|
static void irda_app_item_callback(void* context, uint32_t index);
|
|
|
|
IrdaAppSceneUniversalCommon(const char* filename) : brute_force(filename) {}
|
|
|
|
~IrdaAppSceneUniversalCommon() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
class IrdaAppSceneUniversalTV : public IrdaAppSceneUniversalCommon {
|
|
|
|
public:
|
|
|
|
void on_enter(IrdaApp* app) final;
|
|
|
|
IrdaAppSceneUniversalTV() : IrdaAppSceneUniversalCommon("/irda/universal/tv.ir") {}
|
|
|
|
~IrdaAppSceneUniversalTV() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
class IrdaAppSceneUniversalAudio : public IrdaAppSceneUniversalCommon {
|
|
|
|
public:
|
|
|
|
void on_enter(IrdaApp* app) final;
|
|
|
|
IrdaAppSceneUniversalAudio() : IrdaAppSceneUniversalCommon("/irda/universal/audio.ir") {}
|
|
|
|
~IrdaAppSceneUniversalAudio() {}
|
|
|
|
};
|
|
|
|
|