LpfProvider

LpfProvider — Public transport information provider interface

Functions

Properties

gchar * name Read

Types and Values

Object Hierarchy

    GInterface
    ╰── LpfProvider

Description

A LpfProvider represents a provider of public transport information such as timetables or location information

Functions

LpfProviderGotLocsNotify ()

void
(*LpfProviderGotLocsNotify) (GSList *locs,
                             gpointer user_data,
                             GError *err);

Callback invoked after the locations matching the query were received. In case of an error locs is NULL.

Parameters

locs

List of found locations.

[element-type Lpf.Loc]

user_data

userdata

 

err

GError.

[transfer full]

LpfProviderGotTripsNotify ()

void
(*LpfProviderGotTripsNotify) (GSList *trips,
                              gpointer user_data,
                              GError *err);

Callback invoked after the trips matching the query were received. In case of an error trips is NULL.

Parameters

trips

List of found trips.

[element-type Lpf.Loc]

user_data

userdata

 

err

GError.

[transfer full]

LpfProviderCreateFunc ()

LpfProvider *
(*LpfProviderCreateFunc) (void);

Returns


lpf_provider_create ()

LpfProvider *
lpf_provider_create (void);

Create the provider

Returns


lpf_provider_get_name ()

const char *
lpf_provider_get_name (LpfProvider *self);

Returns


lpf_provider_activate ()

void
lpf_provider_activate (LpfProvider *self,
                       GObject *obj);


lpf_provider_deactivate ()

void
lpf_provider_deactivate (LpfProvider *self,
                         GObject *obj);


lpf_provider_error_quark ()

GQuark
lpf_provider_error_quark (void);

Returns


lpf_provider_get_locs ()

gint
lpf_provider_get_locs (LpfProvider *self,
                       const gchar *match,
                       LpfProviderGetLocsFlags flags,
                       LpfProviderGotLocsNotify callback,
                       gpointer user_data);

Initiate a lookup for locations that match match . Once complete callback is invoked with a GSList of matched LpfLocation s. The caller is responsible for freeing the locations list via lpf_provider_free_locs.

Parameters

self

a LpfProvider

 

match

locations to match

 

flags

LpfProviderGetLocsFlags for loation lookup

 

callback

LpfProviderGotLocsNotify to invoke once locations are available.

[scope async]

user_data

User data for the callback.

[allow-none]

Returns

0 on success, -1 on error


lpf_provider_free_locs ()

void
lpf_provider_free_locs (LpfProvider *self,
                        GSList *locs);

Free the location list

Parameters

self

a LpfProvider

 

locs

A linked list of location.

[element-type LpfLoc]

lpf_provider_get_trips ()

gint
lpf_provider_get_trips (LpfProvider *self,
                        LpfLoc *start,
                        LpfLoc *end,
                        GDateTime *date,
                        LpfProviderGetTripsFlags flags,
                        LpfProviderGotLocsNotify callback,
                        gpointer user_data);

Initiate a lookup for trips starting at the location start , ending at end and starting (or depending on flags ) ending at date . Once completed callback is invoked with a GSList of matched trips. The caller is responsible for freeing the locations list via lpf_provider_free_trips.

Parameters

self

a LpfProvider

 

start

start of trip location

 

end

end of trip location

 

date

Date and time the trip starts as GDateTime

 

flags

LpfProviderGetTripsFlags for trip lookups

 

callback

LpfProviderGotTripsNotify to invoke once trips are available.

[scope async]

user_data

User data for the callback.

[allow-none]

Returns

0 on success, -1 on error


lpf_provider_free_trips ()

void
lpf_provider_free_trips (LpfProvider *self,
                         GSList *trips);

Free the trips list

Parameters

self

a LpfProvider

 

trips

A linked list of trips.

[element-type LpfTrip]

Types and Values

LPF_PROVIDER_MAJOR_VERSION

#define LPF_PROVIDER_MAJOR_VERSION 0


LPF_PROVIDER_MINOR_VERSION

#define LPF_PROVIDER_MINOR_VERSION 0


LPF_PROVIDER_ERROR

#define LPF_PROVIDER_ERROR g_spawn_error_quark ()

Error domain for providers


enum LpfProviderError

Error codes returned by providers

Members

LPF_PROVIDER_ERROR_REQUEST_FAILED

a request to fetch data from a remote failed

 

LPF_PROVIDER_ERROR_PARSE_FAILED

parsing the reply failed

 

enum LpfProviderGetLocsFlags

Flags passed to lpf_provider_get_locs. Currently only here for symmetry with other API functions.

Members

LPF_PROVIDER_GET_LOCS_NONE

No flags

 

enum LpfProviderGetTripsFlags

Flags passed to lpf_provider_get_tips.

Members

LPF_PROVIDER_GET_TRIPS_NONE

No flags

 

LPF_PROVIDER_GET_TRIPS_ARRIVAL

Look for arrivals instead of departures at that date and time

 

LPF_PROVIDER_PROP_NAME

#define LPF_PROVIDER_PROP_NAME "name"


LpfProviderInterface

typedef struct {
    GTypeInterface parent;

    void (*activate)   (LpfProvider *self, GObject *obj);
    void (*deactivate) (LpfProvider *self, GObject *obj);

    const gchar* (*get_name) (LpfProvider *self);

    gint (*get_locs)  (LpfProvider *self, const gchar *match, LpfProviderGetLocsFlags flags, LpfProviderGotLocsNotify callback, gpointer user_data);
    gint (*get_trips) (LpfProvider *self, LpfLoc *start, LpfLoc *end,  GDateTime *date, LpfProviderGetTripsFlags flags, LpfProviderGotLocsNotify callback, gpointer user_data);
} LpfProviderInterface;

Property Details

The “name” property

  “name”                     gchar *

Provider Name.

Flags: Read

Default value: NULL

See Also

LpfProvider