package com.ntels.onecable.common;

import com.google.android.gms.analytics.GoogleAnalytics;
import com.google.android.gms.analytics.Tracker;

import com.ntels.onecable.R;
import com.ntels.onecable.common.util.LogUtil;
import com.ntels.onecable.common.util.Util;
import com.tsengvn.typekit.Typekit;

import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.os.Bundle;
import android.support.multidex.MultiDex;
import android.support.multidex.MultiDexApplication;
import android.util.Base64;
import android.util.Log;
import android.webkit.CookieSyncManager;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Locale;

/**
 * <pre>
 * -----------------------------------------------------------------------------
 * 설명 :  Application 클래스
 * 작성자 : 최진오
 * 작성일자 : 2014-04-06
 * 수정일자 : 2014-04-06 최진오 최초생성
 * ------------------------------------------------------------------------------
 * </pre>
 */
public class AppConfig extends MultiDexApplication {

    private static final String TAG = AppConfig.class.getSimpleName();
    public static boolean DEBUG = false;
    private static volatile AppConfig instance = null;
    public ArrayList<HashMap<String, Object>> authHomegrpListHM = new ArrayList<HashMap<String, Object>>();
    public ArrayList<HashMap<String, Object>> authInvitationList = new ArrayList<HashMap<String, Object>>();
    public Boolean bLogin = false;
    public Boolean isLogout = false;
    public Boolean bExit = false;
    public Boolean bManualNotView = false;
    public Boolean bPush = false;
    public Boolean bAutoLogin = false;
    public Boolean bGoErr = false;
    public Boolean bIntro = false;
    public Boolean bMain = false;
    public Boolean bWebSocketAuth = false;
    public Boolean bWebSocketConn = false;
    public String sVer = "";
    public String sUuid = "";
    public String sLogin_Id = "";
    public String sLogin_TermId = "";
    public String sPush_Token = "";
    /**
     * 나의 사진 이미지 URL
     */
    public String sMy_Image_Url = "";
    /**
     * 닉네임
     */
    public String sNickname = "";
    /**
     * 시간대 ID
     */
    public String sTimezone_Id = "";
    /**
     * 로그인 비밀번호
     */
    public String sLogin_Pass = "";
    public float fScale = 0f;
    public int iDisplayHeight = 0;
    public int iDisplayWidth = 0;
    /**
     * 인증토큰
     */
    public String sAuth_Token = "";
    /**
     * url
     */
    public String sUrl = "";
    public String sSmartUrl = "";
    public String sServicehubWebsocketUrl = "";
    public String sServicehubRestUrl = "";
    public String sCloudGatewayUrl = "";
    /**
     * VSaaS
     */
    public String sSipUrl = "";
    public String sTurnUrl = "";
    public int iTurnPort = 0;
    public String sVsaasDomain = "";
    public String sSipPassword = "";
    /**
     * 서비스 아이디
     */
    public String sService_Id = "";
    public String sProject_Id = "";
    public String sAppstart_Id = "";
    /**
     * 언어 ID
     */
    public String sLanguage_Id = "";
    /**
     * 국가 ID
     */
    public String sCountry_Id = "";
    /**
     * 로그인 멤버 아이디
     */
    public String sLogin_Member_Id = "";
    public String sTemp_Password_Yn = "";
    public String sPush_Type_Mode_Chg_Yn = "";
    public String sPush_Type_Prsnc_Chg_Yn = "";
    /**
     * 초대 여부
     */
    public String sInvitations_Count = "";
    /**
     * (소속된) 홈그룹 명
     */
    public String sSelect_Homegrp_Name = "";
    /**
     * (소속된 홈그룹내) 등급 코드 (MAS: 마스터, SIM:심플유저)
     */
    public String sSelect_Homegrp_Grade_Code = "";
    /**
     * (소속된 홈그룹내) 홈허브 디바이스 ID
     */
    public String sSelect_Homegrp_Homehub_Device_Id = "";
    /**
     * (소속된 홈그룹내) 홈허브 접속 상태 (ON / OFF)
     */
    public String sSelect_Homegrp_Homehub_Online_State = "";
    /**
     * (소속된 홈그룹내) 홈허브 인터넷(MQTT) 접속 상태 (connect / disconnect)
     */
    public String sSelect_Homegrp_Homehub_Conn_State = "";
    /**
     * (소속된 홈그룹내) 홈허브 동글 접속 상태 (ON / OFF)
     */
    public String sSelect_Homegrp_Homehub_Dongle_State = "";
    /**
     * (소속된 홈그룹내) 홈허브 동글 마지막 접속 시간 (포맷 : 년월일시분초)
     */
    public String sSelect_Homegrp_Homehub_Dongle_Online_Last_Datetime = "";
    /**
     * (소속된 홈그룹내) 홈허브 MQTT 마지막 접속 시간 (포맷 : 년월일시분초)
     */
    public String sSelect_Homegrp_Homehub_Mqtt_Online_Last_Datetime = "";
    /**
     * 홈 그룹 디바이스 체크
     */
    public String sSelect_Homegrp_Device_Yn = "";
    /**
     * 홈 그룹 명
     */
    public String sSelect_Homegrp_Icon = "";
    /**
     * 홈 그룹 주소
     */
    public String sSelect_Location_Addr = "";
    /**
     * 홈 그룹 좌표(포맷 : 위도,경도)
     */
    public String sSelect_Location_Coordinate = "";
    /**
     * 홈 그룹 좌표 반경 (ex : 100, 200, 300)
     */
    public String sSelect_Location_Radius = "";
    /**
     * 서비스허브 어플리케이션 ID
     */
    public String sSelect_Servicehub_App_Id = "";
    /**
     * 서비스허브 리퀘스트 ID
     */
    public int iSelect_Servicehub_Request_Id = 0;
    /**
     * (소속된 홈그룹내) 홈허브 디바이스 Key
     */
    public String sSelect_Homegrp_Homehub_Device_Key = "";
    HashMap<TrackerName, Tracker> mTrackers = new HashMap<TrackerName, Tracker>();
    private Util util = new Util();
    private Boolean mSaveId = false;
    /**
     * (소속된 홈그룹내) 홈허브 디바이스 여부
     */
    private Boolean mIsHomegrpHomehub = false;
    /**
     * 고객 ID
     */
    private String mCustId = "";
    /**
     * 계약 그룹 ID
     */
    private String mCtrtGroupId = "";

    public static AppConfig getGlobalApplicationContext() {

        if (instance == null)
            throw new IllegalStateException("this application does not inherit com.kakao.GlobalApplication");
        return instance;
    }

    public static AppConfig getInstance() {

        return instance;
    }

    public static String getLanguageType() {
        Locale locale = getGlobalApplicationContext().getResources().getConfiguration().locale;
        Log.i("getLanguageType()", locale.getLanguage());
        return locale.getLanguage();
    }

    @Override
    protected void attachBaseContext(Context base) {

        super.attachBaseContext(base);
        MultiDex.install(this);
    }

    public synchronized Tracker getTracker(TrackerName trackerId) {

        if (!mTrackers.containsKey(trackerId)) {
            GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
            Tracker t = (trackerId == TrackerName.APP_TRACKER)
                    ? analytics.newTracker(getString(R.string.google_analytics_property_id))
                    : (trackerId == TrackerName.GLOBAL_TRACKER) ? analytics.newTracker(getString(R.string.google_analytics_property_id))
                    : analytics.newTracker(getString(
                    R.string.google_analytics_property_id));
            mTrackers.put(trackerId, t);
        }
        return mTrackers.get(trackerId);
    }

    /**
     * <PRE> 1. MethodName: onCreate 2. ClassName : 3. Comment   : onCreate 4. Developer : 최진오 5.
     * Created   : 2015. 10. </PRE>
     */
    @Override
    public void onCreate() {

        super.onCreate();
        this.DEBUG = isDebuggable(this);
        instance = this;
        Typekit.getInstance().addNormal(Typekit.createFromAsset(this, "fonts/NotoSans-Light.otf"))
                .addBold(Typekit.createFromAsset(this, "fonts/NotoSans-Regular.otf"));

        patchEOFException();
        CookieSyncManager.createInstance(this);

    }

