package kr.co.icontrols.ilp300_700.global;

import android.util.Log;

public class Declare {
    // 미리 정의해야할 변수를 정의한다.

    public static class PrivateBR {
        public static String FINGERPRINT_DETECTED = "FINGERPRINT_DETECTED";
        public static String FINGERPRINT_DATA = "FINGERPRINT_DATA";
        public static String APPLIVESIGNAL = "APPLIVESIGNAL";
        public static String UPDATE_MAINSCREEN = "UPDATE_MAINSCREEN";
        public static String CERES_CALL = "CERES_CALL";
        public static String REDIRECT_CALL = "REDIRECT_CALL";
        public static String UPDATE_KEYDATA= "UPDATE_KEYDATA";
        public static String UPDATE_SENSOR= "UPDATE_SENSOR";
        public static String UPDATE_KEYDATA_TALK= "UPDATE_KEYDATA_TALK";
        public static String SENSETIME_ERROR = "SENSETIME_ERROR";
    }

    public enum DeviceType {
        RESIDENCE,
        RENTRESIDENCE,
        LOBBY,
        GUARD,
    }

    public static class DeviceInfo {
        // 디바이스의 정보를 미리 정의한다.
        public final static DeviceType Type = DeviceType.LOBBY;
        // ILP-300 현산향 (3 inch)
        public final static int ILP_300_SCREEN_SIZE_FULL_W = 480;      // 제품 해상도 (가로)
        public final static int ILP_300_SCREEN_SIZE_FULL_H = 272;      // 제품 해상도 (세로)
        // ILP-700 (대외향 7 inch)
        public final static int ILP_700_SCREEN_SIZE_FULL_W = 800;      // 제품 해상도 (가로)
        public final static int ILP_700_SCREEN_SIZE_FULL_H = 480;      // 제품 해상도 (세로)

        public static int getScreenSizeFullW(int nModelType) {
            if (nModelType == Global.MODEL_ILP_300) return ILP_300_SCREEN_SIZE_FULL_W;
            else if (nModelType == Global.MODEL_ILP_700) return ILP_700_SCREEN_SIZE_FULL_W;
            else {
                Log.w("[getScreenSizeFullW]", "Not Supported MODEL!! nModelType [" + nModelType + "]");
                return 0;
            }
        }
        public static int getScreenSizeFullH(int nModelType) {
            if (nModelType == Global.MODEL_ILP_300) return ILP_300_SCREEN_SIZE_FULL_H;
            else if (nModelType == Global.MODEL_ILP_700) return ILP_700_SCREEN_SIZE_FULL_H;
            else {
                Log.w("[getScreenSizeFullH]", "Not Supported MODEL!! nModelType [" + nModelType + "]");
                return 0;
            }
        }
    }

    public static class Const {
        public static final String DNS_IP =               "10.0.1.1";
        public static final String DNS_IP1 =               "10.0.2.1";
        public static final String SUBNET_MASK =          "255.255.0.0";
        public static final String DNS_IP2 =              "10.0.1.10";
    }

    public static class CALLTRIGGER {
        public static String CALLOWNER = "CALLOWNER";
        public static String CALLSTATUSTYPE = "CALLSTATUSTYPE";
        public static String CALLEVENTTYPE = "CALLEVENTTYPE";
        public static String CALLTYPE = "CALLTYPE";
        public static String REMOTEINFO = "REMOTEINFO";
        public static String REMOTEINFOIP = "REMOTEINFOIP";

        public enum SOURCE {
            USER,
            CALL_RECEIVE,
            SUBPHONE
        }

        public enum TYPE {
            MENU,
            FRONT,
            LOBBY,
            GUARD,
            RESIDENCE,
            PSTN
        }
    }

    public static class DeviceString {
        public static String strType_Resi = "Resi";
        public static String strType_RentResi = "RentResi";
        public static String strType_Lobby = "Lobby";
        public static String strType_Guard = "Guard";
        public static String strType_Ihub = "Ihub";
    }

