![]() |
![]() |
![]() |
Geoclue Reference Manual | ![]() |
---|---|---|---|---|
#define GEOCLUE_MASTER_CLIENT_DBUS_INTERFACE GeoclueMasterClient; gboolean geoclue_master_client_set_requirements (GeoclueMasterClient *client, GeoclueAccuracyLevel min_accuracy, int min_time, gboolean require_updates, GeoclueResourceFlags allowed_resources, GError **error); GeoclueAddress* geoclue_master_client_create_address (GeoclueMasterClient *client, GError **error); void (*CreateAddressCallback) (GeoclueMasterClient *client, GeoclueAddress *address, GError *error, gpointer userdata); void geoclue_master_client_create_address_async (GeoclueMasterClient *client, CreateAddressCallback callback, gpointer userdata); GeocluePosition* geoclue_master_client_create_position (GeoclueMasterClient *client, GError **error); void (*CreatePositionCallback) (GeoclueMasterClient *client, GeocluePosition *position, GError *error, gpointer userdata); void geoclue_master_client_create_position_async (GeoclueMasterClient *client, CreatePositionCallback callback, gpointer userdata); gboolean geoclue_master_client_get_address_provider (GeoclueMasterClient *client, char **name, char **description, char **service, char **path, GError **error); gboolean geoclue_master_client_get_position_provider (GeoclueMasterClient *client, char **name, char **description, char **service, char **path, GError **error);
"address-provider-changed" : Run First / No Recursion "position-provider-changed" : Run First / No Recursion
GeoclueMasterClient is part of the Geoclue public C client API. It uses D-Bus to communicate with the actual Master service.
GeoclueMasterClient is used to control the client specific behaviour of Geoclue Master. Chapter "Master provider: simple example in C" contains a more complete example, but here are the main parts:
GeoclueMaster *master; GeoclueMasterClient *client; GeoclueAddress *address; ... master = geoclue_master_get_default (); client = geoclue_master_create_client (master, NULL, NULL); if (!client) { / * handle error * / } if (!geoclue_master_client_set_requirements (client, GEOCLUE_ACCURACY_LEVEL_NONE, 0, FALSE, GEOCLUE_RESOURCE_NETWORK, &error)) { / * handle error * / } address = geoclue_master_client_create_address (client, error); if (!address) { / * handle error * / } / * Now we can use address just like we'd use a normal address provider, but GeoclueMasterClient makes sure that underneath the provider that best matches our requirements is used * /
#define GEOCLUE_MASTER_CLIENT_DBUS_INTERFACE "org.freedesktop.Geoclue.MasterClient"
gboolean geoclue_master_client_set_requirements (GeoclueMasterClient *client, GeoclueAccuracyLevel min_accuracy, int min_time, gboolean require_updates, GeoclueResourceFlags allowed_resources, GError **error);
Sets the criteria that should be used when selecting the used provider
|
A GeoclueMasterClient |
|
The required minimum accuracy as a GeoclueAccuracyLevel. |
|
The minimum time between update signals (currently not implemented) |
|
Whether the updates (signals) are required. Only applies to interfaces with signals |
|
The resources that are allowed to be used as a GeoclueResourceFlags |
|
A pointer to returned GError or NULL .
|
Returns : |
TRUE on success
|
GeoclueAddress* geoclue_master_client_create_address (GeoclueMasterClient *client, GError **error);
Starts the GeoclueMasterClient address provider and returns a GeoclueAddress that uses the same D-Bus object as the GeoclueMasterClient.
|
A GeoclueMasterClient |
|
A pointer to returned GError or NULL .
|
Returns : |
New GeoclueAddress or NULL on error
|
void (*CreateAddressCallback) (GeoclueMasterClient *client, GeoclueAddress *address, GError *error, gpointer userdata);
|
|
|
|
|
|
|
void geoclue_master_client_create_address_async (GeoclueMasterClient *client, CreateAddressCallback callback, gpointer userdata);
Function returns (essentially) immediately and calls callback
when it has started the address provider
and a GeoclueAddress is available.
|
A GeoclueMasterClient object |
|
A CreateAddressCallback function that should be called when return values are available |
|
pointer for user specified data |
GeocluePosition* geoclue_master_client_create_position (GeoclueMasterClient *client, GError **error);
Starts the GeoclueMasterClient position provider and returns a GeocluePosition that uses the same D-Bus object as the GeoclueMasterClient.
|
A GeoclueMasterClient |
|
A pointer to returned GError or NULL .
|
Returns : |
New GeocluePosition or NULL on error
|
void (*CreatePositionCallback) (GeoclueMasterClient *client, GeocluePosition *position, GError *error, gpointer userdata);
|
|
|
|
|
|
|
void geoclue_master_client_create_position_async (GeoclueMasterClient *client, CreatePositionCallback callback, gpointer userdata);
Function returns (essentially) immediately and calls callback
when it has started the position provider
and a GeocluePosition is available.
|
A GeoclueMasterClient object |
|
A CreatePositionCallback function that should be called when return values are available |
|
pointer for user specified data |
gboolean geoclue_master_client_get_address_provider (GeoclueMasterClient *client, char **name, char **description, char **service, char **path, GError **error);
Gets name and other information for the currently used address provider.
|
A GeoclueMasterClient |
|
Pointer to returned provider name or NULL
|
|
Pointer to returned provider description or NULL
|
|
Pointer to returned D-Bus service name or NULL
|
|
Pointer to returned D-Bus object path or NULL
|
|
Pointer to returned GError or NULL
|
Returns : |
TRUE on success
|
gboolean geoclue_master_client_get_position_provider (GeoclueMasterClient *client, char **name, char **description, char **service, char **path, GError **error);
Gets name and other information for the currently used position provider.
|
A GeoclueMasterClient |
|
Pointer to returned provider name or NULL
|
|
Pointer to returned provider description or NULL
|
|
Pointer to returned D-Bus service name or NULL
|
|
Pointer to returned D-Bus object path or NULL
|
|
Pointer to returned GError or NULL
|
Returns : |
TRUE on success
|
"address-provider-changed"
signalvoid user_function (GeoclueMasterClient *client, gchar *name, gchar *description, gchar *service, gchar *path, gpointer user_data) : Run First / No Recursion
The address-provider-changed signal is emitted each time the used address provider changes.
|
the GeoclueMasterClient object emitting the signal |
|
name of the new provider (e.g. "Hostip") or NULL if there is no provider
|
|
a short description of the new provider or NULL if there is no provider
|
|
D-Bus service name of the new provider or NULL if there is no provider
|
|
D-Bus object path name of the new provider or NULL if there is no provider
|
|
user data set when the signal handler was connected. |
"position-provider-changed"
signalvoid user_function (GeoclueMasterClient *client, gchar *name, gchar *description, gchar *service, gchar *path, gpointer user_data) : Run First / No Recursion
The position-provider-changed signal is emitted each time the used position provider changes.
|
the GeoclueMasterClient object emitting the signal |
|
name of the new provider (e.g. "Hostip") or NULL if there is no provider
|
|
a short description of the new provider or NULL if there is no provider
|
|
D-Bus service name of the new provider or NULL if there is no provider
|
|
D-Bus object path name of the new provider or NULL if there is no provider
|
|
user data set when the signal handler was connected. |