diff options
author | Ben Chan <benchan@chromium.org> | 2018-08-13 12:27:37 -0700 |
---|---|---|
committer | Ben Chan <benchan@chromium.org> | 2018-08-18 13:29:46 -0700 |
commit | 28e64d00181c83fd6cd420c46b6040f7b1afe5fb (patch) | |
tree | 59ba372cd17c3248d7a8d901e2ba41f5a52619d2 /libmm-glib/mm-pco.h | |
parent | 89ffcbdd8db4164a4a1cbea0224b0cc14a3f57b0 (diff) |
libmm-glib: add MMPco for handling raw PCO data
Diffstat (limited to 'libmm-glib/mm-pco.h')
-rw-r--r-- | libmm-glib/mm-pco.h | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/libmm-glib/mm-pco.h b/libmm-glib/mm-pco.h new file mode 100644 index 00000000..e9c47445 --- /dev/null +++ b/libmm-glib/mm-pco.h @@ -0,0 +1,87 @@ +/* -*- 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 2018 Google LLC. + */ + +#ifndef MM_PCO_H +#define MM_PCO_H + +#if !defined (__LIBMM_GLIB_H_INSIDE__) && !defined (LIBMM_GLIB_COMPILATION) +#error "Only <libmm-glib.h> can be included directly." +#endif + +#include <ModemManager.h> +#include <glib-object.h> + +G_BEGIN_DECLS + +#define MM_TYPE_PCO (mm_pco_get_type ()) +#define MM_PCO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_PCO, MMPco)) +#define MM_PCO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_PCO, MMPcoClass)) +#define MM_IS_PCO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_PCO)) +#define MM_IS_PCO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_PCO)) +#define MM_PCO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_PCO, MMPcoClass)) + +typedef struct _MMPco MMPco; +typedef struct _MMPcoClass MMPcoClass; +typedef struct _MMPcoPrivate MMPcoPrivate; + +/** + * MMPco: + * + * The #MMPco structure contains private data and should only be accessed + * using the provided API. + */ +struct _MMPco { + /*< private >*/ + GObject parent; + MMPcoPrivate *priv; +}; + +struct _MMPcoClass { + /*< private >*/ + GObjectClass parent; +}; + +GType mm_pco_get_type (void); + + +guint32 mm_pco_get_session_id (MMPco *self); +gboolean mm_pco_is_complete (MMPco *self); +const guint8 *mm_pco_get_data (MMPco *self, + gsize *data_size); + +/*****************************************************************************/ +/* ModemManager/libmm-glib/mmcli specific methods */ + +#if defined (_LIBMM_INSIDE_MM) || \ + defined (_LIBMM_INSIDE_MMCLI) || \ + defined (LIBMM_GLIB_COMPILATION) + +MMPco *mm_pco_new (void); +MMPco *mm_pco_from_variant (GVariant *variant, + GError **error); +GVariant *mm_pco_to_variant (MMPco *self); +void mm_pco_set_session_id (MMPco *self, + guint32 session_id); +void mm_pco_set_complete (MMPco *self, + gboolean is_complete); +void mm_pco_set_data (MMPco *self, + const guint8 *data, + gsize data_size); + +#endif + +G_END_DECLS + +#endif /* MM_PCO_H */ |