Commit ff6eaf5a authored by scheib's avatar scheib Committed by Commit bot

bluetooth: Make device/bluetooth a shared library component.

device/bluetooth will soon be accessed by content/browser. This
change converts it from a static library to a shared component.

BUG=438305

Review URL: https://codereview.chromium.org/778443002

Cr-Commit-Position: refs/heads/master@{#307049}
parent 74be87a0
...@@ -15,7 +15,7 @@ config("bluetooth_config") { ...@@ -15,7 +15,7 @@ config("bluetooth_config") {
} }
} }
static_library("bluetooth") { component("bluetooth") {
sources = [ sources = [
"bluetooth_adapter.cc", "bluetooth_adapter.cc",
"bluetooth_adapter.h", "bluetooth_adapter.h",
...@@ -91,6 +91,10 @@ static_library("bluetooth") { ...@@ -91,6 +91,10 @@ static_library("bluetooth") {
"bluetooth_uuid.h", "bluetooth_uuid.h",
] ]
defines = [
"DEVICE_BLUETOOTH_IMPLEMENTATION",
]
all_dependent_configs = [ ":bluetooth_config" ] all_dependent_configs = [ ":bluetooth_config" ]
deps = [ deps = [
......
...@@ -10,13 +10,16 @@ ...@@ -10,13 +10,16 @@
{ {
# GN version: //device/bluetooth # GN version: //device/bluetooth
'target_name': 'device_bluetooth', 'target_name': 'device_bluetooth',
'type': 'static_library', 'type': '<(component)',
'dependencies': [ 'dependencies': [
'../../base/base.gyp:base', '../../base/base.gyp:base',
'../../net/net.gyp:net', '../../net/net.gyp:net',
'../../ui/base/ui_base.gyp:ui_base', '../../ui/base/ui_base.gyp:ui_base',
'bluetooth_strings.gyp:device_bluetooth_strings', 'bluetooth_strings.gyp:device_bluetooth_strings',
], ],
'defines': [
'DEVICE_BLUETOOTH_IMPLEMENTATION',
],
'sources': [ 'sources': [
# Note: file list duplicated in GN build. # Note: file list duplicated in GN build.
'bluetooth_adapter.cc', 'bluetooth_adapter.cc',
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "device/bluetooth/bluetooth_device.h" #include "device/bluetooth/bluetooth_device.h"
#include "device/bluetooth/bluetooth_export.h"
namespace device { namespace device {
...@@ -31,7 +32,8 @@ class BluetoothUUID; ...@@ -31,7 +32,8 @@ class BluetoothUUID;
// this class also provides support for obtaining the list of remote devices // this class also provides support for obtaining the list of remote devices
// known to the adapter, discovering new devices, and providing notification of // known to the adapter, discovering new devices, and providing notification of
// updates to device information. // updates to device information.
class BluetoothAdapter : public base::RefCounted<BluetoothAdapter> { class DEVICE_BLUETOOTH_EXPORT BluetoothAdapter
: public base::RefCounted<BluetoothAdapter> {
public: public:
// Interface for observing changes from bluetooth adapters. // Interface for observing changes from bluetooth adapters.
class Observer { class Observer {
...@@ -158,7 +160,7 @@ class BluetoothAdapter : public base::RefCounted<BluetoothAdapter> { ...@@ -158,7 +160,7 @@ class BluetoothAdapter : public base::RefCounted<BluetoothAdapter> {
}; };
// Used to configure a listening servie. // Used to configure a listening servie.
struct ServiceOptions { struct DEVICE_BLUETOOTH_EXPORT ServiceOptions {
ServiceOptions(); ServiceOptions();
~ServiceOptions(); ~ServiceOptions();
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "dbus/object_path.h" #include "dbus/object_path.h"
#include "device/bluetooth/bluetooth_adapter.h" #include "device/bluetooth/bluetooth_adapter.h"
#include "device/bluetooth/bluetooth_device.h" #include "device/bluetooth/bluetooth_device.h"
#include "device/bluetooth/bluetooth_export.h"
namespace device { namespace device {
class BluetoothSocketThread; class BluetoothSocketThread;
...@@ -33,7 +34,7 @@ class BluetoothRemoteGattServiceChromeOS; ...@@ -33,7 +34,7 @@ class BluetoothRemoteGattServiceChromeOS;
// The BluetoothAdapterChromeOS class implements BluetoothAdapter for the // The BluetoothAdapterChromeOS class implements BluetoothAdapter for the
// Chrome OS platform. // Chrome OS platform.
class BluetoothAdapterChromeOS class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
: public device::BluetoothAdapter, : public device::BluetoothAdapter,
public chromeos::BluetoothAdapterClient::Observer, public chromeos::BluetoothAdapterClient::Observer,
public chromeos::BluetoothDeviceClient::Observer, public chromeos::BluetoothDeviceClient::Observer,
......
...@@ -8,12 +8,13 @@ ...@@ -8,12 +8,13 @@
#include "base/callback.h" #include "base/callback.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "device/bluetooth/bluetooth_adapter.h" #include "device/bluetooth/bluetooth_adapter.h"
#include "device/bluetooth/bluetooth_export.h"
namespace device { namespace device {
// A factory class for building a Bluetooth adapter on platforms where Bluetooth // A factory class for building a Bluetooth adapter on platforms where Bluetooth
// is available. // is available.
class BluetoothAdapterFactory { class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterFactory {
public: public:
typedef base::Callback<void(scoped_refptr<BluetoothAdapter> adapter)> typedef base::Callback<void(scoped_refptr<BluetoothAdapter> adapter)>
AdapterCallback; AdapterCallback;
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "base/observer_list.h" #include "base/observer_list.h"
#include "device/bluetooth/bluetooth_adapter.h" #include "device/bluetooth/bluetooth_adapter.h"
#include "device/bluetooth/bluetooth_discovery_manager_mac.h" #include "device/bluetooth/bluetooth_discovery_manager_mac.h"
#include "device/bluetooth/bluetooth_export.h"
@class IOBluetoothDevice; @class IOBluetoothDevice;
@class NSArray; @class NSArray;
...@@ -32,8 +33,9 @@ namespace device { ...@@ -32,8 +33,9 @@ namespace device {
class BluetoothAdapterMacTest; class BluetoothAdapterMacTest;
class BluetoothAdapterMac : public BluetoothAdapter, class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterMac
public BluetoothDiscoveryManagerMac::Observer { : public BluetoothAdapter,
public BluetoothDiscoveryManagerMac::Observer {
public: public:
static base::WeakPtr<BluetoothAdapter> CreateAdapter(); static base::WeakPtr<BluetoothAdapter> CreateAdapter();
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/threading/thread_checker.h" #include "base/threading/thread_checker.h"
#include "device/bluetooth/bluetooth_adapter.h" #include "device/bluetooth/bluetooth_adapter.h"
#include "device/bluetooth/bluetooth_export.h"
#include "device/bluetooth/bluetooth_task_manager_win.h" #include "device/bluetooth/bluetooth_task_manager_win.h"
namespace base { namespace base {
...@@ -28,8 +29,9 @@ class BluetoothAdapterWinTest; ...@@ -28,8 +29,9 @@ class BluetoothAdapterWinTest;
class BluetoothDevice; class BluetoothDevice;
class BluetoothSocketThread; class BluetoothSocketThread;
class BluetoothAdapterWin : public BluetoothAdapter, class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterWin
public BluetoothTaskManagerWin::Observer { : public BluetoothAdapter,
public BluetoothTaskManagerWin::Observer {
public: public:
static base::WeakPtr<BluetoothAdapter> CreateAdapter( static base::WeakPtr<BluetoothAdapter> CreateAdapter(
const InitCallback& init_callback); const InitCallback& init_callback);
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/memory/scoped_vector.h" #include "base/memory/scoped_vector.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "device/bluetooth/bluetooth_export.h"
#include "device/bluetooth/bluetooth_uuid.h" #include "device/bluetooth/bluetooth_uuid.h"
#include "net/base/net_log.h" #include "net/base/net_log.h"
...@@ -34,7 +35,7 @@ class BluetoothUUID; ...@@ -34,7 +35,7 @@ class BluetoothUUID;
// Since the lifecycle of BluetoothDevice instances is managed by // Since the lifecycle of BluetoothDevice instances is managed by
// BluetoothAdapter, that class rather than this provides observer methods // BluetoothAdapter, that class rather than this provides observer methods
// for devices coming and going, as well as properties being updated. // for devices coming and going, as well as properties being updated.
class BluetoothDevice { class DEVICE_BLUETOOTH_EXPORT BluetoothDevice {
public: public:
// Possible values that may be returned by GetVendorIDSource(), // Possible values that may be returned by GetVendorIDSource(),
// indicating different organisations that allocate the identifiers returned // indicating different organisations that allocate the identifiers returned
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "chromeos/dbus/bluetooth_gatt_service_client.h" #include "chromeos/dbus/bluetooth_gatt_service_client.h"
#include "dbus/object_path.h" #include "dbus/object_path.h"
#include "device/bluetooth/bluetooth_device.h" #include "device/bluetooth/bluetooth_device.h"
#include "device/bluetooth/bluetooth_export.h"
namespace device { namespace device {
class BluetoothSocketThread; class BluetoothSocketThread;
...@@ -27,7 +28,7 @@ class BluetoothPairingChromeOS; ...@@ -27,7 +28,7 @@ class BluetoothPairingChromeOS;
// The BluetoothDeviceChromeOS class implements BluetoothDevice for the // The BluetoothDeviceChromeOS class implements BluetoothDevice for the
// Chrome OS platform. // Chrome OS platform.
class BluetoothDeviceChromeOS class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceChromeOS
: public device::BluetoothDevice, : public device::BluetoothDevice,
public BluetoothGattServiceClient::Observer { public BluetoothGattServiceClient::Observer {
public: public:
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/observer_list.h" #include "base/observer_list.h"
#include "device/bluetooth/bluetooth_device.h" #include "device/bluetooth/bluetooth_device.h"
#include "device/bluetooth/bluetooth_export.h"
#include "device/bluetooth/bluetooth_task_manager_win.h" #include "device/bluetooth/bluetooth_task_manager_win.h"
namespace device { namespace device {
...@@ -19,7 +20,7 @@ class BluetoothAdapterWin; ...@@ -19,7 +20,7 @@ class BluetoothAdapterWin;
class BluetoothServiceRecordWin; class BluetoothServiceRecordWin;
class BluetoothSocketThread; class BluetoothSocketThread;
class BluetoothDeviceWin : public BluetoothDevice { class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceWin : public BluetoothDevice {
public: public:
explicit BluetoothDeviceWin( explicit BluetoothDeviceWin(
const BluetoothTaskManagerWin::DeviceState& device_state, const BluetoothTaskManagerWin::DeviceState& device_state,
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/callback.h" #include "base/callback.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "device/bluetooth/bluetooth_export.h"
namespace device { namespace device {
...@@ -25,7 +26,7 @@ class BluetoothAdapter; ...@@ -25,7 +26,7 @@ class BluetoothAdapter;
// AdapterDiscoveringChanged method of the BluetoothAdapter::Observer interface // AdapterDiscoveringChanged method of the BluetoothAdapter::Observer interface
// to be notified of such a change and promptly request a new // to be notified of such a change and promptly request a new
// BluetoothDiscoverySession if their existing sessions have become inactive. // BluetoothDiscoverySession if their existing sessions have become inactive.
class BluetoothDiscoverySession { class DEVICE_BLUETOOTH_EXPORT BluetoothDiscoverySession {
public: public:
// The ErrorCallback is used by methods to asynchronously report errors. // The ErrorCallback is used by methods to asynchronously report errors.
typedef base::Closure ErrorCallback; typedef base::Closure ErrorCallback;
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef DEVICE_BLUETOOTH_DEVICE_BLUETOOTH_EXPORT_H_
#define DEVICE_BLUETOOTH_DEVICE_BLUETOOTH_EXPORT_H_
#if defined(COMPONENT_BUILD) && defined(WIN32)
#if defined(DEVICE_BLUETOOTH_IMPLEMENTATION)
#define DEVICE_BLUETOOTH_EXPORT __declspec(dllexport)
#else
#define DEVICE_BLUETOOTH_EXPORT __declspec(dllimport)
#endif
#elif defined(COMPONENT_BUILD) && !defined(WIN32)
#if defined(DEVICE_BLUETOOTH_IMPLEMENTATION)
#define DEVICE_BLUETOOTH_EXPORT __attribute__((visibility("default")))
#else
#define DEVICE_BLUETOOTH_EXPORT
#endif
#else
#define DEVICE_BLUETOOTH_EXPORT
#endif
#endif // DEVICE_BLUETOOTH_DEVICE_BLUETOOTH_EXPORT_H_
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/callback.h" #include "base/callback.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "device/bluetooth/bluetooth_export.h"
#include "device/bluetooth/bluetooth_gatt_service.h" #include "device/bluetooth/bluetooth_gatt_service.h"
#include "device/bluetooth/bluetooth_uuid.h" #include "device/bluetooth/bluetooth_uuid.h"
...@@ -31,7 +32,7 @@ class BluetoothGattNotifySession; ...@@ -31,7 +32,7 @@ class BluetoothGattNotifySession;
// service. To achieve this, users can construct instances of // service. To achieve this, users can construct instances of
// BluetoothGattCharacteristic directly and add it to the desired // BluetoothGattCharacteristic directly and add it to the desired
// BluetoothGattService instance that represents a local service. // BluetoothGattService instance that represents a local service.
class BluetoothGattCharacteristic { class DEVICE_BLUETOOTH_EXPORT BluetoothGattCharacteristic {
public: public:
// Values representing the possible properties of a characteristic, which // Values representing the possible properties of a characteristic, which
// define how the characteristic can be used. Each of these properties serve // define how the characteristic can be used. Each of these properties serve
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <string> #include <string>
#include "base/callback.h" #include "base/callback.h"
#include "device/bluetooth/bluetooth_export.h"
namespace device { namespace device {
...@@ -17,7 +18,7 @@ namespace device { ...@@ -17,7 +18,7 @@ namespace device {
// active BluetoothGattConnection object. BluetoothGattConnection objects // active BluetoothGattConnection object. BluetoothGattConnection objects
// automatically update themselves, when the connection is terminated by the // automatically update themselves, when the connection is terminated by the
// operating system (e.g. due to user action). // operating system (e.g. due to user action).
class BluetoothGattConnection { class DEVICE_BLUETOOTH_EXPORT BluetoothGattConnection {
public: public:
// Destructor automatically closes this GATT connection. If this is the last // Destructor automatically closes this GATT connection. If this is the last
// remaining GATT connection and this results in a call to the OS, that call // remaining GATT connection and this results in a call to the OS, that call
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/callback.h" #include "base/callback.h"
#include "device/bluetooth/bluetooth_export.h"
#include "device/bluetooth/bluetooth_gatt_characteristic.h" #include "device/bluetooth/bluetooth_gatt_characteristic.h"
#include "device/bluetooth/bluetooth_uuid.h" #include "device/bluetooth/bluetooth_uuid.h"
...@@ -18,7 +19,7 @@ namespace device { ...@@ -18,7 +19,7 @@ namespace device {
// descriptor. A GATT characteristic descriptor provides further information // descriptor. A GATT characteristic descriptor provides further information
// about a characteristic's value. They can be used to describe the // about a characteristic's value. They can be used to describe the
// characteristic's features or to control certain behaviors. // characteristic's features or to control certain behaviors.
class BluetoothGattDescriptor { class DEVICE_BLUETOOTH_EXPORT BluetoothGattDescriptor {
public: public:
// The Bluetooth Specification declares several predefined descriptors that // The Bluetooth Specification declares several predefined descriptors that
// profiles can use. The following are definitions for the list of UUIDs // profiles can use. The following are definitions for the list of UUIDs
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <string> #include <string>
#include "base/callback.h" #include "base/callback.h"
#include "device/bluetooth/bluetooth_export.h"
namespace device { namespace device {
...@@ -15,7 +16,7 @@ namespace device { ...@@ -15,7 +16,7 @@ namespace device {
// to value updates from GATT characteristics that support notifications and/or // to value updates from GATT characteristics that support notifications and/or
// indications. Instances are obtained by calling // indications. Instances are obtained by calling
// BluetoothGattCharacteristic::StartNotifySession. // BluetoothGattCharacteristic::StartNotifySession.
class BluetoothGattNotifySession { class DEVICE_BLUETOOTH_EXPORT BluetoothGattNotifySession {
public: public:
// Destructor automatically stops this session. // Destructor automatically stops this session.
virtual ~BluetoothGattNotifySession(); virtual ~BluetoothGattNotifySession();
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/callback.h" #include "base/callback.h"
#include "device/bluetooth/bluetooth_export.h"
#include "device/bluetooth/bluetooth_uuid.h" #include "device/bluetooth/bluetooth_uuid.h"
namespace device { namespace device {
...@@ -31,7 +32,7 @@ class BluetoothGattDescriptor; ...@@ -31,7 +32,7 @@ class BluetoothGattDescriptor;
// adapter is used in the "peripheral" role. Such instances are meant to be // adapter is used in the "peripheral" role. Such instances are meant to be
// constructed directly and registered. Once registered, a GATT attribute // constructed directly and registered. Once registered, a GATT attribute
// hierarchy will be visible to remote devices in the "central" role. // hierarchy will be visible to remote devices in the "central" role.
class BluetoothGattService { class DEVICE_BLUETOOTH_EXPORT BluetoothGattService {
public: public:
// The Delegate class is used to send certain events that need to be handled // The Delegate class is used to send certain events that need to be handled
// when the device is in peripheral mode. The delegate handles read and write // when the device is in peripheral mode. The delegate handles read and write
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#include <ws2def.h> #include <ws2def.h>
#include <ws2bth.h> #include <ws2bth.h>
#include "device/bluetooth/bluetooth_export.h"
#pragma comment(lib, "Bthprops.lib") #pragma comment(lib, "Bthprops.lib")
#pragma comment(lib, "BluetoothApis.lib") #pragma comment(lib, "BluetoothApis.lib")
...@@ -26,7 +28,7 @@ namespace bluetooth_init_win { ...@@ -26,7 +28,7 @@ namespace bluetooth_init_win {
// Returns true if the machine has a bluetooth stack available. The first call // Returns true if the machine has a bluetooth stack available. The first call
// to this function will involve file IO, so it should be done on an appropriate // to this function will involve file IO, so it should be done on an appropriate
// thread. This function is not thread-safe. // thread. This function is not thread-safe.
bool HasBluetoothStack(); bool DEVICE_BLUETOOTH_EXPORT HasBluetoothStack();
} // namespace bluetooth_init_win } // namespace bluetooth_init_win
} // namespace device } // namespace device
......
...@@ -9,13 +9,14 @@ ...@@ -9,13 +9,14 @@
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h" #include "base/memory/scoped_vector.h"
#include "base/win/scoped_handle.h" #include "base/win/scoped_handle.h"
#include "device/bluetooth/bluetooth_export.h"
#include "device/bluetooth/bluetooth_low_energy_defs_win.h" #include "device/bluetooth/bluetooth_low_energy_defs_win.h"
namespace device { namespace device {
namespace win { namespace win {
// Represents a device registry property value // Represents a device registry property value
class DeviceRegistryPropertyValue { class DEVICE_BLUETOOTH_EXPORT DeviceRegistryPropertyValue {
public: public:
// Creates a property value instance, where |property_type| is one of REG_xxx // Creates a property value instance, where |property_type| is one of REG_xxx
// registry value type (e.g. REG_SZ, REG_DWORD), |value| is a byte array // registry value type (e.g. REG_SZ, REG_DWORD), |value| is a byte array
...@@ -47,7 +48,7 @@ class DeviceRegistryPropertyValue { ...@@ -47,7 +48,7 @@ class DeviceRegistryPropertyValue {
}; };
// Represents the value associated to a DEVPROPKEY. // Represents the value associated to a DEVPROPKEY.
class DevicePropertyValue { class DEVICE_BLUETOOTH_EXPORT DevicePropertyValue {
public: public:
// Creates a property value instance, where |property_type| is one of // Creates a property value instance, where |property_type| is one of
// DEVPROP_TYPE_xxx value type , |value| is a byte array containing the // DEVPROP_TYPE_xxx value type , |value| is a byte array containing the
...@@ -111,7 +112,8 @@ bool EnumerateKnownBluetoothLowEnergyServices( ...@@ -111,7 +112,8 @@ bool EnumerateKnownBluetoothLowEnergyServices(
ScopedVector<BluetoothLowEnergyServiceInfo>* services, ScopedVector<BluetoothLowEnergyServiceInfo>* services,
std::string* error); std::string* error);
bool ExtractBluetoothAddressFromDeviceInstanceIdForTesting( bool DEVICE_BLUETOOTH_EXPORT
ExtractBluetoothAddressFromDeviceInstanceIdForTesting(
const std::string& instance_id, const std::string& instance_id,
BLUETOOTH_ADDRESS* btha, BLUETOOTH_ADDRESS* btha,
std::string* error); std::string* error);
......
...@@ -9,12 +9,13 @@ ...@@ -9,12 +9,13 @@
#include <vector> #include <vector>
#include "base/basictypes.h" #include "base/basictypes.h"
#include "device/bluetooth/bluetooth_export.h"
#include "device/bluetooth/bluetooth_init_win.h" #include "device/bluetooth/bluetooth_init_win.h"
#include "device/bluetooth/bluetooth_uuid.h" #include "device/bluetooth/bluetooth_uuid.h"
namespace device { namespace device {
class BluetoothServiceRecordWin { class DEVICE_BLUETOOTH_EXPORT BluetoothServiceRecordWin {
public: public:
BluetoothServiceRecordWin(const std::string& device_address, BluetoothServiceRecordWin(const std::string& device_address,
const std::string& name, const std::string& name,
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "base/callback.h" #include "base/callback.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "device/bluetooth/bluetooth_export.h"
namespace net { namespace net {
class IOBuffer; class IOBuffer;
...@@ -27,7 +28,8 @@ class BluetoothUUID; ...@@ -27,7 +28,8 @@ class BluetoothUUID;
// various instance methods on the same thread as the thread used at // various instance methods on the same thread as the thread used at
// construction time -- platform specific implementation are responsible for // construction time -- platform specific implementation are responsible for
// marshalling calls to a different thread if required. // marshalling calls to a different thread if required.
class BluetoothSocket : public base::RefCountedThreadSafe<BluetoothSocket> { class DEVICE_BLUETOOTH_EXPORT BluetoothSocket
: public base::RefCountedThreadSafe<BluetoothSocket> {
public: public:
enum ErrorReason { kSystemError, kIOPending, kDisconnected }; enum ErrorReason { kSystemError, kIOPending, kDisconnected };
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/threading/thread_checker.h" #include "base/threading/thread_checker.h"
#include "device/bluetooth/bluetooth_export.h"
namespace base { namespace base {
class SequencedTaskRunner; class SequencedTaskRunner;
...@@ -19,7 +20,7 @@ namespace device { ...@@ -19,7 +20,7 @@ namespace device {
// Thread abstraction used by |BluetoothSocketChromeOS| and |BluetoothSocketWin| // Thread abstraction used by |BluetoothSocketChromeOS| and |BluetoothSocketWin|
// to perform IO operations on the underlying platform sockets. An instance of // to perform IO operations on the underlying platform sockets. An instance of
// this class can be shared by many active sockets. // this class can be shared by many active sockets.
class BluetoothSocketThread class DEVICE_BLUETOOTH_EXPORT BluetoothSocketThread
: public base::RefCountedThreadSafe<BluetoothSocketThread> { : public base::RefCountedThreadSafe<BluetoothSocketThread> {
public: public:
static scoped_refptr<BluetoothSocketThread> Get(); static scoped_refptr<BluetoothSocketThread> Get();
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "base/observer_list.h" #include "base/observer_list.h"
#include "base/win/scoped_handle.h" #include "base/win/scoped_handle.h"
#include "device/bluetooth/bluetooth_adapter.h" #include "device/bluetooth/bluetooth_adapter.h"
#include "device/bluetooth/bluetooth_export.h"
namespace base { namespace base {
...@@ -32,10 +33,10 @@ namespace device { ...@@ -32,10 +33,10 @@ namespace device {
// It delegates the blocking Windows API calls to |bluetooth_task_runner_|'s // It delegates the blocking Windows API calls to |bluetooth_task_runner_|'s
// message loop, and receives responses via methods like OnAdapterStateChanged // message loop, and receives responses via methods like OnAdapterStateChanged
// posted to UI thread. // posted to UI thread.
class BluetoothTaskManagerWin class DEVICE_BLUETOOTH_EXPORT BluetoothTaskManagerWin
: public base::RefCountedThreadSafe<BluetoothTaskManagerWin> { : public base::RefCountedThreadSafe<BluetoothTaskManagerWin> {
public: public:
struct AdapterState { struct DEVICE_BLUETOOTH_EXPORT AdapterState {
AdapterState(); AdapterState();
~AdapterState(); ~AdapterState();
std::string name; std::string name;
...@@ -43,7 +44,7 @@ class BluetoothTaskManagerWin ...@@ -43,7 +44,7 @@ class BluetoothTaskManagerWin
bool powered; bool powered;
}; };
struct ServiceRecordState { struct DEVICE_BLUETOOTH_EXPORT ServiceRecordState {
ServiceRecordState(); ServiceRecordState();
~ServiceRecordState(); ~ServiceRecordState();
// Properties common to Bluetooth Classic and LE devices. // Properties common to Bluetooth Classic and LE devices.
...@@ -54,7 +55,7 @@ class BluetoothTaskManagerWin ...@@ -54,7 +55,7 @@ class BluetoothTaskManagerWin
BluetoothUUID gatt_uuid; BluetoothUUID gatt_uuid;
}; };
struct DeviceState { struct DEVICE_BLUETOOTH_EXPORT DeviceState {
DeviceState(); DeviceState();
~DeviceState(); ~DeviceState();
...@@ -73,7 +74,7 @@ class BluetoothTaskManagerWin ...@@ -73,7 +74,7 @@ class BluetoothTaskManagerWin
base::FilePath path; base::FilePath path;
}; };
class Observer { class DEVICE_BLUETOOTH_EXPORT Observer {
public: public:
virtual ~Observer() {} virtual ~Observer() {}
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
#include <string> #include <string>
#include "device/bluetooth/bluetooth_export.h"
namespace device { namespace device {
// Opaque wrapper around a Bluetooth UUID. Instances of UUID represent the // Opaque wrapper around a Bluetooth UUID. Instances of UUID represent the
...@@ -14,7 +16,7 @@ namespace device { ...@@ -14,7 +16,7 @@ namespace device {
// used in Bluetooth based communication, such as a peripheral's services, // used in Bluetooth based communication, such as a peripheral's services,
// characteristics, and characteristic descriptors. An instance are // characteristics, and characteristic descriptors. An instance are
// constructed using a string representing 16, 32, or 128 bit UUID formats. // constructed using a string representing 16, 32, or 128 bit UUID formats.
class BluetoothUUID { class DEVICE_BLUETOOTH_EXPORT BluetoothUUID {
public: public:
// Possible representation formats used during construction. // Possible representation formats used during construction.
enum Format { enum Format {
...@@ -90,7 +92,8 @@ class BluetoothUUID { ...@@ -90,7 +92,8 @@ class BluetoothUUID {
}; };
// This is required by gtest to print a readable output on test failures. // This is required by gtest to print a readable output on test failures.
void PrintTo(const BluetoothUUID& uuid, std::ostream* out); void DEVICE_BLUETOOTH_EXPORT
PrintTo(const BluetoothUUID& uuid, std::ostream* out);
} // namespace device } // namespace device
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment