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 essential declarations and functions required
24 * for JNI implementation.
27 #ifndef JNI_THINGS_MANAGER_JVM_H_
28 #define JNI_THINGS_MANAGER_JVM_H_
34 #define TM_SERVICE_GROUP_MANAGER_CLASS_PATH "org/iotivity/service/tm/GroupManager"
35 #define TM_SERVICE_GROUP_MANAGER_CLASS_TYPE "Lorg/iotivity/service/tm/GroupManager;"
37 #define TM_SERVICE_GROUP_SYNCHRONIZATION_CLASS_PATH "org/iotivity/service/tm/GroupSynchronization"
38 #define TM_SERVICE_GROUP_SYNCHRONIZATION_CLASS_TYPE "Lorg/iotivity/service/tm/GroupSynchronization;"
40 #define TM_SERVICE_THINGS_CONFIGURATION_CLASS_PATH "org/iotivity/service/tm/ThingsConfiguration"
41 #define TM_SERVICE_THINGS_CONFIGURATION_CLASS_TYPE "Lorg/iotivity/service/tm/ThingsConfigurationn;"
43 #define TM_SERVICE_THINGS_MAINTENANCE_CLASS_PATH "org/iotivity/service/tm/ThingsMaintenance"
44 #define TM_SERVICE_THINGS_MAINTENANCE_CLASS_TYPE "Lorg/iotivity/service/tm/ThingsMaintenance;"
46 #define TM_SERVICE_PLATFORM_CLASS_PATH "org/iotivity/base/OcPlatform"
47 #define TM_SERVICE_PLATFORM_CLASS_TYPE "Lorg/iotivity/base/OcPlatform;"
49 #define TM_SERVICE_PLATFORM_CONFIG_CLASS_PATH "org/iotivity/base/PlatformConfig"
50 #define TM_SERVICE_PLATFORM_CONFIG_CLASS_TYPE "Lorg/iotivity/base/PlatformConfig;"
52 #define TM_SERVICE_CAPABILITY_PATH "org/iotivity/service/tm/Capability"
53 #define TM_SERVICE_CAPABILITY_TYPE "Lorg/iotivity/service/tm/Capability;"
55 #define TM_SERVICE_ACTION_PATH "org/iotivity/service/tm/Action"
56 #define TM_SERVICE_ACTION_TYPE "Lorg/iotivity/service/tm/Action;"
58 #define TM_SERVICE_ACTIONSET_PATH "org/iotivity/service/tm/ActionSet"
59 #define TM_SERVICE_ACTIONSET_TYPE "Lorg/iotivity/service/tm/ActionSet;"
61 #define TM_SERVICE_OCRESOURCE_PATH "org/iotivity/base/OcResource"
62 #define TM_SERVICE_OCRESOURCE_TYPE "Lorg/iotivity/base/OcResource;"
64 #define TM_SERVICE_HEADER_OPTION_PATH "org/iotivity/base/OcHeaderOption"
65 #define TM_SERVICE_HEADER_OPTION_TYPE "Lorg/iotivity/base/OcHeaderOption;"
67 #define TM_SERVICE_OCREPRESENTATION_PATH "org/iotivity/base/OcRepresentation"
68 #define TM_SERVICE_OCREPRESENTATION_TYPE "Lorg/iotivity/base/OcRepresentation;"
70 #define TM_SERVICE_OCRESOURCEHANDLE_PATH "org/iotivity/base/OcResourceHandle"
71 #define TM_SERVICE_OCRESOURCEHANDLE_TYPE "Lorg/iotivity/base/OcResourceHandle;"
73 #define TM_SERVICE_TIME_PATH "org/iotivity/service/tm/Time"
75 #define TM_JAVA_VECTOR_CLASS_PATH "java/util/Vector"
76 #define TM_JAVA_VECTOR_TYPE "Ljava/util/Vector;"
78 #define TM_JAVA_STRING_TYPE "Ljava/lang/String;"
81 * This class provides functions related to JNI Environment.
83 class ThingsManagerJVM
89 ~ThingsManagerJVM() {};
94 static JNIEnv *getEnv();
97 * Release aquired JVM instance.
99 static void releaseEnv();
105 static JavaVM *m_jvm;
114 * Mutex for thread synchronization.
116 static std::mutex m_currentThreadMutex;
122 jclass GetJClass(const char *szClassPath);
123 jobject GetJObjectInstance(const char *szClassPath);
127 #endif //JNI_THINGS_MANAGER_JVM_H_