## BtIcDevice

BtIcDevice — buzztraxs interaction controller device

## Functions

void | btic_device_add_control ()
BtIcControl * | btic_device_get_control_by_id ()
BtIcControl * | btic_device_get_control_by_name ()
gboolean | btic_device_has_controls ()
gboolean | btic_device_start ()
gboolean | btic_device_stop ()
gboolean | (*btic_device_virtual_start) ()
gboolean | (*btic_device_virtual_stop) ()

## Properties

gpointer | controls | Read
gchar * | name | Read / Write / Construct Only
gchar * | udi | Read / Write / Construct Only

## Types and Values

struct | BtIcDevice

## Object Hierarchy

        GObject
        ╰── BtIcDevice
            ├── BtIcASeqDevice
            ├── BtIcInputDevice
            ╰── BtIcMidiDevice

## Includes

    #include <libbtic/ic.h>

## Description

Abstract base class for control devices. Subclasses will provide functionality to query capabilities and register BtIcControl instances. They will also read from the device and trigger the change events on their controls (via value property). To activate reading from a device, the application needs to call `btic_device_start()`. The device is activates on the first such call. Each activation is counted and thus should be paired with a call to `btic_device_stop()` to stop the device on the last call.

This baseclass manages the added controls. They can be queried by calling `btic_device_get_control_by_id()` or iterating the list in BtIcDevice::controls.

## Functions

### btic_device_add_control ()

    void
    btic_device_add_control (const BtIcDevice *self,
                             const BtIcControl *control);

Add the given `control` to the list that the device manages. Takes ownership of the control.

#### Parameters

self | the device |
control | new control |

### btic_device_get_control_by_id ()

    BtIcControl *
    btic_device_get_control_by_id (const BtIcDevice *self,
                                   guint id);

Look up a control by `id` .

#### Parameters

self | the device |
id | the control id |

#### Returns

the found instance or `NULL`. This does not increase the ref-count!.

[transfer none]

Since: 0.6

### btic_device_get_control_by_name ()

    BtIcControl *
    btic_device_get_control_by_name (const BtIcDevice *self,
                                     const gchar *name);

Look up a control by `name` .

#### Parameters

self | the device |
name | the control name |

#### Returns

the found instance or `NULL`.

[transfer full]

Since: 0.9

### btic_device_has_controls ()

    gboolean
    btic_device_has_controls (const BtIcDevice *self);

Check if the device has controls. This is useful to check after device creation. One reason for not having any controls could also be missing read-permissions on the device node.

#### Parameters

self | the device |

Since: 0.6

### btic_device_start ()

    gboolean
    btic_device_start (const BtIcDevice *self);

Starts the io-loop for the device. This can be called multiple times and must be paired by an equal amount of `btic_device_stop()` calls.

#### Parameters

self | the BtIcDevice instance to use |

#### Returns

`TRUE` for success

### btic_device_stop ()

    gboolean
    btic_device_stop (const BtIcDevice *self);

Stops the io-loop for the device. This must be called as often as the device has been started using `btic_device_start()`.

#### Parameters

self | the BtIcDevice instance to use |

#### Returns

`TRUE` for success

### btic_device_virtual_start ()

    gboolean
    (*btic_device_virtual_start) (gconstpointer self);

Subclasses will override this methods with a function that counts start calls and runs the device-io for starts>0.

#### Parameters

self | device instance |

#### Returns

`TRUE` for success

### btic_device_virtual_stop ()

    gboolean
    (*btic_device_virtual_stop) (gconstpointer self);

Subclasses will override this methods with a function that counts stop calls and stops the device-io for starts==0.

#### Parameters

self | device instance |

#### Returns

`TRUE` for success

## Types and Values

### struct BtIcDevice

    struct BtIcDevice;

buzztraxs interaction controller device

## Property Details

### The `“controls”` property

      “controls”                 gpointer

A copy of the list of device controls.

Flags: Read

### The `“name”` property

      “name”                     gchar *

device name.

Flags: Read / Write / Construct Only

Default value: NULL

### The `“udi”` property

      “udi”                      gchar *

device udi.

Flags: Read / Write / Construct Only

Default value: NULL