Repository navigation
Expand file tree
/
Copy pathFritzboxModule.hpp
More file actions
61 lines (48 loc) · 1.9 KB
/
Copy pathFritzboxModule.hpp
File metadata and controls
61 lines (48 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef FRITZBOXMODULE_HPP
#define FRITZBOXMODULE_HPP
#include <U8g2_for_Adafruit_GFX.h>
#include <WiFiClient.h>
#include "PsramUtils.hpp"
#include "DrawableModule.hpp"
// Vorwärtsdeklaration
class WebClientModule;
#define FRITZ_PORT 1012
#define FRITZBOX_MAX_DURATION_MS 900000 // 15 Minuten
#define FRITZBOX_CALL_UID 1 // Feste UID für Anruf-Interrupts
class FritzboxModule : public DrawableModule {
public:
FritzboxModule(U8G2_FOR_ADAFRUIT_GFX &u8g2, GFXcanvas16 &canvas, WebClientModule* webClient);
~FritzboxModule();
void begin(BaseType_t core);
void setConfig(bool isEnabled, const PsramString& ip);
void closeConnection(); // Close Callmonitor connection before restart
// --- Implementierung der Interface-Methoden ---
void draw() override;
const char* getModuleName() const override { return "FritzboxModule"; }
const char* getModuleDisplayName() const override { return "Fritzbox"; }
void shutdown() override; // Clean shutdown before restart
// Modul-Eigenschaften
unsigned long getDisplayDuration() override { return 10000; } // Fallback, wird nicht genutzt
bool isEnabled() override;
void resetPaging() override {} // Keine Seiten
bool canBeInPlaylist() const override { return false; } // Nur Interrupts
private:
U8G2_FOR_ADAFRUIT_GFX &u8g2;
GFXcanvas16 &canvas;
WebClientModule* webClient;
SemaphoreHandle_t dataMutex;
volatile bool enabled;
volatile bool callActive;
unsigned long lastConnectionAttempt;
PsramString fritzIp;
PsramString callerNumber;
PsramString callerName;
PsramString callerLocation;
WiFiClient client;
static void taskRunner(void *pvParameters);
void taskLoop();
void parseCallMonitorLine(const PsramString& line);
void queryCallerInfo(const PsramString& number);
void parseCallerInfo(const char* buffer, size_t size);
};
#endif // FRITZBOXMODULE_HPP