blob: 0d9a757297091d2ec186b9a067ef0cb3519d2f63 [file] [log] [blame]
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +01001// Copyright (c) 2013 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#include "device/bluetooth/bluetooth_profile.h"
6
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +01007#if defined(OS_CHROMEOS)
Torne (Richard Coles)7d4cd472013-06-19 11:58:07 +01008#include "device/bluetooth/bluetooth_profile_chromeos.h"
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +01009#elif defined(OS_MACOSX)
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +010010#include "base/mac/mac_util.h"
11#include "device/bluetooth/bluetooth_profile_mac.h"
12#elif defined(OS_WIN)
13#include "device/bluetooth/bluetooth_profile_win.h"
14#endif
15
16#include <string>
17
18namespace device {
19
20BluetoothProfile::Options::Options()
21 : channel(0),
22 psm(0),
23 require_authentication(false),
24 require_authorization(false),
25 auto_connect(false),
26 version(0),
27 features(0) {
28}
29
30BluetoothProfile::Options::~Options() {
31
32}
33
34
35BluetoothProfile::BluetoothProfile() {
36
37}
38
39BluetoothProfile::~BluetoothProfile() {
40
41}
42
43
44// static
45void BluetoothProfile::Register(const std::string& uuid,
46 const Options& options,
47 const ProfileCallback& callback) {
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +010048#if defined(OS_CHROMEOS)
Torne (Richard Coles)7d4cd472013-06-19 11:58:07 +010049 chromeos::BluetoothProfileChromeOS* profile = NULL;
50 profile = new chromeos::BluetoothProfileChromeOS();
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +010051 profile->Init(uuid, options, callback);
52#elif defined(OS_MACOSX)
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +010053 BluetoothProfile* profile = NULL;
54
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +010055 if (base::mac::IsOSLionOrLater())
56 profile = new BluetoothProfileMac(uuid, options.name);
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +010057 callback.Run(profile);
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +010058#elif defined(OS_WIN)
59 BluetoothProfile* profile = NULL;
60 profile = new BluetoothProfileWin(uuid, options.name);
61 callback.Run(profile);
62#else
63 callback.Run(NULL);
64#endif
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +010065}
66
67} // namespace device