    public boolean isDebuggable(Context context) {

        boolean debuggable = false;

        PackageManager pm = context.getPackageManager();
        try {
            ApplicationInfo appinfo = pm.getApplicationInfo(context.getPackageName(), 0);
            debuggable = (0 != (appinfo.flags & ApplicationInfo.FLAG_DEBUGGABLE));
        } catch (PackageManager.NameNotFoundException e) {
            /* debuggable variable will remain false */
        }

        return debuggable;
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {

        super.onConfigurationChanged(newConfig);
    }

    @Override
    public void onLowMemory() {

        super.onLowMemory();
    }

    @Override
    public void onTerminate() {

        super.onTerminate();
        instance = null;
    }

    private void patchEOFException() {

        System.setProperty("http.keepAlive", "false");
    }

    public void Labinit() {

        authHomegrpListHM = new ArrayList<HashMap<String, Object>>();
        authInvitationList = new ArrayList<HashMap<String, Object>>();
        bLogin = false;
        isLogout = false;
        bExit = false;
        bManualNotView = false;
        bAutoLogin = false;
        mSaveId = false;
        bGoErr = false;
        bIntro = false;
        bMain = false;
        bWebSocketAuth = false;
        bWebSocketConn = false;
        sVer = "";
        sUuid = "";
        sLogin_Id = "";
        sLogin_TermId = "";
        sMy_Image_Url = "";
        sNickname = "";
        sTimezone_Id = "";
        sLogin_Pass = "";
        fScale = 0f;
        iDisplayHeight = 0;
        iDisplayWidth = 0;
        sPush_Token = "";
        sAuth_Token = "";
        sUrl = "";
        sSmartUrl = "";
        sServicehubWebsocketUrl = "";
        sServicehubRestUrl = "";
        sCloudGatewayUrl = "";
        sSipUrl = "";
        sTurnUrl = "";
        iTurnPort = 0;
        sVsaasDomain = "";
        sSipPassword = "";
        sService_Id = "";
        sProject_Id = "";
        sAppstart_Id = "";
        sLanguage_Id = "";
        sCountry_Id = "";
        sLogin_Member_Id = "";
        sSelect_Homegrp_Device_Yn = "";
        sSelect_Homegrp_Name = "";
        sSelect_Homegrp_Icon = "";
        sSelect_Location_Addr = "";
        sSelect_Location_Coordinate = "";
        sSelect_Location_Radius = "";
        sSelect_Homegrp_Grade_Code = "";
        sTemp_Password_Yn = "";
        sPush_Type_Mode_Chg_Yn = "";
        sPush_Type_Prsnc_Chg_Yn = "";
        sInvitations_Count = "";
        sSelect_Homegrp_Homehub_Device_Id = "";
        sSelect_Homegrp_Homehub_Online_State = "";
        sSelect_Homegrp_Homehub_Conn_State = "";
        sSelect_Homegrp_Homehub_Dongle_State = "";
        sSelect_Homegrp_Homehub_Dongle_Online_Last_Datetime = "";
        sSelect_Homegrp_Homehub_Mqtt_Online_Last_Datetime = "";
        sSelect_Servicehub_App_Id = "";
        iSelect_Servicehub_Request_Id = 0;
        sSelect_Homegrp_Homehub_Device_Key = "";
        mIsHomegrpHomehub = false;
        mCustId = "";
        mCtrtGroupId = "";
    }

    public Bundle saveAppication(Bundle outState) {

        outState.putSerializable("authHomegrpListHM", authHomegrpListHM);
        outState.putSerializable("authInvitationList", authInvitationList);
        outState.putBoolean("bLogin", bLogin);
        outState.putBoolean("isLogout", isLogout);
        outState.putBoolean("bExit", bExit);
        outState.putBoolean("bManualNotView", bManualNotView);
        outState.putBoolean("bPush", bPush);
        outState.putBoolean("bAutoLogin", bAutoLogin);
        outState.putBoolean("mSaveId", mSaveId);
        outState.putBoolean("bGoErr", bGoErr);
        outState.putBoolean("bIntro", bIntro);
        outState.putBoolean("bMain", bMain);
        outState.putBoolean("bWebSocketAuth", bWebSocketAuth);
        outState.putBoolean("bWebSocketConn", bWebSocketConn);
        outState.putString("sVer", sVer);
        outState.putString("sUuid", sUuid);
        outState.putString("sLogin_Id", sLogin_Id);
        outState.putString("sLogin_TermId", sLogin_TermId);
        outState.putString("sMy_Image_Url", sMy_Image_Url);
        outState.putString("sNickname", sNickname);
        outState.putString("sTimezone_Id", sTimezone_Id);
        outState.putString("sLogin_Pass", sLogin_Pass);
        outState.putFloat("fScale", fScale);
        outState.putInt("iDisplayHeight", iDisplayHeight);
        outState.putInt("iDisplayWidth", iDisplayWidth);
        outState.putString("sPush_Token", sPush_Token);
        outState.putString("sAuth_Token", sAuth_Token);
        outState.putString("sUrl", sUrl);
        outState.putString("sSmartUrl", sSmartUrl);
        outState.putString("sServicehubWebsocketUrl", sServicehubWebsocketUrl);
        outState.putString("sServicehubRestUrl", sServicehubRestUrl);
        outState.putString("sCloudGatewayUrl", sCloudGatewayUrl);
        outState.putString("sSipUrl", sSipUrl);
        outState.putString("sTurnUrl", sTurnUrl);
        outState.putInt("iTurnPort", iTurnPort);
        outState.putString("sVsaasDomain", sVsaasDomain);
        outState.putString("sSipPassword", sSipPassword);
        outState.putString("sService_Id", sService_Id);
        outState.putString("sProject_Id", sProject_Id);
        outState.putString("sAppstart_Id", sAppstart_Id);
        outState.putString("sLanguage_Id", sLanguage_Id);
        outState.putString("sCountry_Id", sCountry_Id);
        outState.putString("sLogin_Member_Id", sLogin_Member_Id);
        outState.putString("sSelect_Homegrp_Device_Yn", sSelect_Homegrp_Device_Yn);
        outState.putString("sSelect_Homegrp_Name", sSelect_Homegrp_Name);
        outState.putString("sSelect_Homegrp_Icon", sSelect_Homegrp_Icon);
        outState.putString("sSelect_Location_Addr", sSelect_Location_Addr);
        outState.putString("sSelect_Location_Coordinate", sSelect_Location_Coordinate);
        outState.putString("sSelect_Location_Radius", sSelect_Location_Radius);
        outState.putString("sSelect_Homegrp_Grade_Code", sSelect_Homegrp_Grade_Code);
        outState.putString("sTemp_Password_Yn", sTemp_Password_Yn);
        outState.putString("sPush_Type_Mode_Chg_Yn", sPush_Type_Mode_Chg_Yn);
        outState.putString("sPush_Type_Prsnc_Chg_Yn", sPush_Type_Prsnc_Chg_Yn);
        outState.putString("sInvitations_Count", sInvitations_Count);
        outState.putString("sSelect_Homegrp_Homehub_Device_Id", sSelect_Homegrp_Homehub_Device_Id);
        outState.putString("sSelect_Homegrp_Homehub_Online_State", sSelect_Homegrp_Homehub_Online_State);
        outState.putString("sSelect_Homegrp_Homehub_Conn_State", sSelect_Homegrp_Homehub_Conn_State);
        outState.putString("sSelect_Homegrp_Homehub_Dongle_State", sSelect_Homegrp_Homehub_Dongle_State);
        outState.putString("sSelect_Homegrp_Homehub_Dongle_Online_Last_Datetime", sSelect_Homegrp_Homehub_Dongle_Online_Last_Datetime);
        outState.putString("sSelect_Homegrp_Homehub_Mqtt_Online_Last_Datetime", sSelect_Homegrp_Homehub_Mqtt_Online_Last_Datetime);
        outState.putString("sSelect_Servicehub_App_Id", sSelect_Servicehub_App_Id);
        outState.putInt("iSelect_Servicehub_Request_Id", iSelect_Servicehub_Request_Id);
        outState.putString("sSelect_Homegrp_Homehub_Device_Key", sSelect_Homegrp_Homehub_Device_Key);
        outState.putBoolean("mIsHomegrpHomehub", mIsHomegrpHomehub);
        outState.putString("mCustId", mCustId);
        outState.putString("mCtrtGroupId", mCtrtGroupId);

        return outState;
    }

    public void loadAppication(Bundle outState) {

        authHomegrpListHM = (ArrayList<HashMap<String, Object>>) outState.getSerializable("authHomegrpListHM");
        authInvitationList = (ArrayList<HashMap<String, Object>>) outState.getSerializable("authInvitationList");
        bAutoLogin = outState.getBoolean("bAutoLogin");
        bExit = outState.getBoolean("bExit");
        bGoErr = outState.getBoolean("bGoErr");
        bIntro = outState.getBoolean("bIntro");
        bMain = outState.getBoolean("bMain");
        bWebSocketAuth = outState.getBoolean("bWebSocketAuth");
        bWebSocketConn = outState.getBoolean("bWebSocketConn");
        bLogin = outState.getBoolean("bLogin");
        isLogout = outState.getBoolean("isLogout");
        bManualNotView = outState.getBoolean("bManualNotView");
        bPush = outState.getBoolean("bPush");
        mSaveId = outState.getBoolean("mSaveId");
        fScale = outState.getFloat("fScale");
        iDisplayHeight = outState.getInt("iDisplayHeight");
        iDisplayWidth = outState.getInt("iDisplayWidth");
        sAuth_Token = outState.getString("sAuth_Token");
        sCountry_Id = outState.getString("sCountry_Id");
        sLanguage_Id = outState.getString("sLanguage_Id");
        sLogin_Id = outState.getString("sLogin_Id");
        sLogin_Member_Id = outState.getString("sLogin_Member_Id");
        sLogin_Pass = outState.getString("sLogin_Pass");
        sLogin_TermId = outState.getString("sLogin_TermId");
        sMy_Image_Url = outState.getString("sMy_Image_Url");
        sNickname = outState.getString("sNickname");
        sPush_Token = outState.getString("sPush_Token");
        sSelect_Homegrp_Device_Yn = outState.getString("sSelect_Homegrp_Device_Yn");
        sSelect_Homegrp_Grade_Code = outState.getString("sSelect_Homegrp_Grade_Code");
        sSelect_Homegrp_Icon = outState.getString("sSelect_Homegrp_Icon");
        sSelect_Homegrp_Name = outState.getString("sSelect_Homegrp_Name");
        sSelect_Location_Addr = outState.getString("sSelect_Location_Addr");
        sSelect_Location_Coordinate = outState.getString("sSelect_Location_Coordinate");
        sSelect_Location_Radius = outState.getString("sSelect_Location_Radius");
        sService_Id = outState.getString("sService_Id");
        sProject_Id = outState.getString("sProject_Id");
        sAppstart_Id = outState.getString("sAppstart_Id");
        sTemp_Password_Yn = outState.getString("sTemp_Password_Yn");
        sTimezone_Id = outState.getString("sTimezone_Id");
        sUrl = outState.getString("sUrl");
        sSmartUrl = outState.getString("sSmartUrl");
        sServicehubWebsocketUrl = outState.getString("sServicehubWebsocketUrl");
        sServicehubRestUrl = outState.getString("sServicehubRestUrl");
        sCloudGatewayUrl = outState.getString("sCloudGatewayUrl");
        sSipUrl = outState.getString("sSipUrl");
        sTurnUrl = outState.getString("sTurnUrl");
        iTurnPort = outState.getInt("iTurnPort");
        sVsaasDomain = outState.getString("sVsaasDomain");
        sSipPassword = outState.getString("sSipPassword");
        sUuid = outState.getString("sUuid");
        sVer = outState.getString("sVer");
        sPush_Type_Mode_Chg_Yn = outState.getString("sPush_Type_Mode_Chg_Yn");
        sPush_Type_Prsnc_Chg_Yn = outState.getString("sPush_Type_Prsnc_Chg_Yn");
        sInvitations_Count = outState.getString("sInvitations_Count");
        sSelect_Homegrp_Homehub_Device_Id = outState.getString("sSelect_Homegrp_Homehub_Device_Id");
        sSelect_Homegrp_Homehub_Online_State = outState.getString("sSelect_Homegrp_Homehub_Online_State");
        sSelect_Homegrp_Homehub_Conn_State = outState.getString("sSelect_Homegrp_Homehub_Conn_State");
        sSelect_Homegrp_Homehub_Dongle_State = outState.getString("sSelect_Homegrp_Homehub_Dongle_State");
        sSelect_Homegrp_Homehub_Dongle_Online_Last_Datetime = outState.getString("sSelect_Homegrp_Homehub_Dongle_Online_Last_Datetime");
        sSelect_Homegrp_Homehub_Mqtt_Online_Last_Datetime = outState.getString("sSelect_Homegrp_Homehub_Mqtt_Online_Last_Datetime");
        sSelect_Servicehub_App_Id = outState.getString("sSelect_Servicehub_App_Id");
        iSelect_Servicehub_Request_Id = outState.getInt("iSelect_Servicehub_Request_Id");
        sSelect_Homegrp_Homehub_Device_Key = outState.getString("sSelect_Homegrp_Homehub_Device_Key");
        mIsHomegrpHomehub = outState.getBoolean("mIsHomegrpHomehub");
        mCustId = outState.getString("custId");
        mCtrtGroupId = outState.getString("ctrtGroupId");
    }

    public String getInvitations_Count() {

        return sInvitations_Count;
    }

    public void setInvitations_Count(String str) {

        sInvitations_Count = str;
    }

    public String getSelect_Homegrp_Homehub_Device_Id() {

        return sSelect_Homegrp_Homehub_Device_Id;
    }

    public void setSelect_Homegrp_Homehub_Device_Id(String str) {

        sSelect_Homegrp_Homehub_Device_Id = str;
    }

    public String getSelect_Homegrp_Homehub_Online_State() {

        String onlineState = "";
        if (sSelect_Homegrp_Homehub_Conn_State.equalsIgnoreCase("connect") &&
                sSelect_Homegrp_Homehub_Dongle_State.equalsIgnoreCase("ON")) {
            onlineState = "ON";
        } else {
            onlineState = "OFF";
        }
        return onlineState;
    }

    public void setSelect_Homegrp_Homehub_Online_State(String str) {
        LogUtil.i(TAG, "setSelect_Homegrp_Homehub_Online_State : " + str);
        sSelect_Homegrp_Homehub_Online_State = str;
    }

    public String getsSelect_Homegrp_Homehub_Conn_State() {
        return sSelect_Homegrp_Homehub_Conn_State;
    }

    public void setsSelect_Homegrp_Homehub_Conn_State(String sSelect_Homegrp_Homehub_Conn_State) {
        LogUtil.i(TAG, "setsSelect_Homegrp_Homehub_Conn_State : " + sSelect_Homegrp_Homehub_Conn_State);
        this.sSelect_Homegrp_Homehub_Conn_State = sSelect_Homegrp_Homehub_Conn_State;
    }

    public String getsSelect_Homegrp_Homehub_Dongle_State() {
        return sSelect_Homegrp_Homehub_Dongle_State;
    }

    public void setsSelect_Homegrp_Homehub_Dongle_State(String sSelect_Homegrp_Homehub_Dongle_State) {
        LogUtil.i(TAG, "setsSelect_Homegrp_Homehub_Dongle_State : " + sSelect_Homegrp_Homehub_Dongle_State);
        this.sSelect_Homegrp_Homehub_Dongle_State = sSelect_Homegrp_Homehub_Dongle_State;
    }

    public String getsSelect_Homegrp_Homehub_Dongle_Online_Last_Datetime() {
        return sSelect_Homegrp_Homehub_Dongle_Online_Last_Datetime;
    }

    public void setsSelect_Homegrp_Homehub_Dongle_Online_Last_Datetime(String sSelect_Homegrp_Homehub_Dongle_Online_Last_Datetime) {
        LogUtil.i(TAG, "setsSelect_Homegrp_Homehub_Dongle_Online_Last_Datetime : " + sSelect_Homegrp_Homehub_Dongle_Online_Last_Datetime);
        this.sSelect_Homegrp_Homehub_Dongle_Online_Last_Datetime = sSelect_Homegrp_Homehub_Dongle_Online_Last_Datetime;
    }

    public String getsSelect_Homegrp_Homehub_Mqtt_Online_Last_Datetime() {
        return sSelect_Homegrp_Homehub_Mqtt_Online_Last_Datetime;
    }

    public void setsSelect_Homegrp_Homehub_Mqtt_Online_Last_Datetime(String sSelect_Homegrp_Homehub_Mqtt_Online_Last_Datetime) {
        this.sSelect_Homegrp_Homehub_Mqtt_Online_Last_Datetime = sSelect_Homegrp_Homehub_Mqtt_Online_Last_Datetime;
    }

    public String getPush_Type_Mode_Chg_Yn() {

        return sPush_Type_Mode_Chg_Yn;
    }

    public void setPush_Type_Mode_Chg_Yn(String str) {

        sPush_Type_Mode_Chg_Yn = str;
    }

    public String getPush_Type_Prsnc_Chg_Yn() {

        return sPush_Type_Prsnc_Chg_Yn;
    }

    public void setPush_Type_Prsnc_Chg_Yn(String str) {

        sPush_Type_Prsnc_Chg_Yn = str;
    }

    public String getTemp_Password_Yn() {

        return sTemp_Password_Yn;
    }

    public void setTemp_Password_Yn(String str) {

        sTemp_Password_Yn = str;
    }

    public String getSelect_Homegrp_Grade_Code() {

        return sSelect_Homegrp_Grade_Code;
    }

    public void setSelect_Homegrp_Grade_Code(String str) {

        sSelect_Homegrp_Grade_Code = str;
    }

    public String getSelect_Homegrp_Device_Yn() {

        return sSelect_Homegrp_Device_Yn;
    }

    public void setSelect_Homegrp_Device_Yn(String str) {

        sSelect_Homegrp_Device_Yn = str;
    }

    public String getSelect_Homegrp_Name() {

        return sSelect_Homegrp_Name;
    }

    public void setSelect_Homegrp_Name(String str) {

        sSelect_Homegrp_Name = str;
    }

    public String getSelect_Homegrp_Icon() {

        return sSelect_Homegrp_Icon;
    }

    public void setSelect_Homegrp_Icon(String str) {

        sSelect_Homegrp_Icon = str;
    }

    public String getSelect_Location_Addr() {

        return sSelect_Location_Addr;
    }

    public void setSelect_Location_Addr(String str) {

        sSelect_Location_Addr = str;
    }

    public String getSelect_Location_Coordinate() {

        return sSelect_Location_Coordinate;
    }

    public void setSelect_Location_Coordinate(String str) {

        sSelect_Location_Coordinate = str;
    }

    public String getSelect_Location_Radius() {

        return sSelect_Location_Radius;
    }

    public void setSelect_Location_Radius(String str) {

        sSelect_Location_Radius = str;
    }

    public String getLogin_Member_Id() {

        return sLogin_Member_Id;
    }

    public void setLogin_Member_Id(String str) {

        sLogin_Member_Id = str;
    }

    public String getCountry_Id() {

        return sCountry_Id;
    }

    public void setCountry_Id(String str) {

        sCountry_Id = str;
    }

    public String getLanguage_Id() {

        return sLanguage_Id;
    }

    public void setLanguage_Id(String str) {

        sLanguage_Id = str;
    }

    public String getService_Id() {

        return sService_Id;
    }

    public void setService_Id(String str) {

        sService_Id = str;
    }

    public String getProject_Id() {

        return sProject_Id;
    }

    public void setProject_Id(String str) {

        sProject_Id = str;
    }

    public String getAppstart_Id() {

        return sAppstart_Id;
    }

    public void setAppstart_Id(String str) {

        sAppstart_Id = str;
    }

    public String getUrl() {

        return sUrl;
    }

    public void setUrl(String str) {

        sUrl = str;
    }

    public String getSmartUrl() {

        return sSmartUrl;
    }

    public void setSmartUrl(String str) {

        sSmartUrl = str;
    }

    public String getServicehubWebsocketUrl() {

        return sServicehubWebsocketUrl;
    }

    public void setServicehubWebsocketUrl(String str) {

        sServicehubWebsocketUrl = str;
    }

    public String getServicehubRestUrl() {
        return sServicehubRestUrl;
    }

    public void setServicehubRestUrl(String sServicehubRestUrl) {
        this.sServicehubRestUrl = sServicehubRestUrl;
    }

    public String getCloudGatewayUrl() {
        return sCloudGatewayUrl;
    }

    public void setCloudGatewayUrl(String sCloudGatewayUrl) {
        this.sCloudGatewayUrl = sCloudGatewayUrl;
    }

    public String getsSipUrl() {
        return sSipUrl;
    }

    public void setsSipUrl(String sSipUrl) {
        this.sSipUrl = sSipUrl;
    }

    public String getsTurnUrl() {
        return sTurnUrl;
    }

    public void setsTurnUrl(String sTurnUrl) {
        this.sTurnUrl = sTurnUrl;
    }

    public int getiTurnPort() {
        return iTurnPort;
    }

    public void setiTurnPort(int iTurnPort) {
        this.iTurnPort = iTurnPort;
    }

    public String getsVsaasDomain() {
        return sVsaasDomain;
    }

    public void setsVsaasDomain(String sVsaasDomain) {
        this.sVsaasDomain = sVsaasDomain;
    }

    public String getsSipPassword() {
        return sSipPassword;
    }

    public void setsSipPassword(String sSipPassword) {
        this.sSipPassword = sSipPassword;
    }

    public String getAuthToken() {

        return sAuth_Token;
    }

    public void setAuthToken(String str) {

        sAuth_Token = str;
    }

    public String getAuthorization() {

        if (!"".equals(sLogin_Id)) {
            LogUtil.i(TAG, "Authorization - " + Base64.encodeToString((sLogin_Id + ":" + getAuthToken()).getBytes(), 0));
            return Base64.encodeToString((sLogin_Id + ":" + getAuthToken()).getBytes(), 0).replaceAll("\\s", "");
        }
        return null;
    }

    public Float getScale() {

        return fScale;
    }

    public void setScale(Float str) {

        fScale = str;
    }

    public int getDisplayHeight() {

        return iDisplayHeight;
    }

    public void setDisplayHeight(int str) {

        iDisplayHeight = str;
    }

    public int getDisplayWidth() {

        return iDisplayWidth;
    }

    public void setDisplayWidth(int str) {

        iDisplayWidth = str;
    }

    public String getLogin_Pass() {

        return sLogin_Pass;
    }

    public void setLogin_Pass(String str) {

        sLogin_Pass = str;
    }

    public String getPush_Token() {

        return sPush_Token;
    }

    public void setPush_Token(String str) {

        sPush_Token = str;
    }

    public String getMy_Image_Url() {

        return sMy_Image_Url;
    }

    public void setMy_Image_Url(String str) {

        sMy_Image_Url = str;
    }

    public String getNickname() {

        return sNickname;
    }

    public void setNickname(String str) {

        sNickname = str;
    }

    public String getTimezone_Id() {

        return sTimezone_Id;
    }

    public void setTimezone_Id(String str) {

        sTimezone_Id = str;
    }

    public Boolean getGoErr() {

        return bGoErr;
    }

    public void setGoErr(Boolean sVal) {

        bGoErr = sVal;
    }

    public String getVer() {

        return sVer;
    }

    public void setVer(String str) {

        sVer = str;
    }

    public String getUuid() {

        return sUuid;
    }

    public void setUuid(String str) {

        sUuid = str;
    }

    public Boolean getLogin() {

        return bLogin;
    }

    public void setLogin(Boolean str) {

        bLogin = str;
    }

    public Boolean getLogout() {
        return isLogout;
    }

    public void setLogout(Boolean logout) {
        isLogout = logout;
    }

    public Boolean getIntro() {

        return bIntro;
    }

    public void setIntro(Boolean str) {

        bIntro = str;
    }

    public Boolean getMain() {

        return bMain;
    }

    public void setMain(Boolean str) {

        bMain = str;
    }

    public Boolean getbWebSocketAuth() {
        return bWebSocketAuth;
    }

    public void setbWebSocketAuth(Boolean bWebSocketAuth) {
        this.bWebSocketAuth = bWebSocketAuth;
    }

    public Boolean getbWebSocketConn() {
        return bWebSocketConn;
    }

    public void setbWebSocketConn(Boolean bWebSocketConn) {
        this.bWebSocketConn = bWebSocketConn;
    }

    public Boolean getAutoLogin() {

        return bAutoLogin;
    }

    public void setAutoLogin(Boolean str) {

        bAutoLogin = str;
    }

    public Boolean getSaveId() {
        return mSaveId;
    }

    public void setSaveId(Boolean saveId) {
        this.mSaveId = saveId;
    }

    public Boolean getManualNotView() {

        return bManualNotView;
    }

    public void setManualNotView(Boolean str) {

        bManualNotView = str;
    }

    public Boolean getPush() {

        return bPush;
    }

    public void setPush(Boolean str) {

        bPush = str;
    }

    public String getLogin_Id() {

        if (sLogin_Id == null) {
            return "";
        } else {
            return sLogin_Id;
        }
    }

    public void setLogin_Id(String str) {

        sLogin_Id = str;
    }

    public String getLogin_TermId() {

        return sLogin_TermId;
    }

    /**
     * 나의 홈 그룹 리스트 *
     */
    public ArrayList<HashMap<String, Object>> getAuthHomegrpListHM() {

        return authHomegrpListHM;
    }

    /**
     * 나의 홈 그룹 리스트 *
     */
    public void setAuthHomegrpListHM(ArrayList<HashMap<String, Object>> hm) {

        authHomegrpListHM = hm;
    }

    public ArrayList<HashMap<String, Object>> getAuthInvitationList() {

        return authInvitationList;
    }

    public void setAuthInvitationList(ArrayList<HashMap<String, Object>> hm) {

        authInvitationList = hm;
    }

    public String getsSelect_Servicehub_App_Id() {
        return sSelect_Servicehub_App_Id;
    }

    public void setsSelect_Servicehub_App_Id(String sSelect_Servicehub_App_Id) {
        this.sSelect_Servicehub_App_Id = sSelect_Servicehub_App_Id;
    }

    public String getsSelect_Homegrp_Homehub_Device_Key() {
        return sSelect_Homegrp_Homehub_Device_Key;
    }

    public void setsSelect_Homegrp_Homehub_Device_Key(String sSelect_Homegrp_Homehub_Device_Key) {
        this.sSelect_Homegrp_Homehub_Device_Key = sSelect_Homegrp_Homehub_Device_Key;
    }

    public Boolean getIsHomegrpHomehub() {
        return mIsHomegrpHomehub;
    }

    public void setIsHomegrpHomehub(Boolean isHomegrpHomehub) {
        this.mIsHomegrpHomehub = isHomegrpHomehub;
    }

    public String getCustId() {
        return mCustId;
    }

    public void setCustId(String custId) {
        this.mCustId = custId;
    }

    public String getCtrtGroupId() {

        return mCtrtGroupId;
    }

    public void setCtrtGroupId(String ctrtGroupId) {
        this.mCtrtGroupId = ctrtGroupId;
    }

    /**
     * Websocket request id 생성
     *
     * @return request id
     */
    public String getiSelect_Servicehub_Request_Id() {
        return String.valueOf(iSelect_Servicehub_Request_Id++ % 255);
    }


    public enum TrackerName {
        APP_TRACKER,
        // 앱 별로 트래킹
        GLOBAL_TRACKER,
        // 모든 앱을 통틀어 트래킹
        ECOMMERCE_TRACKER,     // 아마 유료 결재 트래킹 개념 같음
    }
}
