diff --git a/appmain/defined/ChameleonCMDSet.java b/appmain/defined/ChameleonCMDSet.java new file mode 100644 index 0000000..dde0a99 --- /dev/null +++ b/appmain/defined/ChameleonCMDSet.java @@ -0,0 +1,67 @@ +package com.proxgrind.chameleon.defined; + +public enum ChameleonCMDSet { + HELP, + GET_VERSION, + RESET_DEVICE, + + GET_MEMORY_SIZE, + GET_UID_SIZE, + + SET_CONFIG, + QUERY_CONFIG, + CONFIG_HELP, + + QUERY_UID, + SET_UID, + + QUERY_READONLY, + SET_READONLY, + + UPLOAD_XMODEM, + DOWNLOAD_XMODEM, + + GET_ACTIVE_SLOT, + SET_ACTIVE_SLOT, + CLEAR_ACTIVE_SLOT, + + GET_RIGHT_BUTTON_CLICK, + SET_RIGHT_BUTTON_CLICK, + BUTTON_RIGHT_CLICK_HELP, + + GET_LEFT_BUTTON_CLICK, + SET_LEFT_BUTTON_CLICK, + BUTTON_LEFT_CLICK_HELP, + + GET_RIGHT_BUTTON_LONG_CLICK, + SET_RIGHT_BUTTON_LONG_CLICK, + BUTTON_RIGHT_CLICK_LONG_HELP, + + GET_LEFT_BUTTON_LONG_CLICK, + SET_LEFT_BUTTON_LONG_CLICK, + BUTTON_LEFT_CLICK_LONG_HELP, + + GET_RSSI_VOLTAGE, + UPLOAD_ENCRYPTED, + DETECTION, + DETECTION_CLEAR, + + GET_SAKMODE, + SET_SAKMODE, + GET_SAKMODE_HELP, + + GET_UIDMODE, + SET_UIDMODE, + GET_UIDMODE_HELP, + + GET_TIMEOUT, + SET_TIMEOUT, + GET_TIMEOUT_HELP, + + GETUID_READER, + KEYAUTH, + SETKEY, + GENKEY, + + CLONE, +} diff --git a/appmain/defined/ChameleonClick.java b/appmain/defined/ChameleonClick.java new file mode 100644 index 0000000..18579a3 --- /dev/null +++ b/appmain/defined/ChameleonClick.java @@ -0,0 +1,11 @@ +package com.proxgrind.chameleon.defined; + +public interface ChameleonClick { + String CLICK_CLOSED = "CLOSED"; + String CLICK_RANDOM_UID = "RANDOM_UID"; + String CLICK_UID_LEFT_INCREMENT = "UID_LEFT_INCREMENT"; + String CLICK_UID_RIGHT_INCREMENT = "UID_RIGHT_INCREMENT"; + String CLICK_UID_LEFT_DECREMENT = "UID_LEFT_DECREMENT"; + String CLICK_UID_RIGHT_DECREMENT = "UID_RIGHT_DECREMENT"; + String CLICK_SWITCHCARD = "SWITCHCARD"; +} diff --git a/appmain/defined/ChameleonRespSet.java b/appmain/defined/ChameleonRespSet.java new file mode 100644 index 0000000..1aa85f3 --- /dev/null +++ b/appmain/defined/ChameleonRespSet.java @@ -0,0 +1,91 @@ +package com.proxgrind.chameleon.defined; + +import java.util.HashMap; +import java.util.Map; + + +/** + *

Serial Response Code

+ * The class SerialRespCode contains extended enum definitions of the possible response + * codes returned by the devices. Also provides helper methods. + */ +public enum ChameleonRespSet { + + /** + * List of the status codes and their corresponding text descriptions + * (taken almost verbatim from the ChameleonMini source code). + */ + OK(100), + OK_WITH_TEXT(101), + WAITING_FOR_MODEM(110), + TRUE(121), + FALSE(120), + UNKNOWN_COMMAND(200), + INVALID_COMMAND_USAGE(201), + INVALID_PARAMETER(202), + TIMEOUT(203); + + /** + * Integer value associated with each enum value. + */ + private int responseCode; + + /** + * Constructor + * + * @param rcode + */ + ChameleonRespSet(int rcode) { + responseCode = rcode; + } + + /** + * Stores a maps of integer-valued response codes to their corresponding enum value. + */ + private static final Map RESP_CODE_MAP = new HashMap<>(); + + static { + for (ChameleonRespSet respCode : values()) { + RESP_CODE_MAP.put(respCode.toInteger(), respCode); + } + } + + /** + * Lookup table of String response codes prefixing command return data sent by the devices. + * + * @ref ChameleonIO.isCommandResponse + */ + public static final Map RESP_CODE_TEXT_MAP = new HashMap<>(); + public static final Map RESP_CODE_TEXT_MAP2 = new HashMap<>(); + + /* + * init response code mapping + * */ + static { + for (ChameleonRespSet respCode : values()) { + String rcode = String.valueOf(respCode.toInteger()); + String rcodeText = respCode.name().replace("_", " "); + RESP_CODE_TEXT_MAP.put(rcode + ":" + rcodeText, respCode); + RESP_CODE_TEXT_MAP2.put(rcode, respCode); + } + } + + /** + * Retrieve the integer-valued response code associated with the enum value. + * + * @return int response code + */ + public int toInteger() { + return responseCode; + } + + /** + * Lookup the enum value by its associated integer response code value. + * + * @param rcode + * @return SerialRespCode enum value associated with the integer code + */ + public static ChameleonRespSet lookupByResponseCode(int rcode) { + return RESP_CODE_MAP.get(rcode); + } +} diff --git a/appmain/defined/ChameleonType.java b/appmain/defined/ChameleonType.java new file mode 100644 index 0000000..acef943 --- /dev/null +++ b/appmain/defined/ChameleonType.java @@ -0,0 +1,10 @@ +package com.proxgrind.chameleon.defined; + +public enum ChameleonType { + /* + * 变色龙有版本的区别,分别,G 和 V版本! + * 版本不同命令也不同! + * */ + REVE, + REVG +} diff --git a/appmain/defined/DataChangeListener.java b/appmain/defined/DataChangeListener.java new file mode 100644 index 0000000..f2c3803 --- /dev/null +++ b/appmain/defined/DataChangeListener.java @@ -0,0 +1,8 @@ +package com.proxgrind.chameleon.defined; + +/** + * 在数据有变动时通知某个对象! + */ +public interface DataChangeListener { + void onChange(T y); +} \ No newline at end of file diff --git a/appmain/defined/DecryptCallback.java b/appmain/defined/DecryptCallback.java new file mode 100644 index 0000000..450df80 --- /dev/null +++ b/appmain/defined/DecryptCallback.java @@ -0,0 +1,9 @@ +package com.proxgrind.chameleon.defined; + +import com.proxgrind.chameleon.detection.ResultBean; + +public interface DecryptCallback { + void onMsg(String msg); + + void onKey(ResultBean result); +} \ No newline at end of file diff --git a/appmain/defined/IChameleonExecutor.java b/appmain/defined/IChameleonExecutor.java new file mode 100644 index 0000000..f4c160a --- /dev/null +++ b/appmain/defined/IChameleonExecutor.java @@ -0,0 +1,30 @@ +package com.proxgrind.chameleon.defined; + +import java.io.IOException; + +import com.proxgrind.devices.DriverInterface; + +/** + * 接口,定义变色龙的执行器的功能! + * + * @author DXL + */ +public interface IChameleonExecutor { + boolean initExecutor(DriverInterface com); + + byte[] requestChameleon(String at, int timeout, boolean xmodemMode); + + byte[] requestChameleon(int timeout, int length); + + int requestChameleon(String at, int timeout) throws IOException; + + DriverInterface getDriver(); + + int clear(int timeout); + + void close(); + + String getVersion(); + + boolean isConnected(); +} diff --git a/appmain/defined/OnConnectListener.java b/appmain/defined/OnConnectListener.java new file mode 100644 index 0000000..8f4ce31 --- /dev/null +++ b/appmain/defined/OnConnectListener.java @@ -0,0 +1,7 @@ +package com.proxgrind.chameleon.defined; + +public interface OnConnectListener { + void onConnectStart(); + + void onConnectEnd(); +} diff --git a/appmain/defined/OnDfuRuniingListener.java b/appmain/defined/OnDfuRuniingListener.java new file mode 100644 index 0000000..07419dd --- /dev/null +++ b/appmain/defined/OnDfuRuniingListener.java @@ -0,0 +1,5 @@ +package com.proxgrind.chameleon.defined; + +public interface OnDfuRuniingListener { + void onRun(String address); +} diff --git a/appmain/defined/OnTouchListener.java b/appmain/defined/OnTouchListener.java new file mode 100644 index 0000000..7291767 --- /dev/null +++ b/appmain/defined/OnTouchListener.java @@ -0,0 +1,10 @@ +package com.proxgrind.chameleon.defined; + +import android.view.MotionEvent; + +/* + * 在触发时的回调! + * */ +public interface OnTouchListener { + boolean onTouch(MotionEvent event); +} \ No newline at end of file diff --git a/appmain/defined/RegexCommon.java b/appmain/defined/RegexCommon.java new file mode 100644 index 0000000..a6c16fe --- /dev/null +++ b/appmain/defined/RegexCommon.java @@ -0,0 +1,7 @@ +package com.proxgrind.chameleon.defined; + +public interface RegexCommon { + + //邮箱匹配规则! + String email = "[\\w!#$%&'*+/=?^_`{|}~-]+(?:\\.[\\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\\w](?:[\\w-]*[\\w])?\\.)+[\\w](?:[\\w-]*[\\w])?"; +} diff --git a/appmain/defined/ResultCallback.java b/appmain/defined/ResultCallback.java new file mode 100644 index 0000000..57ba667 --- /dev/null +++ b/appmain/defined/ResultCallback.java @@ -0,0 +1,7 @@ +package com.proxgrind.chameleon.defined; + +public interface ResultCallback { + void onSuccess(S s); + + void onFaild(F f); +}