mirror of
https://github.com/RfidResearchGroup/ChameleonBLEAPI.git
synced 2026-05-12 11:20:47 -07:00
Add files via upload
This commit is contained in:
@@ -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,
|
||||
}
|
||||
@@ -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";
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.proxgrind.chameleon.defined;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* <h1>Serial Response Code</h1>
|
||||
* 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<Integer, ChameleonRespSet> 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<String, ChameleonRespSet> RESP_CODE_TEXT_MAP = new HashMap<>();
|
||||
public static final Map<String, ChameleonRespSet> 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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.proxgrind.chameleon.defined;
|
||||
|
||||
public enum ChameleonType {
|
||||
/*
|
||||
* 变色龙有版本的区别,分别,G 和 V版本!
|
||||
* 版本不同命令也不同!
|
||||
* */
|
||||
REVE,
|
||||
REVG
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.proxgrind.chameleon.defined;
|
||||
|
||||
/**
|
||||
* 在数据有变动时通知某个对象!
|
||||
*/
|
||||
public interface DataChangeListener<T> {
|
||||
void onChange(T y);
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.proxgrind.chameleon.defined;
|
||||
|
||||
public interface OnConnectListener {
|
||||
void onConnectStart();
|
||||
|
||||
void onConnectEnd();
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.proxgrind.chameleon.defined;
|
||||
|
||||
public interface OnDfuRuniingListener {
|
||||
void onRun(String address);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.proxgrind.chameleon.defined;
|
||||
|
||||
import android.view.MotionEvent;
|
||||
|
||||
/*
|
||||
* 在触发时的回调!
|
||||
* */
|
||||
public interface OnTouchListener {
|
||||
boolean onTouch(MotionEvent event);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.proxgrind.chameleon.defined;
|
||||
|
||||
public interface RegexCommon {
|
||||
|
||||
//邮箱匹配规则!
|
||||
String email = "[\\w!#$%&'*+/=?^_`{|}~-]+(?:\\.[\\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\\w](?:[\\w-]*[\\w])?\\.)+[\\w](?:[\\w-]*[\\w])?";
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.proxgrind.chameleon.defined;
|
||||
|
||||
public interface ResultCallback<S, F> {
|
||||
void onSuccess(S s);
|
||||
|
||||
void onFaild(F f);
|
||||
}
|
||||
Reference in New Issue
Block a user