⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 commandid.java

📁 利用Java Socket写的一段通讯协议
💻 JAVA
字号:
package com.ict.netcom2.message;

public class CommandID {

	/**
	 * Command ID
	 */
	public static final int NetPro_Connect = 0x01;

	public static final int NetPro_Connect_ACK = NetPro_Connect	+ Integer.MIN_VALUE;

	public static final int NetPro_Disconnect = 0x02;

	public static final int NetPro_Disconnect_ACK = NetPro_Disconnect + Integer.MIN_VALUE;

	public static final int NetPro_SetComm = 0x03;

	public static final int NetPro_SetComm_ACK = NetPro_SetComm	+ Integer.MIN_VALUE;

	public static final int NetPro_LivingCheck = 0x04;

	public static final int NetPro_LivingCheck_ACK = NetPro_LivingCheck	+ Integer.MIN_VALUE;

	public static final int NetPro_SetKey = 0x05;

	public static final int NetPro_SetKey_ACK = NetPro_SetKey + Integer.MIN_VALUE;

	public static final int NetPro_QuerySysInfo = 0x07;

	public static final int NetPro_QuerySysInfo_REP = NetPro_QuerySysInfo + Integer.MIN_VALUE;

	public static final int NetPro_QueryTask = 0x08;

	public static final int NetPro_QueryTask_REP = NetPro_QueryTask	+ Integer.MIN_VALUE;

	public static final int NetPro_QueryThreads = 0x09;

	public static final int NetPro_QueryThreads_REP = NetPro_QueryThreads + Integer.MIN_VALUE;

	public static final int NetPro_TaskAdd = 0x0a;

	public static final int NetPro_TaskAdd_ACK = NetPro_TaskAdd	+ Integer.MIN_VALUE;

	public static final int NetPro_TaskStop = 0x0b;

	public static final int NetPro_TaskStop_ACK = NetPro_TaskStop + Integer.MIN_VALUE;

	public static final int NetPro_GetResult = 0x0c;

	public static final int NetPro_GetResult_ACK = NetPro_GetResult	+ Integer.MIN_VALUE;

	public static final int NetPro_TaskStatusNotify = 0x0d + Integer.MIN_VALUE;

	public static final int NetPro_EventNotify = 0x0e + Integer.MIN_VALUE;

	public static final int NetCom_Register = 0x0f;

	public static final int NetCom_Register_ACK = NetCom_Register + Integer.MIN_VALUE;

	public static final int NetCom_unRegister = 0x10;

	public static final int NetCom_unRegister_ACK = NetCom_unRegister + Integer.MIN_VALUE;

	public static String getType(int cmdId) {
		
		switch (cmdId) {
		
		case NetPro_Connect:
			return "NetPro_Connect";
			
		case NetPro_Connect_ACK:
			return "NetPro_Connect_ACK";
			
		case NetPro_Disconnect:
			return "NetPro_Disconnect";
			
		case NetPro_Disconnect_ACK:
			return "NetPro_Disconnect_ACK";
			
		case NetPro_SetComm:
			return "NetPro_SetComm";
			
		case NetPro_SetComm_ACK:
			return "NetPro_SetComm_ACK";
			
		case NetPro_LivingCheck:
			return "NetPro_LivingCheck";
			
		case NetPro_LivingCheck_ACK:
			return "NetPro_LivingCheck_ACK";
			
		case NetPro_SetKey:
			return "NetPro_SetKey";
			
		case NetPro_SetKey_ACK:
			return "NetPro_SetKey_ACK";
			
		case NetPro_QuerySysInfo:
			return "NetPro_QuerySysInfo";
			
		case NetPro_QuerySysInfo_REP:
			return "NetPro_QuerySysInfo_REP";
			
		case NetPro_QueryTask:
			return "NetPro_QueryTask";
			
		case NetPro_QueryTask_REP:
			return "NetPro_QueryTask_REP";
			
		case NetPro_QueryThreads:
			return "NetPro_QueryThreads";
			
		case NetPro_QueryThreads_REP:
			return "NetPro_QueryThreads_REP";
			
		case NetPro_TaskAdd:
			return "NetPro_TaskAdd";
			
		case NetPro_TaskAdd_ACK:
			return "NetPro_TaskAdd_ACK";
			
		case NetPro_TaskStop:
			return "NetPro_TaskStop";
			
		case NetPro_TaskStop_ACK:
			return "NetPro_TaskStop_ACK";
			
		case NetPro_GetResult:
			return "NetPro_GetResult";
			
		case NetPro_GetResult_ACK:
			return "NetPro_GetResult_ACK";
			
		case NetPro_TaskStatusNotify:
			return "NetPro_TaskStatusNotify";
			
		case NetPro_EventNotify:
			return "NetPro_EventNotify";
			
		case NetCom_Register:
			return "NetCom_Register";
			
		case NetCom_Register_ACK:
			return "NetCom_Register_ACK";
			
		case NetCom_unRegister:
			return "NetCom_unRegister";
			
		case NetCom_unRegister_ACK:
			return "NetCom_unRegister_ACK";
			
		default:
			return null;
		}
	}

	public static void main(String[] str) {
		System.out.println(NetPro_Disconnect_ACK);
		System.out.println((int) Long.parseLong("80000002", 16));

	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -