GUsb.Context
Description: Reference for GUsb.Context

### Class

# GUsbContext

#### Description

    class GUsb.Context : GObject.Object {
      parent_instance: GObject
    }

No description available.

#### Ancestors

- GObject

#### Implements

- GInitable

#### Constructors

###### g_usb_context_new

Creates a new context for accessing USB devices.

since: 0.1.0

#### Functions

###### g_usb_context_error_quark

No description available.

since: 0.1.0

#### Instance methods

###### g_usb_context_enumerate

Enumerates all the USB devices and adds them to the context.

since: 0.2.2

###### g_usb_context_find_by_bus_address

Finds a device based on its bus and address values.

since: 0.2.2

###### g_usb_context_find_by_platform_id

Finds a device based on its platform id value.

since: 0.2.4

###### g_usb_context_find_by_vid_pid

Finds a device based on its bus and address values.

since: 0.2.2

###### g_usb_context_get_devices

No description available.

since: 0.2.2

###### g_usb_context_get_flags

Sets the flags to use for the context.

since: 0.2.11

###### g_usb_context_get_hotplug_poll_interval

Gets the poll interval for platforms like Windows that do not support `LIBUSB_CAP_HAS_HOTPLUG`.

since: 0.3.10

###### g_usb_context_get_main_context

Gets the internal GMainContext to use for synchronous methods. By default the value is set to the value of `g_main_context_default()`

since: 0.2.5

###### g_usb_context_get_source

This function does nothing.

since: 0.1.0

###### g_usb_context_load

Loads the context from a JSON object.

since: 0.4.0

###### g_usb_context_load_with_tag

Loads any devices with a specified tag into the context from a JSON object.

since: 0.4.1

###### g_usb_context_save

Saves the context to an existing JSON builder.

since: 0.4.0

###### g_usb_context_save_with_tag

Saves any devices with a specified tag into an existing JSON builder.

since: 0.4.1

###### g_usb_context_set_debug

Sets the debug flags which control what is logged to the console.

since: 0.1.0

###### g_usb_context_set_flags

Sets the flags to use for the context. These should be set before `g_usb_context_enumerate()` is called.

since: 0.2.11

###### g_usb_context_set_hotplug_poll_interval

Sets the poll interval for platforms like Windows that do not support `LIBUSB_CAP_HAS_HOTPLUG`. This defaults to 1000ms and can be changed before or after `g_usb_context_enumerate()` has been called.

since: 0.3.10

###### g_usb_context_set_main_context

Sets the internal GMainContext to use for synchronous methods.

since: 0.2.5

###### g_usb_context_wait_for_replug

Waits for the device to be replugged. It may come back with a different VID:PID.

since: 0.2.9

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

##### Methods inherited from GInitable (1)

###### g_initable_init

Initializes the object implementing the interface.

unstable since: 2.22

#### Properties

###### GUsb.Context:debug-level

No description available.

###### GUsb.Context:libusb-context

No description available.

#### Signals

###### GUsb.Context::device-added

This signal is emitted when a USB device is added.

###### GUsb.Context::device-changed

This signal is emitted when a USB device is changed.

###### GUsb.Context::device-removed

This signal is emitted when a USB device is removed.

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

#### Class structure

    struct GUsbContextClass {
      GObjectClass parent_class;
      void (* device_added) (
        GUsbContext* self,
        GUsbDevice* device
      );
      void (* device_removed) (
        GUsbContext* self,
        GUsbDevice* device
      );
      void (* device_changed) (
        GUsbContext* self,
        GUsbDevice* device
      );

    }

No description available.

###### Class members

`parent_class: GObjectClass`
  No description available.
`device_added: void (* device_added) ( GUsbContext* self, GUsbDevice* device )`
  No description available.
`device_removed: void (* device_removed) ( GUsbContext* self, GUsbDevice* device )`
  No description available.
`device_changed: void (* device_changed) ( GUsbContext* self, GUsbDevice* device )`
  No description available.

#### Virtual methods

###### GUsb.ContextClass.device_added

No description available.

###### GUsb.ContextClass.device_changed

No description available.

###### GUsb.ContextClass.device_removed

No description available.