/usr/share/gtk-doc/html/gypsy/connecting.html is in libgypsy-doc 0.8-0ubuntu7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Connecting to a GPS</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="index.html" title="Gypsy Reference Manual">
<link rel="up" href="ch01.html" title="Programming Gypsy With Python">
<link rel="prev" href="ch01.html" title="Programming Gypsy With Python">
<link rel="next" href="gps.html" title="Getting Your Location">
<meta name="generator" content="GTK-Doc V1.15 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
<td><a accesskey="p" href="ch01.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="ch01.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">Gypsy Reference Manual</th>
<td><a accesskey="n" href="gps.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr></table>
<div class="section" title="Connecting to a GPS">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="connecting"></a>Connecting to a GPS</h2></div></div></div>
<p>
The Gypsy daemon sits on the system bus, and we'll be using the GLib main
loop for signals. This requires a little setup.
</p>
<pre class="programlisting">#! /usr/bin/python
import dbus, dbus.mainloop.glib
# Hook into the glib main loop
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
# Connect to the system bus
bus = dbus.SystemBus()</pre>
<p>
Now that we're connected to the bus, we can get an object for the Gypsy
daemon.
</p>
<pre class="programlisting"># Get a connection to the Gypsy daemon
daemon = bus.get_object("org.freedesktop.Gypsy", "/org/freedesktop/Gypsy")
# Get an object conforming to the Server interface
control = dbus.Interface(daemon, "org.freedesktop.Gypsy.Server")</pre>
<p>
The <code class="varname">control</code> object now implements the
<span class="interface">Server</span> interface, which has a single method:
<code class="methodname">Create</code>. This is used to create new
<span class="interface">Device</span> objects.
</p>
<pre class="programlisting"># This gives us an object path to the new device
path = control.Create("00:11:22:33:44:55")
# Now get the object at that path
gps = bus.get_object("org.freedesktop.Gypsy", path)
</pre>
<p>
The object <code class="varname">gps</code> now represents the GPS, and implements
several other interfaces which will be covered next.
</p>
</div>
<div class="footer">
<hr>
Generated by GTK-Doc V1.15</div>
</body>
</html>
|