Direct-BT  2.3.1
Direct-BT - Direct Bluetooth Programming.
helper_base.hpp
Go to the documentation of this file.
1 /*
2  * Author: Andrei Vasiliu <andrei.vasiliu@intel.com>
3  * Copyright (c) 2016 Intel Corporation.
4  *
5  * Author: Sven Gothel <sgothel@jausoft.com>
6  * Copyright (c) 2020 Gothel Software e.K.
7  * Copyright (c) 2020 ZAFENA AB
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining
10  * a copy of this software and associated documentation files (the
11  * "Software"), to deal in the Software without restriction, including
12  * without limitation the rights to use, copy, modify, merge, publish,
13  * distribute, sublicense, and/or sell copies of the Software, and to
14  * permit persons to whom the Software is furnished to do so, subject to
15  * the following conditions:
16  *
17  * The above copyright notice and this permission notice shall be
18  * included in all copies or substantial portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27  */
28 
29 #ifndef HELPER_BASE_HPP_
30 #define HELPER_BASE_HPP_
31 
32 #include <vector>
33 #include <memory>
34 #include <functional>
35 #include <jni.h>
36 
37 #include <jau/jni/helper_jni.hpp>
38 
39 #include "direct_bt/BTTypes0.hpp"
40 
41 jobject get_bluetooth_type(JNIEnv *env, const char *field_name);
42 
43 void raise_java_exception(JNIEnv *env, const direct_bt::BTException &e, const char* file, int line);
44 
45 /**
46  * Re-throw current exception and raise respective java exception
47  * using any matching function above.
48  */
49 void rethrow_and_raise_java_exception_impl(JNIEnv *env, const char* file, int line);
50 
51 /**
52  * Re-throw current exception and raise respective java exception
53  * using any matching function above.
54  */
55 #define rethrow_and_raise_java_exception(E) rethrow_and_raise_java_exception_impl((E), __FILE__, __LINE__)
56 // inline void rethrow_and_raise_java_exception(JNIEnv *env) { rethrow_and_raise_java_exception_impl(env, __FILE__, __LINE__); }
57 
58 #endif /* HELPER_BASE_HPP_ */
rethrow_and_raise_java_exception_impl
void rethrow_and_raise_java_exception_impl(JNIEnv *env, const char *file, int line)
Re-throw current exception and raise respective java exception using any matching function above.
Definition: helper_base.cxx:56
helper_jni.hpp
direct_bt::BTException
Definition: BTTypes0.hpp:43
BTTypes0.hpp
raise_java_exception
void raise_java_exception(JNIEnv *env, const direct_bt::BTException &e, const char *file, int line)
Definition: helper_base.cxx:49
get_bluetooth_type
jobject get_bluetooth_type(JNIEnv *env, const char *field_name)
Definition: helper_base.cxx:38