package org.ts.ddcs.tool;

public class GBConstants {

	public final static String VERSION_KEY_SZY_54 ="5.4";
	public final static String  BASE_KEY_SERVER_MASTER ="server_master";
	public final static String  BASE_KEY_COLLECT_SERVER ="collect_server_id";
	public final static String  BASE_KEY_COLLECT_SERVER_GROUP ="collect_server_id_group";
	public final static String  BASE_KEY_RTU ="rtuCode";
	public final static String  BASE_KEY_AGREEMENT ="agreement";
	public final static String  BASE_KEY_DATAGRAM ="datagram";
	public final static String  BASE_KEY_VERSION ="version";
	public final static String  BASE_KEY_SETTING ="setting_datagram";
	public final static String  BASE_KEY_ORGID ="orgId";
	public final static String  BASE_KEY_DATAGRAM_PICK_TM ="datagramPickTime";
	public final static String  BASE_KEY_WARNING_INFO ="warningInfo";
	public final static String  BASE_KEY_WARNING_KIND ="warningKind";
	public final static String  BASE_KEY_WARNING_CHECK_TIME ="checkTime";


	public final static String  RELAY_KEY_URL ="key_url";
	public final static String  RELAY_KEY_CHANNEL ="key_channel";
	public final static String  RELAY_KEY_MQ ="MQ";
	public final static String  RELAY_KEY_HTTP ="HTTP";
	public final static String  RELAY_KEY_QUEUE ="key_queue";
	public final static String  HTTP_REQUEST_KEY_CODE ="code";
	public final static String  HTTP_REQUEST_KEY_OK ="0";
	public final static String  HTTP_REQUEST_KEY_ERROR ="1";


	public final static String AGREEMENT_KIND_SW="sw2014";
	public final static String AGREEMENT_KIND_SZY="szy2012";


	public final static String REDIS_KEY ="redis_key";
	public final static String REDIS_KEY_COMMAND_QUERY ="command:query";
	public final static String REDIS_KEY_COMMAND_SETTING = "command:setting";
	public final static String REDIS_KEY_COMMAND_FILE = "command:file";
	public final static String REDIS_KEY_SERVER_MASTER ="server_master";
	public final static String REDIS_KEY_COLLECT_SERVER ="collect_server_id";
	public final static String REDIS_KEY_RTU_SPACE_TIME ="spaceTime";
	public final static String REDIS_KEY_RTU_STATUS_DATAGRAM ="statusDatagram";
	public final static String REDIS_KEY_PROJECT_PREFIX ="project_";
	public final static String REDIS_KEY_PROJECT_ID ="projectId";
	public final static String REDIS_KEY_AGREEMENT ="agreement";

	public final static String WARNING_TYPE_UNDEFINE ="0";//未定义预警类型
	public final static String WARNING_TYPE_OFFLINE ="1"; //RTU设备在线预警
	public final static String WARNING_TYPE_DATAGRAM_DELAY ="2";//报文上报延时
	public final static String WARNING_TYPE_RTU_FAULT_SE ="3";//水位计故障
	public final static String WARNING_TYPE_RTU_FAULT_AC ="4";//交流电故障
	public final static String WARNING_TYPE_RTU_FAULT_BV ="5";//电池电压故障
	public final static String WARNING_TYPE_RTU_COLLECT_TIME_ERROR ="6";//采集时间错误
	public final static String WARNING_TYPE_CRC_ERROR ="7";//CRC检验错误
	public final static String WARNING_TYPE_OUTLIER_DATA ="8";//异常数据
    public final static String WARNING_TYPE_SD_DAMAGE ="9";//SD卡损坏

	public final static String RTU_STATUS_INFO_NAME_WSE ="waterLevelDeviceStatus";//水位计
	public final static String RTU_STATUS_INFO_NAME_ACC ="alternatingCurrentCharging";//交流电
	public final static String RTU_STATUS_INFO_NAME_BV ="batteryVoltage";//电池电压
	public final static String RTU_STATUS_INFO_NAME_PV ="powerVoltage";//电源电压

	public final static long BASE_RTU_FRESH_CONNECT_TIME = 90000;

	public final static String RELAY_DATAGRAM_ACTIVE="1";
	public final static String RELAY_DATAGRAM_ENABLE="0";
	public final static String RELAY_DATAGRAM_REMOTE_IP_KEY="relayIp";
	public final static String RELAY_DATAGRAM_KEY="relay";


	public final static String SERVER_MESSAGE_KIND_RUNNING ="1";

//	/**
//	 * GPRS帧类型
//	 */
	public final static int GPRS_TYPE_LOGIN = 0x01; //登录帧
	public final static int GPRS_TYPE_LOGIN_REPLY = 0x02; //登录应答帧
	public final static int GPRS_TYPE_LOGOUT = 0x03; //注销帧
	public final static int GPRS_TYPE_LOGOUT_REPLY = 0x04; //注销应答帧
	public final static int GPRS_TYPE_DATA = 0x05; //数据帧
	public final static int GPRS_TYPE_DATA_REPLY = 0x06; //数据应答帧，暂时不用
	public final static int GPRS_TYPE_HEART = 0x07; //心跳帧
	public final static int GPRS_TYPE_HEART_REPLY = 0x08; //心跳应答帧



