Commit 85d3c47d authored by Slava Monich's avatar Slava Monich

[mms-engine] Proper support for multiple SIMs. Fixes JB#33702

We need to use org.nemomobile.ofono.ModemManager API to notify ofono
that we need to download MMS so that it enables mobile data for the
appropriate SIM. If it's different from the currently selected data SIM,
then connman will be prevented from using mobile data while MMS download
is taking place.
parent 9ed94503
# -*- Mode: makefile-gmake -*-
.PHONY: clean all debug release
# Required packages
PKGS = libgofono libgofonoext libglibutil glib-2.0 gio-2.0 gio-unix-2.0
#
# Default target
#
all: debug release
#
# Sources
#
SRC = \
mms_connection_nemo.c \
mms_connman_nemo.c
#
# Directories
#
SRC_DIR = src
INCLUDE_DIR = include
BUILD_DIR = build
SPEC_DIR = spec
MMS_LIB_INCLUDE = ../mms-lib/include
DEBUG_BUILD_DIR = $(BUILD_DIR)/debug
RELEASE_BUILD_DIR = $(BUILD_DIR)/release
#
# Tools and flags
#
CC = $(CROSS_COMPILE)gcc
LD = $(CC)
ARFLAGS = rc
DEBUG_FLAGS = -g
RELEASE_FLAGS = -O2
DEBUG_DEFS = -DDEBUG
RELEASE_DEFS =
WARNINGS = -Wall
INCLUDES = -I$(SRC_DIR) -I$(INCLUDE_DIR) -I$(MMS_LIB_INCLUDE) -I.
CFLAGS += $(WARNINGS) $(INCLUDES) $(shell pkg-config --cflags $(PKGS)) \
-fPIC -MMD
ifndef KEEP_SYMBOLS
KEEP_SYMBOLS = 0
endif
ifneq ($(KEEP_SYMBOLS),0)
RELEASE_FLAGS += -g
endif
DEBUG_CFLAGS = $(DEBUG_FLAGS) $(DEBUG_DEFS) $(CFLAGS)
RELEASE_CFLAGS = $(RELEASE_FLAGS) $(RELEASE_DEFS) $(CFLAGS)
#
# Files
#
DEBUG_OBJS = $(SRC:%.c=$(DEBUG_BUILD_DIR)/%.o)
RELEASE_OBJS = $(SRC:%.c=$(RELEASE_BUILD_DIR)/%.o)
#
# Dependencies
#
DEPS = $(DEBUG_OBJS:%.o=%.d) $(RELEASE_OBJS:%.o=%.d)
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(DEPS)),)
-include $(DEPS)
endif
endif
$(DEBUG_OBJS): | $(DEBUG_BUILD_DIR)
$(RELEASE_OBJS): | $(RELEASE_BUILD_DIR)
#
# Rules
#
LIB = libmms-connman-nemo.a
DEBUG_LIB = $(DEBUG_BUILD_DIR)/$(LIB)
RELEASE_LIB = $(RELEASE_BUILD_DIR)/$(LIB)
debug: $(DEBUG_LIB)
release: $(RELEASE_LIB)
clean:
rm -fr $(BUILD_DIR) *~ $(SRC_DIR)/*~ $(INCLUDE_DIR)/*~
$(DEBUG_BUILD_DIR):
mkdir -p $@
$(RELEASE_BUILD_DIR):
mkdir -p $@
$(DEBUG_BUILD_DIR)/%.o : $(SRC_DIR)/%.c
$(CC) -c $(WARN) $(DEBUG_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
$(RELEASE_BUILD_DIR)/%.o : $(SRC_DIR)/%.c
$(CC) -c $(WARN) $(RELEASE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
$(DEBUG_LIB): $(DEBUG_OBJS)
$(AR) $(ARFLAGS) $@ $^
$(RELEASE_LIB): $(RELEASE_OBJS)
$(AR) $(ARFLAGS) $@ $^
/*
* Copyright (C) 2013-2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* 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.
*
*/
#ifndef JOLLA_MMS_CONNMAN_NEMO_H
#define JOLLA_MMS_CONNMAN_NEMO_H
#include "mms_connman.h"
MMSConnMan*
mms_connman_nemo_new(void);
#endif /* JOLLA_MMS_CONNMAN_NEMO_H */
/*
* Local Variables:
* mode: C
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*/
/*
* Copyright (C) 2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* 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.
*
*/
#ifndef JOLLA_MMS_CONNMAN_NEMO_LOG_H
#define JOLLA_MMS_CONNMAN_NEMO_LOG_H
#include "mms_log.h"
#define MMS_CONNMAN_LOG_MODULES(log) \
log(gofonoext_log) \
log(gofono_log)
MMS_CONNMAN_LOG_MODULES(GLOG_MODULE_DECL)
#endif /* JOLLA_MMS_CONNMAN_NEMO_LOG_H */
/*
* Local Variables:
* mode: C
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*/
TEMPLATE = lib
CONFIG += staticlib
CONFIG -= qt
CONFIG += link_pkgconfig
PKGCONFIG += libgofono libgofonoext libglibutil glib-2.0 gio-2.0 gio-unix-2.0
DBUS_SPEC_DIR = $$_PRO_FILE_PWD_/spec
INCLUDEPATH += include
INCLUDEPATH += ../mms-lib/include
QMAKE_CFLAGS += -Wno-unused-parameter
CONFIG(debug, debug|release) {
DEFINES += DEBUG
DESTDIR = $$_PRO_FILE_PWD_/build/debug
} else {
DESTDIR = $$_PRO_FILE_PWD_/build/release
}
SOURCES += \
src/mms_connection_nemo.c \
src/mms_connman_nemo.c
HEADERS += \
src/mms_connection_nemo.h
HEADERS += \
include/mms_connman_nemo.h \
include/mms_connman_nemo_log.h
This diff is collapsed.
/*
* Copyright (C) 2013-2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* 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.
*
*/
#ifndef JOLLA_MMS_CONNECTION_NEMO_H
#define JOLLA_MMS_CONNECTION_NEMO_H
#include "mms_connection.h"
#include <gofonoext_mm.h>
MMSConnection*
mms_connection_nemo_new(
MMSConnMan* cm,
const char* imsi,
gboolean user_request);
#endif /* JOLLA_MMS_CONNECTION_NEMO_H */
/*
* Local Variables:
* mode: C
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*/
/*
* Copyright (C) 2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* 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.
*
*/
#include "mms_connman_nemo.h"
#include "mms_connection_nemo.h"
/* Logging */
#define MMS_LOG_MODULE_NAME mms_connman_log
#include "mms_connman_nemo_log.h"
MMS_LOG_MODULE_DEFINE("mms-connman-nemo");
typedef MMSConnManClass MMSConnManNemoClass;
typedef struct mms_connman_nemo {
MMSConnMan cm;
OfonoExtModemManager* mm;
MMSConnection* conn;
gulong voice_sim_changed_id;
} MMSConnManNemo;
G_DEFINE_TYPE(MMSConnManNemo, mms_connman_nemo, MMS_TYPE_CONNMAN)
#define MMS_TYPE_CONNMAN_NEMO (mms_connman_nemo_get_type())
#define MMS_CONNMAN_NEMO(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),\
MMS_TYPE_CONNMAN_NEMO, MMSConnManNemo))
#define MMS_INIT_TIMEOUT_SEC (30)
static
gboolean
mms_connman_nemo_wait_timeout(
gpointer data)
{
g_main_loop_quit(data);
return G_SOURCE_REMOVE;
}
static
void
mms_connman_nemo_wait_valid_changed(
OfonoExtModemManager* mm,
void* data)
{
if (mm->valid) {
g_main_loop_quit(data);
}
}
/**
* Checks if OfonoExtModemManager is initialized and waits up to
* MMS_INIT_TIMEOUT_SEC if necessary.
*/
static
gboolean
mms_connman_nemo_mm_valid(
MMSConnManNemo* self)
{
if (self->mm->valid) {
return TRUE;
} else {
/* That shouldn't take long */
GMainLoop* loop = g_main_loop_new(NULL, TRUE);
guint timeout_id = g_timeout_add(MMS_INIT_TIMEOUT_SEC*1000,
mms_connman_nemo_wait_timeout, loop);
gulong valid_id = ofonoext_mm_add_valid_changed_handler(self->mm,
mms_connman_nemo_wait_valid_changed, loop);
g_main_loop_run(loop);
g_main_loop_unref(loop);
g_source_remove(timeout_id);
ofonoext_mm_remove_handler(self->mm, valid_id);
return self->mm->valid;
}
}
/**
* Returns IMSI of the default (voice) SIM
*/
static
char*
mms_connman_nemo_default_imsi(
MMSConnMan* cm)
{
MMSConnManNemo* self = MMS_CONNMAN_NEMO(cm);
if (mms_connman_nemo_mm_valid(self)) {
return g_strdup(self->mm->voice_imsi);
}
return NULL;
}
/**
* MMSConnection destroy notification.
*/
static
void
mms_connman_nemo_connection_weak_ref_notify(
gpointer arg,
GObject* connection)
{
MMSConnManNemo* self = MMS_CONNMAN_NEMO(arg);
MMS_ASSERT(MMS_CONNECTION(connection) == self->conn);
self->conn = NULL;
}
/**
* Creates a new connection or returns the reference to an aready active one.
* The caller must release the reference. Returns NULL if the modem is offline
* and the network task should fail immediately.
*/
static
MMSConnection*
mms_connman_nemo_open_connection(
MMSConnMan* cm,
const char* imsi,
gboolean user_request)
{
MMSConnManNemo* self = MMS_CONNMAN_NEMO(cm);
if (self->conn) {
if (!g_strcmp0(self->conn->imsi, imsi)) {
return mms_connection_ref(self->conn);
} else {
g_object_weak_unref(G_OBJECT(self->conn),
mms_connman_nemo_connection_weak_ref_notify, self);
self->conn = NULL;
}
}
self->conn = mms_connection_nemo_new(cm, imsi, user_request);
g_object_weak_ref(G_OBJECT(self->conn),
mms_connman_nemo_connection_weak_ref_notify, self);
return self->conn;
}
/**
* Creates connection manager
*/
MMSConnMan*
mms_connman_nemo_new()
{
MMSConnManNemo* self = g_object_new(MMS_TYPE_CONNMAN_NEMO, NULL);
self->mm = ofonoext_mm_new();
return &self->cm;
}
/**
* Final stage of deinitialization
*/
static
void
mms_connman_nemo_finalize(
GObject* object)
{
MMSConnManNemo* self = MMS_CONNMAN_NEMO(object);
MMS_VERBOSE_("");
ofonoext_mm_unref(self->mm);
G_OBJECT_CLASS(mms_connman_nemo_parent_class)->finalize(object);
}
/**
* Per class initializer
*/
static
void
mms_connman_nemo_class_init(
MMSConnManNemoClass* klass)
{
GObjectClass* object_class = G_OBJECT_CLASS(klass);
klass->fn_default_imsi = mms_connman_nemo_default_imsi;
klass->fn_open_connection = mms_connman_nemo_open_connection;
object_class->finalize = mms_connman_nemo_finalize;
}
/**
* Per instance initializer
*/
static
void
mms_connman_nemo_init(
MMSConnManNemo* self)
{
}
/*
* Local Variables:
* mode: C
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*/
...@@ -18,6 +18,11 @@ include ../mms-lib/Config.mak ...@@ -18,6 +18,11 @@ include ../mms-lib/Config.mak
PKGS = gio-unix-2.0 gio-2.0 libglibutil PKGS = gio-unix-2.0 gio-2.0 libglibutil
LIB_PKGS = libwspcodec gmime-2.6 libgofono libsoup-2.4 dconf LIB_PKGS = libwspcodec gmime-2.6 libgofono libsoup-2.4 dconf
ifdef MMS_CONNMAN_NEMO
LIB_PKGS += libgofonoext
endif
LIB_PKGS += $(RESIZE_PKG) $(PKGS) LIB_PKGS += $(RESIZE_PKG) $(PKGS)
# #
...@@ -58,8 +63,13 @@ MMS_LIB_RELEASE_LIB = $(MMS_LIB_BUILD_DIR)/release/$(MMS_LIB_LIB) ...@@ -58,8 +63,13 @@ MMS_LIB_RELEASE_LIB = $(MMS_LIB_BUILD_DIR)/release/$(MMS_LIB_LIB)
# mms-connman # mms-connman
# #
MMS_CONNMAN_LIB = libmms-connman-ofono.a ifdef MMS_CONNMAN_NEMO
MMS_CONNMAN_DIR = ../mms-connman-ofono MMS_CONNMAN = nemo
else
MMS_CONNMAN = ofono
endif
MMS_CONNMAN_LIB = libmms-connman-$(MMS_CONNMAN).a
MMS_CONNMAN_DIR = ../mms-connman-$(MMS_CONNMAN)
MMS_CONNMAN_BUILD_DIR = $(MMS_CONNMAN_DIR)/build MMS_CONNMAN_BUILD_DIR = $(MMS_CONNMAN_DIR)/build
MMS_CONNMAN_DEBUG_LIB = $(MMS_CONNMAN_BUILD_DIR)/debug/$(MMS_CONNMAN_LIB) MMS_CONNMAN_DEBUG_LIB = $(MMS_CONNMAN_BUILD_DIR)/debug/$(MMS_CONNMAN_LIB)
MMS_CONNMAN_RELEASE_LIB = $(MMS_CONNMAN_BUILD_DIR)/release/$(MMS_CONNMAN_LIB) MMS_CONNMAN_RELEASE_LIB = $(MMS_CONNMAN_BUILD_DIR)/release/$(MMS_CONNMAN_LIB)
...@@ -112,6 +122,10 @@ ifdef MMS_ENGINE_VERSION ...@@ -112,6 +122,10 @@ ifdef MMS_ENGINE_VERSION
CFLAGS += -DMMS_ENGINE_VERSION="$(MMS_ENGINE_VERSION)" CFLAGS += -DMMS_ENGINE_VERSION="$(MMS_ENGINE_VERSION)"
endif endif
ifdef MMS_CONNMAN_NEMO
CFLAGS += -DMMS_CONNMAN_NEMO
endif
DEBUG_CFLAGS = $(DEBUG_FLAGS) $(DEBUG_DEFS) $(CFLAGS) DEBUG_CFLAGS = $(DEBUG_FLAGS) $(DEBUG_DEFS) $(CFLAGS)
RELEASE_CFLAGS = $(RELEASE_FLAGS) $(RELEASE_DEFS) $(CFLAGS) RELEASE_CFLAGS = $(RELEASE_FLAGS) $(RELEASE_DEFS) $(CFLAGS)
......
...@@ -17,11 +17,16 @@ ...@@ -17,11 +17,16 @@
#include <glib-unix.h> #include <glib-unix.h>
#include "mms_engine.h" #include "mms_engine.h"
#include "mms_connman_ofono_log.h"
#include "mms_lib_log.h" #include "mms_lib_log.h"
#include "mms_lib_util.h" #include "mms_lib_util.h"
#include "mms_settings.h" #include "mms_settings.h"
#ifdef MMS_CONNMAN_NEMO
# include "mms_connman_nemo_log.h"
#else
# include "mms_connman_ofono_log.h"
#endif
#define RET_OK (0) #define RET_OK (0)
#define RET_ERR (1) #define RET_ERR (1)
......
...@@ -2,16 +2,6 @@ TEMPLATE = app ...@@ -2,16 +2,6 @@ TEMPLATE = app
CONFIG += link_pkgconfig CONFIG += link_pkgconfig
PKGCONFIG += gmime-2.6 gio-unix-2.0 gio-2.0 glib-2.0 libsoup-2.4 dconf PKGCONFIG += gmime-2.6 gio-unix-2.0 gio-2.0 glib-2.0 libsoup-2.4 dconf
PKGCONFIG += libwspcodec libgofono libglibutil PKGCONFIG += libwspcodec libgofono libglibutil
DBUS_INTERFACE_DIR = $$_PRO_FILE_PWD_
MMS_LIB_DIR = $$_PRO_FILE_PWD_/../mms-lib
MMS_CONNMAN = mms-connman-ofono
MMS_CONNMAN_DIR = $$_PRO_FILE_PWD_/../$$MMS_CONNMAN
MMS_HANDLER_DIR = $$_PRO_FILE_PWD_/../mms-handler-dbus
MMS_SETTINGS_DIR = $$_PRO_FILE_PWD_/../mms-settings-dconf
INCLUDEPATH += $$MMS_CONNMAN_DIR/include
INCLUDEPATH += $$MMS_LIB_DIR/include
INCLUDEPATH += $$MMS_HANDLER_DIR/include
INCLUDEPATH += $$MMS_SETTINGS_DIR/include
QMAKE_CFLAGS += -Wno-unused-parameter QMAKE_CFLAGS += -Wno-unused-parameter
include(../mms-lib/mms-lib-config.pri) include(../mms-lib/mms-lib-config.pri)
...@@ -21,6 +11,25 @@ ResizeImageMagick { ...@@ -21,6 +11,25 @@ ResizeImageMagick {
PKGCONFIG += ImageMagick PKGCONFIG += ImageMagick
} }
ConnManNemo {
PKGCONFIG += libgofonoext
DEFINES += MMS_CONNMAN_NEMO
MMS_CONNMAN = mms-connman-nemo
} else {
MMS_CONNMAN = mms-connman-ofono
}
DBUS_INTERFACE_DIR = $$_PRO_FILE_PWD_
MMS_LIB_DIR = $$_PRO_FILE_PWD_/../mms-lib
MMS_HANDLER_DIR = $$_PRO_FILE_PWD_/../mms-handler-dbus
MMS_SETTINGS_DIR = $$_PRO_FILE_PWD_/../mms-settings-dconf
MMS_CONNMAN_DIR = $$_PRO_FILE_PWD_/../$$MMS_CONNMAN
INCLUDEPATH += $$MMS_LIB_DIR/include
INCLUDEPATH += $$MMS_HANDLER_DIR/include
INCLUDEPATH += $$MMS_SETTINGS_DIR/include
INCLUDEPATH += $$MMS_CONNMAN_DIR/include
SOURCES += \ SOURCES += \
main.c \ main.c \
mms_engine.c mms_engine.c
......
...@@ -17,11 +17,18 @@ ...@@ -17,11 +17,18 @@
#include "mms_dispatcher.h" #include "mms_dispatcher.h"
#include "mms_settings.h" #include "mms_settings.h"
#include "mms_lib_util.h" #include "mms_lib_util.h"
#include "mms_connman_ofono.h"
#include "mms_handler_dbus.h" #include "mms_handler_dbus.h"
#include "mms_settings_dconf.h" #include "mms_settings_dconf.h"
#include "mms_log.h" #include "mms_log.h"
#ifdef MMS_CONNMAN_NEMO
# include "mms_connman_nemo.h"
# define mms_connman_new() mms_connman_nemo_new()
#else
# include "mms_connman_ofono.h"
# define mms_connman_new() mms_connman_ofono_new()
#endif
/* Generated code */ /* Generated code */
#include "org.nemomobile.MmsEngine.h" #include "org.nemomobile.MmsEngine.h"
...@@ -452,7 +459,7 @@ mms_engine_new( ...@@ -452,7 +459,7 @@ mms_engine_new(
MMSLogModule* log_modules[], MMSLogModule* log_modules[],
int log_count) int log_count)
{ {
MMSConnMan* cm = mms_connman_ofono_new(); MMSConnMan* cm = mms_connman_new();
if (cm) { if (cm) {
MMSEngine* mms = g_object_new(MMS_TYPE_ENGINE, NULL); MMSEngine* mms = g_object_new(MMS_TYPE_ENGINE, NULL);
MMSHandler* handler = mms_handler_dbus_new(); MMSHandler* handler = mms_handler_dbus_new();
......
/* /*
* Copyright (C) 2013-2014 Jolla Ltd. * Copyright (C) 2013-2016 Jolla Ltd.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
/* Instance */ /* Instance */
struct mms_connman { struct mms_connman {
GObject object; GObject object;
int busy;
}; };
/* Class */ /* Class */
...@@ -33,6 +34,12 @@ typedef struct mms_connman_class { ...@@ -33,6 +34,12 @@ typedef struct mms_connman_class {
GType mms_connman_get_type(void); GType mms_connman_get_type(void);
#define MMS_TYPE_CONNMAN (mms_connman_get_type()) #define MMS_TYPE_CONNMAN (mms_connman_get_type())
/* Connman event callback */
typedef void
(*mms_connman_event_fn)(
MMSConnMan* cm,
void* param);
/* Reference counting */ /* Reference counting */
MMSConnMan* MMSConnMan*
mms_connman_ref( mms_connman_ref(
...@@ -60,6 +67,29 @@ mms_connman_open_connection( ...@@ -60,6 +67,29 @@ mms_connman_open_connection(
const char* imsi, const char* imsi,
gboolean user_request); gboolean user_request);
/**
* While busy flags is on, mms-engine shouldn't exit
*/
void
mms_connman_busy_update(
MMSConnMan* cm,
int change);
gulong
mms_connman_add_done_callback(
MMSConnMan* cm,
mms_connman_event_fn fn,
void* param);
void
mms_connman_remove_callback(
MMSConnMan* cm,
gulong handler_id);
#define mms_connman_busy(cm) ((cm) && ((cm)->busy > 0))
#define mms_connman_busy_inc(cm) mms_connman_busy_update(cm,1)
#define mms_connman_busy_dec(cm) mms_connman_busy_update(cm,-1)
#endif /* JOLLA_MMS_CONNMAN_H */ #endif /* JOLLA_MMS_CONNMAN_H */
/* /*
......
#CONFIG += ResizeImageMagick #CONFIG += ResizeImageMagick
CONFIG += ResizeQt CONFIG += ResizeQt
#CONFIG += ConnManNemo
/* /*
* Copyright (C) 2013-2014 Jolla Ltd. * Copyright (C) 2013-2016 Jolla Ltd.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
...@@ -14,12 +14,25 @@ ...@@ -14,12 +14,25 @@
#include "mms_connman.h" #include "mms_connman.h"
/* Logging */
#define MMS_LOG_MODULE_NAME mms_connman_log
#include "mms_lib_log.h"
G_DEFINE_TYPE(MMSConnMan, mms_connman, G_TYPE_OBJECT); G_DEFINE_TYPE(MMSConnMan, mms_connman, G_TYPE_OBJECT);
#define MMS_CONNMAN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),\ #define MMS_CONNMAN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),\
MMS_TYPE_CONNMAN, MMSConnMan)) MMS_TYPE_CONNMAN, MMSConnMan))
#define MMS_CONNMAN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), \ #define MMS_CONNMAN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), \
MMS_TYPE_CONNMAN, MMSConnManClass)) MMS_TYPE_CONNMAN, MMSConnManClass))
enum {
MMS_CONNMAN_SIGNAL_DONE,
MMS_CONNMAN_SIGNAL_COUNT
};
#define MMS_CONNMAN_SIGNAL_DONE_NAME "connman-done"
static guint mms_connman_sig[MMS_CONNMAN_SIGNAL_COUNT] = { 0 };
MMSConnMan* MMSConnMan*
mms_connman_ref( mms_connman_ref(
MMSConnMan* cm) MMSConnMan* cm)
...@@ -35,6 +48,36 @@ mms_connman_unref( ...@@ -35,6 +48,36 @@ mms_connman_unref(
if (cm) g_object_unref(MMS_CONNMAN(cm)); if (cm) g_object_unref(MMS_CONNMAN(cm));
} }
gulong
mms_connman_add_done_callback(
MMSConnMan* cm,
mms_connman_event_fn fn,
void* param)
{
if (cm && fn) {
return g_signal_connect_data(cm, MMS_CONNMAN_SIGNAL_DONE_NAME,