private void RegisterDBus() { try { Monitor.Enter(this); DBusManager.Bus.TrapSignals(); if (entry_group != null) { entry_group.Reset(); return; } if (DBusManager.Server.GetState() != AvahiServerState.Running) { throw new ApplicationException("Avahi Server is not in the Running state"); } ObjectPath path = DBusManager.Server.EntryGroupNew(); entry_group = DBusManager.GetObject <IAvahiEntryGroup> (path); //Monitor.Exit (this); entry_group.StateChanged += OnEntryGroupStateChanged; } finally { Monitor.Exit(this); DBusManager.Bus.UntrapSignals(); } }
public void Resolve() { if (disposed) { throw new InvalidOperationException("The service has been disposed and cannot be resolved. " + " Perhaps this service was removed?"); } // DBusManager.Bus.TrapSignals (); lock (this) { if (resolver != null) { throw new InvalidOperationException("The service is already running a resolve operation"); } ObjectPath path = DBusManager.Server.ServiceResolverNew(AvahiInterface, AvahiProtocol, Name ?? String.Empty, RegType ?? String.Empty, ReplyDomain ?? String.Empty, AvahiProtocol, LookupFlags.None); resolver = DBusManager.GetObject <IAvahiServiceResolver> (path); } resolver.Failure += OnResolveFailure; resolver.Found += OnResolveFound; // DBusManager.Bus.UntrapSignals (); }
public void Browse(uint interfaceIndex, AddressProtocol addressProtocol, string regtype, string domain) { lock (this) { Dispose(); ObjectPath object_path = DBusManager.Server.ServiceBrowserNew( AvahiUtils.FromMzcInterface(interfaceIndex), AvahiUtils.FromMzcProtocol(addressProtocol), regtype ?? String.Empty, domain ?? String.Empty, LookupFlags.None); service_browser = DBusManager.GetObject <IAvahiServiceBrowser> (object_path); } service_browser.ItemNew += OnItemNew; service_browser.ItemRemove += OnItemRemove; }