mirror of git://git.sysmocom.de/ofono
Add an API for a CSSI/CSSU notifications.
This commit is contained in:
parent
8d628ef7f4
commit
e63c82e648
|
@ -12,7 +12,7 @@ ofonod_SOURCES = main.c ofono.h log.c plugin.c \
|
|||
manager.c dbus-gsm.h dbus-gsm.c util.h util.c \
|
||||
network.c voicecall.c ussd.h ussd.c \
|
||||
call-settings.c call-waiting.c call-forwarding.c call-meter.c \
|
||||
smsutil.h smsutil.c
|
||||
smsutil.h smsutil.c cssn.c
|
||||
|
||||
ofonod_LDADD = $(top_builddir)/plugins/libbuiltin.la \
|
||||
$(top_builddir)/drivers/libbuiltin.la \
|
||||
|
|
26
src/common.h
26
src/common.h
|
@ -142,6 +142,32 @@ enum ss_control_type {
|
|||
SS_CONTROL_TYPE_ERASURE,
|
||||
};
|
||||
|
||||
/* TS 27.007 Supplementary service notifications +CSSN */
|
||||
enum ss_cssi {
|
||||
SS_MO_UNCONDITIONAL_FORWARDING = 0,
|
||||
SS_MO_CONDITIONAL_FORWARDING = 1,
|
||||
SS_MO_CALL_FORWARDED = 2,
|
||||
SS_MO_CALL_WAITING = 3,
|
||||
SS_MO_CUG_CALL = 4,
|
||||
SS_MO_OUTGOING_BARRING = 5,
|
||||
SS_MO_INCOMING_BARRING = 6,
|
||||
SS_MO_CLIR_SUPPRESSION_REJECTED = 7,
|
||||
SS_MO_CALL_DEFLECTED = 8,
|
||||
};
|
||||
|
||||
enum ss_cssu {
|
||||
SS_MT_CALL_FORWARDED = 0,
|
||||
SS_MT_CUG_CALL = 1,
|
||||
SS_MT_VOICECALL_ON_HOLD = 2,
|
||||
SS_MT_VOICECALL_RETRIEVED = 3,
|
||||
SS_MT_MULTIPARTY_VOICECALL = 4,
|
||||
SS_MT_VOICECALL_HOLD_RELEASED = 5,
|
||||
SS_MT_FORWARD_CHECK_SS_MESSAGE = 6,
|
||||
SS_MT_VOICECALL_IN_TRANSFER = 7,
|
||||
SS_MT_VOICECALL_TRANSFERRED = 8,
|
||||
SS_MT_CALL_DEFLECTED = 9,
|
||||
};
|
||||
|
||||
const char *telephony_error_to_str(const struct ofono_error *error);
|
||||
|
||||
gboolean valid_phone_number_format(const char *number);
|
||||
|
|
|
@ -0,0 +1,176 @@
|
|||
/*
|
||||
*
|
||||
* oFono - Open Source Telephony
|
||||
*
|
||||
* Copyright (C) 2008-2009 Intel Corporation. All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include "ofono.h"
|
||||
|
||||
#include "driver.h"
|
||||
#include "log.h"
|
||||
#include "modem.h"
|
||||
#include "common.h"
|
||||
#include "cssn.h"
|
||||
|
||||
struct cssn_data {
|
||||
GSList *mo_handler_list;
|
||||
GSList *mt_handler_list;
|
||||
};
|
||||
|
||||
struct mo_handler {
|
||||
enum ss_cssi code1;
|
||||
mo_ss_notify_cb cb;
|
||||
void *cb_data;
|
||||
};
|
||||
|
||||
struct mt_handler {
|
||||
enum ss_cssu code2;
|
||||
mt_ss_notify_cb cb;
|
||||
void *cb_data;
|
||||
};
|
||||
|
||||
static gint ss_handler_compare(gconstpointer a, gconstpointer b)
|
||||
{
|
||||
return memcmp(a, b, sizeof(struct mo_handler));
|
||||
}
|
||||
|
||||
void ofono_mo_ss_register(struct ofono_modem *modem, int code1,
|
||||
mo_ss_notify_cb cb, void *userdata)
|
||||
{
|
||||
struct cssn_data *ss = modem->cssn;
|
||||
struct mo_handler *handler = g_try_new0(struct mo_handler, 1);
|
||||
|
||||
handler->code1 = code1;
|
||||
handler->cb = cb;
|
||||
handler->cb_data = userdata;
|
||||
|
||||
ss->mo_handler_list = g_slist_prepend(ss->mo_handler_list, handler);
|
||||
}
|
||||
|
||||
void ofono_mo_ss_unregister(struct ofono_modem *modem, int code1,
|
||||
mo_ss_notify_cb cb, void *userdata)
|
||||
{
|
||||
struct cssn_data *ss = modem->cssn;
|
||||
struct mo_handler val = { code1, cb, userdata };
|
||||
GSList *l = g_slist_find_custom(ss->mo_handler_list, &val,
|
||||
ss_handler_compare);
|
||||
|
||||
if (!l) {
|
||||
ofono_error("An unregistered handler passed to "
|
||||
"ofono_mo_ss_unregister");
|
||||
return;
|
||||
}
|
||||
|
||||
g_free(l->data);
|
||||
ss->mo_handler_list = g_slist_delete_link(ss->mo_handler_list, l);
|
||||
}
|
||||
|
||||
void ofono_mt_ss_register(struct ofono_modem *modem, int code2,
|
||||
mt_ss_notify_cb cb, void *userdata)
|
||||
{
|
||||
struct cssn_data *ss = modem->cssn;
|
||||
struct mt_handler *handler = g_try_new0(struct mt_handler, 1);
|
||||
|
||||
handler->code2 = code2;
|
||||
handler->cb = cb;
|
||||
handler->cb_data = userdata;
|
||||
|
||||
ss->mt_handler_list = g_slist_prepend(ss->mt_handler_list, handler);
|
||||
}
|
||||
|
||||
void ofono_mt_ss_unregister(struct ofono_modem *modem, int code2,
|
||||
mt_ss_notify_cb cb, void *userdata)
|
||||
{
|
||||
struct cssn_data *ss = modem->cssn;
|
||||
struct mt_handler val = { code2, cb, userdata };
|
||||
GSList *l = g_slist_find_custom(ss->mt_handler_list, &val,
|
||||
ss_handler_compare);
|
||||
|
||||
if (!l) {
|
||||
ofono_error("An unregistered handler passed to "
|
||||
"ofono_mt_ss_unregister");
|
||||
return;
|
||||
}
|
||||
|
||||
g_free(l->data);
|
||||
ss->mt_handler_list = g_slist_delete_link(ss->mt_handler_list, l);
|
||||
}
|
||||
|
||||
void ofono_cssn_init(struct ofono_modem *modem)
|
||||
{
|
||||
struct cssn_data *ss = g_try_new0(struct cssn_data, 1);
|
||||
|
||||
modem->cssn = ss;
|
||||
}
|
||||
|
||||
static void cssn_free_handlers(GSList *l)
|
||||
{
|
||||
GSList *iter;
|
||||
|
||||
for (iter = l; iter; iter = iter->next)
|
||||
g_free(iter->data);
|
||||
g_slist_free(l);
|
||||
}
|
||||
|
||||
void ofono_cssn_exit(struct ofono_modem *modem)
|
||||
{
|
||||
if (!modem->cssn)
|
||||
return;
|
||||
|
||||
cssn_free_handlers(modem->cssn->mo_handler_list);
|
||||
cssn_free_handlers(modem->cssn->mt_handler_list);
|
||||
g_free(modem->cssn);
|
||||
|
||||
modem->cssn = NULL;
|
||||
}
|
||||
|
||||
void ofono_cssi_notify(struct ofono_modem *modem, int code1, int index)
|
||||
{
|
||||
struct cssn_data *ss = modem->cssn;
|
||||
struct mo_handler *h;
|
||||
GSList *l;
|
||||
|
||||
for (l = ss->mo_handler_list; l; l = l->next) {
|
||||
h = l->data;
|
||||
if (h->code1 == (enum ss_cssi) code1)
|
||||
h->cb(index, h->cb_data);
|
||||
}
|
||||
}
|
||||
|
||||
void ofono_cssu_notify(struct ofono_modem *modem, int code2, int index,
|
||||
const char *number, int number_type)
|
||||
{
|
||||
struct cssn_data *ss = modem->cssn;
|
||||
struct mt_handler *h;
|
||||
GSList *l;
|
||||
|
||||
for (l = ss->mt_handler_list; l; l = l->next) {
|
||||
h = l->data;
|
||||
if (h->code2 == (enum ss_cssu) code2)
|
||||
h->cb(index, number, number_type, h->cb_data);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
*
|
||||
* oFono - Open Source Telephony
|
||||
*
|
||||
* Copyright (C) 2008-2009 Intel Corporation. All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __CSSN_H__
|
||||
#define __CSSN_H__
|
||||
|
||||
typedef void (*mo_ss_notify_cb)(int index, void *userdata);
|
||||
typedef void (*mt_ss_notify_cb)(int index, const char *num, int num_type,
|
||||
void *userdata);
|
||||
|
||||
void ofono_cssn_init(struct ofono_modem *modem);
|
||||
void ofono_cssn_exit(struct ofono_modem *modem);
|
||||
void ofono_mo_ss_register(struct ofono_modem *modem, int code1,
|
||||
mo_ss_notify_cb cb, void *userdata);
|
||||
void ofono_mo_ss_unregister(struct ofono_modem *modem, int code1,
|
||||
mo_ss_notify_cb cb, void *userdata);
|
||||
void ofono_mt_ss_register(struct ofono_modem *modem, int code2,
|
||||
mt_ss_notify_cb cb, void *userdata);
|
||||
void ofono_mt_ss_unregister(struct ofono_modem *modem, int code2,
|
||||
mt_ss_notify_cb cb, void *userdata);
|
||||
|
||||
#endif
|
12
src/driver.h
12
src/driver.h
|
@ -198,8 +198,8 @@ int ofono_network_registration_register(struct ofono_modem *modem,
|
|||
struct ofono_network_registration_ops *ops);
|
||||
void ofono_network_registration_unregister(struct ofono_modem *modem);
|
||||
|
||||
/* Voice call related functionality, including ATD, ATA, +CHLD, CTFR, CLCC,
|
||||
* SSN notifications (CSSI and CSSU) and VTS.
|
||||
/* Voice call related functionality, including ATD, ATA, +CHLD, CTFR, CLCC
|
||||
* and VTS.
|
||||
*
|
||||
* It is up to the plugin to implement polling of CLCC if the modem does
|
||||
* not support vendor extensions for call progress indication.
|
||||
|
@ -243,13 +243,15 @@ void ofono_voicecall_notify(struct ofono_modem *modem, const struct ofono_call *
|
|||
void ofono_voicecall_disconnected(struct ofono_modem *modem, int id,
|
||||
enum ofono_disconnect_reason reason,
|
||||
const struct ofono_error *error);
|
||||
void ofono_voicecall_cssi(struct ofono_modem *modem, int code, int index);
|
||||
void ofono_voicecall_cssu(struct ofono_modem *modem, int code, int index,
|
||||
const char *number, int number_type);
|
||||
|
||||
int ofono_voicecall_register(struct ofono_modem *modem, struct ofono_voicecall_ops *ops);
|
||||
void ofono_voicecall_unregister(struct ofono_modem *modem);
|
||||
|
||||
/* SSN notifications (CSSI and CSSU). */
|
||||
void ofono_cssi_notify(struct ofono_modem *modem, int code, int index);
|
||||
void ofono_cssu_notify(struct ofono_modem *modem, int code, int index,
|
||||
const char *number, int number_type);
|
||||
|
||||
struct ofono_call_forwarding_ops {
|
||||
void (*activation)(struct ofono_modem *modem, int type, int cls,
|
||||
ofono_generic_cb_t cb, void *data);
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "dbus-gsm.h"
|
||||
#include "modem.h"
|
||||
#include "driver.h"
|
||||
#include "cssn.h"
|
||||
|
||||
#define MODEM_INTERFACE "org.ofono.Modem"
|
||||
|
||||
|
@ -411,6 +412,8 @@ struct ofono_modem *modem_create(int id, struct ofono_modem_attribute_ops *ops)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
ofono_cssn_init(modem);
|
||||
|
||||
modem->modem_info->flags |= MODEM_FLAG_INITIALIZING_ATTRS;
|
||||
g_timeout_add(ATTRIBUTE_QUERY_DELAY, query_manufacturer, modem);
|
||||
|
||||
|
@ -425,6 +428,8 @@ void modem_remove(struct ofono_modem *modem)
|
|||
|
||||
ofono_debug("Removing modem: %s", modem->path);
|
||||
|
||||
ofono_cssn_exit(modem);
|
||||
|
||||
g_dbus_unregister_interface(conn, path, MODEM_INTERFACE);
|
||||
|
||||
g_free(path);
|
||||
|
|
|
@ -37,6 +37,7 @@ struct ofono_modem {
|
|||
struct call_settings_data *call_settings;
|
||||
struct call_waiting_data *call_waiting;
|
||||
struct call_meter_data *call_meter;
|
||||
struct cssn_data *cssn;
|
||||
};
|
||||
|
||||
struct ofono_modem *modem_create(int id, struct ofono_modem_attribute_ops *ops);
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "common.h"
|
||||
#include "dbus-gsm.h"
|
||||
#include "modem.h"
|
||||
#include "cssn.h"
|
||||
|
||||
#define VOICECALL_MANAGER_INTERFACE "org.ofono.VoiceCallManager"
|
||||
#define VOICECALL_INTERFACE "org.ofono.VoiceCall"
|
||||
|
@ -1301,17 +1302,6 @@ err:
|
|||
g_free(v);
|
||||
}
|
||||
|
||||
void ofono_voicecall_cssi(struct ofono_modem *modem, int code, int index)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ofono_voicecall_cssu(struct ofono_modem *modem, int code, int index,
|
||||
const char *number, int number_type)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void generic_callback(const struct ofono_error *error, void *data)
|
||||
{
|
||||
struct voicecalls_data *calls = data;
|
||||
|
|
Loading…
Reference in New Issue