/*
 * Copyright (c) 2015. Ncomz. All Rights Reserved
 */

package com.ntels.kneet.v3.common.http;

import com.ntels.kneet.v3.R;
import com.ntels.kneet.v3.common.AppConfig;
import com.ntels.kneet.v3.common.Constants;
import com.ntels.kneet.v3.common.c_interface.OnDataSendToReslut;
import com.ntels.kneet.v3.common.c_interface.OnTaskExecutionFinished;
import com.ntels.kneet.v3.common.exception.RequestUnsuccessfulException;
import com.ntels.kneet.v3.common.netatmo.NetatmoHttpClientImpl;
import com.ntels.kneet.v3.common.util.Dlog;
import com.ntels.kneet.v3.common.util.Util;

import android.app.Dialog;
import android.content.Context;
import android.os.AsyncTask;
import android.view.ViewGroup.LayoutParams;
import android.widget.ProgressBar;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * <pre>
 * 1. ClassName :   HttpSend
 * 2. FileName  :   HttpSend.java
 * 3. Package   :   com.ntels.kneet.v3.common.http
 * 4. Date      :   2016-12-06
 * 5. Author    :   aaron
 * 6. Comment   :   Initialize
 * </pre>
 */
public class HttpSend {

    private AppConfig appConfig;
    private static final String TAG = HttpSend.class.getSimpleName();
    public static final long DEFAULT_TIMEOUT = 5000;
    private Util util = new Util();
    public final static int ENC_NOT = 10200;
    public final static int ENC_AES = 10201;
    private boolean bDialog = true;
    private boolean bDim = true;
    protected Context context;

    /**
     * 생성자.
     *
     * @param context 컨텍스트
     */
    public HttpSend(Context context) {

        appConfig = (AppConfig) context.getApplicationContext();
        this.context = context;
    }

    /**
     * 생성자.
     *
     * @param context 컨텍스트
     * @param bDialog Dialog 표시 여부
     */
    public HttpSend(Context context, boolean bDialog) {

        appConfig = (AppConfig) context.getApplicationContext();
        this.context = context;
        this.bDialog = bDialog;
    }

    /**
     * 생성자.
     *
     * @param context 컨텍스트
     * @param bDialog Dialog 표시 여부
     */
    public HttpSend(Context context, boolean bDialog, boolean bDim) {

        appConfig = (AppConfig) context.getApplicationContext();
        this.context = context;
        this.bDialog = bDialog;
        this.bDim = bDim;
    }

