build-version 1.5.0 launch preparation
1. added compile option for armv7hf 2. fixed JNI component build errors
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
########################################################
|
||||
project(ir_decoder)
|
||||
project(ir_decode)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
add_definitions(-DBOARD_PC)
|
||||
# add_definitions(-DBOARD_PC_JNI)
|
||||
add_definitions(-DBOARD_PC_JNI)
|
||||
# add_definitions(-DDEBUG)
|
||||
|
||||
IF (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
@@ -57,17 +57,23 @@ set(SOURCE_FILES_JNI_SHARED_LIB
|
||||
src/ir_decode.c)
|
||||
|
||||
# SET(CMAKE_SYSTEM_NAME Linux)
|
||||
## ARM32 cross compile
|
||||
# SET(CMAKE_C_COMPILER "/usr/bin/arm-linux-gnueabi-gcc")
|
||||
# SET(CMAKE_CXX_COMPILER "/usr/bin/arm-linux-gnueabi-g++")
|
||||
## ARMv7hf cross compile
|
||||
# SET(CMAKE_C_COMPILER "/usr/bin/arm-linux-gnueabihf-gcc")
|
||||
# SET(CMAKE_CXX_COMPILER "/usr/bin/arm-linux-gnueabihf-g++")
|
||||
# SET(CMAKE_FIND_ROOT_PATH "/usr/bin")
|
||||
|
||||
# SET(CMAKE_SYSTEM_NAME Linux)
|
||||
## ARMv7el cross compile
|
||||
SET(CMAKE_C_COMPILER "/usr/bin/arm-linux-gnueabi-gcc")
|
||||
SET(CMAKE_CXX_COMPILER "/usr/bin/arm-linux-gnueabi-g++")
|
||||
SET(CMAKE_FIND_ROOT_PATH "/usr/bin")
|
||||
|
||||
## ARM64 cross compile
|
||||
# SET(CMAKE_C_COMPILER "/usr/bin/aarch64-linux-gnu-gcc")
|
||||
# SET(CMAKE_CXX_COMPILER "/usr/bin/aarch64-linux-gnu-g++")
|
||||
# SET(CMAKE_FIND_ROOT_PATH "/usr/bin")
|
||||
|
||||
# add_library(ir_decoder SHARED ${SOURCE_FILES_LIB})
|
||||
# add_library(ir_decoder STATIC ${SOURCE_FILES_LIB})
|
||||
add_executable(ir_decoder ${SOURCE_FILES_EXECUTABLE})
|
||||
# add_library(ir_decoder SHARED ${SOURCE_FILES_JNI_SHARED_LIB})
|
||||
# add_library(ir_decode SHARED ${SOURCE_FILES_LIB})
|
||||
# add_library(ir_decode STATIC ${SOURCE_FILES_LIB})
|
||||
# add_executable(ir_decode ${SOURCE_FILES_EXECUTABLE})
|
||||
add_library(ir_decode SHARED ${SOURCE_FILES_JNI_SHARED_LIB})
|
||||
|
||||
@@ -3,9 +3,7 @@ package net.irext.decode.sdk;
|
||||
import net.irext.decode.sdk.bean.ACStatus;
|
||||
import net.irext.decode.sdk.bean.TemperatureRange;
|
||||
import net.irext.decode.sdk.utils.Constants;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
/**
|
||||
* Filename: IRDecode.java
|
||||
@@ -19,11 +17,6 @@ import javax.servlet.ServletContext;
|
||||
*/
|
||||
public class IRDecode {
|
||||
|
||||
private static final String TAG = IRDecode.class.getSimpleName();
|
||||
|
||||
@Autowired
|
||||
private static ServletContext context;
|
||||
|
||||
private static Object mSync = new Object();
|
||||
|
||||
private native String irGetVersion();
|
||||
@@ -56,7 +49,7 @@ public class IRDecode {
|
||||
}
|
||||
|
||||
private IRDecode() {
|
||||
String libPath = "/data/irext/libir_decoder.so";
|
||||
String libPath = "/data/irext/libir_decode.so";
|
||||
System.out.println("loading decode library " + libPath);
|
||||
System.load(libPath);
|
||||
}
|
||||
@@ -74,11 +67,15 @@ public class IRDecode {
|
||||
}
|
||||
|
||||
public int[] decodeBinary(int keyCode, ACStatus acStatus, int changeWindDir) {
|
||||
int[] decoded;
|
||||
int []decoded;
|
||||
synchronized (mSync) {
|
||||
if (null == acStatus) {
|
||||
acStatus = new ACStatus();
|
||||
}
|
||||
// validate ac status
|
||||
if (!validateAcStatus(acStatus, keyCode, changeWindDir)) {
|
||||
return new int[0];
|
||||
}
|
||||
decoded = irDecode(keyCode, acStatus, changeWindDir);
|
||||
}
|
||||
return decoded;
|
||||
@@ -94,7 +91,7 @@ public class IRDecode {
|
||||
|
||||
public int[] getACSupportedMode() {
|
||||
// cool, heat, auto, fan, de-humidification
|
||||
int[] retSupportedMode = {0, 0, 0, 0, 0};
|
||||
int []retSupportedMode = {0, 0, 0, 0, 0};
|
||||
int supportedMode = irACGetSupportedMode();
|
||||
for (int i = Constants.ACMode.MODE_COOL.getValue(); i <=
|
||||
Constants.ACMode.MODE_DEHUMIDITY.getValue(); i++) {
|
||||
@@ -105,7 +102,7 @@ public class IRDecode {
|
||||
|
||||
public int[] getACSupportedWindSpeed(int acMode) {
|
||||
// auto, low, medium, high
|
||||
int[] retSupportedWindSpeed = {0, 0, 0, 0};
|
||||
int []retSupportedWindSpeed = {0, 0, 0, 0};
|
||||
int supportedWindSpeed = irACGetSupportedWindSpeed(acMode);
|
||||
for (int i = Constants.ACWindSpeed.SPEED_AUTO.getValue();
|
||||
i <= Constants.ACWindSpeed.SPEED_HIGH.getValue();
|
||||
@@ -117,7 +114,7 @@ public class IRDecode {
|
||||
|
||||
public int[] getACSupportedSwing(int acMode) {
|
||||
// swing-on, swing-off
|
||||
int[] retSupportedSwing = {0, 0};
|
||||
int []retSupportedSwing= {0, 0};
|
||||
int supportedSwing = irACGetSupportedSwing(acMode);
|
||||
for (int i = Constants.ACSwing.SWING_ON.getValue();
|
||||
i <= Constants.ACSwing.SWING_OFF.getValue();
|
||||
@@ -131,4 +128,31 @@ public class IRDecode {
|
||||
// how many directions supported by specific AC
|
||||
return irACGetSupportedWindDirection(acMode);
|
||||
}
|
||||
|
||||
private boolean validateAcStatus(ACStatus acStatus, int keyCode, int changeWindDir) {
|
||||
if (acStatus.getAcPower() != Constants.ACPower.POWER_ON.getValue() &&
|
||||
acStatus.getAcPower() != Constants.ACPower.POWER_OFF.getValue()) {
|
||||
return false;
|
||||
}
|
||||
if (acStatus.getAcMode() < Constants.ACMode.MODE_COOL.getValue() ||
|
||||
acStatus.getAcMode() > Constants.ACMode.MODE_DEHUMIDITY.getValue()) {
|
||||
return false;
|
||||
}
|
||||
if (acStatus.getAcTemp() < Constants.ACTemperature.TEMP_16.getValue() ||
|
||||
acStatus.getAcTemp() > Constants.ACTemperature.TEMP_30.getValue()) {
|
||||
return false;
|
||||
}
|
||||
if (acStatus.getAcWindSpeed() < Constants.ACWindSpeed.SPEED_AUTO.getValue() ||
|
||||
acStatus.getAcWindSpeed() > Constants.ACWindSpeed.SPEED_HIGH.getValue()) {
|
||||
return false;
|
||||
}
|
||||
if (acStatus.getAcWindDir() < Constants.ACSwing.SWING_ON.getValue() ||
|
||||
acStatus.getAcWindDir() > Constants.ACSwing.SWING_OFF.getValue()) {
|
||||
return false;
|
||||
}
|
||||
if (changeWindDir != 0 && changeWindDir != 1) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,10 @@ public class Constants {
|
||||
LIGHT(10),
|
||||
BSTB(11),
|
||||
CLEANING_ROBOT(12),
|
||||
AIR_CLEANER(13);
|
||||
AIR_CLEANER(13),
|
||||
DYSON_SERIES(14),
|
||||
CAMERA(15),
|
||||
HEATER(16);
|
||||
|
||||
private final int id;
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ INT8 ir_binary_open(const UINT8 category, const UINT8 sub_category, UINT8* binar
|
||||
return IR_DECODE_FAILED;
|
||||
}
|
||||
|
||||
#if (defined(BOARD_PC) || defined (BOARD_PC_DLL))
|
||||
#if (defined(BOARD_PC) || defined (BOARD_PC_DLL) || defined (BOARD_ANDROID))
|
||||
binary_content = (UINT8 *) ir_malloc(bin_length);
|
||||
if (NULL == binary_content)
|
||||
{
|
||||
@@ -228,7 +228,7 @@ INT8 ir_binary_open(const UINT8 category, const UINT8 sub_category, UINT8* binar
|
||||
}
|
||||
memcpy(binary_content, binary, bin_length);
|
||||
#else
|
||||
binary_content = buffer;
|
||||
binary_content = binary;
|
||||
#endif
|
||||
|
||||
ret = ir_tv_binary_open(binary_content, bin_length);
|
||||
|
||||
Reference in New Issue
Block a user