35 lines
667 B
C
35 lines
667 B
C
|
#pragma once
|
||
|
|
||
|
#include <Arduino.h>
|
||
|
#include <SD.h>
|
||
|
#include "config.h"
|
||
|
|
||
|
class DataSource {
|
||
|
private:
|
||
|
public:
|
||
|
DataSource() {};
|
||
|
~DataSource() {};
|
||
|
virtual size_t read(uint8_t* buf, size_t len) = 0;
|
||
|
virtual uint8_t read() = 0;
|
||
|
virtual size_t position() = 0;
|
||
|
virtual void seek(size_t position) = 0;
|
||
|
virtual size_t size() = 0;
|
||
|
virtual void close() = 0;
|
||
|
virtual void skip_id3_tag();
|
||
|
};
|
||
|
|
||
|
class SDDataSource : public DataSource {
|
||
|
private:
|
||
|
File _file;
|
||
|
public:
|
||
|
SDDataSource(String file);
|
||
|
~SDDataSource();
|
||
|
size_t read(uint8_t* buf, size_t len);
|
||
|
uint8_t read();
|
||
|
size_t position();
|
||
|
void seek(size_t position);
|
||
|
size_t size();
|
||
|
void close();
|
||
|
void skip_id3_tag();
|
||
|
};
|