aboutsummaryrefslogtreecommitdiff
path: root/src/mm-cbm-list.h
blob: 479c363002dd7270f6048df19caf24f3fb01e848 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/* -*- 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) 2024 Guido Günther <agx@sigxcpu.org>
 */

#ifndef MM_CBM_LIST_H
#define MM_CBM_LIST_H

#include <glib.h>
#include <glib-object.h>

#include "mm-base-modem.h"
#include "mm-base-cbm.h"
#include "mm-cbm-part.h"

#define MM_TYPE_CBM_LIST            (mm_cbm_list_get_type ())
#define MM_CBM_LIST(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_CBM_LIST, MMCbmList))
#define MM_CBM_LIST_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  MM_TYPE_CBM_LIST, MMCbmListClass))
#define MM_IS_CBM_LIST(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_CBM_LIST))
#define MM_IS_CBM_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  MM_TYPE_CBM_LIST))
#define MM_CBM_LIST_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  MM_TYPE_CBM_LIST, MMCbmListClass))

typedef struct _MMCbmList MMCbmList;
typedef struct _MMCbmListClass MMCbmListClass;
typedef struct _MMCbmListPrivate MMCbmListPrivate;

#define MM_CBM_LIST_MODEM "cbm-list-modem"

#define MM_CBM_ADDED   "cbm-added"
#define MM_CBM_DELETED "cbm-deleted"

struct _MMCbmList {
    GObject parent;
    MMCbmListPrivate *priv;
};

struct _MMCbmListClass {
    GObjectClass parent;

    /* Signals */
    void (* cbm_added)    (MMCbmList *self,
                           const gchar *cbm_path);
    void (* cbm_deleted)  (MMCbmList *self,
                           const gchar *sms_path);
};

GType mm_cbm_list_get_type (void);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MMCbmList, g_object_unref)

MMCbmList *mm_cbm_list_new (MMBaseModem *modem,
                            GObject     *bind_to);

GStrv mm_cbm_list_get_paths (MMCbmList *self);
guint mm_cbm_list_get_count (MMCbmList *self);

gboolean mm_cbm_list_has_part (MMCbmList *self,
                               guint16    serial,
                               guint16    message_id,
                               guint8     part_num);

gboolean mm_cbm_list_take_part (MMCbmList *self,
                                GObject *bind_to,
                                MMCbmPart *part,
                                MMCbmState state,
                                GError **error);

void mm_cbm_list_add_cbm (MMCbmList *self,
                          MMBaseCbm *cbm);

void     mm_cbm_list_delete_cbm        (MMCbmList *self,
                                        const gchar *cbm_path,
                                        GAsyncReadyCallback callback,
                                        gpointer user_data);
gboolean mm_cbm_list_delete_cbm_finish (MMCbmList *self,
                                        GAsyncResult *res,
                                        GError **error);

#endif /* MM_CBM_LIST_H */