/*
 * Emunation Plugin for MD-API 
 *
 * This code is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This code is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
 */
 
#ifndef __LOGGER_H
#define __LOGGER_H

#define ECMTXTFILENAME "Emunation_ECM_Log.txt"
#define EMMTXTFILENAME "Emunation_EMM_Log.txt"
#define ECMBINFILENAME "Emunation_ECM_Log.bin"
#define EMMBINFILENAME "Emunation_EMM_Log.bin"
#define DCWFILENAME "Emunation_DCW_Log.txt"
class cLogger
{
public:
    static const int ECM_Text;
    static const int ECM_Bin;
    static const int EMM_Text;
    static const int EMM_Bin;
    static const int DCW;

    cLogger();
    void LogData(unsigned char* data,int len,int type);    
    bool SetActive(bool flag,int type);
    bool GetActive(int type);
    bool ToggleActive(int type);
    void OnChannelChange(char* chname,int ecmpid,int emmpid);
    void OnChannelChange(int ecmpid,int emmpid);
private:
    //--------------------------------------------
    //Private member methods
    //--------------------------------------------
    char* GetFileName (char* filename,int type);
    bool IsBinary(int type);
    bool IsTypeChChanged(int type);
    void ResetChChanged();
    bool SetChChanged(int type);
    void WriteStartMessage();
    char* GetTimeStr(char* str);
    //--------------------------------------------
    //Private member control variables
    //--------------------------------------------
    bool m_IsBinECMActive;
    bool m_IsTextECMActive;
    bool m_IsBinEMMActive;
    bool m_IsTextEMMActive;
    bool m_IsCWActive;
    //--------------------------------------------
    //Private member data variables
    //--------------------------------------------
    char m_ch_name[25];
    int m_ECMPid;
    int m_EMMPid;
    bool m_chchanged_cw;
    bool m_chchanged_ecm;
    bool m_chchanged_emm;
};
#endif
