| 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::Close() { NOTIMPLEMENTED(); } | |
| 51 | |
| 52 void BluetoothSocketChromeOS::Disconnect(const base::Closure& callback) { | |
| 53 NOTIMPLEMENTED(); | |
| 54 } | |
| 55 | |
| 56 void BluetoothSocketChromeOS::Receive( | |
| 57 int count, | |
| 58 const ReceiveCompletionCallback& success_callback, | |
| 59 const ReceiveErrorCompletionCallback& error_callback) { | |
| 60 NOTIMPLEMENTED(); | |
| 61 } | |
| 62 | |
| 63 void BluetoothSocketChromeOS::Send( | |
| 64 scoped_refptr<net::IOBuffer> buffer, | |
| 65 int buffer_size, | |
| 66 const SendCompletionCallback& success_callback, | |
| 67 const ErrorCompletionCallback& error_callback) { | |
| 68 NOTIMPLEMENTED(); | |
| 69 } | |
| 70 | |
| 71 #if 0 | |
| 72 bool BluetoothSocketChromeOS::Receive(net::GrowableIOBuffer *buffer) { | 50 bool BluetoothSocketChromeOS::Receive(net::GrowableIOBuffer *buffer) { |
| 73 base::ThreadRestrictions::AssertIOAllowed(); | 51 base::ThreadRestrictions::AssertIOAllowed(); |
| 74 | 52 |
| 75 if (socket_type_ == L2CAP) { | 53 if (socket_type_ == L2CAP) { |
| 76 int count; | 54 int count; |
| 77 if (ioctl(fd_, FIONREAD, &count) < 0) { | 55 if (ioctl(fd_, FIONREAD, &count) < 0) { |
| 78 error_message_ = safe_strerror(errno); | 56 error_message_ = safe_strerror(errno); |
| 79 LOG(WARNING) << "Unable to get waiting data size: " << error_message_; | 57 LOG(WARNING) << "Unable to get waiting data size: " << error_message_; |
| 80 return true; | 58 return true; |
| 81 } | 59 } |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 return false; | 146 return false; |
| 169 } | 147 } |
| 170 } | 148 } |
| 171 | 149 |
| 172 return true; | 150 return true; |
| 173 } | 151 } |
| 174 | 152 |
| 175 std::string BluetoothSocketChromeOS::GetLastErrorMessage() const { | 153 std::string BluetoothSocketChromeOS::GetLastErrorMessage() const { |
| 176 return error_message_; | 154 return error_message_; |
| 177 } | 155 } |
| 178 #endif | |
| 179 | 156 |
| 180 // static | 157 // static |
| 181 scoped_refptr<device::BluetoothSocket> BluetoothSocketChromeOS::Create( | 158 scoped_refptr<device::BluetoothSocket> BluetoothSocketChromeOS::Create( |
| 182 dbus::FileDescriptor* fd) { | 159 dbus::FileDescriptor* fd) { |
| 183 DCHECK(fd->is_valid()); | 160 DCHECK(fd->is_valid()); |
| 184 | 161 |
| 185 BluetoothSocketChromeOS* bluetooth_socket = | 162 BluetoothSocketChromeOS* bluetooth_socket = |
| 186 new BluetoothSocketChromeOS(fd->TakeValue()); | 163 new BluetoothSocketChromeOS(fd->TakeValue()); |
| 187 return scoped_refptr<BluetoothSocketChromeOS>(bluetooth_socket); | 164 return scoped_refptr<BluetoothSocketChromeOS>(bluetooth_socket); |
| 188 } | 165 } |
| 189 | 166 |
| 190 } // namespace chromeos | 167 } // namespace chromeos |
| OLD | NEW |