updated all example references

This commit is contained in:
2017-05-31 21:10:54 +08:00
parent 0f4e3cacfb
commit 66b97e50e6
16 changed files with 64 additions and 19 deletions

View File

@@ -8,10 +8,9 @@ Description: This file links to java layer for Android application
Revision log:
* 2016-03-21: created by strawmanbobi
**************************************************************************************************/
#include <jni.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include "ir_decode_jni.h"
#include "../include/ir_defs.h"
#include "../include/ir_decode.h"
@@ -49,24 +48,22 @@ JNIEXPORT jint JNICALL Java_net_irext_decodesdk_IRDecode_irOpenBinary
return IR_DECODE_FAILED;
}
(*env)->ReleaseByteArrayElements(env, binaries, j_buffer, JNI_ABORT);
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];
UINT16 user_data[USER_DATA_SIZE];
int i = 0;
int copy_array[USER_DATA_SIZE] = {0};
remote_ac_status_t ac_status;
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");
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");
@@ -80,7 +77,7 @@ JNIEXPORT jintArray JNICALL Java_net_irext_decodesdk_IRDecode_irDecode
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;
@@ -89,7 +86,7 @@ JNIEXPORT jintArray JNICALL Java_net_irext_decodesdk_IRDecode_irDecode
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);
@@ -103,7 +100,7 @@ JNIEXPORT jintArray JNICALL Java_net_irext_decodesdk_IRDecode_irDecode
copy_array[i] = (int)user_data[i];
}
(*env)->SetIntArrayRegion(env, result, 0, wave_code_length, copy_array);
(*env)->DeleteLocalRef(env, n_ac_status);
(*env)->DeleteLocalRef(env, n_ac_status);
return result;
}