resolved conflicts
This commit is contained in:
@@ -200,6 +200,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);
|
||||||
@@ -245,11 +246,6 @@ 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 */
|
||||||
if (mIRSocketEmitter.getConnectionStatus() == IRSocketEmitter.EMITTER_CONNECTED) {
|
|
||||||
decodeOnBoard(inputKeyCode, acStatus, 0);
|
|
||||||
} else {
|
|
||||||
decodeInApp(inputKeyCode, acStatus, 0);
|
|
||||||
}
|
|
||||||
return mIRDecode.decodeBinary(inputKeyCode, acStatus, 0);
|
return mIRDecode.decodeBinary(inputKeyCode, acStatus, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -27,7 +26,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();
|
||||||
|
|
||||||
@@ -42,7 +41,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();
|
||||||
@@ -51,11 +49,10 @@ public class IRDecode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private IRDecode() {
|
private IRDecode() {
|
||||||
String libPath = "/data/irext/libir_decode.so";
|
String libPath = "/data/irext/libirdecode_jni.so";
|
||||||
System.out.println("loading decode library " + libPath);
|
System.out.println("loading decode library " + libPath);
|
||||||
System.load(libPath);
|
System.load(libPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getVersion() {
|
public String getVersion() {
|
||||||
return irGetVersion();
|
return irGetVersion();
|
||||||
}
|
}
|
||||||
@@ -68,17 +65,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;
|
||||||
}
|
}
|
||||||
@@ -131,7 +128,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;
|
||||||
@@ -152,7 +149,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;
|
||||||
@@ -166,7 +163,7 @@ public class IRDecode {
|
|||||||
1,
|
1,
|
||||||
"/home/strawmanbobi/Downloads/test.bin")) {
|
"/home/strawmanbobi/Downloads/test.bin")) {
|
||||||
int[] decoded =
|
int[] decoded =
|
||||||
irDecoder.decodeBinary(1, null, 0);
|
irDecoder.decodeBinary(1, null);
|
||||||
for (int i = 0; i < decoded.length; i++) {
|
for (int i = 0; i < decoded.length; i++) {
|
||||||
System.out.print(decoded[i]);
|
System.out.print(decoded[i]);
|
||||||
if (i != decoded.length - 1) {
|
if (i != decoded.length - 1) {
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
11
java-example/java-example.iml
Normal file
11
java-example/java-example.iml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/decodesdk/src" isTestSource="false" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
Reference in New Issue
Block a user