OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "device/bluetooth/bluetooth_socket_chromeos.h" | 5 #include "device/bluetooth/bluetooth_socket_chromeos.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <poll.h> | 8 #include <poll.h> |
9 #include <unistd.h> | 9 #include <unistd.h> |
10 #include <sys/ioctl.h> | 10 #include <sys/ioctl.h> |
(...skipping 29 matching lines...) Expand all Loading... |
40 socket_type_ = L2CAP; | 40 socket_type_ = L2CAP; |
41 } else { | 41 } else { |
42 socket_type_ = RFCOMM; | 42 socket_type_ = RFCOMM; |
43 } | 43 } |
44 } | 44 } |
45 | 45 |
46 BluetoothSocketChromeOS::~BluetoothSocketChromeOS() { | 46 BluetoothSocketChromeOS::~BluetoothSocketChromeOS() { |
47 close(fd_); | 47 close(fd_); |
48 } | 48 } |
49 | 49 |
| 50 void BluetoothSocketChromeOS::Disconnect(const base::Closure& callback) { |
| 51 NOTIMPLEMENTED(); |
| 52 } |
| 53 |
| 54 void BluetoothSocketChromeOS::Receive( |
| 55 int count, |
| 56 const ReceiveCompletionCallback& success_callback, |
| 57 const ReceiveErrorCompletionCallback& error_callback) { |
| 58 NOTIMPLEMENTED(); |
| 59 } |
| 60 |
| 61 void BluetoothSocketChromeOS::Send( |
| 62 scoped_refptr<net::IOBuffer> buffer, |
| 63 int buffer_size, |
| 64 const SendCompletionCallback& success_callback, |
| 65 const ErrorCompletionCallback& error_callback) { |
| 66 NOTIMPLEMENTED(); |
| 67 } |
| 68 |
| 69 #if 0 |
50 bool BluetoothSocketChromeOS::Receive(net::GrowableIOBuffer *buffer) { | 70 bool BluetoothSocketChromeOS::Receive(net::GrowableIOBuffer *buffer) { |
51 base::ThreadRestrictions::AssertIOAllowed(); | 71 base::ThreadRestrictions::AssertIOAllowed(); |
52 | 72 |
53 if (socket_type_ == L2CAP) { | 73 if (socket_type_ == L2CAP) { |
54 int count; | 74 int count; |
55 if (ioctl(fd_, FIONREAD, &count) < 0) { | 75 if (ioctl(fd_, FIONREAD, &count) < 0) { |
56 error_message_ = safe_strerror(errno); | 76 error_message_ = safe_strerror(errno); |
57 LOG(WARNING) << "Unable to get waiting data size: " << error_message_; | 77 LOG(WARNING) << "Unable to get waiting data size: " << error_message_; |
58 return true; | 78 return true; |
59 } | 79 } |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 return false; | 166 return false; |
147 } | 167 } |
148 } | 168 } |
149 | 169 |
150 return true; | 170 return true; |
151 } | 171 } |
152 | 172 |
153 std::string BluetoothSocketChromeOS::GetLastErrorMessage() const { | 173 std::string BluetoothSocketChromeOS::GetLastErrorMessage() const { |
154 return error_message_; | 174 return error_message_; |
155 } | 175 } |
| 176 #endif |
156 | 177 |
157 // static | 178 // static |
158 scoped_refptr<device::BluetoothSocket> BluetoothSocketChromeOS::Create( | 179 scoped_refptr<device::BluetoothSocket> BluetoothSocketChromeOS::Create( |
159 dbus::FileDescriptor* fd) { | 180 dbus::FileDescriptor* fd) { |
160 DCHECK(fd->is_valid()); | 181 DCHECK(fd->is_valid()); |
161 | 182 |
162 BluetoothSocketChromeOS* bluetooth_socket = | 183 BluetoothSocketChromeOS* bluetooth_socket = |
163 new BluetoothSocketChromeOS(fd->TakeValue()); | 184 new BluetoothSocketChromeOS(fd->TakeValue()); |
164 return scoped_refptr<BluetoothSocketChromeOS>(bluetooth_socket); | 185 return scoped_refptr<BluetoothSocketChromeOS>(bluetooth_socket); |
165 } | 186 } |
166 | 187 |
167 } // namespace chromeos | 188 } // namespace chromeos |
OLD | NEW |