3
* oFono - Open Source Telephony
5
* Copyright (C) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License version 2 as
9
* published by the Free Software Foundation.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29
#define OFONO_API_SUBJECT_TO_CHANGE
30
#include <ofono/plugin.h>
31
#include <ofono/log.h>
32
#include <ofono/nettime.h>
33
#include <ofono/types.h>
37
static int example_nettime_probe(struct ofono_nettime_context *context)
39
ofono_debug("Example Network Time Probe for modem: %p",
44
static void example_nettime_remove(struct ofono_nettime_context *context)
46
ofono_debug("Example Network Time Remove for modem: %p",
50
static void example_nettime_info_received(struct ofono_nettime_context *context,
51
struct ofono_network_time *info)
56
ofono_debug("Received a network time notification on modem: %p",
58
ofono_debug("Time: %04d-%02d-%02d %02d:%02d:%02d%c%02d:%02d (DST=%d)",
59
info->year, info->mon, info->mday, info->hour,
60
info->min, info->sec, info->utcoff > 0 ? '+' : '-',
61
info->utcoff / 3600, (info->utcoff % 3600) / 60,
65
static struct ofono_nettime_driver example_driver = {
66
.name = "Example Network Time",
67
.probe = example_nettime_probe,
68
.remove = example_nettime_remove,
69
.info_received = example_nettime_info_received,
72
static int example_nettime_init(void)
74
return ofono_nettime_driver_register(&example_driver);
77
static void example_nettime_exit(void)
79
ofono_nettime_driver_unregister(&example_driver);
82
OFONO_PLUGIN_DEFINE(example_nettime, "Example Network Time Plugin",
83
VERSION, OFONO_PLUGIN_PRIORITY_DEFAULT,
84
example_nettime_init, example_nettime_exit)