Commit Graph

42 Commits

Author SHA1 Message Date
Niels Grewe
40258b7034 A lot of changes to deal with the fact that many D-Bus services
use variant typed arguments extensively. Inside those, we don't
have any introspection information, and the other side might have
expectations that we don't know about. Hence, we now have classes
to explicitly identify the format we want to pass the object in.

Using these new classes, our implementation of the D-Bus menu protocol 
has is finally progressed into working state!


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@37606 72102866-910b-0410-8b05-ffd578937521
2014-01-15 19:16:54 +00:00
Niels Grewe
6188a008b3 Finish support for posting notifications/signals to D-Bus.
This also changes the behaviour of DKPort: If a local receive
port is requested, we now cache it and always return the
same instance. This makes sense because the underlying 
DKEndpoint is shared anyways, and it fixes a bug where
multiple ports were exposing different parts of the object
graph without knowing about each other (this only became
apparent when the notification center class started looking
up the proxies and couldn't find them eventhough they were
properly exported).

Also contains some debugging and example improvements.




git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@37604 72102866-910b-0410-8b05-ffd578937521
2014-01-14 21:02:57 +00:00
Niels Grewe
1fa440e08e Deprecate some observer management methods because it was
using a mixture of C-style arguments and varags in a
slightly confusing way. Introduce new replacement methods
that accept the filter specification as a dictionary.

Documentation improvements.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@37586 72102866-910b-0410-8b05-ffd578937521
2014-01-13 08:33:43 +00:00
Niels Grewe
12639b9de3 Support for explicitly designating an object to be exposed as a structure
on D-Bus. This is only required in some corner cases where the structure
appears inside a variant-typed argument. This means that we don't have any
introspection information to decide whether we want to marshall an NSArray
as a D-Bus structure or a D-Bus array.
Also start support for converting NSData to D-Bus byte arrays. 


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@37531 72102866-910b-0410-8b05-ffd578937521
2014-01-01 19:36:36 +00:00
Niels Grewe
2891af1ce9 Expose some more DKProxy state for subclasses. Implement private method
for manually loading instrospection metadata into a outward facing proxy.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@36797 72102866-910b-0410-8b05-ffd578937521
2013-07-02 10:30:00 +00:00
Niels Grewe
0d7353ce76 Implement D-Bus method generation from Objective-C runtime introspection data
(no methods get yet exposed on the bus, though). Fix a couple of bugs.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@35410 72102866-910b-0410-8b05-ffd578937521
2012-08-16 08:21:59 +00:00
Niels Grewe
28572c0c9d Finally clean up and commit WIP object path management code.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@35100 72102866-910b-0410-8b05-ffd578937521
2012-04-21 19:24:55 +00:00
Niels Grewe
d0d44a9224 Start work on scaffolding for vending objects to D-Bus.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@34945 72102866-910b-0410-8b05-ffd578937521
2012-03-17 21:51:36 +00:00
Niels Grewe
69a8dd2665 Fix declaration of queueCount ivar.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@34944 72102866-910b-0410-8b05-ffd578937521
2012-03-17 21:17:54 +00:00
Niels Grewe
2ca4ea9f8e Eliminate a problematic code-path by not depending on the libdbus API for adding
and removing match rules. Turns out we can just call the corresponding methods
via the bus objects. 


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@33033 72102866-910b-0410-8b05-ffd578937521
2011-05-13 08:26:54 +00:00
Niels Grewe
bb61cac657 Thread safety fixes, started working on generating D-Bus XML introspection data.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@33031 72102866-910b-0410-8b05-ffd578937521
2011-05-12 20:32:15 +00:00
Niels Grewe
5e7f448c7b Documentation improvements. Avoid starting the worker thread before we
really need it.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@32394 72102866-910b-0410-8b05-ffd578937521
2011-02-27 22:52:24 +00:00
Niels Grewe
27e02097dd Start working on recovery of the bus objects after disconnection from the bus.
Also sanitize the dependencies of DKNotificationCenter and DKDBus (previously,
certain conditions could trigger them to go into an infinite loop calling each
other).



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@32210 72102866-910b-0410-8b05-ffd578937521
2011-02-18 21:20:19 +00:00
Niels Grewe
0581388c0e Add stub implementation of a port name server.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@32190 72102866-910b-0410-8b05-ffd578937521
2011-02-16 08:41:24 +00:00
Niels Grewe
383d61bf75 Merge DBusKit-ThreadRewrite branch. DBusKit now offloads all interactions with
libdbus to a separate thread and uses DKEndpointManager as a gateway to do so.
The new behaviour is disabled by default and can be enabled by calling [DKPort
enableWorkerThread].
This also contains various smaller improvements and fixes bugs that were exposed
when stuff was taking place asynchronously.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@32178 72102866-910b-0410-8b05-ffd578937521
2011-02-15 22:05:24 +00:00
Niels Grewe
cd0f6cb33e Make DKProxy use a DKPort instead of a DKEndpoint/service name-pair. This is the
level of abstraction that will be used by DKPortNameServer to handle connection
invalidation etc.
Note: This breaks binary compatibility for DKPort subclasses when using the
fragile ABI.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31376 72102866-910b-0410-8b05-ffd578937521
2010-09-19 11:23:50 +00:00
Niels Grewe
3b177d7c9c * COPYING: Add LGPL.
* GNUmakefile: Add documentation to the build.
* GNUmakefile.preamble: Add version variable.
* Documentation/GNUmakefile
  Documentation/GNUmakefile.postamble
  Documentation/readme.texi
  Documentation/install.texi
  Documentation/DBusKit.gsdoc:
  Build README and INSTALL as well as reference documentation.
* Headers/DKProxy.h
  Headers/DKPort.h
  Headers/DNotificationCenter.h:
  Mark ivars as private. Minor documentation improvements.
* README
  INSTALL:
  Regenerate.

Improvements to the documentation.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31169 72102866-910b-0410-8b05-ffd578937521
2010-08-16 13:47:57 +00:00
Niels Grewe
a3d9847375 Clarify removal semantics for observations.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31166 72102866-910b-0410-8b05-ffd578937521
2010-08-16 08:44:22 +00:00
Niels Grewe
ba1471914b Simplify removal of observations.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31164 72102866-910b-0410-8b05-ffd578937521
2010-08-16 08:17:49 +00:00
Niels Grewe
a7cefdc366 * Headers/DBusKit.h: Add DKNotificationCenter.h
* Source/DKProxy.m: Use correct path to the bus object.
* Source/DKNotificationCenter.m: Observe name changes so 
  that sender rules for observables stay up to date.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31129 72102866-910b-0410-8b05-ffd578937521
2010-08-13 11:40:17 +00:00
Niels Grewe
ee4f1cfa86 * Headers/DKProxy.h: Small documentation improvement.
* Headers/DKNotificationCenter.h: Documented DKNotificationCenter. Added ivar.
* Source/DKProxy.m: Override -respondsToSelector:. Protect generation of the
  method cache so that a remote error doesn't leave the object in an unusable
  state.
* Source/DKEndpoint.m: Fix DKWakeUp(). (Previously, it would create unwanted
  reentrancy.)
* Source/DKNotificationCenter.m: Primitive support for observing D-Bus signals.

Preliminary support for D-Bus signals. Documentation improvements.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31126 72102866-910b-0410-8b05-ffd578937521
2010-08-13 10:33:40 +00:00
Niels Grewe
7c2b8c41aa * Headers/DKProxy.h
Source/DKProxy.m
  Source/DKInterface.[hm]:
  Remove dispatch table from DKProxy and let DKInterface generate it instead.
* Source/DKInterface.[hm]: Fix memory leak. Rename -methodForSelector: to
  -DBusMethodForSelector:. Also move registration of signals here.
* Source/DKMethod.m: Generate smarter method declarations.
* Source/DKIntrospectionParserDelegate.m: Return nil from -leaf instead of
  NSNull. Improve handling signals.
* Source/DKSignal.[hm]: Implement generation of userInfo dictionaries for
  notifications from received signals.
* Source/DKMethodCall.m: Small indentation fix.
* Headers/DKNotificationCenter.h
  Source/DKNotificationCenter.m:
  Bugfixes. Continue implementing generation of notifications from signals.
* Tests/TestDKMethodCall.m
  Tests/TestDkMethod.m:
  Use new method name.

A few bugfixes and improvements suggested by Fred Kiefer. Continued work on
D-Bus signals.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31122 72102866-910b-0410-8b05-ffd578937521
2010-08-12 21:21:48 +00:00
Niels Grewe
3ad6b56190 Implement method to add match rules for signals.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31101 72102866-910b-0410-8b05-ffd578937521
2010-08-09 19:41:05 +00:00
Niels Grewe
660085f72b * Headers/DKProxy.h
Source/DKProxy.m:
  API refinements for DKDBus.
* Headers/DKPort.h
  Source/DKPort.m
  Tests/TestDKProxy.m:
  Finish replacing subclasses with equivalent initializers. Adopt test case.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31098 72102866-910b-0410-8b05-ffd578937521
2010-08-09 14:54:59 +00:00
Niels Grewe
4e5c14e7d5 Move rule generation into DKObservable helper-class.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31096 72102866-910b-0410-8b05-ffd578937521
2010-08-09 09:01:50 +00:00
Niels Grewe
b64dca900c Remove struct nonsense in favour of real objects.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31095 72102866-910b-0410-8b05-ffd578937521
2010-08-08 20:20:44 +00:00
Niels Grewe
5f686a8408 * Source/DKSignal.[hm]: Make DKSignal useful.
* Header/DKNotificationCenter.h: Add notificationNames ivar.
* Source/DKNotificationCenter.m: Implement registration of signals and
  notification names.
* DKIntrospectionParserDelegate.m: Parse signals and trigger their
  registration with the appropriate notification center.
* Tests/TestDKProxy.m: Fix test for errors returned by remote objects.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31094 72102866-910b-0410-8b05-ffd578937521
2010-08-08 02:28:09 +00:00
Niels Grewe
dd63b72009 * Headers/DKProxy.h
Source/DKProxy.m:
  Add DKDBus subclass for getting shared proxies to the org.freedesktop.DBus
  services on their respective busses.
* Source/DKProxy.m
  Source/DKProxy+Private.h:
  Implement -_uniqueName to get the unique name of a service from the bus.
* Headers/DKPort.h: Add "don't know" member value to the bus type enumeration.
* Source/DKPort.m: Use DKDBus instead of -getBusObject magic.
* Source/DKEndpoint.[hm]: Implement -DBusBusType to get the type of bus an
  endpoint is connected to.
* Source/DKInterface.[hm]: Add some more methods for signals/properties.
* Headers/DKNotificationCenter.h
  Source/DKNotificationCenter.m
  Source/GNUmakefile:
  Add very much work-in-progress notification center class for managing D-Bus
  signals.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31090 72102866-910b-0410-8b05-ffd578937521
2010-08-07 17:35:22 +00:00
Niels Grewe
a74e8429f8 * Headers/DKPort.h
Source/DKPort.m:
  Add DKDBusBusType enumeration and related initializer.
* Source/DKArgument.m
  Source/DKInterface.m
  Source/DKIntrospectionNode.[hm]
  Source/DKMethod.m
  Source/DKObjectPathNode.m
  Source/DKSignal.m:
  Adopt NSCopying for DKIntrospectionNode and subclasses.
* Source/NSConnection+DBus.m: Add further integration methods (commented out
  until DKPortNameServer can be committed).


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31083 72102866-910b-0410-8b05-ffd578937521
2010-08-05 07:14:13 +00:00
Niels Grewe
de8e4920fc * Headers/DKProxy.h
Source/DKProxy.m:
  Add an explicit NSCondition and a state variable to make synchronisation more
  robust (and readable).
