Commit Graph

33 Commits

Author SHA1 Message Date
Alexander Couzens 528f4838fa common,atmodem: rename & move at_util_call_compare_by_status to common.c
at_util_call_compare_by_status is used by several modem drivers.
2020-10-15 17:33:47 +02:00
Alexander Couzens d03af77d94 common: create GList helper ofono_call_compare
replaces at_util_call_compare (atmodem) and
call_compare (rild).
2019-12-17 15:57:51 +01:00
Denis Kenzior 630e48465c atutil: Introduce at_util_open_device 2019-05-31 11:58:36 -05:00
Antara Borwankar 413e6ecab0 xmm7modem: handling of IPv6 address for activated context
Handled IPv6 address after activating PDP context.
Received IPv6 address is of format addr + netmask in the same string
in the form of "a1.a2.a3.a4.a5.a6.a7.a8.a9.a10.a11.a12.a13.a14.a15.a16.
m1.m2.m3.m4.m5.m6.m7.m8.m9.m10.m11.m12.m13.m14.m15.m16"
2019-04-29 11:33:58 -05:00
Giacinto Cifelli eed785a4d7 atmodem: Add reference counting to cb_data
the cb_data can be used by creating the structure with cb_data_new,
and then there are two possibilities:
- use it in a single callback function, and destroy it with a call to
  g_free.
  Example:
  - calling function:
    struct cb_data *cbd = cb_data_new(cb, data);
    if (g_at_chat_send(chat, buf, NULL, at_cgatt_cb, cbd, g_free) > 0)
	return;
    g_free(cbd);
  - called function (here at_cgatt_cb):
	static void at_cgatt_cb(gboolean ok, GAtResult *result,
						gpointer user_data)
	{
		struct cb_data *cbd = user_data;
		ofono_gprs_cb_t cb = cbd->cb;
		struct ofono_error error;

		decode_at_error(&error,
				g_at_result_final_response(result));

		cb(&error, cbd->data);
	}
    note the absence of explicit g_free(cbd);

- pass it through a train of callback functions, adding a reference at
  each pass cb_data_ref, and removing it with cb_data_unref.
  the use of cb_data_ref would replace a new object creation, while the
  use of cb_data_unref the use of g_free.
  Example:
  - calling function:
	struct cb_data *cbd = cb_data_new(cb, data);
	// no cb_ref at the creation
	if (g_at_chat_send(chat, buf, NULL,
				at_lte_set_default_attach_info_cb,
				cbd, cb_data_unref) > 0)
		goto end;
	cb_data_unref(cbd);
  - called function 1 (at_lte_set_default_attach_info_cb):
	static void at_lte_set_default_attach_info_cb(gboolean ok,
				GAtResult *result, gpointer user_data)
	{
		struct cb_data *cbd = user_data;

		cbd = cb_data_ref(cbd);
		if (g_at_chat_send(chat, buf, NULL,
				at_cgatt_cb, cbd, cb_data_unref) > 0)
			return;
		cb_data_unref(cbd);
	}
  - called function 2 (at_cgatt_cb):
    like above. no call to g_free or cb_data_unref. The terminal function
    doesn't need to know about the reference scheme.