	/**
	 * AFN
	 */
	// 链路检测
	public final static int DATA_AFN_LOGIN = 0x02;
	
	// 参数设置及查询
	public final static int DATA_AFN_RESET = 0x01; //复位命令
	
	
	
	public final static int DATA_AFN_SETWORKPATTERN = 0x07; //设置终端工作模式
	public final static int DATA_AFN_QUERYWORKPATTERN = 0x08; //查询终端工作模式
	public final static int DATA_AFN_SETTIMINGINTERVAL = 0x09; //设置终端自报时间间隔及时间起点
	public final static int DATA_AFN_QUERYTIMINGINTERVAL = 0x0A; //查询终端自报时间间隔及时间起点
	
	public final static int DATA_AFN_SETALTITUDE = 0x14; //设置终端井口高程、水位下限及水位计量程
	public final static int DATA_AFN_QUERYALTITUDE = 0x15; //查询终端井口高程、水位下限及水位计量程
	
	public final static int DATA_AFN_SETSIMID = 0x17; //设置终端SIM卡ID号
	public final static int DATA_AFN_QUERYSIMID = 0x18; //查询终端SIM卡ID号
	public final static int DATA_AFN_QUERYHISTIMEVALUE = 0x19; //查询终端某一天的历史记录
	
	public final static int DATA_AFN_CLEARHISDATA = 0x1B; //清空终端历史数据
	
//	public final static int DATA_AFN_QUERYREALTIMEVALUE = 0x16; //查询终端水位实时值
//	public final static int DATA_AFN_QUERYREALTIMEWATERQUALITY = 0x26; //查询终端水质实时值
	
	//GZ设置终端地址
	public final static int DATA_AFN_SETADDRESS = 0x10; 
	//GZ查询终端地址
	public final static int DATA_AFN_QUERYADDRESS = 0x50; 
	
	//GZ设置终端时钟
	public final static int DATA_AFN_SETCLOCK = 0x11; //设置终端时钟
	//GZ查询终端时钟
	public final static int DATA_AFN_QUERYCLOCK = 0x51; 
	//GZ定时自报数据
	public final static int DATA_AFN_TIMINGDATA = 0xC0;
	//GZ随机自报报警数据
	public final static int DATA_AFN_WARNING = 0x81; 
	//GZ查询终端实时值
	public final static int DATA_AFN_QUERYREALTIMEVALUE = 0xB0; 
	
	//GZ查询终端报警状态和终端状态
	public final static int DATA_AFN_QUERYWARNINGSTATUS = 0x5E; 
	
	
	/*
	 * zs20141025 用水计量 命令
	 */
	public final static int DATA_AFN_QUERY_WATER_INSTANTFLOW = 0x16; //查询用水瞬时流量
	public final static int DATA_AFN_QUERY_WATER_TOTALFLOW = 0x26; //查询用水累计流量
	public final static int DATA_AFN_WATERMEASURE_TIMINGDATA = 0x29;//zs20141025 定时自报数据
	
	public final static int DATA_AFN_SETRESPONSE = 0x00; //设置命令执行后返回的响应
	
	
	
	
	
	public final static int MAX_FCB = 3;
	
	// 控制域功能码
	public final static int CONTROL_DIR0_FN_COMMAN_CONFIRM = 1;
	public final static int CONTROL_DIR0_FN_QUERY_STATUS = 4;
	
	/*
	 * GZ 功能码 水位参数
	 */
	public final static int CONTROL_DIR0_FN_QUERY_WATERLEVEL = 2;//5改为2 zs20151204 modify
	
	/*
	 * GZ 功能码 水质参数
	 */
	public final static int CONTROL_DIR0_FN_QUERY_WATERQUALITY = 10;
	
	/*
	 * GZ 报警和状态参数
	 */
	public final static int CONTROL_DIR0_FN_QUERY_RTUSTATUS = 13;
	
	/*
	 * GZ 功能码 流量（水量）
	 */
	public final static int CONTROL_DIR0_FN_QUERY_WATERFLOW = 3;
	
	
	
	
	public final static int CONTROL_DIR0_FN_QUERY_WARNPARAM = 6;
	
	
	public final static int CONTROL_DIR1_FN_REPLY_CONFIRM = 1;
	public final static int CONTROL_DIR1_FN_REPLY_NODATA = 2;
	public final static int CONTROL_DIR1_FN_REPLY_STATUS = 4;
	public final static int CONTROL_DIR0_FN_REPLY_WATERLEVEL = 5;
	public final static int CONTROL_DIR0_FN_REPLY_WARNPARAM = 6;
	
	
	/**
	 * 报警种类
	 */
	public final static int WARN_AC_OFF = 0x0001; //工作用交流电停电
	public final static int WARN_DC_OFF = 0x0002; //蓄电池电压低
	public final static int WARN_EQUIP_ERR = 0x0020; //流量仪表故障
	public final static int WARN_PUMP_ERR = 0x0040; //水泵故障
	public final static int WARN_QUAN_LIMIT = 0x0080; //剩余水量下限报警
	
	public final static int WARN_TERM_IC = 0x0400; //终端IC卡功能报警
	public final static int WARN_VAL_CON = 0x0800; //定值控制报警
	public final static int WARN_TERM_STATE = 0x2000; //终端箱门状态报警
	

}

