cleaned unused examples - 1

This commit is contained in:
2019-01-16 10:16:35 +08:00
parent 31f6aefb85
commit 93e117c79f
71 changed files with 0 additions and 881 deletions

View File

@@ -0,0 +1 @@
ndk-build NDK_PROJECT_PATH=./ NDK_APPLICATION_MK=./Application.mk

View File

@@ -0,0 +1,170 @@
/**************************************************************************************************
Filename: ir_decode_jni.c
Revised: Date: 2016-03-21
Revision: Revision: 1.0
Description: This file links to java layer for Android application
Revision log:
* 2016-03-21: created by strawmanbobi
**************************************************************************************************/
#include <stdlib.h>
#include <stdio.h>
#include "ir_decode_jni.h"
#include "../include/ir_defs.h"
#include "../include/ir_decode.h"
// global variable definition
extern size_t binary_length;
extern UINT8 *binary_content;
JNIEXPORT jint JNICALL Java_net_irext_decodesdk_IRDecode_irOpen
(JNIEnv *env, jobject this_obj, jint category_id, jint sub_cate, jstring file_name)
{
const char *n_file_name = (*env)->GetStringUTFChars(env, file_name, 0);
if (IR_DECODE_FAILED == ir_file_open(category_id, sub_cate, n_file_name))
{
ir_close();
(*env)->ReleaseStringUTFChars(env, file_name, n_file_name);
return IR_DECODE_FAILED;
}
(*env)->ReleaseStringUTFChars(env, file_name, n_file_name);
return IR_DECODE_SUCCEEDED;
}
JNIEXPORT jint JNICALL Java_net_irext_decodesdk_IRDecode_irOpenBinary
(JNIEnv *env, jobject this_obj, jint category_id, jint sub_cate,
jbyteArray binaries, jint bin_length)
{
jbyte* j_buffer = (*env)->GetByteArrayElements(env, binaries, 0);
unsigned char* buffer = (unsigned char*)j_buffer;
if (IR_DECODE_FAILED == ir_binary_open(category_id, sub_cate, buffer, bin_length))
{
ir_close();
(*env)->ReleaseByteArrayElements(env, binaries, j_buffer, JNI_ABORT);
return IR_DECODE_FAILED;
}
return IR_DECODE_SUCCEEDED;
}
JNIEXPORT jintArray JNICALL Java_net_irext_decodesdk_IRDecode_irDecode
(JNIEnv *env, jobject this_obj, jint key_code, jobject jni_ac_status, jint change_wind_direction)
{
UINT16 user_data[USER_DATA_SIZE];
int i = 0;
jint copy_array[USER_DATA_SIZE] = {0};
remote_ac_status_t ac_status;
jclass n_ac_status = (*env)->GetObjectClass(env, jni_ac_status);
if (NULL != n_ac_status)
{
jfieldID ac_power_fid = (*env)->GetFieldID(env, n_ac_status, "acPower", "I");
jint i_ac_power = (*env)->GetIntField(env, jni_ac_status, ac_power_fid);
jfieldID ac_mode_fid = (*env)->GetFieldID(env, n_ac_status, "acMode", "I");
jint i_ac_mode = (*env)->GetIntField(env, jni_ac_status, ac_mode_fid);
jfieldID ac_temp_fid = (*env)->GetFieldID(env, n_ac_status, "acTemp", "I");
jint i_ac_temp = (*env)->GetIntField(env, jni_ac_status, ac_temp_fid);
jfieldID ac_wind_dir_fid = (*env)->GetFieldID(env, n_ac_status, "acWindDir", "I");
jint i_ac_wind_dir = (*env)->GetIntField(env, jni_ac_status, ac_wind_dir_fid);
jfieldID ac_wind_speed_fid = (*env)->GetFieldID(env, n_ac_status, "acWindSpeed", "I");
jint i_ac_wind_speed = (*env)->GetIntField(env, jni_ac_status, ac_wind_speed_fid);
ac_status.acDisplay = 0;
ac_status.acSleep = 0;
ac_status.acTimer = 0;
ac_status.acPower = i_ac_power;
ac_status.acMode = i_ac_mode;
ac_status.acTemp = i_ac_temp;
ac_status.acWindDir = i_ac_wind_dir;
ac_status.acWindSpeed = i_ac_wind_speed;
}
int wave_code_length = ir_decode(key_code, user_data, &ac_status, change_wind_direction);
jintArray result = (*env)->NewIntArray(env, wave_code_length);
if (result == NULL)
{
return NULL; /* out of memory error thrown */
}
for (i = 0; i < wave_code_length; i++)
{
copy_array[i] = (int)user_data[i];
}
(*env)->SetIntArrayRegion(env, result, 0, wave_code_length, copy_array);
(*env)->DeleteLocalRef(env, n_ac_status);
return result;
}
JNIEXPORT void JNICALL Java_net_irext_decodesdk_IRDecode_irClose
(JNIEnv *env, jobject this_obj)
{
ir_close();
}
JNIEXPORT jobject JNICALL Java_net_irext_decodesdk_IRDecode_irACGetTemperatureRange
(JNIEnv *env, jobject this_obj, jint ac_mode)
{
int tempMin = 0;
int tempMax = 0;
jobject temperature_range = NULL;
jclass temperature_range_class =
(*env)->FindClass(env, "com/irext/remote/bean/jnibean/JNITemperatureRange");
jmethodID temperature_range_mid =
(*env)->GetMethodID(env, temperature_range_class, "<init>", "()V");
jfieldID min_temp_fid = (*env)->GetFieldID(env, temperature_range_class, "tempMin", "I");
jfieldID max_temp_fid = (*env)->GetFieldID(env, temperature_range_class, "tempMax", "I");
temperature_range = (*env)->NewObject(env, temperature_range_class, temperature_range_mid);
get_temperature_range((UINT8)ac_mode, (INT8*)&tempMin, (INT8*)&tempMax);
(*env)->SetIntField(env, temperature_range, min_temp_fid, tempMin);
(*env)->SetIntField(env, temperature_range, max_temp_fid, tempMax);
return temperature_range;
}
JNIEXPORT jint JNICALL Java_net_irext_decodesdk_IRDecode_irACGetSupportedMode
(JNIEnv *env, jobject this_obj)
{
int supported_mode = 0;
get_supported_mode((UINT8*)&supported_mode);
return supported_mode;
}
JNIEXPORT jint JNICALL Java_net_irext_decodesdk_IRDecode_irACGetSupportedWindSpeed
(JNIEnv *env, jobject this_obj, jint ac_mode)
{
int supported_wind_speed = 0;
get_supported_wind_speed((UINT8)ac_mode, (UINT8*)&supported_wind_speed);
return supported_wind_speed;
}
JNIEXPORT jint JNICALL Java_net_irext_decodesdk_IRDecode_irACGetSupportedSwing
(JNIEnv *env, jobject this_obj, jint ac_mode)
{
int supported_swing = 0;
get_supported_swing((UINT8)ac_mode, (UINT8*)&supported_swing);
return supported_swing;
}
JNIEXPORT jint JNICALL Java_net_irext_decodesdk_IRDecode_irACGetSupportedWindDirection
(JNIEnv *env, jobject this_obj)
{
int supported_wind_direction = 0;
get_supported_wind_direction((UINT8*)&supported_wind_direction);
return supported_wind_direction;
}

