aboutsummaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorPetre Eftime <[email protected]>2016-05-23 17:42:28 +0300
committerPetre Eftime <[email protected]>2016-05-23 18:17:45 +0300
commitf475d6dbcc549022920090ac11d783f011ffc010 (patch)
treef32e3139295fe4d0e7031c1b106f8eac12e1b4ea /api
parentb98d8d7ad75d748596ee0246b6f21a74f4b61ef3 (diff)
c++, java: Add BluetoothException, throw it on DBus or BlueZ error
Signed-off-by: Petre Eftime <[email protected]>
Diffstat (limited to 'api')
-rw-r--r--api/tinyb/BluetoothException.hpp22
-rw-r--r--api/tinyb/BluetoothObject.hpp1
2 files changed, 23 insertions, 0 deletions
diff --git a/api/tinyb/BluetoothException.hpp b/api/tinyb/BluetoothException.hpp
new file mode 100644
index 00000000..0bd76606
--- /dev/null
+++ b/api/tinyb/BluetoothException.hpp
@@ -0,0 +1,22 @@
+#pragma once
+#include <stdexcept>
+#include <iostream>
+
+using namespace tinyb;
+
+class tinyb::BluetoothException: public std::runtime_error {
+
+public:
+ explicit BluetoothException(const std::string &msg): std::runtime_error(msg) {
+ }
+
+ explicit BluetoothException(const char *msg): std::runtime_error(msg) {
+ }
+
+ virtual ~BluetoothException() throw() {
+ }
+
+ virtual const char* what() const throw() {
+ return std::runtime_error::what();
+ }
+};
diff --git a/api/tinyb/BluetoothObject.hpp b/api/tinyb/BluetoothObject.hpp
index 0c13058b..804f39ed 100644
--- a/api/tinyb/BluetoothObject.hpp
+++ b/api/tinyb/BluetoothObject.hpp
@@ -46,6 +46,7 @@ enum class BluetoothType {
class BluetoothGattService;
class BluetoothGattCharacteristic;
class BluetoothGattDescriptor;
+ class BluetoothException;
}
class tinyb::BluetoothObject