fat: Greatly simplify and clean up dosfs_get_file_map().
[haiku.git] / src / preferences / bluetooth / BluetoothSettings.cpp
blob2f3bc59d86bd5deec64e42389d190760c3e97e79
1 /*
2 * Copyright 2008-2009, Oliver Ruiz Dorantes, <oliver.ruiz.dorantes@gmail.com>
3 * Copyright 2012-2013, Tri-Edge AI <triedgeai@gmail.com>
5 * All rights reserved. Distributed under the terms of the MIT license.
6 */
8 #include "BluetoothSettings.h"
10 BluetoothSettings::BluetoothSettings()
12 find_directory(B_USER_SETTINGS_DIRECTORY, &fPath);
13 fPath.Append("Bluetooth_settings", true);
17 BluetoothSettings::~BluetoothSettings()
23 void
24 BluetoothSettings::Defaults()
26 Data.PickedDevice = bdaddrUtils::NullAddress();
27 Data.LocalDeviceClass = DeviceClass();
31 void
32 BluetoothSettings::Load()
34 fFile = new BFile(fPath.Path(), B_READ_ONLY);
36 if (fFile->InitCheck() == B_OK) {
37 fFile->Read(&Data, sizeof(Data));
38 // TODO: Add more settings here.
39 } else
40 Defaults();
42 delete fFile;
46 void
47 BluetoothSettings::Save()
49 fFile = new BFile(fPath.Path(), B_WRITE_ONLY | B_CREATE_FILE);
51 if (fFile->InitCheck() == B_OK) {
52 fFile->Write(&Data, sizeof(Data));
53 // TODO: Add more settings here.
56 delete fFile;