    public static class DBInfo {
        public static String DATABASE_FILENAME_CONFIG = "DEVICE_CONFIG.DB";
        public static String DATABASE_FILENAME_RFKEY = "RFKEY.DB";
        public static String DATABASE_FILENAME_RFKEY_STD_RESI = "RFKEY_STD_RESI.DB";
        public static String DATABASE_FILENAME_RFKEY_STD_ADMIN_DONG = "RFKEY_STD_ADMIN_DONG.DB";
        public static String DATABASE_FILENAME_RFKEY_STD_ADMIN_ENTIRE = "RFKEY_STD_ADMIN_ENTIRE.DB";
        public static String DATABASE_FILENAME_RFKEY_STD_VISITOR = "RFKEY_STD_VISITOR.DB";
        public static String TABLE_NAME_CONFIG = "CONFIG";
        public static String TABLE_NAME_RFKEY = "RFKEY";
        public static String TABLE_NAME_RFKEY_STD_RESI = "RFKEY_STD_RESI";
        public static String TABLE_NAME_RFKEY_STD_ADMIN_DONG = "RFKEY_STD_ADMIN_DONG";
        public static String TABLE_NAME_RFKEY_STD_ADMIN_ENTIRE = "RFKEY_STD_ADMIN_ENTIRE";

        public static String[] VALUE_NAME_DEFAULT = {"KEY", "VALUE"};
        public static String[] VALUE_NAME_RFKEY = {"KEY", "KEYTYPE", "UID", "CID", "SN", "SITECODE", "DONG", "HO", "KEYNO", "ISSUE_CNT", "ISSUE_DATE", "EXPIRE_DATE", "LASTUSE_DATE", "NAME", "MESSAGE", "ETC"};
    }

    public static class TargetPort {
        public static int nServer1_X = 10000;
        public static int nServer2_0 = 11000;
    }

    public static class ServerVersion {
        public static String strVer_1dot0 = "1.0";
        public static String strVer_1dot5 = "1.5";
        public static String strVer_2dot0 = "2.0";
    }

    public static class MultiReaderPacket {
        public static final byte STX = (byte) 0x02;   // Packet STX
        public static final byte ETX = (byte) 0x03;   // Packet ETX
        public static final byte ID_RFREADER = (byte) 0x11;   // RFReader ID
        public static final byte ID_LOBBY = (byte) 0x1A;   // Lobby ID
        public static final byte RESERVED = (byte) 0x00;   // Packet Reserved

        public static final byte CMD_STATUS_REQUEST = (byte) 0x00;   // RF Reader Status Request
        public static final byte CMD_STATUS_REPLY = (byte) 0x90;   // RF Reader Status Reply
        public static final byte CMD_FW_VER_REQUEST = (byte) 0x0A;   // RF Reader F/W Ver. Request
        public static final byte CMD_FW_VER_REPLY = (byte) 0x9A;   // RF Reader F/W Ver. Reply
        public static final byte CMD_MIFARE = (byte) 0x91;   // CMD : Mifare
        public static final byte CMD_TMONEY = (byte) 0x92;   // CMD : T-Money
        public static final byte CMD_IPARK = (byte) 0x93;   // CMD : I-PARK
        public static final byte CMD_IPARKNFC = (byte) 0x9C;   // CMD : NFC
        public static final byte CMD_UNKNOWN = (byte) 0x9F;   // CMD : Unknown
        public static final byte CMD_SMARTKEY = (byte) 0x71;   // CMD : SmartKey
        public static final byte CMD_SMARTKEY_DOOROPEN = (byte) 0x7A;   // CMD : 문열림 알림
        public static final byte CMD_SMARTKEY_CARDREADER = (byte) 0x7B;   // CMD : 카드리더기로 외부 레이더 감지 정보 전달
        public static final byte CMD_ZIGBEE_SENSITIVITY_REQUEST = (byte) 0x7C; // CMD: C/R로 무선 통신 신호 감도 변경 정보 전달
        public static final byte CMD_ZIGBEE_SENSITIVITY_REPLY = (byte) 0x73; // CMD: C/R에 현재 설정된 무선 통신 신호 감도 응답
        public static final byte CMD_SMARTKEY_INVALID = (byte) 0x7F;   // CMD : 유효하지않은 스마트키

