From: Jessica Nilsson
---
drivers/isimodem/call-forwarding.c |1 -
drivers/isimodem/ssn.c | 406 +++-
2 files changed, 401 insertions(+), 6 deletions(-)
diff --git a/drivers/isimodem/call-forwarding.c
b/drivers/isimodem/call-forwarding.c
index 687f975..05b304f 100644
--- a/drivers/isimodem/call-forwarding.c
+++ b/drivers/isimodem/call-forwarding.c
@@ -467,7 +467,6 @@ static int isi_call_forwarding_probe(struct
ofono_call_forwarding *cf,
return -ENOMEM;
fd->client = g_isi_client_create(modem, PN_SS);
-
if (fd->client == NULL) {
g_free(fd);
return -ENOMEM;
diff --git a/drivers/isimodem/ssn.c b/drivers/isimodem/ssn.c
index 068e5e8..225e5e0 100644
--- a/drivers/isimodem/ssn.c
+++ b/drivers/isimodem/ssn.c
@@ -3,6 +3,7 @@
* oFono - Open Source Telephony
*
* Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+ * Copyright (C) ST-Ericsson SA 2011.
*
* 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
@@ -32,20 +33,403 @@
#include
#include
+#include
#include
#include
#include
+#include "call.h"
#include "isimodem.h"
#include "ss.h"
+#include "isiutil.h"
+#include "debug.h"
+
+#define NOT_3GGP_NOTIFICATION -1
+#define PN_SS 0x06
+
+/* 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,
+};
struct ssn_data {
GIsiClient *client;
+ GIsiClient *primary;
+ GIsiClient *secondary;
+};
+
+struct isi_ssn_prop {
+ char number[OFONO_MAX_PHONE_NUMBER_LENGTH + 1];
+ int type;
+ uint16_t cug_index;
+};
+
+struct isi_ssn {
+ GIsiClient *client;
+ struct isi_call_req_context *queue;
};
+static void isi_cm_sb_rem_address_sb_proc(struct isi_ssn_prop *ssn_prop,
+ GIsiSubBlockIter const *sb)
+{
+ uint8_t addr_type, addr_len;
+ char *address;
+ DBG("CALL_SB_REMOTE_ADDRESS");
+
+ if (!g_isi_sb_iter_get_byte(sb, &addr_type, 2) ||
+ /* address type */
+ /* presentation indicator */
+ /* fillerbyte */
+ !g_isi_sb_iter_get_byte(sb, &addr_len, 5) ||
+ !g_isi_sb_iter_get_alpha_tag(sb, &address, 2 *
+ addr_len, 6))
+ return;
+
+ strncpy(ssn_prop->number, address, addr_len);
+
+ g_free(address);
+}
+
+static void isi_ssn_notify_ofono(void *_ssn, int cssi, int cssu,
+ struct isi_ssn_prop *ssn_prop)
+{
+ struct ofono_phone_number *phone_nr =
+ (struct ofono_phone_number *) ssn_prop;
+
+ if (cssi != NOT_3GGP_NOTIFICATION)
+ ofono_ssn_cssi_notify(_ssn, cssi, ssn_prop->cug_index);
+
+ if (cssu != NOT_3GGP_NOTIFICATION)
+ ofono_ssn_cssu_notify(_ssn, cssi, ssn_prop->cug_index,
+ phone_nr);
+}
+
+static void isi_ssn_call_modem_sb_notify(GIsiSubBlockIter const *sb)
+{
+ uint8_t sb_property;
+ g_isi_sb_iter_get_byte(sb, &sb_property, 2);
+
+ if (sb_property == CALL_NOTIFY_USER_SUSPENDED)
+ DBG("CALL_NOTIFY_USER_SUSPENDED");
+
+ if (sb_property == CALL_NOTIFY_USER_RESUMED)
+ DBG("CALL_NOTIFY_USER_RESUMED");
+
+ if (sb_property == CALL_NOTIFY_BEARER_CHANGE)
+ DBG("CALL_NOTIFY_BEARER_CHANGE");
+}
+
+static void isi_ssn_call_modem_sb_ss_code(GIsiSubBlockIter const *sb,
+ int *cssi_p, int *cssu_p)
+{
+ uint16_t sb_property;
+ g_isi_sb_iter_get_word(sb, &sb_property, 2);
+
+ switch (sb_property) {
+ case(CALL_SSC_ALL_FWDS):
+ DBG("Call forwarding is active");
+ break;
+ case(CALL_SSC_ALL_COND_FWD): {
+ *(cssi_p) = SS_MO_CONDITIONAL_FORWARDING;
+ DBG("Some of co