View File

@@ -0,0 +1,148 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#if defined BOARD_ANDROID
#include <jni.h>
#elif (defined BOARD_PC) && (defined BOARD_PC_JNI)
#include "./include/jni.h"
#endif
/* Header for class net_irext_decodesdk_IRDecode */
#ifndef _Included_net_irext_decodesdk_IRDecode
#define _Included_net_irext_decodesdk_IRDecode
#ifdef __cplusplus
extern "C" {
#endif
#undef net_irext_decodesdk_IRDecode_BIND_ABOVE_CLIENT
#define net_irext_decodesdk_IRDecode_BIND_ABOVE_CLIENT 8L
#undef net_irext_decodesdk_IRDecode_BIND_ADJUST_WITH_ACTIVITY
#define net_irext_decodesdk_IRDecode_BIND_ADJUST_WITH_ACTIVITY 128L
#undef net_irext_decodesdk_IRDecode_BIND_ALLOW_OOM_MANAGEMENT
#define net_irext_decodesdk_IRDecode_BIND_ALLOW_OOM_MANAGEMENT 16L
#undef net_irext_decodesdk_IRDecode_BIND_AUTO_CREATE
#define net_irext_decodesdk_IRDecode_BIND_AUTO_CREATE 1L
#undef net_irext_decodesdk_IRDecode_BIND_DEBUG_UNBIND
#define net_irext_decodesdk_IRDecode_BIND_DEBUG_UNBIND 2L
#undef net_irext_decodesdk_IRDecode_BIND_IMPORTANT
#define net_irext_decodesdk_IRDecode_BIND_IMPORTANT 64L
#undef net_irext_decodesdk_IRDecode_BIND_NOT_FOREGROUND
#define net_irext_decodesdk_IRDecode_BIND_NOT_FOREGROUND 4L
#undef net_irext_decodesdk_IRDecode_BIND_WAIVE_PRIORITY
#define net_irext_decodesdk_IRDecode_BIND_WAIVE_PRIORITY 32L
#undef net_irext_decodesdk_IRDecode_CONTEXT_IGNORE_SECURITY
#define net_irext_decodesdk_IRDecode_CONTEXT_IGNORE_SECURITY 2L
#undef net_irext_decodesdk_IRDecode_CONTEXT_INCLUDE_CODE
#define net_irext_decodesdk_IRDecode_CONTEXT_INCLUDE_CODE 1L
#undef net_irext_decodesdk_IRDecode_CONTEXT_RESTRICTED
#define net_irext_decodesdk_IRDecode_CONTEXT_RESTRICTED 4L
#undef net_irext_decodesdk_IRDecode_MODE_APPEND
#define net_irext_decodesdk_IRDecode_MODE_APPEND 32768L
#undef net_irext_decodesdk_IRDecode_MODE_ENABLE_WRITE_AHEAD_LOGGING
#define net_irext_decodesdk_IRDecode_MODE_ENABLE_WRITE_AHEAD_LOGGING 8L
#undef net_irext_decodesdk_IRDecode_MODE_MULTI_PROCESS
#define net_irext_decodesdk_IRDecode_MODE_MULTI_PROCESS 4L
#undef net_irext_decodesdk_IRDecode_MODE_PRIVATE
#define net_irext_decodesdk_IRDecode_MODE_PRIVATE 0L
#undef net_irext_decodesdk_IRDecode_MODE_WORLD_READABLE
#define net_irext_decodesdk_IRDecode_MODE_WORLD_READABLE 1L
#undef net_irext_decodesdk_IRDecode_MODE_WORLD_WRITEABLE
#define net_irext_decodesdk_IRDecode_MODE_WORLD_WRITEABLE 2L
#undef net_irext_decodesdk_IRDecode_START_CONTINUATION_MASK
#define net_irext_decodesdk_IRDecode_START_CONTINUATION_MASK 15L
#undef net_irext_decodesdk_IRDecode_START_FLAG_REDELIVERY
#define net_irext_decodesdk_IRDecode_START_FLAG_REDELIVERY 1L
#undef net_irext_decodesdk_IRDecode_START_FLAG_RETRY
#define net_irext_decodesdk_IRDecode_START_FLAG_RETRY 2L
#undef net_irext_decodesdk_IRDecode_START_NOT_STICKY
#define net_irext_decodesdk_IRDecode_START_NOT_STICKY 2L
#undef net_irext_decodesdk_IRDecode_START_REDELIVER_INTENT
#define net_irext_decodesdk_IRDecode_START_REDELIVER_INTENT 3L
#undef net_irext_decodesdk_IRDecode_START_STICKY
#define net_irext_decodesdk_IRDecode_START_STICKY 1L
#undef net_irext_decodesdk_IRDecode_START_STICKY_COMPATIBILITY
#define net_irext_decodesdk_IRDecode_START_STICKY_COMPATIBILITY 0L
/*
* Class: net_irext_decodesdk_IRDecode
* Method: irOpen
* Signature: II(Ljava/lang/String;)
*/
JNIEXPORT jint JNICALL Java_net_irext_decodesdk_IRDecode_irOpen
(JNIEnv *, jobject, jint, jint, jstring);
/*
* Class: net_irext_decodesdk_IRDecode
* Method: irOpenBinary
* Signature: II(Ljava/lang/String;)
*/
JNIEXPORT jint JNICALL Java_net_irext_decodesdk_IRDecode_irOpenBinary
(JNIEnv *, jobject, jint, jint, jbyteArray, jint);
/*
* Class: net_irext_decodesdk_IRDecode
* Method: irDecode
* Signature: I(Lnet/irext/decodesdk/bean/ACStatus;I)[I
*/
JNIEXPORT jintArray JNICALL Java_net_irext_decodesdk_IRDecode_irDecode
(JNIEnv *, jobject, jint, jobject, jint);
/*
* Class: net_irext_decodesdk_IRDecode
* Method: irClose
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_net_irext_decodesdk_IRDecode_irClose
(JNIEnv *, jobject);
/*
* Class: net_irext_decodesdk_IRDecode
* Method: irACGetTemperatureRange
* Signature: (I)Lcom/irext/remote/bean/jnibean/TemperatureRange;
*/
JNIEXPORT jobject JNICALL Java_net_irext_decodesdk_IRDecode_irACGetTemperatureRange
(JNIEnv *, jobject, jint);
/*
* Class: net_irext_decodesdk_IRDecode
* Method: irACGetSupportedMode
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_net_irext_decodesdk_IRDecode_irACGetSupportedMode
(JNIEnv *, jobject);
/*
* Class: net_irext_decodesdk_IRDecode
* Method: irACGetSupportedWindSpeed
* Signature: (I)I
*/
JNIEXPORT jint JNICALL Java_net_irext_decodesdk_IRDecode_irACGetSupportedWindSpeed
(JNIEnv *, jobject, jint);
/*
* Class: net_irext_decodesdk_IRDecode
* Method: irACGetSupportedSwing
* Signature: (I)I
*/
JNIEXPORT jint JNICALL Java_net_irext_decodesdk_IRDecode_irACGetSupportedSwing
(JNIEnv *, jobject, jint);
/*
* Class: net_irext_decodesdk_IRDecode
* Method: irACGetSupportedWindDirection
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_net_irext_decodesdk_IRDecode_irACGetSupportedWindDirection
(JNIEnv *, jobject);
#ifdef __cplusplus
}
#endif
#endif
/* Header for class net_irext_decodesdk_IRDecode_LocalBinder */
#ifndef _Included_net_irext_decodesdk_IRDecode_LocalBinder
#define _Included_net_irext_decodesdk_IRDecode_LocalBinder
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif