Integrate BLE keyboard host functionality for page-turner remotes. Adds device pairing, button mapping, preset configurations for Free2/Free3 remotes, and persistent storage of mappings. Migrates from open-x4-sdk to freeink-sdk submodule which includes the BleKeyboardHost library. Implements CPU frequency locking during BLE operations to prevent watchdog timeouts.
63 lines
1.7 KiB
C++
63 lines
1.7 KiB
C++
#pragma once
|
|
#include <Epub.h>
|
|
#include <I18n.h>
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "activities/Activity.h"
|
|
#include "util/ButtonNavigator.h"
|
|
|
|
class EpubReaderMenuActivity final : public Activity {
|
|
public:
|
|
// Menu actions available from the reader menu.
|
|
enum class MenuAction {
|
|
SELECT_CHAPTER,
|
|
FOOTNOTES,
|
|
GO_TO_PERCENT,
|
|
AUTO_PAGE_TURN,
|
|
ROTATE_SCREEN,
|
|
BOOKMARKS,
|
|
TOGGLE_BOOKMARK,
|
|
SCREENSHOT,
|
|
DISPLAY_QR,
|
|
GO_HOME,
|
|
SYNC,
|
|
DELETE_CACHE,
|
|
TOGGLE_BLUETOOTH
|
|
};
|
|
|
|
explicit EpubReaderMenuActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, const std::string& title,
|
|
const int currentPage, const int totalPages, const int bookProgressPercent,
|
|
const uint8_t currentOrientation, const bool hasFootnotes, bool hasBookmarks);
|
|
|
|
void onEnter() override;
|
|
void onExit() override;
|
|
void loop() override;
|
|
void render(RenderLock&&) override;
|
|
|
|
private:
|
|
struct MenuItem {
|
|
MenuAction action;
|
|
StrId labelId;
|
|
};
|
|
|
|
static std::vector<MenuItem> buildMenuItems(bool hasFootnotes, bool hasBookmarks);
|
|
|
|
// Fixed menu layout
|
|
const std::vector<MenuItem> menuItems;
|
|
|
|
int selectedIndex = 0;
|
|
|
|
ButtonNavigator buttonNavigator;
|
|
std::string title = "Reader Menu";
|
|
uint8_t pendingOrientation = 0;
|
|
uint8_t selectedPageTurnOption = 0;
|
|
const std::vector<StrId> orientationLabels = {StrId::STR_PORTRAIT, StrId::STR_LANDSCAPE_CW, StrId::STR_INVERTED,
|
|
StrId::STR_LANDSCAPE_CCW};
|
|
const std::vector<const char*> pageTurnLabels = {I18N.get(StrId::STR_STATE_OFF), "1", "3", "6", "12"};
|
|
int currentPage = 0;
|
|
int totalPages = 0;
|
|
int bookProgressPercent = 0;
|
|
};
|