Compare commits
1 commit
69dacb8024
...
98fe4c353b
Author | SHA1 | Date | |
---|---|---|---|
98fe4c353b |
8 changed files with 25 additions and 18 deletions
|
@ -1,5 +1,5 @@
|
|||
package net.typeblog.lpac_jni
|
||||
|
||||
interface ProfileDiscoveryCallback {
|
||||
fun onDiscovered(servers: Set<String>)
|
||||
fun onDiscovered(servers: List<String>)
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
#include "interface-wrapper.h"
|
||||
#include "lpac-convertor.h"
|
||||
#include "utils.h"
|
||||
|
||||
static jmethodID method_apdu_connect;
|
||||
static jmethodID method_apdu_disconnect;
|
||||
|
@ -95,15 +95,7 @@ http_interface_transmit(struct euicc_ctx *ctx, const char *url, uint32_t *rcode,
|
|||
jbyteArray txArr = (*env)->NewByteArray(env, (jsize) tx_len);
|
||||
(*env)->SetByteArrayRegion(env, txArr, 0, (jsize) tx_len, (const jbyte *) tx);
|
||||
|
||||
jobject header_list = new_array_list(env);
|
||||
jclass header_list_class = (*env)->GetObjectClass(env, header_list);
|
||||
jmethodID add_header = (*env)->GetMethodID(env, header_list_class, "add", "(Ljava/lang/Object;)Z");
|
||||
|
||||
for (int i = 0; headers[i] != NULL; i++) {
|
||||
jstring header = toJString(env, headers[i]);
|
||||
(*env)->CallBooleanMethod(env, header_list, add_header, header);
|
||||
(*env)->DeleteLocalRef(env, header);
|
||||
}
|
||||
jobject header_list = to_string_list(env, (char **) headers);
|
||||
|
||||
jobject ret = (*env)->CallObjectMethod(env, LPAC_JNI_CTX(ctx)->http_interface,
|
||||
method_http_transmit, jurl, txArr, header_list);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
#include <syslog.h>
|
||||
#include "lpac-convertor.h"
|
||||
#include "utils.h"
|
||||
#include "lpac-discovery.h"
|
||||
|
||||
JNIEXPORT jobject JNICALL
|
||||
|
@ -52,7 +52,7 @@ Java_net_typeblog_lpac_1jni_LpacJni_discoveryProfile(
|
|||
|
||||
jclass callback_class = (*env)->GetObjectClass(env, callback);
|
||||
jmethodID on_discovered = (*env)->GetMethodID(env, callback_class, "onDiscovered",
|
||||
"(Ljava/util/Set;)V");
|
||||
"(Ljava/util/List;)V");
|
||||
|
||||
const char *_address = (*env)->GetStringUTFChars(env, address, NULL);
|
||||
const char *_imei = NULL;
|
||||
|
@ -95,7 +95,7 @@ Java_net_typeblog_lpac_1jni_LpacJni_discoveryProfile(
|
|||
goto out;
|
||||
}
|
||||
|
||||
(*env)->CallVoidMethod(env, callback, on_discovered, to_string_set(env, smdp_list));
|
||||
(*env)->CallVoidMethod(env, callback, on_discovered, to_string_list(env, smdp_list));
|
||||
|
||||
out:
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
#include "lpac-convertor.h"
|
||||
#include "utils.h"
|
||||
#include "lpac-download.h"
|
||||
|
||||
static jobject download_state_preparing;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "lpac-download.h"
|
||||
#include "lpac-notifications.h"
|
||||
#include "lpac-discovery.h"
|
||||
#include "lpac-convertor.h"
|
||||
#include "utils.h"
|
||||
#include "interface-wrapper.h"
|
||||
|
||||
JavaVM *jvm = NULL;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include <euicc/es10b.h>
|
||||
#include <malloc.h>
|
||||
#include <syslog.h>
|
||||
#include "lpac-convertor.h"
|
||||
#include "utils.h"
|
||||
#include "lpac-notifications.h"
|
||||
|
||||
JNIEXPORT jobject JNICALL
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "lpac-convertor.h"
|
||||
#include "utils.h"
|
||||
#include <malloc.h>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
|
@ -145,6 +145,19 @@ jobject to_string_set(JNIEnv *env, char **values) {
|
|||
return elements;
|
||||
}
|
||||
|
||||
jobject to_string_list(JNIEnv *env, char **values) {
|
||||
jclass set_class = (*env)->FindClass(env, ARRAY_LIST_CLASS);
|
||||
jmethodID set_constructor = (*env)->GetMethodID(env, set_class, "<init>", "()V");
|
||||
jobject elements = (*env)->NewObject(env, set_class, set_constructor);
|
||||
jmethodID add_element = (*env)->GetMethodID(env, set_class, "add", "(Ljava/lang/Object;)Z");
|
||||
jstring element = NULL;
|
||||
for (jsize index = 0; values[index] != NULL; index++) {
|
||||
element = toJString(env, values[index]);
|
||||
(*env)->CallBooleanMethod(env, elements, add_element, element);
|
||||
}
|
||||
return elements;
|
||||
}
|
||||
|
||||
jobject build_profile_metadata(JNIEnv *env, struct es8p_metadata *metadata) {
|
||||
if (metadata == NULL) return NULL;
|
||||
|
|
@ -31,6 +31,8 @@ jobject to_version(JNIEnv *env, const char *version);
|
|||
|
||||
jobject to_string_set(JNIEnv *env, char **values);
|
||||
|
||||
jobject to_string_list(JNIEnv *env, char **values);
|
||||
|
||||
jobject build_profile_metadata(JNIEnv *env, struct es8p_metadata *metadata);
|
||||
|
||||
jobject to_profile_management_operation(enum es10b_profile_management_operation operation);
|
Loading…
Add table
Reference in a new issue