        public static final byte DATA_GET_ZIGBEE_SENSITIVITY = (byte) 0x01; // 신호 감도 요청
        public static final byte DATA_SET_ZIGBEE_SENSITIVITY = (byte) 0x02; // 신호 감도 설정

        public static final byte ID_TYPE_RESI = (byte) 0x00;   // 0x00 : 입주자 카드, 0x01 : 마스터 카드, 0x02 : 방문자 카드
        public static final byte ID_TYPE_ADMIN = (byte) 0x01;   // 0x00 : 입주자 카드, 0x01 : 마스터 카드, 0x02 : 방문자 카드
        public static final byte ID_TYPE_VISITOR = (byte) 0x02;   // 0x00 : 입주자 카드, 0x01 : 마스터 카드, 0x02 : 방문자 카드
        public static final byte SMARTKEY_DIRECTION_OUT = (byte) 0x00;   // 스마트키 출입방향
        public static final byte SMARTKEY_DIRECTION_IN = (byte) 0x01;   // 스마트키 출입방향
    }

    public static class STDReaderPacket {
        public static final byte STX = (byte) 0x02;   // Packet STX
        public static final byte ETX = (byte) 0x03;   // Packet ETX
        public static final byte RESERVED = (byte) 0x00;   // Packet Reserved
    }

    public static class FPReaderPacket {
        /*
        // Packet length : The total byte number from packet length to Sum (instruction, parameter or data), including Sum, but not the byte number of packet length itself.
        // Sum is the total bytes from packet flag to Sum, the carry will be ignored if it exceed 2 bytes.
         */

        // Header
        public static final byte[] STX = { (byte) 0xEF, (byte) 0x01 };   // Packet STX (2Bytes)
        public static final byte[] ID_READER = { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF };   // Fingerprint reader ID (4Bytes)

        // Instruction cmd (Packet ID, Master -> FP module)
        public static final byte PID_TYPE_INST = (byte) 0x01;   // Command packet (Packet ID, Master -> FP module)
        public static final byte PID_TYPE_DATA = (byte) 0x02;   // Data packet, and with continue packet Instruction ack (Packet ID, FP module -> Master)
        public static final byte PID_TYPE_ACK = (byte) 0x07;   // Instruction ack (Packet ID, Master -> FP module)
        public static final byte PID_TYPE_LASTDATA = (byte) 0x08;   // The last data packet, i.e. end packet Instruction ack (Packet ID, FP module -> Master)

        // Instruction code (cmd, Master -> FP module)
        public static final byte CMD_GETIMAGE = (byte) 0x01;   // get fingerprint image
        public static final byte CMD_GENCHAR = (byte) 0x02;   // generate  fingerprint character
        public static final byte CMD_UPCHAR = (byte) 0x08;   // upload fingerprint character

        // Confirm code (ack, FP module -> Master)
        public static final byte CFCODE_OK = (byte) 0x00;   // Indicates instruction implementing end or OK
        public static final byte CFCODE_ERROR = (byte) 0x01;   // Indicates data packet receiving error
        public static final byte CFCODE_NOFPONSENSOR = (byte) 0x02;   // Indicates no finger on the sensor
        public static final byte CFCODE_FAILEDGETFP = (byte) 0x03;   // Indicates getting fingerprint image failed
        public static final byte CFCODE_FPDRYLIGHT = (byte) 0x04;   // Indicates the fingerprint image is too dry or too light to generate feature
        public static final byte CFCODE_FPHUMIDBLURRY = (byte) 0x05;   // Indicates the fingerprint image is too humid or too blurry to generate feature
        public static final byte CFCODE_AMORPHOUS = (byte) 0x06;   // Indicates the fingerprint image is too amorphous to generate feature
        public static final byte CFCODE_LACKFP = (byte) 0x07;   // Indicates the fingerprint image is in order, but with too little minutiaes（or too small area）to generate feature
        public static final byte CFCODE_FPUNMATCH = (byte) 0x08;   // Indicates the fingerprint unmatched
        public static final byte CFCODE_NOFP = (byte) 0x09;   // Indicates no fingerprint searched
        public static final byte CFCODE_MERGEFAILED = (byte) 0x0A;   // Indicates the feature merging failed
        public static final byte CFCODE_ADDRERROR = (byte) 0x0B;   // Indicates the address SN exceeding the range of fingerprint database when accessing to it
        public static final byte CFCODE_DBERROR = (byte) 0x0C;   // Indicates template reading error or invalid from the fingerprint
        public static final byte CFCODE_NOVALID = (byte) 0x15;   // shows there is no valid original image in buffer to generate image

    }