    /**
     * [POST]회원 가입 등록(회원 가입 정보를 입력 완료 후 인증 이메일을 발송한다.)
     *
     * @param sHTTP_nickname        사용자 이름
     * @param sHTTP_email_id        사용자 email id
     * @param sHTTP_password        사용자 password
     * @param sHTTP_service_id      서비스 ID (30001 : AoT@Home 3.0)
     * @param sHTTP_os_type         OS 유형 (MA : 안드로이드, MI : IOS)
     * @param sHTTP_country_code    국가 코드 (default : KR)
     * @param sHTTP_timezone_name   타임존 아이디 (default : 210)
     * @param sHTTP_image_file      사용자 프로필 이미지 파일 이름
     * @param sHTTP_image_file_path 사용자 프로필 이미지 파일 경로
     */
    public void P_member(String sHTTP_nickname, String sHTTP_email_id, String sHTTP_password, String sHTTP_service_id, String sHTTP_os_type, String sHTTP_country_code, String sHTTP_timezone_name, String sHTTP_image_file, String sHTTP_image_file_path) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_P_member);
            //            sSendType = Constants.SEND_TYPE_POST;
            sSendType = Constants.SEND_TYPE_MULTIPART;
            //            /** 이름 */
            //            sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_member_id, sHTTP_member_id);
            //            /** 이름 */
            //            addParameter(alPost, Constants.HTTP_, sHTTP_);
            /** 이름 */
            addParameter(alPost, Constants.HTTP_nickname, sHTTP_nickname);
            /** 이메일 ID */
            addParameter(alPost, Constants.HTTP_email_id, sHTTP_email_id);
            /** 패스워드 */
            addParameter(alPost, Constants.HTTP_password, sHTTP_password);
            /** 서비스 ID (30001 : AoT@Home 3.0) */
            addParameter(alPost, Constants.HTTP_service_id, sHTTP_service_id);
            /** OS 유형 (MA : 안드로이드, MI : IOS) */
            addParameter(alPost, Constants.HTTP_os_type, sHTTP_os_type);
            /** 국가 코드 (default : KR) */
            addParameter(alPost, Constants.HTTP_country_code, sHTTP_country_code);
            /** 타임존 아이디 (default : 210) */
            addParameter(alPost, Constants.HTTP_timezone_name, sHTTP_timezone_name);

            sFileParamName = sHTTP_image_file;
            sFilePath = sHTTP_image_file_path;
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [POST]회원 로그인(회원 로그인을 처리한다.)
     *
     * @param sHTTP_email_id        사용자 email id
     * @param sHTTP_password        사용자 password
     * @param sHTTP_service_id      서비스 ID (30001 : AoT@Home 3.0)
     * @param sHTTP_os_type         OS 유형 (MA : 안드로이드, MI : IOS)
     * @param sHTTP_device_sn       단말 일련번호 (애플 기기 : UUID / 안드로이드 기기 : IMEI or Mac Address)
     * @param sHTTP_device_token    푸시노티 토큰 (애플 기기 : device token / 안드로이드 기기 : reg id)
     * @param sHTTP_device_name     사용자 단말기 이름
     * @param sHTTP_device_hostname 사용자 단말기 네트워크 호스트 이름
     */
    public void P_member_login(String sHTTP_email_id, String sHTTP_password, String sHTTP_service_id, String sHTTP_os_type, String sHTTP_device_sn, String sHTTP_device_token, String sHTTP_device_name, String sHTTP_device_hostname) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_P_member_login);
            sSendType = Constants.SEND_TYPE_POST;
            /** 이메일 ID */
            addParameter(alPost, Constants.HTTP_email_id, sHTTP_email_id);
            /** 패스워드 */
            addParameter(alPost, Constants.HTTP_password, sHTTP_password);
            /** 서비스 ID (30001 : AoT@Home 3.0) */
            addParameter(alPost, Constants.HTTP_service_id, sHTTP_service_id);
            /** OS 유형 (MA : 안드로이드, MI : IOS) */
            addParameter(alPost, Constants.HTTP_os_type, sHTTP_os_type);
            addParameter(alPost, Constants.HTTP_device_sn, sHTTP_device_sn);
            addParameter(alPost, Constants.HTTP_device_token, sHTTP_device_token);
            addParameter(alPost, Constants.HTTP_device_name, sHTTP_device_name);
            addParameter(alPost, Constants.HTTP_device_hostname, sHTTP_device_hostname);
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [POST] (홈그룹에 속해 있지 않은 회원이 마스터가 되는) 홈그룹을 새로 생성한다.
     */
    public void P_homegrp() {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_P_homegrp);
            sSendType = Constants.SEND_TYPE_POST;

            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [POST] 등록하려는 홈허브에 device_id, device_key 정보를 전달한다.
     *
     * @param sHTTP_host_address 홈허브 IP address
     * @param sHTTP_device_id    홈허브 ID
     * @param sHTTP_device_key   홈허브 key
     */
    public void P_deviceinfo(String sHTTP_host_address, String sHTTP_device_id, String sHTTP_device_key) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sUrl = context.getString(R.string.SEND_P_deviceinfo, sHTTP_host_address);
            addParameter(alPost, Constants.HTTP_device_id, sHTTP_device_id);
            addParameter(alPost, Constants.HTTP_device_key, sHTTP_device_key);
            sSendType = Constants.SEND_TYPE_POST;

            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [POST]새 단말(장치) 인증(새로운 단말로 로그인 시 단말(장치) 인증 번호를 확인하고, 단말(장치)을 등록 처리한다. (기존 단말(장치)을 대체할 경우의 처리도
     * 포함))
     *
     * @param sHTTP_key             이메일로 전달되는 인증 번호
     * @param sHTTP_email_id        사용자 email id
     * @param sHTTP_service_id      서비스 ID (30001 : AoT@Home 3.0)
     * @param sHTTP_os_type         OS 유형 (MA : 안드로이드, MI : IOS)
     * @param sHTTP_device_sn       단말 일련번호 (애플 기기 : UUID / 안드로이드 기기 : IMEI or Mac Address)
     * @param sHTTP_device_token    푸시노티 토큰 (애플 기기 : device token / 안드로이드 기기 : reg id)
     * @param sHTTP_device_name     사용자 단말기 이름
     * @param sHTTP_device_hostname 사용자 단말기 네트워크 호스트 이름
     */
    public void P_member_new_mobile_device(String sHTTP_key, String sHTTP_email_id, String sHTTP_service_id, String sHTTP_os_type, String sHTTP_device_sn, String sHTTP_device_token, String sHTTP_device_name, String sHTTP_device_hostname) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_P_member_new_mobile_device);
            sSendType = Constants.SEND_TYPE_POST;
            //            /** 이름 */
            //            sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_member_id, sHTTP_member_id);
            //            /** 이름 */
            //            addParameter(alPost, Constants.HTTP_, sHTTP_);
            /** ket */
            addParameter(alPost, Constants.HTTP_key, sHTTP_key);
            /** 이메일 ID */
            addParameter(alPost, Constants.HTTP_email_id, sHTTP_email_id);
            /** 서비스 ID (30001 : AoT@Home 3.0) */
            addParameter(alPost, Constants.HTTP_service_id, sHTTP_service_id);
            /** OS 유형 (MA : 안드로이드, MI : IOS) */
            addParameter(alPost, Constants.HTTP_os_type, sHTTP_os_type);
            addParameter(alPost, Constants.HTTP_device_sn, sHTTP_device_sn);
            addParameter(alPost, Constants.HTTP_device_token, sHTTP_device_token);
            addParameter(alPost, Constants.HTTP_device_name, sHTTP_device_name);
            addParameter(alPost, Constants.HTTP_device_hostname, sHTTP_device_hostname);
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [POST]비밀번호 찾기(재설정)(입력된 이메일 ID 정보로 비밀번호 찾기를 위한 메일 발송을 처리한다.)
     *
     * @param sHTTP_email_id   사용자 email id
     * @param sHTTP_service_id 서비스 ID (30001 : AoT@Home 3.0)
     */
    public void P_member_password(String sHTTP_email_id, String sHTTP_service_id) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_P_member_password);
            sSendType = Constants.SEND_TYPE_POST;
            /** 이메일 ID */
            addParameter(alPost, Constants.HTTP_email_id, sHTTP_email_id);
            addParameter(alPost, Constants.HTTP_service_id, sHTTP_service_id);
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [GET]회원 로그아웃(회원 로그아웃을 처리한다. (인증 토큰 무효화))
     */
    public void G_member_logout() {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_G_member_logout);
            sSendType = Constants.SEND_TYPE_GET;
            //            /** 이름 */
            //            sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_member_id, sHTTP_member_id);
            //            /** 이름 */
            //            addParameter(alPost, Constants.HTTP_, sHTTP_);
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [PUT]회원 로그인 정보 조회 및 푸시 토큰 등록/수정(인증 토큰을 기준으로 회원의 로그인 정보를 조회하고 푸시 토큰을 등록/수정한다.)
     *
     * @param sHTTP_device_sn       단말 일련번호 (애플 기기 : UUID / 안드로이드 기기 : IMEI or Mac Address)
     * @param sHTTP_device_token    푸시노티 토큰 (애플 기기 : device token / 안드로이드 기기 : reg id)
     * @param sHTTP_os_type         OS 유형 (MA : 안드로이드, MI : IOS)
     * @param sHTTP_device_hostname 사용자 단말기 네트워크 호스트 이름
     */
    public void P_member(String sHTTP_device_sn, String sHTTP_device_token, String sHTTP_os_type, String sHTTP_device_hostname) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_G_member);
            sSendType = Constants.SEND_TYPE_PUT;
            /** 단말 일련번호 (애플 기기 : UUID / 안드로이드 기기 : IMEI or Mac Address) */
            addParameter(alPost, Constants.HTTP_device_sn, sHTTP_device_sn);
            /** 푸시노티 토큰 (애플 기기 : device token / 안드로이드 기기 : reg id) */
            addParameter(alPost, Constants.HTTP_device_token, sHTTP_device_token);
            addParameter(alPost, Constants.HTTP_os_type, sHTTP_os_type);
            addParameter(alPost, Constants.HTTP_device_hostname, sHTTP_device_hostname);
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [PUT][REST]회원 정보 수정(가입된 이메일, 비밀번호, 이름 정보에 대해 변경 처리한다.)
     *
     * @param sHTTP_member_id        멤버 ID(정수)
     * @param sHTTP_update_field     수정할 필드명(ex> name, password, email...)
     * @param sHTTP_new_email_id     신규 이메일 ID(변경구분 : email 일때 필수)
     * @param sHTTP_old_password     현재 비밀번호(변경구분 : password 일때 필수)
     * @param sHTTP_new_password     새 비밀번호(변경구분 : password 일때 필수)
     * @param sHTTP_confirm_password 비밀번호 확인(변경구분 : password 일때 필수)
     * @param sHTTP_nickname         이름(변경구분 : name 일때 필수)
     */
    public void P_member_member_id_update_field(String sHTTP_member_id, String sHTTP_update_field, String sHTTP_new_email_id, String sHTTP_old_password, String sHTTP_new_password, String sHTTP_confirm_password, String sHTTP_nickname, String sHTTP_image_file_name) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_P_member_member_id_update_field);
            sSendType = Constants.SEND_TYPE_PUT;
            sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_update_field, sHTTP_update_field);
            if (sHTTP_update_field.equals("email")) {
                /** 신규 이메일 ID(변경구분 : email 일때 필수) */
                addParameter(alPost, Constants.HTTP_new_email_id, sHTTP_new_email_id);
            } else if (sHTTP_update_field.equals("password")) {
                /** 현재 비밀번호(변경구분 : password 일때 필수) */
                addParameter(alPost, Constants.HTTP_old_password, sHTTP_old_password);
                /** 새 비밀번호(변경구분 : password 일때 필수) */
                addParameter(alPost, Constants.HTTP_new_password, sHTTP_new_password);
                /** 비밀번호 확인(변경구분 : password 일때 필수) */
                addParameter(alPost, Constants.HTTP_confirm_password, sHTTP_confirm_password);
            } else if (sHTTP_update_field.equals("name")) {
                /** 이름(변경구분 : name 일때 필수) */
                addParameter(alPost, Constants.HTTP_nickname, sHTTP_nickname);
            } else if (sHTTP_update_field.equals("profile")) {
                /** 이름(변경구분 : name 일때 필수) */
                addParameter(alPost, Constants.HTTP_image_file_name, sHTTP_image_file_name);
            }
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [GET][REST](기존)비밀번호 확인(비밀번호 정보를 확인한다.)
     *
     * @param sHTTP_member_id 멤버 ID(정수)
     * @param sHTTP_password  사용자 password
     */
    public void G_member_member_id(String sHTTP_member_id, String sHTTP_password) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_G_member_member_id);
            sSendType = Constants.SEND_TYPE_GET;
            /** 비밀번호 */
            addParameter(alPost, Constants.HTTP_password, sHTTP_password);
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [DELETE][REST]회원 탈퇴 (계정삭제)(회원의 계정을 삭제 처리한다.)
     */
    public void D_member() {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_D_member);
            sSendType = Constants.SEND_TYPE_DELETE;
            //sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_device_id, sHTTP_device_id);
            //sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_member_id, sHTTP_member_id);
            /** 비밀번호 */
            //addParameter(alPost, Constants.HTTP_password, sHTTP_password);
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [GET]홈그룹 멤버 목록조회(홈그룹의 멤버 목록을 조회한다.)
     */
    public void G_homegrp_members() {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_G_homegrp_members);
            sSendType = Constants.SEND_TYPE_GET;
            //            /** 이름 */
            //            sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_member_id, sHTTP_member_id);
            //            /** 이름 */
            //            addParameter(alPost, Constants.HTTP_, sHTTP_);
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [POST]홈그룹 멤버초대(홈그룹의 멤버를 초대한다.)
     *
     * @param sBodyVal Request body string
     */
    public void P_homegrp_members(String sBodyVal) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_P_homegrp_members);
            sSendType = Constants.SEND_TYPE_POST1;
            sBody = sBodyVal;
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [DELETE]홈그룹 멤버 강퇴/초대 취소(홈그룹으로 초대받은 멤버의 정보를 변경한다.)
     *
     * @param sHTTP_member_ids          멤버 ID 목록(','로 구분됨)
     * @param sHTTP_invitation_hist_ids 초대 멤버 ID 목록(','로 구분됨)
     */
    public void D_homegrp_members(String sHTTP_member_ids, String sHTTP_invitation_hist_ids) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_D_homegrp_members);
            sSendType = Constants.SEND_TYPE_DELETE;
            addParameter(alPost, Constants.HTTP_member_ids, sHTTP_member_ids);
            addParameter(alPost, Constants.HTTP_invitation_hist_ids, sHTTP_invitation_hist_ids);
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [POST]홈그룹 초대 알림(홈초대 알림 화면에서 승락/거절 처리를 한다. (+ 초대 수락 처리 후에 나머지 요청은 거절한다.))
     *
     * @param sHTTP_homegrp_id          홈그룹 ID
     * @param sHTTP_status_code         (응답) 상태 코드 (Y : 참여 / N : 거절)
     * @param sHTTP_authorization_reply 인증 답변 (년-월-일,  ex : "2015-10-01")
     */
    public void P_homegrp_members_invitations(String sHTTP_homegrp_id, String sHTTP_status_code, String sHTTP_authorization_reply) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_P_homegrp_members_invitations);
            sSendType = Constants.SEND_TYPE_POST;
            addParameter(alPost, Constants.HTTP_homegrp_id, sHTTP_homegrp_id);
            addParameter(alPost, Constants.HTTP_status_code, sHTTP_status_code);
            if (!sHTTP_authorization_reply.equals("")) {
                addParameter(alPost, Constants.HTTP_authorization_reply, sHTTP_authorization_reply);
            }
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [GET]홈그룹 멤버 초대 유효성 체크(초대 대상자의 유효성을 체크한다. (홈허브가 없는 홈의 회원 또는 홈이 없는 회원/비회원만 가능))
     *
     * @param sHTTP_target_email 초대할 email
     */
    public void P_homegrp_members_validation(String sHTTP_target_email) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_P_homegrp_members_validation);
            sSendType = Constants.SEND_TYPE_GET;
            addParameter(alPost, Constants.HTTP_target_email, sHTTP_target_email);
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [DELETE][REST]홈그룹 (자진) 탈퇴(일반 등급의 홈그룹 멤버를 홈그룹에서 자진 탈퇴 처리한다.)
     */
    public void D_homegrp_members_member_id() {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_D_homegrp_members_member_id);
            sSendType = Constants.SEND_TYPE_DELETE;
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [POST]멤버 이미지 변경(멤버의 프로필 이미지를 수정.)
     *
     * @param sHTTP_image_file      프로필 이미지 파일명
     * @param sHTTP_image_file_path 프로필 이미지 파일 path
     */
    public void P_member_profile_image(String sHTTP_image_file, String sHTTP_image_file_path) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_P_member_profile_image);
            sSendType = Constants.SEND_TYPE_MULTIPART;
            /** 이메일 ID */
            sFileParamName = sHTTP_image_file;
            sFilePath = sHTTP_image_file_path;

            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [POST]홈그룹 이미지 변경(홈그룹의 프로필 이미지를 수정.)
     *
     * @param sHTTP_image_file      프로필 이미지 파일명
     * @param sHTTP_image_file_path 프로필 이미지 파일 path
     */
    public void P_homegrp_profile_image(String sHTTP_image_file, String sHTTP_image_file_path) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_P_homegrp_profile_image);
            sSendType = Constants.SEND_TYPE_MULTIPART;
            /** 이메일 ID */
            sFileParamName = sHTTP_image_file;
            sFilePath = sHTTP_image_file_path;

            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [GET]홈그룹 초대 목록(초대받은 홈그룹 목록을 호출)
     */
    public void G_homegrp_members_invitations() {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_G_homegrp_members_invitations);
            sSendType = Constants.SEND_TYPE_GET;
            //            /** 이름 */
            //            sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_member_id, sHTTP_member_id);
            //            /** 이름 */
            //            addParameter(alPost, Constants.HTTP_, sHTTP_);
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [GET]홈모드 조회(홈그룹의 홈모드 목록을 불러온다.)
     */
    public void G_modes() {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_G_modes);
            sSendType = Constants.SEND_TYPE_GET;
            //            /** 이름 */
            //            sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_member_id, sHTTP_member_id);
            //            /** 이름 */
            //            addParameter(alPost, Constants.HTTP_, sHTTP_);
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [PUT][REST]현재 홈모드 변경(현재 홈모드를 변경한다.)
     *
     * @param sHTTP_mode_id 홈모드 ID(ex> HOME, AWAY, MORNING, NIGHT)
     */
    public void P_modes_mode_id_current_mode(String sHTTP_mode_id) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_P_modes_mode_id_current_mode);
            sSendType = Constants.SEND_TYPE_PUT;
            addParameter(alPost, Constants.HTTP_mode_id, sHTTP_mode_id);
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [GET]대시보드 정보 조회(홈그룹 모드 조회, 공지, 알림 갯수 조회 등)
     *
     * @param sHTTP_read_datetime 공지사항 최종 확인 일시 (년월일시분초, ex : 20150101151515)
     */
    public void G_dashboard(String sHTTP_read_datetime) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_G_dashboard);
            sSendType = Constants.SEND_TYPE_GET;
            /** 이메일 ID */
            addParameter(alPost, Constants.HTTP_read_datetime, sHTTP_read_datetime);
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [GET]알림 조회(알림 목록을 조회한다.)
     *
     * @param sHTTP_push_noti_hist_id (페이징 기준) 푸시 노티 이력 ID
     * @param sHTTP_paging_type       페이징 방향 (U:Upward, D:Downward)
     */
    public void G_notices_personal(String sHTTP_push_noti_hist_id, String sHTTP_paging_type) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_G_notices_personal);
            sSendType = Constants.SEND_TYPE_GET;
            /** 이메일 인증키 */
            addParameter(alPost, Constants.HTTP_push_noti_hist_id, sHTTP_push_noti_hist_id);
            addParameter(alPost, Constants.HTTP_paging_type, sHTTP_paging_type);
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [GET]공지사항 조회(공지사항 목록을 조회한다.)
     *
     * @param sHTTP_notice_id     (페이징 기준) 공지사항 ID
     * @param sHTTP_paging_type   페이징 방향 (U:Upward, D:Downward)
     * @param sHTTP_read_datetime 공지사항 최종 확인 일시 (년월일시분초, ex : 20150101151515)
     */
    public void G_notices(String sHTTP_notice_id, String sHTTP_paging_type, String sHTTP_read_datetime) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_G_notices);
            sSendType = Constants.SEND_TYPE_GET;
            /** 이메일 인증키 */
            addParameter(alPost, Constants.HTTP_notice_id, sHTTP_notice_id);
            addParameter(alPost, Constants.HTTP_paging_type, sHTTP_paging_type);
            addParameter(alPost, Constants.HTTP_read_datetime, sHTTP_read_datetime);
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [GET][REST]홈모드 변경 결과 조회(현재 홈모드 변경으로 장치를 제어한 결과를 조회한다.)
     *
     * @param sHTTP_mode_id 홈모드 ID(ex> HOME, AWAY, MORNING, NIGHT)
     */
    public void G_modes_mode_id_status(String sHTTP_mode_id) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_G_modes_mode_id_status);
            sSendType = Constants.SEND_TYPE_GET;
            sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_mode_id, sHTTP_mode_id);
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [GET]장치 리스트 조회(회원의 장치 목록을 조회한다.)
     */
    public void G_devices() {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_G_devices);
            sSendType = Constants.SEND_TYPE_GET;
            //            /** 이름 */
            //            sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_member_id, sHTTP_member_id);
            //            /** 이름 */
            //            addParameter(alPost, Constants.HTTP_, sHTTP_);
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [GET][REST]노드 상세 조회(해당 장치의 상세 정보를 조회한다.
     *
     * @param sHTTP_device_id 홈허브 ID
     * @param sHTTP_node_id   노드 ID
     */
    public void G_devices_device_id(String sHTTP_device_id, String sHTTP_node_id) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_G_devices_device_id);
            sSendType = Constants.SEND_TYPE_GET;
            sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_device_id, sHTTP_device_id);
            sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_node_id, sHTTP_node_id);
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [PUT][REST]장치 명/아이콘 변경(장치 이름 또는 아이콘을 변경한다.)
     *
     * @param sHTTP_device_id   홈허브 ID
     * @param sHTTP_node_id     노드 ID
     * @param sHTTP_device_name 새 장치명명
     */
    public void P_devices_property_device_id(String sHTTP_device_id, String sHTTP_node_id, String sHTTP_device_name) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_P_devices_property_device_id);
            sSendType = Constants.SEND_TYPE_PUT;
            sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_device_id, sHTTP_device_id);
            sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_node_id, sHTTP_node_id);
            addParameter(alPost, Constants.HTTP_device_name, sHTTP_device_name);
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [PUT]기존 디바이스의 비밀번호를 확인하여 일치하면 소유권을 변경 처리한다.
     *
     * @param sHTTP_device_id           홈허브 ID
     * @param sHTTP_owner_auth_password 홈허브 password
     */
    public void P_devices_device_id_ownership(String sHTTP_device_id, String sHTTP_owner_auth_password) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_P_devices_device_id_ownership);
            sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_device_id, sHTTP_device_id);
            sSendType = Constants.SEND_TYPE_PUT;
            addParameter(alPost, Constants.HTTP_owner_auth_password, sHTTP_owner_auth_password);
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [PUT](소유권을 확인할 때 사용하는) 디바이스 비밀번호를 변경한다.)
     *
     * @param sHTTP_device_id               홈허브 ID
     * @param sHTTP_new_owner_auth_password (새) 소유자 인증 비밀번호
     */
    public void P_devices_device_id_password(String sHTTP_device_id, String sHTTP_new_owner_auth_password) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_P_devices_device_id_password);
            sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_device_id, sHTTP_device_id);
            sSendType = Constants.SEND_TYPE_PUT;
            //            /** 이름 */
            //            sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_member_id, sHTTP_member_id);
            //            /** 이름 */
            //            addParameter(alPost, Constants.HTTP_user_device_password, sHTTP_user_device_password);
            addParameter(alPost, Constants.HTTP_new_owner_auth_password, sHTTP_new_owner_auth_password);
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [GET](외출 상태시) 경고 필요한 장치 조회((외출 상태시) 경고가 필요한 장치 노드 목록을 조회한다.)
     */
    public void G_devices_warning_nodes() {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_G_devices_warning_nodes);
            sSendType = Constants.SEND_TYPE_GET;
            //            /** 이름 */
            //            sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_member_id, sHTTP_member_id);
            //            /** 이름 */
            //            addParameter(alPost, Constants.HTTP_, sHTTP_);
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [GET]홈 규칙 목록 조회(홈의 규칙 목록을 조회한다.)
     *
     * @param sHTTP_rule_id     페이징 기준 규칙 ID
     * @param sHTTP_paging_type 페이징 유형 (U : Upward, D : Downward)
     */
    public void G_rules(String sHTTP_rule_id, String sHTTP_paging_type) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_G_rules);
            sSendType = Constants.SEND_TYPE_GET;

            addParameter(alPost, Constants.HTTP_rule_id, sHTTP_rule_id);
            addParameter(alPost, Constants.HTTP_paging_type, sHTTP_paging_type);

            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [GET][REST]홈 규칙 상세 조회(해당 규칙의 정보를 상세 조회한다.)
     *
     * @param sHTTP_homegrp_rule_id 홈그룹 규칙 ID
     */
    public void G_rules_homegrp_rule_id(String sHTTP_homegrp_rule_id) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_G_rules_homegrp_rule_id);
            sSendType = Constants.SEND_TYPE_GET;
            sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_homegrp_rule_id, sHTTP_homegrp_rule_id);
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [PUT][REST]홈 규칙 상태 변경(해당 규칙의 상태를 변경한다.)
     *
     * @param sHTTP_homegrp_rule_id 홈그룹 규칙 ID
     * @param sHTTP_status_code     (변경할) 상태 코드 (02 : 실행 / 03 : 중지)
     */
    public void P_rules_homegrp_rule_id_status(String sHTTP_homegrp_rule_id, String sHTTP_status_code) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_P_rules_homegrp_rule_id_status);
            sSendType = Constants.SEND_TYPE_PUT;
            sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_homegrp_rule_id, sHTTP_homegrp_rule_id);
            addParameter(alPost, Constants.HTTP_status_code, sHTTP_status_code);
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [POST]홈 규칙 등록(규칙을 등록한다.)
     *
     * @param sBodyVal Request body string
     */
    public void P_rules(String sBodyVal) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_P_rules);
            sSendType = Constants.SEND_TYPE_POST1;
            sBody = sBodyVal;
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [PUT][REST]홈 규칙 수정(해당 규칙을 수정한다.)
     *
     * @param sHTTP_homegrp_rule_id 홈그룹 규칙 ID
     * @param sBodyVal              Request body string
     */
    public void P_rules_homegrp_rule_id(String sHTTP_homegrp_rule_id, String sBodyVal) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_P_rules_homegrp_rule_id);
            sSendType = Constants.SEND_TYPE_PUT1;
            sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_homegrp_rule_id, sHTTP_homegrp_rule_id);
            sBody = sBodyVal;
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [DELETE][REST]홈 규칙 삭제(해당 규칙을 삭제한다.)
     *
     * @param sHTTP_homegrp_rule_id 홈그룹 규칙 ID
     */
    public void D_rules_homegrp_rule_id(String sHTTP_homegrp_rule_id) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_D_rules_homegrp_rule_id);
            sSendType = Constants.SEND_TYPE_DELETE;
            sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_homegrp_rule_id, sHTTP_homegrp_rule_id);

            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [GET][REST]액션 장치의 목록 조회(규칙 아이템(조건,액션)으로 사용할 장치를 조회)
     *
     * @param sHTTP_item_type_code 항목 유형 코드 (01 : trigger, 02 : action)
     */
    public void G_rules_item_devices_item_type_code(String sHTTP_item_type_code) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_G_rules_item_devices_item_type_code);
            sSendType = Constants.SEND_TYPE_GET;
            addParameter(alPost, Constants.HTTP_item_type_code, sHTTP_item_type_code);
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [GET][REST]홈그룹 모드의 멀티제어 상세 조회(해당 홈모드 멀티제어의 정보를 상세 조회한다.)
     *
     * @param sHTTP_mode_id 홈모드 ID(ex> HOME, AWAY, MORNING, NIGHT)
     */
    public void G_mode_scenes_mode_id(String sHTTP_mode_id) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_G_mode_scenes_mode_id);
            sSendType = Constants.SEND_TYPE_GET;
            sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_mode_id, sHTTP_mode_id);
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [POST][REST]홈그룹 모드의 멀티제어 등록&수정(멀티제어를 등록&수정한다.)
     *
     * @param sHTTP_mode_id 홈모드 ID(ex> HOME, AWAY, MORNING, NIGHT)
     * @param sBodyVal      Request body string
     */
    public void P_mode_scenes_mode_id(String sHTTP_mode_id, String sBodyVal) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_P_mode_scenes_mode_id);
            sSendType = Constants.SEND_TYPE_POST1;
            sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_mode_id, sHTTP_mode_id);
            sBody = sBodyVal;
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [DELETE][REST]홈그룹 모드의 규칙 삭제
     *
     * @param sHTTP_mode_id 홈모드 ID(ex> HOME, AWAY, MORNING, NIGHT)
     */
    public void D_modes_mode_id_rule(String sHTTP_mode_id) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_D_modes_mode_id_rule);
            sSendType = Constants.SEND_TYPE_DELETE;
            sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_mode_id, sHTTP_mode_id);
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [GET]앱 버전 정보 조회(서비스 이용이 가능한 앱 버전 정보를 조회한다.)
     *
     * @param sHTTP_os_type     OS 유형 (MA : 안드로이드, MI : IOS)
     * @param sHTTP_store_code  스토어 코드(G - Google Play, T - T-Store...)
     * @param sHTTP_app_version (현재 접속한) 앱 버전
     * @param sHTTP_service_id  서비스 ID (30001 : AoT@Home 3.0)
     */
    public void G_app_version(String sHTTP_os_type, String sHTTP_store_code, String sHTTP_app_version, String sHTTP_service_id) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_G_app_version);
            sSendType = Constants.SEND_TYPE_GET;
            //            /** 이름 */
            //            sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_member_id, sHTTP_member_id);
            //            /** 이름 */
            //            addParameter(alPost, Constants.HTTP_, sHTTP_);
            addParameter(alPost, Constants.HTTP_os_type, sHTTP_os_type);
            addParameter(alPost, Constants.HTTP_store_code, sHTTP_store_code);
            addParameter(alPost, Constants.HTTP_app_version, sHTTP_app_version);
            addParameter(alPost, Constants.HTTP_service_id, sHTTP_service_id);
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [GET]야후날씨 지역코드 목록 조회(야후 날씨에 사용할 지역코드목록을 조회한다.)
     */
    public void G_common_weather_location_codes() {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_G_common_weather_location_codes);
            sSendType = Constants.SEND_TYPE_GET;
            //            /** 이름 */
            //            sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_member_id, sHTTP_member_id);
            //            /** 이름 */
            //            addParameter(alPost, Constants.HTTP_, sHTTP_);
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [PUT]알림 수신 여부 설정(알림 수신 여부를 설정 한다. (예 : 홈모드가 바뀔 때, 집이 빌 때))
     *
     * @param sHTTP_push_type_mode_chg_yn  모드가 바뀔 때 알림 설정 여부 (Y : 받음, N : 안받음)
     * @param sHTTP_push_type_prsnc_chg_yn 집이 빌때 알림 설정 여부 (Y : 받음, N : 안받음)
     */
    public void P_member_push_noti(String sHTTP_push_type_mode_chg_yn, String sHTTP_push_type_prsnc_chg_yn) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_P_member_push_noti);
            sSendType = Constants.SEND_TYPE_PUT;
            /** 이메일 ID */
            addParameter(alPost, Constants.HTTP_push_type_mode_chg_yn, sHTTP_push_type_mode_chg_yn);
            addParameter(alPost, Constants.HTTP_push_type_prsnc_chg_yn, sHTTP_push_type_prsnc_chg_yn);
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [GET](등록 진행하기 전) 해당 디바이스의 기 등록여부를 조회한다.
     *
     * @param sHTTP_mf_id    홈허브 제조사 ID
     * @param sHTTP_model_id 홈허브 모델 ID
     * @param sHTTP_sn       홈허브 시리얼번호
     */
    public void G_devices_mf_id_model_id_sn(String sHTTP_mf_id, String sHTTP_model_id, String sHTTP_sn) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sInterface_Id = util.getString(context, R.string.API_VERSION) + util.getString(context, R.string.SEND_G_devices_mf_id_model_id_sn);
            sSendType = Constants.SEND_TYPE_GET;

            sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_device_mf_id, sHTTP_mf_id);
            sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_device_model_id, sHTTP_model_id);
            sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_device_sn, sHTTP_sn);

            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [POST] Cloud to Cloud 연동 Node 등록
     *
     * @param sHTTP_device_id 홈허브 ID
     * @param sBodyVal        Request body string
     */
    public void P_cloud_devices_device_id_nodes(String sHTTP_device_id, String sBodyVal) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sUrl = appConfig.getCloudGatewayUrl();
            sInterface_Id = util.getString(context, R.string.CLOUD_API_VERSION) + util.getString(context, R.string.SEND_P_cloud_devices_device_id_nodes);
            sSendType = Constants.SEND_TYPE_POST1;
            sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_device_id, sHTTP_device_id);
            sBody = sBodyVal;

            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [DELETE] Cloud to Cloud 연동 Node 삭제
     *
     * @param sHTTP_device_id 홈허브 ID
     * @param sHTTP_node_id   노드 ID
     * @param homegroupId     홈그룹 ID
     * @param memberId        멤버 ID
     */
    public void D_cloud_devices_device_id_nodes_node_id(String sHTTP_device_id, String sHTTP_node_id,
                                                        String homegroupId, String memberId) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sUrl = appConfig.getCloudGatewayUrl();
            sInterface_Id = util.getString(context, R.string.CLOUD_API_VERSION) + util.getString(context, R.string.SEND_D_cloud_devices_device_id_nodes_node_id);
            sSendType = Constants.SEND_TYPE_DELETE;

            sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_device_id, sHTTP_device_id);
            sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_node_id, sHTTP_node_id);
            addParameter(alPost, Constants.HTTP_homegroup_id, homegroupId);
            addParameter(alPost, Constants.HTTP_member_id, memberId);

            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [GET][REST]네타모 카메라의 로컬 IP Address를 조회한다.
     *
     * @param sHTTP_vpn_url 넷타모 영상 스트리밍 URL
     */
    public void G_cloud_netatmo_command_ping(String sHTTP_vpn_url) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sUrl = sHTTP_vpn_url + "/command/ping";
            sSendType = Constants.SEND_TYPE_GET;
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [DELETE] 서비스허브 REST API를 사용하여 노드 삭제(Inclusion과정이 필요없는 장치용)
     *
     * @param sHTTP_device_id 홈허브 ID
     * @param sHTTP_node_id   노드 ID
     * @param homegroupId     홈그룹 ID
     * @param memberId        멤버 ID
     */
    public void D_servicehub_devices_device_id_nodes_node_id(String sHTTP_device_id, String sHTTP_node_id,
                                                             String homegroupId, String memberId) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sUrl = appConfig.getServicehubRestUrl();
            sInterface_Id = util.getString(context, R.string.SERVICEHUB_API_VERSION) + util.getString(context, R.string.SEND_D_servicehub_devices_device_id_nodes_node_id);
            sSendType = Constants.SEND_TYPE_DELETE;

            sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_device_id, sHTTP_device_id);
            sInterface_Id = util.convGetRestReplace(sInterface_Id, Constants.HTTP_node_id, sHTTP_node_id);
            addParameter(alPost, Constants.HTTP_homegroup_id, homegroupId);
            addParameter(alPost, Constants.HTTP_member_id, memberId);

            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * [POST][REST]넷타모 로그인
     *
     * @param netatmoHttpClientImpl 넷타모 정보를 포함한 인스턴스
     * @param email                 넷타모 로그인 email
     * @param password              넷타모 로그인 password
     */
    public void P_cloud_netatmo_login(NetatmoHttpClientImpl netatmoHttpClientImpl, String email, String password) {

        String sUrl = "";
        String sInterface_Id = "";
        String sSendType = "";
        String sBody = "";
        String sFileParamName = "";
        String sFilePath = "";
        ArrayList<HashMap<String, Object>> alPost = new ArrayList<HashMap<String, Object>>();
        ArrayList<String> alFilePath = new ArrayList<String>();
        try {
            sUrl = "https://api.netatmo.net/oauth2/token";
            sSendType = Constants.SEND_TYPE_POST;
            addParameter(alPost, "grant_type", "password");
            addParameter(alPost, "client_id", netatmoHttpClientImpl.getClientId());
            addParameter(alPost, "client_secret", netatmoHttpClientImpl.getClientSecret());
            addParameter(alPost, "username", email);
            addParameter(alPost, "password", password);
            addParameter(alPost, "scope", netatmoHttpClientImpl.getAppScope());
            setHttp(sUrl, sInterface_Id, sSendType, alPost, sBody, sFileParamName, sFilePath, alFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * Http 정보 셋팅 및 요청
     *
     * @param sUrl           요청 URL
     * @param sInterface_Id  Path parameter
     * @param sSendType      HTTP method
     * @param alPost         Request parameter list
     * @param sBody          Request parameter string
     * @param sFileParamName 업로드 파일 명
     * @param sFilePath      업로드 파일 경로
     * @param alFilePath     업로드 파일 경로 list
     */
    void setHttp(String sUrl, String sInterface_Id, String sSendType, ArrayList<HashMap<String, Object>> alPost, String sBody, String sFileParamName, String sFilePath, ArrayList<String> alFilePath) {

        try {
            String sUrlVal = "";
            String sUriVal = "";
            String sSendTypeVal = "";
            if (sUrl.equals("")) {
                sUrlVal = appConfig.getUrl();
            } else {
                sUrlVal = sUrl;
            }

            String sParam = util.convGetParam(alPost);
            if (sSendType.equals(Constants.SEND_TYPE_POST)) {
                sUriVal = sUrlVal + sInterface_Id;
                sSendTypeVal = CustomRequest.HTTP_METHOD_POST;
                CustomRequest customRequest = new CustomRequest(bDialog, sSendTypeVal, sUriVal, appConfig.getAuth_Token(), alPost, CustomRequest.SEND_METHOD);
                executeRequest(customRequest);
            } else if (sSendType.equals(Constants.SEND_TYPE_POST1)) {
                sUriVal = sUrlVal + sInterface_Id;
                sSendTypeVal = CustomRequest.HTTP_METHOD_POST;
                CustomRequest customRequest = new CustomRequest(bDialog, sSendTypeVal, sUriVal, appConfig.getAuth_Token(), sBody, CustomRequest.SEND_METHOD);
                executeRequest(customRequest);
            } else if (sSendType.equals(Constants.SEND_TYPE_MULTIPART)) {
                sUriVal = sUrlVal + sInterface_Id;
                sSendTypeVal = CustomRequest.HTTP_METHOD_MULTIPART;
                CustomRequest customRequest = new CustomRequest(bDialog, sSendTypeVal, sUriVal, appConfig.getAuth_Token(), alPost, sFileParamName, sFilePath, CustomRequest.SEND_METHOD);
                executeRequest(customRequest);
            } else if (sSendType.equals(Constants.SEND_TYPE_MULTIPART1)) {
                sUriVal = sUrlVal + sInterface_Id;
                sSendTypeVal = CustomRequest.HTTP_METHOD_MULTIPART;
                CustomRequest customRequest = new CustomRequest(bDialog, sSendTypeVal, sUriVal, appConfig.getAuth_Token(), alPost, sFileParamName, alFilePath, CustomRequest.SEND_METHOD);
                executeRequest(customRequest);
            } else if (sSendType.equals(Constants.SEND_TYPE_DELETE)) {
                sUriVal = sUrlVal + sInterface_Id + sParam;
                sSendTypeVal = CustomRequest.HTTP_METHOD_DELETE;
                CustomRequest customRequest = new CustomRequest(bDialog, sSendTypeVal, sUriVal, appConfig.getAuth_Token(), "", CustomRequest.SEND_METHOD);
                executeRequest(customRequest);
                //            } else if ( sSendType.equals(Constants.SEND_TYPE_DELETE1) ) {
                //                sUriVal = sUrlVal + sInterface_Id + body;
                //                sSendTypeVal = CustomRequest.HTTP_METHOD_DELETE;
                //                CustomRequest customRequest = new CustomRequest(bDialog, sSendTypeVal, sUriVal, mAppConfig.getAuth_Token(), "", CustomRequest.SEND_METHOD);
                //                executeRequest(customRequest);
            } else if (sSendType.equals(Constants.SEND_TYPE_GET)) {
                sUriVal = sUrlVal + sInterface_Id + sParam;
                sSendTypeVal = CustomRequest.HTTP_METHOD_GET;
                CustomRequest customRequest = new CustomRequest(bDialog, sSendTypeVal, sUriVal, appConfig.getAuth_Token(), "", CustomRequest.SEND_METHOD);
                executeRequest(customRequest);
            } else if (sSendType.equals(Constants.SEND_TYPE_PUT)) {
                sUriVal = sUrlVal + sInterface_Id + sParam;
                sSendTypeVal = CustomRequest.HTTP_METHOD_PUT;
                CustomRequest customRequest = new CustomRequest(bDialog, sSendTypeVal, sUriVal, appConfig.getAuth_Token(), alPost, CustomRequest.SEND_METHOD);
                executeRequest(customRequest);
            } else if (sSendType.equals(Constants.SEND_TYPE_PUT1)) {
                sUriVal = sUrlVal + sInterface_Id + sParam;
                sSendTypeVal = CustomRequest.HTTP_METHOD_PUT;
                CustomRequest customRequest = new CustomRequest(bDialog, sSendTypeVal, sUriVal, appConfig.getAuth_Token(), sBody, CustomRequest.SEND_METHOD);
                executeRequest(customRequest);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * Request parameter 추가.
     *
     * @param paramListPost  Parameter 추가 될 list
     * @param parameterName  Parameter key
     * @param parameterValue Parameter value
     */
    void addParameter(List<HashMap<String, Object>> paramListPost, String parameterName, String parameterValue) {

        if (parameterName == null) {
            return;
        }
        HashMap<String, Object> hmTemp = new HashMap<String, Object>();
        if (parameterValue == null) {
            hmTemp.put(parameterName, "");
        } else {
            Dlog.v(parameterName + ": " + parameterValue);
            hmTemp.put(parameterName, parameterValue);
        }
        paramListPost.add(hmTemp);
    }

    private OnDataSendToReslut _task_resulted_event;
    private Dialog dialog;

    /**
     * HTTP 요청
     *
     * @param customRequest HTTP request 정보 instance
     */
    private void executeRequest(CustomRequest customRequest) {

        if (!bDialog) {
            if (dialog != null) {
                dialog.dismiss();
                dialog = null;
            }
        } else {
            if (dialog != null) {
                dialog.cancel();
                dialog = null;
            }
            if (bDialog) {
                dialog = new Dialog(context, R.style.NTLES_Dialog1);
            } else {
                dialog = new Dialog(context, R.style.NTLES_Dialog2);
            }
            dialog.addContentView(new ProgressBar(context, null, android.R.attr.progressBarStyleInverse), new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
            dialog.show();
        }
        AsyncTask<CustomRequest, Integer, Response[]> task = null;
        try {
            task = new HttpTask(context);
            ((HttpTask) task).setOnTaskFinishedEvent(new OnTaskExecutionFinished() {
                @Override
                public void OnTaskFihishedEvent(Response[] result) {

                    try {
                        if (dialog != null && dialog.isShowing()) {
                            dialog.dismiss();
                            dialog = null;
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    if (_task_resulted_event != null) {
                        _task_resulted_event.resultResponse(result != null ? result[0] : null);
                    }
                }
            });
            task.execute(customRequest);
        } catch (RequestUnsuccessfulException e) {
            String msg1 = "Unable to execute request";
            Dlog.w(msg1, e);
            _task_resulted_event.resultResponse(ResponseHelper.writeException(msg1, e));
        } catch (Exception ex) {
            ex.printStackTrace();
            String msg1 = "Unable to execute request";
            Dlog.w(msg1, ex);
            _task_resulted_event.resultResponse(ResponseHelper.writeException(msg1, ex));
        }
    }

    /**
     * HTTP response listener setting.
     *
     * @param _event Response listener
     */
    public void setOnDataSendToReslutEvent(OnDataSendToReslut _event) {

        if (_event != null) {
            this._task_resulted_event = _event;
        }
    }
}
