3 * oFono - Open Source Telephony
5 * Copyright (C) 2008-2010 Intel Corporation. All rights reserved.
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
22 #ifndef __OFONO_NETREG_H
23 #define __OFONO_NETREG_H
29 #include <ofono/types.h>
33 /* Theoretical limit is 16, but each GSM char can be encoded into
34 * * 3 UTF8 characters resulting in 16*3=48 chars
36 #define OFONO_MAX_OPERATOR_NAME_LENGTH 63
38 struct ofono_network_operator {
39 char name[OFONO_MAX_OPERATOR_NAME_LENGTH + 1];
40 char mcc[OFONO_MAX_MCC_LENGTH + 1];
41 char mnc[OFONO_MAX_MNC_LENGTH + 1];
46 typedef void (*ofono_netreg_operator_cb_t)(const struct ofono_error *error,
47 const struct ofono_network_operator *op,
50 typedef void (*ofono_netreg_register_cb_t)(const struct ofono_error *error,
53 typedef void (*ofono_netreg_operator_list_cb_t)(const struct ofono_error *error,
55 const struct ofono_network_operator *list,
58 typedef void (*ofono_netreg_status_cb_t)(const struct ofono_error *error,
59 int status, int lac, int ci, int tech,
62 typedef void (*ofono_netreg_strength_cb_t)(const struct ofono_error *error,
63 int strength, void *data);
65 /* Network related functions, including registration status, operator selection
66 * and signal strength indicators.
68 * It is up to the plugin to implement CSQ polling if the modem does not support
69 * vendor extensions for signal strength notification.
71 struct ofono_netreg_driver {
73 int (*probe)(struct ofono_netreg *netreg, unsigned int vendor,
75 void (*remove)(struct ofono_netreg *netreg);
76 void (*registration_status)(struct ofono_netreg *netreg,
77 ofono_netreg_status_cb_t cb, void *data);
78 void (*current_operator)(struct ofono_netreg *netreg,
79 ofono_netreg_operator_cb_t cb, void *data);
80 void (*list_operators)(struct ofono_netreg *netreg,
81 ofono_netreg_operator_list_cb_t cb, void *data);
82 void (*register_auto)(struct ofono_netreg *netreg,
83 ofono_netreg_register_cb_t cb, void *data);
84 void (*register_manual)(struct ofono_netreg *netreg,
85 const char *mcc, const char *mnc,
86 ofono_netreg_register_cb_t cb, void *data);
87 void (*deregister)(struct ofono_netreg *netreg,
88 ofono_netreg_register_cb_t cb, void *data);
89 void (*strength)(struct ofono_netreg *netreg,
90 ofono_netreg_strength_cb_t, void *data);
93 void ofono_netreg_strength_notify(struct ofono_netreg *netreg, int strength);
94 void ofono_netreg_status_notify(struct ofono_netreg *netreg, int status,
95 int lac, int ci, int tech);
96 void ofono_netreg_time_notify(struct ofono_netreg *netreg,
97 struct ofono_network_time *info);
99 int ofono_netreg_driver_register(const struct ofono_netreg_driver *d);
100 void ofono_netreg_driver_unregister(const struct ofono_netreg_driver *d);
102 struct ofono_netreg *ofono_netreg_create(struct ofono_modem *modem,
107 void ofono_netreg_register(struct ofono_netreg *netreg);
108 void ofono_netreg_remove(struct ofono_netreg *netreg);
110 void ofono_netreg_set_data(struct ofono_netreg *netreg, void *data);
111 void *ofono_netreg_get_data(struct ofono_netreg *netreg);
113 int ofono_netreg_get_location(struct ofono_netreg *netreg);
114 int ofono_netreg_get_cellid(struct ofono_netreg *netreg);
115 int ofono_netreg_get_status(struct ofono_netreg *netreg);
116 int ofono_netreg_get_technology(struct ofono_netreg *netreg);
117 const char *ofono_netreg_get_mcc(struct ofono_netreg *netreg);
118 const char *ofono_netreg_get_mnc(struct ofono_netreg *netreg);
124 #endif /* __OFONO_NETREG_H */