compatibility to latest decode lib
This commit is contained in:
@@ -205,6 +205,7 @@ public class ControlFragment extends Fragment implements View.OnClickListener {
|
|||||||
acStatus.setAcTemp(Constants.ACTemperature.TEMP_24.getValue());
|
acStatus.setAcTemp(Constants.ACTemperature.TEMP_24.getValue());
|
||||||
acStatus.setAcWindSpeed(Constants.ACWindSpeed.SPEED_AUTO.getValue());
|
acStatus.setAcWindSpeed(Constants.ACWindSpeed.SPEED_AUTO.getValue());
|
||||||
acStatus.setAcWindDir(Constants.ACSwing.SWING_ON.getValue());
|
acStatus.setAcWindDir(Constants.ACSwing.SWING_ON.getValue());
|
||||||
|
acStatus.setChangeWindDir(0);
|
||||||
acStatus.setAcDisplay(0);
|
acStatus.setAcDisplay(0);
|
||||||
acStatus.setAcTimer(0);
|
acStatus.setAcTimer(0);
|
||||||
acStatus.setAcSleep(0);
|
acStatus.setAcSleep(0);
|
||||||
@@ -250,7 +251,7 @@ public class ControlFragment extends Fragment implements View.OnClickListener {
|
|||||||
/* translate key code for AC according to the mapping above */
|
/* translate key code for AC according to the mapping above */
|
||||||
/* ac status is useless for decoding devices other than AC, it's an optional parameter */
|
/* ac status is useless for decoding devices other than AC, it's an optional parameter */
|
||||||
/* change wind dir is an optional parameter, set to 0 as default */
|
/* change wind dir is an optional parameter, set to 0 as default */
|
||||||
return mIRDecode.decodeBinary(inputKeyCode, acStatus, 0);
|
return mIRDecode.decodeBinary(inputKeyCode, acStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onEmitterConnected() {
|
private void onEmitterConnected() {
|
||||||
|
|||||||
BIN
android-example/app/src/main/jniLibs/arm64-v8a/libirdecode.so
Normal file → Executable file
BIN
android-example/app/src/main/jniLibs/arm64-v8a/libirdecode.so
Normal file → Executable file
Binary file not shown.
BIN
android-example/app/src/main/jniLibs/armeabi-v7a/libirdecode.so
Normal file → Executable file
BIN
android-example/app/src/main/jniLibs/armeabi-v7a/libirdecode.so
Normal file → Executable file
Binary file not shown.
BIN
android-example/app/src/main/jniLibs/x86/libirdecode.so
Normal file → Executable file
BIN
android-example/app/src/main/jniLibs/x86/libirdecode.so
Normal file → Executable file
Binary file not shown.
BIN
android-example/app/src/main/jniLibs/x86_64/libirdecode.so
Normal file → Executable file
BIN
android-example/app/src/main/jniLibs/x86_64/libirdecode.so
Normal file → Executable file
Binary file not shown.
@@ -4,7 +4,6 @@ import net.irext.decode.sdk.bean.ACStatus;
|
|||||||
import net.irext.decode.sdk.bean.TemperatureRange;
|
import net.irext.decode.sdk.bean.TemperatureRange;
|
||||||
import net.irext.decode.sdk.utils.Constants;
|
import net.irext.decode.sdk.utils.Constants;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filename: IRDecode.java
|
* Filename: IRDecode.java
|
||||||
* Revised: Date: 2017-04-22
|
* Revised: Date: 2017-04-22
|
||||||
@@ -31,7 +30,7 @@ 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();
|
||||||
|
|
||||||
@@ -46,7 +45,6 @@ public class IRDecode {
|
|||||||
private native int irACGetSupportedWindDirection(int acMode);
|
private native int irACGetSupportedWindDirection(int acMode);
|
||||||
|
|
||||||
private static IRDecode mInstance;
|
private static IRDecode mInstance;
|
||||||
|
|
||||||
public static IRDecode getInstance() {
|
public static IRDecode getInstance() {
|
||||||
if (null == mInstance) {
|
if (null == mInstance) {
|
||||||
mInstance = new IRDecode();
|
mInstance = new IRDecode();
|
||||||
@@ -66,17 +64,17 @@ 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) {
|
||||||
if (null == acStatus) {
|
if (null == acStatus) {
|
||||||
acStatus = new ACStatus();
|
acStatus = new ACStatus();
|
||||||
}
|
}
|
||||||
// validate ac status
|
// validate ac status
|
||||||
if (!validateAcStatus(acStatus, keyCode, changeWindDir)) {
|
if (!validateAcStatus(acStatus, keyCode)) {
|
||||||
return new int[0];
|
return new int[0];
|
||||||
}
|
}
|
||||||
decoded = irDecode(keyCode, acStatus, changeWindDir);
|
decoded = irDecode(keyCode, acStatus);
|
||||||
}
|
}
|
||||||
return decoded;
|
return decoded;
|
||||||
}
|
}
|
||||||
@@ -129,7 +127,7 @@ public class IRDecode {
|
|||||||
return irACGetSupportedWindDirection(acMode);
|
return irACGetSupportedWindDirection(acMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean validateAcStatus(ACStatus acStatus, int keyCode, int changeWindDir) {
|
private boolean validateAcStatus(ACStatus acStatus, int keyCode) {
|
||||||
if (acStatus.getAcPower() != Constants.ACPower.POWER_ON.getValue() &&
|
if (acStatus.getAcPower() != Constants.ACPower.POWER_ON.getValue() &&
|
||||||
acStatus.getAcPower() != Constants.ACPower.POWER_OFF.getValue()) {
|
acStatus.getAcPower() != Constants.ACPower.POWER_OFF.getValue()) {
|
||||||
return false;
|
return false;
|
||||||
@@ -150,7 +148,7 @@ public class IRDecode {
|
|||||||
acStatus.getAcWindDir() > Constants.ACSwing.SWING_OFF.getValue()) {
|
acStatus.getAcWindDir() > Constants.ACSwing.SWING_OFF.getValue()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (changeWindDir != 0 && changeWindDir != 1) {
|
if (acStatus.getChangeWindDir() != 0 && acStatus.getChangeWindDir() != 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user