updated decode library to version 1.5.2

This commit is contained in:
strawmanbobi
2026-01-07 14:25:12 +08:00
parent 9c168384a2
commit a10e3f4a15
7 changed files with 28 additions and 11 deletions

View File

@@ -97,3 +97,8 @@ fabric.properties
target target
private-backend.iml private-backend.iml
private-server.iml private-server.iml
# Downloaded bin cache
bin_cache/
bin_cache/*
bin_cache/**

View File

@@ -27,12 +27,12 @@ public class IRDecode {
private native int irOpenBinary(int category, int subCate, byte[] binaries, int binLength); private native int irOpenBinary(int category, int subCate, byte[] binaries, int binLength);
private native int[] irDecode(int keyCode, ACStatus acStatus, int changeWindDirection); private native int[] irDecode(int keyCode, ACStatus acStatus);
private native void irClose(); private native void irClose();
private native int[] irDecodeCombo(int category, int subCate, byte[] binaries, int binLength, private native int[] irDecodeCombo(int category, int subCate, byte[] binaries, int binLength,
int keyCode, ACStatus acStatus, int changeWindDirection); int keyCode, ACStatus acStatus);
private native TemperatureRange irACGetTemperatureRange(int acMode); private native TemperatureRange irACGetTemperatureRange(int acMode);
@@ -71,22 +71,22 @@ public class IRDecode {
return irOpenBinary(category, subCate, binaries, binLength); return irOpenBinary(category, subCate, binaries, binLength);
} }
public int[] decodeBinary(int keyCode, ACStatus acStatus, int changeWindDir) { public int[] decodeBinary(int keyCode, ACStatus acStatus) {
int[] decoded; int[] decoded;
synchronized (mSync) { synchronized (mSync) {
acStatus = ensureACStatus(acStatus, keyCode); acStatus = ensureACStatus(acStatus, keyCode);
decoded = irDecode(keyCode, acStatus, changeWindDir); decoded = irDecode(keyCode, acStatus);
} }
return decoded; return decoded;
} }
public int[] decodeBinary(int category, int subCate, byte[] binaries, int binLength, public int[] decodeBinary(int category, int subCate, byte[] binaries, int binLength,
int keyCode, ACStatus acStatus, int changeWindDir) { int keyCode, ACStatus acStatus) {
int[] decoded; int[] decoded;
synchronized (mSync) { synchronized (mSync) {
acStatus = ensureACStatus(acStatus, keyCode); acStatus = ensureACStatus(acStatus, keyCode);
decoded = irDecodeCombo(category, subCate, binaries, binLength, decoded = irDecodeCombo(category, subCate, binaries, binLength,
keyCode, acStatus, changeWindDir); keyCode, acStatus);
} }
return decoded; return decoded;
} }

View File

@@ -24,6 +24,7 @@ public class ACStatus {
private int acDisplay; private int acDisplay;
private int acSleep; private int acSleep;
private int acTimer; private int acTimer;
private int changeWindDir;
public ACStatus() { public ACStatus() {
this.acPower = Constants.ACPower.POWER_OFF.getValue(); this.acPower = Constants.ACPower.POWER_OFF.getValue();
@@ -34,10 +35,11 @@ public class ACStatus {
this.acTimer = 0; this.acTimer = 0;
this.acDisplay = 0; this.acDisplay = 0;
this.acSleep = 0; this.acSleep = 0;
this.changeWindDir = 0;
} }
public ACStatus(int acPower, int acMode, int acTemp, int acWindSpeed, int acWindDir, public ACStatus(int acPower, int acMode, int acTemp, int acWindSpeed, int acWindDir,
int acDisplay, int acSleep, int acTimer) { int acDisplay, int acSleep, int acTimer, int changeWindDir) {
this.acPower = acPower; this.acPower = acPower;
this.acTemp = acTemp; this.acTemp = acTemp;
this.acMode = acMode; this.acMode = acMode;
@@ -46,6 +48,7 @@ public class ACStatus {
this.acDisplay = acDisplay; this.acDisplay = acDisplay;
this.acSleep = acSleep; this.acSleep = acSleep;
this.acTimer = acTimer; this.acTimer = acTimer;
this.changeWindDir = changeWindDir;
} }
public int getAcPower() { public int getAcPower() {
@@ -112,4 +115,11 @@ public class ACStatus {
this.acTimer = acTimer; this.acTimer = acTimer;
} }
public int getChangeWindDir() {
return changeWindDir;
}
public void setChangeWindDir(int changeWindDir) {
this.changeWindDir = changeWindDir;
}
} }

View File

@@ -31,7 +31,7 @@ public class Constants {
public static final String ERROR_CODE_INVALID_BRAND_TEXT = "invalid brand"; public static final String ERROR_CODE_INVALID_BRAND_TEXT = "invalid brand";
public static final String ERROR_CODE_INVALID_PARAMETER_TEXT = "invalid parameter"; public static final String ERROR_CODE_INVALID_PARAMETER_TEXT = "invalid parameter";
public static final String ERROR_CODE_INVALID_SESSION_TEXT = "invalid server session"; public static final String ERROR_CODE_INVALID_SESSION_TEXT = "invalid decode session";
public enum CategoryID { public enum CategoryID {
AIR_CONDITIONER(1), AIR_CONDITIONER(1),
@@ -46,7 +46,10 @@ public class Constants {
LIGHT(10), LIGHT(10),
BSTB(11), BSTB(11),
CLEANING_ROBOT(12), CLEANING_ROBOT(12),
AIR_CLEANER(13); AIR_CLEANER(13),
DYSON_SERIES(14),
CAMERA(15),
HEATER(16);
private final int id; private final int id;

View File

@@ -128,7 +128,7 @@ public class OperationLogic {
IRDecode irDecode = IRDecode.getInstance(); IRDecode irDecode = IRDecode.getInstance();
int ret = irDecode.openBinary(categoryId, subCate, binaryContent, binaryContent.length); int ret = irDecode.openBinary(categoryId, subCate, binaryContent, binaryContent.length);
if (0 == ret) { if (0 == ret) {
decoded = irDecode.decodeBinary(keyCode, acStatus, changeWindDirection); decoded = irDecode.decodeBinary(keyCode, acStatus);
} }
irDecode.closeBinary(); irDecode.closeBinary();
return decoded; return decoded;
@@ -270,7 +270,6 @@ public class OperationLogic {
return null; return null;
} }
} }
private InputStream getBinInputStream(String fileName) { private InputStream getBinInputStream(String fileName) {
String downloadURL = IR_BIN_DOWNLOAD_PREFIX + fileName; String downloadURL = IR_BIN_DOWNLOAD_PREFIX + fileName;
try { try {