Merge "Merge remote-tracking branch 'origin/master' into notification-service" into...
[platform/upstream/iotivity.git] / service / notification / android / notification-service / src / main / jni / common / JniNotificationCommon.h
1 //******************************************************************\r
2 //\r
3 // Copyright 2016 Samsung Electronics All Rights Reserved.\r
4 //\r
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
6 //\r
7 // Licensed under the Apache License, Version 2.0 (the "License");\r
8 // you may not use this file except in compliance with the License.\r
9 // You may obtain a copy of the License at\r
10 //\r
11 //      http://www.apache.org/licenses/LICENSE-2.0\r
12 //\r
13 // Unless required by applicable law or agreed to in writing, software\r
14 // distributed under the License is distributed on an "AS IS" BASIS,\r
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16 // See the License for the specific language governing permissions and\r
17 // limitations under the License.\r
18 //\r
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
20 \r
21 #ifndef _JNI_NOTIFICATION_COMMON_H_\r
22 #define _JNI_NOTIFICATION_COMMON_H_\r
23 \r
24 #include <jni.h>\r
25 #include <android/log.h>\r
26 \r
27 \r
28 #define  LOG_TAG    "Notification_Common"\r
29 \r
30 #define JNI_CURRENT_VERSION JNI_VERSION_1_6\r
31 \r
32 #ifdef __cplusplus\r
33 extern "C" {\r
34 #endif\r
35 \r
36 #define  LOGD(...)  __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)\r
37 #define  LOGI(...)  __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)\r
38 #define  LOGW(...)  __android_log_print(ANDROID_LOG_WARN,LOG_TAG,__VA_ARGS__)\r
39 #define  LOGE(...)  __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)\r
40 \r
41 #define JNI_EXCEPTION 1000\r
42 #define JNI_NO_NATIVE_POINTER 1001\r
43 #define JNI_INVALID_VALUE 1002\r
44 \r
45 #define JNI_NS_OK 100\r
46 #define JNI_NS_ERROR 200\r
47 #define JNI_NS_SUCCESS 300\r
48 #define JNI_NS_FAIL 400\r
49 #define JNI_NS_ALLOW 500\r
50 #define JNI_NS_DENY 600\r
51 \r
52 jobject getNSException(JNIEnv *env, const char *file, const char *functionName, const int line,\r
53                        const int code, const char *message);\r
54 void throwNSException(JNIEnv *env, jobject ex);\r
55 \r
56 #define GetNSException(code, message) getNSException(env, __FILE__, __func__, __LINE__, code, message)\r
57 #define ThrowNSException(code, message) throwNSException(env, GetNSException(code, message))\r
58 \r
59 static const char *NSResultToChar(const int nsresult);\r
60 int NSExceptionInit(JNIEnv *env);\r
61 \r
62 #ifdef __cplusplus\r
63 }\r
64 #endif\r
65 \r
66 #endif // _JNI_NOTIFICATION_COMMON_H_