summaryrefslogtreecommitdiff
path: root/cpp/src/IceBT/TransceiverI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/IceBT/TransceiverI.cpp')
-rw-r--r--cpp/src/IceBT/TransceiverI.cpp117
1 files changed, 117 insertions, 0 deletions
diff --git a/cpp/src/IceBT/TransceiverI.cpp b/cpp/src/IceBT/TransceiverI.cpp
new file mode 100644
index 00000000000..8ce1241870a
--- /dev/null
+++ b/cpp/src/IceBT/TransceiverI.cpp
@@ -0,0 +1,117 @@
+// **********************************************************************
+//
+// 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/TransceiverI.h>
+#include <IceBT/ConnectionInfo.h>
+#include <IceBT/Engine.h>
+#include <IceBT/Instance.h>
+#include <IceBT/Util.h>
+
+#include <Ice/Connection.h>
+#include <Ice/LocalException.h>
+
+#include <IceUtil/DisableWarnings.h>
+
+using namespace std;
+using namespace Ice;
+using namespace IceBT;
+
+IceInternal::NativeInfoPtr
+IceBT::TransceiverI::getNativeInfo()
+{
+ return _stream;
+}
+
+IceInternal::SocketOperation
+IceBT::TransceiverI::initialize(IceInternal::Buffer& readBuffer, IceInternal::Buffer& writeBuffer)
+{
+ return IceInternal::SocketOperationNone; // Already connected.
+}
+
+IceInternal::SocketOperation
+IceBT::TransceiverI::closing(bool initiator, const Ice::LocalException&)
+{
+ // If we are initiating the connection closure, wait for the peer
+ // to close the TCP/IP connection. Otherwise, close immediately.
+ return initiator ? IceInternal::SocketOperationRead : IceInternal::SocketOperationNone;
+}
+
+void
+IceBT::TransceiverI::close()
+{
+ if(_connection)
+ {
+ _connection->close();
+ }
+ _stream->close();
+}
+
+IceInternal::SocketOperation
+IceBT::TransceiverI::write(IceInternal::Buffer& buf)
+{
+ return _stream->write(buf);
+}
+
+IceInternal::SocketOperation
+IceBT::TransceiverI::read(IceInternal::Buffer& buf)
+{
+ return _stream->read(buf);
+}
+
+string
+IceBT::TransceiverI::protocol() const
+{
+ return _instance->protocol();
+}
+
+string
+IceBT::TransceiverI::toString() const
+{
+ return _stream->toString();
+}
+
+string
+IceBT::TransceiverI::toDetailedString() const
+{
+ return toString();
+}
+
+Ice::ConnectionInfoPtr
+IceBT::TransceiverI::getInfo() const
+{
+ IceBT::ConnectionInfoPtr info = new IceBT::ConnectionInfo();
+ fdToAddressAndChannel(_stream->fd(), info->localAddress, info->localChannel, info->remoteAddress,
+ info->remoteChannel);
+ info->uuid = _uuid;
+ return info;
+}
+
+void
+IceBT::TransceiverI::checkSendSize(const IceInternal::Buffer&)
+{
+}
+
+void
+IceBT::TransceiverI::setBufferSize(int rcvSize, int sndSize)
+{
+ _stream->setBufferSize(rcvSize, sndSize);
+}
+
+IceBT::TransceiverI::TransceiverI(const InstancePtr& instance, const StreamSocketPtr& stream, const ConnectionPtr& conn,
+ const string& uuid) :
+ _instance(instance),
+ _stream(stream),
+ _connection(conn),
+ _uuid(uuid)
+{
+}
+
+IceBT::TransceiverI::~TransceiverI()
+{
+}