blob: 41713e713097d7c7c377ddaee04cebe7a8f4cd60 [file] [log] [blame]
Torne (Richard Coles)58218062012-11-14 11:43:16 +00001// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_WIN_H_
6#define DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_WIN_H_
7
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +00008#include <WinSock2.h>
9
10#include <string>
11
12#include "base/memory/ref_counted.h"
Torne (Richard Coles)58218062012-11-14 11:43:16 +000013#include "device/bluetooth/bluetooth_socket.h"
14
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000015namespace net {
16
17class DrainableIOBuffer;
18class GrowableIOBuffer;
19
20} // namespace net
21
Torne (Richard Coles)58218062012-11-14 11:43:16 +000022namespace device {
23
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000024class BluetoothServiceRecord;
25
26// This class is an implementation of BluetoothSocket class for Windows
27// platform.
Torne (Richard Coles)58218062012-11-14 11:43:16 +000028class BluetoothSocketWin : public BluetoothSocket {
29 public:
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000030 static scoped_refptr<BluetoothSocket> CreateBluetoothSocket(
31 const BluetoothServiceRecord& service_record);
32
Torne (Richard Coles)58218062012-11-14 11:43:16 +000033 // BluetoothSocket override
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000034 virtual bool Receive(net::GrowableIOBuffer* buffer) OVERRIDE;
35 virtual bool Send(net::DrainableIOBuffer* buffer) OVERRIDE;
36 virtual std::string GetLastErrorMessage() const OVERRIDE;
37
38 protected:
39 virtual ~BluetoothSocketWin();
Torne (Richard Coles)58218062012-11-14 11:43:16 +000040
41 private:
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000042 explicit BluetoothSocketWin(SOCKET fd);
43
44 const SOCKET fd_;
45 std::string error_message_;
46
47 DISALLOW_COPY_AND_ASSIGN(BluetoothSocketWin);
Torne (Richard Coles)58218062012-11-14 11:43:16 +000048};
49
50} // namespace device
51
52#endif // DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_WIN_H_