diff options
author | Mark Spruiell <mes@zeroc.com> | 2015-11-06 11:24:22 -0800 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2015-11-06 11:24:22 -0800 |
commit | 61f9f44b8eda9c9cdb9139436d4ad87e6e7d5839 (patch) | |
tree | 286025a254ce57d02068551f11cf69b89fa66a72 /cpp/src/IceBT/PluginI.cpp | |
parent | A few changes to support move of Freeze (diff) | |
download | ice-61f9f44b8eda9c9cdb9139436d4ad87e6e7d5839.tar.bz2 ice-61f9f44b8eda9c9cdb9139436d4ad87e6e7d5839.tar.xz ice-61f9f44b8eda9c9cdb9139436d4ad87e6e7d5839.zip |
initial commit of C++ Bluetooth transport
Diffstat (limited to 'cpp/src/IceBT/PluginI.cpp')
-rw-r--r-- | cpp/src/IceBT/PluginI.cpp | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/cpp/src/IceBT/PluginI.cpp b/cpp/src/IceBT/PluginI.cpp new file mode 100644 index 00000000000..c95ce5db9e0 --- /dev/null +++ b/cpp/src/IceBT/PluginI.cpp @@ -0,0 +1,70 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#include <IceBT/PluginI.h> +#include <IceBT/EndpointI.h> +#include <IceBT/Engine.h> +#include <IceBT/Instance.h> +#include <IceBT/Util.h> + +#include <Ice/LocalException.h> +#include <Ice/ProtocolPluginFacade.h> +#include <Ice/ProtocolInstance.h> + +using namespace std; +using namespace Ice; +using namespace IceBT; + +void +IceBT::BluetoothException::ice_print(ostream& out) const +{ + Exception::ice_print(out); + out << ":\nbluetooth exception: `" << reason << "'"; +} + +// +// Plug-in factory function. +// +extern "C" +{ + +ICE_BT_API Ice::Plugin* +createIceBT(const CommunicatorPtr& communicator, const string& /*name*/, const StringSeq& /*args*/) +{ + return new PluginI(communicator); +} + +} + +// +// Plugin implementation. +// +IceBT::PluginI::PluginI(const Ice::CommunicatorPtr& com) : + _engine(new Engine(com)) +{ + // + // Register the endpoint factory. We have to do this now, rather + // than in initialize, because the communicator may need to + // interpret proxies before the plug-in is fully initialized. + // + IceInternal::EndpointFactoryPtr btFactory = new EndpointFactoryI(new Instance(_engine, EndpointType, "bt")); + IceInternal::getProtocolPluginFacade(com)->addEndpointFactory(btFactory); +} + +void +IceBT::PluginI::initialize() +{ + _engine->initialize(); +} + +void +IceBT::PluginI::destroy() +{ + _engine->destroy(); +} |