| 1 |
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
| 2 |
/* |
| 3 |
* qmi-firmware-update -- Command line tool to update firmware in QMI devices |
| 4 |
* |
| 5 |
* This program is free software: you can redistribute it and/or modify |
| 6 |
* it under the terms of the GNU General Public License as published by |
| 7 |
* the Free Software Foundation, either version 2 of the License, or |
| 8 |
* (at your option) any later version. |
| 9 |
* |
| 10 |
* This program is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
* GNU General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License |
| 16 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
* |
| 18 |
* Copyright (C) 2017 Zodiac Inflight Innovations |
| 19 |
* Copyright (C) 2017 Aleksander Morgado <[email protected]> |
| 20 |
*/ |
| 21 |
|
| 22 |
#ifndef QFU_DEVICE_SELECTION_H |
| 23 |
#define QFU_DEVICE_SELECTION_H |
| 24 |
|
| 25 |
#include <glib-object.h> |
| 26 |
#include <gio/gio.h> |
| 27 |
|
| 28 |
#include "qfu-helpers.h" |
| 29 |
|
| 30 |
G_BEGIN_DECLS |
| 31 |
|
| 32 |
#define QFU_TYPE_DEVICE_SELECTION (qfu_device_selection_get_type ()) |
| 33 |
#define QFU_DEVICE_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), QFU_TYPE_DEVICE_SELECTION, QfuDeviceSelection)) |
| 34 |
#define QFU_DEVICE_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), QFU_TYPE_DEVICE_SELECTION, QfuDeviceSelectionClass)) |
| 35 |
#define QFU_IS_DEVICE_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), QFU_TYPE_DEVICE_SELECTION)) |
| 36 |
#define QFU_IS_DEVICE_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), QFU_TYPE_DEVICE_SELECTION)) |
| 37 |
#define QFU_DEVICE_SELECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), QFU_TYPE_DEVICE_SELECTION, QfuDeviceSelectionClass)) |
| 38 |
|
| 39 |
typedef struct _QfuDeviceSelection QfuDeviceSelection; |
| 40 |
typedef struct _QfuDeviceSelectionClass QfuDeviceSelectionClass; |
| 41 |
typedef struct _QfuDeviceSelectionPrivate QfuDeviceSelectionPrivate; |
| 42 |
|
| 43 |
struct _QfuDeviceSelection { |
| 44 |
GObject parent; |
| 45 |
QfuDeviceSelectionPrivate *priv; |
| 46 |
}; |
| 47 |
|
| 48 |
struct _QfuDeviceSelectionClass { |
| 49 |
GObjectClass parent; |
| 50 |
}; |
| 51 |
|
| 52 |
GType qfu_device_selection_get_type (void); |
| 53 |
G_DEFINE_AUTOPTR_CLEANUP_FUNC (QfuDeviceSelection, g_object_unref); |
| 54 |
|
| 55 |
QfuDeviceSelection *qfu_device_selection_new (const gchar *preferred_cdc_wdm, |
| 56 |
const gchar *preferred_tty, |
| 57 |
guint16 preferred_vid, |
| 58 |
guint16 preferred_pid, |
| 59 |
guint preferred_busnum, |
| 60 |
guint preferred_devnum, |
| 61 |
GError **error); |
| 62 |
|
| 63 |
GFile *qfu_device_selection_get_single_cdc_wdm (QfuDeviceSelection *self); |
| 64 |
void qfu_device_selection_wait_for_cdc_wdm (QfuDeviceSelection *self, |
| 65 |
GCancellable *cancellable, |
| 66 |
GAsyncReadyCallback callback, |
| 67 |
gpointer user_data); |
| 68 |
GFile *qfu_device_selection_wait_for_cdc_wdm_finish (QfuDeviceSelection *self, |
| 69 |
GAsyncResult *res, |
| 70 |
GError **error); |
| 71 |
|
| 72 |
GFile *qfu_device_selection_get_single_tty (QfuDeviceSelection *self, |
| 73 |
QfuHelpersDeviceMode mode); |
| 74 |
GList *qfu_device_selection_get_multiple_ttys (QfuDeviceSelection *self, |
| 75 |
QfuHelpersDeviceMode mode); |
| 76 |
void qfu_device_selection_wait_for_tty (QfuDeviceSelection *self, |
| 77 |
QfuHelpersDeviceMode mode, |
| 78 |
GCancellable *cancellable, |
| 79 |
GAsyncReadyCallback callback, |
| 80 |
gpointer user_data); |
| 81 |
GFile *qfu_device_selection_wait_for_tty_finish (QfuDeviceSelection *self, |
| 82 |
GAsyncResult *res, |
| 83 |
GError **error); |
| 84 |
|
| 85 |
G_END_DECLS |
| 86 |
|
| 87 |
#endif /* QFU_DEVICE_SELECTION_H */ |