    public static class SmartAutoDoor {
        public static final byte STX = (byte) 0x28;   // Packet STX
        public static final byte ETX = (byte) 0x29;   // Packet ETX
    }

    public static class AccessValues {
        public static final String pass = "pass";
        public static final String fail = "fail";
        public static final String fail_site = "fail_site";
        public static final String deny = "deny";   // 로비폰의 카드출입 정책으로 인해 출입이 거부된 경우 (로비폰이 UID 카드정보를 가지고 있지만, 출입정책으로 인해 출입을 거부하는 경우, 관리PC의 카드정보 자동전송기능 때문에 이를 예방하기 위해
        public static final String mpasswd = "mpasswd";   // 공용 출입비밀번호를 이용한 출입
        public static final String passwd = "passwd";   // 세대비밀번호를 이용한 출입
        public static final String adminpw = "adminpw";   // 관리자 출입 비밀번호를 이용한 출입
        public static final String card = "card";   // 세대 카드를 이용한 출입
        public static final String dcard = "dcard";   // 동 마스터 카드를 이용한 출입
        public static final String mcard = "mcard";   // 마스터 카드를 이용한 출입
        public static final String call = "call";   // 경비실 및 세대 통화에 의한 출입
        public static final String onepass = "onepass";   // 원패스를 이용한 출입
        public static final String V_hcard = "v_hcard";   // 세대 방문자 카드를 이용한 출입
        public static final String V_dcard = "v_dcard";   // 동 방문자 카드를 이용한 출입
        public static final String V_mcard = "v_mcard";   // 전체 방문자 카드를 이용한 출입
        public static final String card_fail = "card_fail";   // 전체 방문자 카드를 이용한 출입
        public static final String TMoney = "tmoney";   // T-Money 카드를 이용한 출입
        public static final String Mifare = "mifare";   // Mifare 카드를 이용한 출입
        public static final String IPARK_NFC = "ipark_nfc";   // 아이파크 NFC를 이용한 출입
        public static final String IPARK_SmartKey = "ipark_smartkey";   // Smart Key 카드를 이용한 출입
        public static final String fingerprint = "fingerprint";   // 지문을 이용한 출입
        public static final String iris = "iris";   // 홍채를 이용한 출입
        public static final String vein = "vein";   // 정맥을 이용한 출입
        public static final String face = "face";   // 안면인식을 이용한 출입
        public static final String hkey = "hkey";   // 세대키
        public static final String dkey = "dkey";   // 동관리자키
        public static final String mkey = "mkey";   // 전체관리자키
    }

    public static class Alarm {
        class Mode {
            public static final String Fired = "fired";
            public static final String Stopped = "stopped";
            public static final String Return = "return";
        }

        class Cause {
            public static final String normal = "normal";
            public static final String fire = "fire";
            public static final String gas = "gas";
            public static final String bugout = "bugout";
            public static final String bugin = "bugin";
            public static final String magnetic = "magnetic";
            public static final String emergency = "emergency";
            public static final String emergency_BT = "emergency_BT";
            public static final String emergency_IO = "emergency_IO";
            public static final String emergency_Comm = "emergency_Comm";
            public static final String fire_IO = "fire_IO";
            public static final String fire_Comm = "fire_Comm";
            public static final String gas_IO = "gas_IO";
            public static final String gas_Comm = "gas_Comm";
            public static final String ladder_Open = "ladder_Open";
            public static final String ladder_Close = "ladder_Close";
            public static final String upladder_Open = "upladder_Open";
            public static final String upladder_Close = "upladder_Close";
            public static final String residentsafety = "residentsafety";
        }
    }

