コード例 #1
0
 public PebblePlugin(string pbwPath, string btAdapterName, ILogger logger, DBusConnection connection)
 {
     _pbwPath       = pbwPath;
     _btAdapterName = btAdapterName;
     _logger        = logger;
     _manager       = new PebbleManager(connection);
 }
コード例 #2
0
ファイル: Client.cs プロジェクト: SyaskiMasyaski/banshee
        public static void Main()
        {
            if (!DBusConnection.ConnectTried)
            {
                DBusConnection.Connect();
            }

            if (!DBusConnection.Enabled)
            {
                Error("All commands ignored, DBus support is disabled");
                return;
            }
            else if (!DBusConnection.ApplicationInstanceAlreadyRunning)
            {
                Error("Banshee does not seem to be running");
                return;
            }

            command    = DBusServiceManager.FindInstance <DBusCommandService> ("/DBusCommandService");
            hide_field = ApplicationContext.CommandLine.Contains("hide-field");

            bool present = HandlePlayerCommands() && !ApplicationContext.CommandLine.Contains("indexer");

            HandleWindowCommands(present);
            HandleFiles();
        }
コード例 #3
0
ファイル: IndexerClient.cs プロジェクト: thoja21/banshee-1
        public static void Main()
        {
            if (!DBusConnection.Enabled)
            {
                Log.Error("All commands ignored, DBus support is disabled");
                return;
            }
            else if (ApplicationContext.CommandLine.Contains("client"))
            {
                ActAsRemoteClient();
                return;
            }
            else if (DBusConnection.ApplicationInstanceAlreadyRunning)
            {
                Log.Error("Banshee is already running");
                return;
            }
            else if (DBusConnection.NameHasOwner("CollectionIndexer"))
            {
                Log.Error("Another indexer is already running");
                return;
            }

            Log.Information("Indexer client started");

            Startup();
        }
コード例 #4
0
ファイル: IndexerClient.cs プロジェクト: thoja21/banshee-1
        public void Run()
        {
            ServiceManager.Get <CollectionIndexerService> ().ShutdownHandler = DBusConnection.QuitMainLoop;

            ServiceManager.SourceManager.AddSource(new Banshee.Library.MusicLibrarySource());
            ServiceManager.SourceManager.AddSource(new Banshee.Library.VideoLibrarySource());

            DBusConnection.RunMainLoop();

            ServiceManager.Shutdown();

            if (reboot_args != null)
            {
                Log.Debug("Rebooting");

                System.Text.StringBuilder builder = new System.Text.StringBuilder();
                foreach (string arg in reboot_args)
                {
                    builder.AppendFormat("\"{0}\" ", arg);
                }

                // FIXME: Using Process.Start sucks, but DBus doesn't let you specify
                // extra command line arguments
                DBusConnection.Disconnect("CollectionIndexer");
                Process.Start("banshee", builder.ToString());
                // Bus.Session.StartServiceByName (DBusConnection.DefaultBusName);
                // Bus.Session.Iterate ();
            }
        }
コード例 #5
0
        public static async Task <Tuple <DBusConnection, DBusConnection> > CreateConnectedPairAsync()
        {
            var streams = PairedMessageStream.CreatePair();
            var task1   = DBusConnection.CreateAndConnectAsync(streams.Item1);
            var task2   = DBusConnection.CreateAndConnectAsync(streams.Item2);
            var conn1   = await task1;
            var conn2   = await task2;

            return(Tuple.Create <DBusConnection, DBusConnection>(conn1, conn2));
        }
コード例 #6
0
        public static async Task <Tuple <IDBusConnection, IDBusConnection> > CreateConnectedPairAsync()
        {
            var streams = PairedMessageStream.CreatePair();
            var task1   = DBusConnection.CreateAndConnectAsync(streams.Item1, null, sayHelloToServer: false);
            var task2   = DBusConnection.CreateAndConnectAsync(streams.Item2, null, sayHelloToServer: false);
            var conn1   = await task1;
            var conn2   = await task2;

            return(Tuple.Create <IDBusConnection, IDBusConnection>(conn1, conn2));
        }
コード例 #7
0
 public BlendMicroAnemometerSensor(ILogger logger, IClock clock, TimeSpan maximumDataAge, BlendMicroAnemometerPlugin plugin, string adapterName, string deviceAddress, DBusConnection connection, double windAngleOffset)
 {
     _plugin          = plugin;
     _logger          = logger;
     _adapterName     = adapterName;
     _deviceAddress   = deviceAddress;
     _connection      = connection;
     _clock           = clock;
     _maximumDataAge  = maximumDataAge;
     _windAngleOffset = windAngleOffset;
 }
コード例 #8
0
 public BlendMicroAnemometerPlugin(ILogger logger, IClock clock, TimeSpan maximumDataAge, DBusConnection connection, string btAdapterName, string deviceAddress, bool simulated, double windAngleOffset)
 {
     _btAdapterName   = btAdapterName;
     _deviceAddress   = deviceAddress;
     _connection      = connection;
     _logger          = logger;
     _clock           = clock;
     _maximumDataAge  = maximumDataAge;
     _simulated       = simulated;
     _windAngleOffset = windAngleOffset;
 }
