Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
Start export test, hack interface to not return enums
Browse files Browse the repository at this point in the history
  • Loading branch information
Alp Toker committed Aug 27, 2006
1 parent e237ff7 commit 7765ded
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/DBus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,12 @@ public interface Properties
[Interface ("org.freedesktop.DBus")]
public interface Bus : Introspectable
{
NameReply RequestName (string name, NameFlag flags);
ReleaseNameReply ReleaseName (string name);
//return enum won't work until type mapping is done

//NameReply RequestName (string name, NameFlag flags);
uint RequestName (string name, NameFlag flags);
//ReleaseNameReply ReleaseName (string name);
uint ReleaseName (string name);
string Hello ();
string[] ListNames ();
bool NameHasOwner (string name);
Expand Down
2 changes: 2 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ NDesk.DBus.Ssl.dll: NDesk.DBus.dll SslTransport.cs

test.exe: NDesk.DBus.dll Test.cs

test-export.exe: NDesk.DBus.dll TestExport.cs

monitor.exe: NDesk.DBus.dll Monitor.cs

introspect.exe: NDesk.DBus.dll Introspect.cs
Expand Down
46 changes: 46 additions & 0 deletions src/TestExport.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright 2006 Alp Toker <alp@atoker.com>
// This software is made available under the MIT License
// See COPYING for details

using System;
using NDesk.DBus;
using org.freedesktop.DBus;

public class ManagedDBusTestExport
{
public static void Main ()
{
Connection conn = new Connection ();

ObjectPath opath = new ObjectPath ("/org/freedesktop/DBus");
string name = "org.freedesktop.DBus";

DProxy prox = new DProxy (conn, opath, name, typeof (Bus));
Bus bus = (Bus)prox.GetTransparentProxy ();

/*
bus.NameAcquired += delegate (string name) {
Console.WriteLine ("NameAcquired: " + name);
};
*/

bus.NameAcquired += delegate (string acquired_name) {
Console.WriteLine ("NameAcquired: " + acquired_name);
};

string myName = bus.Hello ();
Console.WriteLine ("myName: " + myName);

//hack to process the NameAcquired signal synchronously
conn.HandleMessage (conn.ReadMessage ());

string myNameReq = "org.ndesk.test";

//NameReply nameReply = bus.RequestName (myNameReq, NameFlag.None);
NameReply nameReply = (NameReply)bus.RequestName (myNameReq, NameFlag.None);

Console.WriteLine ("nameReply: " + nameReply);

System.Threading.Thread.Sleep (60000);
}
}

0 comments on commit 7765ded

Please sign in to comment.