#ifndef __OCPP16_CHARGING_PROFILES_H__
#define __OCPP16_CHARGING_PROFILES_H__
#include "msystem.h"
#include "ocpp16.h"
#include "ocpp16_configkey.h"

/*********************************************************************************************************************************************
1, 途充CCU有选择的实现了OCPP的充电计划（即限制功率和限制电流），能够处理的情况如下：
    SetChargingProfileReq_t.csChargingProfiles.chargingProfileKind == "Relative"
    SetChargingProfileReq_t.csChargingProfiles.chargingProfileKind == "Absolute" && SetChargingProfileReq_t.csChargingProfiles.chargingSchedule.chargingSchedulePeriod[i].startTime != NULL

2, 针对全桩所有充电枪的充电计划，
    SetChargingProfileReq_t.connectorId == 0 && SetChargingProfileReq_t.csChargingProfiles.chargingProfilePurpose == "ChargePointMaxProfile" 

3，针对充电桩的某个充电枪的充电计划，
    （SetChargingProfileReq_t.connectorId == 1 || SetChargingProfileReq_t.connectorId ==2）
    && SetChargingProfileReq_t.csChargingProfiles.chargingProfilePurpose == "TxDefaultProfile" 

3，针对当前充电交易， chargingProfilePurpose必须是"TxProfile"， transactionId必填
    SetChargingProfileReq_t.csChargingProfiles.chargingProfilePurpose = "TxProfile" && SetChargingProfileReq_t.csChargingProfiles.transactionId != 0


*********************************************************************************************************************************************/

typedef struct ChargingProfileList
{
    int count;
    ChargingProfile_t *items;
    int maxLength;
}ChargingProfileList_t;
/****************************************************************************************************/

extern ChargingProfileList_t chargingProfiles;

int ocpp16_set_ChargingProfiles(ChargingProfile_t* new, int connectorId);
int ocpp16_check_ChargingProfiles(void);

void ocpp16_ChargingProfiles_save(ChargingProfileList_t* list, const char* filename);
void ocpp16_ChargingProfiles_load(ChargingProfileList_t* list, const char* filename);

void ocpp16_ChargingProfiles_init(void);
void ocpp16_ChargingProfiles_exit(void);

#endif//__OCPP16_CHARGING_PROFILES_H__