summaryrefslogtreecommitdiff
path: root/cpp/src/IceBT/Engine.cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2015-11-20 14:53:32 -0800
committerMark Spruiell <mes@zeroc.com>2015-11-20 14:53:32 -0800
commit3d0f671afa1645ab51e265b5fc0cf404f02fdccf (patch)
tree872349d3737066cc6c96b1155c39cd90a139f842 /cpp/src/IceBT/Engine.cpp
parentinitial BlueZ 4 implementation (diff)
downloadice-3d0f671afa1645ab51e265b5fc0cf404f02fdccf.tar.bz2
ice-3d0f671afa1645ab51e265b5fc0cf404f02fdccf.tar.xz
ice-3d0f671afa1645ab51e265b5fc0cf404f02fdccf.zip
BT fixes
Diffstat (limited to 'cpp/src/IceBT/Engine.cpp')
-rw-r--r--cpp/src/IceBT/Engine.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/cpp/src/IceBT/Engine.cpp b/cpp/src/IceBT/Engine.cpp
index 878deec1f73..46e67f47016 100644
--- a/cpp/src/IceBT/Engine.cpp
+++ b/cpp/src/IceBT/Engine.cpp
@@ -544,7 +544,8 @@ public:
void runFindService(const IceUtil::ThreadPtr& thread, const string& addr, const string& uuid,
const FindServiceCallbackPtr& cb)
{
- int channel = -1;
+ vector<int> channels;
+ bool failed = false;
try
{
@@ -724,9 +725,10 @@ public:
if(ch)
{
string val = ch->getAttribute("value");
+ int channel;
if(sscanf(val.c_str(), "%x", &channel) == 1)
{
- break;
+ channels.push_back(channel);
}
}
}
@@ -770,23 +772,34 @@ public:
catch(const DBus::Exception& ex)
{
cb->exception(BluetoothException(__FILE__, __LINE__, ex.reason));
+ failed = true;
}
catch(const LocalException& ex)
{
cb->exception(ex);
+ failed = true;
}
catch(const std::exception& ex)
{
cb->exception(UnknownException(__FILE__, __LINE__, ex.what()));
+ failed = true;
}
catch(...)
{
cb->exception(UnknownException(__FILE__, __LINE__, "unknown C++ exception"));
+ failed = true;
}
- if(channel != -1)
+ if(!failed)
{
- cb->completed(channel);
+ if(channels.empty())
+ {
+ cb->exception(BluetoothException(__FILE__, __LINE__, "no service found for " + uuid + " at " + addr));
+ }
+ else
+ {
+ cb->completed(channels);
+ }
}
{