resolved decode example jni names issue for Android

This commit is contained in:
2017-05-11 13:32:10 +08:00
parent 97e3292d97
commit 81d63de77a
4 changed files with 12 additions and 73 deletions

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinCommonCompilerArguments">
<option name="languageVersion" value="1.1" />
<option name="apiVersion" value="1.1" />
</component>
</project>

29
Android/.idea/misc.xml generated
View File

@@ -1,33 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="EntryPointsManager"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<entry_points version="2.0" />
</component>
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">

6
Android/.idea/vcs.xml generated
View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@@ -22,11 +22,11 @@ public class IRDecode {
System.loadLibrary("irdecode"); System.loadLibrary("irdecode");
} }
private native int irACLibOpen(String fileName); private native int irOpen(int category, int subCate, String fileName);
private native int[] irACControl(ACStatus acStatus, int functionCode); private native int[] irDecode(int keyCode, ACStatus acStatus, int changeWindDirection);
private native void irACLibClose(); private native void irClose();
private native TemperatureRange irACGetTemperatureRange(int acMode); private native TemperatureRange irACGetTemperatureRange(int acMode);
@@ -36,12 +36,6 @@ public class IRDecode {
private native int irACGetSupportedSwing(int acMode); private native int irACGetSupportedSwing(int acMode);
private native int irTVLibOpen(String fileName, int irHexEncode);
private native int[] irTVControl(int key_number);
private native void irTVLibClose();
private static IRDecode mInstance; private static IRDecode mInstance;
public static IRDecode getInstance() { public static IRDecode getInstance() {
@@ -51,16 +45,16 @@ public class IRDecode {
return mInstance; return mInstance;
} }
public int openACBinary(String fileName) { public int openBinary(int category, int subCate, String fileName) {
return irACLibOpen(fileName); return irOpen(category, subCate, fileName);
} }
public int[] decodeACBinary(ACStatus acStatus, int functionCode) { public int[] decodeBinary(int keyCode, ACStatus acStatus, int changeWindDir) {
return irACControl(acStatus, functionCode); return irDecode(keyCode, acStatus, changeWindDir);
} }
public void closeACBinary() { public void closeBinary() {
irACLibClose(); irClose();
} }
public TemperatureRange getTemperatureRange(int acMode) { public TemperatureRange getTemperatureRange(int acMode) {
@@ -71,7 +65,8 @@ public class IRDecode {
// cool, heat, auto, fan, de-humidification // cool, heat, auto, fan, de-humidification
int []retSupportedMode = {0, 0, 0, 0, 0}; int []retSupportedMode = {0, 0, 0, 0, 0};
int supportedMode = irACGetSupportedMode(); int supportedMode = irACGetSupportedMode();
for (int i = Constants.ACMode.MODE_COOL.getValue(); i <= Constants.ACMode.MODE_DEHUMIDITY.getValue(); i++) { for (int i = Constants.ACMode.MODE_COOL.getValue(); i <=
Constants.ACMode.MODE_DEHUMIDITY.getValue(); i++) {
retSupportedMode[i] = (supportedMode >>> 1) & 1; retSupportedMode[i] = (supportedMode >>> 1) & 1;
} }
return retSupportedMode; return retSupportedMode;
@@ -100,20 +95,4 @@ public class IRDecode {
} }
return retSupportedSwing; return retSupportedSwing;
} }
public int openTVBinary(String fileName, int subCategory) {
int isHexType = 0;
if (2 == subCategory) {
isHexType = 1;
}
return irTVLibOpen(fileName, isHexType);
}
public int[] decodeTVBinary(int keyCode) {
return irTVControl(keyCode);
}
public void closeTVBinary() {
irTVLibClose();
}
} }