summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--controller.cpp26
-rw-r--r--controller.h30
-rw-r--r--schack.ino3
3 files changed, 59 insertions, 0 deletions
diff --git a/controller.cpp b/controller.cpp
new file mode 100644
index 0000000..6a4b900
--- /dev/null
+++ b/controller.cpp
@@ -0,0 +1,26 @@
1#include "Arduino.h"
2#include "controller.h"
3
4
5Controller::Controller(MP3Controller *mp3Controller) {
6 this->mp3Controller = mp3Controller;
7}
8
9void Controller::next() {
10 mp3Controller->nextFile();
11}
12
13void Controller::nextS() {
14 mp3Controller->nextSection();
15}
16
17void Controller::previousS() {
18 mp3Controller->previousSection();
19}
20
21void Controller::previous() {
22 mp3Controller->previousFile();
23}
24
25void Controller::setRoot(String newRoot) { root = newRoot; }
26String Controller::getRoot() { return root; }
diff --git a/controller.h b/controller.h
new file mode 100644
index 0000000..de8d86b
--- /dev/null
+++ b/controller.h
@@ -0,0 +1,30 @@
1#ifndef CONTROLLER_H
2#define CONTROLLER_H
3
4class MP3Controller {
5public:
6 virtual void nextFile() = 0;
7 virtual void previousFile() = 0;
8 virtual void nextSection() = 0;
9 virtual void previousSection() = 0;
10};
11
12class Controller {
13 String root = "/";
14 MP3Controller *mp3Controller;
15public:
16 Controller(MP3Controller*);
17
18 void next();
19 void nextS();
20 void previous();
21 void previousS();
22
23 void setRoot(String);
24 String getRoot();
25
26 String getAPSSID() { return "ESP8266"; }
27 String getAPPassword() { return "test1234"; }
28};
29
30#endif
diff --git a/schack.ino b/schack.ino
index 6efcf5c..2cc3da2 100644
--- a/schack.ino
+++ b/schack.ino
@@ -1,12 +1,15 @@
1#include "controller.h"
1#include "mp3player.h" 2#include "mp3player.h"
2 3
3MP3Player *mp3Player; 4MP3Player *mp3Player;
5Controller *controller;
4 6
5void setup() { 7void setup() {
6 Serial.begin(9600); 8 Serial.begin(9600);
7 SD.begin(SS); 9 SD.begin(SS);
8 10
9 mp3Player = new MP3Player(); 11 mp3Player = new MP3Player();
12 controller = new Controller(mp3Player);
10} 13}
11 14
12 15