mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-01-25 20:06:08 +00:00
Price config
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
#ifndef _PRICESERVICE_H
|
||||
#define _PRICESERVICE_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "TimeLib.h"
|
||||
#include "Timezone.h"
|
||||
#include "RemoteDebug.h"
|
||||
@@ -23,6 +25,37 @@
|
||||
|
||||
#define SSL_BUF_SIZE 512
|
||||
|
||||
#define PRICE_DIRECTION_IMPORT 0x01
|
||||
#define PRICE_DIRECTION_EXPORT 0x02
|
||||
#define PRICE_DIRECTION_BOTH 0x03
|
||||
|
||||
#define PRICE_DAY_MO 0x01
|
||||
#define PRICE_DAY_TU 0x02
|
||||
#define PRICE_DAY_WE 0x04
|
||||
#define PRICE_DAY_TH 0x08
|
||||
#define PRICE_DAY_FR 0x10
|
||||
#define PRICE_DAY_SA 0x12
|
||||
#define PRICE_DAY_SU 0x14
|
||||
|
||||
#define PRICE_TYPE_FIXED 0x00
|
||||
#define PRICE_TYPE_ADD 0x01
|
||||
#define PRICE_TYPE_PCT 0x02
|
||||
|
||||
struct PriceConfig {
|
||||
char name[32];
|
||||
uint8_t direction;
|
||||
uint8_t days;
|
||||
uint32_t hours;
|
||||
uint8_t type;
|
||||
uint16_t value;
|
||||
};
|
||||
|
||||
struct PricePart {
|
||||
char name[32];
|
||||
char description[32];
|
||||
uint16_t value;
|
||||
};
|
||||
|
||||
class PriceService {
|
||||
public:
|
||||
PriceService(RemoteDebug*);
|
||||
@@ -33,11 +66,21 @@ public:
|
||||
char* getCurrency();
|
||||
char* getArea();
|
||||
char* getSource();
|
||||
float getValueForHour(int8_t);
|
||||
float getValueForHour(time_t, int8_t);
|
||||
float getValueForHour(uint8_t direction, int8_t hour);
|
||||
float getValueForHour(uint8_t direction, time_t ts, int8_t hour);
|
||||
|
||||
float getEnergyPriceForHour(uint8_t direction, time_t ts, int8_t hour);
|
||||
|
||||
std::vector<PriceConfig>& getPriceConfig();
|
||||
void setPriceConfig(uint8_t index, PriceConfig &priceConfig);
|
||||
|
||||
PricePart getPricePart(uint8_t index);
|
||||
|
||||
int16_t getLastError();
|
||||
|
||||
bool load();
|
||||
bool save();
|
||||
|
||||
private:
|
||||
RemoteDebug* debugger;
|
||||
PriceServiceConfig* config = NULL;
|
||||
@@ -52,6 +95,8 @@ private:
|
||||
PricesContainer* today = NULL;
|
||||
PricesContainer* tomorrow = NULL;
|
||||
|
||||
std::vector<PriceConfig> priceConfig;
|
||||
|
||||
Timezone* tz = NULL;
|
||||
|
||||
static const uint16_t BufferSize = 256;
|
||||
|
||||
Reference in New Issue
Block a user