2010-05-30 23:13:17 +00:00
|
|
|
/** Interface for the DKProxy class representing D-Bus objects on the
|
|
|
|
GNUstep side.
|
|
|
|
Copyright (C) 2010 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
Written by: Niels Grewe <niels.grewe@halbordnung.de>
|
|
|
|
Created: May 2010
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Library General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with this library; if not, write to the Free
|
|
|
|
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
Boston, MA 02111 USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#import <Foundation/NSProxy.h>
|
2010-08-09 14:54:59 +00:00
|
|
|
#import <DBusKit/DKPort.h>
|
2010-05-30 23:13:17 +00:00
|
|
|
|
2010-07-31 01:25:19 +00:00
|
|
|
@class DKEndpoint, DKInterface, NSCondition, NSLock, NSString, NSMapTable, NSMutableArray, NSMutableDictionary;
|
2010-05-30 23:13:17 +00:00
|
|
|
@protocol NSCoding;
|
|
|
|
|
2010-08-13 10:33:40 +00:00
|
|
|
/**
|
|
|
|
* The DKProxy class is used to send messages to D-Bus objects. Usually, you
|
|
|
|
* don't create them yourself but by using the DKPort and NSConnection classes.
|
|
|
|
*/
|
2010-05-30 23:13:17 +00:00
|
|
|
@interface DKProxy: NSProxy <NSCoding>
|
|
|
|
{
|
2010-08-16 13:47:57 +00:00
|
|
|
@private
|
|
|
|
/**
|
2010-09-19 11:23:50 +00:00
|
|
|
* The (remote) port object used for communication with D-Bus.
|
2010-08-16 13:47:57 +00:00
|
|
|
*/
|
2010-09-19 11:23:50 +00:00
|
|
|
DKPort *port;
|
2010-08-16 13:47:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The object path identifying the object proxied.
|
|
|
|
*/
|
2010-05-30 23:13:17 +00:00
|
|
|
NSString *path;
|
2010-08-16 13:47:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
2010-07-02 21:48:30 +00:00
|
|
|
NSMutableDictionary *interfaces;
|
2010-08-16 13:47:57 +00:00
|
|
|
|
|
|
|
/**
|
2012-04-21 19:24:55 +00:00
|
|
|
* The name->child dictionary of all direct children of the node.
|
2010-08-16 13:47:57 +00:00
|
|
|
*/
|
2012-04-21 19:24:55 +00:00
|
|
|
NSMutableDictionary *children;
|
2010-08-16 13:47:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A reference to the interface that is marked active and will be preferred
|
|
|
|
* for method resolution.
|
|
|
|
*/
|
2010-07-02 21:48:30 +00:00
|
|
|
DKInterface *activeInterface;
|
2010-08-16 13:47:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The lock protecting modifications to the tables.
|
|
|
|
*/
|
2010-07-31 01:25:19 +00:00
|
|
|
NSLock *tableLock;
|
2010-08-16 13:47:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The condition object ensures that state changes in the proxy can be
|
|
|
|
* conducted in a snychronized manner.
|
|
|
|
*/
|
2010-07-31 01:25:19 +00:00
|
|
|
NSCondition *condition;
|
2010-08-16 13:47:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Identifies the present state of the proxy.
|
|
|
|
*/
|
2010-07-31 01:25:19 +00:00
|
|
|
NSInteger state;
|
2010-05-30 23:13:17 +00:00
|
|
|
}
|
|
|
|
|
2010-09-19 11:23:50 +00:00
|
|
|
+ (id) proxyWithPort: (DKPort*)aPort
|
|
|
|
path: (NSString*)aPath;
|
|
|
|
|
|
|
|
+ (id) proxyWithService: (NSString*)aService
|
|
|
|
path: (NSString*)aPath
|
|
|
|
bus: (DKDBusBusType)type;
|
|
|
|
|
|
|
|
- (id) initWithPort: (DKPort*)aPort
|
|
|
|
path: (NSString*)aPath;
|
|
|
|
|
|
|
|
- (id) initWithService: (NSString*)aService
|
|
|
|
path: (NSString*)aPath
|
|
|
|
bus: (DKDBusBusType)type;
|
2010-05-30 23:13:17 +00:00
|
|
|
|
|
|
|
- (id) initWithEndpoint: (DKEndpoint*)anEndpoint
|
|
|
|
andService: (NSString*)aService
|
|
|
|
andPath: (NSString*)aPath;
|
2010-06-11 21:52:09 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks whether the to proxies are attached to the same D-Bus service.
|
|
|
|
*/
|
|
|
|
- (BOOL) hasSameScopeAs: (DKProxy*)aProxy;
|
2010-07-19 08:11:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* D-Bus allows identically named methods to appear in multiple interfaces. By
|
|
|
|
* default and in accordance with the D-Bus specification, DKProxy will call the
|
|
|
|
* first available implementation unless you specify the interface. If you
|
|
|
|
* usually call methods from a specific interface, you can designate the
|
|
|
|
* interface as the primary one by calling -setPrimaryDBusInterface:.
|
|
|
|
*/
|
2010-08-13 10:33:40 +00:00
|
|
|
- (void)setPrimaryDBusInterface: (NSString*)anInterface;
|
2010-05-30 23:13:17 +00:00
|
|
|
@end
|
2010-08-07 17:35:22 +00:00
|
|
|
|
2011-02-27 22:52:24 +00:00
|
|
|
extern NSString* DKBusDisconnectedNotification;
|
|
|
|
extern NSString* DKBusReconnectedNotification;
|
2010-08-07 17:35:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The DKDBus class exposes the D-Bus objects specifically (i.e. the
|
|
|
|
* "org.freedesktop.DBus" service). The instances returned by this class are
|
|
|
|
* shared objects: Calling -setPrimaryDBusInterface: on them has no effect.
|
2011-02-27 22:52:24 +00:00
|
|
|
*
|
|
|
|
* DKDBus instances also emit notifications about the state of the bus they
|
|
|
|
* represent. An application can watch for a
|
|
|
|
* <code>DKBusDisconnectedNotification</code> and
|
|
|
|
* <code>DKBusReconnectedNotification</code> to be notified about state changes
|
|
|
|
* for the bus.
|
2010-08-07 17:35:22 +00:00
|
|
|
*/
|
|
|
|
@interface DKDBus: DKProxy
|
2011-02-18 21:20:19 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The isDisconnected flag is set by a bus object that experiences a bus
|
|
|
|
* failure and tries to reconnect to the bus.
|
|
|
|
*/
|
|
|
|
BOOL isDisconnected;
|
|
|
|
}
|
2010-08-09 14:54:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a reference to the org.freedesktop.DBus service on the bus specified
|
|
|
|
* by type.
|
|
|
|
*/
|
|
|
|
+(id)busWithBusType: (DKDBusBusType)type;
|
|
|
|
|
2010-08-07 17:35:22 +00:00
|
|
|
/**
|
|
|
|
* Returns a reference to the org.freedesktop.DBus service on the session
|
|
|
|
* message bus.
|
|
|
|
*/
|
|
|
|
+(id)sessionBus;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a reference to the org.freedesktop.DBus service on the system
|
|
|
|
* message bus.
|
|
|
|
*/
|
|
|
|
+(id)systemBus;
|
|
|
|
@end
|