    public static class EventNotify {
        public static final String new_arrival = "new_arrival";   // 새로운 공지사항 존재
        public static final String box_arrival = "box_arrival";   // 택배 도착
        public static final String box_delivered = "box_delivered";   // 택배 출고
        public static final String car_arrival = "car_arrival";   // 등록된 차량 도착
        public static final String epic_completed = "epic_completed";   // 공용 출입비밀번호를 이용한 출입
        public static final String epic_down_fail = "epic_down_fail";   // 세대비밀번호를 이용한 출입
        public static final String elevator_arrived = "elevator_arrived";   // 관리자 출입 비밀번호를 이용한 출입
        public static final String elevator_arrived_up = "elevator_arrived_up";   // 세대 카드를 이용한 출입
        public static final String elevator_up = "elevator_up";   // 동 마스터 카드를 이용한 출입
        public static final String elevator_dn = "elevator_dn";   // 마스터 카드를 이용한 출입
        public static final String elevator_cancel = "elevator_cancel";   // 경비실 및 세대 통화에 의한 출입
        public static final String elevator_move_info_set = "elevator_move_info_set";   // 세대 방문자 카드를 이용한 출입
        public static final String elevator_move_info_clear = "elevator_move_info_clear";   // 동 방문자 카드를 이용한 출입
        public static final String repair_accept = "repair_accept";   // 전체 방문자 카드를 이용한 출입
    }

    public enum BioInfoOwner {
        RESIDENT,
        ZONEMASTER,
        ENTIREMASTER,
        VISITOR,
    }

    public enum BioInfoResult {
        ACCEPTED,
        DENIED,
    }

    public enum BioInfoReason {
        LISTED,
        UNLISTED,
        POLICY,
    }

    public class Button {
        public final static int NUMBER_00 = 7;
        public final static int NUMBER_01 = 8;
        public final static int NUMBER_02 = 9;
        public final static int NUMBER_03 = 10;
        public final static int NUMBER_04 = 11;
        public final static int NUMBER_05 = 12;
        public final static int NUMBER_06 = 13;
        public final static int NUMBER_07 = 14;
        public final static int NUMBER_08 = 15;
        public final static int NUMBER_09 = 16;
        public final static int STAR = 29;
        public final static int SHARP = 30;
        public final static int GUARD = 31;
        public final static int CALL = 32;
        public final static int CANCEL = 33;
        public final static int TACT_GUARD = 34;    // 시각장애인용 점자 버튼 (경비실)
        public final static int TACT_CANCEL = 35;   // 시각장애인용 점자 버튼 (취소)
        public static final int INSIDESENSOR_ACTIVE = 39;   // EM/ES Lock 스위치 눌림 (High)
        public static final int INSIDESENSOR_INACTIVE = 40;   // EM/ES Lock 스위치 눌림해제 (Low)
        public static final int FIRE_ACTIVE = 36;   // 화재알림 (화재 감지시 3초에 한번씩 이벤트 발생)
        public static final int OUTSIDESENSOR_ACTIVE = 37;   // 원패스 기능을 위한 외부 센서 입력 (High)
        public static final int OUTSIDESENSOR_INACTIVE = 38;   // 원패스 기능을 위한 외부 센서 입력 (Low)
        public static final int PROXIMITYSENSOR_ACTIVE = 39; // 근접센서 입력 TODO 근접센서 임시 코드!!!!!!!!!!!! 추후 BSP 적용 후 수정하기!!!!!!!!!!!!
        public static final int PROXIMITYSENSOR_INACTIVE = 40; // 근접센서 입력
    }
}