JNI for test coverage #3965
This commit is contained in:
parent
65ade05792
commit
ecac4bc6d9
|
@ -16,6 +16,7 @@ public class JniSandbox {
|
|||
|
||||
EngineLogic engineLogic = new EngineLogic();
|
||||
System.out.println(engineLogic.getVersion());
|
||||
engineLogic.setSensor("clt", 90);
|
||||
engineLogic.setConfiguration(new byte[4], 24, 14);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "pch.h"
|
||||
#include "com_rusefi_native__EngineLogic.h"
|
||||
#include "auto_generated_sensor.h"
|
||||
|
||||
//static EngineTestHelper eth(TEST_ENGINE);
|
||||
|
||||
|
@ -18,7 +19,7 @@ JNIEXPORT jstring JNICALL Java_com_rusefi_native_1_EngineLogic_getVersion(JNIEnv
|
|||
return result;
|
||||
}
|
||||
|
||||
JNIEXPORT jbyteArray JNICALL Java_com_rusefi_native_1_EngineLogic_getConfiguration(JNIEnv *env, jobject) {
|
||||
JNIEXPORT jbyteArray JNICALL Java_com_rusefi_native_1_EngineLogic_getConfiguration(JNIEnv *env, jobject instance) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -29,3 +30,16 @@ JNIEXPORT void JNICALL Java_com_rusefi_native_1_EngineLogic_setConfiguration(JNI
|
|||
printf("[native] setConfiguration %d %d\n", offset, size);
|
||||
// printf("[native] engine %d %d\n", engineConfiguration->engineType);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_rusefi_native_1_EngineLogic_setSensor
|
||||
(JNIEnv *env, jobject instance, jstring sensorName, jdouble sensorValue) {
|
||||
|
||||
const char *sensorNameNative = env->GetStringUTFChars(sensorName, 0);
|
||||
|
||||
SensorType type = findSensorTypeByName(sensorNameNative);
|
||||
|
||||
printf("Setting [%s] to %f\n", getSensorType(type), sensorValue);
|
||||
Sensor::setMockValue(type, sensorValue);
|
||||
|
||||
env->ReleaseStringUTFChars(sensorName, sensorNameNative);
|
||||
}
|
||||
|
|
|
@ -139,6 +139,7 @@ endif
|
|||
AOPT = -fPIC -I$(JAVA_HOME)/include
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
# TODO: add validation to assert that we do not have Windows slash in JAVA_HOME variable
|
||||
AOPT += -I$(JAVA_HOME)/include/win32
|
||||
else
|
||||
ifeq ($(IS_MAC),yes)
|
||||
|
|
Loading…
Reference in New Issue