1 /******************************************************************
3 * Copyright 2015 Samsung Electronics All Rights Reserved.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 ******************************************************************/
23 * This file contains the utility functions for conversions from java to CPP
27 #ifndef JNI_THINGS_MANAGER_UTILS_H_
28 #define JNI_THINGS_MANAGER_UTILS_H_
32 #include "JniOcResource.h"
33 #include "jni_things_manager_jvm.h"
36 * Utility function for converting a Java Vector of Strings to CPP Vector of Strings.
38 * @param env - Default JNI Environment pointer
39 * @param jVectorString - Java Vector of Strings
41 std::vector<std::string> convertStringVector(JNIEnv *env, jobject jVectorString);
44 * Utility function for converting a Hash Map of Strings to CPP Map of Strings.
46 * @param env - Default JNI Environment pointer
47 * @param jMapString - Java Map of Strings
49 std::map<std::string, std::string> convertStringMap(JNIEnv *env, jobject jMapString);
52 * Utility function for converting ocResource Handle to java.
53 * @param env - Default JNI Environment pointer
54 * @param resourceHandle - Resource Handle
56 jobject ocResourceHandleToJava(JNIEnv *env, jlong resourceHandle);
59 * Utility function for converting native ocResource to java ocResource.
60 * @param env - Default JNI Environment pointer
61 * @param resource - Native Resource
63 jobject OcResourceToJava(JNIEnv *env, jlong resource);
66 * Utility function for converting native ocHeaderOption to java ocHeaderOption.
67 * @param env - Default JNI Environment pointer
68 * @param headerOption - Native headerOption
70 jobject OcHeaderOptionToJava(JNIEnv *env, OC::HeaderOption::OCHeaderOption headerOption);
73 * Utility function for converting native ocRepresentation to java ocRepresentation.
74 * @param env - Default JNI Environment pointer
75 * @param ocRepresentation - Native ocRepresentation
77 jobject OcRepresentationToJava(JNIEnv *env, jlong ocRepresentation);
79 #endif //JNI_THINGS_MANAGER_UTILS_H_