/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/* 
 * File:   iec61850_controller.h
 * Author: Jan Hudec
 *
 * Created on 28. dubna 2019, 16:44
 */

#ifndef IEC61850_CONTROLLER_H
#define IEC61850_CONTROLLER_H

#include <string>
#include <vector>
#include <map>

#include <sv_publisher.h>
#include <goose_publisher.h>

class iec61850_controller {
private:
    char* _interface;
    
    // sv
    SVPublisher _sv_pub;
    Timestamp _ts;
    std::map<std::string, SVPublisher_ASDU> _asdu_units;
    std::map<std::string, std::vector<int>> _asdu_units_offsets;
    
    // goose
    GoosePublisher _gp_pub;
    LinkedList _ll;
    CommParameters _sv_cp;
public:    
    iec61850_controller();
    ~iec61850_controller();
    
    void sv_publisher_create(CommParameters cp, std::string interface);
    void sv_asdu_create(std::string name);
    void sv_asdu_add_float(std::string name);
    void sv_asdu_add_quality(std::string name);
    void sv_asdu_add_timestamp(std::string name);
    void sv_setup_complete();
    void sv_asdu_set_float(std::string name, int offset_index, float value);
    void sv_asdu_set_quality(std::string name, int offset_index, Quality quality);
    void sv_asdu_set_timestamp(std::string name, int offset_index, time_t ts);
    void sv_publish();
    
    
};

#endif /* IEC61850_CONTROLLER_H */

