2006-10-19 15:24:57 +04:00
|
|
|
/*
|
2013-09-30 03:11:23 +04:00
|
|
|
* Copyright 2006-2013, Haiku, Inc. All Rights Reserved.
|
2006-10-19 15:24:57 +04:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Axel Dörfler, axeld@pinc-software.de
|
|
|
|
*/
|
|
|
|
#ifndef SETTINGS_H
|
|
|
|
#define SETTINGS_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <Message.h>
|
2006-10-19 17:37:13 +04:00
|
|
|
#include <Messenger.h>
|
2013-09-30 03:11:23 +04:00
|
|
|
#include <Path.h>
|
2006-10-19 15:24:57 +04:00
|
|
|
|
|
|
|
|
|
|
|
class Settings {
|
2010-06-11 11:29:16 +04:00
|
|
|
public:
|
|
|
|
Settings();
|
|
|
|
~Settings();
|
|
|
|
|
|
|
|
status_t GetNextInterface(uint32& cookie,
|
|
|
|
BMessage& interface);
|
2011-10-07 14:15:57 +04:00
|
|
|
|
2011-10-09 23:56:19 +04:00
|
|
|
int32 CountNetworks() const;
|
2010-12-09 03:11:15 +03:00
|
|
|
status_t GetNextNetwork(uint32& cookie,
|
2011-10-09 23:56:19 +04:00
|
|
|
BMessage& network) const;
|
2011-10-07 14:15:57 +04:00
|
|
|
status_t AddNetwork(const BMessage& network);
|
2011-10-09 23:56:19 +04:00
|
|
|
status_t RemoveNetwork(const char* name);
|
2011-10-07 14:15:57 +04:00
|
|
|
|
2010-06-11 11:29:16 +04:00
|
|
|
status_t GetNextService(uint32& cookie,
|
|
|
|
BMessage& service);
|
|
|
|
const BMessage& Services() const;
|
|
|
|
|
|
|
|
status_t StartMonitoring(const BMessenger& target);
|
|
|
|
status_t StopMonitoring(const BMessenger& target);
|
|
|
|
|
|
|
|
status_t Update(BMessage* message);
|
|
|
|
|
|
|
|
private:
|
|
|
|
status_t _Load(const char* name = NULL,
|
|
|
|
uint32* _type = NULL);
|
2011-10-07 14:15:57 +04:00
|
|
|
status_t _Save(const char* name = NULL);
|
2013-09-30 03:11:23 +04:00
|
|
|
BPath _Path(BPath& parent, const char* name);
|
2010-06-11 11:29:16 +04:00
|
|
|
status_t _GetPath(const char* name, BPath& path);
|
|
|
|
|
|
|
|
status_t _StartWatching(const char* name,
|
|
|
|
const BMessenger& target);
|
2011-10-07 14:15:57 +04:00
|
|
|
|
2010-06-11 11:29:16 +04:00
|
|
|
bool _IsWatching(const BMessenger& target) const
|
|
|
|
{ return fListener == target; }
|
|
|
|
bool _IsWatching() const
|
|
|
|
{ return fListener.IsValid(); }
|
|
|
|
|
|
|
|
private:
|
|
|
|
BMessenger fListener;
|
|
|
|
BMessage fInterfaces;
|
2010-12-14 01:24:39 +03:00
|
|
|
BMessage fNetworks;
|
2010-06-11 11:29:16 +04:00
|
|
|
BMessage fServices;
|
2006-10-19 15:24:57 +04:00
|
|
|
};
|
|
|
|
|
2010-06-11 11:29:16 +04:00
|
|
|
|
2006-10-19 17:37:13 +04:00
|
|
|
static const uint32 kMsgInterfaceSettingsUpdated = 'SUif';
|
2006-12-22 23:53:08 +03:00
|
|
|
static const uint32 kMsgServiceSettingsUpdated = 'SUsv';
|
2006-10-19 17:37:13 +04:00
|
|
|
|
2010-06-11 11:29:16 +04:00
|
|
|
|
2006-10-19 15:24:57 +04:00
|
|
|
#endif // SETTINGS_H
|