/*
 * megatec.h
 *
 *  Created on: 22.05.2017
 *      Author: balbekova
 */

#ifndef MEGATEC_H_
#define MEGATEC_H_

#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>

typedef enum{
	ups_status_req,
	ups_test_10sec,
	ups_test_low_bat,
	ups_test_time,
	ups_beep,
	ups_shutdown,
	ups_shutdown_restore,
	ups_cancel_shut_down,
	ups_cancel_test,
	ups_info,
	ups_rating_info,
	ups_remain_time_reg,

	MegaTec_cmd_max
} cmdMegaTecEnums_t;

typedef struct{
	float Freq_in;
	float VAC_in;
	float VAC_out;
	float Temp;
	uint8_t Load;
	uint8_t SOC;
	uint8_t work_time;
	uint8_t Status;
	uint8_t Alarm;
	char model[11];
	char vertion[11];
	uint8_t cnt_err_ups;
	bool Present;
	bool Flag_Present;
}UPS_value_t;

extern UPS_value_t UPS;

extern uint16_t TimeParam;
extern uint16_t TimeParam2;

int ups_metac_service_pdu(cmdMegaTecEnums_t command);

void ups_megatec_init(void);


#endif /* MEGATEC_H_ */