2018-10-25 10:55:09 -05:00
Giacinto Cifelli 0d9a380ea0 atmodem: Add at_util_get_cgdcont_command
The function at_util_get_cgdcont_command computes the AT+CGDCONT
string, as per 3GPP 27.007.
It uses a second function, at_util_gprs_proto_to_pdp_type,
that returns the pdp_type string for the command
2018-10-22 15:05:38 -05:00
Giacinto Cifelli 0208c10e9b atmodem: Add at_util_gprs_auth_method_to_auth_proto
This function converts the ofono enum ofono_gprs_auth_method
into the value of the 3GPP 27.007 'auth_proto' variable of +CGAUTH so
that it can be passed directly to the AT command.
2018-10-22 15:01:51 -05:00
Ankit Navik aadd4668f1 atutil: Add logic for cgcontrdp to get address and netmask 2017-09-13 10:26:35 -05:00
Denis Kenzior 0026ae3fb7 atmodem: Update parse_clcc utility function 2013-09-12 13:17:39 -05:00
Daniel Wagner 79453f3284 atutil: Remove unused macro
With commit 6ee21a3fc1
the usage DECLARE_FAILURE was removed.
2012-12-17 09:50:22 -06:00
Guillaume Zajac fb92db81d4 atutil: Add destroy notify to sim_state_query 2012-04-18 04:06:43 -05:00
Syam Sidhardhan 5e06f070aa atutil: Fix newline before EOF 2012-01-01 18:17:36 -06:00
Marcel Holtmann 4e77afffb3 drivers: Update copyright information 2011-10-10 13:39:48 -07:00
Denis Kenzior 380c95ddcb atmodem: Implement generic CPIN polling 2011-07-22 08:22:52 -05:00
Jeevaka Badrappan ac20890cc9 atutil: use g_new0 for callback data memory 2011-01-29 18:39:37 +01:00
Denis Kenzior febb9014ca atutil: Break out attribute parser into atutil 2011-01-12 23:53:38 -06:00
Lucas De Marchi b82a7f8511 drivers: explicitly compare pointers to NULL
This patch was generated by the following semantic patch
(http://coccinelle.lip6.fr/)

// <smpl>
@fix disable is_null,isnt_null1@
expression *E;
@@

- !E
+ E == NULL
// </smpl>
2010-11-29 11:37:09 -06:00
Jeevaka Badrappan a632cfe11b atutil: Add parsing of CSCS queries 2010-09-10 12:00:43 -05:00
Denis Kenzior 1b36d1cd43 atmodem: Add utility for parsing CMTI/CDSI/CBMI 2010-06-10 20:06:26 -05:00
Kalle Valo bf5b31e8a8 Move report_signal_strength to atutil
The function is needed in two different places, better to move it
to atutil.h.
2010-05-19 23:08:36 -05:00
Denis Kenzior c98b951fe6 Refactor: Remove atutil dump_response
No longer needed now that we have nice AT command tracing using
OFONO_AT_DEBUG=1
2010-02-08 12:28:23 -06:00
Sjur Brændeland c664f80f22 Add at_util_call_compare_by_id function 2010-01-25 20:53:57 +01:00
Jussi Kukkonen ebe8904f39 Add quirk for cid and lac handling for Huawei 2010-01-20 10:09:54 -06:00
Marcel Holtmann 144080e749 Update copyright information 2010-01-01 17:00:10 -08:00
Denis Kenzior 66d1e90814 Add utilities to parse CREG/CGREG
These are nearly identical and can be shared between gprs/netreg
2009-12-09 12:49:43 -06:00
Denis Kenzior 341c631cd1 Remove: at_util callid APIs are no longer necessary 2009-12-04 16:52:31 -06:00
Denis Kenzior efd34778d1 Add CALLBACK_WITH_SUCCESS 2009-11-18 18:07:11 -06:00
Zhenhua Zhang 20e9ff8551 Add parse_clcc into atutil.c
So that it could be shared by atmodem and hfpmodem.
2009-11-12 11:22:31 -06:00
Zhenhua Zhang 372edf4f21 Add call_compare_by_phone_number utility function
This utility will be used by HFP voicecall driver to compare
two calls. In some hardware, the call index may be shift when
a call transitions from waiting to incoming state (e.g. all other
held and active calls are released)
2009-11-11 16:24:54 -06:00
Zhenhua Zhang 57aaf9813f Refactor: Move alloc/release id to atutil.c 2009-10-28 17:31:44 -05:00
Zhenhua Zhang 17903940c5 Refactor: Move & Rename functions to atutil.c
Move and rename call_compare and call_compare_by_status to atutil.c.
These will be utilized by other drivers, including hfpmodem.
2009-10-28 17:30:02 -05:00
Denis Kenzior cbb36acee8 Rework DECLARE_FAILURE to be a bit nicer 2009-09-11 12:39:56 -05:00
Denis Kenzior 5749b6e75d Break common at utilities to atutils.c/.h 2009-09-04 20:37:49 -05:00