Skip to content

Commit 21db659

Browse files
Merge pull request #210 from mavlink/pr-tmp-dir
Configurable temp directory
2 parents f127435 + d62eb57 commit 21db659

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

mavsdk_server/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ allprojects {
2626
// version. Say we set this package to be 3.6.0-2-SNAPSHOT, it means that it
2727
// corresponds to mavsdk_server 3.6.0.
2828
val mavsdk_server_release = if (!project.hasProperty("VERSION")) {
29-
"v3.6.0"
29+
"v3.7.1"
3030
} else {
3131
val versionString = project.property("VERSION").toString()
3232
val regex = Regex("v?(\\d+\\.\\d+\\.\\d+)")
@@ -103,7 +103,7 @@ android {
103103
// MAVSDK-Java package and "SNAPSHOT" optionally sets it as a SNAPSHOT.
104104
version =
105105
if (project.hasProperty("VERSION")) project.property("VERSION").toString()
106-
else "3.6.0-SNAPSHOT"
106+
else "3.7.1-SNAPSHOT"
107107

108108
ndk {
109109
abiFilters += listOf("arm64-v8a", "armeabi-v7a", "x86", "x86_64")

mavsdk_server/src/main/cpp/native-lib.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,"MAVSDK-Server",__VA_ARGS__)
88

9+
extern "C" char* mavsdk_temp_path;
10+
911
extern "C"
1012
{
1113
JNIEXPORT jlong JNICALL
@@ -77,4 +79,16 @@ extern "C"
7779
auto mavsdk_server = reinterpret_cast<MavsdkServer*>(mavsdkServerHandle);
7880
mavsdk_server_destroy(mavsdk_server);
7981
}
82+
83+
JNIEXPORT void JNICALL
84+
Java_io_mavsdk_mavsdkserver_MavsdkServer_setTempDirectory(JNIEnv *env, jobject thiz, jstring temp_dir)
85+
{
86+
const char* temp_c_str = env->GetStringUTFChars(temp_dir, 0);
87+
88+
static char our_copy[256];
89+
strncpy(our_copy, temp_c_str, sizeof(our_copy));
90+
mavsdk_temp_path = our_copy;
91+
92+
env->ReleaseStringUTFChars(temp_dir, temp_c_str);
93+
}
8094
};

mavsdk_server/src/main/java/io/mavsdk/mavsdkserver/MavsdkServer.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,4 +125,6 @@ public void destroy() {
125125
}
126126

127127
private native void destroy(long mavsdkServerHandle);
128+
129+
public native void setTempDirectory(String dir);
128130
}

sdk/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ group = "io.mavsdk"
3030
// version of the proto files as MAVSDK-C++ v3.6.0.
3131
version =
3232
if (project.hasProperty("VERSION")) project.property("VERSION").toString()
33-
else "3.6.0-SNAPSHOT"
33+
else "3.7.1-SNAPSHOT"
3434

3535
val grpcVersion = "1.61.1"
3636

0 commit comments

Comments
 (0)