UrfClient

UrfClient — Main client object for accessing the urfkill daemon

Synopsis

#include <urfkill.h>

struct              UrfClient;
struct              UrfClientClass;
gboolean            urf_client_enumerate_devices_sync   (UrfClient *client,
                                                         GCancellable *cancellable,
                                                         GError **error);
const char *        urf_client_get_daemon_version       (UrfClient *client);
GList *             urf_client_get_devices              (UrfClient *client);
guint               urf_client_inhibit                  (UrfClient *client,
                                                         const char *reason,
                                                         GError **error);
gboolean            urf_client_is_inhibited             (UrfClient *client,
                                                         GError **error);
UrfClient *         urf_client_new                      (void);
gboolean            urf_client_set_block                (UrfClient *client,
                                                         UrfEnumType type,
                                                         const gboolean block,
                                                         GCancellable *cancellable,
                                                         GError **error);
gboolean            urf_client_set_block_idx            (UrfClient *client,
                                                         const guint index,
                                                         const gboolean block,
                                                         GCancellable *cancellable,
                                                         GError **error);
gboolean            urf_client_set_bluetooth_block      (UrfClient *client,
                                                         const gboolean block);
gboolean            urf_client_set_wlan_block           (UrfClient *client,
                                                         const gboolean block);
gboolean            urf_client_set_wwan_block           (UrfClient *client,
                                                         const gboolean block);
void                urf_client_uninhibit                (UrfClient *client,
                                                         const guint cookie);

Object Hierarchy

  GObject
   +----UrfClient

Properties

  "daemon-version"           gchar*                : Read
  "key-control"              gboolean              : Read

Signals

  "device-added"                                   : Run Last
  "device-changed"                                 : Run Last
  "device-removed"                                 : Run Last
  "rf-key-pressed"                                 : Run Last

Description

A helper GObject to use for accessing urfkill information, and to be notified when it is changed.

Details

struct UrfClient

struct UrfClient;

The UrfClient struct contains only private fields and should not be directly accessed.


struct UrfClientClass

struct UrfClientClass {
};

Class structure for UrfClient


urf_client_enumerate_devices_sync ()

gboolean            urf_client_enumerate_devices_sync   (UrfClient *client,
                                                         GCancellable *cancellable,
                                                         GError **error);

Enumerate the devices from the daemon.

client :

a UrfClient instance

cancellable :

a GCancellable or NULL

error :

a GError, or NULL

Returns :

TRUE for success, else FALSE and error is used

Since 0.3.0


urf_client_get_daemon_version ()

const char *        urf_client_get_daemon_version       (UrfClient *client);

Get urfkill daemon version

client :

a UrfClient instance

Returns :

string containing the daemon version, e.g. 0.2.0

Since 0.2.0


urf_client_get_devices ()

GList *             urf_client_get_devices              (UrfClient *client);

Get a list of the device objects.

Note

You must have called urf_client_enumerate_devices_sync before calling this function.

client :

a UrfClient instance

Returns :

a list of UrfDevice objects. [element-type UrfDevice][transfer none]

Since 0.2.0


urf_client_inhibit ()

guint               urf_client_inhibit                  (UrfClient *client,
                                                         const char *reason,
                                                         GError **error);

Inhibit the rfkill key handling function for this session.

client :

a UrfClient instance

reason :

the reason to inhibit the key control

error :

a GError, or NULL

Returns :

the cookie and error is used

Since 0.2.0


urf_client_is_inhibited ()

gboolean            urf_client_is_inhibited             (UrfClient *client,
                                                         GError **error);

Get whether the key control is inhibited or not,

client :

a UrfClient instance

error :

a GError, or NULL

Returns :

TRUE if the key control is inhibited

Since 0.2.0


urf_client_new ()

UrfClient *         urf_client_new                      (void);

Creates a new UrfClient object.

Returns :

a new UrfClient object.

urf_client_set_block ()

gboolean            urf_client_set_block                (UrfClient *client,
                                                         UrfEnumType type,
                                                         const gboolean block,
                                                         GCancellable *cancellable,
                                                         GError **error);

Block or unblock the devices belonging to the type.

Note

This function only changes soft block. Hard block is controlled by BIOS or the hardware and there is no way to change the state of hard block through kernel functions.

client :

a UrfClient instance

type :

the type of the devices

block :

TRUE to block the devices or FALSE to unblock

cancellable :

a GCancellable or NULL

error :

a GError, or NULL

Returns :

TRUE for success, else FALSE and error is used

Since 0.2.0


urf_client_set_block_idx ()

gboolean            urf_client_set_block_idx            (UrfClient *client,
                                                         const guint index,
                                                         const gboolean block,
                                                         GCancellable *cancellable,
                                                         GError **error);

Block or unblock the device by the index.

Note

This function only changes soft block. Hard block is controlled by BIOS or the hardware and there is no way to change the state of hard block through kernel functions.

client :

a UrfClient instance

index :

the index of the device

block :

TRUE to block the device or FALSE to unblock

cancellable :

a GCancellable or NULL

error :

a GError, or NULL

Returns :

TRUE for success, else FALSE and error is used

Since 0.2.0


urf_client_set_bluetooth_block ()

gboolean            urf_client_set_bluetooth_block      (UrfClient *client,
                                                         const gboolean block);

Block or unblock the bluetooth devices. This is a convenient function and the underlying function is urf_client_set_block.

client :

a UrfClient instance

block :

TRUE to block the bluetooth devices or FALSE to unblock

Returns :

TRUE for success, else FALSE

Since 0.2.0


urf_client_set_wlan_block ()

gboolean            urf_client_set_wlan_block           (UrfClient *client,
                                                         const gboolean block);

Block or unblock the WLAN devices. This is a convenient function and the underlying function is urf_client_set_block.

client :

a UrfClient instance

block :

TRUE to block the WLAN devices or FALSE to unblock

Returns :

TRUE for success, else FALSE

Since 0.2.0


urf_client_set_wwan_block ()

gboolean            urf_client_set_wwan_block           (UrfClient *client,
                                                         const gboolean block);

Block or unblock the wireless WAN devices. This is a convenient function and the underlying function is urf_client_set_block.

client :

a UrfClient instance

block :

TRUE to block the WWAN devices or FALSE to unblock

Returns :

TRUE for success, else FALSE

Since 0.2.0


urf_client_uninhibit ()

void                urf_client_uninhibit                (UrfClient *client,
                                                         const guint cookie);

Cancel a previous call to urf_client_inhibit identified by the cookie.

client :

a UrfClient instance

cookie :

the cookie

Since 0.2.0

Property Details

The "daemon-version" property

  "daemon-version"           gchar*                : Read

The running daemon version.

Default value: NULL

Since 0.2.0


The "key-control" property

  "key-control"              gboolean              : Read

Whether the key control in the daemon is enabled or not

Default value: FALSE

Since 0.2.0

Signal Details

The "device-added" signal

void                user_function                      (UrfClient *client,
                                                        UrfDevice *device,
                                                        gpointer   user_data)      : Run Last

The device-added signal is emitted when a rfkill device is added.

Since 0.2.0

client :

the UrfClient instance that emitted the signal

device :

the UrfDevice that was added.

user_data :

user data set when the signal handler was connected.

The "device-changed" signal

void                user_function                      (UrfClient *client,
                                                        UrfDevice *device,
                                                        gpointer   user_data)      : Run Last

The device-changed signal is emitted when a rfkill device is changed.

Since 0.2.0

client :

the UrfClient instance that emitted the signal

device :

the UrfDevice that was changed.

user_data :

user data set when the signal handler was connected.

The "device-removed" signal

void                user_function                      (UrfClient *client,
                                                        UrfDevice *device,
                                                        gpointer   user_data)      : Run Last

The device-removed signal is emitted when a rfkill device is removed.

Since 0.2.0

client :

the UrfClient instance that emitted the signal

device :

the UrfDevice that was removed.

user_data :

user data set when the signal handler was connected.

The "rf-key-pressed" signal

void                user_function                      (UrfClient *client,
                                                        gint       keycode,
                                                        gpointer   user_data)      : Run Last

The rf-key-pressed signal is emitted when a rfkill key is pressed.

Since 0.2.0

client :

the UrfClient instance that emitted the signal

keycode :

the keycode from the input device

user_data :

user data set when the signal handler was connected.

See Also

UrfDevice