2009-08-24 12:47:17 +00:00
|
|
|
/*
|
|
|
|
*
|
2010-10-14 07:50:08 +00:00
|
|
|
* oFono - Open Source Telephony
|
2009-08-24 12:47:17 +00:00
|
|
|
*
|
2010-10-14 07:50:08 +00:00
|
|
|
* Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
|
2009-08-24 12:47:17 +00:00
|
|
|
*
|
2010-10-14 07:50:08 +00:00
|
|
|
* 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.
|
2009-08-24 12:47:17 +00:00
|
|
|
*
|
2010-10-14 07:50:08 +00:00
|
|
|
* 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.
|
2009-08-24 12:47:17 +00:00
|
|
|
*
|
2010-10-14 07:50:08 +00:00
|
|
|
* 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
|
2009-08-24 12:47:17 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include <config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define _GNU_SOURCE
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
|
|
|
#include <gisi/client.h>
|
|
|
|
|
|
|
|
#include <ofono/log.h>
|
|
|
|
#include <ofono/modem.h>
|
|
|
|
#include <ofono/ssn.h>
|
|
|
|
|
2010-01-08 08:57:01 +00:00
|
|
|
#include "isimodem.h"
|
2010-11-18 12:11:30 +00:00
|
|
|
#include "ss.h"
|
2009-08-24 12:47:17 +00:00
|
|
|
|
|
|
|
struct ssn_data {
|
|
|
|
GIsiClient *client;
|
|
|
|
};
|
|
|
|
|
2009-09-02 02:39:02 +00:00
|
|
|
static int isi_ssn_probe(struct ofono_ssn *ssn, unsigned int vendor,
|
|
|
|
void *user)
|
2009-08-24 12:47:17 +00:00
|
|
|
{
|
2010-11-18 12:11:30 +00:00
|
|
|
GIsiModem *modem = user;
|
|
|
|
struct ssn_data *sd;
|
2009-08-24 12:47:17 +00:00
|
|
|
|
2010-11-18 12:11:30 +00:00
|
|
|
sd = g_try_new0(struct ssn_data, 1);
|
|
|
|
if (sd == NULL)
|
2009-08-24 12:47:17 +00:00
|
|
|
return -ENOMEM;
|
|
|
|
|
2010-11-18 12:11:30 +00:00
|
|
|
sd->client = g_isi_client_create(modem, PN_SS);
|
|
|
|
if (sd->client == NULL) {
|
|
|
|
g_free(sd);
|
2009-08-24 12:47:17 +00:00
|
|
|
return -ENOMEM;
|
2010-11-18 12:11:30 +00:00
|
|
|
}
|
2009-08-24 12:47:17 +00:00
|
|
|
|
2010-11-18 12:11:30 +00:00
|
|
|
ofono_ssn_set_data(ssn, sd);
|
2009-08-24 12:47:17 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-09-02 03:27:08 +00:00
|
|
|
static void isi_ssn_remove(struct ofono_ssn *ssn)
|
2009-08-24 12:47:17 +00:00
|
|
|
{
|
|
|
|
struct ssn_data *data = ofono_ssn_get_data(ssn);
|
|
|
|
|
2010-11-18 12:11:30 +00:00
|
|
|
ofono_ssn_set_data(ssn, NULL);
|
|
|
|
|
2010-11-27 19:38:56 +00:00
|
|
|
if (data == NULL)
|
2010-10-19 08:28:06 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
g_isi_client_destroy(data->client);
|
|
|
|
g_free(data);
|
2009-08-24 12:47:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct ofono_ssn_driver driver = {
|
2009-09-02 03:35:14 +00:00
|
|
|
.name = "isimodem",
|
2009-08-24 12:47:17 +00:00
|
|
|
.probe = isi_ssn_probe,
|
|
|
|
.remove = isi_ssn_remove
|
|
|
|
};
|
|
|
|
|
|
|
|
void isi_ssn_init()
|
|
|
|
{
|
|
|
|
ofono_ssn_driver_register(&driver);
|
|
|
|
}
|
|
|
|
|
|
|
|
void isi_ssn_exit()
|
|
|
|
{
|
|
|
|
ofono_ssn_driver_unregister(&driver);
|
|
|
|
}
|