IdeDeviceProvider: Builder SDK Reference

## IdeDeviceProvider IdeDeviceProvider |

## Functions

void | ide_device_provider_emit_device_added ()
void | ide_device_provider_emit_device_removed ()
void | ide_device_provider_load_async ()
gboolean | ide_device_provider_load_finish ()
GPtrArray * | ide_device_provider_get_devices ()

## Signals

void | device-added | Run Last
void | device-removed | Run Last

## Types and Values

#define | IDE_TYPE_DEVICE_PROVIDER
struct | IdeDeviceProviderClass
| IdeDeviceProvider

## Object Hierarchy

        GObject
        ╰── IdeObject
            ╰── IdeDeviceProvider

## Description

## Functions

### ide_device_provider_emit_device_added ()

    void
    ide_device_provider_emit_device_added (IdeDeviceProvider *self,
                                           IdeDevice *device);

Emits the “device-added” signal.

This should only be called by subclasses of IdeDeviceProvider when a new device has been discovered.

Since: 3.28

### ide_device_provider_emit_device_removed ()

    void
    ide_device_provider_emit_device_removed
                                   (IdeDeviceProvider *self,
                                    IdeDevice *device);

Emits the “device-removed” signal.

This should only be called by subclasses of IdeDeviceProvider when a previously added device has been removed.

Since: 3.28

### ide_device_provider_load_async ()

    void
    ide_device_provider_load_async (IdeDeviceProvider *self,
                                    GCancellable *cancellable,
                                    GAsyncReadyCallback callback,
                                    gpointer user_data);

Requests that the IdeDeviceProvider asynchronously load any known devices.

This should only be called once on an IdeDeviceProvider. It is an error to call this function more than once for a single IdeDeviceProvider.

IdeDeviceProvider implementations are expected to emit the “device-added” signal for each device they've discovered. That should be done for known devices before returning from the asynchronous operation so that the device manager does not need to wait for additional devices to enter the "settled" state.

#### Parameters

self | an IdeDeviceProvider |
cancellable | a GCancellable or `NULL`. | [nullable]
callback | a GAsyncReadyCallback to execute upon completion. | [nullable]
user_data | closure data for `callback` |

Since: 3.28

### ide_device_provider_load_finish ()

    gboolean
    ide_device_provider_load_finish (IdeDeviceProvider *self,
                                     GAsyncResult *result,
                                     GError **error);

Completes an asynchronous request to load known devices via `ide_device_provider_load_async()`.

#### Parameters

self | an IdeDeviceProvider |
result | a GAsyncResult provided to callback |
error | a location for a GError, or `NULL` |

#### Returns

`TRUE` if successful; otherwise `FALSE` and `error` is set.

Since: 3.28

### ide_device_provider_get_devices ()

    GPtrArray *
    ide_device_provider_get_devices (IdeDeviceProvider *self);

Gets a new GPtrArray containing a list of IdeDevice instances that were registered by the IdeDeviceProvider

#### Parameters

self | an IdeDeviceProvider |

#### Returns

a GPtrArray of IdeDevice.

[transfer full][element-type Ide.Device][not nullable]

Since: 3.28

## Types and Values

### IDE_TYPE_DEVICE_PROVIDER

    #define IDE_TYPE_DEVICE_PROVIDER (ide_device_provider_get_type())

### struct IdeDeviceProviderClass

    struct IdeDeviceProviderClass {
      IdeObjectClass parent_class;

      void     (*device_added)   (IdeDeviceProvider    *self,
                                  IdeDevice            *device);
      void     (*device_removed) (IdeDeviceProvider    *self,
                                  IdeDevice            *device);
      void     (*load_async)     (IdeDeviceProvider    *self,
                                  GCancellable         *cancellable,
                                  GAsyncReadyCallback   callback,
                                  gpointer              user_data);
      gboolean (*load_finish)    (IdeDeviceProvider    *self,
                                  GAsyncResult         *result,
                                  GError              **error);
    };

### IdeDeviceProvider

    typedef struct _IdeDeviceProvider IdeDeviceProvider;

## Signal Details

### The `“device-added”` signal

    void
    user_function (IdeDeviceProvider *self,
                   IdeDevice         *device,
                   gpointer           user_data)

The "device-added" signal is emitted when a provider has discovered a device has become available.

Subclasses of IdeDeviceManager must chain-up if they override the IdeDeviceProviderClass.device_added vfunc.

#### Parameters

self | an IdeDeviceProvider |
device | an IdeDevice |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 3.28

### The `“device-removed”` signal

    void
    user_function (IdeDeviceProvider *self,
                   IdeDevice         *device,
                   gpointer           user_data)

The "device-removed" signal is emitted when a provider has discovered a device is no longer available.

Subclasses of IdeDeviceManager must chain-up if they override the IdeDeviceProviderClass.device_removed vfunc.

#### Parameters

self | an IdeDeviceProvider |
device | an IdeDevice |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 3.28