* Tests/TestDKProxy.m: Adopt to changed code and add test for calling methods
  from multiple threads.

Thread safety improvements.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31061 72102866-910b-0410-8b05-ffd578937521
2010-07-31 01:25:19 +00:00
Niels Grewe
5c427df3a2 * Headers/DKProxy.h
Source/GNUmakefile
  Source/DKObjectPathNode.[hm]
  Source/DKProxy.m
  Source/DKProxy+Private.h:
  Add DKObjectPathNode class and protocol (handles object trees and interfaces).
  Implement DKObjectPathNode protocol in DKProxy and expose it via
  DKProxy+Private.h.
* Source/DKArgument.m
  Source/DKIntrospectionNode.m
  Source/DKMethod.m
  Source/DKMethodCall.m
  Source/DKOutgoingProxy.h
  Source/DKPort.m
  Source/DKProxy.m
  Source/NSConnection+DBus.m:
  Include new DKProxy+Private.h instead of the public header.
* Source/DKMethod.[hm]
  Source/DKInterface.[hm]
  Source/DKIntrospectionParserDelegate.m
  Tests/TestDKMethod.m:
  Rename initializers of DKMethod and DKInterface to follow the naming scheme of
  the superclass more closely.
* Source/DKIntrospectionParserDelegate.[hm]: Use the parent to store the
  introspection tree and not the parser delegate.

Clean up the generation of the introspection data so that the parser delegate
doesn't need to keep the generated tree around. Also be more consistent about
naming initializers in subclasses of DKIntrospectionNode.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31045 72102866-910b-0410-8b05-ffd578937521
2010-07-28 14:56:58 +00:00
Niels Grewe
8e0343c404 * Headers/NSConnection+DBus.h
Source/NSConnection+DBus.m:
  Add -proxyAtPath: method to obtain proxies for non-root objects of a D-Bus
  service.
* Source/GNUmakefile: Add NSConnection+DBus.[hm] to build.
* Source/DKPort.m: Rearrange so that proxy generation is separated from encoding
  the proxy for use in NSConnection.
* Headers/DBusKit.h: Add DKProxy.h and NSConnection+DBus.h.
* Tests/TestDKProxy.m: Test for fetching proxies to non-root objects. 


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31012 72102866-910b-0410-8b05-ffd578937521
2010-07-21 13:06:35 +00:00
Niels Grewe
dc8565c4bb * Source/DKPort.m: Move from NSLog() to NSDebugMLog()
* Source/DKProxy.[mh]: Move from NSLog() to NSDebugMLog(). Implement
  -setPrimaryDBusInterface:.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@30997 72102866-910b-0410-8b05-ffd578937521
2010-07-19 08:11:45 +00:00
Niels Grewe
919ac8a4b9 * Source/DKMethod.[hm]: Be more flexible about boxing. Decide whether argument
should or shouldn't be boxed based on the related invocation.
* Source/DKMethodCall.[hm]
  Source/DKProxy.m
  Tests/TestDKMethodCall.m
  Tests/TestDKProxy.m:
  Remove references to the old argument types which did statically decide on a
  boxing scheme.
* Headers/DKProxy.h: Remove unused ivar.

Make better use of D-Bus and Objective-C introspection data to decide on the fly
whether an argument to a D-Bus method should be boxed in an Objective-C object
or not.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@30979 72102866-910b-0410-8b05-ffd578937521
2010-07-16 12:49:34 +00:00
Niels Grewe
95f4360669 * Headers/DKProxy.h: Add needed ivars.
* Source/AsyncBehavior.h: Minor addition.
* Source/DKArgument.[mh]: Remove -proxyParent method (now in superclass)
* Source/DKInterface.h: Declare -mangledName.
* Source/DKInterface.m: Implement selector/method-map and XML parser delegate
  methods.
* Source/DKIntrospectionNode.[mh]: Move -proxyParent method here. Handle
  annotations.
* Source/DKMethod.[hm]: Implement -selectorString method to generate selector
  names. Also add XML parser delegate methods.
