diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-06-05 15:25:38 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-08-06 20:06:44 +0200 |
commit | 815693661c7f6a4225d271d2cec67e59bad8e070 (patch) | |
tree | 4bd354e4713a5eb11a95d50e56b6ed2e2afe30e3 /src/mm-device.h | |
parent | 4add521a98e59c9fbaaf30d965771ca01f748242 (diff) |
core: compile all ports before creating the modem object
Before this, we only exported the modem to DBus when all ports were organized,
in order to make sure that we select as primary port the one we really want and
not the first AT port grabbed. Given that to get all the ports organized we also
needed to wait to get all the ports grabbed, we can now also defer the creation
of the modem object until all the ports get grabbed. This allows us to create
different types of objects based on the ports available (e.g. we can now create
QMI-supported modem objects if we see a QMI port around).
Diffstat (limited to 'src/mm-device.h')
-rw-r--r-- | src/mm-device.h | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/src/mm-device.h b/src/mm-device.h new file mode 100644 index 00000000..dab11b7e --- /dev/null +++ b/src/mm-device.h @@ -0,0 +1,74 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details: + * + * Copyright (C) 2012 Google, Inc. + */ + +#ifndef MM_DEVICE_H +#define MM_DEVICE_H + +#include <glib.h> +#include <glib-object.h> + +#include <gudev/gudev.h> + +#include "mm-plugin.h" + +#define MM_TYPE_DEVICE (mm_device_get_type ()) +#define MM_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_DEVICE, MMDevice)) +#define MM_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_DEVICE, MMDeviceClass)) +#define MM_IS_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_DEVICE)) +#define MM_IS_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_DEVICE)) +#define MM_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_DEVICE, MMDeviceClass)) + +typedef struct _MMDevice MMDevice; +typedef struct _MMDeviceClass MMDeviceClass; +typedef struct _MMDevicePrivate MMDevicePrivate; + +#define MM_DEVICE_UDEV_DEVICE "udev-device" +#define MM_DEVICE_PLUGIN "plugin" +#define MM_DEVICE_MODEM "modem" + +struct _MMDevice { + GObject parent; + MMDevicePrivate *priv; +}; + +struct _MMDeviceClass { + GObjectClass parent; +}; + +GType mm_device_get_type (void); + +MMDevice *mm_device_new (GUdevDevice *udev_device, + MMPlugin *plugin); + +void mm_device_grab_port (MMDevice *self, + GUdevDevice *udev_port); +void mm_device_release_port (MMDevice *self, + GUdevDevice *udev_port); +gboolean mm_device_owns_port (MMDevice *self, + GUdevDevice *udev_port); + +gboolean mm_device_create_modem (MMDevice *self, + GDBusObjectManagerServer *object_manager, + GError **error); +void mm_device_remove_modem (MMDevice *self); + +GUdevDevice *mm_device_peek_udev_device (MMDevice *self); +GUdevDevice *mm_device_get_udev_device (MMDevice *self); +MMPlugin *mm_device_peek_plugin (MMDevice *self); +MMPlugin *mm_device_get_plugin (MMDevice *self); +MMBaseModem *mm_device_peek_modem (MMDevice *self); +MMBaseModem *mm_device_get_modem (MMDevice *self); + +#endif /* MM_DEVICE_H */ |