• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // 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 
8 #include <WinSock2.h>
9 
10 #include <string>
11 
12 #include "base/memory/ref_counted.h"
13 #include "device/bluetooth/bluetooth_socket.h"
14 
15 namespace net {
16 
17 class DrainableIOBuffer;
18 class GrowableIOBuffer;
19 
20 }  // namespace net
21 
22 namespace device {
23 
24 class BluetoothServiceRecord;
25 
26 // This class is an implementation of BluetoothSocket class for Windows
27 // platform.
28 class BluetoothSocketWin : public BluetoothSocket {
29  public:
30   static scoped_refptr<BluetoothSocket> CreateBluetoothSocket(
31       const BluetoothServiceRecord& service_record);
32 
33   // BluetoothSocket override
34   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();
40 
41  private:
42   explicit BluetoothSocketWin(SOCKET fd);
43 
44   const SOCKET fd_;
45   std::string error_message_;
46 
47   DISALLOW_COPY_AND_ASSIGN(BluetoothSocketWin);
48 };
49 
50 }  // namespace device
51 
52 #endif  // DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_WIN_H_
53