* Source/DKMethodCall.m: Fix bug where an D-Bus error was used unitialized.
* Source/DKProxy.m: Remove async stuff (pretty superfluous right now). Fix
  various bugs in selector resolution and implement building the method cache.
* Source/Tests/TestDKProxy.m: Add tests for new functionality.

Implement the remaining bits of basic proxy functionality. Arbitrary D-Bus
methods can now be called when their arguments are boxed as Objective-C types.
Calling methods without boxing to come.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@30947 72102866-910b-0410-8b05-ffd578937521
2010-07-12 20:35:03 +00:00
Niels Grewe
f5f682d47a * Source/AsyncBehavior.h: Add macros to do stuff asynchronously if possible.
* Source/DKInterface.[hm]: Remove superfluous -parent method.
* Source/DKMethod.m: Some more modularisation. Add comparison method.
  Calculate offsets and sizes for signatures correctly.
* Headers/DKProxy.h: Add instance variables.
* Source/DKProxy.[hm]: Implement -forwardInvocation: and triggers to generate
  the method cache (actual generation of the cache still missing).
* Source/Tests/TestDKProxy.m: Add test for calling Introspect() via the
  built-in _DKMethodIntrospect.
* Source/Tests/TestDKArgument.m: Minor rearrangement.

Made dispatching D-Bus method calls work via -forwardInvocation:. As of yet, you
can only call -Introspect (this is needed to obtain the introspection data used
to build the actual method cache).


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@30912 72102866-910b-0410-8b05-ffd578937521
2010-07-02 21:48:30 +00:00
Niels Grewe
517874dca8 * Source/Tests/TestDKMethod.m
Source/Tests/TestDKArgument.m:
  Tests for assignments in the initializers.
* Source/DKProxy.m
  Headers/DKProxy.h:
  -hasSameScopeAs: method to test whether two proxies fall into the scope of
  one and the same D-Bus service.
* Source/DKArgument.h: Expose a few accessors. 
* Source/DKArgument.m: Fix bug in the name assignment. Implement -name method.
  Let the proxy do the scope checking.
* Source/DKMethod.m: Shuffle a few statements around for more natural ordering.
* configure.ac: Leave a TODO about needing to fix the configure script
  ugliness.
* config.make.in: Another attempt to get linking done properly.

Many improvement suggested by Fred Kiefer.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@30687 72102866-910b-0410-8b05-ffd578937521
2010-06-11 21:52:09 +00:00
Niels Grewe
ee7d90418f Fix failure to link against libdbus (reported by Fred Kiefer).
Initial work on method-name mangling. 


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@30686 72102866-910b-0410-8b05-ffd578937521
2010-06-11 21:06:25 +00:00
Niels Grewe
fd1b66db25 Add a dummy proxy class. Finish implementation of the NSConnection integration
for ROOTPROXY_REQUEST messages: Connections to D-Bus can now return their own
proxies.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@30501 72102866-910b-0410-8b05-ffd578937521
2010-05-30 23:13:17 +00:00
Niels Grewe
40eae871ed * Source/DKEndpoint.m: Fixes a bug where returning an pre-existing
DKEndpoint would result in a teardown of the D-Bus connection. Also work
  around some libdbus strangeness that needs further investigation.
* Source/DKPort.m: Slightly more expressive designated initializer. Begin
  stubbing out integration into NSConnection (not yet working).
* Headers/DKPort.h: Add initializer.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@30456 72102866-910b-0410-8b05-ffd578937521
2010-05-26 15:49:33 +00:00
Niels Grewe
e36fb8a562 Add configure script and paraphernalia (but make still regenerates config.make
on distclean).

Simple initializers for DKPort.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@30344 72102866-910b-0410-8b05-ffd578937521
2010-05-10 05:49:49 +00:00
Niels Grewe
f84a07139e Getting ready for GSoC: Import old and current D-Bus projects.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@30331 72102866-910b-0410-8b05-ffd578937521
2010-05-09 18:19:11 +00:00