コード例 #9
0
ファイル: DBusAdapter.cs プロジェクト: seanz617/Tmds.DBus
 protected DBusAdapter(DBusConnection connection, ObjectPath objectPath, object o, IProxyFactory factory, SynchronizationContext synchronizationContext)
 {
     _connection             = connection;
     _objectPath             = objectPath;
     _object                 = o;
     _state                  = State.Registering;
     _factory                = factory;
     _synchronizationContext = synchronizationContext;
     _methodHandlers         = new Dictionary <string, MethodCallHandler>();
     _methodHandlers.Add(GetMethodLookupKey("org.freedesktop.DBus.Introspectable", "Introspect", null), HandleIntrospect);
 }
コード例 #10
0
 public BlunoBeetleBlePressurePlugin(ILogger logger, IClock clock, TimeSpan maximumDataAge, DBusConnection connection, string btAdapterName, string portAddress, string starboardAddress, bool simulated)
 {
     _btAdapterName    = btAdapterName;
     _portAddress      = portAddress;
     _starboardAddress = starboardAddress;
     _connection       = connection;
     _logger           = logger;
     _clock            = clock;
     _maximumDataAge   = maximumDataAge;
     _simulated        = simulated;
 }
コード例 #11
0
        public CollectionIndexerService()
        {
            DBusConnection.Connect("CollectionIndexer");

            ServiceManager.SourceManager.SourceAdded   += OnSourceAdded;
            ServiceManager.SourceManager.SourceRemoved += OnSourceRemoved;

            foreach (Source source in ServiceManager.SourceManager.Sources)
            {
                MonitorLibrary(source as LibrarySource);
            }
        }
コード例 #12
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (dbus_conn != null)
                {
                    dbus_conn.Close();
                    dbus_conn = null;
                }
            }

            base.Dispose(disposing);
        }
コード例 #13
0
        protected override void OnChannelReady(object sender, EventArgs args)
        {
            Console.WriteLine("{0} Connection to address {1}", Contact.Name, tube.Address);

            try {
                dbus_conn = new DBusConnection(tube.Address, true);
                State     = ActivityState.Connected;
                OnReady(EventArgs.Empty);
            }
            catch (Exception e) {
                Console.WriteLine(e.ToString());
            }
        }
コード例 #14
0
        public BlunoBeetleBlePressureSensor(ILogger logger, IClock clock, TimeSpan maximumDataAge, BlunoBeetleBlePressurePlugin plugin, string adapterName, string portDeviceAddress, string starboardDeviceAddress, DBusConnection connection)
        {
            _plugin      = plugin;
            _logger      = logger;
            _adapterName = adapterName;

            _connection     = connection;
            _clock          = clock;
            _maximumDataAge = maximumDataAge;

            _sensors = new List <PressureSensor> ();
            _sensors.Add(new PressureSensor(Side.Port, 1, portDeviceAddress));
            _sensors.Add(new PressureSensor(Side.Starboard, 1, starboardDeviceAddress));
        }
コード例 #15
0
ファイル: Entry.cs プロジェクト: mono-soc-2011/banshee
        public static void Main()
        {
            Application.InitializePaths();

            if (CheckHelpVersion())
            {
                return;
            }

            if (DBusConnection.ApplicationInstanceAlreadyRunning)
            {
                // DBus Command/Query/File Proxy Client
                BootClient("Halie");
                NotifyStartupComplete();
            }
            else if (DBusConnection.NameHasOwner("CollectionIndexer"))
            {
                // Tell the existing indexer to start Banshee when it's done
                IIndexerClient indexer = DBusServiceManager.FindInstance <IIndexerClient> ("CollectionIndexer", "/IndexerClient");
                try {
                    indexer.Hello();
                    indexer.RebootWhenFinished(Environment.GetCommandLineArgs());
                    Log.Warning("The Banshee indexer is currently running. Banshee will be started when the indexer finishes.");
                } catch (Exception e) {
                    Log.Exception("CollectionIndexer found on the Bus, but doesn't say Hello", e);
                }
            }
            else if (ApplicationContext.CommandLine.Contains("indexer"))
            {
                // Indexer Client
                BootClient("Beroe");
            }
            else if (ApplicationContext.CommandLine.Contains("client"))
            {
                BootClient(Path.GetFileNameWithoutExtension(ApplicationContext.CommandLine["client"]));
            }
            else
            {
                if (PlatformDetection.IsMeeGo)
                {
                    BootClient("MeeGo");
                }
                else
                {
                    BootClient("Nereid");
                }
            }
        }
コード例 #16
0
 public PebbleManager(DBusConnection connection)
 {
     _ownsConnection = false;
     _pebbles        = new Dictionary <ObjectPath, DiscoveredPebble> ();
     _connection     = connection;
 }
コード例 #17
0
 public GattServer()
 {
     busConnection = new DBusConnection();
 }
コード例 #18
0
ファイル: LocalServer.cs プロジェクト: seanz617/Tmds.DBus
 public LocalServer(DBusConnection connection)
 {
     _connection = connection;
     _clients    = Array.Empty <IMessageStream>();
 }