mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
nearby: snapshot as of cl/296436629
Signed-off-by: Alexey Polyudov <apolyudov@google.com> Change-Id: I2cf5bf225b76f4c1541954651f3a7544a14e0cec
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
#include "core/internal/ble_endpoint_channel.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
namespace connections {
|
||||
|
||||
template <typename Platform>
|
||||
Ptr<BLEEndpointChannel<Platform> >
|
||||
BLEEndpointChannel<Platform>::createOutgoing(
|
||||
Ptr<MediumManager<Platform> > medium_manager, const string& channel_name,
|
||||
Ptr<BLESocket> ble_socket) {
|
||||
return MakePtr(
|
||||
new BLEEndpointChannel<Platform>(channel_name, ble_socket));
|
||||
}
|
||||
|
||||
template <typename Platform>
|
||||
Ptr<BLEEndpointChannel<Platform> >
|
||||
BLEEndpointChannel<Platform>::createIncoming(
|
||||
Ptr<MediumManager<Platform> > medium_manager, const string& channel_name,
|
||||
Ptr<BLESocket> ble_socket) {
|
||||
return MakePtr(
|
||||
new BLEEndpointChannel<Platform>(channel_name, ble_socket));
|
||||
}
|
||||
|
||||
template <typename Platform>
|
||||
BLEEndpointChannel<Platform>::BLEEndpointChannel(
|
||||
const string& channel_name, Ptr<BLESocket> ble_socket)
|
||||
: BaseEndpointChannel<Platform>(channel_name,
|
||||
ble_socket->getInputStream(),
|
||||
ble_socket->getOutputStream()),
|
||||
ble_socket_(ble_socket) {}
|
||||
|
||||
template <typename Platform>
|
||||
BLEEndpointChannel<Platform>::~BLEEndpointChannel() {}
|
||||
|
||||
template <typename Platform>
|
||||
proto::connections::Medium BLEEndpointChannel<Platform>::getMedium() {
|
||||
return proto::connections::Medium::BLE;
|
||||
}
|
||||
|
||||
template <typename Platform>
|
||||
void BLEEndpointChannel<Platform>::closeImpl() {
|
||||
Exception::Value exception = ble_socket_->close();
|
||||
if (exception != Exception::NONE) {
|
||||
if (exception == Exception::IO) {
|
||||
// TODO(ahlee): Add logging.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace connections
|
||||
} // namespace nearby
|
||||
} // namespace location
|
||||
Reference in New Issue
Block a user