![]() |
![]() |
![]() |
Gypsy Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy |
GypsyControl; #define GYPSY_CONTROL_DBUS_SERVICE #define GYPSY_CONTROL_DBUS_PATH #define GYPSY_CONTROL_DBUS_INTERFACE GypsyControl * gypsy_control_get_default (void
); char * gypsy_control_create (GypsyControl *control
,const char *device_name
,GError **error
);
GypsyControl is the object that controls the gypsy-daemon process.
It is a singleton object, meaning that there will only be one instance of it
per application. Once the object has been created (or referenced if it
had already been created for the application) with
gypsy_control_get_default()
, it can be used to tell gypsy-daemon what GPS
device to connect to with gypsy_control_create()
. This call returns the
D-Bus object path to the GPS object in gypsy-daemon. This object path is then used to
create other objects, such as GypsyPosition, or GypsyCourse.
As gypsy-daemon is able to connect to multiple GPS devices, the one
GypsyControl can be used to create them, returning a different path for each
GPS device. Gypsy-daemon can connect to both serial port devices which have
an entry in /dev
and Bluetooth devices natively without
the need to use rfcomm to set up a /dev
entry. To do
this you pass either the device path or the Bluetooth address of the device
to gypsy_control_create()
.
Once the program has finished with the GPS, the GypsyControl object should
by unreferenced with g_object_unref()
.
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 |
. . . <a class="link" href="gypsy-gypsy-control.html#GypsyControl">GypsyControl</a> *control; char *path_bt, *path_dev; GError *error = NULL; . . . control = gypsy_control_get_default (); / * Use a Bluetooth device * / path_bt = gypsy_control_create (control, "aa:bb:cc:dd:ee", &error); if (path_bt == NULL) { g_warning ("There was an error creating aa:bb:cc:dd:ee - %s", error->message); g_error_free (error); error = NULL; } / * Use a serial port device * / path_dev = gypsy_control_create (control, "/dev/gps", &error); if (path_dev == NULL) { g_warning ("There was an error creating /dev/gps - %s", error->message); g_error_free (error); error = NULL; } . . . / * Use the paths here to create listener objects * / . . . g_free (path_bt); g_free (path_dev); . . . / * The program has finished with Gypsy now, unref the object. * / g_object_unref (G_OBJECT (control)); |
#define GYPSY_CONTROL_DBUS_SERVICE "org.freedesktop.Gypsy"
A define containing the service name of the control service
#define GYPSY_CONTROL_DBUS_PATH "/org/freedesktop/Gypsy"
A define containing the object path of the Gypsy object
#define GYPSY_CONTROL_DBUS_INTERFACE "org.freedesktop.Gypsy.Server"
A define containing the name of the Control interface
GypsyControl * gypsy_control_get_default (void
);
Retrieves the default GypsyControl object.
Returns : |
A singleton GypsyControl. Once the program has finished using
the GypsyControl, it should be unreferenced with g_object_unref() .
|
char * gypsy_control_create (GypsyControl *control
,const char *device_name
,GError **error
);
Creates a object on the server that refers to the GPS device at device_name
.
When this object is finalized, the remote object on the server will be
shutdown after which any calls to the object at the returned path
are not guaranteed to work.
|
The GypsyControl device |
|
The path to the device file, or Bluetooth address |
|
A GError to return errors in, or NULL
|
Returns : |
The path to the created object. |