Compare commits

...

67 Commits

Author SHA1 Message Date
ed3d502783 debug logs 2025-10-21 22:46:36 +08:00
11399e8942 debug logs 2025-10-21 00:21:18 +08:00
1e2c04e0bb debug logs 2025-10-18 14:56:12 +08:00
100d9873c8 debug logs 2025-10-18 14:25:07 +08:00
aeeb20499f debug logs 2025-10-18 12:04:24 +08:00
b8991bde50 debian files 2025-10-17 23:54:18 +08:00
01a7c0fe71 debian files 2025-10-17 22:45:39 +08:00
TheKit
0686f965fb add hack to allow more than 1 active context on MTK
[ratchanan@ubports.com: port the patch to ofono-binder-plugin]

Origin: vendor
Bug-UBports: https://gitlab.com/ubports/development/core/packaging/ofono-binder-plugin/-/issues/1
Forwarded: not-needed
2025-10-17 22:40:36 +08:00
e29eaa45e8 Makefile don't meddle with debian folder 2025-10-17 22:40:24 +08:00
Marius Gripsgard
cd40ce7466 Makefile: allow building against an oFono variant 2025-10-17 22:38:27 +08:00
TheKit
f1bc06ee38 Makefile: do not remove debian/*.install during clean step 2025-10-17 22:38:27 +08:00
Matti Lehtimäki
3aff488691 Version 1.1.21 2025-02-13 15:40:01 +02:00
Matti Lehtimäki
40c9293493 Merge pull request #43 from mer-hybris/jb63132
Fix VoLTE toggling. Fix some memory related and other issues
2025-02-13 15:35:57 +02:00
Matti Lehtimäki
b00ecc5417 [ofono-binder] Fix disabling and enabling VoLTE with toggle. JB#63009 2025-02-12 15:24:34 +02:00
Matti Lehtimäki
7dd348cb90 [ofono-binder] Fix incorrectly emitting binder property signals. JB#63132 2025-02-12 15:24:34 +02:00
Matti Lehtimäki
20f286f2a2 [ofono-binder] Fix null pointer dereference and incorrectly reporting call failure status. JB#63132 2025-02-12 15:24:34 +02:00
Matti Lehtimäki
33f5a70553 [ofono-binder] Fix double free when SMS sending fails. JB#63132
Only affects AIDL interface.
Fix an indentation style issue and reduce the scope of some variables.
2025-02-12 15:24:34 +02:00
Matti Lehtimäki
fadbe2be24 Version 1.1.20 2025-02-01 18:09:05 +02:00
Eugenio Paolantonio (g7)
4e9dc9670c [ofono-binder] util: drop RAF_EHRPD from UMTS and LTE families
EHRPD is only used in CDMA networks. The modem might not expect
it and raise an INVALID_ARGUMENT when using setPreferredNetworkTypeBitmap.

Signed-off-by: Eugenio Paolantonio (g7) <me@medesimo.eu>
2025-02-01 18:07:31 +02:00
Matti Lehtimäki
b1d9cf7c63 Version 1.1.19 2025-01-24 15:53:51 +02:00
Matti Lehtimäki
d9724f63bd Merge pull request #42 from mer-hybris/jb63068
Fix some memory issues in AIDL interface support
2025-01-24 15:52:01 +02:00
Matti Lehtimäki
4f6f4555f4 [ofono-binder] Fix initializing data profile for initial attach APN. JB#63068
Initialization was missing for AIDL interface.
2025-01-24 15:26:12 +02:00
Matti Lehtimäki
fd57dda0ba [ofono-binder] Fix memory allocation size for a string. JB#63068
Used in AIDL interface. Incorrect size caused writing outside of allocated memory.
2025-01-24 15:18:52 +02:00
Slava Monich
0ad76c3528 Version 1.1.18 2024-11-15 15:15:13 +02:00
Slava Monich
6b30a0ec0b [binder-ofono] Tweaked compilation warning binder_sms_on_sim
Replaced this warning in the release build:

src/binder_sms.c:1120:13: warning: unused variable 'ind_code' [-Wunused-variable]
     guint32 ind_code = self->interface_aidl == RADIO_MESSAGING_INTERFACE ?
             ^~~~~~~~

with this one (whichi appears in both release and debug builds):

src/binder_sms.c:1124:18: warning: comparison between 'RADIO_IND' {aka 'enum radio_ind'}
and 'enum radio_messaging_ind' [-Wenum-compare]
             code == RADIO_MESSAGING_IND_NEW_SMS_ON_SIM);
                  ^~

The enum-compare warning is at least useful because it reminds about
different enums being mixed up.
2024-11-15 15:13:17 +02:00
Slava Monich
2cfc88f62b Merge pull request #41 from monich/housekeeping
Fix compilation issues
2024-11-15 14:56:51 +02:00
Slava Monich
8287ee7558 [ofono-binder] Fix compilation issues
src/binder_voicecall.c: In function 'binder_voicecall_list_find_call_with_id':
src/binder_voicecall.c:377:5: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
     for (GSList* l = list; l; l = l->next) {
     ^

src/binder_voicecall.c: In function 'binder_voicecall_merge_call_lists':
src/binder_voicecall.c:403:5: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
     for (GSList* l = self->calls; l; l = l->next) {
     ^

src/binder_voicecall.c: In function 'binder_voicecall_call_state_changed_event':
src/binder_voicecall.c:1386:13: warning: unused variable 'ind_code' [-Wunused-variable]
     guint32 ind_code = self->interface_aidl == RADIO_VOICE_INTERFACE ?
             ^
2024-11-15 05:52:01 +02:00
Slava Monich
da9353ab74 Merge pull request #40 from monich/jb62411-1
Respect sms and voice IMS caps
2024-11-14 18:32:05 +02:00
Slava Monich
aebd7d431a [ofono-binder] Respect sms and voice IMS caps. JB#62411
Check the caps obtained from the IMS plugin in addition to the
registration status.
2024-11-07 03:19:46 +02:00
Matti Lehtimäki
f8eede4395 [ofono-binder] Fix external dial status. JB#62411 2024-11-03 01:41:14 +02:00
Slava Monich
50d226e401 Merge pull request #31 from NotKit/merge-ext-calls
Fallback to IRadio in binder_voicecall_answer and merge calls lists
2024-11-02 20:17:35 +02:00
Slava Monich
59d4bfb259 Merge pull request #39 from monich/build_fixes
Build fixes
2024-10-28 18:21:22 +02:00
Slava Monich
c413645fff [ofono-binder] Fix compilation errors
src/binder_plugin.c: In function 'binder_logger_dump_update_slot':
src/binder_plugin.c:471:5: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
     for (RADIO_AIDL_INTERFACE i = 0; i < RADIO_AIDL_INTERFACE_COUNT; i++) {
     ^
src/binder_plugin.c:471:5: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
src/binder_plugin.c: In function 'binder_logger_trace_update_slot':
src/binder_plugin.c:489:5: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
     for (RADIO_AIDL_INTERFACE i = 0; i < RADIO_AIDL_INTERFACE_COUNT; i++) {
     ^
src/binder_plugin.c: In function 'binder_plugin_is_slot_client_connected':
src/binder_plugin.c:533:5: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
     for (RADIO_AIDL_INTERFACE i = 0; i < RADIO_AIDL_INTERFACE_COUNT; i++) {
     ^
src/binder_plugin.c: In function 'binder_plugin_slot_shutdown':
src/binder_plugin.c:608:13: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
             for (RADIO_AIDL_INTERFACE i = 0; i < RADIO_AIDL_INTERFACE_COUNT; i++) {
             ^
src/binder_plugin.c: In function 'binder_plugin_slot_enabled_changed':
src/binder_plugin.c:787:5: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
     for (RADIO_AIDL_INTERFACE i = 0; i < RADIO_AIDL_INTERFACE_COUNT; i++) {
     ^
make: *** [Makefile:204: build/release/binder_plugin.o] Error 1
2024-10-28 03:02:56 +02:00
Slava Monich
04c803da45 [rpm] Use make_build macro when it's available 2024-10-28 02:58:54 +02:00
Slava Monich
1e9c46a485 [rpm] Bump ofono version requirement 2024-10-28 02:57:22 +02:00
Matti Lehtimäki
8d3a7a6048 Version 1.1.17 2024-09-26 21:30:31 +03:00
Matti Lehtimäki
c047df31bb Merge pull request #37 from mer-hybris/aidl-fix
[ofono-binder] Fix getting IMEI with HIDL interface. JB#61702
2024-09-26 21:29:43 +03:00
Matti Lehtimäki
1f2d9a7175 [ofono-binder] Fix getting IMEI with HIDL interface. JB#61702
Writing to incorrect array index overwrote other values.
2024-09-26 20:03:07 +03:00
Matti Lehtimäki
05b9507a7c Version 1.1.16 2024-09-26 14:32:32 +03:00
Matti Lehtimäki
51b3dfafa6 Merge pull request #36 from mer-hybris/aidl
Add support for AIDL interfaces
2024-09-26 14:26:44 +03:00
Nikita Ukhrenkov
eaeb88b504 [ofono-binder] Add USSD requests support for AIDL 2024-09-26 01:25:59 +03:00
Matti Lehtimäki
eb9fcfd261 [ofono-binder] Add IMS registration support for AIDL 2024-09-26 01:25:59 +03:00
Matti Lehtimäki
73c65171c6 [ofono-binder] Add SIM toolkit support for AIDL 2024-09-26 01:25:59 +03:00
Matti Lehtimäki
88de129781 [ofono-binder] Add call volume support for AIDL 2024-09-26 01:25:59 +03:00
Matti Lehtimäki
e96d1e6c29 [ofono-binder] Add call settings support for AIDL 2024-09-26 01:25:59 +03:00
Matti Lehtimäki
c016258c24 [ofono-binder] Add call forwarding support for AIDL 2024-09-26 01:25:59 +03:00
Matti Lehtimäki
4ccfd647c9 [ofono-binder] Add support for IRadioVoice interface 2024-09-26 01:25:59 +03:00
Matti Lehtimäki
46db487a09 [ofono-binder] Add support for AIDL call barring 2024-09-26 01:25:59 +03:00
Matti Lehtimäki
8c9ccc3cbd [ofono-binder] Add support for AIDL IRadioMessaging boardcast SMS 2024-09-26 01:25:59 +03:00
Matti Lehtimäki
bd479ed778 [ofono-binder] Add support for AIDL IRadioMessaging 2024-09-26 01:25:59 +03:00
Matti Lehtimäki
44f1713c60 [ofono-binder] Add radio caps support for AIDL 2024-09-26 01:25:59 +03:00
Matti Lehtimäki
56f9d4dd84 [ofono-binder] Add support for IRadioData interface 2024-09-26 01:25:59 +03:00
Matti Lehtimäki
99b4fe71a4 [ofono-binder] Add initial cell info support for AIDL 2024-09-26 01:25:59 +03:00
Matti Lehtimäki
a3bd6ac710 [ofono-binder] Add device monitoring support for AIDL 2024-09-26 01:25:59 +03:00
Matti Lehtimäki
656a5b36dd [ofono-binder] Add support for IRadioNetwork interface 2024-09-26 01:25:59 +03:00
Nikita Ukhrenkov
0333e60bba [ofono-binder] Add support for IRadioSIM interface 2024-09-26 01:07:44 +03:00
Matti Lehtimäki
3cd7c36202 [ofono-binder] Add baseband version support for AIDL 2024-09-26 01:05:56 +03:00
Nikita Ukhrenkov
9e589a0c0e [ofono-binder] Allow for multiple radio instances per slot 2024-09-26 01:05:56 +03:00
Nikita Ukhrenkov
76e9b1e825 [ofono-binder] Add support for AIDL IRadioModem 2024-09-26 01:05:49 +03:00
Nikita Ukhrenkov
86abda661b [ofono-binder] Add support for AIDL IRadioConfig 2024-09-26 01:05:34 +03:00
Nikita Ukhrenkov
dddc3e3d51 [ofono-binder] Add binder_read_parcelable_size helper function 2024-09-26 01:00:22 +03:00
Nikita Ukhrenkov
8a13fe18b4 [ofono-binder] Add binder_read_parcelable helper function 2024-09-26 01:00:22 +03:00
Nikita Ukhrenkov
258b187f5d [ofono-binder] Add binder_read_string16_parse_int helper function 2024-09-26 01:00:22 +03:00
Matti Lehtimäki
a5d89fc2db [ofono-binder] Add binder_strv_from_string16_array helper function 2024-09-23 18:44:29 +03:00
Matti Lehtimäki
97c0560717 [ofono-binder] Add binder_read_string16 helper function 2024-09-02 18:13:47 +03:00
TheKit
9dab7226b0 [ofono-binder] Merge ongoing call lists between IRadio/ext
IRadio and ext may have different lists of calls, so re-add
the ongoing calls initiated by the other component before
replacing the calls list with a new one.
2024-04-12 21:21:45 +03:00
TheKit
a7f69f8ced [ofono-binder] Fallback to IRadio in binder_voicecall_answer
MTK IMS implementation expects the radio client to answer the
call via the regular IRadio interface, even though the incoming
call signalling is done differently.

Make binder_voicecall_answer fallback to IRadio if ext plugin
did not submit a request.
2024-04-12 21:18:43 +03:00
60 changed files with 5898 additions and 1639 deletions

View File

@@ -5,6 +5,9 @@
.PHONY: print_debug_lib print_release_lib print_coverage_lib
.PHONY: debug_ext_so release_ext_so
# Allow building against an oFono variant.
OFONO_PKG ?= ofono
#
# Required packages
#
@@ -13,7 +16,7 @@
#
LDPKGS = libgbinder-radio libgbinder libmce-glib libglibutil gobject-2.0 glib-2.0
PKGS = ofono $(LDPKGS)
PKGS = $(OFONO_PKG) $(LDPKGS)
#
# Default target
@@ -178,10 +181,7 @@ release_ext_so:
clean:
make -C unit clean
make -C $(EXTLIB_DIR) clean
rm -fr debian/*.install debian/.debhelper debian/tmp
rm -fr debian/libofonobinderpluginext debian/libofonobinderpluginext-dev
rm -f documentation.list debian/files debian/*.substvars
rm -f debian/*.debhelper.log debian/*.debhelper debian/*~
rm -f documentation.list
rm -f *~ $(SRC_DIR)/*~ rpm/*~
rm -fr $(BUILD_DIR)
@@ -231,7 +231,7 @@ $(COVERAGE_LIB): $(COVERAGE_OBJS)
# Install
#
PLUGINDIR ?= $$(pkg-config ofono --variable=plugindir)
PLUGINDIR ?= $$(pkg-config $(OFONO_PKG) --variable=plugindir)
ABS_PLUGINDIR := $(shell echo /$(PLUGINDIR) | sed -r 's|/+|/|g')
INSTALL = install

10
debian/Jenkinsfile vendored Normal file
View File

@@ -0,0 +1,10 @@
@Library('ubports-build-tools') _
buildAndProvideDebianPackage()
// Or if the package consists entirely of arch-independent packages:
// (optional optimization, will confuse BlueOcean's live view at build stage)
// buildAndProvideDebianPackage(/* isArchIndependent */ true)
// Optionally, to skip building on some architectures (amd64 is always built):
// buildAndProvideDebianPackage(false, /* ignoredArchs */ ['arm64'])

32
debian/changelog vendored
View File

@@ -1,3 +1,35 @@
ofono-binder-plugin (1.1.21-0ubports1) noble; urgency=medium
* New upstream release v1.1.21
-- TheKit <thekit@disroot.org> Mon, 03 Mar 2025 22:30:54 +0300
ofono-binder-plugin (1.1.20-0ubports1) noble; urgency=medium
* New upstream release v1.1.20
-- TheKit <thekit@disroot.org> Mon, 03 Feb 2025 00:26:23 +0300
ofono-binder-plugin (1.1.18-0ubports1) UNRELEASED; urgency=unknown
* New upstream release v1.1.18
-- UBports package upgrader bot <dev@ubports.com> Sun, 22 Dec 2024 18:20:07 +0000
ofono-binder-plugin (1.1.15-0ubports1) noble; urgency=medium
* New upstream release
* debian/patches: import Fallback to IRadio in
binder_voicecall_answer and merge calls lists from upstream PR 31
-- TheKit <thekit@disroot.org> Thu, 15 Aug 2024 15:32:13 +0300
ofono-binder-plugin (1.1.11-0ubports1) focal; urgency=low
* Add initial packaging for Ubuntu Touch.
-- TheKit <thekit@disroot.org> Mon, 26 Apr 2023 21:44:17 +0300
libofonobinderpluginext (1.1.0) unstable; urgency=low
* Stable release of the extension API

1
debian/compat vendored
View File

@@ -1 +0,0 @@
7

21
debian/control vendored
View File

@@ -1,10 +1,25 @@
Source: libofonobinderpluginext
Source: ofono-binder-plugin
Section: libs
Priority: optional
Maintainer: Slava Monich <slava.monich@jolla.com>
Build-Depends: debhelper (>= 8.1.3), libglib2.0-dev (>= 2.0)
Maintainer: UBports developers <devs@ubports.com>
Build-Depends: debhelper-compat (= 12),
libglib2.0-dev (>= 2.0),
libmce-glib-dev,
libglibutil-dev,
libgbinder-dev,
libgbinder-radio1-dev,
ofono-sailfish-dev (>= 1.29+git8-0ubports1~),
Standards-Version: 3.8.4
Package: ofono-binder-plugin
Section: libs
Architecture: any
Depends: ${shlibs:Depends},
${misc:Depends},
Description: oFono binder-based IRadio plugin
Integrates Sailfish OS fork of ofono with Android adaptations
which support IRadio family of binder interfaces.
Package: libofonobinderpluginext
Section: libs
Architecture: any

View File

@@ -0,0 +1,3 @@
usr/lib/*/libofonobinderpluginext.so
usr/lib/*/pkgconfig/libofonobinderpluginext.pc
usr/include/*

View File

@@ -0,0 +1 @@
usr/lib/*/libofonobinderpluginext.so.*

1
debian/ofono-binder-plugin.install vendored Normal file
View File

@@ -0,0 +1 @@
usr/lib/*/ofono-sailfish/plugins/binderplugin.so

9
debian/rules vendored
View File

@@ -3,14 +3,19 @@
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
export DEB_BUILD_OPTIONS='nostrip debug'
export OFONO_PKG = ofono-sailfish
LIBDIR=usr/lib/$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
override_dh_auto_build:
dh_auto_build -- -C lib LIBDIR=$(LIBDIR) release pkgconfig ../debian/libofonobinderpluginext.install ../debian/libofonobinderpluginext-dev.install
dh_auto_build -- LIBDIR=$(LIBDIR) CFLAGS="-g -O0"
override_dh_auto_install:
dh_auto_install -- -C lib LIBDIR=$(LIBDIR) install-dev
dh_auto_install
make -C lib LIBDIR=$(LIBDIR) pkgconfig
make -C lib LIBDIR=$(LIBDIR) DESTDIR=../debian/tmp install-dev
%:
dh $@

View File

@@ -6,12 +6,15 @@
.PHONY: print_debug_lib print_release_lib print_coverage_lib
.PHONY: pkgconfig install install-dev
# Allow building against an oFono variant.
OFONO_PKG ?= ofono
#
# Required packages
#
PKGS = libgbinder-radio libglibutil glib-2.0 gobject-2.0
LDPKGS = libgbinder-radio libglibutil glib-2.0 gobject-2.0
PKGS = $(OFONO_PKG) $(LDPKGS)
#
# Default target
@@ -25,7 +28,7 @@ all: debug release pkgconfig
VERSION_MAJOR = 1
VERSION_MINOR = 1
VERSION_RELEASE = 14
VERSION_RELEASE = 21
# Version for pkg-config
PCVERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_RELEASE)
@@ -78,7 +81,7 @@ BASE_FLAGS = -fPIC
FULL_CFLAGS = $(BASE_FLAGS) $(CFLAGS) $(DEFINES) $(WARNINGS) $(INCLUDES) \
-MMD -MP $(shell pkg-config --cflags $(PKGS))
FULL_LDFLAGS = $(BASE_FLAGS) $(LDFLAGS) -shared -Wl,-soname,$(LIB_SONAME) \
$(shell pkg-config --libs $(PKGS)) -lpthread
$(shell pkg-config --libs $(LDPKGS)) -lpthread
DEBUG_FLAGS = -g
RELEASE_FLAGS =
COVERAGE_FLAGS = -g

View File

@@ -14,6 +14,9 @@
*/
#include "binder_ext_call_impl.h"
#include <gutil_log.h>
#define DBG(fmt, ...) \
gutil_log(GLOG_MODULE_CURRENT, GLOG_LEVEL_ALWAYS, "ext:"fmt, ##__VA_ARGS__)
G_DEFINE_INTERFACE(BinderExtCall, binder_ext_call, G_TYPE_OBJECT)
#define GET_IFACE(obj) BINDER_EXT_CALL_GET_IFACE(obj)
@@ -26,6 +29,7 @@ BinderExtCall*
binder_ext_call_ref(
BinderExtCall* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self)) {
g_object_ref(self);
}
@@ -36,6 +40,7 @@ void
binder_ext_call_unref(
BinderExtCall* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self)) {
g_object_unref(self);
}
@@ -45,6 +50,7 @@ BINDER_EXT_CALL_INTERFACE_FLAGS
binder_ext_call_get_interface_flags(
BinderExtCall* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return G_LIKELY(self) ? GET_IFACE(self)->flags :
BINDER_EXT_CALL_INTERFACE_NO_FLAGS;
}
@@ -53,6 +59,7 @@ const BinderExtCallInfo* const*
binder_ext_call_get_calls(
BinderExtCall* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
static const BinderExtCallInfo* none = NULL;
if (G_LIKELY(self)) {
@@ -82,6 +89,7 @@ binder_ext_call_dial(
GDestroyNotify destroy,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self) && G_LIKELY(number)) {
BinderExtCallInterface* iface = GET_IFACE(self);
@@ -103,6 +111,7 @@ binder_ext_call_deflect(
GDestroyNotify destroy,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self) && G_LIKELY(number)) {
BinderExtCallInterface* iface = GET_IFACE(self);
@@ -122,6 +131,7 @@ binder_ext_call_answer(
GDestroyNotify destroy,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self)) {
BinderExtCallInterface* iface = GET_IFACE(self);
@@ -141,6 +151,7 @@ binder_ext_call_swap(
GDestroyNotify destroy,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self)) {
BinderExtCallInterface* iface = GET_IFACE(self);
@@ -160,6 +171,7 @@ binder_ext_call_transfer(
GDestroyNotify destroy,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self)) {
BinderExtCallInterface* iface = GET_IFACE(self);
@@ -178,6 +190,7 @@ binder_ext_call_conference(
GDestroyNotify destroy,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self)) {
BinderExtCallInterface* iface = GET_IFACE(self);
@@ -196,6 +209,7 @@ binder_ext_call_send_dtmf(
GDestroyNotify destroy,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self) && G_LIKELY(tones)) {
BinderExtCallInterface* iface = GET_IFACE(self);
@@ -216,6 +230,7 @@ binder_ext_call_hangup(
GDestroyNotify destroy,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self)) {
BinderExtCallInterface* iface = GET_IFACE(self);
@@ -232,6 +247,7 @@ binder_ext_call_cancel(
BinderExtCall* self,
guint id)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self) && G_LIKELY(id)) {
BinderExtCallInterface* iface = GET_IFACE(self);
@@ -247,6 +263,7 @@ binder_ext_call_add_calls_changed_handler(
BinderExtCallFunc handler,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self)) {
BinderExtCallInterface* iface = GET_IFACE(self);
@@ -263,6 +280,7 @@ binder_ext_call_add_disconnect_handler(
BinderExtCallDisconnectFunc handler,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self)) {
BinderExtCallInterface* iface = GET_IFACE(self);
@@ -279,6 +297,7 @@ binder_ext_call_add_ring_handler(
BinderExtCallFunc handler,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self)) {
BinderExtCallInterface* iface = GET_IFACE(self);
@@ -295,6 +314,7 @@ binder_ext_call_add_ssn_handler(
BinderExtCallSuppSvcNotifyFunc handler,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self)) {
BinderExtCallInterface* iface = GET_IFACE(self);
@@ -310,6 +330,7 @@ binder_ext_call_remove_handler(
BinderExtCall* self,
gulong id)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self) && G_LIKELY(id)) {
/*
* Since we provide the default callback, we can safely assume
@@ -325,6 +346,7 @@ binder_ext_call_remove_handlers(
gulong* ids,
guint count)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self) && G_LIKELY(ids) && G_LIKELY(count)) {
BinderExtCallInterface* iface = GET_IFACE(self);
int i;
@@ -352,6 +374,7 @@ binder_ext_call_default_remove_handler(
BinderExtCall* self,
gulong id)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (id) {
g_signal_handler_disconnect(self, id);
}
@@ -362,6 +385,7 @@ void
binder_ext_call_default_init(
BinderExtCallInterface* iface)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
/*
* Assume the smallest interface version. Implementation must overwrite
* iface->version with BINDER_EXT_CALL_INTERFACE_VERSION known to it at

View File

@@ -14,6 +14,9 @@
*/
#include "binder_ext_ims_impl.h"
#include <gutil_log.h>
#define DBG(fmt, ...) \
gutil_log(GLOG_MODULE_CURRENT, GLOG_LEVEL_ALWAYS, "ext:"fmt, ##__VA_ARGS__)
G_DEFINE_INTERFACE(BinderExtIms, binder_ext_ims, G_TYPE_OBJECT)
#define GET_IFACE(obj) BINDER_EXT_IMS_GET_IFACE(obj)
@@ -26,6 +29,7 @@ BinderExtIms*
binder_ext_ims_ref(
BinderExtIms* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self)) {
g_object_ref(self);
}
@@ -36,6 +40,7 @@ void
binder_ext_ims_unref(
BinderExtIms* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self)) {
g_object_unref(self);
}
@@ -45,6 +50,7 @@ BINDER_EXT_IMS_INTERFACE_FLAGS
binder_ext_ims_get_interface_flags(
BinderExtIms* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return G_LIKELY(self) ? GET_IFACE(self)->flags :
BINDER_EXT_IMS_INTERFACE_NO_FLAGS;
}
@@ -53,6 +59,7 @@ BINDER_EXT_IMS_STATE
binder_ext_ims_get_state(
BinderExtIms* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self)) {
BinderExtImsInterface* iface = GET_IFACE(self);
@@ -71,6 +78,7 @@ binder_ext_ims_set_registration(
GDestroyNotify destroy,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self)) {
BinderExtImsInterface* iface = GET_IFACE(self);
@@ -87,6 +95,7 @@ binder_ext_ims_cancel(
BinderExtIms* self,
guint id)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self) && G_LIKELY(id)) {
BinderExtImsInterface* iface = GET_IFACE(self);
@@ -102,6 +111,7 @@ binder_ext_ims_add_state_handler(
BinderExtImsFunc handler,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self) && G_LIKELY(handler)) {
BinderExtImsInterface* iface = GET_IFACE(self);
@@ -117,6 +127,7 @@ binder_ext_ims_remove_handler(
BinderExtIms* self,
gulong id)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self) && G_LIKELY(id)) {
/*
* Since we provide the default callback, we can safely assume
@@ -132,6 +143,7 @@ binder_ext_ims_remove_handlers(
gulong* ids,
guint count)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self) && G_LIKELY(ids) && G_LIKELY(count)) {
BinderExtImsInterface* iface = GET_IFACE(self);
int i;
@@ -159,6 +171,7 @@ binder_ext_ims_default_remove_handler(
BinderExtIms* self,
gulong id)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (id) {
g_signal_handler_disconnect(self, id);
}
@@ -169,6 +182,7 @@ void
binder_ext_ims_default_init(
BinderExtImsInterface* iface)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
/*
* Assume the smallest interface version. Implementation must overwrite
* iface->version with BINDER_EXT_IMS_INTERFACE_VERSION known to it at

View File

@@ -14,6 +14,9 @@
*/
#include "binder_ext_plugin_impl.h"
#include <gutil_log.h>
#define DBG(fmt, ...) \
gutil_log(GLOG_MODULE_CURRENT, GLOG_LEVEL_ALWAYS, "ext:"fmt, ##__VA_ARGS__)
#define THIS(obj) BINDER_EXT_PLUGIN(obj)
#define THIS_TYPE BINDER_EXT_TYPE_PLUGIN
@@ -36,6 +39,7 @@ binder_ext_slot_new(
RadioInstance* radio,
GHashTable* params)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
/* Well, this is kind of BinderExtSlot API but let it be here. */
return plugin ? GET_CLASS(plugin)->new_slot(plugin, radio, params) : NULL;
}
@@ -44,6 +48,7 @@ BinderExtPlugin*
binder_ext_plugin_ref(
BinderExtPlugin* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self)) {
g_object_ref(THIS(self));
}
@@ -54,6 +59,7 @@ void
binder_ext_plugin_unref(
BinderExtPlugin* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self)) {
g_object_unref(THIS(self));
}
@@ -63,6 +69,7 @@ const char*
binder_ext_plugin_name(
BinderExtPlugin* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return G_LIKELY(self) ? GET_CLASS(self)->plugin_name : NULL;
}
@@ -70,6 +77,7 @@ BinderExtPlugin*
binder_ext_plugin_get(
const char* name)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return (binder_ext_plugin_table && G_LIKELY(name)) ?
g_hash_table_lookup(binder_ext_plugin_table, name) :
NULL;
@@ -79,6 +87,7 @@ void
binder_ext_plugin_register(
BinderExtPlugin* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
const char* name = binder_ext_plugin_name(self);
if (name) {
@@ -95,6 +104,7 @@ void
binder_ext_plugin_unregister(
const char* name)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (binder_ext_plugin_table) {
g_hash_table_remove(binder_ext_plugin_table, name);
if (!g_hash_table_size(binder_ext_plugin_table)) {
@@ -113,6 +123,7 @@ void
binder_ext_plugin_init(
BinderExtPlugin* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
}
static
@@ -120,6 +131,7 @@ void
binder_ext_plugin_class_init(
BinderExtPluginClass* klass)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
}
/*

View File

@@ -16,6 +16,9 @@
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include "binder_ext_slot_impl.h"
#include <gutil_log.h>
#define DBG(fmt, ...) \
gutil_log(GLOG_MODULE_CURRENT, GLOG_LEVEL_ALWAYS, "ext:"fmt, ##__VA_ARGS__)
struct binder_ext_slot_priv {
gboolean dropped;
@@ -37,6 +40,7 @@ BinderExtSlot*
binder_ext_slot_ref(
BinderExtSlot* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self)) {
g_object_ref(self);
}
@@ -47,6 +51,7 @@ void
binder_ext_slot_unref(
BinderExtSlot* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self)) {
g_object_unref(self);
}
@@ -56,6 +61,7 @@ void
binder_ext_slot_drop(
BinderExtSlot* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self)) {
BinderExtSlotPriv* priv = self->priv;
@@ -72,6 +78,7 @@ binder_ext_slot_get_interface(
BinderExtSlot* self,
GType type)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return G_LIKELY(self) ? GET_CLASS(self)->get_interface(self, type) : NULL;
}
@@ -85,6 +92,7 @@ binder_ext_slot_default_get_interface(
BinderExtSlot* self,
GType iface)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return NULL;
}
@@ -93,6 +101,7 @@ void
binder_ext_slot_nop(
BinderExtSlot* slot)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
}
static
@@ -100,6 +109,7 @@ void
binder_ext_slot_init(
BinderExtSlot* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
self->priv = G_TYPE_INSTANCE_GET_PRIVATE(self, THIS_TYPE,
BinderExtSlotPriv);
}
@@ -109,6 +119,7 @@ void
binder_ext_slot_class_init(
BinderExtSlotClass* klass)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
g_type_class_add_private(klass, sizeof(BinderExtSlotPriv));
klass->get_interface = binder_ext_slot_default_get_interface;
klass->shutdown = binder_ext_slot_nop;

View File

@@ -14,6 +14,9 @@
*/
#include "binder_ext_sms_impl.h"
#include <gutil_log.h>
#define DBG(fmt, ...) \
gutil_log(GLOG_MODULE_CURRENT, GLOG_LEVEL_ALWAYS, "ext:"fmt, ##__VA_ARGS__)
G_DEFINE_INTERFACE(BinderExtSms, binder_ext_sms, G_TYPE_OBJECT)
#define GET_IFACE(obj) BINDER_EXT_SMS_GET_IFACE(obj)
@@ -26,6 +29,7 @@ BinderExtSms*
binder_ext_sms_ref(
BinderExtSms* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self)) {
g_object_ref(self);
}
@@ -36,6 +40,7 @@ void
binder_ext_sms_unref(
BinderExtSms* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self)) {
g_object_unref(self);
}
@@ -45,6 +50,7 @@ BINDER_EXT_SMS_INTERFACE_FLAGS
binder_ext_sms_get_interface_flags(
BinderExtSms* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return G_LIKELY(self) ? GET_IFACE(self)->flags :
BINDER_EXT_SMS_INTERFACE_NO_FLAGS;
}
@@ -61,6 +67,7 @@ binder_ext_sms_send(
GDestroyNotify destroy,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self)) {
BinderExtSmsInterface* iface = GET_IFACE(self);
@@ -77,6 +84,7 @@ binder_ext_sms_cancel(
BinderExtSms* self,
guint id)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self) && G_LIKELY(id)) {
BinderExtSmsInterface* iface = GET_IFACE(self);
@@ -92,6 +100,7 @@ binder_ext_sms_add_report_handler(
BinderExtSmsReportFunc cb,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self) && G_LIKELY(cb)) {
BinderExtSmsInterface* iface = GET_IFACE(self);
@@ -108,6 +117,7 @@ binder_ext_sms_add_incoming_handler(
BinderExtSmsIncomingFunc cb,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self) && G_LIKELY(cb)) {
BinderExtSmsInterface* iface = GET_IFACE(self);
@@ -124,6 +134,7 @@ binder_ext_sms_ack_report(
guint msg_ref,
gboolean ok)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self)) {
BinderExtSmsInterface* iface = GET_IFACE(self);
@@ -138,6 +149,7 @@ binder_ext_sms_ack_incoming(
BinderExtSms* self,
gboolean ok)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self)) {
BinderExtSmsInterface* iface = GET_IFACE(self);
@@ -152,6 +164,7 @@ binder_ext_sms_remove_handler(
BinderExtSms* self,
gulong id)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self) && G_LIKELY(id)) {
/*
* Since we provide the default callback, we can safely assume
@@ -167,6 +180,7 @@ binder_ext_sms_remove_handlers(
gulong* ids,
guint count)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self) && G_LIKELY(ids) && G_LIKELY(count)) {
BinderExtSmsInterface* iface = GET_IFACE(self);
int i;
@@ -194,6 +208,7 @@ binder_ext_sms_default_remove_handler(
BinderExtSms* self,
gulong id)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (id) {
g_signal_handler_disconnect(self, id);
}
@@ -204,6 +219,7 @@ void
binder_ext_sms_default_init(
BinderExtSmsInterface* iface)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
/*
* Assume the smallest interface version. Implementation must overwrite
* iface->version with BINDER_EXT_SMS_INTERFACE_VERSION known to it at

View File

@@ -1,6 +1,6 @@
Name: ofono-binder-plugin
Version: 1.1.14
Version: 1.1.21
Release: 1
Summary: Binder based ofono plugin
License: GPLv2
@@ -9,10 +9,10 @@ Source: %{name}-%{version}.tar.bz2
%define libglibutil_version 1.0.61
%define libgbinder_version 1.1.29
%define libgbinder_radio_version 1.5.6
%define libgbinder_radio_version 1.6.0
%define libmce_version 1.0.6
%define libofonobinderpluginext_version 1.1.0
%define ofono_version 1.28+git8
%define ofono_version 1.29+git8
BuildRequires: pkgconfig
BuildRequires: ofono-devel >= %{ofono_version}
@@ -26,6 +26,9 @@ BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(rpm)
%define license_support %(pkg-config --exists 'rpm >= 4.11'; echo $?)
# make_build macro appeared in rpm 4.12
%{!?make_build:%define make_build make %{_smp_mflags}}
Requires: ofono >= %{ofono_version}
Requires: libofonobinderpluginext >= %{libofonobinderpluginext_version}
Requires: libgbinder >= %{libgbinder_version}
@@ -48,8 +51,8 @@ Binder plugin for Sailfish OS fork of ofono
%setup -q -n %{name}-%{version}
%build
make %{_smp_mflags} PLUGINDIR=%{plugin_dir} KEEP_SYMBOLS=1 release
make %{_smp_mflags} -C lib LIBDIR=%{_libdir} KEEP_SYMBOLS=1 release pkgconfig
%make_build PLUGINDIR=%{plugin_dir} KEEP_SYMBOLS=1 release
%make_build -C lib LIBDIR=%{_libdir} KEEP_SYMBOLS=1 release pkgconfig
%check
make test

View File

@@ -53,6 +53,7 @@ GQuark
binder_base_property_quark(
guint property)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
GASSERT(property < BINDER_BASE_MAX_PROPERTIES);
/* For ANY property this function is expected to return zero */
if (property > 0 && G_LIKELY(property < BINDER_BASE_MAX_PROPERTIES)) {
@@ -77,6 +78,7 @@ binder_base_property_changed(
guint property,
BinderBaseClosure* closure)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
const BinderBaseClass* klass = GET_CLASS(self);
closure->callback(((guint8*)self) + klass->public_offset, property,
@@ -94,6 +96,7 @@ binder_base_add_property_handler(
GCallback callback,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(callback)) {
/*
* We can't directly connect the provided callback because
@@ -122,6 +125,7 @@ binder_base_queue_property_change(
BinderBase* self,
guint property)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
self->queued_signals |= BINDER_BASE_PROPERTY_BIT(property);
}
@@ -130,6 +134,7 @@ binder_base_emit_property_change(
BinderBase* self,
guint property)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
binder_base_queue_property_change(self, property);
binder_base_emit_queued_signals(self);
}
@@ -138,13 +143,14 @@ void
binder_base_emit_queued_signals(
BinderBase* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
guint p;
/* Signal handlers may release references to this object */
g_object_ref(self);
/* Emit the signals */
for (p = 0; self->queued_signals && p < BINDER_BASE_MAX_PROPERTIES; p++) {
/* Emit the signals, ignore the ANY property */
for (p = 1; self->queued_signals && p < BINDER_BASE_MAX_PROPERTIES; p++) {
if (self->queued_signals & BINDER_BASE_PROPERTY_BIT(p)) {
self->queued_signals &= ~BINDER_BASE_PROPERTY_BIT(p);
g_signal_emit(self, binder_base_signals[SIGNAL_PROPERTY_CHANGED],
@@ -165,6 +171,7 @@ void
binder_base_init(
BinderBase* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
}
static
@@ -172,6 +179,7 @@ void
binder_base_class_init(
BinderBaseClass* klass)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
/* By default assume that public part immediately follows BinderBase */
klass->public_offset = sizeof(BinderBase);
binder_base_signals[SIGNAL_PROPERTY_CHANGED] =

View File

@@ -22,8 +22,11 @@
#include <ofono/call-barring.h>
#include <ofono/log.h>
#include <radio_client.h>
#include <radio_request.h>
#include <radio_request_group.h>
#include <radio_network_types.h>
#include <radio_sim_types.h>
#include <gbinder_reader.h>
#include <gbinder_writer.h>
@@ -31,7 +34,9 @@
typedef struct binder_call_barring {
struct ofono_call_barring* b;
BinderSimCard* card;
RadioClient* network_client;
RadioRequestGroup* g;
RADIO_AIDL_INTERFACE interface_aidl;
char* log_prefix;
guint register_id;
} BinderCallBarring;
@@ -59,6 +64,7 @@ binder_call_barring_callback_data_new(
BinderCallback cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCallBarringCbData* cbd = g_slice_new0(BinderCallBarringCbData);
cbd->self = self;
@@ -72,6 +78,7 @@ void
binder_call_barring_callback_data_free(
gpointer cbd)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
g_slice_free(BinderCallBarringCbData, cbd);
}
@@ -81,6 +88,7 @@ binder_call_barring_query_ok(
const BinderCallBarringCbData* cbd,
const GBinderReader* args)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
GBinderReader reader;
gint32 response;
@@ -112,11 +120,15 @@ binder_call_barring_query_cb(
const GBinderReader* args,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_error err;
const BinderCallBarringCbData* cbd = user_data;
if (status == RADIO_TX_STATUS_OK) {
if (resp == RADIO_RESP_GET_FACILITY_LOCK_FOR_APP) {
guint32 code = cbd->self->interface_aidl == RADIO_SIM_INTERFACE ?
RADIO_SIM_RESP_GET_FACILITY_LOCK_FOR_APP :
RADIO_RESP_GET_FACILITY_LOCK_FOR_APP;
if (resp == code) {
if (error == RADIO_ERROR_NONE) {
if (binder_call_barring_query_ok(cbd, args)) {
return;
@@ -140,6 +152,7 @@ binder_call_barring_query(
ofono_call_barring_query_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCallBarring* self = ofono_call_barring_get_data(b);
/*
@@ -147,18 +160,29 @@ binder_call_barring_query(
* string password, int32_t serviceClass, string appId);
*/
GBinderWriter writer;
guint32 code = self->interface_aidl == RADIO_SIM_INTERFACE ?
RADIO_SIM_REQ_GET_FACILITY_LOCK_FOR_APP :
RADIO_REQ_GET_FACILITY_LOCK_FOR_APP;
RadioRequest* req = radio_request_new2(self->g,
RADIO_REQ_GET_FACILITY_LOCK_FOR_APP, &writer,
code, &writer,
binder_call_barring_query_cb,
binder_call_barring_callback_data_free,
binder_call_barring_callback_data_new(self, BINDER_CB(cb), data));
DBG_(self, "lock: %s, services to query: 0x%02x", lock, cls);
binder_append_hidl_string(&writer, lock); /* facility */
binder_append_hidl_string(&writer, ""); /* password */
gbinder_writer_append_int32(&writer, cls); /* serviceClass */
binder_append_hidl_string(&writer, binder_sim_card_app_aid(self->card));
/* appId */
if (self->interface_aidl == RADIO_AIDL_INTERFACE_NONE) {
binder_append_hidl_string(&writer, lock); /* facility */
binder_append_hidl_string(&writer, ""); /* password */
gbinder_writer_append_int32(&writer, cls); /* serviceClass */
binder_append_hidl_string(&writer, binder_sim_card_app_aid(self->card));
/* appId */
} else {
gbinder_writer_append_string16(&writer, lock); /* facility */
gbinder_writer_append_string16(&writer, ""); /* password */
gbinder_writer_append_int32(&writer, cls); /* serviceClass */
gbinder_writer_append_string16(&writer,
binder_sim_card_app_aid(self->card)); /* appId */
}
radio_request_submit(req);
radio_request_unref(req);
}
@@ -173,12 +197,16 @@ binder_call_barring_set_cb(
const GBinderReader* args,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_error err;
const BinderCallBarringCbData* cbd = user_data;
ofono_call_barring_set_cb_t cb = cbd->cb.set;
if (status == RADIO_TX_STATUS_OK) {
if (resp == RADIO_RESP_SET_FACILITY_LOCK_FOR_APP) {
guint32 code = cbd->self->interface_aidl == RADIO_SIM_INTERFACE ?
RADIO_SIM_RESP_SET_FACILITY_LOCK_FOR_APP :
RADIO_RESP_SET_FACILITY_LOCK_FOR_APP;
if (resp == code) {
/*
* setFacilityLockForAppResponse(RadioResponseInfo, int32_t retry);
*
@@ -208,6 +236,7 @@ binder_call_barring_set(
ofono_call_barring_set_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCallBarring* self = ofono_call_barring_get_data(b);
/*
@@ -215,20 +244,32 @@ binder_call_barring_set(
* string password, int32_t serviceClass, string appId);
*/
GBinderWriter writer;
guint32 code = self->interface_aidl == RADIO_SIM_INTERFACE ?
RADIO_SIM_REQ_SET_FACILITY_LOCK_FOR_APP :
RADIO_REQ_SET_FACILITY_LOCK_FOR_APP;
RadioRequest* req = radio_request_new2(self->g,
RADIO_REQ_SET_FACILITY_LOCK_FOR_APP, &writer,
code, &writer,
binder_call_barring_set_cb,
binder_call_barring_callback_data_free,
binder_call_barring_callback_data_new(self, BINDER_CB(cb), data));
DBG_(self, "lock: %s, enable: %i, bearer class: %i", lock, enable, cls);
binder_append_hidl_string(&writer, lock); /* facility */
gbinder_writer_append_bool(&writer, enable); /* lockState */
binder_append_hidl_string(&writer, passwd); /* password */
gbinder_writer_append_int32(&writer, cls); /* serviceClass */
binder_append_hidl_string(&writer, binder_sim_card_app_aid(self->card));
/* appId */
if (self->interface_aidl == RADIO_AIDL_INTERFACE_NONE) {
binder_append_hidl_string(&writer, lock); /* facility */
gbinder_writer_append_bool(&writer, enable); /* lockState */
binder_append_hidl_string(&writer, passwd); /* password */
gbinder_writer_append_int32(&writer, cls); /* serviceClass */
binder_append_hidl_string(&writer, binder_sim_card_app_aid(self->card));
/* appId */
} else {
gbinder_writer_append_string16(&writer, lock); /* facility */
gbinder_writer_append_bool(&writer, enable); /* lockState */
gbinder_writer_append_string16(&writer, passwd); /* password */
gbinder_writer_append_int32(&writer, cls); /* serviceClass */
gbinder_writer_append_string16(&writer,
binder_sim_card_app_aid(self->card)); /* appId */
}
radio_request_submit(req);
radio_request_unref(req);
}
@@ -243,12 +284,18 @@ binder_call_barring_set_passwd_cb(
const GBinderReader* args,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_error err;
const BinderCallBarringCbData* cbd = user_data;
ofono_call_barring_set_cb_t cb = cbd->cb.set;
if (status == RADIO_TX_STATUS_OK) {
if (resp == RADIO_RESP_SET_BARRING_PASSWORD) {
const RADIO_AIDL_INTERFACE iface_aidl =
radio_client_aidl_interface(cbd->self->network_client);
guint32 code = iface_aidl == RADIO_NETWORK_INTERFACE ?
RADIO_NETWORK_RESP_SET_BARRING_PASSWORD :
RADIO_RESP_SET_BARRING_PASSWORD;
if (resp == code) {
if (error == RADIO_ERROR_NONE) {
cb(binder_error_ok(&err), cbd->data);
return;
@@ -272,23 +319,36 @@ binder_call_barring_set_passwd(
ofono_call_barring_set_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCallBarring* self = ofono_call_barring_get_data(b);
const RADIO_AIDL_INTERFACE iface_aidl =
radio_client_aidl_interface(self->network_client);
/*
* setBarringPassword(int32_t serial, string facility,
* string oldPassword, string newPassword);
*/
GBinderWriter writer;
RadioRequest* req = radio_request_new2(self->g,
RADIO_REQ_SET_BARRING_PASSWORD, &writer,
guint32 code = iface_aidl == RADIO_NETWORK_INTERFACE ?
RADIO_NETWORK_REQ_SET_BARRING_PASSWORD :
RADIO_REQ_SET_BARRING_PASSWORD;
RadioRequest* req = radio_request_new(self->network_client,
code, &writer,
binder_call_barring_set_passwd_cb,
binder_call_barring_callback_data_free,
binder_call_barring_callback_data_new(self, BINDER_CB(cb), data));
DBG_(self, "");
binder_append_hidl_string(&writer, lock); /* facility */
binder_append_hidl_string(&writer, old_passwd); /* oldPassword */
binder_append_hidl_string(&writer, new_passwd); /* newPassword */
if (iface_aidl == RADIO_AIDL_INTERFACE_NONE) {
binder_append_hidl_string(&writer, lock); /* facility */
binder_append_hidl_string(&writer, old_passwd); /* oldPassword */
binder_append_hidl_string(&writer, new_passwd); /* newPassword */
} else {
gbinder_writer_append_string16(&writer, lock); /* facility */
gbinder_writer_append_string16(&writer, old_passwd); /* oldPassword */
gbinder_writer_append_string16(&writer, new_passwd); /* newPassword */
}
radio_request_submit(req);
radio_request_unref(req);
@@ -299,6 +359,7 @@ gboolean
binder_call_barring_register(
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCallBarring* self = user_data;
GASSERT(self->register_id);
@@ -314,13 +375,16 @@ binder_call_barring_probe(
unsigned int vendor,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderModem* modem = binder_modem_get_data(data);
BinderCallBarring* self = g_new0(struct binder_call_barring, 1);
self->b = b;
self->card = binder_sim_card_ref(modem->sim_card);
self->g = radio_request_group_new(modem->client);
self->g = radio_request_group_new(modem->sim_client);
self->interface_aidl = radio_client_aidl_interface(modem->sim_client);
self->log_prefix = binder_dup_prefix(modem->log_prefix);
self->network_client = radio_client_ref(modem->network_client);
self->register_id = g_idle_add(binder_call_barring_register, self);
DBG_(self, "");
@@ -333,6 +397,7 @@ void
binder_call_barring_remove(
struct ofono_call_barring* b)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCallBarring* self = binder_call_barring_get_data(b);
DBG_(self, "");
@@ -342,6 +407,7 @@ binder_call_barring_remove(
binder_sim_card_unref(self->card);
radio_request_group_cancel(self->g);
radio_request_group_unref(self->g);
radio_client_unref(self->network_client);
g_free(self->log_prefix);
g_free(self);
@@ -364,12 +430,14 @@ static const struct ofono_call_barring_driver binder_call_barring_driver = {
void
binder_call_barring_init()
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ofono_call_barring_driver_register(&binder_call_barring_driver);
}
void
binder_call_barring_cleanup()
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ofono_call_barring_driver_unregister(&binder_call_barring_driver);
}

View File

@@ -21,8 +21,10 @@
#include <ofono/call-forwarding.h>
#include <ofono/log.h>
#include <radio_client.h>
#include <radio_request.h>
#include <radio_request_group.h>
#include <radio_voice_types.h>
#include <gbinder_reader.h>
#include <gbinder_writer.h>
@@ -30,11 +32,13 @@
typedef struct binder_call_forwarding {
struct ofono_call_forwarding* f;
RadioRequestGroup* g;
RADIO_AIDL_INTERFACE interface_aidl;
char* log_prefix;
guint register_id;
} BinderCallForwarding;
typedef struct binder_call_forwarding_cbd {
BinderCallForwarding* self;
union call_forwarding_cb {
ofono_call_forwarding_query_cb_t query;
ofono_call_forwarding_set_cb_t set;
@@ -54,11 +58,14 @@ binder_call_forwarding_get_data(struct ofono_call_forwarding* f)
static
BinderCallForwardingCbData*
binder_call_forwarding_callback_data_new(
BinderCallForwarding* self,
BinderCallback cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCallForwardingCbData* cbd = g_slice_new0(BinderCallForwardingCbData);
cbd->self = self;
cbd->cb.ptr = cb;
cbd->data = data;
return cbd;
@@ -69,6 +76,7 @@ void
binder_call_forwarding_callback_data_free(
gpointer cbd)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
g_slice_free(BinderCallForwardingCbData, cbd);
}
@@ -86,6 +94,7 @@ binder_call_forwarding_call(
BinderCallback cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
/*
* getCallForwardStatus(int32_t serial, CallForwardInfo callInfo);
* setCallForward(int32_t serial, CallForwardInfo callInfo);
@@ -93,24 +102,50 @@ binder_call_forwarding_call(
GBinderWriter writer;
RadioRequest* req = radio_request_new2(self->g, code, &writer, complete,
binder_call_forwarding_callback_data_free,
binder_call_forwarding_callback_data_new(cb, data));
RadioCallForwardInfo* info = gbinder_writer_new0(&writer,
RadioCallForwardInfo);
guint parent;
binder_call_forwarding_callback_data_new(self, cb, data));
info->status = action;
info->reason = reason;
info->serviceClass = cls;
info->timeSeconds = time;
if (number) {
info->toa = number->type;
binder_copy_hidl_string(&writer, &info->number, number->number);
if (self->interface_aidl == RADIO_AIDL_INTERFACE_NONE) {
RadioCallForwardInfo* info = gbinder_writer_new0(&writer,
RadioCallForwardInfo);
guint parent;
info->status = action;
info->reason = reason;
info->serviceClass = cls;
info->timeSeconds = time;
if (number) {
info->toa = number->type;
binder_copy_hidl_string(&writer, &info->number, number->number);
} else {
info->toa = OFONO_NUMBER_TYPE_UNKNOWN;
binder_copy_hidl_string(&writer, &info->number, NULL);
}
parent = gbinder_writer_append_buffer_object(&writer, info, sizeof(*info));
binder_append_hidl_string_data(&writer, info, number, parent);
} else {
info->toa = OFONO_NUMBER_TYPE_UNKNOWN;
binder_copy_hidl_string(&writer, &info->number, NULL);
gint32 initial_size;
/* Non-null parcelable */
gbinder_writer_append_int32(&writer, 1);
initial_size = gbinder_writer_bytes_written(&writer);
/* Dummy parcelable size, replaced at the end */
gbinder_writer_append_int32(&writer, -1);
gbinder_writer_append_int32(&writer, action);
gbinder_writer_append_int32(&writer, reason);
gbinder_writer_append_int32(&writer, cls);
if (number) {
gbinder_writer_append_int32(&writer, number->type);
gbinder_writer_append_string16(&writer, number->number);
} else {
gbinder_writer_append_int32(&writer, OFONO_NUMBER_TYPE_UNKNOWN);
gbinder_writer_append_string16(&writer, NULL);
}
gbinder_writer_append_int32(&writer, time);
/* Overwrite parcelable size */
gbinder_writer_overwrite_int32(&writer, initial_size,
gbinder_writer_bytes_written(&writer) - initial_size);
}
parent = gbinder_writer_append_buffer_object(&writer, info, sizeof(*info));
binder_append_hidl_string_data(&writer, info, number, parent);
radio_request_submit(req);
radio_request_unref(req);
@@ -126,12 +161,16 @@ binder_call_forwarding_set_cb(
const GBinderReader* args,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_error err;
const BinderCallForwardingCbData* cbd = user_data;
ofono_call_forwarding_set_cb_t cb = cbd->cb.set;
if (status == RADIO_TX_STATUS_OK) {
if (resp == RADIO_RESP_SET_CALL_FORWARD) {
guint32 code = cbd->self->interface_aidl == RADIO_VOICE_INTERFACE ?
RADIO_VOICE_RESP_SET_CALL_FORWARD :
RADIO_RESP_SET_CALL_FORWARD;
if (resp == code) {
if (error == RADIO_ERROR_NONE) {
cb(binder_error_ok(&err), cbd->data);
return;
@@ -157,7 +196,11 @@ binder_call_forwarding_set(
ofono_call_forwarding_set_cb_t cb,
void* data)
{
binder_call_forwarding_call(self, RADIO_REQ_SET_CALL_FORWARD,
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
guint32 code = self->interface_aidl == RADIO_VOICE_INTERFACE ?
RADIO_VOICE_REQ_SET_CALL_FORWARD :
RADIO_REQ_SET_CALL_FORWARD;
binder_call_forwarding_call(self, code,
action, reason, cls, number, time, binder_call_forwarding_set_cb,
BINDER_CB(cb), data);
}
@@ -173,6 +216,7 @@ binder_call_forwarding_registration(
ofono_call_forwarding_set_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCallForwarding* self = binder_call_forwarding_get_data(f);
DBG_(self, "%d", type);
@@ -189,6 +233,7 @@ binder_call_forwarding_erasure(
ofono_call_forwarding_set_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCallForwarding* self = binder_call_forwarding_get_data(f);
DBG_(self, "%d", type);
@@ -205,6 +250,7 @@ binder_call_forwarding_deactivate(
ofono_call_forwarding_set_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCallForwarding* self = binder_call_forwarding_get_data(f);
DBG_(self, "%d", type);
@@ -221,6 +267,7 @@ binder_call_forwarding_activate(
ofono_call_forwarding_set_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCallForwarding* self = binder_call_forwarding_get_data(f);
DBG_(self, "%d", type);
@@ -234,6 +281,7 @@ binder_call_forwarding_query_ok(
const BinderCallForwardingCbData* cbd,
const GBinderReader* args)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_error err;
const RadioCallForwardInfo* infos;
struct ofono_call_forwarding_condition* list = NULL;
@@ -274,11 +322,15 @@ binder_call_forwarding_query_cb(
const GBinderReader* args,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_error err;
const BinderCallForwardingCbData* cbd = user_data;
if (status == RADIO_TX_STATUS_OK) {
if (resp == RADIO_RESP_GET_CALL_FORWARD_STATUS) {
guint32 code = cbd->self->interface_aidl == RADIO_VOICE_INTERFACE ?
RADIO_VOICE_RESP_GET_CALL_FORWARD_STATUS :
RADIO_RESP_GET_CALL_FORWARD_STATUS;
if (resp == code) {
if (error == RADIO_ERROR_NONE) {
binder_call_forwarding_query_ok(cbd, args);
return;
@@ -301,7 +353,11 @@ binder_call_forwarding_query(
ofono_call_forwarding_query_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCallForwarding* self = binder_call_forwarding_get_data(f);
guint32 code = self->interface_aidl == RADIO_VOICE_INTERFACE ?
RADIO_VOICE_REQ_GET_CALL_FORWARD_STATUS :
RADIO_REQ_GET_CALL_FORWARD_STATUS;
DBG_(self, "%d", type);
@@ -311,7 +367,7 @@ binder_call_forwarding_query(
DBG_(self, "cls %d => %d", cls, RADIO_SERVICE_CLASS_NONE);
cls = RADIO_SERVICE_CLASS_NONE;
}
binder_call_forwarding_call(self, RADIO_REQ_GET_CALL_FORWARD_STATUS,
binder_call_forwarding_call(self, code,
RADIO_CALL_FORWARD_INTERROGATE, type, cls, NULL, CF_TIME_DEFAULT,
binder_call_forwarding_query_cb, BINDER_CB(cb), data);
}
@@ -321,6 +377,7 @@ gboolean
binder_call_forwarding_register(
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCallForwarding* self = user_data;
GASSERT(self->register_id);
@@ -336,11 +393,13 @@ binder_call_forwarding_probe(
unsigned int vendor,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderModem* modem = binder_modem_get_data(data);
BinderCallForwarding* self = g_new0(BinderCallForwarding, 1);
self->f = f;
self->g = radio_request_group_new(modem->client);
self->g = radio_request_group_new(modem->voice_client);
self->interface_aidl = radio_client_aidl_interface(modem->voice_client);
self->log_prefix = binder_dup_prefix(modem->log_prefix);
self->register_id = g_idle_add(binder_call_forwarding_register, self);
@@ -354,6 +413,7 @@ void
binder_call_forwarding_remove(
struct ofono_call_forwarding* f)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCallForwarding* self = binder_call_forwarding_get_data(f);
DBG_(self, "");
@@ -387,12 +447,14 @@ binder_call_forwarding_driver = {
void
binder_call_forwarding_init()
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ofono_call_forwarding_driver_register(&binder_call_forwarding_driver);
}
void
binder_call_forwarding_cleanup()
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ofono_call_forwarding_driver_unregister(&binder_call_forwarding_driver);
}

View File

@@ -21,8 +21,10 @@
#include <ofono/call-settings.h>
#include <ofono/log.h>
#include <radio_client.h>
#include <radio_request.h>
#include <radio_request_group.h>
#include <radio_voice_types.h>
#include <gbinder_reader.h>
#include <gbinder_writer.h>
@@ -30,6 +32,7 @@
typedef struct binder_call_settings {
struct ofono_call_settings* s;
RadioRequestGroup* g;
RADIO_AIDL_INTERFACE interface_aidl;
char* log_prefix;
guint register_id;
} BinderCallSettings;
@@ -58,6 +61,7 @@ binder_call_settings_callback_data_new(
BinderCallback cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCallSettingsCbData* cbd = g_slice_new0(BinderCallSettingsCbData);
cbd->self = self;
@@ -71,6 +75,7 @@ void
binder_call_settings_callback_data_free(
gpointer cbd)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
g_slice_free(BinderCallSettingsCbData, cbd);
}
@@ -83,6 +88,7 @@ binder_call_settings_call(
BinderCallback cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
RadioRequest* req = radio_request_new2(self->g, code, NULL, complete,
binder_call_settings_callback_data_free,
binder_call_settings_callback_data_new(self, cb, data));
@@ -101,6 +107,7 @@ binder_call_settings_set_cb(
const GBinderReader* args,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_error err;
const BinderCallSettingsCbData* cbd = user_data;
ofono_call_settings_set_cb_t cb = cbd->cb.set;
@@ -121,6 +128,7 @@ binder_call_settings_cw_set(
ofono_call_settings_set_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCallSettings* self = binder_call_settings_get_data(s);
/*
@@ -136,8 +144,10 @@ binder_call_settings_cw_set(
/* setCallWaiting(int32_t serial, bool enable, int32_t serviceClass); */
GBinderWriter writer;
guint32 code = self->interface_aidl == RADIO_VOICE_INTERFACE ?
RADIO_VOICE_REQ_SET_CALL_WAITING : RADIO_REQ_SET_CALL_WAITING;
RadioRequest* req = radio_request_new2(self->g,
RADIO_REQ_SET_CALL_WAITING, &writer,
code, &writer,
binder_call_settings_set_cb,
binder_call_settings_callback_data_free,
binder_call_settings_callback_data_new(self, BINDER_CB(cb), data));
@@ -155,6 +165,7 @@ binder_call_settings_cw_query_ok(
const BinderCallSettingsCbData* cbd,
const GBinderReader* args)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_error err;
ofono_call_settings_status_cb_t cb = cbd->cb.status;
GBinderReader reader;
@@ -191,11 +202,14 @@ binder_call_settings_cw_query_cb(
const GBinderReader* args,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_error err;
const BinderCallSettingsCbData* cbd = user_data;
if (status == RADIO_TX_STATUS_OK) {
if (resp == RADIO_RESP_GET_CALL_WAITING) {
guint32 code = cbd->self->interface_aidl == RADIO_VOICE_INTERFACE ?
RADIO_VOICE_RESP_GET_CALL_WAITING : RADIO_RESP_GET_CALL_WAITING;
if (resp == code) {
if (error == RADIO_ERROR_NONE) {
if (binder_call_settings_cw_query_ok(cbd, args)) {
return;
@@ -217,6 +231,7 @@ void binder_call_settings_cw_query(
ofono_call_settings_status_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCallSettings* self = binder_call_settings_get_data(s);
/*
@@ -232,8 +247,10 @@ void binder_call_settings_cw_query(
/* getCallWaiting(int32_t serial, int32_t serviceClass); */
GBinderWriter writer;
guint32 code = self->interface_aidl == RADIO_VOICE_INTERFACE ?
RADIO_VOICE_REQ_GET_CALL_WAITING : RADIO_REQ_GET_CALL_WAITING;
RadioRequest* req = radio_request_new2(self->g,
RADIO_REQ_GET_CALL_WAITING, &writer,
code, &writer,
binder_call_settings_cw_query_cb,
binder_call_settings_callback_data_free,
binder_call_settings_callback_data_new(self, BINDER_CB(cb), data));
@@ -250,6 +267,7 @@ binder_call_settings_clip_query_ok(
const BinderCallSettingsCbData* cbd,
const GBinderReader* args)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_error err;
GBinderReader reader;
gint32 status;
@@ -273,11 +291,14 @@ binder_call_settings_clip_query_cb(
const GBinderReader* args,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_error err;
const BinderCallSettingsCbData* cbd = user_data;
if (status == RADIO_TX_STATUS_OK) {
if (resp == RADIO_RESP_GET_CLIP) {
guint32 code = cbd->self->interface_aidl == RADIO_VOICE_INTERFACE ?
RADIO_VOICE_RESP_GET_CLIP : RADIO_RESP_GET_CLIP;
if (resp == code) {
if (error == RADIO_ERROR_NONE) {
if (binder_call_settings_clip_query_ok(cbd, args)) {
return;
@@ -299,11 +320,14 @@ binder_call_settings_clip_query(
ofono_call_settings_status_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCallSettings* self = binder_call_settings_get_data(s);
guint32 code = self->interface_aidl == RADIO_VOICE_INTERFACE ?
RADIO_VOICE_REQ_GET_CLIP : RADIO_REQ_GET_CLIP;
DBG_(self, "");
/* getClip(int32_t serial); */
binder_call_settings_call(self, RADIO_REQ_GET_CLIP,
binder_call_settings_call(self, code,
binder_call_settings_clip_query_cb, BINDER_CB(cb), data);
}
@@ -313,6 +337,7 @@ binder_call_settings_clir_ok(
const BinderCallSettingsCbData* cbd,
const GBinderReader* args)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_error err;
GBinderReader reader;
gint32 n, m;
@@ -338,11 +363,14 @@ binder_call_settings_clir_cb(
const GBinderReader* args,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_error err;
const BinderCallSettingsCbData* cbd = user_data;
if (status == RADIO_TX_STATUS_OK) {
if (resp == RADIO_RESP_GET_CLIR) {
guint32 code = cbd->self->interface_aidl == RADIO_VOICE_INTERFACE ?
RADIO_VOICE_RESP_GET_CLIR : RADIO_RESP_GET_CLIR;
if (resp == code) {
if (error == RADIO_ERROR_NONE) {
if (binder_call_settings_clir_ok(cbd, args)) {
return;
@@ -364,11 +392,14 @@ binder_call_settings_clir_query(
ofono_call_settings_clir_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCallSettings* self = binder_call_settings_get_data(s);
guint32 code = self->interface_aidl == RADIO_VOICE_INTERFACE ?
RADIO_VOICE_REQ_GET_CLIR : RADIO_REQ_GET_CLIR;
DBG_(self, "");
/* getClir(int32_t serial); */
binder_call_settings_call(self, RADIO_REQ_GET_CLIR,
binder_call_settings_call(self, code,
binder_call_settings_clir_cb , BINDER_CB(cb), data);
}
@@ -380,12 +411,15 @@ binder_call_settings_clir_set(
ofono_call_settings_set_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCallSettings* self = binder_call_settings_get_data(s);
guint32 code = self->interface_aidl == RADIO_VOICE_INTERFACE ?
RADIO_VOICE_REQ_SET_CLIR : RADIO_REQ_SET_CLIR;
/* setClir(int32_t serial, int32_t status); */
GBinderWriter writer;
RadioRequest* req = radio_request_new2(self->g,
RADIO_REQ_SET_CLIR, &writer,
code, &writer,
binder_call_settings_set_cb,
binder_call_settings_callback_data_free,
binder_call_settings_callback_data_new(self, BINDER_CB(cb), data));
@@ -402,6 +436,7 @@ gboolean
binder_call_settings_register(
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCallSettings* self = user_data;
DBG_(self, "");
@@ -418,11 +453,13 @@ binder_call_settings_probe(
unsigned int vendor,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderModem* modem = binder_modem_get_data(data);
BinderCallSettings* self = g_new0(BinderCallSettings, 1);
self->s = s;
self->g = radio_request_group_new(modem->client);
self->g = radio_request_group_new(modem->voice_client);
self->interface_aidl = radio_client_aidl_interface(modem->voice_client);
self->log_prefix = binder_dup_prefix(modem->log_prefix);
self->register_id = g_idle_add(binder_call_settings_register, self);
@@ -436,6 +473,7 @@ void
binder_call_settings_remove(
struct ofono_call_settings* s)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCallSettings* self = binder_call_settings_get_data(s);
DBG_(self, "");
@@ -468,12 +506,14 @@ static const struct ofono_call_settings_driver binder_call_settings_driver = {
void
binder_call_settings_init()
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ofono_call_settings_driver_register(&binder_call_settings_driver);
}
void
binder_call_settings_cleanup()
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ofono_call_settings_driver_unregister(&binder_call_settings_driver);
}

View File

@@ -21,8 +21,10 @@
#include <ofono/call-volume.h>
#include <ofono/log.h>
#include <radio_client.h>
#include <radio_request.h>
#include <radio_request_group.h>
#include <radio_voice_types.h>
#include <gbinder_reader.h>
#include <gbinder_writer.h>
@@ -30,11 +32,13 @@
typedef struct binder_call_volume {
struct ofono_call_volume* v;
RadioRequestGroup* g;
RADIO_AIDL_INTERFACE interface_aidl;
char* log_prefix;
guint register_id;
} BinderCallVolume;
typedef struct binder_call_volume_req {
BinderCallVolume* self;
ofono_call_volume_cb_t cb;
gpointer data;
} BinderCallVolumeCbData;
@@ -48,11 +52,14 @@ binder_call_volume_get_data(struct ofono_call_volume* v)
static
BinderCallVolumeCbData*
binder_call_volume_callback_data_new(
BinderCallVolume* self,
ofono_call_volume_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCallVolumeCbData* cbd = g_slice_new0(BinderCallVolumeCbData);
cbd->self = self;
cbd->cb = cb;
cbd->data = data;
return cbd;
@@ -63,6 +70,7 @@ void
binder_call_volume_callback_data_free(
gpointer cbd)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
g_slice_free(BinderCallVolumeCbData, cbd);
}
@@ -76,12 +84,15 @@ binder_call_volume_mute_cb(
const GBinderReader* args,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_error err;
const BinderCallVolumeCbData* cbd = user_data;
ofono_call_volume_cb_t cb = cbd->cb;
if (status == RADIO_TX_STATUS_OK) {
if (resp == RADIO_RESP_SET_MUTE) {
guint32 code = cbd->self->interface_aidl == RADIO_VOICE_INTERFACE ?
RADIO_VOICE_RESP_SET_MUTE : RADIO_RESP_SET_MUTE;
if (resp == code) {
if (error == RADIO_ERROR_NONE) {
cb(binder_error_ok(&err), cbd->data);
return;
@@ -103,15 +114,18 @@ binder_call_volume_mute(
ofono_call_volume_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCallVolume* self = binder_call_volume_get_data(v);
guint32 code = self->interface_aidl == RADIO_VOICE_INTERFACE ?
RADIO_VOICE_REQ_SET_MUTE : RADIO_REQ_SET_MUTE;
/* setMute(int32_t serial, bool enable); */
GBinderWriter writer;
RadioRequest* req = radio_request_new2(self->g,
RADIO_REQ_SET_MUTE, &writer,
code, &writer,
binder_call_volume_mute_cb,
binder_call_volume_callback_data_free,
binder_call_volume_callback_data_new(cb, data));
binder_call_volume_callback_data_new(self, cb, data));
DBG_(self, "%d", muted);
gbinder_writer_append_bool(&writer, muted); /* enabled */
@@ -130,8 +144,12 @@ binder_call_volume_query_mute_cb(
const GBinderReader* args,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
const BinderCallVolume* self = user_data;
if (status == RADIO_TX_STATUS_OK) {
if (resp == RADIO_RESP_GET_MUTE) {
guint32 code = self->interface_aidl == RADIO_VOICE_INTERFACE ?
RADIO_VOICE_RESP_GET_MUTE : RADIO_RESP_GET_MUTE;
if (resp == code) {
if (error == RADIO_ERROR_NONE) {
GBinderReader reader;
gboolean muted;
@@ -158,7 +176,10 @@ gboolean
binder_call_volume_register(
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCallVolume* self = user_data;
guint32 code = self->interface_aidl == RADIO_VOICE_INTERFACE ?
RADIO_VOICE_REQ_GET_MUTE : RADIO_REQ_GET_MUTE;
DBG_(self, "");
GASSERT(self->register_id);
@@ -166,7 +187,7 @@ binder_call_volume_register(
ofono_call_volume_register(self->v);
/* Probe the mute state */
binder_submit_request2(self->g, RADIO_REQ_GET_MUTE,
binder_submit_request2(self->g, code,
binder_call_volume_query_mute_cb, NULL, self);
return G_SOURCE_REMOVE;
@@ -179,11 +200,13 @@ binder_call_volume_probe(
unsigned int vendor,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderModem* modem = binder_modem_get_data(data);
BinderCallVolume* self = g_new0(BinderCallVolume, 1);
self->v = v;
self->g = radio_request_group_new(modem->client);
self->g = radio_request_group_new(modem->voice_client);
self->interface_aidl = radio_client_aidl_interface(modem->voice_client);
self->log_prefix = binder_dup_prefix(modem->log_prefix);
self->register_id = g_idle_add(binder_call_volume_register, self);
@@ -197,6 +220,7 @@ void
binder_call_volume_remove(
struct ofono_call_volume* v)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCallVolume* self = binder_call_volume_get_data(v);
DBG_(self, "");
@@ -225,12 +249,14 @@ static const struct ofono_call_volume_driver binder_call_volume_driver = {
void
binder_call_volume_init()
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ofono_call_volume_driver_register(&binder_call_volume_driver);
}
void
binder_call_volume_cleanup()
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ofono_call_volume_driver_unregister(&binder_call_volume_driver);
}

View File

@@ -24,6 +24,7 @@
#include <radio_client.h>
#include <radio_request.h>
#include <radio_request_group.h>
#include <radio_messaging_types.h>
#include <gbinder_reader.h>
#include <gbinder_writer.h>
@@ -34,6 +35,7 @@
typedef struct binder_cbs {
struct ofono_cbs* cbs;
RadioRequestGroup* g;
RADIO_AIDL_INTERFACE interface_aidl;
char* log_prefix;
guint register_id;
gulong event_id;
@@ -60,6 +62,7 @@ binder_cbs_callback_data_new(
ofono_cbs_set_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCbsCbData* cbd = g_slice_new0(BinderCbsCbData);
cbd->self = self;
@@ -73,6 +76,7 @@ void
binder_cbs_callback_data_free(
gpointer cbd)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
g_slice_free(BinderCbsCbData, cbd);
}
@@ -86,6 +90,7 @@ binder_cbs_retry(
const GBinderReader* args,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return error == RADIO_ERROR_INVALID_STATE;
}
@@ -99,11 +104,15 @@ binder_cbs_activate_cb(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_error err;
BinderCbsCbData* cbd = user_data;
guint32 code = cbd->self->interface_aidl == RADIO_MESSAGING_INTERFACE ?
RADIO_MESSAGING_RESP_SET_GSM_BROADCAST_ACTIVATION :
RADIO_RESP_SET_GSM_BROADCAST_ACTIVATION;
if (status == RADIO_TX_STATUS_OK) {
if (resp == RADIO_RESP_SET_GSM_BROADCAST_ACTIVATION) {
if (resp == code) {
if (error == RADIO_ERROR_NONE) {
cbd->cb(binder_error_ok(&err), cbd->data);
return;
@@ -127,10 +136,14 @@ binder_cbs_activate(
ofono_cbs_set_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
/* setGsmBroadcastActivation(int32_t serial, bool activate); */
GBinderWriter writer;
guint32 code = self->interface_aidl == RADIO_MESSAGING_INTERFACE ?
RADIO_MESSAGING_REQ_SET_GSM_BROADCAST_ACTIVATION :
RADIO_REQ_SET_GSM_BROADCAST_ACTIVATION;
RadioRequest* req = radio_request_new2(self->g,
RADIO_REQ_SET_GSM_BROADCAST_ACTIVATION, &writer,
code, &writer,
binder_cbs_activate_cb,
binder_cbs_callback_data_free,
binder_cbs_callback_data_new(self, cb, data));
@@ -153,11 +166,15 @@ binder_cbs_set_config_cb(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCbsCbData* cbd = user_data;
struct ofono_error err;
if (status == RADIO_TX_STATUS_OK) {
if (resp == RADIO_RESP_SET_GSM_BROADCAST_CONFIG) {
guint32 code = cbd->self->interface_aidl == RADIO_MESSAGING_INTERFACE ?
RADIO_MESSAGING_RESP_SET_GSM_BROADCAST_CONFIG :
RADIO_RESP_SET_GSM_BROADCAST_CONFIG;
if (resp == code) {
if (error == RADIO_ERROR_NONE) {
binder_cbs_activate(cbd->self, TRUE, cbd->cb, cbd->data);
return;
@@ -180,51 +197,87 @@ binder_cbs_set_config(
ofono_cbs_set_cb_t cb,
void* data)
{
/* setGsmBroadcastConfig(int32_t serial, vec<GsmBroadcastSmsConfigInfo>); */
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
GBinderWriter writer;
guint32 code = self->interface_aidl == RADIO_MESSAGING_INTERFACE ?
RADIO_MESSAGING_REQ_SET_GSM_BROADCAST_CONFIG :
RADIO_REQ_SET_GSM_BROADCAST_CONFIG;
RadioRequest* req = radio_request_new2(self->g,
RADIO_REQ_SET_GSM_BROADCAST_CONFIG, &writer,
code, &writer,
binder_cbs_set_config_cb,
binder_cbs_callback_data_free,
binder_cbs_callback_data_new(self, cb, data));
GBinderParent parent;
GBinderHidlVec* vec = gbinder_writer_new0(&writer, GBinderHidlVec);
RadioGsmBroadcastSmsConfig* configs = NULL;
char** list = topics ? g_strsplit(topics, ",", 0) : NULL;
const guint count = gutil_strv_length(list);
guint i;
vec->count = count;
vec->owns_buffer = TRUE;
vec->data.ptr = configs = gbinder_writer_malloc0(&writer,
sizeof(RadioGsmBroadcastSmsConfig) * count);
if (self->interface_aidl == RADIO_AIDL_INTERFACE_NONE) {
/* setGsmBroadcastConfig(int32_t serial, vec<GsmBroadcastSmsConfigInfo>); */
GBinderParent parent;
GBinderHidlVec* vec = gbinder_writer_new0(&writer, GBinderHidlVec);
RadioGsmBroadcastSmsConfig* configs = NULL;
guint i;
for (i = 0; i < count; i++) {
RadioGsmBroadcastSmsConfig* config = configs + i;
const char* entry = list[i];
const char* delim = strchr(entry, '-');
vec->count = count;
vec->owns_buffer = TRUE;
vec->data.ptr = configs = gbinder_writer_malloc0(&writer,
sizeof(RadioGsmBroadcastSmsConfig) * count);
config->selected = TRUE;
config->toCodeScheme = 0xff;
if (delim) {
char** range = g_strsplit(entry, "-", 0);
for (i = 0; i < count; i++) {
RadioGsmBroadcastSmsConfig* config = configs + i;
const char* entry = list[i];
const char* delim = strchr(entry, '-');
config->fromServiceId = atoi(range[0]);
config->toServiceId = atoi(range[1]);
g_strfreev(range);
} else {
config->fromServiceId = config->toServiceId = atoi(entry);
config->selected = TRUE;
config->toCodeScheme = 0xff;
if (delim) {
char** range = g_strsplit(entry, "-", 0);
config->fromServiceId = atoi(range[0]);
config->toServiceId = atoi(range[1]);
g_strfreev(range);
} else {
config->fromServiceId = config->toServiceId = atoi(entry);
}
}
/* Every vector, even the one without data, requires two buffer objects */
parent.offset = GBINDER_HIDL_VEC_BUFFER_OFFSET;
parent.index = gbinder_writer_append_buffer_object(&writer, vec,
sizeof(*vec));
gbinder_writer_append_buffer_object_with_parent(&writer, configs,
sizeof(configs[0]) * count, &parent);
} else {
/* setGsmBroadcastConfig(int32_t serial, GsmBroadcastSmsConfigInfo[]); */
guint i;
gbinder_writer_append_int32(&writer, count);
for (i = 0; i < count; i++) {
const char* entry = list[i];
const char* delim = strchr(entry, '-');
/* Non-null parcelable */
gbinder_writer_append_int32(&writer, 1);
/* Parcelable size */
gbinder_writer_append_int32(&writer, 6 * sizeof(gint32));
if (delim) {
char** range = g_strsplit(entry, "-", 0);
gbinder_writer_append_int32(&writer, atoi(range[0]));
gbinder_writer_append_int32(&writer, atoi(range[1]));
g_strfreev(range);
} else {
gbinder_writer_append_int32(&writer, atoi(entry));
gbinder_writer_append_int32(&writer, atoi(entry));
}
gbinder_writer_append_int32(&writer, 0);
gbinder_writer_append_int32(&writer, 0xff);
gbinder_writer_append_bool(&writer, TRUE);
}
}
/* Every vector, even the one without data, requires two buffer objects */
parent.offset = GBINDER_HIDL_VEC_BUFFER_OFFSET;
parent.index = gbinder_writer_append_buffer_object(&writer, vec,
sizeof(*vec));
gbinder_writer_append_buffer_object_with_parent(&writer, configs,
sizeof(configs[0]) * count, &parent);
DBG_(self, "configuring CB");
radio_request_set_retry_func(req, binder_cbs_retry);
radio_request_set_retry(req, CBS_CHECK_RETRY_MS, CBS_CHECK_RETRY_COUNT);
@@ -241,6 +294,7 @@ binder_cbs_set_topics(
ofono_cbs_set_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCbs* self = binder_cbs_get_data(cbs);
DBG_(self, "%s", topics);
@@ -254,6 +308,7 @@ binder_cbs_clear_topics(
ofono_cbs_set_cb_t cb,
void *data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCbs* self = binder_cbs_get_data(cbs);
DBG_(self, "");
@@ -268,15 +323,23 @@ binder_cbs_notify(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCbs* self = user_data;
GBinderReader reader;
const guchar* ptr;
gsize len;
guint32 ind_code = self->interface_aidl == RADIO_MESSAGING_INTERFACE ?
RADIO_MESSAGING_IND_NEW_BROADCAST_SMS :
RADIO_IND_NEW_BROADCAST_SMS;
/* newBroadcastSms(RadioIndicationType type, vec<uint8_t> data); */
GASSERT(code == RADIO_IND_NEW_BROADCAST_SMS);
GASSERT(code == ind_code);
gbinder_reader_copy(&reader, args);
ptr = gbinder_reader_read_hidl_byte_vec(&reader, &len);
if (self->interface_aidl == RADIO_AIDL_INTERFACE_NONE) {
ptr = gbinder_reader_read_hidl_byte_vec(&reader, &len);
} else {
ptr = gbinder_reader_read_byte_array(&reader, &len);
}
/* By default assume that it's a length followed by the binary PDU data. */
if (ptr) {
@@ -303,14 +366,18 @@ gboolean
binder_cbs_register(
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCbs* self = user_data;
RadioClient* client = self->g->client;
guint32 code = self->interface_aidl == RADIO_MESSAGING_INTERFACE ?
RADIO_MESSAGING_IND_NEW_BROADCAST_SMS :
RADIO_IND_NEW_BROADCAST_SMS;
GASSERT(self->register_id);
self->register_id = 0;
DBG_(self, "registering for CB");
self->event_id = radio_client_add_indication_handler(client,
RADIO_IND_NEW_BROADCAST_SMS, binder_cbs_notify, self);
code, binder_cbs_notify, self);
ofono_cbs_register(self->cbs);
return G_SOURCE_REMOVE;
}
@@ -322,11 +389,13 @@ binder_cbs_probe(
unsigned int vendor,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderModem* modem = binder_modem_get_data(data);
BinderCbs* self = g_new0(BinderCbs, 1);
self->cbs = cbs;
self->g = radio_request_group_new(modem->client); /* Keeps ref to client */
self->g = radio_request_group_new(modem->messaging_client); /* Keeps ref to client */
self->interface_aidl = radio_client_aidl_interface(modem->messaging_client);
self->log_prefix = binder_dup_prefix(modem->log_prefix);
self->register_id = g_idle_add(binder_cbs_register, self);
@@ -340,6 +409,7 @@ void
binder_cbs_remove(
struct ofono_cbs* cbs)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCbs* self = binder_cbs_get_data(cbs);
DBG_(self, "");
@@ -370,12 +440,14 @@ static const struct ofono_cbs_driver binder_cbs_driver = {
void
binder_cbs_init()
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ofono_cbs_driver_register(&binder_cbs_driver);
}
void
binder_cbs_cleanup()
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ofono_cbs_driver_unregister(&binder_cbs_driver);
}

View File

@@ -20,9 +20,12 @@
#include "binder_log.h"
#include <radio_client.h>
#include <radio_instance.h>
#include <radio_request.h>
#include <radio_util.h>
#include <radio_network_types.h>
#include <gbinder_reader.h>
#include <gbinder_writer.h>
@@ -46,6 +49,7 @@ typedef struct binder_cell_info {
GObject object;
struct ofono_cell_info info;
struct ofono_cell **cells;
RadioInstance* instance;
RadioClient* client;
BinderRadio* radio;
BinderSimCard* sim_card;
@@ -91,6 +95,7 @@ binder_cell_info_int_format(
int value,
const char* format)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (value == OFONO_CELL_INVALID_VALUE) {
return "";
} else {
@@ -108,6 +113,7 @@ binder_cell_info_int64_format(
guint64 value,
const char* format)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (value == OFONO_CELL_INVALID_VALUE_INT64) {
return "";
} else {
@@ -125,6 +131,7 @@ binder_cell_info_list_compare(
gconstpointer a,
gconstpointer b)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return ofono_cell_compare_location(*(struct ofono_cell**)a,
*(struct ofono_cell**)b);
}
@@ -135,6 +142,7 @@ binder_cell_info_list_equal(
const ofono_cell_ptr* l1,
const ofono_cell_ptr* l2)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (l1 && l2) {
while (*l1 && *l2) {
if (memcmp(*l1, *l2, sizeof(struct ofono_cell))) {
@@ -154,6 +162,7 @@ void
binder_cell_info_clear(
BinderCellInfo* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (self->cells && self->cells[0]) {
gutil_ptrv_free((void**)self->cells);
self->info.cells = self->cells = g_new0(struct ofono_cell*, 1);
@@ -168,6 +177,7 @@ binder_cell_info_update_cells(
BinderCellInfo* self,
GPtrArray* l)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (l) {
g_ptr_array_sort(l, binder_cell_info_list_compare);
g_ptr_array_add(l, NULL);
@@ -193,6 +203,7 @@ binder_cell_info_invalidate(
void* info,
gsize size)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
const int n = size/sizeof(int);
int* value = info;
int i;
@@ -207,6 +218,7 @@ void
binder_cell_info_invalidate_nr(
struct ofono_cell_info_nr* nr)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
nr->mcc = OFONO_CELL_INVALID_VALUE;
nr->mnc = OFONO_CELL_INVALID_VALUE;
nr->nci = OFONO_CELL_INVALID_VALUE_INT64;
@@ -228,6 +240,7 @@ binder_cell_info_new_cell_gsm(
const RadioCellIdentityGsm* id,
const RadioSignalStrengthGsm* ss)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_cell* cell = binder_cell_new();
struct ofono_cell_info_gsm* gsm = &cell->info.gsm;
@@ -265,6 +278,7 @@ binder_cell_info_new_cell_wcdma(
const RadioCellIdentityWcdma* id,
const RadioSignalStrengthWcdma* ss)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_cell* cell = binder_cell_new();
struct ofono_cell_info_wcdma* wcdma = &cell->info.wcdma;
@@ -298,6 +312,7 @@ binder_cell_info_new_cell_lte(
const RadioCellIdentityLte* id,
const RadioSignalStrengthLte* ss)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_cell* cell = binder_cell_new();
struct ofono_cell_info_lte* lte = &cell->info.lte;
@@ -338,6 +353,7 @@ binder_cell_info_new_cell_nr(
const RadioCellIdentityNr* id,
const RadioSignalStrengthNr* ss)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_cell* cell = binder_cell_new();
struct ofono_cell_info_nr* nr = &cell->info.nr;
@@ -372,12 +388,248 @@ binder_cell_info_new_cell_nr(
return cell;
}
static
struct ofono_cell*
binder_cell_info_new_cell_gsm_aidl(
gboolean registered,
GBinderReader* reader)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_cell* cell = binder_cell_new();
struct ofono_cell_info_gsm* gsm = &cell->info.gsm;
gsize data_read;
gsize initial_size;
gsize parcel_size;
cell->type = OFONO_CELL_TYPE_GSM;
cell->registered = registered;
binder_cell_info_invalidate(gsm, sizeof(*gsm));
/* CellInfoGsm */
if (binder_read_parcelable_size(reader)) {
/* CellIdentityGsm */
parcel_size = binder_read_parcelable_size(reader);
initial_size = gbinder_reader_bytes_read(reader);
binder_read_string16_parse_int(reader, &gsm->mcc);
binder_read_string16_parse_int(reader, &gsm->mnc);
gbinder_reader_read_int32(reader, &gsm->lac);
gbinder_reader_read_int32(reader, &gsm->cid);
gbinder_reader_read_int32(reader, &gsm->arfcn);
gbinder_reader_read_int32(reader, &gsm->bsic);
data_read = gbinder_reader_bytes_read(reader) - initial_size;
while (data_read < parcel_size) {
gbinder_reader_read_uint32(reader, NULL);
data_read += sizeof(guint32);
}
/* SignalStrengthGsm */
binder_read_parcelable_size(reader);
gbinder_reader_read_int32(reader, &gsm->signalStrength);
gbinder_reader_read_int32(reader, &gsm->bitErrorRate);
gbinder_reader_read_int32(reader, &gsm->timingAdvance);
}
DBG("[gsm] reg=%d%s%s%s%s%s%s%s%s%s", registered,
binder_cell_info_int_format(gsm->mcc, ",mcc=%d"),
binder_cell_info_int_format(gsm->mnc, ",mnc=%d"),
binder_cell_info_int_format(gsm->lac, ",lac=%d"),
binder_cell_info_int_format(gsm->cid, ",cid=%d"),
binder_cell_info_int_format(gsm->arfcn, ",arfcn=%d"),
binder_cell_info_int_format(gsm->bsic, ",bsic=%d"),
binder_cell_info_int_format(gsm->signalStrength, ",strength=%d"),
binder_cell_info_int_format(gsm->bitErrorRate, ",err=%d"),
binder_cell_info_int_format(gsm->timingAdvance, ",t=%d"));
return cell;
}
static
struct
ofono_cell*
binder_cell_info_new_cell_wcdma_aidl(
gboolean registered,
GBinderReader* reader)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_cell* cell = binder_cell_new();
struct ofono_cell_info_wcdma* wcdma = &cell->info.wcdma;
gsize data_read;
gsize initial_size;
gsize parcel_size;
cell->type = OFONO_CELL_TYPE_WCDMA;
cell->registered = registered;
binder_cell_info_invalidate(wcdma, sizeof(*wcdma));
/* CellInfoWcdma */
if (binder_read_parcelable_size(reader)) {
/* CellIdentityWcdma */
parcel_size = binder_read_parcelable_size(reader);
initial_size = gbinder_reader_bytes_read(reader);
binder_read_string16_parse_int(reader, &wcdma->mcc);
binder_read_string16_parse_int(reader, &wcdma->mnc);
gbinder_reader_read_int32(reader, &wcdma->lac);
gbinder_reader_read_int32(reader, &wcdma->cid);
gbinder_reader_read_int32(reader, &wcdma->psc);
gbinder_reader_read_int32(reader, &wcdma->uarfcn);
data_read = gbinder_reader_bytes_read(reader) - initial_size;
while (data_read < parcel_size) {
gbinder_reader_read_uint32(reader, NULL);
data_read += sizeof(guint32);
}
/* SignalStrengthWcdma */
binder_read_parcelable_size(reader);
gbinder_reader_read_int32(reader, &wcdma->signalStrength);
gbinder_reader_read_int32(reader, &wcdma->bitErrorRate);
gbinder_reader_read_int32(reader, NULL); /* rscp */
gbinder_reader_read_int32(reader, NULL); /* ecno */
}
DBG("[wcdma] reg=%d%s%s%s%s%s%s%s", registered,
binder_cell_info_int_format(wcdma->mcc, ",mcc=%d"),
binder_cell_info_int_format(wcdma->mnc, ",mnc=%d"),
binder_cell_info_int_format(wcdma->lac, ",lac=%d"),
binder_cell_info_int_format(wcdma->cid, ",cid=%d"),
binder_cell_info_int_format(wcdma->psc, ",psc=%d"),
binder_cell_info_int_format(wcdma->signalStrength, ",strength=%d"),
binder_cell_info_int_format(wcdma->bitErrorRate, ",err=%d"));
return cell;
}
static
struct ofono_cell*
binder_cell_info_new_cell_lte_aidl(
gboolean registered,
GBinderReader* reader)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_cell* cell = binder_cell_new();
struct ofono_cell_info_lte* lte = &cell->info.lte;
gsize data_read;
gsize initial_size;
gsize parcel_size;
cell->type = OFONO_CELL_TYPE_LTE;
cell->registered = registered;
binder_cell_info_invalidate(lte, sizeof(*lte));
/* CellInfoLte */
if (binder_read_parcelable_size(reader)) {
/* CellIdentityLte */
parcel_size = binder_read_parcelable_size(reader);
initial_size = gbinder_reader_bytes_read(reader);
binder_read_string16_parse_int(reader, &lte->mcc);
binder_read_string16_parse_int(reader, &lte->mnc);
gbinder_reader_read_int32(reader, &lte->ci);
gbinder_reader_read_int32(reader, &lte->pci);
gbinder_reader_read_int32(reader, &lte->tac);
gbinder_reader_read_int32(reader, &lte->earfcn);
data_read = gbinder_reader_bytes_read(reader) - initial_size;
while (data_read < parcel_size) {
gbinder_reader_read_uint32(reader, NULL);
data_read += sizeof(guint32);
}
/* SignalStrengthLte */
binder_read_parcelable_size(reader);
gbinder_reader_read_int32(reader, &lte->signalStrength);
gbinder_reader_read_int32(reader, &lte->rsrp);
gbinder_reader_read_int32(reader, &lte->rsrq);
gbinder_reader_read_int32(reader, &lte->rssnr);
gbinder_reader_read_int32(reader, &lte->cqi);
gbinder_reader_read_int32(reader, &lte->timingAdvance);
gbinder_reader_read_int32(reader, NULL);
}
DBG("[lte] reg=%d%s%s%s%s%s%s%s%s%s%s%s", registered,
binder_cell_info_int_format(lte->mcc, ",mcc=%d"),
binder_cell_info_int_format(lte->mnc, ",mnc=%d"),
binder_cell_info_int_format(lte->ci, ",ci=%d"),
binder_cell_info_int_format(lte->pci, ",pci=%d"),
binder_cell_info_int_format(lte->tac, ",tac=%d"),
binder_cell_info_int_format(lte->signalStrength, ",strength=%d"),
binder_cell_info_int_format(lte->rsrp, ",rsrp=%d"),
binder_cell_info_int_format(lte->rsrq, ",rsrq=%d"),
binder_cell_info_int_format(lte->rssnr, ",rssnr=%d"),
binder_cell_info_int_format(lte->cqi, ",cqi=%d"),
binder_cell_info_int_format(lte->timingAdvance, ",t=%d"));
return cell;
}
static
struct ofono_cell*
binder_cell_info_new_cell_nr_aidl(
gboolean registered,
GBinderReader* reader)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_cell* cell = binder_cell_new();
struct ofono_cell_info_nr* nr = &cell->info.nr;
gsize data_read;
gsize initial_size;
gsize parcel_size;
cell->type = OFONO_CELL_TYPE_NR;
cell->registered = registered;
binder_cell_info_invalidate_nr(nr);
/* CellInfoNr */
if (binder_read_parcelable_size(reader)) {
/* CellIdentityNr */
parcel_size = binder_read_parcelable_size(reader);
initial_size = gbinder_reader_bytes_read(reader);
binder_read_string16_parse_int(reader, &nr->mcc);
binder_read_string16_parse_int(reader, &nr->mnc);
gbinder_reader_read_int64(reader, &nr->nci);
gbinder_reader_read_int32(reader, &nr->pci);
gbinder_reader_read_int32(reader, &nr->tac);
gbinder_reader_read_int32(reader, &nr->nrarfcn);
data_read = gbinder_reader_bytes_read(reader) - initial_size;
while (data_read < parcel_size) {
gbinder_reader_read_uint32(reader, NULL);
data_read += sizeof(guint32);
}
/* SignalStrengthNr */
parcel_size = binder_read_parcelable_size(reader);
initial_size = gbinder_reader_bytes_read(reader);
gbinder_reader_read_int32(reader, &nr->ssRsrp);
gbinder_reader_read_int32(reader, &nr->ssRsrp);
gbinder_reader_read_int32(reader, &nr->ssSinr);
gbinder_reader_read_int32(reader, &nr->csiRsrp);
gbinder_reader_read_int32(reader, &nr->csiRsrq);
gbinder_reader_read_int32(reader, &nr->csiSinr);
data_read = gbinder_reader_bytes_read(reader) - initial_size;
while (data_read < parcel_size) {
gbinder_reader_read_uint32(reader, NULL);
data_read += sizeof(guint32);
}
}
DBG("[nr] reg=%d%s%s%s%s%s%s%s%s%s%s%s", registered,
binder_cell_info_int_format(nr->mcc, ",mcc=%d"),
binder_cell_info_int_format(nr->mnc, ",mnc=%d"),
binder_cell_info_int64_format(nr->nci, ",nci=%" G_GINT64_FORMAT),
binder_cell_info_int_format(nr->pci, ",pci=%d"),
binder_cell_info_int_format(nr->tac, ",tac=%d"),
binder_cell_info_int_format(nr->ssRsrp, ",ssRsrp=%d"),
binder_cell_info_int_format(nr->ssRsrq, ",ssRsrq=%d"),
binder_cell_info_int_format(nr->ssSinr, ",ssSinr=%d"),
binder_cell_info_int_format(nr->csiRsrp, ",csiRsrp=%d"),
binder_cell_info_int_format(nr->csiRsrq, ",csiRsrq=%d"),
binder_cell_info_int_format(nr->csiSinr, ",csiSinr=%d"));
return cell;
}
static
GPtrArray*
binder_cell_info_array_new_1_0(
const RadioCellInfo* cells,
gsize count)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
gsize i;
GPtrArray* l = g_ptr_array_sized_new(count + 1);
@@ -429,6 +681,7 @@ binder_cell_info_array_new_1_2(
const RadioCellInfo_1_2* cells,
gsize count)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
gsize i;
GPtrArray* l = g_ptr_array_sized_new(count + 1);
@@ -480,6 +733,7 @@ binder_cell_info_array_new_1_4(
const RadioCellInfo_1_4* cells,
gsize count)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
gsize i;
GPtrArray* l = g_ptr_array_sized_new(count + 1);
@@ -523,6 +777,7 @@ binder_cell_info_array_new_1_5(
const RadioCellInfo_1_5* cells,
gsize count)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
gsize i;
GPtrArray* l = g_ptr_array_sized_new(count + 1);
@@ -560,12 +815,66 @@ binder_cell_info_array_new_1_5(
return l;
}
static
GPtrArray*
binder_cell_info_array_new_aidl(
GBinderReader* reader)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
gsize i;
gint32 count = 0;
GPtrArray* l;
gbinder_reader_read_int32(reader, &count);
l = g_ptr_array_sized_new(count + 1);
for (i = 0; i < count; i++) {
gboolean registered;
gint32 type;
if (!binder_read_parcelable_size(reader)) {
continue;
}
gbinder_reader_read_bool(reader, &registered);
gbinder_reader_read_int32(reader, NULL); /* connectionStatus */
gbinder_reader_read_int32(reader, NULL); /* non-null rat specific info union */
gbinder_reader_read_int32(reader, &type);
switch (type) {
case RADIO_CELL_INFO_1_5_GSM:
g_ptr_array_add(l, binder_cell_info_new_cell_gsm_aidl(registered,
reader));
continue;
case RADIO_CELL_INFO_1_5_LTE:
g_ptr_array_add(l, binder_cell_info_new_cell_lte_aidl(registered,
reader));
continue;
case RADIO_CELL_INFO_1_5_WCDMA:
g_ptr_array_add(l, binder_cell_info_new_cell_wcdma_aidl(registered,
reader));
continue;
case RADIO_CELL_INFO_1_5_NR:
g_ptr_array_add(l, binder_cell_info_new_cell_nr_aidl(registered,
reader));
continue;
case RADIO_CELL_INFO_1_5_TD_SCDMA:
case RADIO_CELL_INFO_1_5_CDMA:
/* Skip not implemented cell info types */
gbinder_reader_read_parcelable(reader, NULL);
break;
}
DBG("unsupported cell type %d", type);
gbinder_reader_read_parcelable(reader, NULL);
}
return l;
}
static
void
binder_cell_info_list_1_0(
BinderCellInfo* self,
GBinderReader* reader)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
gsize count;
const RadioCellInfo* cells = gbinder_reader_read_hidl_type_vec(reader,
RadioCellInfo, &count);
@@ -584,6 +893,7 @@ binder_cell_info_list_1_2(
BinderCellInfo* self,
GBinderReader* reader)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
gsize count;
const RadioCellInfo_1_2* cells = gbinder_reader_read_hidl_type_vec(reader,
RadioCellInfo_1_2, &count);
@@ -602,6 +912,7 @@ binder_cell_info_list_1_4(
BinderCellInfo* self,
GBinderReader* reader)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
gsize count;
const RadioCellInfo_1_4* cells = gbinder_reader_read_hidl_type_vec(reader,
RadioCellInfo_1_4, &count);
@@ -620,6 +931,7 @@ binder_cell_info_list_1_5(
BinderCellInfo* self,
GBinderReader* reader)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
gsize count;
const RadioCellInfo_1_5* cells = gbinder_reader_read_hidl_type_vec(reader,
RadioCellInfo_1_5, &count);
@@ -632,6 +944,17 @@ binder_cell_info_list_1_5(
}
}
static
void
binder_cell_info_list_aidl(
BinderCellInfo* self,
GBinderReader* reader)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
binder_cell_info_update_cells(self,
binder_cell_info_array_new_aidl(reader));
}
static
void
binder_cell_info_list_changed_1_0(
@@ -640,6 +963,7 @@ binder_cell_info_list_changed_1_0(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCellInfo* self = THIS(user_data);
GASSERT(code == RADIO_IND_CELL_INFO_LIST);
@@ -659,6 +983,7 @@ binder_cell_info_list_changed_1_2(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCellInfo* self = THIS(user_data);
GASSERT(code == RADIO_IND_CELL_INFO_LIST_1_2);
@@ -678,6 +1003,7 @@ binder_cell_info_list_changed_1_4(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCellInfo* self = THIS(user_data);
GASSERT(code == RADIO_IND_CELL_INFO_LIST_1_4);
@@ -697,6 +1023,7 @@ binder_cell_info_list_changed_1_5(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCellInfo* self = THIS(user_data);
GASSERT(code == RADIO_IND_CELL_INFO_LIST_1_5);
@@ -708,6 +1035,26 @@ binder_cell_info_list_changed_1_5(
}
}
static
void
binder_cell_info_list_changed_aidl(
RadioClient* client,
RADIO_IND code,
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCellInfo* self = THIS(user_data);
GASSERT((RADIO_NETWORK_IND)code == RADIO_NETWORK_IND_CELL_INFO_LIST);
if (self->enabled) {
GBinderReader reader;
gbinder_reader_copy(&reader, args);
binder_cell_info_list_aidl(self, &reader);
}
}
static
void
binder_cell_info_list_cb(
@@ -718,6 +1065,7 @@ binder_cell_info_list_cb(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCellInfo* self = THIS(user_data);
GASSERT(self->query_req == req);
@@ -730,26 +1078,31 @@ binder_cell_info_list_cb(
GBinderReader reader;
gbinder_reader_copy(&reader, args);
switch (resp) {
case RADIO_RESP_GET_CELL_INFO_LIST:
binder_cell_info_list_1_0(self, &reader);
break;
case RADIO_RESP_GET_CELL_INFO_LIST_1_2:
binder_cell_info_list_1_2(self, &reader);
break;
case RADIO_RESP_GET_CELL_INFO_LIST_1_4:
binder_cell_info_list_1_4(self, &reader);
break;
case RADIO_RESP_GET_CELL_INFO_LIST_1_5:
binder_cell_info_list_1_5(self, &reader);
break;
default:
ofono_warn("Unexpected getCellInfoList response %d", resp);
break;
const RADIO_AIDL_INTERFACE iface_aidl = radio_client_aidl_interface(self->client);
if (iface_aidl == RADIO_AIDL_INTERFACE_NONE) {
switch (resp) {
case RADIO_RESP_GET_CELL_INFO_LIST:
binder_cell_info_list_1_0(self, &reader);
break;
case RADIO_RESP_GET_CELL_INFO_LIST_1_2:
binder_cell_info_list_1_2(self, &reader);
break;
case RADIO_RESP_GET_CELL_INFO_LIST_1_4:
binder_cell_info_list_1_4(self, &reader);
break;
case RADIO_RESP_GET_CELL_INFO_LIST_1_5:
binder_cell_info_list_1_5(self, &reader);
break;
default:
ofono_warn("Unexpected getCellInfoList response %d", resp);
break;
}
} else {
binder_cell_info_list_aidl(self, &reader);
}
}
} else {
DBG_(self, "%s error %d", radio_resp_name(resp), error);
DBG_(self, "%s error %d", radio_resp_name2(self->instance, resp), error);
}
}
}
@@ -764,7 +1117,12 @@ binder_cell_info_set_rate_cb(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCellInfo* self = THIS(user_data);
const RADIO_AIDL_INTERFACE iface_aidl = radio_client_aidl_interface(self->client);
guint32 code = iface_aidl == RADIO_NETWORK_INTERFACE ?
RADIO_NETWORK_RESP_SET_CELL_INFO_LIST_RATE :
RADIO_RESP_SET_CELL_INFO_LIST_RATE;
DBG_(self, "");
GASSERT(self->set_rate_req == req);
@@ -772,7 +1130,7 @@ binder_cell_info_set_rate_cb(
self->set_rate_req = NULL;
if (status == RADIO_TX_STATUS_OK) {
if (resp == RADIO_RESP_SET_CELL_INFO_LIST_RATE) {
if (resp == code) {
if (error != RADIO_ERROR_NONE) {
DBG_(self, "Failed to set cell info rate, error %d", error);
}
@@ -792,6 +1150,7 @@ binder_cell_info_retry(
const GBinderReader* args,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCellInfo* self = THIS(user_data);
switch (error) {
@@ -808,9 +1167,15 @@ void
binder_cell_info_query(
BinderCellInfo* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
const RADIO_AIDL_INTERFACE iface_aidl = radio_client_aidl_interface(self->client);
guint32 code = iface_aidl == RADIO_NETWORK_INTERFACE ?
RADIO_NETWORK_REQ_GET_CELL_INFO_LIST :
RADIO_REQ_GET_CELL_INFO_LIST;
radio_request_drop(self->query_req);
self->query_req = radio_request_new(self->client,
RADIO_REQ_GET_CELL_INFO_LIST, NULL,
code, NULL,
binder_cell_info_list_cb, NULL, self);
radio_request_set_retry(self->query_req, BINDER_RETRY_MS, MAX_RETRIES);
radio_request_set_retry_func(self->query_req, binder_cell_info_retry);
@@ -822,11 +1187,16 @@ void
binder_cell_info_set_rate(
BinderCellInfo* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
GBinderWriter writer;
const RADIO_AIDL_INTERFACE iface_aidl = radio_client_aidl_interface(self->client);
guint32 code = iface_aidl == RADIO_NETWORK_INTERFACE ?
RADIO_NETWORK_REQ_SET_CELL_INFO_LIST_RATE :
RADIO_REQ_SET_CELL_INFO_LIST_RATE;
radio_request_drop(self->set_rate_req);
self->set_rate_req = radio_request_new(self->client,
RADIO_REQ_SET_CELL_INFO_LIST_RATE, &writer,
code, &writer,
binder_cell_info_set_rate_cb, NULL, self);
gbinder_writer_append_int32(&writer,
@@ -843,6 +1213,7 @@ void
binder_cell_info_refresh(
BinderCellInfo* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
/* getCellInfoList fails without SIM card */
if (self->enabled &&
self->radio->state == RADIO_STATE_ON &&
@@ -860,6 +1231,7 @@ binder_cell_info_radio_state_cb(
BINDER_RADIO_PROPERTY property,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCellInfo* self = THIS(user_data);
DBG_(self, "%s", binder_radio_state_string(radio->state));
@@ -872,6 +1244,7 @@ binder_cell_info_sim_status_cb(
BinderSimCard* sim,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCellInfo* self = THIS(user_data);
self->sim_card_ready = binder_sim_card_ready(sim);
@@ -900,6 +1273,7 @@ void
binder_cell_info_ref_proc(
struct ofono_cell_info* info)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
g_object_ref(binder_cell_info_cast(info));
}
@@ -908,6 +1282,7 @@ void
binder_cell_info_unref_proc(
struct ofono_cell_info* info)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
g_object_unref(binder_cell_info_cast(info));
}
@@ -917,6 +1292,7 @@ binder_cell_info_cells_changed_cb(
BinderCellInfo* self,
BinderCellInfoClosure* closure)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
closure->cb(&self->info, closure->user_data);
}
@@ -927,6 +1303,7 @@ binder_cell_info_add_cells_changed_handler_proc(
ofono_cell_info_cb_t cb,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (cb) {
BinderCellInfoClosure* closure = (BinderCellInfoClosure *)
g_closure_new_simple(sizeof(BinderCellInfoClosure), NULL);
@@ -950,6 +1327,7 @@ binder_cell_info_remove_handler_proc(
struct ofono_cell_info* info,
gulong id)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(id)) {
g_signal_handler_disconnect(binder_cell_info_cast(info), id);
}
@@ -961,6 +1339,7 @@ binder_cell_info_set_update_interval_proc(
struct ofono_cell_info* info,
int ms)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCellInfo* self = binder_cell_info_cast(info);
if (self->update_rate_ms != ms) {
@@ -978,6 +1357,7 @@ binder_cell_info_set_enabled_proc(
struct ofono_cell_info* info,
gboolean enabled)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCellInfo* self = binder_cell_info_cast(info);
if (self->enabled != enabled) {
@@ -996,35 +1376,47 @@ binder_cell_info_set_enabled_proc(
struct ofono_cell_info*
binder_cell_info_new(
RadioInstance* instance,
RadioClient* client,
const char* log_prefix,
BinderRadio* radio,
BinderSimCard* sim)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCellInfo* self = g_object_new(THIS_TYPE, 0);
self->instance = radio_instance_ref(instance);
self->client = radio_client_ref(client);
self->radio = binder_radio_ref(radio);
self->sim_card = binder_sim_card_ref(sim);
self->log_prefix = binder_dup_prefix(log_prefix);
const RADIO_AIDL_INTERFACE iface_aidl =
radio_client_aidl_interface(self->client);
DBG_(self, "");
self->event_id[CELL_INFO_EVENT_1_0] =
radio_client_add_indication_handler(client,
RADIO_IND_CELL_INFO_LIST,
binder_cell_info_list_changed_1_0, self);
self->event_id[CELL_INFO_EVENT_1_2] =
radio_client_add_indication_handler(client,
RADIO_IND_CELL_INFO_LIST_1_2,
binder_cell_info_list_changed_1_2, self);
self->event_id[CELL_INFO_EVENT_1_4] =
radio_client_add_indication_handler(client,
RADIO_IND_CELL_INFO_LIST_1_4,
binder_cell_info_list_changed_1_4, self);
self->event_id[CELL_INFO_EVENT_1_5] =
radio_client_add_indication_handler(client,
RADIO_IND_CELL_INFO_LIST_1_5,
binder_cell_info_list_changed_1_5, self);
if (iface_aidl == RADIO_AIDL_INTERFACE_NONE) {
self->event_id[CELL_INFO_EVENT_1_0] =
radio_client_add_indication_handler(client,
RADIO_IND_CELL_INFO_LIST,
binder_cell_info_list_changed_1_0, self);
self->event_id[CELL_INFO_EVENT_1_2] =
radio_client_add_indication_handler(client,
RADIO_IND_CELL_INFO_LIST_1_2,
binder_cell_info_list_changed_1_2, self);
self->event_id[CELL_INFO_EVENT_1_4] =
radio_client_add_indication_handler(client,
RADIO_IND_CELL_INFO_LIST_1_4,
binder_cell_info_list_changed_1_4, self);
self->event_id[CELL_INFO_EVENT_1_5] =
radio_client_add_indication_handler(client,
RADIO_IND_CELL_INFO_LIST_1_5,
binder_cell_info_list_changed_1_5, self);
} else {
self->event_id[CELL_INFO_EVENT_1_0] =
radio_client_add_indication_handler(client,
RADIO_NETWORK_IND_CELL_INFO_LIST,
binder_cell_info_list_changed_aidl, self);
}
self->radio_state_event_id =
binder_radio_add_property_handler(radio,
BINDER_RADIO_PROPERTY_STATE,
@@ -1052,6 +1444,7 @@ void
binder_cell_info_init(
BinderCellInfo* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
static const struct ofono_cell_info_proc binder_cell_info_proc = {
binder_cell_info_ref_proc,
binder_cell_info_unref_proc,
@@ -1071,6 +1464,7 @@ void
binder_cell_info_finalize(
GObject* object)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderCellInfo* self = THIS(object);
DBG_(self, "");
@@ -1078,6 +1472,7 @@ binder_cell_info_finalize(
radio_request_drop(self->set_rate_req);
radio_client_remove_all_handlers(self->client, self->event_id);
radio_client_unref(self->client);
radio_instance_unref(self->instance);
binder_radio_remove_handler(self->radio, self->radio_state_event_id);
binder_radio_unref(self->radio);
binder_sim_card_remove_handler(self->sim_card, self->sim_status_event_id);
@@ -1092,6 +1487,7 @@ void
binder_cell_info_class_init(
BinderCellInfoClass* klass)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
G_OBJECT_CLASS(klass)->finalize = binder_cell_info_finalize;
binder_cell_info_signals[SIGNAL_CELLS_CHANGED] =
g_signal_new(SIGNAL_CELLS_CHANGED_NAME, G_OBJECT_CLASS_TYPE(klass),

View File

@@ -22,6 +22,7 @@
struct ofono_cell_info*
binder_cell_info_new(
RadioInstance* instance,
RadioClient* client,
const char* log_prefix,
BinderRadio* radio,

View File

@@ -85,6 +85,7 @@ ConnManObject*
connman_object_cast(
BinderConnman* connman)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return G_LIKELY(connman) ?
THIS(G_CAST(connman, ConnManObject, pub)) :
NULL;
@@ -95,6 +96,7 @@ const char*
connman_iter_get_string(
DBusMessageIter* it)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
const char* str = NULL;
dbus_message_iter_get_basic(it, &str);
@@ -106,6 +108,7 @@ void
connman_object_emit_pending_signals(
ConnManObject* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderBase* base = &self->base;
BinderConnman* connman = &self->pub;
gsize late_signals = 0;
@@ -144,6 +147,7 @@ void
connman_cancel_call(
ConnManObject* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (self->call) {
dbus_pending_call_cancel(self->call);
dbus_pending_call_unref(self->call);
@@ -157,6 +161,7 @@ connman_tech_new(
ConnManObject* self,
const char* path)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ConnManTech* tech = g_new0(ConnManTech, 1);
char* key = g_strdup(path);
@@ -171,6 +176,7 @@ void
connman_invalidate(
ConnManObject* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderConnman* connman = &self->pub;
if (connman->valid) {
@@ -185,6 +191,7 @@ void
connman_update_valid(
ConnManObject* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderConnman* connman = &self->pub;
const gboolean valid = (connman->present && !self->call);
@@ -200,6 +207,7 @@ gboolean
connman_update_tethering(
ConnManObject* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderConnman* connman = &self->pub;
gboolean tethering = FALSE;
GHashTableIter it;
@@ -231,6 +239,7 @@ connman_set_tech_tethering(
ConnManTech* tech,
gboolean tethering)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (tech->tethering != tethering) {
ConnManObject* self = tech->obj;
@@ -260,6 +269,7 @@ connman_set_tech_connected(
ConnManTech* tech,
gboolean connected)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (tech->connected != connected) {
ConnManObject* self = tech->obj;
@@ -283,6 +293,7 @@ connman_tech_set_property(
ConnManTech* tech,
DBusMessageIter* it)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
DBusMessageIter var;
DBusBasicValue value;
const char* key = connman_iter_get_string(it);
@@ -310,6 +321,7 @@ connman_tech_set_properties(
ConnManTech* tech,
DBusMessageIter* it)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
DBusMessageIter dict;
int handled = 0;
@@ -334,6 +346,7 @@ connman_tech_property_changed(
DBusMessage* msg,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
const char* path = dbus_message_get_path(msg);
ConnManObject* self = THIS(user_data);
ConnManTech* tech = g_hash_table_lookup(self->techs, path);
@@ -357,6 +370,7 @@ connman_set_techs(
ConnManObject* self,
DBusMessageIter* it)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
DBusMessageIter list;
dbus_message_iter_recurse(it, &list);
@@ -387,6 +401,7 @@ connman_techs_reply(
DBusPendingCall* call,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ConnManObject* self = THIS(user_data);
DBusMessage* reply = dbus_pending_call_steal_reply(call);
DBusError error;
@@ -413,6 +428,7 @@ void
connman_get_techs(
ConnManObject* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
DBusMessage* msg = dbus_message_new_method_call(CONNMAN_SERVICE,
CONNMAN_PATH, CONNMAN_MANAGER_INTERFACE, CONNMAN_GET_TECHNOLOGIES);
@@ -433,6 +449,7 @@ connman_appeared(
DBusConnection* conn,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ConnManObject* self = THIS(user_data);
BinderConnman* connman = &self->pub;
@@ -452,6 +469,7 @@ connman_vanished(
DBusConnection* conn,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ConnManObject* self = THIS(user_data);
BinderConnman* connman = &self->pub;
@@ -482,6 +500,7 @@ connman_init(
ConnManObject* self,
DBusConnection* connection)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
self->connection = dbus_connection_ref(connection);
self->service_watch = g_dbus_add_service_watch(self->connection,
CONNMAN_SERVICE, connman_appeared, connman_vanished, self, NULL);
@@ -497,6 +516,7 @@ connman_init(
BinderConnman*
binder_connman_new()
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
static ConnManObject* instance = NULL;
if (instance) {
@@ -528,6 +548,7 @@ BinderConnman*
binder_connman_ref(
BinderConnman* connman)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ConnManObject* self = connman_object_cast(connman);
if (G_LIKELY(self)) {
@@ -540,6 +561,7 @@ void
binder_connman_unref(
BinderConnman* connman)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ConnManObject* self = connman_object_cast(connman);
if (G_LIKELY(self)) {
@@ -554,6 +576,7 @@ binder_connman_add_property_changed_handler(
BinderConnmanPropertyFunc callback,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ConnManObject* self = connman_object_cast(connman);
return G_LIKELY(self) ? binder_base_add_property_handler(&self->base,
@@ -565,6 +588,7 @@ binder_connman_remove_handler(
BinderConnman* connman,
gulong id)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(id)) {
ConnManObject* self = connman_object_cast(connman);
@@ -580,6 +604,7 @@ binder_connman_remove_handlers(
gulong* ids,
int n)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
gutil_disconnect_handlers(connman_object_cast(connman), ids, n);
}
@@ -592,6 +617,7 @@ void
connman_object_init(
ConnManObject* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
self->techs = g_hash_table_new_full(g_str_hash, g_str_equal,
g_free, g_free);
}
@@ -601,6 +627,7 @@ void
connman_object_finalize(
GObject *object)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ConnManObject* self = THIS(object);
connman_cancel_call(self);
@@ -613,6 +640,7 @@ connman_object_finalize(
static void connman_object_class_init(ConnManObjectClass *klass)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
G_OBJECT_CLASS(klass)->finalize = connman_object_finalize;
BINDER_BASE_CLASS(klass)->public_offset =
G_STRUCT_OFFSET(ConnManObject, pub);

File diff suppressed because it is too large Load Diff

View File

@@ -132,6 +132,7 @@ BinderData*
binder_data_new(
BinderDataManager* dm,
RadioClient* client,
RadioClient* network_client,
const char* name,
BinderRadio* radio,
BinderNetwork* network,

View File

@@ -20,6 +20,9 @@
#include <ofono/devinfo.h>
#include <ofono/log.h>
#include <radio_modem_types.h>
#include <radio_client.h>
#include <radio_request.h>
#include <radio_request_group.h>
@@ -60,6 +63,7 @@ binder_devinfo_callback_data_new(
ofono_devinfo_query_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderDevInfoCbData* cbd = g_slice_new0(BinderDevInfoCbData);
cbd->self = self;
@@ -73,6 +77,7 @@ void
binder_devinfo_callback_data_free(
gpointer cbd)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
g_slice_free(BinderDevInfoCbData, cbd);
}
@@ -83,6 +88,7 @@ binder_devinfo_query_unsupported(
ofono_devinfo_query_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_error error;
cb(binder_error_failure(&error), "", data);
@@ -94,15 +100,26 @@ binder_devinfo_query_revision_ok(
const BinderDevInfoCbData* cbd,
const GBinderReader* args)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_error err;
GBinderReader reader;
const char* res;
char* res;
RADIO_AIDL_INTERFACE interface_aidl =
radio_client_aidl_interface(cbd->self->g->client);
/* getBasebandVersionResponse(RadioResponseInfo, string version); */
gbinder_reader_copy(&reader, args);
res = gbinder_reader_read_hidl_string_c(&reader);
if (interface_aidl == RADIO_AIDL_INTERFACE_NONE) {
res = gbinder_reader_read_hidl_string(&reader);
} else {
res = gbinder_reader_read_string16(&reader);
}
DBG_(cbd->self, "%s", res);
cbd->cb(binder_error_ok(&err), res ? res : "", cbd->data);
g_free(res);
}
static
@@ -115,11 +132,17 @@ binder_devinfo_query_revision_cb(
const GBinderReader* args,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_error err;
const BinderDevInfoCbData* cbd = user_data;
guint32 code =
radio_client_aidl_interface(
cbd->self->g->client) == RADIO_MODEM_INTERFACE ?
RADIO_MODEM_RESP_GET_BASEBAND_VERSION :
RADIO_RESP_GET_BASEBAND_VERSION;
if (status == RADIO_TX_STATUS_OK) {
if (resp == RADIO_RESP_GET_BASEBAND_VERSION) {
if (resp == code) {
if (error == RADIO_ERROR_NONE) {
binder_devinfo_query_revision_ok(cbd, args);
return;
@@ -140,9 +163,15 @@ binder_devinfo_query_revision(
ofono_devinfo_query_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderDevInfo* self = binder_devinfo_get_data(di);
guint32 code =
(radio_client_aidl_interface(self->g->client) == RADIO_MODEM_INTERFACE) ?
RADIO_MODEM_REQ_GET_BASEBAND_VERSION :
RADIO_REQ_GET_BASEBAND_VERSION;
RadioRequest* req = radio_request_new2(self->g,
RADIO_REQ_GET_BASEBAND_VERSION, NULL,
code, NULL,
binder_devinfo_query_revision_cb,
binder_devinfo_callback_data_free,
binder_devinfo_callback_data_new(self, cb, data));
@@ -157,6 +186,7 @@ void
binder_devinfo_query_serial_cb(
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderDevInfoCbData* cbd = user_data;
BinderDevInfo* self = cbd->self;
struct ofono_error error;
@@ -170,6 +200,7 @@ void
binder_devinfo_query_svn_cb(
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderDevInfoCbData* cbd = user_data;
BinderDevInfo* self = cbd->self;
struct ofono_error error;
@@ -191,6 +222,7 @@ binder_devinfo_query(
ofono_devinfo_query_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
GVERIFY_FALSE(gutil_idle_queue_cancel_tag(self->iq, tag));
gutil_idle_queue_add_tag_full(self->iq, tag, fn,
binder_devinfo_callback_data_new(self, cb, data),
@@ -204,6 +236,7 @@ binder_devinfo_query_serial(
ofono_devinfo_query_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderDevInfo* self = binder_devinfo_get_data(devinfo);
DBG_(self, "");
@@ -218,6 +251,7 @@ binder_devinfo_query_svn(
ofono_devinfo_query_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderDevInfo* self = binder_devinfo_get_data(devinfo);
DBG_(self, "");
@@ -230,6 +264,7 @@ void
binder_devinfo_register(
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderDevInfo* self = user_data;
DBG_(self, "");
@@ -243,6 +278,7 @@ binder_devinfo_probe(
unsigned int vendor,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderModem* modem = binder_modem_get_data(data);
BinderDevInfo* self = g_new0(BinderDevInfo, 1);
@@ -264,6 +300,7 @@ void
binder_devinfo_remove(
struct ofono_devinfo* di)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderDevInfo* self = binder_devinfo_get_data(di);
DBG_(self, "");
@@ -296,12 +333,14 @@ static const struct ofono_devinfo_driver binder_devinfo_driver = {
void
binder_devinfo_init()
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ofono_devinfo_driver_register(&binder_devinfo_driver);
}
void
binder_devinfo_cleanup()
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ofono_devinfo_driver_unregister(&binder_devinfo_driver);
}

View File

@@ -18,16 +18,19 @@
BinderDevmonIo*
binder_devmon_start_io(
BinderDevmon* devmon,
RadioClient* client,
RadioClient* ds_client,
RadioClient* if_client,
struct ofono_slot* slot)
{
return devmon ? devmon->start_io(devmon, client, slot) : NULL;
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return devmon ? devmon->start_io(devmon, ds_client, if_client, slot) : NULL;
}
void
binder_devmon_io_free(
BinderDevmonIo* io)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (io) {
io->free(io);
}
@@ -37,6 +40,7 @@ void
binder_devmon_free(
BinderDevmon* devmon)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (devmon) {
devmon->free(devmon);
}

View File

@@ -33,8 +33,8 @@ struct binder_devmon_io {
struct binder_devmon {
void (*free)(BinderDevmon* devmon);
BinderDevmonIo* (*start_io)(BinderDevmon* devmon, RadioClient* client,
struct ofono_slot* slot);
BinderDevmonIo* (*start_io)(BinderDevmon* devmon, RadioClient* ds_client,
RadioClient* if_client, struct ofono_slot* slot);
};
/*
@@ -70,7 +70,8 @@ binder_devmon_combine(
BinderDevmonIo*
binder_devmon_start_io(
BinderDevmon* devmon,
RadioClient* client,
RadioClient* ds_client,
RadioClient* if_client,
struct ofono_slot* slot)
BINDER_INTERNAL;

View File

@@ -42,6 +42,7 @@ void
binder_devmon_combine_io_free(
BinderDevmonIo* io)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
guint i;
DevMonIo* self = binder_devmon_combine_io_cast(io);
@@ -55,9 +56,11 @@ static
BinderDevmonIo*
binder_devmon_combine_start_io(
BinderDevmon* devmon,
RadioClient* client,
RadioClient* ds_client,
RadioClient* if_client,
struct ofono_slot* slot)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
guint i;
DevMon* self = binder_devmon_combine_cast(devmon);
DevMonIo* io = g_malloc0(sizeof(DevMonIo) +
@@ -67,7 +70,8 @@ binder_devmon_combine_start_io(
io->impl = (BinderDevmonIo**)(io + 1);
io->count = self->count;
for (i = 0; i < io->count; i++) {
io->impl[i] = binder_devmon_start_io(self->impl[i], client, slot);
io->impl[i] = binder_devmon_start_io(self->impl[i], ds_client,
if_client, slot);
}
return &io->pub;
}
@@ -77,6 +81,7 @@ void
binder_devmon_combine_free(
BinderDevmon* dm)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
DevMon* self = binder_devmon_combine_cast(dm);
guint i;
@@ -95,6 +100,7 @@ binder_devmon_combine(
BinderDevmon* dm[],
guint n)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
guint i;
DevMon* self = g_malloc0(sizeof(DevMon) + sizeof(BinderDevmon*) * n);

View File

@@ -25,6 +25,7 @@
#include <radio_client.h>
#include <radio_request.h>
#include <radio_modem_types.h>
#include <gbinder_writer.h>
@@ -117,14 +118,18 @@ binder_devmon_ds_io_low_data_state_sent(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
DevMonIo* self = user_data;
guint32 code =
radio_client_aidl_interface(self->client) == RADIO_MODEM_INTERFACE ?
RADIO_MODEM_RESP_SEND_DEVICE_STATE : RADIO_RESP_SEND_DEVICE_STATE;
GASSERT(self->low_data_req == req);
radio_request_unref(self->low_data_req);
self->low_data_req = NULL;
if (status == RADIO_TX_STATUS_OK) {
if (resp == RADIO_RESP_SEND_DEVICE_STATE) {
if (resp == code) {
if (error == RADIO_ERROR_REQUEST_NOT_SUPPORTED) {
DBG_(self, "LOW_DATA_EXPECTED state is not supported");
self->low_data_supported = FALSE;
@@ -146,14 +151,18 @@ binder_devmon_ds_io_charging_state_sent(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
DevMonIo* self = user_data;
guint32 code =
radio_client_aidl_interface(self->client) == RADIO_MODEM_INTERFACE ?
RADIO_MODEM_RESP_SEND_DEVICE_STATE : RADIO_RESP_SEND_DEVICE_STATE;
GASSERT(self->charging_req == req);
radio_request_unref(self->charging_req);
self->charging_req = NULL;
if (status == RADIO_TX_STATUS_OK) {
if (resp == RADIO_RESP_SEND_DEVICE_STATE) {
if (resp == code) {
if (error == RADIO_ERROR_REQUEST_NOT_SUPPORTED) {
DBG_(self, "CHARGING state is not supported");
self->charging_supported = FALSE;
@@ -173,9 +182,15 @@ binder_devmon_ds_io_send_device_state(
gboolean state,
RadioRequestCompleteFunc callback)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
GBinderWriter writer;
RadioRequest* req = radio_request_new(self->client,
RADIO_REQ_SEND_DEVICE_STATE, &writer, callback, NULL, self);
RadioRequest* req;
guint32 code =
radio_client_aidl_interface(self->client) == RADIO_MODEM_INTERFACE ?
RADIO_MODEM_REQ_SEND_DEVICE_STATE : RADIO_REQ_SEND_DEVICE_STATE;
req = radio_request_new(self->client,
code, &writer, callback, NULL, self);
/* sendDeviceState(int32_t serial, DeviceStateType type, bool state); */
gbinder_writer_append_int32(&writer, type);
@@ -193,6 +208,7 @@ void
binder_devmon_ds_io_update_charging(
DevMonIo* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
const gboolean charging = binder_devmon_ds_charging(self->charger);
if (self->charging != charging) {
@@ -212,6 +228,7 @@ void
binder_devmon_ds_io_update_low_data(
DevMonIo* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
const gboolean low_data =
!binder_devmon_ds_tethering_on(self->connman) &&
!binder_devmon_ds_charging(self->charger) &&
@@ -234,6 +251,7 @@ void
binder_devmon_ds_io_set_cell_info_update_interval(
DevMonIo* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ofono_slot_set_cell_info_update_interval(self->slot, self,
(binder_devmon_ds_display_on(self->display) &&
(binder_devmon_ds_charging(self->charger) ||
@@ -249,6 +267,7 @@ binder_devmon_ds_io_connman_cb(
BINDER_CONNMAN_PROPERTY property,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
binder_devmon_ds_io_update_low_data((DevMonIo*)user_data);
}
@@ -258,6 +277,7 @@ binder_devmon_ds_io_battery_cb(
MceBattery* battery,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
binder_devmon_ds_io_set_cell_info_update_interval((DevMonIo*)user_data);
}
@@ -267,6 +287,7 @@ binder_devmon_ds_io_display_cb(
MceDisplay* display,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
DevMonIo* self = user_data;
binder_devmon_ds_io_update_low_data(self);
@@ -279,6 +300,7 @@ binder_devmon_ds_io_charger_cb(
MceCharger* charger,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
DevMonIo* self = user_data;
binder_devmon_ds_io_update_low_data(self);
@@ -291,6 +313,7 @@ void
binder_devmon_ds_io_free(
BinderDevmonIo* io)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
DevMonIo* self = binder_devmon_ds_io_cast(io);
binder_connman_remove_all_handlers(self->connman, self->connman_event_id);
@@ -318,16 +341,18 @@ static
BinderDevmonIo*
binder_devmon_ds_start_io(
BinderDevmon* devmon,
RadioClient* client,
RadioClient* ds_client,
RadioClient* if_client,
struct ofono_slot* slot)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
DevMon* ds = binder_devmon_ds_cast(devmon);
DevMonIo* self = g_new0(DevMonIo, 1);
self->pub.free = binder_devmon_ds_io_free;
self->low_data_supported = TRUE;
self->charging_supported = TRUE;
self->client = radio_client_ref(client);
self->client = radio_client_ref(ds_client);
self->slot = ofono_slot_ref(slot);
self->connman = binder_connman_ref(ds->connman);
@@ -378,6 +403,7 @@ void
binder_devmon_ds_free(
BinderDevmon* devmon)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
DevMon* self = binder_devmon_ds_cast(devmon);
binder_connman_unref(self->connman);
@@ -395,6 +421,7 @@ BinderDevmon*
binder_devmon_ds_new(
const BinderSlotConfig* config)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
DevMon* self = g_new0(DevMon, 1);
self->pub.free = binder_devmon_ds_free;

View File

@@ -24,6 +24,7 @@
#include <radio_client.h>
#include <radio_request.h>
#include <radio_network_types.h>
#include <gbinder_writer.h>
@@ -101,6 +102,7 @@ binder_devmon_if_io_indication_filter_sent(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
DevMonIo* self = user_data;
GASSERT(self->req == req);
@@ -108,7 +110,13 @@ binder_devmon_if_io_indication_filter_sent(
self->req = NULL;
if (status == RADIO_TX_STATUS_OK) {
if (resp == RADIO_RESP_SET_INDICATION_FILTER) {
const RADIO_AIDL_INTERFACE iface_aidl =
radio_client_aidl_interface(self->client);
guint32 code = iface_aidl == RADIO_NETWORK_INTERFACE ?
RADIO_NETWORK_RESP_SET_INDICATION_FILTER :
RADIO_RESP_SET_INDICATION_FILTER;
if (resp == code) {
if (error == RADIO_ERROR_REQUEST_NOT_SUPPORTED) {
/* This is a permanent failure */
DBG_(self, "Indication response filter is not supported");
@@ -125,36 +133,53 @@ void
binder_devmon_if_io_set_indication_filter(
DevMonIo* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (self->ind_filter_supported) {
GBinderWriter args;
RADIO_REQ code;
gint32 value;
const RADIO_AIDL_INTERFACE iface_aidl =
radio_client_aidl_interface(self->client);
/*
* Both requests take the same args:
*
* setIndicationFilter(serial, bitfield<IndicationFilter>)
* setIndicationFilter_1_2(serial, bitfield<IndicationFilter>)
*
* and both produce IRadioResponse.setIndicationFilterResponse()
*
* However setIndicationFilter_1_2 comments says "If unset, defaults
* to @1.2::IndicationFilter:ALL" and it's unclear what "unset" means
* wrt a bitmask. How is "unset" different from NONE which is zero.
* To be on the safe side, let's always set the most innocently
* looking bit which I think is DATA_CALL_DORMANCY.
*/
if (radio_client_interface(self->client) < RADIO_INTERFACE_1_2) {
code = RADIO_REQ_SET_INDICATION_FILTER;
value = self->display_on ? RADIO_IND_FILTER_ALL :
RADIO_IND_FILTER_DATA_CALL_DORMANCY;
} else if (radio_client_interface(self->client) < RADIO_INTERFACE_1_5) {
code = RADIO_REQ_SET_INDICATION_FILTER_1_2;
value = self->display_on ? RADIO_IND_FILTER_ALL_1_2 :
RADIO_IND_FILTER_DATA_CALL_DORMANCY;
if (iface_aidl == RADIO_AIDL_INTERFACE_NONE) {
/*
* Both requests take the same args:
*
* setIndicationFilter(serial, bitfield<IndicationFilter>)
* setIndicationFilter_1_2(serial, bitfield<IndicationFilter>)
*
* and both produce IRadioResponse.setIndicationFilterResponse()
*
* However setIndicationFilter_1_2 comments says "If unset, defaults
* to @1.2::IndicationFilter:ALL" and it's unclear what "unset" means
* wrt a bitmask. How is "unset" different from NONE which is zero.
* To be on the safe side, let's always set the most innocently
* looking bit which I think is DATA_CALL_DORMANCY.
*/
if (radio_client_interface(self->client) < RADIO_INTERFACE_1_2) {
code = RADIO_REQ_SET_INDICATION_FILTER;
value = self->display_on ? RADIO_IND_FILTER_ALL :
RADIO_IND_FILTER_DATA_CALL_DORMANCY;
} else if (radio_client_interface(self->client) < RADIO_INTERFACE_1_5) {
code = RADIO_REQ_SET_INDICATION_FILTER_1_2;
value = self->display_on ? RADIO_IND_FILTER_ALL_1_2 :
RADIO_IND_FILTER_DATA_CALL_DORMANCY;
} else {
code = RADIO_REQ_SET_INDICATION_FILTER_1_5;
value = self->display_on ? RADIO_IND_FILTER_ALL_1_5 :
RADIO_IND_FILTER_DATA_CALL_DORMANCY;
}
} else {
code = RADIO_REQ_SET_INDICATION_FILTER_1_5;
value = self->display_on ? RADIO_IND_FILTER_ALL_1_5 :
code = RADIO_NETWORK_REQ_SET_INDICATION_FILTER;
/* Some devices don't like setting all filters */
value = self->display_on ?
RADIO_IND_FILTER_SIGNAL_STRENGTH |
RADIO_IND_FILTER_FULL_NETWORK_STATE |
RADIO_IND_FILTER_DATA_CALL_DORMANCY |
RADIO_IND_FILTER_LINK_CAPACITY_ESTIMATE |
RADIO_IND_FILTER_PHYSICAL_CHANNEL_CONFIG |
RADIO_IND_FILTER_REGISTRATION_FAILURE |
RADIO_IND_FILTER_BARRING_INFO :
RADIO_IND_FILTER_DATA_CALL_DORMANCY;
}
@@ -172,6 +197,7 @@ void
binder_devmon_if_io_set_cell_info_update_interval(
DevMonIo* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ofono_slot_set_cell_info_update_interval(self->slot, self,
(self->display_on && (binder_devmon_if_charging(self->charger) ||
binder_devmon_if_battery_ok(self->battery))) ?
@@ -185,6 +211,7 @@ binder_devmon_if_io_battery_cb(
MceBattery* battery,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
binder_devmon_if_io_set_cell_info_update_interval((DevMonIo*)user_data);
}
@@ -193,6 +220,7 @@ void binder_devmon_if_io_charger_cb(
MceCharger* charger,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
binder_devmon_if_io_set_cell_info_update_interval((DevMonIo*)user_data);
}
@@ -202,6 +230,7 @@ binder_devmon_if_io_display_cb(
MceDisplay* display,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
DevMonIo* self = user_data;
const gboolean display_on = binder_devmon_if_display_on(display);
@@ -217,6 +246,7 @@ void
binder_devmon_if_io_free(
BinderDevmonIo* io)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
DevMonIo* self = binder_devmon_if_io_cast(io);
mce_battery_remove_all_handlers(self->battery, self->battery_event_id);
@@ -240,15 +270,17 @@ static
BinderDevmonIo*
binder_devmon_if_start_io(
BinderDevmon* devmon,
RadioClient* client,
RadioClient* ds_client,
RadioClient* if_client,
struct ofono_slot* slot)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
DevMon* impl = binder_devmon_if_cast(devmon);
DevMonIo* self = g_new0(DevMonIo, 1);
self->pub.free = binder_devmon_if_io_free;
self->ind_filter_supported = TRUE;
self->client = radio_client_ref(client);
self->client = radio_client_ref(if_client);
self->slot = ofono_slot_ref(slot);
self->battery = mce_battery_ref(impl->battery);
@@ -289,6 +321,7 @@ void
binder_devmon_if_free(
BinderDevmon* devmon)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
DevMon* self = binder_devmon_if_cast(devmon);
mce_battery_unref(self->battery);
@@ -305,6 +338,7 @@ BinderDevmon*
binder_devmon_if_new(
const BinderSlotConfig* config)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
DevMon* self = g_new0(DevMon, 1);
self->pub.free = binder_devmon_if_free;

View File

@@ -65,6 +65,7 @@ binder_gprs_cbd_new(
ofono_gprs_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderGprsCbData* cbd = g_slice_new0(BinderGprsCbData);
cbd->self = self;
@@ -77,6 +78,7 @@ void
binder_gprs_cbd_free(
gpointer cbd)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
g_slice_free(BinderGprsCbData, cbd);
}
@@ -86,6 +88,7 @@ binder_gprs_fix_registration_status(
BinderGprs* self,
enum ofono_netreg_status status)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (!binder_data_allowed(self->data)) {
return OFONO_NETREG_STATUS_NOT_REGISTERED;
} else {
@@ -104,6 +107,7 @@ void
binder_gprs_data_update_registration_state(
BinderGprs* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
const enum ofono_netreg_status status = binder_gprs_fix_registration_status
(self, self->network->data.status);
@@ -121,6 +125,7 @@ void
binder_gprs_check_data_allowed(
BinderGprs* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
DBG_(self, "%d %d", binder_data_allowed(self->data), self->attached);
if (!binder_data_allowed(self->data) && self->attached) {
self->attached = FALSE;
@@ -137,6 +142,7 @@ gboolean
binder_gprs_set_attached_cb(
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderGprsCbData* cbd = user_data;
BinderGprs* self = cbd->self;
struct ofono_error err;
@@ -156,6 +162,7 @@ binder_gprs_set_attached(
ofono_gprs_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderGprs* self = binder_gprs_get_data(gprs);
struct ofono_error err;
@@ -181,6 +188,7 @@ binder_gprs_allow_data_changed(
BINDER_DATA_PROPERTY property,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderGprs* self = user_data;
DBG_(self, "%d", binder_data_allowed(data));
@@ -196,11 +204,19 @@ binder_gprs_max_data_calls_changed(
BINDER_NETWORK_PROPERTY property,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderGprs* self = user_data;
if (net->max_data_calls > 0) {
DBG_(self, "setting max cids to %d", net->max_data_calls);
ofono_gprs_set_cid_range(self->gprs, 1, net->max_data_calls);
int max_data_calls = net->max_data_calls;
// Some MediaTek RILs support more than 1 active context on Android
// but report only 1 in response to getDataRegistrationState
if (max_data_calls == 1)
max_data_calls = 3;
DBG_(self, "setting max cids to %d", max_data_calls);
ofono_gprs_set_cid_range(self->gprs, 1, max_data_calls);
}
}
@@ -211,6 +227,7 @@ binder_gprs_data_registration_state_changed(
BINDER_NETWORK_PROPERTY property,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
binder_gprs_data_update_registration_state((BinderGprs*)user_data);
}
@@ -221,6 +238,7 @@ binder_gprs_registration_status(
ofono_gprs_status_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderGprs* self = binder_gprs_get_data(gprs);
struct ofono_error err;
const enum ofono_netreg_status status = self->attached ?
@@ -235,6 +253,7 @@ gboolean
binder_gprs_register(
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderGprs* self = user_data;
BinderNetwork* network = self->network;
struct ofono_gprs* gprs = self->gprs;
@@ -256,8 +275,15 @@ binder_gprs_register(
network->data.status);
if (network->max_data_calls > 0) {
DBG_(self, "setting max cids to %d", network->max_data_calls);
ofono_gprs_set_cid_range(gprs, 1,network->max_data_calls);
int max_data_calls = network->max_data_calls;
// Some MediaTek RILs support more than 1 active context on Android
// but report only 1 in response to getDataRegistrationState
if (max_data_calls == 1)
max_data_calls = 3;
DBG_(self, "setting max cids to %d", max_data_calls);
ofono_gprs_set_cid_range(self->gprs, 1, max_data_calls);
}
ofono_gprs_register(gprs);
@@ -271,6 +297,7 @@ binder_gprs_probe(
unsigned int vendor,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderModem* modem = binder_modem_get_data(data);
BinderGprs* self = g_new0(BinderGprs, 1);
@@ -292,6 +319,7 @@ void
binder_gprs_remove(
struct ofono_gprs* gprs)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderGprs* self = binder_gprs_get_data(gprs);
DBG_(self, "");
@@ -332,12 +360,14 @@ static const struct ofono_gprs_driver binder_gprs_driver = {
void
binder_gprs_init()
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ofono_gprs_driver_register(&binder_gprs_driver);
}
void
binder_gprs_cleanup()
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ofono_gprs_driver_unregister(&binder_gprs_driver);
}

View File

@@ -66,6 +66,7 @@ char*
binder_gprs_context_netmask(
const char* bits)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
guint nbits;
if (gutil_parse_uint(bits, 0, &nbits) && nbits < 33) {
@@ -87,6 +88,7 @@ int
binder_gprs_context_address_family(
const char* addr)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (strchr(addr, ':')) {
return AF_INET6;
} else if (strchr(addr, '.')) {
@@ -101,6 +103,7 @@ void
binder_gprs_context_free_active_call(
BinderGprsContext* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (self->active_call) {
binder_data_call_release(self->data, self->active_call->cid, self);
binder_data_call_free(self->active_call);
@@ -122,6 +125,7 @@ binder_gprs_context_set_active_call(
BinderGprsContext* self,
const BinderDataCall* call)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (call) {
binder_data_call_free(self->active_call);
self->active_call = binder_data_call_dup(call);
@@ -147,6 +151,7 @@ void
binder_gprs_context_set_disconnected(
BinderGprsContext* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (self->active_call) {
binder_gprs_context_free_active_call(self);
if (self->deactivate.req) {
@@ -178,6 +183,7 @@ binder_gprs_context_set_address(
struct ofono_gprs_context *gc,
const BinderDataCall* call)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
const char* ip_addr = NULL;
char* ip_mask = NULL;
const char* ipv6_addr = NULL;
@@ -250,6 +256,7 @@ binder_gprs_context_set_gateway(
struct ofono_gprs_context *gc,
const BinderDataCall* call)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
const char* ip_gw = NULL;
const char* ipv6_gw = NULL;
char* const* list = call->gateways;
@@ -287,6 +294,7 @@ binder_gprs_context_set_servers(
ofono_gprs_context_list_setter_t set_ipv4,
ofono_gprs_context_list_setter_t set_ipv6)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
int i;
const char** ip_list = NULL, ** ip_ptr = NULL;
const char** ipv6_list = NULL, ** ipv6_ptr = NULL;
@@ -326,6 +334,7 @@ binder_gprs_context_set_dns_servers(
struct ofono_gprs_context* gc,
const BinderDataCall* call)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
binder_gprs_context_set_servers(gc, call->dnses,
ofono_gprs_context_set_ipv4_dns_servers,
ofono_gprs_context_set_ipv6_dns_servers);
@@ -337,6 +346,7 @@ binder_gprs_context_set_proxy_cscf(
struct ofono_gprs_context* gc,
const BinderDataCall* call)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
binder_gprs_context_set_servers(gc, call->pcscf,
ofono_gprs_context_set_ipv4_proxy_cscf,
ofono_gprs_context_set_ipv6_proxy_cscf);
@@ -357,6 +367,7 @@ binder_gprs_context_data_call_change(
const BinderDataCall* c1,
const BinderDataCall* c2)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (c1 == c2) {
return 0;
} else if (c1 && c2) {
@@ -395,6 +406,7 @@ binder_gprs_context_call_list_changed(
BINDER_DATA_PROPERTY property,
void* arg)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderGprsContext* self = arg;
struct ofono_gprs_context* gc = self->gc;
@@ -476,6 +488,7 @@ binder_gprs_context_activate_primary_cb(
const BinderDataCall* call,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderGprsContext* self = user_data;
struct ofono_gprs_context* gc = self->gc;
struct ofono_error error;
@@ -532,6 +545,7 @@ binder_gprs_context_activate_primary(
ofono_gprs_context_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderGprsContext* self = binder_gprs_context_get_data(gc);
struct ofono_watch* watch = self->watch;
struct ofono_netreg* netreg = watch->netreg;
@@ -571,6 +585,7 @@ binder_gprs_context_deactivate_primary_cb(
RADIO_ERROR radio_error,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderGprsContext* gcd = user_data;
/*
@@ -612,6 +627,7 @@ binder_gprs_context_deactivate_primary(
ofono_gprs_context_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderGprsContext* self = binder_gprs_context_get_data(gc);
GASSERT(self->active_ctx_cid == id);
@@ -636,6 +652,7 @@ binder_gprs_context_detach_shutdown(
struct ofono_gprs_context* gc,
unsigned int id)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
binder_gprs_context_deactivate_primary(gc, id, NULL, NULL);
}
@@ -646,6 +663,7 @@ binder_gprs_context_probe(
unsigned int vendor,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderModem* modem = binder_modem_get_data(data);
BinderGprsContext* self = g_new0(BinderGprsContext, 1);
@@ -667,6 +685,7 @@ void
binder_gprs_context_remove(
struct ofono_gprs_context* gc)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderGprsContext* self = binder_gprs_context_get_data(gc);
DBG_(self, "");
@@ -717,12 +736,14 @@ static const struct ofono_gprs_context_driver binder_gprs_context_driver = {
void
binder_gprs_context_init()
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ofono_gprs_context_driver_register(&binder_gprs_context_driver);
}
void
binder_gprs_context_cleanup()
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ofono_gprs_context_driver_unregister(&binder_gprs_context_driver);
}

View File

@@ -1,6 +1,7 @@
/*
* oFono - Open Source Telephony - binder based adaptation
*
* Copyright (C) 2024 Slava Monich <slava@monich.com>
* Copyright (C) 2022 Jolla Ltd.
*
* This program is free software; you can redistribute it and/or modify
@@ -19,36 +20,21 @@
#include "binder_modem.h"
#include "binder_util.h"
#include "binder_ext_call.h"
#include "binder_ext_ims.h"
#include "binder_ext_slot.h"
#include "binder_ext_sms.h"
#include <ofono/ims.h>
#include <ofono/log.h>
#include <gutil_macros.h>
enum binder_ims_events {
EVENT_IMS_REGISTRATION_CHANGED,
EVENT_COUNT
};
enum binder_ims_ext_events {
IMS_EXT_STATE_CHANGED,
IMS_EXT_EVENT_COUNT
};
typedef struct binder_ims {
struct ofono_ims* ims;
struct ofono_ims* handle;
char* log_prefix;
BinderImsReg* reg;
BinderImsReg* ims;
BinderExtIms* ext;
gulong radio_event[EVENT_COUNT];
gulong ext_event[IMS_EXT_EVENT_COUNT];
gulong event_id;
guint ext_req_id;
guint start_id;
int caps;
} BinderIms;
typedef struct binder_ims_cbd {
@@ -59,8 +45,8 @@ typedef struct binder_ims_cbd {
#define DBG_(self,fmt,args...) DBG("%s" fmt, (self)->log_prefix, ##args)
static inline BinderIms* binder_ims_get_data(struct ofono_ims* ims)
{ return ofono_ims_get_data(ims); }
static inline BinderIms* binder_ims_get_data(struct ofono_ims* handle)
{ return ofono_ims_get_data(handle); }
static
BinderImsCbData*
@@ -69,6 +55,7 @@ binder_ims_cbd_new(
ofono_ims_register_cb_t cb,
void* cb_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderImsCbData* cbd = g_slice_new0(BinderImsCbData);
cbd->self = self;
@@ -82,6 +69,7 @@ void
binder_ims_cbd_free(
BinderImsCbData* cbd)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
gutil_slice_free(cbd);
}
@@ -92,6 +80,7 @@ binder_ims_register_complete(
BINDER_EXT_IMS_RESULT result,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderImsCbData* cbd = user_data;
BinderIms* self = cbd->self;
struct ofono_error err;
@@ -105,29 +94,16 @@ binder_ims_register_complete(
cbd->cb(&err, cbd->cb_data);
}
static
gboolean
binder_ims_is_registered(
BinderIms* self)
{
if (self->ext) {
return binder_ext_ims_get_state(self->ext) ==
BINDER_EXT_IMS_STATE_REGISTERED;
} else if (self->reg) {
return self->reg->registered;
} else {
return FALSE;
}
}
static
void
binder_ims_notify(
BinderIms* self)
{
const gboolean registered = binder_ims_is_registered(self);
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderImsReg* ims = self->ims;
ofono_ims_status_notify(self->ims, registered, registered ? self->caps : 0);
ofono_ims_status_notify(self->handle, ims->registered,
ims->registered ? ims->caps : 0);
}
static
@@ -137,33 +113,24 @@ binder_ims_registration_changed(
BINDER_IMS_REG_PROPERTY property,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderIms* self = user_data;
DBG_(self, "");
binder_ims_notify(self);
}
static
void
binder_ims_ext_state_changed(
BinderExtIms* ext,
void* user_data)
{
BinderIms* self = user_data;
DBG_(self, "");
GASSERT(property == BINDER_IMS_REG_PROPERTY_REGISTERED);
binder_ims_notify(self);
}
static
void
binder_ims_control(
struct ofono_ims* ims,
struct ofono_ims* handle,
BINDER_EXT_IMS_REGISTRATION registration,
ofono_ims_register_cb_t cb,
void* data)
{
BinderIms* self = binder_ims_get_data(ims);
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderIms* self = binder_ims_get_data(handle);
struct ofono_error err;
if (self->ext) {
@@ -185,35 +152,39 @@ binder_ims_control(
static
void
binder_ims_register(
struct ofono_ims* ims,
struct ofono_ims* handle,
ofono_ims_register_cb_t cb,
void* data)
{
binder_ims_control(ims, BINDER_EXT_IMS_REGISTRATION_ON, cb, data);
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
binder_ims_control(handle, BINDER_EXT_IMS_REGISTRATION_ON, cb, data);
}
static
void
binder_ims_unregister(
struct ofono_ims* ims,
struct ofono_ims* handle,
ofono_ims_register_cb_t cb,
void* data)
{
binder_ims_control(ims, BINDER_EXT_IMS_REGISTRATION_OFF, cb, data);
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
binder_ims_control(handle, BINDER_EXT_IMS_REGISTRATION_OFF, cb, data);
}
static
void
binder_ims_registration_status(
struct ofono_ims* ims,
struct ofono_ims* handle,
ofono_ims_status_cb_t cb,
void* data)
{
BinderIms* self = binder_ims_get_data(ims);
const gboolean registered = binder_ims_is_registered(self);
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderIms* self = binder_ims_get_data(handle);
BinderImsReg* ims = self->ims;
struct ofono_error err;
cb(binder_error_ok(&err), registered, registered ? self->caps : 0, data);
cb(binder_error_ok(&err), ims->registered,
ims->registered ? ims->caps : 0, data);
}
static
@@ -221,86 +192,51 @@ gboolean
binder_ims_start(
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderIms* self = user_data;
DBG_(self, "");
GASSERT(self->start_id);
self->start_id = 0;
if (self->ext) {
self->ext_event[IMS_EXT_STATE_CHANGED] =
binder_ext_ims_add_state_handler(self->ext,
binder_ims_ext_state_changed, self);
}
GASSERT(!self->event_id);
self->event_id = binder_ims_reg_add_property_handler(self->ims,
BINDER_IMS_REG_PROPERTY_REGISTERED, binder_ims_registration_changed,
self);
if (!self->ext_event[IMS_EXT_STATE_CHANGED]) {
self->radio_event[EVENT_IMS_REGISTRATION_CHANGED] =
binder_ims_reg_add_property_handler(self->reg,
BINDER_IMS_REG_PROPERTY_REGISTERED,
binder_ims_registration_changed, self);
}
ofono_ims_register(self->ims);
ofono_ims_register(self->handle);
return G_SOURCE_REMOVE;
}
static
int
binder_ims_probe(
struct ofono_ims* ims,
struct ofono_ims* handle,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderModem* modem = binder_modem_get_data(data);
BinderIms* self = g_new0(BinderIms, 1);
self->log_prefix = binder_dup_prefix(modem->log_prefix);
DBG_(self, "");
self->reg = binder_ims_reg_ref(modem->ims);
self->ims = ims;
if (modem->ext && (self->ext =
binder_ext_slot_get_interface(modem->ext,
BINDER_EXT_TYPE_IMS)) != NULL) {
BINDER_EXT_IMS_INTERFACE_FLAGS flags =
binder_ext_ims_get_interface_flags(self->ext);
DBG_(self, "using ims extension");
binder_ext_ims_ref(self->ext);
if (flags & BINDER_EXT_IMS_INTERFACE_FLAG_SMS_SUPPORT) {
DBG_(self, "ims sms support is detected");
self->caps |= OFONO_IMS_SMS_CAPABLE;
}
if (flags & BINDER_EXT_IMS_INTERFACE_FLAG_VOICE_SUPPORT) {
DBG_(self, "ims call support is detected");
self->caps |= OFONO_IMS_VOICE_CAPABLE;
}
} else {
if (binder_ext_sms_get_interface_flags
(binder_ext_slot_get_interface(modem->ext, BINDER_EXT_TYPE_SMS)) &
BINDER_EXT_SMS_INTERFACE_FLAG_IMS_SUPPORT) {
DBG_(self, "ims sms support is detected");
self->caps |= OFONO_IMS_SMS_CAPABLE;
}
if (binder_ext_call_get_interface_flags
(binder_ext_slot_get_interface(modem->ext, BINDER_EXT_TYPE_CALL)) &
BINDER_EXT_CALL_INTERFACE_FLAG_IMS_SUPPORT) {
DBG_(self, "ims call support is detected");
self->caps |= OFONO_IMS_VOICE_CAPABLE;
}
}
self->handle = handle;
self->ims = binder_ims_reg_ref(modem->ims);
self->ext = binder_ext_ims_ref(binder_ext_slot_get_interface(modem->ext,
BINDER_EXT_TYPE_IMS));
self->start_id = g_idle_add(binder_ims_start, self);
ofono_ims_set_data(ims, self);
ofono_ims_set_data(handle, self);
return 0;
}
static
void
binder_ims_remove(
struct ofono_ims* ims)
struct ofono_ims* handle)
{
BinderIms* self = binder_ims_get_data(ims);
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderIms* self = binder_ims_get_data(handle);
DBG_(self, "");
@@ -309,18 +245,17 @@ binder_ims_remove(
}
if (self->ext) {
binder_ext_ims_remove_all_handlers(self->ext, self->ext_event);
binder_ext_ims_cancel(self->ext, self->ext_req_id);
binder_ext_ims_unref(self->ext);
}
binder_ims_reg_remove_all_handlers(self->reg, self->radio_event);
binder_ims_reg_unref(self->reg);
binder_ims_reg_remove_handler(self->ims, self->event_id);
binder_ims_reg_unref(self->ims);
g_free(self->log_prefix);
g_free(self);
ofono_ims_set_data(ims, NULL);
ofono_ims_set_data(handle, NULL);
}
/*==========================================================================*
@@ -339,12 +274,14 @@ static const struct ofono_ims_driver binder_ims_driver = {
void
binder_ims_init()
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ofono_ims_driver_register(&binder_ims_driver);
}
void
binder_ims_cleanup()
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ofono_ims_driver_unregister(&binder_ims_driver);
}

View File

@@ -1,6 +1,7 @@
/*
* oFono - Open Source Telephony - binder based adaptation
*
* Copyright (C) 2024 Slava Monich <slava@monich.com>
* Copyright (C) 2022 Jolla Ltd.
*
* This program is free software; you can redistribute it and/or modify
@@ -18,13 +19,19 @@
#include "binder_log.h"
#include "binder_util.h"
#include "binder_ext_call.h"
#include "binder_ext_ims.h"
#include "binder_ext_slot.h"
#include "binder_ext_sms.h"
#include <radio_client.h>
#include <radio_request.h>
#include <radio_request_group.h>
#include <radio_network_types.h>
#include <ofono/ims.h>
#include <gbinder_reader.h>
#include <gutil_macros.h>
#include <gutil_misc.h>
@@ -78,6 +85,7 @@ binder_ims_reg_query_done(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderImsRegObject* self = THIS(user_data);
BinderBase* base = &self->base;
BinderImsReg* ims = &self->pub;
@@ -85,7 +93,8 @@ binder_ims_reg_query_done(
if (status != RADIO_TX_STATUS_OK) {
ofono_error("getImsRegistrationState failed");
} else if (resp != RADIO_RESP_GET_IMS_REGISTRATION_STATE) {
} else if (resp != RADIO_RESP_GET_IMS_REGISTRATION_STATE &&
resp != RADIO_NETWORK_RESP_GET_IMS_REGISTRATION_STATE) {
ofono_error("Unexpected getImsRegistrationState response %d", resp);
} else if (error != RADIO_ERROR_NONE) {
DBG_(self, "%s", binder_radio_error_string(error));
@@ -120,9 +129,13 @@ void
binder_ims_reg_query(
BinderImsRegObject* self)
{
RadioRequest* req = radio_request_new2(self->g,
RADIO_REQ_GET_IMS_REGISTRATION_STATE, NULL,
binder_ims_reg_query_done, NULL, self);
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
RadioRequestGroup* g = self->g;
RadioRequest* req = radio_request_new2(g,
radio_client_aidl_interface(g->client) == RADIO_NETWORK_INTERFACE ?
RADIO_NETWORK_REQ_GET_IMS_REGISTRATION_STATE :
RADIO_REQ_GET_IMS_REGISTRATION_STATE,
NULL, binder_ims_reg_query_done, NULL, self);
radio_request_submit(req);
radio_request_unref(req);
@@ -136,6 +149,7 @@ binder_ims_reg_state_changed(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderImsRegObject* self = THIS(user_data);
DBG_(self, "");
@@ -144,9 +158,10 @@ binder_ims_reg_state_changed(
static
void
binder_ims_ext_update_state(
binder_ims_reg_update_state(
BinderImsRegObject* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
const BINDER_EXT_IMS_STATE state = binder_ext_ims_get_state(self->ext);
const gboolean registered = (state == BINDER_EXT_IMS_STATE_REGISTERED);
BinderImsReg* ims = &self->pub;
@@ -165,9 +180,10 @@ binder_ims_ext_state_changed(
BinderExtIms* ext,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderImsRegObject* self = THIS(user_data);
binder_ims_ext_update_state(self);
binder_ims_reg_update_state(self);
binder_base_emit_queued_signals(&self->base);
}
@@ -181,6 +197,7 @@ binder_ims_reg_new(
BinderExtSlot* ext_slot,
const char* log_prefix)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderImsReg* ims = NULL;
if (client) {
@@ -188,12 +205,27 @@ binder_ims_reg_new(
ims = &self->pub;
self->log_prefix = binder_dup_prefix(log_prefix);
self->ext = binder_ext_ims_ref(binder_ext_slot_get_interface(ext_slot,
BINDER_EXT_TYPE_IMS));
self->ext = binder_ext_slot_get_interface(ext_slot,
BINDER_EXT_TYPE_IMS);
if (self->ext) {
BINDER_EXT_IMS_INTERFACE_FLAGS flags =
binder_ext_ims_get_interface_flags(self->ext);
DBG_(self, "using ims ext");
binder_ims_ext_update_state(self);
binder_ext_ims_ref(self->ext);
/* Query flags from the extension */
if (flags & BINDER_EXT_IMS_INTERFACE_FLAG_SMS_SUPPORT) {
DBG_(self, "ims sms support is detected");
ims->caps |= OFONO_IMS_SMS_CAPABLE;
}
if (flags & BINDER_EXT_IMS_INTERFACE_FLAG_VOICE_SUPPORT) {
DBG_(self, "ims call support is detected");
ims->caps |= OFONO_IMS_VOICE_CAPABLE;
}
binder_ims_reg_update_state(self);
/* Register event handler */
self->ext_event_id[EVENT_EXT_IMS_STATE_CHANGED] =
@@ -203,9 +235,28 @@ binder_ims_reg_new(
DBG_(self, "using ims radio api");
self->g = radio_request_group_new(client); /* Keeps ref to client */
/* Initialize the flags based on which interfaces are supported */
if (binder_ext_sms_get_interface_flags
(binder_ext_slot_get_interface(ext_slot,
BINDER_EXT_TYPE_SMS)) &
BINDER_EXT_SMS_INTERFACE_FLAG_IMS_SUPPORT) {
DBG_(self, "ims sms support is detected");
ims->caps |= OFONO_IMS_SMS_CAPABLE;
}
if (binder_ext_call_get_interface_flags
(binder_ext_slot_get_interface(ext_slot,
BINDER_EXT_TYPE_CALL)) &
BINDER_EXT_CALL_INTERFACE_FLAG_IMS_SUPPORT) {
DBG_(self, "ims call support is detected");
ims->caps |= OFONO_IMS_VOICE_CAPABLE;
}
/* Register event handler */
self->event_id[EVENT_IMS_NETWORK_STATE_CHANGED] =
radio_client_add_indication_handler(client,
radio_client_aidl_interface(client) ==
RADIO_NETWORK_INTERFACE ?
RADIO_NETWORK_IND_IMS_NETWORK_STATE_CHANGED :
RADIO_IND_IMS_NETWORK_STATE_CHANGED,
binder_ims_reg_state_changed, self);
@@ -223,6 +274,7 @@ BinderImsReg*
binder_ims_reg_ref(
BinderImsReg* ims)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderImsRegObject* self = binder_ims_reg_cast(ims);
if (G_LIKELY(self)) {
@@ -237,6 +289,7 @@ void
binder_ims_reg_unref(
BinderImsReg* ims)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderImsRegObject* self = binder_ims_reg_cast(ims);
if (G_LIKELY(self)) {
@@ -251,6 +304,7 @@ binder_ims_reg_add_property_handler(
BinderImsRegPropertyFunc callback,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderImsRegObject* self = binder_ims_reg_cast(ims);
return G_LIKELY(self) ? binder_base_add_property_handler(&self->base,
@@ -262,6 +316,7 @@ binder_ims_reg_remove_handler(
BinderImsReg* ims,
gulong id)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(id)) {
BinderImsRegObject* self = binder_ims_reg_cast(ims);
@@ -277,6 +332,7 @@ binder_ims_reg_remove_handlers(
gulong* ids,
int count)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
gutil_disconnect_handlers(binder_ims_reg_cast(ims), ids, count);
}
@@ -289,6 +345,7 @@ void
binder_ims_reg_object_init(
BinderImsRegObject* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
}
static
@@ -296,6 +353,7 @@ void
binder_ims_reg_object_finalize(
GObject* object)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderImsRegObject* self = THIS(object);
if (self->ext) {
@@ -320,6 +378,7 @@ void
binder_ims_reg_object_class_init(
BinderImsRegObjectClass* klass)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
G_OBJECT_CLASS(klass)->finalize = binder_ims_reg_object_finalize;
BINDER_BASE_CLASS(klass)->public_offset =
G_STRUCT_OFFSET(BinderImsRegObject, pub);

View File

@@ -1,6 +1,7 @@
/*
* oFono - Open Source Telephony - binder based adaptation
*
* Copyright (C) 2024 Slava Monich <slava@monich.com>
* Copyright (C) 2022 Jolla Ltd.
*
* This program is free software; you can redistribute it and/or modify
@@ -29,6 +30,7 @@ typedef enum binder_ims_reg_property {
struct binder_ims_reg {
gboolean registered;
int caps; /* OFONO_IMS_xxx bits */
};
typedef

View File

@@ -20,6 +20,10 @@
#include <gutil_log.h>
#include <ofono/log.h>
#undef DBG
#define DBG(fmt, ...) \
gutil_log(GLOG_MODULE_CURRENT, GLOG_LEVEL_ALWAYS, "binder_plugin:"fmt, ##__VA_ARGS__)
#endif /* BINDER_LOG_H */
/*

View File

@@ -35,9 +35,9 @@ enum binder_logger_events {
};
typedef struct binder_logger_callbacks {
const char* (*req_name)(guint32 code);
const char* (*resp_name)(guint32 code);
const char* (*ind_name)(guint32 code);
const char* (*req_name)(gpointer object, guint32 code);
const char* (*resp_name)(gpointer object, guint32 code);
const char* (*ind_name)(gpointer object, guint32 code);
gsize (*rpc_header_size)(gpointer object, guint32 code);
void (*drop_object)(BinderLogger* logger);
} BinderLoggerCallbacks;
@@ -71,10 +71,11 @@ binder_logger_trace_req(
guint code,
GBinderLocalRequest* args)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
const BinderLoggerCallbacks* cb = logger->cb;
static const GLogModule* log = &binder_logger_module;
const gsize header_size = cb->rpc_header_size(logger->object, code);
const char* name = cb->req_name(code);
const char* name = cb->req_name(logger->object, code);
GBinderWriter writer;
const guint8* data;
guint32 serial;
@@ -102,9 +103,10 @@ binder_logger_trace_resp(
const RadioResponseInfo* info,
const GBinderReader* args)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
static const GLogModule* log = &binder_logger_module;
const BinderLoggerCallbacks* cb = logger->cb;
const char* name = cb->resp_name(code);
const char* name = cb->resp_name(logger->object, code);
const char* error = (info->error == RADIO_ERROR_NONE) ? NULL :
binder_radio_error_string(info->error);
const char* arg1 = name ? name : error;
@@ -129,8 +131,9 @@ binder_logger_trace_ind(
RADIO_IND code,
const GBinderReader* args)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
const BinderLoggerCallbacks* cb = logger->cb;
const char* name = cb->ind_name(code);
const char* name = cb->ind_name(logger->object, code);
static const GLogModule* log = &binder_logger_module;
gutil_log(log, GLOG_LEVEL_VERBOSE, "%s> %u %s",
@@ -142,6 +145,7 @@ void
binder_logger_dump_req(
GBinderLocalRequest* args)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
GBinderWriter writer;
const guint8* data;
gsize size;
@@ -158,6 +162,7 @@ void
binder_logger_dump_reader(
const GBinderReader* reader)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
gsize size;
const guint8* data = gbinder_reader_get_data(reader, &size);
@@ -177,6 +182,7 @@ binder_logger_radio_trace_req_cb(
GBinderLocalRequest* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
binder_logger_trace_req((BinderLogger*)user_data, code, args);
}
@@ -189,6 +195,7 @@ binder_logger_radio_trace_resp_cb(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
binder_logger_trace_resp((BinderLogger*)user_data, code, info, args);
}
@@ -201,6 +208,7 @@ binder_logger_radio_trace_ind_cb(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
binder_logger_trace_ind((BinderLogger*)user_data, code, args);
}
@@ -211,6 +219,7 @@ binder_logger_radio_trace_ack_cb(
guint32 serial,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderLogger* logger = user_data;
gutil_log(&binder_logger_module, GLOG_LEVEL_VERBOSE, "%s> [%08x] "
@@ -225,6 +234,7 @@ binder_logger_radio_dump_req_cb(
GBinderLocalRequest* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
binder_logger_dump_req(args);
}
@@ -237,6 +247,7 @@ binder_logger_radio_dump_resp_cb(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
binder_logger_dump_reader(args);
}
@@ -249,31 +260,38 @@ binder_logger_radio_dump_ind_cb(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
binder_logger_dump_reader(args);
}
static
const char*
binder_logger_radio_req_name(
gpointer object,
guint32 code)
{
return radio_req_name(code);
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return radio_req_name2(object, code);
}
static
const char*
binder_logger_radio_resp_name(
gpointer object,
guint32 code)
{
return radio_resp_name(code);
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return radio_resp_name2(object, code);
}
static
const char*
binder_logger_radio_ind_name(
gpointer object,
guint32 code)
{
return radio_ind_name(code);
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return radio_ind_name2(object, code);
}
static
@@ -282,6 +300,7 @@ binder_logger_radio_rpc_header_size(
gpointer object,
guint32 code)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return radio_instance_rpc_header_size(object, code);
}
@@ -290,6 +309,7 @@ void
binder_logger_radio_drop_object(
BinderLogger* logger)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
radio_instance_remove_all_handlers(logger->object, logger->event_id);
radio_instance_unref(logger->object);
}
@@ -305,6 +325,7 @@ binder_logger_radio_new(
RadioIndicationObserverFunc ind_cb,
RadioAckFunc ack_cb)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
static BinderLoggerCallbacks binder_logger_radio_callbacks = {
.req_name = binder_logger_radio_req_name,
.resp_name = binder_logger_radio_resp_name,
@@ -348,6 +369,7 @@ binder_logger_config_trace_req_cb(
GBinderLocalRequest* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
binder_logger_trace_req((BinderLogger*)user_data, code, args);
}
@@ -360,6 +382,7 @@ binder_logger_config_trace_resp_cb(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
binder_logger_trace_resp((BinderLogger*)user_data, code, info, args);
}
@@ -371,6 +394,7 @@ binder_logger_config_trace_ind_cb(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
binder_logger_trace_ind((BinderLogger*)user_data, code, args);
}
@@ -382,6 +406,7 @@ binder_logger_config_dump_req_cb(
GBinderLocalRequest* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
binder_logger_dump_req(args);
}
@@ -394,6 +419,7 @@ binder_logger_config_dump_resp_cb(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
binder_logger_dump_reader(args);
}
@@ -405,31 +431,38 @@ binder_logger_config_dump_ind_cb(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
binder_logger_dump_reader(args);
}
static
const char*
binder_logger_config_req_name(
gpointer object,
guint32 code)
{
return radio_config_req_name(NULL, code);
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return radio_config_req_name(object, code);
}
static
const char*
binder_logger_config_resp_name(
gpointer object,
guint32 code)
{
return radio_config_resp_name(NULL, code);
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return radio_config_resp_name(object, code);
}
static
const char*
binder_logger_config_ind_name(
gpointer object,
guint32 code)
{
return radio_config_ind_name(NULL, code);
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return radio_config_ind_name(object, code);
}
static
@@ -438,6 +471,7 @@ binder_logger_config_rpc_header_size(
gpointer object,
guint32 code)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return radio_config_rpc_header_size(object, code);
}
@@ -446,6 +480,7 @@ void
binder_logger_config_drop_object(
BinderLogger* logger)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
radio_config_remove_all_handlers(logger->object, logger->event_id);
radio_config_unref(logger->object);
}
@@ -460,6 +495,7 @@ binder_logger_config_new(
RadioConfigResponseObserverFunc resp_cb,
RadioConfigIndicationObserverFunc ind_cb)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
static BinderLoggerCallbacks binder_logger_config_callbacks = {
.req_name = binder_logger_config_req_name,
.resp_name = binder_logger_config_resp_name,
@@ -498,6 +534,7 @@ binder_logger_new_radio_trace(
RadioInstance* radio,
const char* prefix)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return binder_logger_radio_new(radio, prefix,
RADIO_INSTANCE_PRIORITY_HIGHEST, binder_logger_radio_trace_req_cb,
binder_logger_radio_trace_resp_cb, binder_logger_radio_trace_ind_cb,
@@ -509,6 +546,7 @@ binder_logger_new_radio_dump(
RadioInstance* radio,
const char* prefix)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return binder_logger_radio_new(radio, prefix,
RADIO_INSTANCE_PRIORITY_HIGHEST - 1, binder_logger_radio_dump_req_cb,
binder_logger_radio_dump_resp_cb, binder_logger_radio_dump_ind_cb,
@@ -519,6 +557,7 @@ BinderLogger*
binder_logger_new_config_trace(
RadioConfig* config)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return binder_logger_config_new(config, CONFIG_PREFIX,
RADIO_INSTANCE_PRIORITY_HIGHEST, binder_logger_config_trace_req_cb,
binder_logger_config_trace_resp_cb, binder_logger_config_trace_ind_cb);
@@ -528,6 +567,7 @@ BinderLogger*
binder_logger_new_config_dump(
RadioConfig* config)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return binder_logger_config_new(config, CONFIG_PREFIX,
RADIO_INSTANCE_PRIORITY_HIGHEST - 1, binder_logger_config_dump_req_cb,
binder_logger_config_dump_resp_cb, binder_logger_config_dump_ind_cb);
@@ -537,6 +577,7 @@ void
binder_logger_free(
BinderLogger* logger)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (logger) {
logger->cb->drop_object(logger);
g_free(logger->prefix);

View File

@@ -47,6 +47,7 @@
#include <ofono/watch.h>
#include <radio_client.h>
#include <radio_instance.h>
#include <radio_request.h>
#include <radio_request_group.h>
@@ -112,6 +113,7 @@ void
binder_modem_online_request_done(
BinderModemOnlineRequest* req)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (req->cb) {
struct ofono_error error;
ofono_modem_online_cb_t cb = req->cb;
@@ -129,6 +131,7 @@ void
binder_modem_online_request_ok(
BinderModemOnlineRequest* req)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (req->timeout_id) {
g_source_remove(req->timeout_id);
req->timeout_id = 0;
@@ -141,6 +144,7 @@ void
binder_modem_update_online_state(
BinderModemPriv* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
switch (self->pub.radio->state) {
case RADIO_STATE_ON:
DBG_(self, "online");
@@ -171,6 +175,7 @@ gboolean
binder_modem_online_request_timeout(
gpointer data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderModemOnlineRequest* req = data;
GASSERT(req->timeout_id);
@@ -186,6 +191,7 @@ gboolean
binder_modem_online_check(
gpointer data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderModemPriv* self = data;
GASSERT(self->online_check_id);
@@ -199,6 +205,7 @@ void
binder_modem_schedule_online_check(
BinderModemPriv* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (!self->online_check_id) {
self->online_check_id = g_idle_add(binder_modem_online_check, self);
}
@@ -209,6 +216,7 @@ void
binder_modem_update_radio_settings(
BinderModemPriv* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderModem* modem = &self->pub;
struct ofono_watch* watch = modem->watch;
struct ofono_radio_settings* rs =
@@ -234,6 +242,7 @@ binder_modem_radio_state_cb(
BINDER_RADIO_PROPERTY property,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
binder_modem_update_online_state((BinderModemPriv*)data);
}
@@ -243,6 +252,7 @@ binder_modem_imsi_cb(
struct ofono_watch* watch,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
binder_modem_update_radio_settings((BinderModemPriv*)data);
}
@@ -252,6 +262,7 @@ binder_modem_iccid_cb(
struct ofono_watch* watch,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderModemPriv* self = data;
if (watch->iccid) {
@@ -267,6 +278,7 @@ binder_modem_sim_state_cb(
struct ofono_watch* watch,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderModemPriv* self = data;
const enum ofono_sim_state state = ofono_sim_get_state(watch->sim);
@@ -283,6 +295,7 @@ void
binder_modem_pre_sim(
struct ofono_modem* ofono)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderModem* modem = binder_modem_get_data(ofono);
BinderModemPriv* self = binder_modem_cast(modem);
const BINDER_FEATURE_MASK features = modem->config.features;
@@ -306,6 +319,7 @@ void
binder_modem_post_sim(
struct ofono_modem* ofono)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderModem* modem = binder_modem_get_data(ofono);
BinderModemPriv* self = binder_modem_cast(modem);
const BINDER_FEATURE_MASK features = modem->config.features;
@@ -368,6 +382,7 @@ void
binder_modem_post_online(
struct ofono_modem* ofono)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderModem* modem = binder_modem_get_data(ofono);
const BINDER_FEATURE_MASK features = modem->config.features;
@@ -394,6 +409,7 @@ binder_modem_set_online(
ofono_modem_online_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderModem* modem = binder_modem_get_data(ofono);
BinderModemPriv* self = binder_modem_cast(modem);
struct binder_radio* radio = modem->radio;
@@ -425,6 +441,7 @@ int
binder_modem_enable(
struct ofono_modem* ofono)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderModemPriv* self = binder_modem_get_priv(ofono);
DBG_(self, "");
@@ -437,6 +454,7 @@ int
binder_modem_disable(
struct ofono_modem* ofono)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderModemPriv* self = binder_modem_get_priv(ofono);
DBG_(self, "");
@@ -454,6 +472,7 @@ int
binder_modem_probe(
struct ofono_modem* ofono)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
DBG("%s", ofono_modem_get_path(ofono));
return 0;
}
@@ -463,6 +482,7 @@ void
binder_modem_remove(
struct ofono_modem* ofono)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderModem* modem = binder_modem_get_data(ofono);
BinderModemPriv* self = binder_modem_cast(modem);
@@ -499,6 +519,12 @@ binder_modem_remove(
radio_request_group_cancel(self->g);
radio_request_group_unref(self->g);
radio_client_unref(modem->client);
radio_client_unref(modem->data_client);
radio_client_unref(modem->messaging_client);
radio_client_unref(modem->network_client);
radio_client_unref(modem->sim_client);
radio_client_unref(modem->voice_client);
radio_instance_unref(modem->instance);
g_free(self->last_known_iccid);
g_free(self->reset_iccid);
@@ -527,18 +553,26 @@ static const struct ofono_modem_driver binder_modem_driver = {
void
binder_modem_init()
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ofono_modem_driver_register(&binder_modem_driver);
}
void
binder_modem_cleanup()
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ofono_modem_driver_unregister(&binder_modem_driver);
}
BinderModem*
binder_modem_create(
RadioInstance* instance,
RadioClient* client,
RadioClient* data_client,
RadioClient* messaging_client,
RadioClient* network_client,
RadioClient* sim_client,
RadioClient* voice_client,
const char* log_prefix,
const char* path,
const char* imei,
@@ -552,6 +586,7 @@ binder_modem_create(
BinderSimSettings* settings,
struct ofono_cell_info* cell_info)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
/* Skip the slash from the path, it looks like "/ril_0" */
struct ofono_modem* ofono = ofono_modem_create(path + 1, BINDER_DRIVER);
@@ -579,8 +614,14 @@ binder_modem_create(
modem->cell_info = ofono_cell_info_ref(cell_info);
modem->data = binder_data_ref(data);
modem->watch = ofono_watch_new(path);
modem->instance = radio_instance_ref(instance);
modem->client = radio_client_ref(client);
modem->ims = binder_ims_reg_new(client, ext, log_prefix);
modem->data_client = radio_client_ref(data_client);
modem->messaging_client = radio_client_ref(messaging_client);
modem->network_client = radio_client_ref(network_client);
modem->sim_client = radio_client_ref(sim_client);
modem->voice_client = radio_client_ref(voice_client);
modem->ims = binder_ims_reg_new(network_client, ext, log_prefix);
modem->ext = binder_ext_slot_ref(ext);
self->g = radio_request_group_new(client);
self->last_known_iccid = g_strdup(modem->watch->iccid);
@@ -620,9 +661,14 @@ binder_modem_create(
* the only reason for making this call.
*/
if (config->query_available_band_mode) {
guint32 code =
radio_client_aidl_interface(
modem->network_client) == RADIO_NETWORK_INTERFACE ?
RADIO_NETWORK_REQ_GET_AVAILABLE_BAND_MODES :
RADIO_REQ_GET_AVAILABLE_BAND_MODES;
/* oneway getAvailableBandModes(int32 serial); */
RadioRequest* req = radio_request_new2(self->g,
RADIO_REQ_GET_AVAILABLE_BAND_MODES, NULL,
code, NULL,
NULL, NULL, NULL);
radio_request_submit(req);

View File

@@ -22,7 +22,13 @@
#include <ofono/modem.h>
struct binder_modem {
RadioInstance* instance;
RadioClient* client;
RadioClient* data_client;
RadioClient* messaging_client;
RadioClient* network_client;
RadioClient* sim_client;
RadioClient* voice_client;
const char* path;
const char* log_prefix;
const char* imei;
@@ -53,7 +59,13 @@ binder_modem_cleanup(void)
BinderModem*
binder_modem_create(
RadioInstance* instance,
RadioClient* client,
RadioClient* data_client,
RadioClient* messaging_client,
RadioClient* network_client,
RadioClient* sim_client,
RadioClient* voice_client,
const char* name,
const char* path,
const char* imei,

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -62,6 +62,8 @@ BinderNetwork*
binder_network_new(
const char* path,
RadioClient* client,
RadioClient* data_client,
RadioClient* modem_client,
const char* log_prefix,
BinderRadio* radio,
BinderSimCard* sim_card,

View File

@@ -20,6 +20,7 @@
BinderOpList*
binder_oplist_new()
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return (BinderOpList*) g_array_new(FALSE, TRUE,
sizeof(struct ofono_network_operator));
}
@@ -29,6 +30,7 @@ binder_oplist_set_count(
BinderOpList* oplist,
guint count)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (!oplist) {
oplist = binder_oplist_new();
}
@@ -41,6 +43,7 @@ binder_oplist_append(
BinderOpList* oplist,
const struct ofono_network_operator* op)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (!oplist) {
oplist = binder_oplist_new();
}
@@ -52,6 +55,7 @@ void
binder_oplist_free(
BinderOpList* oplist)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (oplist) {
g_array_free((GArray*)oplist, TRUE);
}

File diff suppressed because it is too large Load Diff

View File

@@ -21,6 +21,7 @@
#include <radio_client.h>
#include <radio_request.h>
#include <radio_request_group.h>
#include <radio_modem_types.h>
#include <gbinder_reader.h>
#include <gbinder_writer.h>
@@ -88,6 +89,7 @@ gboolean
binder_radio_power_should_be_on(
BinderRadioObject* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadio* radio = &self->pub;
return (radio->online || g_hash_table_size(self->req_table) > 0) &&
@@ -99,6 +101,7 @@ gboolean
binder_radio_power_request_retry_cb(
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioObject* self = THIS(user_data);
DBG_(self, "");
@@ -115,6 +118,7 @@ void
binder_radio_cancel_retry(
BinderRadioObject* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (self->retry_id) {
DBG_(self, "retry cancelled");
g_source_remove(self->retry_id);
@@ -127,6 +131,7 @@ void
binder_radio_check_state(
BinderRadioObject* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadio* radio = &self->pub;
if (!self->pending_req) {
@@ -162,6 +167,7 @@ void
binder_radio_power_request_done(
BinderRadioObject* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
GASSERT(!self->pending_req);
if (self->next_state_valid) {
binder_radio_submit_power_request(self, self->next_state);
@@ -180,11 +186,19 @@ binder_radio_power_request_cb(
const GBinderReader* args,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioObject* self = THIS(user_data);
const RADIO_INTERFACE iface = radio_client_interface(self->client);
const RADIO_RESP code = (iface >= RADIO_INTERFACE_1_5) ?
RADIO_RESP_SET_RADIO_POWER_1_5 :
RADIO_RESP_SET_RADIO_POWER;
const RADIO_AIDL_INTERFACE iface_aidl = radio_client_aidl_interface(self->client);
guint32 code = RADIO_RESP_NONE;
if (iface_aidl == RADIO_AIDL_INTERFACE_NONE) {
code = (iface >= RADIO_INTERFACE_1_5) ?
RADIO_RESP_SET_RADIO_POWER_1_5 :
RADIO_RESP_SET_RADIO_POWER;
} else if (iface_aidl == RADIO_MODEM_INTERFACE) {
code = RADIO_MODEM_RESP_SET_RADIO_POWER;
}
GASSERT(self->pending_req == req);
radio_request_unref(self->pending_req);
@@ -210,21 +224,34 @@ binder_radio_submit_power_request(
BinderRadioObject* self,
gboolean on)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
/* setRadioPower(int32 serial, bool on)
* setRadioPower_1_5(int32 serial, bool on, bool forEmergencyCall,
* bool preferredForEmergencyCall)
* AIDL:
* setRadioPower(int32 serial, bool on, bool forEmergencyCall,
* bool preferredForEmergencyCall)
*/
GBinderWriter writer;
const RADIO_INTERFACE iface = radio_client_interface(self->client);
const RADIO_REQ code = (iface >= RADIO_INTERFACE_1_5) ?
RADIO_REQ_SET_RADIO_POWER_1_5 :
RADIO_REQ_SET_RADIO_POWER;
const RADIO_AIDL_INTERFACE iface_aidl = radio_client_aidl_interface(self->client);
guint32 code = RADIO_REQ_NONE;
if (iface_aidl == RADIO_AIDL_INTERFACE_NONE) {
code = (iface >= RADIO_INTERFACE_1_5) ?
RADIO_REQ_SET_RADIO_POWER_1_5 :
RADIO_REQ_SET_RADIO_POWER;
} else if (iface_aidl == RADIO_MODEM_INTERFACE) {
code = RADIO_MODEM_REQ_SET_RADIO_POWER;
}
RadioRequest* req = radio_request_new(self->client,
code, &writer,
binder_radio_power_request_cb, NULL, self);
gbinder_writer_append_bool(&writer, on);
if (iface >= RADIO_INTERFACE_1_5) {
if ((iface_aidl == RADIO_AIDL_INTERFACE_NONE && iface >= RADIO_INTERFACE_1_5) ||
iface_aidl == RADIO_MODEM_INTERFACE) {
gbinder_writer_append_bool(&writer, FALSE);
gbinder_writer_append_bool(&writer, FALSE);
}
@@ -250,6 +277,7 @@ binder_radio_power_request(
gboolean on,
gboolean allow_repeat)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
const char* on_off = on ? "on" : "off";
if (self->pending_req) {
@@ -280,6 +308,7 @@ binder_radio_state_changed(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioObject* self = THIS(user_data);
RADIO_STATE radio_state = RADIO_STATE_UNAVAILABLE;
GBinderReader reader;
@@ -337,16 +366,23 @@ binder_radio_new(
RadioClient* client,
const char* log_prefix)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioObject* self = g_object_new(THIS_TYPE, NULL);
BinderRadio* radio = &self->pub;
const RADIO_AIDL_INTERFACE iface_aidl = radio_client_aidl_interface(client);
self->client = radio_client_ref(client);
self->g = radio_request_group_new(client);
self->log_prefix = binder_dup_prefix(log_prefix);
DBG_(self, "");
self->state_event_id = radio_client_add_indication_handler(client,
RADIO_IND_RADIO_STATE_CHANGED, binder_radio_state_changed, self);
if (iface_aidl == RADIO_AIDL_INTERFACE_NONE) {
self->state_event_id = radio_client_add_indication_handler(client,
RADIO_IND_RADIO_STATE_CHANGED, binder_radio_state_changed, self);
} else if (iface_aidl == RADIO_MODEM_INTERFACE) {
self->state_event_id = radio_client_add_indication_handler(client,
RADIO_MODEM_IND_RADIO_STATE_CHANGED, binder_radio_state_changed, self);
}
/*
* Some modem adaptations like to receive power off request at startup
@@ -360,6 +396,7 @@ BinderRadio*
binder_radio_ref(
BinderRadio* radio)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioObject* self = binder_radio_object_cast(radio);
if (G_LIKELY(self)) {
@@ -374,6 +411,7 @@ void
binder_radio_unref(
BinderRadio* radio)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioObject* self = binder_radio_object_cast(radio);
if (G_LIKELY(self)) {
@@ -386,6 +424,7 @@ binder_radio_set_online(
BinderRadio* radio,
gboolean online)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioObject* self = binder_radio_object_cast(radio);
if (G_LIKELY(self) && radio->online != online) {
@@ -405,6 +444,7 @@ void
binder_radio_confirm_power_on(
BinderRadio* radio)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioObject* self = binder_radio_object_cast(radio);
if (G_LIKELY(self) && binder_radio_power_should_be_on(self)) {
@@ -426,6 +466,7 @@ void
binder_radio_power_cycle(
BinderRadio* radio)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioObject* self = binder_radio_object_cast(radio);
if (G_LIKELY(self)) {
@@ -449,6 +490,7 @@ binder_radio_power_on(
BinderRadio* radio,
gpointer tag)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioObject* self = binder_radio_object_cast(radio);
if (G_LIKELY(self)) {
@@ -469,6 +511,7 @@ binder_radio_power_off(
BinderRadio* radio,
gpointer tag)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioObject* self = binder_radio_object_cast(radio);
if (G_LIKELY(self)) {
@@ -489,6 +532,7 @@ binder_radio_add_property_handler(
BinderRadioPropertyFunc callback,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioObject* self = binder_radio_object_cast(radio);
return G_LIKELY(self) ? binder_base_add_property_handler(&self->base,
@@ -500,6 +544,7 @@ binder_radio_remove_handler(
BinderRadio* radio,
gulong id)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(id)) {
BinderRadioObject* self = binder_radio_object_cast(radio);
@@ -515,6 +560,7 @@ binder_radio_remove_handlers(
gulong* ids,
int count)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
gutil_disconnect_handlers(binder_radio_object_cast(radio), ids, count);
}
@@ -527,6 +573,7 @@ void
binder_radio_object_init(
BinderRadioObject* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
self->req_table = g_hash_table_new(g_direct_hash, g_direct_equal);
}
@@ -535,6 +582,7 @@ void
binder_radio_object_finalize(
GObject* object)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioObject* self = THIS(object);
DBG_(self, "");
@@ -557,6 +605,7 @@ void
binder_radio_object_class_init(
BinderRadioObjectClass* klass)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
G_OBJECT_CLASS(klass)->finalize = binder_radio_object_finalize;
BINDER_BASE_CLASS(klass)->public_offset =
G_STRUCT_OFFSET(BinderRadioObject, pub);

View File

@@ -28,6 +28,8 @@
#include <radio_request.h>
#include <radio_request_group.h>
#include <radio_modem_types.h>
#include <gbinder_reader.h>
#include <gbinder_writer.h>
@@ -86,6 +88,7 @@ typedef struct binder_radio_caps_object {
char* log_prefix;
RadioClient* client;
RadioRequestGroup* g;
RADIO_AIDL_INTERFACE interface_aidl;
GUtilIdlePool* idle_pool;
gulong watch_event_id[WATCH_EVENT_COUNT];
gulong settings_event_id[SETTINGS_EVENT_COUNT];
@@ -135,6 +138,7 @@ struct binder_radio_caps_request {
typedef struct binder_radio_caps_check_data {
BinderRadioCapsCheckFunc cb;
void* cb_data;
RADIO_AIDL_INTERFACE interface_aidl;
} BinderRadioCapsCheckData;
typedef struct binder_radio_caps_request_tx_phase {
@@ -262,6 +266,7 @@ binder_radio_caps_permutate(
guint off,
guint n)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (off < n) {
guint i;
@@ -283,6 +288,7 @@ binder_radio_caps_generate_permutations(
GPtrArray* list,
guint n)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
g_ptr_array_set_size(list, 0);
if (n > 0) {
@@ -305,6 +311,7 @@ RadioCapability*
binder_radio_caps_dup(
const RadioCapability* in)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (in) {
if (in->logicalModemUuid.data.str) {
/* Allocate the whole thing from a single memory block */
@@ -330,6 +337,7 @@ binder_radio_caps_equal(
const RadioCapability* rc1,
const RadioCapability* rc2)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (rc1 == rc2) {
return TRUE;
} else if (rc1 && rc2) {
@@ -358,13 +366,33 @@ binder_radio_caps_check_done(
const GBinderReader* args,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioCapsCheckData* check = user_data;
const RadioCapability* result = NULL;
RadioCapability* result = NULL;
char* uuid_str = NULL;
if (status == RADIO_TX_STATUS_OK) {
if (resp == RADIO_RESP_GET_RADIO_CAPABILITY) {
guint32 code = check->interface_aidl == RADIO_MODEM_INTERFACE ?
RADIO_MODEM_RESP_GET_RADIO_CAPABILITY :
RADIO_RESP_GET_RADIO_CAPABILITY;
if (resp == code) {
if (error == RADIO_ERROR_NONE) {
result = binder_read_hidl_struct(args, RadioCapability);
if (check->interface_aidl == RADIO_AIDL_INTERFACE_NONE) {
result = (RadioCapability*)binder_read_hidl_struct(args, RadioCapability);
} else {
GBinderReader reader;
gbinder_reader_copy(&reader, args);
result = g_malloc0(sizeof(RadioCapability));
binder_read_parcelable_size(&reader);
gbinder_reader_read_int32(&reader, &result->session);
gbinder_reader_read_uint32(&reader, &result->phase);
gbinder_reader_read_uint32(&reader, &result->raf);
uuid_str = gbinder_reader_read_string16(&reader);
result->logicalModemUuid.data.str = (const char*)uuid_str;
result->logicalModemUuid.len = strlen(uuid_str);
gbinder_reader_read_uint32(&reader, &result->status);
}
if (result) {
DBG("tx=%d,phase=%d,raf=0x%x,uuid=%s,status=%d",
result->session, result->phase, result->raf,
@@ -380,6 +408,10 @@ binder_radio_caps_check_done(
}
check->cb(result, check->cb_data);
if (check->interface_aidl == RADIO_MODEM_INTERFACE) {
g_free(result);
g_free(uuid_str);
}
}
static
@@ -392,6 +424,7 @@ binder_radio_caps_check_retry(
const GBinderReader* args,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (status == RADIO_TX_STATUS_OK) {
switch (error) {
case RADIO_ERROR_NONE:
@@ -411,15 +444,21 @@ binder_radio_caps_check(
BinderRadioCapsCheckFunc cb,
void* cb_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioCapsCheckData* check = g_new0(BinderRadioCapsCheckData, 1);
const RADIO_AIDL_INTERFACE iface_aidl = radio_client_aidl_interface(client);
guint32 code = iface_aidl == RADIO_MODEM_INTERFACE ?
RADIO_MODEM_REQ_GET_RADIO_CAPABILITY :
RADIO_REQ_GET_RADIO_CAPABILITY;
/* getRadioCapability(int32 serial) */
RadioRequest* req = radio_request_new(client,
RADIO_REQ_GET_RADIO_CAPABILITY, NULL,
code, NULL,
binder_radio_caps_check_done, g_free, check);
check->cb = cb;
check->cb_data = cb_data;
check->interface_aidl = iface_aidl;
/*
* Make is blocking because this is typically happening at startup
@@ -455,6 +494,7 @@ enum ofono_radio_access_mode
binder_radio_caps_access_mode(
const RadioCapability* cap)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (cap) {
const RADIO_ACCESS_FAMILY raf = cap->raf;
int i;
@@ -474,6 +514,7 @@ enum ofono_radio_access_mode
binder_radio_caps_modes(
const RadioCapability* cap)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
enum ofono_radio_access_mode modes = OFONO_RADIO_ACCESS_MODE_NONE;
if (cap) {
@@ -495,6 +536,7 @@ void
binder_radio_caps_update_raf(
BinderRadioCapsObject* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioCaps* caps = &self->pub;
const RadioCapability* cap = self->cap;
RADIO_ACCESS_FAMILY raf = cap ? cap->raf : RAF_NONE;
@@ -513,6 +555,7 @@ binder_radio_caps_score(
const BinderRadioCapsObject* self,
const RadioCapability* cap)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (!self->radio->online || !self->simcard->status ||
self->simcard->status->card_state != RADIO_CARD_STATE_PRESENT) {
/* Unusable slot */
@@ -537,6 +580,7 @@ binder_radio_caps_slot_compare(
gconstpointer a,
gconstpointer b)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
const BinderRadioCapsObject* c1 = *(void**)a;
const BinderRadioCapsObject* c2 = *(void**)b;
@@ -550,6 +594,7 @@ binder_radio_caps_radio_event(
BINDER_RADIO_PROPERTY property,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioCapsObject* self = RADIO_CAPS(user_data);
DBG_(self, "");
@@ -562,6 +607,7 @@ binder_radio_caps_simcard_event(
BinderSimCard* sim,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioCapsObject* self = RADIO_CAPS(user_data);
DBG_(self, "");
@@ -574,6 +620,7 @@ binder_radio_caps_watch_event(
struct ofono_watch* watch,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioCapsObject* self = RADIO_CAPS(user_data);
DBG_(self, "");
@@ -587,6 +634,7 @@ binder_radio_caps_settings_event(
BINDER_SIM_SETTINGS_PROPERTY property,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioCapsObject* self = RADIO_CAPS(user_data);
BinderRadioCapsManager* mgr = self->pub.mgr;
@@ -603,6 +651,7 @@ binder_radio_caps_changed_cb(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
/* radioCapabilityIndication(RadioIndicationType, RadioCapability rc) */
BinderRadioCapsObject* self = RADIO_CAPS(user_data);
const RadioCapability* cap = binder_read_hidl_struct(args, RadioCapability);
@@ -623,6 +672,7 @@ void
binder_radio_caps_finish_init(
BinderRadioCapsObject* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
/* Register for update notifications */
self->client_event_id[CLIENT_EVENT_IND_RADIO_CAPABILITY] =
radio_client_add_indication_handler(self->client,
@@ -643,11 +693,15 @@ binder_radio_caps_initial_query_cb(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioCapsObject* self = RADIO_CAPS(user_data);
const RadioCapability* cap = NULL;
if (status == RADIO_TX_STATUS_OK) {
if (resp == RADIO_RESP_GET_RADIO_CAPABILITY) {
guint32 code = self->interface_aidl == RADIO_MODEM_INTERFACE ?
RADIO_MODEM_RESP_GET_RADIO_CAPABILITY :
RADIO_RESP_GET_RADIO_CAPABILITY;
if (resp == code) {
/* getRadioCapabilityResponse(RadioResponseInfo, RadioCapability) */
if (error == RADIO_ERROR_NONE) {
cap = binder_read_hidl_struct(args, RadioCapability);
@@ -679,6 +733,7 @@ binder_radio_caps_new(
const BinderSlotConfig* config,
const RadioCapability* cap)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
GASSERT(mgr);
if (G_LIKELY(mgr)) {
BinderRadioCapsObject* self = g_object_new(RADIO_CAPS_TYPE, 0);
@@ -688,6 +743,7 @@ binder_radio_caps_new(
self->log_prefix = binder_dup_prefix(log_prefix);
self->g = radio_request_group_new(client);
self->interface_aidl = radio_client_aidl_interface(client);
self->radio = binder_radio_ref(radio);
self->data = binder_data_ref(data);
caps->mgr = binder_radio_caps_manager_ref(mgr);
@@ -749,6 +805,7 @@ BinderRadioCaps*
binder_radio_caps_ref(
BinderRadioCaps* caps)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioCapsObject* self = binder_radio_caps_cast(caps);
if (G_LIKELY(self)) {
@@ -761,6 +818,7 @@ void
binder_radio_caps_unref(
BinderRadioCaps* caps)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioCapsObject* self = binder_radio_caps_cast(caps);
if (G_LIKELY(self)) {
@@ -772,6 +830,7 @@ void
binder_radio_caps_drop(
BinderRadioCaps* caps)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioCapsObject* self = binder_radio_caps_cast(caps);
if (G_LIKELY(self)) {
@@ -786,6 +845,7 @@ binder_radio_caps_signal_cb(
BinderRadioCapsObject* caps,
BinderRadioCapsClosure* closure)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
closure->cb(&caps->pub, closure->user_data);
}
@@ -795,6 +855,7 @@ binder_radio_caps_add_raf_handler(
BinderRadioCapsFunc cb,
void* arg)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioCapsObject* self = binder_radio_caps_cast(caps);
if (G_LIKELY(self) && G_LIKELY(cb)) {
@@ -818,6 +879,7 @@ binder_radio_caps_remove_handler(
BinderRadioCaps* caps,
gulong id)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(id)) {
BinderRadioCapsObject* self = binder_radio_caps_cast(caps);
@@ -832,6 +894,7 @@ void
binder_radio_caps_object_finalize(
GObject* object)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioCapsObject* self = RADIO_CAPS(object);
BinderRadioCapsManager* mgr = self->pub.mgr;
@@ -868,6 +931,7 @@ void
binder_radio_caps_object_init(
BinderRadioCapsObject* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
self->idle_pool = gutil_idle_pool_ref
(gutil_idle_pool_get(&binder_radio_caps_shared_pool));
}
@@ -876,6 +940,7 @@ static
void
binder_radio_caps_object_class_init(BinderRadioCapsObjectClass* klass)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
G_OBJECT_CLASS(klass)->finalize = binder_radio_caps_object_finalize;
binder_radio_caps_signals[CAPS_SIGNAL_RAF_CHANGED] =
g_signal_new(CAPS_SIGNAL_RAF_CHANGED_NAME,
@@ -893,6 +958,7 @@ binder_radio_caps_manager_order_str(
BinderRadioCapsManager* self,
const guint* order)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
const guint n = self->caps_list->len;
if (n > 0) {
@@ -919,6 +985,7 @@ binder_radio_caps_manager_role_str(
BinderRadioCapsManager* self,
enum ofono_slot_data_role role)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
char* str;
switch (role) {
@@ -941,6 +1008,7 @@ binder_radio_caps_manager_foreach(
BinderRadioCapsManager* self,
BinderRadioCapsEnumFunc cb)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
guint i;
const GPtrArray* list = self->caps_list;
@@ -955,6 +1023,7 @@ binder_radio_caps_manager_foreach_tx(
BinderRadioCapsManager* self,
BinderRadioCapsEnumFunc cb)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
guint i;
const GPtrArray* list = self->caps_list;
@@ -973,6 +1042,7 @@ gboolean
binder_radio_caps_manager_tx_pending(
BinderRadioCapsManager* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
guint i;
const GPtrArray* list = self->caps_list;
@@ -998,6 +1068,7 @@ gboolean
binder_radio_caps_manager_can_check(
BinderRadioCapsManager* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (self->caps_list && !binder_radio_caps_manager_tx_pending(self)) {
const GPtrArray* list = self->caps_list;
const BinderRadioCapsObject* prev_caps = NULL;
@@ -1051,6 +1122,7 @@ binder_radio_caps_manager_issue_requests(
const BinderRadioCapsRequestTxPhase* phase,
RadioRequestCompleteFunc handler)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
guint i;
const GPtrArray* list = self->caps_list;
@@ -1105,6 +1177,7 @@ binder_radio_caps_manager_next_transaction_cb(
BinderRadioCapsManager* self,
BinderRadioCapsObject* caps)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
radio_request_group_cancel(caps->g);
radio_client_remove_handlers(caps->client, caps->client_event_id +
CLIENT_EVENT_OWNER, 1);
@@ -1117,6 +1190,7 @@ void
binder_radio_caps_manager_next_transaction(
BinderRadioCapsManager* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
binder_radio_caps_manager_foreach(self,
binder_radio_caps_manager_next_transaction_cb);
self->tx_failed = FALSE;
@@ -1130,6 +1204,7 @@ void binder_radio_caps_manager_cancel_cb(
BinderRadioCapsManager* self,
BinderRadioCapsObject* caps)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
GASSERT(!caps->client_event_id[CLIENT_EVENT_OWNER]);
radio_request_group_unblock(caps->g);
}
@@ -1139,6 +1214,7 @@ void
binder_radio_caps_manager_transaction_done(
BinderRadioCapsManager* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
binder_radio_caps_manager_schedule_check(self);
binder_data_manager_assert_data_on(self->data_manager);
binder_radio_caps_manager_foreach(self,
@@ -1155,11 +1231,15 @@ binder_radio_caps_manager_abort_cb(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioCapsObject* caps = RADIO_CAPS(user_data);
BinderRadioCapsManager* self = caps->pub.mgr;
if (status == RADIO_TX_STATUS_OK) {
if (resp == RADIO_RESP_SET_RADIO_CAPABILITY) {
guint32 code = caps->interface_aidl == RADIO_MODEM_INTERFACE ?
RADIO_MODEM_RESP_SET_RADIO_CAPABILITY :
RADIO_RESP_SET_RADIO_CAPABILITY;
if (resp == code) {
if (error != RADIO_ERROR_NONE) {
DBG_(caps, "Failed to abort radio caps switch, error %s",
binder_radio_error_string(error));
@@ -1184,6 +1264,7 @@ void
binder_radio_caps_manager_abort_transaction(
BinderRadioCapsManager* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
guint i;
const GPtrArray* list = self->caps_list;
const int prev_tx_id = self->tx_id;
@@ -1223,14 +1304,18 @@ void binder_radio_caps_manager_next_phase_cb(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioCapsObject* caps = RADIO_CAPS(user_data);
BinderRadioCapsManager* self = caps->pub.mgr;
gboolean ok = FALSE;
GASSERT(caps->tx_pending > 0);
if (status == RADIO_TX_STATUS_OK) {
guint32 code = caps->interface_aidl == RADIO_MODEM_INTERFACE ?
RADIO_MODEM_RESP_SET_RADIO_CAPABILITY :
RADIO_RESP_SET_RADIO_CAPABILITY;
/* getRadioCapabilityResponse(RadioResponseInfo, RadioCapability rc) */
if (resp == RADIO_RESP_SET_RADIO_CAPABILITY) {
if (resp == code) {
if (error == RADIO_ERROR_NONE) {
GBinderReader reader;
const RadioCapability* rc;
@@ -1272,6 +1357,7 @@ void
binder_radio_caps_manager_next_phase(
BinderRadioCapsManager* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
/* Note: -1 > 2 if 2 is unsigned (which turns -1 into 4294967295) */
const int max_index = G_N_ELEMENTS(binder_radio_caps_tx_phase) - 1;
@@ -1321,6 +1407,7 @@ binder_radio_caps_manager_data_off_done(
BinderRadioCapsManager* self,
BinderRadioCapsObject* caps)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (!binder_radio_caps_manager_tx_pending(self)) {
if (self->tx_failed) {
DBG("failed to start the transaction");
@@ -1347,6 +1434,7 @@ binder_radio_caps_manager_data_disallowed(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioCapsObject* caps = RADIO_CAPS(user_data);
BinderRadioCapsManager* self = caps->pub.mgr;
@@ -1367,6 +1455,7 @@ binder_radio_caps_manager_data_off(
BinderRadioCapsManager* self,
BinderRadioCapsObject* caps)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (binder_data_manager_need_set_data_allowed(self->data_manager)) {
RadioRequest* req = binder_data_set_data_allowed_request_new(caps->g,
FALSE, binder_radio_caps_manager_data_disallowed, NULL, caps);
@@ -1391,6 +1480,7 @@ binder_radio_caps_manager_deactivate_data_call_done(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioCapsObject* caps = RADIO_CAPS(user_data);
BinderRadioCapsManager* self = caps->pub.mgr;
@@ -1426,6 +1516,7 @@ binder_radio_caps_deactivate_data_call(
BinderRadioCapsObject* caps,
int cid)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
RadioRequest* req = binder_data_deactivate_data_call_request_new(caps->g,
cid, binder_radio_caps_manager_deactivate_data_call_done,
NULL, caps);
@@ -1444,6 +1535,7 @@ binder_radio_caps_deactivate_data_call_cb(
gpointer list_data,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderDataCall* call = list_data;
if (call->status == RADIO_DATA_CALL_FAIL_NONE) {
@@ -1458,6 +1550,7 @@ binder_radio_caps_manager_deactivate_all_cb(
BinderRadioCapsManager* self,
BinderRadioCapsObject* caps)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderData* data = caps->data;
if (data) {
@@ -1471,6 +1564,7 @@ void
binder_radio_caps_manager_deactivate_all(
BinderRadioCapsManager* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
binder_radio_caps_manager_foreach_tx(self,
binder_radio_caps_manager_deactivate_all_cb);
if (!binder_radio_caps_manager_tx_pending(self)) {
@@ -1487,6 +1581,7 @@ binder_radio_caps_tx_wait_cb(
RadioClient* client,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioCapsObject* caps = RADIO_CAPS(user_data);
BinderRadioCapsManager* self = caps->pub.mgr;
const GPtrArray* list = self->caps_list;
@@ -1522,6 +1617,7 @@ void
binder_radio_caps_manager_lock_io_for_transaction(
BinderRadioCapsManager* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
const GPtrArray* list = self->caps_list;
gboolean can_start = TRUE;
guint i;
@@ -1570,6 +1666,7 @@ binder_radio_caps_manager_stop_sim_io_watch(
BinderRadioCapsManager* self,
BinderRadioCapsObject* caps)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
/* binder_sim_card_remove_handlers zeros the id */
binder_sim_card_remove_handlers(caps->simcard, caps->simcard_event_id +
SIM_EVENT_IO_ACTIVE_CHANGED, 1);
@@ -1581,6 +1678,7 @@ binder_radio_caps_tx_wait_sim_io_cb(
BinderSimCard* simcard,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioCapsObject* src = RADIO_CAPS(user_data);
BinderRadioCapsManager* self = src->pub.mgr;
const GPtrArray* list = self->caps_list;
@@ -1610,6 +1708,7 @@ binder_radio_caps_manager_start_sim_io_watch(
BinderRadioCapsManager* self,
BinderRadioCapsObject* caps)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
caps->simcard_event_id[SIM_EVENT_IO_ACTIVE_CHANGED] =
binder_sim_card_add_sim_io_active_changed_handler(caps->simcard,
binder_radio_caps_tx_wait_sim_io_cb, caps);
@@ -1620,6 +1719,7 @@ void
binder_radio_caps_manager_start_transaction(
BinderRadioCapsManager *self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
const GPtrArray* list = self->caps_list;
gboolean sim_io_active = FALSE;
guint i, count = 0;
@@ -1665,6 +1765,7 @@ binder_radio_caps_manager_set_order(
BinderRadioCapsManager* self,
const guint* order)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
const GPtrArray* list = self->caps_list;
guint i;
@@ -1689,6 +1790,7 @@ void
binder_radio_caps_manager_check(
BinderRadioCapsManager *self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (binder_radio_caps_manager_can_check(self)) {
guint i;
const GPtrArray* list = self->caps_list;
@@ -1727,6 +1829,7 @@ gboolean
binder_radio_caps_manager_check_cb(
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioCapsManager* self = RADIO_CAPS_MANAGER(user_data);
GASSERT(self->check_id);
@@ -1740,6 +1843,7 @@ void
binder_radio_caps_manager_recheck_later(
BinderRadioCapsManager* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (!binder_radio_caps_manager_tx_pending(self)) {
if (self->check_id) {
g_source_remove(self->check_id);
@@ -1755,6 +1859,7 @@ void
binder_radio_caps_manager_schedule_check(
BinderRadioCapsManager* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (!self->check_id && !binder_radio_caps_manager_tx_pending(self)) {
self->check_id = g_idle_add(binder_radio_caps_manager_check_cb, self);
}
@@ -1766,6 +1871,7 @@ binder_caps_manager_request_sort(
gconstpointer a,
gconstpointer b)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
const BinderRadioCapsRequest* r1 = *(void**)a;
const BinderRadioCapsRequest* r2 = *(void**)b;
@@ -1785,6 +1891,7 @@ void
binder_radio_caps_manager_consider_requests(
BinderRadioCapsManager* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
guint i;
gboolean changed = FALSE;
const GPtrArray* list = self->caps_list;
@@ -1827,6 +1934,7 @@ void
binder_radio_caps_manager_list_changed(
BinderRadioCapsManager* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
/* Order list elements according to slot numbers */
g_ptr_array_sort(self->caps_list, binder_radio_caps_slot_compare);
@@ -1841,6 +1949,7 @@ binder_radio_caps_manager_add(
BinderRadioCapsManager* self,
BinderRadioCapsObject* caps)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
g_ptr_array_add(self->caps_list, caps);
binder_radio_caps_manager_list_changed(self);
}
@@ -1850,6 +1959,7 @@ void binder_radio_caps_manager_remove(
BinderRadioCapsManager* self,
BinderRadioCapsObject* caps)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (g_ptr_array_remove(self->caps_list, caps)) {
binder_radio_caps_manager_list_changed(self);
}
@@ -1861,6 +1971,7 @@ binder_radio_caps_manager_add_tx_aborted_handler(
BinderRadioCapsManagerFunc cb,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return (G_LIKELY(self) && G_LIKELY(cb)) ? g_signal_connect(self,
CAPS_MANAGER_SIGNAL_ABORTED_NAME, G_CALLBACK(cb), user_data) : 0;
}
@@ -1871,6 +1982,7 @@ binder_radio_caps_manager_add_tx_done_handler(
BinderRadioCapsManagerFunc cb,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return (G_LIKELY(self) && G_LIKELY(cb)) ? g_signal_connect(self,
CAPS_MANAGER_SIGNAL_TX_DONE_NAME, G_CALLBACK(cb), user_data) : 0;
}
@@ -1880,6 +1992,7 @@ binder_radio_caps_manager_remove_handler(
BinderRadioCapsManager* self,
gulong id)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self) && G_LIKELY(id)) {
g_signal_handler_disconnect(self, id);
}
@@ -1891,6 +2004,7 @@ binder_radio_caps_manager_remove_handlers(
gulong* ids,
int count)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
gutil_disconnect_handlers(self, ids, count);
}
@@ -1898,6 +2012,7 @@ BinderRadioCapsManager*
binder_radio_caps_manager_ref(
BinderRadioCapsManager *self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self)) {
g_object_ref(RADIO_CAPS_MANAGER(self));
}
@@ -1908,6 +2023,7 @@ void
binder_radio_caps_manager_unref(
BinderRadioCapsManager* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(self)) {
g_object_unref(RADIO_CAPS_MANAGER(self));
}
@@ -1917,6 +2033,7 @@ BinderRadioCapsManager*
binder_radio_caps_manager_new(
BinderDataManager* dm)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioCapsManager* self = g_object_new(RADIO_CAPS_MANAGER_TYPE, 0);
self->data_manager = binder_data_manager_ref(dm);
@@ -1928,6 +2045,7 @@ void
binder_radio_caps_manager_init(
BinderRadioCapsManager* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
self->caps_list = g_ptr_array_new();
self->order_list = g_ptr_array_new();
self->requests = g_ptr_array_new();
@@ -1941,6 +2059,7 @@ void
binder_radio_caps_manager_finalize(
GObject* object)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioCapsManager* self = RADIO_CAPS_MANAGER(object);
GASSERT(!self->caps_list->len);
@@ -1962,6 +2081,7 @@ void
binder_radio_caps_manager_class_init(
BinderRadioCapsManagerClass* klass)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
GType type = G_OBJECT_CLASS_TYPE(klass);
G_OBJECT_CLASS(klass)->finalize = binder_radio_caps_manager_finalize;
@@ -1983,6 +2103,7 @@ binder_radio_caps_request_new(
enum ofono_radio_access_mode modes,
enum ofono_slot_data_role role)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioCapsRequest* req = NULL;
BinderRadioCapsObject* caps = binder_radio_caps_cast(pub);
@@ -2006,6 +2127,7 @@ void
binder_radio_caps_request_free(
BinderRadioCapsRequest* req)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (req) {
/* In case if g_object_unref frees the caps */
BinderRadioCapsManager* mgr =

View File

@@ -50,6 +50,7 @@ void
binder_radio_settings_callback_data_free(
gpointer cbd)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
g_slice_free(BinderRadioSettingsCbData, cbd);
}
@@ -61,6 +62,7 @@ binder_radio_settings_later(
BinderCallback cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioSettingsCbData* cbd = g_slice_new0(BinderRadioSettingsCbData);
cbd->self = self;
@@ -77,6 +79,7 @@ gboolean
binder_radio_settings_set_rat_mode_cb(
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioSettingsCbData* cbd = user_data;
BinderRadioSettings* self = cbd->self;
struct ofono_error error;
@@ -95,6 +98,7 @@ binder_radio_settings_set_rat_mode(
ofono_radio_settings_rat_mode_set_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioSettings* self = binder_radio_settings_get_data(rs);
DBG_(self, "%s", ofono_radio_access_mode_to_string(mode));
@@ -109,6 +113,7 @@ gboolean
binder_radio_settings_query_rat_mode_cb(
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioSettingsCbData* cbd = user_data;
BinderRadioSettings* self = cbd->self;
const enum ofono_radio_access_mode mode =
@@ -129,6 +134,7 @@ binder_radio_settings_query_rat_mode(
ofono_radio_settings_rat_mode_query_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioSettings* self = binder_radio_settings_get_data(rs);
DBG_(self, "");
@@ -141,6 +147,7 @@ gboolean
binder_radio_settings_query_available_rats_cb(
gpointer data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioSettingsCbData* cbd = data;
BinderRadioSettings* self = cbd->self;
struct ofono_error error;
@@ -159,6 +166,7 @@ binder_radio_settings_query_available_rats(
ofono_radio_settings_available_rats_query_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioSettings* self = binder_radio_settings_get_data(rs);
DBG_(self, "");
@@ -171,6 +179,7 @@ gboolean
binder_radio_settings_register(
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioSettings* self = user_data;
GASSERT(self->callback_id);
@@ -186,6 +195,7 @@ binder_radio_settings_probe(
unsigned int vendor,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderModem* modem = binder_modem_get_data(data);
BinderRadioSettings* self = g_new0(struct binder_radio_settings, 1);
@@ -204,6 +214,7 @@ void
binder_radio_settings_remove(
struct ofono_radio_settings* rs)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderRadioSettings* self = binder_radio_settings_get_data(rs);
DBG_(self, "");
@@ -233,12 +244,14 @@ static const struct ofono_radio_settings_driver binder_radio_settings_driver = {
void
binder_radio_settings_init()
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ofono_radio_settings_driver_register(&binder_radio_settings_driver);
}
void
binder_radio_settings_cleanup()
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ofono_radio_settings_driver_unregister(&binder_radio_settings_driver);
}

File diff suppressed because it is too large Load Diff

View File

@@ -21,6 +21,7 @@
#include <radio_client.h>
#include <radio_request.h>
#include <radio_request_group.h>
#include <radio_sim_types.h>
#include <gbinder_reader.h>
#include <gbinder_writer.h>
@@ -59,6 +60,7 @@ typedef struct binder_sim_card_object {
RadioRequest* status_req;
RadioRequest* sub_req;
RadioRequestGroup* g;
RADIO_AIDL_INTERFACE interface_aidl;
guint sub_start_timer;
gulong event_id[EVENT_COUNT];
guint sim_io_idle_id;
@@ -110,6 +112,7 @@ binder_sim_card_app_equal(
const BinderSimCardApp* a1,
const BinderSimCardApp* a2)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (a1 == a2) {
return TRUE;
} else if (!a1 || !a2) {
@@ -132,6 +135,7 @@ binder_sim_card_status_compare(
const BinderSimCardStatus* s1,
const BinderSimCardStatus* s2)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (s1 == s2) {
return 0;
} else if (!s1 || !s2) {
@@ -168,6 +172,7 @@ void
binder_sim_card_status_free(
BinderSimCardStatus* status)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (status) {
if (status->apps) {
int i;
@@ -187,6 +192,7 @@ void
binder_sim_card_tx_start(
BinderSimCardObject* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
RADIO_BLOCK block = radio_request_group_block_status(self->g);
if (block == RADIO_BLOCK_NONE) {
@@ -201,6 +207,7 @@ void
binder_sim_card_tx_check(
BinderSimCardObject* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (radio_request_group_block_status(self->g) != RADIO_BLOCK_NONE) {
BinderSimCard* card = &self->card;
const BinderSimCardStatus* status = card->status;
@@ -229,6 +236,7 @@ void
binder_sim_card_subscription_done(
BinderSimCardObject* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (self->sub_start_timer) {
/* Don't need this timer anymore */
g_source_remove(self->sub_start_timer);
@@ -251,9 +259,12 @@ binder_sim_card_subscribe_cb(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSimCardObject* self = THIS(user_data);
guint32 code = self->interface_aidl == RADIO_SIM_INTERFACE ?
RADIO_SIM_RESP_SET_UICC_SUBSCRIPTION: RADIO_RESP_SET_UICC_SUBSCRIPTION;
GASSERT(resp == RADIO_RESP_SET_UICC_SUBSCRIPTION);
GASSERT(resp == code);
GASSERT(status == RADIO_TX_STATUS_OK);
GASSERT(error == RADIO_ERROR_NONE);
GASSERT(self->sub_req == req);
@@ -270,19 +281,30 @@ binder_sim_card_subscribe(
BinderSimCardObject* self,
int app_index)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSimCard* card = &self->card;
GBinderWriter args;
guint32 code = self->interface_aidl == RADIO_SIM_INTERFACE ?
RADIO_SIM_REQ_SET_UICC_SUBSCRIPTION : RADIO_REQ_SET_UICC_SUBSCRIPTION;
RadioRequest* req = radio_request_new2(self->g,
RADIO_REQ_SET_UICC_SUBSCRIPTION, &args,
code, &args,
binder_sim_card_subscribe_cb, NULL, self);
RadioSelectUiccSub* sub = gbinder_writer_new0(&args, RadioSelectUiccSub);
/* setUiccSubscription(serial, SelectUiccSub uiccSub) */
DBG("%u,%d", card->slot, app_index);
sub->slot = card->slot;
sub->appIndex = app_index;
sub->actStatus = RADIO_UICC_SUB_ACTIVATE;
gbinder_writer_append_buffer_object(&args, sub, sizeof(*sub));
if (self->interface_aidl == RADIO_AIDL_INTERFACE_NONE) {
gbinder_writer_append_buffer_object(&args, sub, sizeof(*sub));
} else {
gbinder_writer_append_parcelable(&args, sub, sizeof(*sub));
}
radio_request_set_retry(req, UICC_SUBSCRIPTION_RETRY_MS, -1);
radio_request_set_timeout(req, UICC_SUBSCRIPTION_TIMEOUT_MS);
@@ -304,6 +326,7 @@ int
binder_sim_card_select_app(
const BinderSimCardStatus *status)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
int i, selected_app = -1;
for (i = 0; i < status->num_apps; i++) {
@@ -326,6 +349,7 @@ void
binder_sim_card_update_app(
BinderSimCardObject* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSimCard* card = &self->card;
const BinderSimCardApp* old_app = card->app;
const BinderSimCardStatus* status = card->status;
@@ -364,6 +388,7 @@ gboolean
binder_sim_card_sub_start_timeout(
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSimCardObject* self = THIS(user_data);
DBG("%u", self->card.slot);
@@ -379,6 +404,7 @@ binder_sim_card_update_status(
BinderSimCardObject* self,
BinderSimCardStatus* status)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSimCard* card = &self->card;
const int diff = binder_sim_card_status_compare(card->status, status);
@@ -429,6 +455,7 @@ BinderSimCardStatus*
binder_sim_card_status_new(
const RadioCardStatus* radio_status)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
const guint num_apps = radio_status->apps.count;
BinderSimCardStatus* status = g_malloc0(sizeof(BinderSimCardStatus) +
num_apps * sizeof(BinderSimCardApp));
@@ -473,6 +500,90 @@ binder_sim_card_status_new(
return status;
}
static
BinderSimCardStatus*
binder_sim_card_status_new_from_aidl(
GBinderReader* reader)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
gint32 card_state, pin_state;
gint32 gsm_umts_index, cdma_index, ims_index;
guint32 num_apps = 0;
gsize parcel_size = binder_read_parcelable_size(reader);
BinderSimCardStatus* status = NULL;
char* atr, *iccid, *eid = NULL;
if (!parcel_size) {
return NULL;
}
gbinder_reader_read_int32(reader, &card_state);
gbinder_reader_read_int32(reader, &pin_state);
gbinder_reader_read_int32(reader, &gsm_umts_index);
gbinder_reader_read_int32(reader, &cdma_index);
gbinder_reader_read_int32(reader, &ims_index);
gbinder_reader_read_uint32(reader, &num_apps);
DBG("card_state=%d, universal_pin_state=%d, gsm_umts_index=%d, "
"ims_index=%d, cdma_index=%d, num_apps=%d",
card_state, pin_state, gsm_umts_index, cdma_index,
ims_index, num_apps);
/* The observed size of parcel for empty SIM slot */
GASSERT(parcel_size >= 64);
status = g_malloc0(sizeof(BinderSimCardStatus) +
num_apps * sizeof(BinderSimCardApp));
status->card_state = card_state;
status->pin_state = pin_state;
status->gsm_umts_index = gsm_umts_index;
status->ims_index = ims_index;
if ((status->num_apps = num_apps) > 0) {
guint i;
status->apps = (BinderSimCardApp*)(status + 1);
for (i = 0; i < num_apps; i++) {
BinderSimCardApp* app = status->apps + i;
gsize app_parcel_size = binder_read_parcelable_size(reader);
GASSERT(app_parcel_size >= sizeof(guint32) * 8);
gbinder_reader_read_int32(reader, (gint32*)&app->app_type);
gbinder_reader_read_int32(reader, (gint32*)&app->app_state);
gbinder_reader_read_int32(reader, (gint32*)&app->perso_substate);
app->aid = gbinder_reader_read_string16(reader);
app->label = gbinder_reader_read_string16(reader);
gbinder_reader_read_bool(reader, (gboolean*)&app->pin_replaced);
gbinder_reader_read_int32(reader, (gint32*)&app->pin1_state);
gbinder_reader_read_int32(reader, (gint32*)&app->pin2_state);
DBG("app[%d]: app_parcel_size=%d, type=%d, state=%d, perso_substate=%d, "
"aid_ptr=%s, label=%s, pin1_replaced=%d, pin1=%d, pin2=%d", i,
app_parcel_size, app->app_type, app->app_state, app->perso_substate,
app->aid, app->label, app->pin_replaced, app->pin1_state,
app->pin2_state);
}
}
/* Not used by the plugin, but useful to visually verify the parsing */
atr = gbinder_reader_read_string16(reader);
iccid = gbinder_reader_read_string16(reader);
eid = gbinder_reader_read_string16(reader);
DBG("atr=%s, iccid=%s, eid=%s", atr ? atr : "(null)",
iccid ? iccid : "(null)", eid ? eid : "(null)");
g_free(atr);
g_free(iccid);
g_free(eid);
return status;
}
static
void
binder_sim_card_status_cb(
@@ -483,6 +594,7 @@ binder_sim_card_status_cb(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSimCardObject* self = THIS(user_data);
GASSERT(self->status_req);
@@ -498,37 +610,41 @@ binder_sim_card_status_cb(
GBinderReader reader;
gbinder_reader_copy(&reader, args);
switch (resp) {
case RADIO_RESP_GET_ICC_CARD_STATUS:
status_1_0 = gbinder_reader_read_hidl_struct(&reader,
RadioCardStatus);
if (status_1_0) {
status = binder_sim_card_status_new(status_1_0);
if (self->interface_aidl == RADIO_AIDL_INTERFACE_NONE) {
switch (resp) {
case RADIO_RESP_GET_ICC_CARD_STATUS:
status_1_0 = gbinder_reader_read_hidl_struct(&reader,
RadioCardStatus);
if (status_1_0) {
status = binder_sim_card_status_new(status_1_0);
}
break;
case RADIO_RESP_GET_ICC_CARD_STATUS_1_2:
status_1_2 = gbinder_reader_read_hidl_struct(&reader,
RadioCardStatus_1_2);
if (status_1_2) {
status = binder_sim_card_status_new(&status_1_2->base);
}
break;
case RADIO_RESP_GET_ICC_CARD_STATUS_RESPONSE_1_4:
status_1_4 = gbinder_reader_read_hidl_struct(&reader,
RadioCardStatus_1_4);
if (status_1_4) {
status = binder_sim_card_status_new(&status_1_4->base);
}
break;
case RADIO_RESP_GET_ICC_CARD_STATUS_1_5:
status_1_5 = gbinder_reader_read_hidl_struct(&reader,
RadioCardStatus_1_5);
if (status_1_5) {
status = binder_sim_card_status_new(&status_1_5->base.base);
}
break;
default:
ofono_warn("Unexpected getIccCardStatus response %u", resp);
}
break;
case RADIO_RESP_GET_ICC_CARD_STATUS_1_2:
status_1_2 = gbinder_reader_read_hidl_struct(&reader,
RadioCardStatus_1_2);
if (status_1_2) {
status = binder_sim_card_status_new(&status_1_2->base);
}
break;
case RADIO_RESP_GET_ICC_CARD_STATUS_RESPONSE_1_4:
status_1_4 = gbinder_reader_read_hidl_struct(&reader,
RadioCardStatus_1_4);
if (status_1_4) {
status = binder_sim_card_status_new(&status_1_4->base);
}
break;
case RADIO_RESP_GET_ICC_CARD_STATUS_1_5:
status_1_5 = gbinder_reader_read_hidl_struct(&reader,
RadioCardStatus_1_5);
if (status_1_5) {
status = binder_sim_card_status_new(&status_1_5->base.base);
}
break;
default:
ofono_warn("Unexpected getIccCardStatus response %u", resp);
} else {
status = binder_sim_card_status_new_from_aidl(&reader);
}
if (status) {
@@ -543,12 +659,16 @@ void
binder_sim_card_get_status(
BinderSimCardObject* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (self->status_req) {
/* Retry right away, don't wait for retry timeout to expire */
radio_request_retry(self->status_req);
} else {
guint32 code = self->interface_aidl == RADIO_SIM_INTERFACE ?
RADIO_SIM_REQ_GET_ICC_CARD_STATUS : RADIO_REQ_GET_ICC_CARD_STATUS;
self->status_req = radio_request_new2(self->g,
RADIO_REQ_GET_ICC_CARD_STATUS, NULL,
code, NULL,
binder_sim_card_status_cb, NULL, self);
/*
@@ -566,6 +686,7 @@ void
binder_sim_card_update_sim_io_active(
BinderSimCardObject* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
/* SIM I/O is considered active for certain period of time after
* the last request has completed. That's because SIM_IO requests
* are usually submitted in large quantities and quick succession.
@@ -589,6 +710,7 @@ gboolean
binder_sim_card_sim_io_idle_cb(
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSimCardObject* self = THIS(user_data);
if (++(self->sim_io_idle_count) >= SIM_IO_IDLE_LOOPS) {
@@ -609,6 +731,7 @@ binder_sim_card_status_changed(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
binder_sim_card_get_status(THIS(user_data));
}
@@ -621,21 +744,34 @@ binder_sim_card_new(
RadioClient* client,
guint slot)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSimCardObject* self = g_object_new(THIS_TYPE, NULL);
BinderSimCard *card = &self->card;
DBG("%u", slot);
card->slot = slot;
self->g = radio_request_group_new(client); /* Keeps ref to client */
self->interface_aidl = radio_client_aidl_interface(client);
self->event_id[EVENT_SIM_STATUS_CHANGED] =
radio_client_add_indication_handler(client,
RADIO_IND_SIM_STATUS_CHANGED,
binder_sim_card_status_changed, self);
self->event_id[EVENT_UICC_SUBSCRIPTION_STATUS_CHANGED] =
radio_client_add_indication_handler(client,
RADIO_IND_SUBSCRIPTION_STATUS_CHANGED,
binder_sim_card_status_changed, self);
if (self->interface_aidl == RADIO_AIDL_INTERFACE_NONE) {
self->event_id[EVENT_SIM_STATUS_CHANGED] =
radio_client_add_indication_handler(client,
RADIO_IND_SIM_STATUS_CHANGED,
binder_sim_card_status_changed, self);
self->event_id[EVENT_UICC_SUBSCRIPTION_STATUS_CHANGED] =
radio_client_add_indication_handler(client,
RADIO_IND_SUBSCRIPTION_STATUS_CHANGED,
binder_sim_card_status_changed, self);
} else {
self->event_id[EVENT_SIM_STATUS_CHANGED] =
radio_client_add_indication_handler(client,
RADIO_SIM_IND_SIM_STATUS_CHANGED,
binder_sim_card_status_changed, self);
self->event_id[EVENT_UICC_SUBSCRIPTION_STATUS_CHANGED] =
radio_client_add_indication_handler(client,
RADIO_SIM_IND_SUBSCRIPTION_STATUS_CHANGED,
binder_sim_card_status_changed, self);
}
binder_sim_card_get_status(self);
return card;
}
@@ -644,6 +780,7 @@ BinderSimCard*
binder_sim_card_ref(
BinderSimCard* card)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(card)) {
g_object_ref(THIS(card));
}
@@ -654,6 +791,7 @@ void
binder_sim_card_unref(
BinderSimCard* card)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(card)) {
g_object_unref(THIS(card));
}
@@ -663,6 +801,7 @@ void
binder_sim_card_reset(
BinderSimCard* card)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(card)) {
BinderSimCardObject* self = binder_sim_card_cast(card);
BinderSimCardStatus* status = g_new0(BinderSimCardStatus, 1);
@@ -680,6 +819,7 @@ void
binder_sim_card_request_status(
BinderSimCard* card)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(card)) {
binder_sim_card_get_status(binder_sim_card_cast(card));
}
@@ -690,6 +830,7 @@ binder_sim_card_sim_io_started(
BinderSimCard* card,
gpointer key)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSimCardObject* self = binder_sim_card_cast(card);
if (G_LIKELY(self) && G_LIKELY(key)) {
@@ -708,6 +849,7 @@ binder_sim_card_sim_io_finished(
BinderSimCard* card,
gpointer key)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (G_LIKELY(card) && G_LIKELY(key)) {
BinderSimCardObject* self = binder_sim_card_cast(card);
@@ -729,6 +871,7 @@ gboolean
binder_sim_card_ready(
BinderSimCard* card)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return card && card->app &&
((card->app->app_state == RADIO_APP_STATE_READY) ||
(card->app->app_state == RADIO_APP_STATE_SUBSCRIPTION_PERSO &&
@@ -741,6 +884,7 @@ binder_sim_card_add_status_received_handler(
BinderSimCardFunc fn,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSimCardObject* self = binder_sim_card_cast(card);
return (G_LIKELY(self) && G_LIKELY(fn)) ? g_signal_connect(self,
@@ -753,6 +897,7 @@ binder_sim_card_add_status_changed_handler(
BinderSimCardFunc fn,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSimCardObject* self = binder_sim_card_cast(card);
return (G_LIKELY(self) && G_LIKELY(fn)) ? g_signal_connect(self,
@@ -765,6 +910,7 @@ binder_sim_card_add_state_changed_handler(
BinderSimCardFunc fn,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSimCardObject* self = binder_sim_card_cast(card);
return (G_LIKELY(self) && G_LIKELY(fn)) ? g_signal_connect(self,
@@ -777,6 +923,7 @@ binder_sim_card_add_app_changed_handler(
BinderSimCardFunc fn,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSimCardObject* self = binder_sim_card_cast(card);
return (G_LIKELY(self) && G_LIKELY(fn)) ? g_signal_connect(self,
@@ -789,6 +936,7 @@ binder_sim_card_add_sim_io_active_changed_handler(
BinderSimCardFunc fn,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSimCardObject* self = binder_sim_card_cast(card);
return (G_LIKELY(self) && G_LIKELY(fn)) ? g_signal_connect(self,
@@ -800,6 +948,7 @@ binder_sim_card_remove_handler(
BinderSimCard* card,
gulong id)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSimCardObject* self = binder_sim_card_cast(card);
if (G_LIKELY(self) && G_LIKELY(id)) {
@@ -813,6 +962,7 @@ binder_sim_card_remove_handlers(
gulong* ids,
int n)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
gutil_disconnect_handlers(binder_sim_card_cast(card), ids, n);
}
@@ -825,6 +975,7 @@ void
binder_sim_card_init(
BinderSimCardObject* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
self->sim_io_pending = g_hash_table_new(g_direct_hash, g_direct_equal);
}
@@ -833,6 +984,7 @@ void
binder_sim_card_finalize(
GObject* object)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSimCardObject* self = THIS(object);
BinderSimCard* card = &self->card;
@@ -861,6 +1013,7 @@ void
binder_sim_card_class_init(
BinderSimCardObjectClass* klass)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
G_OBJECT_CLASS(klass)->finalize = binder_sim_card_finalize;
NEW_SIGNAL_(klass,STATUS_RECEIVED);
NEW_SIGNAL(klass,STATUS);

View File

@@ -51,6 +51,7 @@ BinderSimSettingsObject*
binder_sim_settings_cast(
BinderSimSettings* settings)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return G_LIKELY(settings) ?
THIS(G_CAST(settings, BinderSimSettingsObject, pub)) :
NULL;
@@ -62,6 +63,7 @@ binder_sim_settings_imsi_changed(
struct ofono_watch* watch,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSimSettingsObject* self = THIS(user_data);
if (g_strcmp0(self->imsi, watch->imsi)) {
@@ -83,6 +85,7 @@ binder_sim_settings_new(
const char* path,
enum ofono_radio_access_mode techs)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSimSettings* settings = NULL;
if (G_LIKELY(path)) {
@@ -104,6 +107,7 @@ BinderSimSettings*
binder_sim_settings_ref(
BinderSimSettings* settings)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSimSettingsObject* self = binder_sim_settings_cast(settings);
if (G_LIKELY(self)) {
@@ -116,6 +120,7 @@ void
binder_sim_settings_unref(
BinderSimSettings* settings)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSimSettingsObject* self = binder_sim_settings_cast(settings);
if (G_LIKELY(self)) {
@@ -128,6 +133,7 @@ binder_sim_settings_set_pref(
BinderSimSettings* settings,
enum ofono_radio_access_mode pref)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSimSettingsObject* self = binder_sim_settings_cast(settings);
if (G_LIKELY(self) && settings->pref != pref) {
@@ -144,6 +150,7 @@ binder_sim_settings_add_property_handler(
BinderSimSettingsPropertyFunc callback,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSimSettingsObject* self = binder_sim_settings_cast(settings);
return G_LIKELY(self) ? binder_base_add_property_handler(&self->base,
@@ -155,6 +162,7 @@ binder_sim_settings_remove_handler(
BinderSimSettings* settings,
gulong id)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSimSettingsObject* self = binder_sim_settings_cast(settings);
if (G_LIKELY(self) && G_LIKELY(id)) {
@@ -168,6 +176,7 @@ binder_sim_settings_remove_handlers(
gulong* ids,
int count)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
gutil_disconnect_handlers(binder_sim_settings_cast(settings), ids, count);
}
@@ -180,6 +189,7 @@ void
binder_sim_settings_object_init(
BinderSimSettingsObject* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
}
static
@@ -187,6 +197,7 @@ void
binder_sim_settings_object_finalize(
GObject* object)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSimSettingsObject* self = THIS(object);
ofono_watch_remove_all_handlers(self->watch, self->watch_event_id);
@@ -200,6 +211,7 @@ void
binder_sim_settings_object_class_init(
BinderSimSettingsObjectClass* klass)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
G_OBJECT_CLASS(klass)->finalize = binder_sim_settings_object_finalize;
BINDER_BASE_CLASS(klass)->public_offset =
G_STRUCT_OFFSET(BinderSimSettingsObject, pub);

View File

@@ -1,6 +1,7 @@
/*
* oFono - Open Source Telephony - binder based adaptation
*
* Copyright (C) 2024 Slava Monich <slava@monich.com>
* Copyright (C) 2021-2022 Jolla Ltd.
*
* This program is free software; you can redistribute it and/or modify
@@ -22,7 +23,7 @@
#include "binder_ext_slot.h"
#include "binder_ext_sms.h"
#include <ofono/log.h>
#include <ofono/ims.h>
#include <ofono/misc.h>
#include <ofono/sim.h>
#include <ofono/sms.h>
@@ -31,6 +32,7 @@
#include <radio_client.h>
#include <radio_request.h>
#include <radio_request_group.h>
#include <radio_messaging_types.h>
#include <gbinder_reader.h>
#include <gbinder_writer.h>
@@ -81,6 +83,7 @@ typedef struct binder_sms {
BinderExtSms* sms_ext;
BinderImsReg* ims_reg;
RadioRequestGroup* g;
RADIO_AIDL_INTERFACE interface_aidl;
gulong ext_event[SMS_EXT_EVENT_COUNT];
gulong radio_event[SMS_RADIO_EVENT_COUNT];
guint register_id;
@@ -142,6 +145,7 @@ binder_sms_cbd_new(
BinderCallback cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSmsCbData* cbd = g_slice_new0(BinderSmsCbData);
cbd->self = self;
@@ -155,6 +159,7 @@ void
binder_sms_cbd_free(
gpointer cbd)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
g_slice_free(BinderSmsCbData, cbd);
}
@@ -168,6 +173,7 @@ binder_sms_submit_cbd_new(
ofono_sms_submit_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSmsSubmitCbData* cbd = g_slice_new0(BinderSmsSubmitCbData);
cbd->self = self;
@@ -184,6 +190,7 @@ void
binder_sms_submit_cbd_free(
gpointer data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSmsSubmitCbData* cbd = data;
g_free(cbd->pdu);
@@ -196,6 +203,7 @@ binder_sms_sim_read_data_new(
BinderSms* self,
int rec)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSmsSimReadData* rd = g_slice_new0(BinderSmsSimReadData);
rd->self = self;
@@ -208,6 +216,7 @@ void
binder_sms_sim_read_data_free(
BinderSmsSimReadData* rd)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
gutil_slice_free(rd);
}
@@ -221,12 +230,16 @@ binder_sms_sca_set_cb(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSmsCbData* cbd = user_data;
ofono_sms_sca_set_cb_t cb = cbd->cb.sca_set;
struct ofono_error err;
if (status == RADIO_TX_STATUS_OK) {
if (resp == RADIO_RESP_SET_SMSC_ADDRESS) {
guint32 code = cbd->self->interface_aidl == RADIO_MESSAGING_INTERFACE ?
RADIO_MESSAGING_RESP_SET_SMSC_ADDRESS :
RADIO_RESP_SET_SMSC_ADDRESS;
if (resp == code) {
if (error == RADIO_ERROR_NONE) {
cb(binder_error_ok(&err), cbd->data);
return;
@@ -250,19 +263,27 @@ binder_sms_sca_set(
ofono_sms_sca_set_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSms* self = binder_sms_get_data(sms);
char* tmp = NULL;
GBinderWriter writer;
const char* number = (sca->type == OFONO_NUMBER_TYPE_INTERNATIONAL) ?
(tmp = g_strconcat("+", sca->number, NULL)) : sca->number;
guint32 code = self->interface_aidl == RADIO_MESSAGING_INTERFACE ?
RADIO_MESSAGING_REQ_SET_SMSC_ADDRESS :
RADIO_REQ_SET_SMSC_ADDRESS;
/* setSmscAddress(int32_t serial, string smsc); */
RadioRequest* req = radio_request_new2(self->g,
RADIO_REQ_SET_SMSC_ADDRESS, &writer, binder_sms_sca_set_cb,
code, &writer, binder_sms_sca_set_cb,
binder_sms_cbd_free, binder_sms_cbd_new(self, BINDER_CB(cb), data));
DBG_(self, "setting sca: %s", number);
binder_append_hidl_string(&writer, number);
if (self->interface_aidl == RADIO_AIDL_INTERFACE_NONE) {
binder_append_hidl_string(&writer, number);
} else {
gbinder_writer_append_string16(&writer, number);
}
if (!radio_request_submit(req)) {
struct ofono_error err;
@@ -284,30 +305,42 @@ binder_sms_sca_query_cb(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSmsCbData* cbd = user_data;
BinderSms* self = cbd->self;
ofono_sms_sca_query_cb_t cb = cbd->cb.sca_query;
struct ofono_error err;
if (status == RADIO_TX_STATUS_OK) {
if (resp == RADIO_RESP_GET_SMSC_ADDRESS) {
guint32 code = self->interface_aidl == RADIO_MESSAGING_INTERFACE ?
RADIO_MESSAGING_RESP_GET_SMSC_ADDRESS :
RADIO_RESP_GET_SMSC_ADDRESS;
if (resp == code) {
if (error == RADIO_ERROR_NONE) {
GBinderReader reader;
const char* smsc;
char* smsc;
gbinder_reader_copy(&reader, args);
smsc = gbinder_reader_read_hidl_string_c(&reader);
if (self->interface_aidl == RADIO_AIDL_INTERFACE_NONE) {
smsc = gbinder_reader_read_hidl_string(&reader);
} else {
smsc = gbinder_reader_read_string16(&reader);
}
if (smsc) {
struct ofono_phone_number sca;
const char* str = smsc;
if (smsc[0] == '+') {
smsc++;
if (str[0] == '+') {
str++;
sca.type = OFONO_NUMBER_TYPE_INTERNATIONAL;
} else {
sca.type = OFONO_NUMBER_TYPE_UNKNOWN;
}
g_strlcpy(sca.number, smsc, sizeof(sca.number));
g_strlcpy(sca.number, str, sizeof(sca.number));
DBG("csca_query_cb: %s, %d", sca.number, sca.type);
cb(binder_error_ok(&err), &sca, cbd->data);
g_free(smsc);
return;
}
} else {
@@ -330,9 +363,13 @@ binder_sms_sca_query(
ofono_sms_sca_query_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSms* self = binder_sms_get_data(sms);
guint32 code = self->interface_aidl == RADIO_MESSAGING_INTERFACE ?
RADIO_MESSAGING_REQ_GET_SMSC_ADDRESS :
RADIO_REQ_GET_SMSC_ADDRESS;
RadioRequest* req = radio_request_new2(self->g,
RADIO_REQ_GET_SMSC_ADDRESS, NULL, binder_sms_sca_query_cb,
code, NULL, binder_sms_sca_query_cb,
binder_sms_cbd_free, binder_sms_cbd_new(self, BINDER_CB(cb), data));
DBG_(self, "sending csca_query");
@@ -349,7 +386,9 @@ gboolean
binder_sms_can_send_ims_message(
BinderSms* self)
{
return self->ims_reg && self->ims_reg->registered;
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return self->ims_reg && self->ims_reg->registered &&
(self->ims_reg->caps & OFONO_IMS_SMS_CAPABLE);
}
static
@@ -357,6 +396,7 @@ gboolean
binder_sms_can_send_ext_message(
BinderSms* self)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return self->sms_ext && (!(binder_ext_sms_get_interface_flags
(self->sms_ext) & BINDER_EXT_SMS_INTERFACE_FLAG_IMS_REQUIRED) ||
binder_sms_can_send_ims_message(self));
@@ -372,13 +412,17 @@ binder_sms_submit_cb(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSmsSubmitCbData* cbd = user_data;
BinderSms* self = cbd->self;
ofono_sms_submit_cb_t cb = cbd->cb;
struct ofono_error err;
binder_error_init_failure(&err);
if (status == RADIO_TX_STATUS_OK) {
const gboolean ims = (resp == RADIO_RESP_SEND_IMS_SMS);
const gboolean ims = self->interface_aidl == RADIO_MESSAGING_INTERFACE ?
((RADIO_MESSAGING_RESP)resp == RADIO_MESSAGING_RESP_SEND_IMS_SMS) :
(resp == RADIO_RESP_SEND_IMS_SMS);
/*
* Luckily, all 3 responses that we're handling here have the
@@ -388,47 +432,95 @@ binder_sms_submit_cb(
* sendSMSExpectMoreResponse(RadioResponseInfo, SendSmsResult sms);
* sendImsSmsResponse(RadioResponseInfo, SendSmsResult sms);
*/
if (resp == RADIO_RESP_SEND_SMS ||
resp == RADIO_RESP_SEND_SMS_EXPECT_MORE ||
resp == RADIO_RESP_SEND_IMS_SMS) {
if (error == RADIO_ERROR_NONE) {
const RadioSendSmsResult* res;
GBinderReader reader;
if (self->interface_aidl == RADIO_AIDL_INTERFACE_NONE) {
if (resp == RADIO_RESP_SEND_SMS ||
resp == RADIO_RESP_SEND_SMS_EXPECT_MORE ||
resp == RADIO_RESP_SEND_IMS_SMS) {
if (error == RADIO_ERROR_NONE) {
const RadioSendSmsResult* res;
GBinderReader reader;
gbinder_reader_copy(&reader, args);
res = gbinder_reader_read_hidl_struct(&reader,
RadioSendSmsResult);
gbinder_reader_copy(&reader, args);
res = gbinder_reader_read_hidl_struct(&reader,
RadioSendSmsResult);
if (res) {
DBG("%ssms msg ref: %d, ack: %s err: %d", ims ? "ims " : "",
res->messageRef, res->ackPDU.data.str, res->errorCode);
if (res) {
DBG("%ssms msg ref: %d, ack: %s err: %d", ims ? "ims " : "",
res->messageRef, res->ackPDU.data.str, res->errorCode);
/*
* Error is -1 if unknown or not applicable,
* otherwise 3GPP 27.005, 3.2.5
*/
if (res->errorCode > 0) {
err.type = OFONO_ERROR_TYPE_CMS;
err.error = res->errorCode;
} else {
/* Success */
cb(binder_error_ok(&err), res->messageRef, cbd->data);
return;
/*
* Error is -1 if unknown or not applicable,
* otherwise 3GPP 27.005, 3.2.5
*/
if (res->errorCode > 0) {
err.type = OFONO_ERROR_TYPE_CMS;
err.error = res->errorCode;
} else {
/* Success */
cb(binder_error_ok(&err), res->messageRef, cbd->data);
return;
}
}
} else {
ofono_error("%ssms send error %s", ims ? "ims " : "",
binder_radio_error_string(error));
}
if (ims && cbd->pdu) {
/* Failed to send IMS SMS, try GSM */
binder_sms_send(cbd->self, cbd->pdu, cbd->pdu_len,
cbd->tpdu_len, BINDER_SMS_SEND_FLAG_FORCE_GSM,
cbd->cb, cbd->data);
return;
}
} else {
ofono_error("%ssms send error %s", ims ? "ims " : "",
binder_radio_error_string(error));
}
if (ims && cbd->pdu) {
/* Failed to send IMS SMS, try GSM */
binder_sms_send(cbd->self, cbd->pdu, cbd->pdu_len,
cbd->tpdu_len, BINDER_SMS_SEND_FLAG_FORCE_GSM,
cbd->cb, cbd->data);
return;
ofono_error("Unexpected send sms response %d", resp);
}
} else {
ofono_error("Unexpected send sms response %d", resp);
if ((RADIO_MESSAGING_RESP)resp == RADIO_MESSAGING_RESP_SEND_SMS ||
(RADIO_MESSAGING_RESP)resp == RADIO_MESSAGING_RESP_SEND_SMS_EXPECT_MORE ||
(RADIO_MESSAGING_RESP)resp == RADIO_MESSAGING_RESP_SEND_IMS_SMS) {
if (error == RADIO_ERROR_NONE) {
GBinderReader reader;
gbinder_reader_copy(&reader, args);
if (binder_read_parcelable_size(&reader)) {
gint32 message_ref;
char* ack_pdu = NULL;
gint32 error_code;
gbinder_reader_read_int32(&reader, &message_ref);
ack_pdu = gbinder_reader_read_string16(&reader);
gbinder_reader_read_int32(&reader, &error_code);
DBG("%ssms msg ref: %d, ack: %s err: %d", ims ? "ims " : "",
message_ref, ack_pdu, error_code);
g_free(ack_pdu);
/*
* Error is -1 if unknown or not applicable,
* otherwise 3GPP 27.005, 3.2.5
*/
if (error_code > 0) {
err.type = OFONO_ERROR_TYPE_CMS;
err.error = error_code;
} else {
/* Success */
cb(binder_error_ok(&err), message_ref, cbd->data);
return;
}
}
} else {
ofono_error("%ssms send error %s", ims ? "ims " : "",
binder_radio_error_string(error));
}
if (ims && cbd->pdu) {
/* Failed to send IMS SMS, try GSM */
binder_sms_send(cbd->self, cbd->pdu, cbd->pdu_len,
cbd->tpdu_len, BINDER_SMS_SEND_FLAG_FORCE_GSM,
cbd->cb, cbd->data);
return;
}
}
}
}
/* Error path */
@@ -443,6 +535,7 @@ binder_sms_submit_ext_cb(
guint msg_ref,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSmsSubmitCbData* cbd = user_data;
BinderSms* self = cbd->self;
struct ofono_error err;
@@ -489,6 +582,7 @@ binder_sms_gsm_message(
int tpdu_len,
const GBinderParent* parent)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
/*
* SMSC address:
*
@@ -530,6 +624,7 @@ binder_sms_ims_message(
int pdu_len,
int tpdu_len)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
RadioImsSmsMessage* ims = gbinder_writer_new0(writer, RadioImsSmsMessage);
RadioGsmSmsMessage* gsm = gbinder_writer_new0(writer, RadioGsmSmsMessage);
GBinderParent p;
@@ -547,6 +642,81 @@ binder_sms_ims_message(
binder_sms_gsm_message(self, writer, gsm, pdu, pdu_len, tpdu_len, &p);
}
static
void
binder_sms_gsm_message_aidl(
BinderSms* self,
GBinderWriter* writer,
const unsigned char* pdu,
int pdu_len,
int tpdu_len)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
/*
* SMSC address:
*
* smsc_len == 1, then zero-length SMSC was specified but IRadio
* interface expects an empty string for default SMSC.
*/
char* tpdu;
int smsc_len = pdu_len - tpdu_len;
gint32 initial_size;
/* PDU is sent as an ASCII hex string */
tpdu = g_malloc0(sizeof(char) * (tpdu_len * 2 + 1));
ofono_encode_hex(pdu + smsc_len, tpdu_len, tpdu);
DBG_(self, "%s", tpdu);
/* Non-null parcelable */
gbinder_writer_append_int32(writer, 1);
initial_size = gbinder_writer_bytes_written(writer);
/* Dummy parcelable size, replaced at the end */
gbinder_writer_append_int32(writer, -1);
gbinder_writer_append_string16_len(writer, (const char*) pdu, smsc_len);
gbinder_writer_append_string16_len(writer, tpdu, tpdu_len * 2 + 1);
/* Overwrite parcelable size */
gbinder_writer_overwrite_int32(writer, initial_size,
gbinder_writer_bytes_written(writer) - initial_size);
g_free(tpdu);
}
static
void
binder_sms_ims_message_aidl(
BinderSms* self,
GBinderWriter* writer,
const unsigned char* pdu,
int pdu_len,
int tpdu_len)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
gint32 initial_size;
/* Non-null parcelable */
gbinder_writer_append_int32(writer, 1);
initial_size = gbinder_writer_bytes_written(writer);
/* Dummy parcelable size, replaced at the end */
gbinder_writer_append_int32(writer, -1);
gbinder_writer_append_int32(writer, RADIO_TECH_FAMILY_3GPP2);
gbinder_writer_append_bool(writer, FALSE);
gbinder_writer_append_int32(writer, 0);
/* CDMA message count */
gbinder_writer_append_int32(writer, 0);
/* GSM message count */
gbinder_writer_append_int32(writer, 1);
/* Overwrite parcelable size */
gbinder_writer_overwrite_int32(writer, initial_size,
gbinder_writer_bytes_written(writer) - initial_size);
binder_sms_gsm_message_aidl(self, writer, pdu, pdu_len, tpdu_len);
}
static
void
binder_sms_send(
@@ -558,6 +728,7 @@ binder_sms_send(
ofono_sms_submit_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSmsSubmitCbData* cbd = NULL;
struct ofono_error err;
@@ -591,16 +762,26 @@ binder_sms_send(
* sendSMSExpectMore(serial, GsmSmsMessage message);
*/
GBinderWriter writer;
guint32 code = self->interface_aidl == RADIO_MESSAGING_INTERFACE ?
((flags & BINDER_SMS_SEND_FLAG_EXPECT_MORE) ?
RADIO_MESSAGING_REQ_SEND_SMS_EXPECT_MORE :
RADIO_MESSAGING_REQ_SEND_SMS) :
((flags & BINDER_SMS_SEND_FLAG_EXPECT_MORE) ?
RADIO_REQ_SEND_SMS_EXPECT_MORE : RADIO_REQ_SEND_SMS);
RadioRequest* req = radio_request_new2(self->g,
(flags & BINDER_SMS_SEND_FLAG_EXPECT_MORE) ?
RADIO_REQ_SEND_SMS_EXPECT_MORE : RADIO_REQ_SEND_SMS, &writer,
code, &writer,
binder_sms_submit_cb, binder_sms_submit_cbd_free,
cbd ? cbd : /* No need to copy the PDU */
binder_sms_submit_cbd_new(self, NULL, 0, 0, cb, data));
binder_sms_gsm_message(self, &writer,
gbinder_writer_new0(&writer, RadioGsmSmsMessage),
pdu, pdu_len, tpdu_len, NULL);
if (self->interface_aidl == RADIO_AIDL_INTERFACE_NONE) {
binder_sms_gsm_message(self, &writer,
gbinder_writer_new0(&writer, RadioGsmSmsMessage),
pdu, pdu_len, tpdu_len, NULL);
} else {
binder_sms_gsm_message_aidl(self, &writer,
pdu, pdu_len, tpdu_len);
}
if (radio_request_submit(req)) {
radio_request_unref(req);
/* Request submitted */
@@ -609,14 +790,21 @@ binder_sms_send(
} else if (self->use_standard_ims_sms_api) {
/* sendImsSms(serial, ImsSmsMessage message); */
GBinderWriter writer;
guint32 code = self->interface_aidl == RADIO_MESSAGING_INTERFACE ?
RADIO_MESSAGING_REQ_SEND_IMS_SMS : RADIO_REQ_SEND_IMS_SMS;
RadioRequest* req = radio_request_new2(self->g,
RADIO_REQ_SEND_IMS_SMS, &writer,
code, &writer,
binder_sms_submit_cb, binder_sms_submit_cbd_free,
cbd ? cbd : /* Copy the PDU for GSM SMS fallback */
binder_sms_submit_cbd_new(self, pdu, pdu_len, tpdu_len, cb, data));
DBG("sending ims message");
binder_sms_ims_message(self, &writer, pdu, pdu_len, tpdu_len);
if (self->interface_aidl == RADIO_AIDL_INTERFACE_NONE) {
binder_sms_ims_message(self, &writer, pdu, pdu_len, tpdu_len);
} else {
binder_sms_ims_message_aidl(self, &writer, pdu, pdu_len, tpdu_len);
}
if (radio_request_submit(req)) {
radio_request_unref(req);
/* Request submitted */
@@ -642,6 +830,7 @@ binder_sms_submit(
ofono_sms_submit_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
binder_sms_send(binder_sms_get_data(sms), pdu, pdu_len, tpdu_len,
expect_more ? BINDER_SMS_SEND_FLAG_EXPECT_MORE :
BINDER_SMS_SEND_FLAGS_NONE, cb, data);
@@ -657,8 +846,13 @@ binder_sms_ack_cb(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSms* self = user_data;
if (status == RADIO_TX_STATUS_OK) {
if (resp == RADIO_RESP_ACKNOWLEDGE_LAST_INCOMING_GSM_SMS) {
guint32 code = self->interface_aidl == RADIO_MESSAGING_INTERFACE ?
RADIO_MESSAGING_RESP_ACKNOWLEDGE_LAST_INCOMING_GSM_SMS :
RADIO_RESP_ACKNOWLEDGE_LAST_INCOMING_GSM_SMS;
if (resp == code) {
if (error != RADIO_ERROR_NONE) {
ofono_error("SMS acknowledgement failed: %s",
binder_radio_error_string(error));
@@ -678,15 +872,19 @@ binder_sms_ack(
BinderSms* self,
gboolean ok)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
GBinderWriter writer;
guint32 code = self->interface_aidl == RADIO_MESSAGING_INTERFACE ?
RADIO_MESSAGING_REQ_ACKNOWLEDGE_LAST_INCOMING_GSM_SMS :
RADIO_REQ_ACKNOWLEDGE_LAST_INCOMING_GSM_SMS;
/*
* acknowledgeLastIncomingGsmSms(int32 serial, bool success,
* SmsAcknowledgeFailCause cause);
*/
RadioRequest* req = radio_request_new2(self->g,
RADIO_REQ_ACKNOWLEDGE_LAST_INCOMING_GSM_SMS, &writer,
binder_sms_ack_cb, NULL, NULL);
code, &writer,
binder_sms_ack_cb, NULL, self);
DBG_(self, "%s", ok ? "ok" : "fail");
gbinder_writer_append_bool(&writer, ok);
@@ -707,6 +905,7 @@ binder_sms_incoming(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSms* self = user_data;
GBinderReader reader;
const guint8* pdu;
@@ -717,12 +916,19 @@ binder_sms_incoming(
* newSmsStatusReport(RadioIndicationType, vec<uint8_t> pdu);
*/
gbinder_reader_copy(&reader, args);
pdu = gbinder_reader_read_hidl_byte_vec(&reader, &len);
if (self->interface_aidl == RADIO_AIDL_INTERFACE_NONE) {
pdu = gbinder_reader_read_hidl_byte_vec(&reader, &len);
} else {
pdu = gbinder_reader_read_byte_array(&reader, &len);
}
if (pdu) {
const guint pdu_len = (guint) len;
const guint smsc_len = (guint) pdu[0] + 1;
ofono_info("%s, %u bytes",(code == RADIO_IND_NEW_SMS) ?
guint32 ind_code = self->interface_aidl == RADIO_MESSAGING_INTERFACE ?
RADIO_MESSAGING_IND_NEW_SMS : RADIO_IND_NEW_SMS;
ofono_info("%s, %u bytes",(code == ind_code) ?
"incoming sms" : "sms status", pdu_len);
if (pdu_len > smsc_len) {
/* The PDU starts with the SMSC address per TS 27.005 (+CMT:) */
@@ -731,18 +937,34 @@ binder_sms_incoming(
DBG_(self, "smsc: %s", binder_print_hex(pdu, smsc_len));
DBG_(self, "tpdu: %s", binder_print_hex(pdu + smsc_len, tpdu_len));
switch (code) {
case RADIO_IND_NEW_SMS:
ofono_sms_deliver_notify(self->sms, pdu, pdu_len, tpdu_len);
binder_sms_ack(self, TRUE);
break;
case RADIO_IND_NEW_SMS_STATUS_REPORT:
ofono_sms_status_notify(self->sms, pdu, pdu_len, tpdu_len);
binder_sms_ack(self, TRUE);
break;
default:
binder_sms_ack(self, FALSE);
break;
if (self->interface_aidl == RADIO_AIDL_INTERFACE_NONE) {
switch (code) {
case RADIO_IND_NEW_SMS:
ofono_sms_deliver_notify(self->sms, pdu, pdu_len, tpdu_len);
binder_sms_ack(self, TRUE);
break;
case RADIO_IND_NEW_SMS_STATUS_REPORT:
ofono_sms_status_notify(self->sms, pdu, pdu_len, tpdu_len);
binder_sms_ack(self, TRUE);
break;
default:
binder_sms_ack(self, FALSE);
break;
}
} else {
switch (code) {
case RADIO_MESSAGING_IND_NEW_SMS:
ofono_sms_deliver_notify(self->sms, pdu, pdu_len, tpdu_len);
binder_sms_ack(self, TRUE);
break;
case RADIO_MESSAGING_IND_NEW_SMS_STATUS_REPORT:
ofono_sms_status_notify(self->sms, pdu, pdu_len, tpdu_len);
binder_sms_ack(self, TRUE);
break;
default:
binder_sms_ack(self, FALSE);
break;
}
}
return;
}
@@ -763,6 +985,7 @@ binder_sms_notify(
int len,
int tpdu_len))
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (pdu_len > 0) {
const guint smsc_len = (guint)pdu[0] + 1;
@@ -786,6 +1009,7 @@ binder_sms_ext_incoming(
guint pdu_len,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ofono_info("incoming %ssms, %u bytes", SMS_TYPE_STR(ext), pdu_len);
if (binder_sms_notify((BinderSms*) user_data, pdu, pdu_len,
ofono_sms_deliver_notify)) {
@@ -805,6 +1029,7 @@ binder_sms_ext_status_report(
guint msg_ref,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ofono_info("incoming %ssms report, %u bytes", SMS_TYPE_STR(ext), pdu_len);
if (binder_sms_notify((BinderSms*) user_data, pdu, pdu_len,
ofono_sms_status_notify)) {
@@ -825,8 +1050,13 @@ binder_sms_delete_on_sim_cb(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSms* self = user_data;
if (status == RADIO_TX_STATUS_OK) {
if (resp == RADIO_RESP_DELETE_SMS_ON_SIM) {
guint32 code = self->interface_aidl == RADIO_MESSAGING_INTERFACE ?
RADIO_MESSAGING_RESP_DELETE_SMS_ON_SIM :
RADIO_RESP_DELETE_SMS_ON_SIM;
if (resp == code) {
if (error == RADIO_ERROR_NONE) {
ofono_info("sms deleted from sim");
} else {
@@ -851,6 +1081,7 @@ binder_sms_on_sim_cb(
int length,
void* userdata)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSmsSimReadData* cbd = userdata;
BinderSms* self = cbd->self;
@@ -869,6 +1100,10 @@ binder_sms_on_sim_cb(
RadioRequest* req;
GBinderWriter writer;
const guint tpdu_len = pdu_len - smsc_len;
guint32 code =
self->interface_aidl == RADIO_MESSAGING_INTERFACE ?
RADIO_MESSAGING_REQ_DELETE_SMS_ON_SIM :
RADIO_REQ_DELETE_SMS_ON_SIM;
ofono_info("read sms from sim, %u bytes", pdu_len);
DBG_(self, "smsc: %s", binder_print_hex(pdu, smsc_len));
@@ -880,8 +1115,8 @@ binder_sms_on_sim_cb(
/* deleteSmsOnSim(int32 serial, int32 index); */
DBG_(self, "deleting record: %d", cbd->record);
req = radio_request_new2(self->g,
RADIO_REQ_DELETE_SMS_ON_SIM, &writer,
binder_sms_delete_on_sim_cb, NULL, NULL);
code, &writer,
binder_sms_delete_on_sim_cb, NULL, self);
gbinder_writer_append_int32(&writer, cbd->record);
radio_request_submit(req);
radio_request_unref(req);
@@ -906,6 +1141,7 @@ binder_sms_on_sim(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSms* self = user_data;
GBinderReader reader;
gint32 rec;
@@ -913,7 +1149,8 @@ binder_sms_on_sim(
ofono_info("new sms on sim");
/* newSmsOnSim(RadioIndicationType type, int32 recordNumber); */
GASSERT(code == RADIO_IND_NEW_SMS_ON_SIM);
GASSERT(code == RADIO_IND_NEW_SMS_ON_SIM ||
code == RADIO_MESSAGING_IND_NEW_SMS_ON_SIM);
gbinder_reader_copy(&reader, args);
if (gbinder_reader_read_int32(&reader, &rec)) {
DBG("rec %d", rec);
@@ -930,6 +1167,7 @@ static
gboolean binder_sms_register(
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSms* self = user_data;
RadioClient* client = self->g->client;
@@ -940,15 +1178,27 @@ gboolean binder_sms_register(
ofono_sms_register(self->sms);
/* Register event handlers */
self->radio_event[SMS_RADIO_EVENT_NEW_SMS] =
radio_client_add_indication_handler(client,
RADIO_IND_NEW_SMS, binder_sms_incoming, self);
self->radio_event[SMS_RADIO_EVENT_NEW_STATUS_REPORT] =
radio_client_add_indication_handler(client,
RADIO_IND_NEW_SMS_STATUS_REPORT, binder_sms_incoming, self);
self->radio_event[SMS_RADIO_EVENT_NEW_SMS_ON_SIM] =
radio_client_add_indication_handler(client,
RADIO_IND_NEW_SMS_ON_SIM, binder_sms_on_sim, self);
if (self->interface_aidl == RADIO_AIDL_INTERFACE_NONE) {
self->radio_event[SMS_RADIO_EVENT_NEW_SMS] =
radio_client_add_indication_handler(client,
RADIO_IND_NEW_SMS, binder_sms_incoming, self);
self->radio_event[SMS_RADIO_EVENT_NEW_STATUS_REPORT] =
radio_client_add_indication_handler(client,
RADIO_IND_NEW_SMS_STATUS_REPORT, binder_sms_incoming, self);
self->radio_event[SMS_RADIO_EVENT_NEW_SMS_ON_SIM] =
radio_client_add_indication_handler(client,
RADIO_IND_NEW_SMS_ON_SIM, binder_sms_on_sim, self);
} else {
self->radio_event[SMS_RADIO_EVENT_NEW_SMS] =
radio_client_add_indication_handler(client,
RADIO_MESSAGING_IND_NEW_SMS, binder_sms_incoming, self);
self->radio_event[SMS_RADIO_EVENT_NEW_STATUS_REPORT] =
radio_client_add_indication_handler(client,
RADIO_MESSAGING_IND_NEW_SMS_STATUS_REPORT, binder_sms_incoming, self);
self->radio_event[SMS_RADIO_EVENT_NEW_SMS_ON_SIM] =
radio_client_add_indication_handler(client,
RADIO_MESSAGING_IND_NEW_SMS_ON_SIM, binder_sms_on_sim, self);
}
if (self->sms_ext) {
/* Extension */
@@ -970,6 +1220,7 @@ binder_sms_probe(
unsigned int vendor,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderModem* modem = binder_modem_get_data(data);
BinderSms* self = g_new0(BinderSms, 1);
@@ -980,7 +1231,8 @@ binder_sms_probe(
self->watch = ofono_watch_new(binder_modem_get_path(modem));
self->sim_context = ofono_sim_context_create(self->watch->sim);
self->ims_reg = binder_ims_reg_ref(modem->ims);
self->g = radio_request_group_new(modem->client); /* Keeps ref to client */
self->g = radio_request_group_new(modem->messaging_client); /* Keeps ref to client */
self->interface_aidl = radio_client_aidl_interface(modem->messaging_client);
if (modem->ext && (self->sms_ext = binder_ext_slot_get_interface(modem->ext,
BINDER_EXT_TYPE_SMS)) != NULL) {
@@ -999,6 +1251,7 @@ void
binder_sms_remove(
struct ofono_sms* sms)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderSms* self = binder_sms_get_data(sms);
DBG_(self, "");
@@ -1044,12 +1297,14 @@ static const struct ofono_sms_driver binder_sms_driver = {
void
binder_sms_init()
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ofono_sms_driver_register(&binder_sms_driver);
}
void
binder_sms_cleanup()
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ofono_sms_driver_unregister(&binder_sms_driver);
}

View File

@@ -24,6 +24,8 @@
#include <radio_client.h>
#include <radio_request.h>
#include <radio_request_group.h>
#include <radio_sim_types.h>
#include <radio_voice_types.h>
#include <gbinder_reader.h>
#include <gbinder_writer.h>
@@ -39,6 +41,8 @@ typedef struct binder_stk {
struct ofono_stk* stk;
char* log_prefix;
RadioRequestGroup* g;
RADIO_AIDL_INTERFACE interface_aidl;
RadioClient* voice_client;
gulong event_id[STK_EVENT_COUNT];
guint register_id;
} BinderStk;
@@ -65,6 +69,7 @@ binder_stk_cbd_new(
BinderCallback cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderStkCbData* cbd = g_slice_new0(BinderStkCbData);
cbd->self = self;
@@ -78,6 +83,7 @@ void
binder_stk_cbd_free(
gpointer cbd)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
g_slice_free(BinderStkCbData, cbd);
}
@@ -89,13 +95,17 @@ static void binder_stk_envelope_cb(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderStkCbData* cbd = user_data;
ofono_stk_envelope_cb_t cb = cbd->cb.envelope;
struct ofono_error err;
DBG_(cbd->self, "");
if (status == RADIO_TX_STATUS_OK) {
if (resp == RADIO_RESP_SEND_ENVELOPE) {
guint32 code = cbd->self->interface_aidl == RADIO_SIM_INTERFACE ?
RADIO_SIM_RESP_SEND_ENVELOPE :
RADIO_RESP_SEND_ENVELOPE;
if (resp == code) {
if (error == RADIO_ERROR_NONE) {
cb(binder_error_ok(&err), NULL, 0, cbd->data);
return;
@@ -119,19 +129,29 @@ binder_stk_envelope(
ofono_stk_envelope_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderStk* self = binder_stk_get_data(stk);
char* hex = binder_encode_hex(cmd, length);
GBinderWriter writer;
guint32 code = self->interface_aidl == RADIO_SIM_INTERFACE ?
RADIO_SIM_REQ_SEND_ENVELOPE :
RADIO_REQ_SEND_ENVELOPE;
/* sendEnvelope(int32 serial, string command); */
RadioRequest* req = radio_request_new2(self->g,
RADIO_REQ_SEND_ENVELOPE, &writer,
code, &writer,
binder_stk_envelope_cb, binder_stk_cbd_free,
binder_stk_cbd_new(self, BINDER_CB(cb), data));
DBG("envelope %s", hex);
gbinder_writer_add_cleanup(&writer, g_free, hex);
gbinder_writer_append_hidl_string(&writer, hex);
if (self->interface_aidl == RADIO_AIDL_INTERFACE_NONE) {
gbinder_writer_append_hidl_string(&writer, hex);
} else {
gbinder_writer_append_string16(&writer, hex);
}
radio_request_submit(req);
radio_request_unref(req);
}
@@ -146,13 +166,17 @@ binder_stk_terminal_response_cb(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderStkCbData* cbd = user_data;
ofono_stk_generic_cb_t cb = cbd->cb.generic;
struct ofono_error err;
DBG_(cbd->self, "");
if (status == RADIO_TX_STATUS_OK) {
if (resp == RADIO_RESP_SEND_TERMINAL_RESPONSE_TO_SIM) {
guint32 code = cbd->self->interface_aidl == RADIO_SIM_INTERFACE ?
RADIO_SIM_RESP_SEND_TERMINAL_RESPONSE_TO_SIM :
RADIO_RESP_SEND_TERMINAL_RESPONSE_TO_SIM;
if (resp == code) {
if (error == RADIO_ERROR_NONE) {
cb(binder_error_ok(&err), cbd->data);
return;
@@ -177,19 +201,27 @@ binder_stk_terminal_response(
ofono_stk_generic_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderStk* self = binder_stk_get_data(stk);
char* hex = binder_encode_hex(resp, length);
GBinderWriter writer;
guint32 code = self->interface_aidl == RADIO_SIM_INTERFACE ?
RADIO_SIM_REQ_SEND_TERMINAL_RESPONSE_TO_SIM :
RADIO_REQ_SEND_TERMINAL_RESPONSE_TO_SIM;
/* sendTerminalResponseToSim(int32 serial, string commandResponse); */
RadioRequest* req = radio_request_new2(self->g,
RADIO_REQ_SEND_TERMINAL_RESPONSE_TO_SIM, &writer,
code, &writer,
binder_stk_terminal_response_cb, binder_stk_cbd_free,
binder_stk_cbd_new(self, BINDER_CB(cb), data));
DBG_(self, "terminal response: %s", hex);
gbinder_writer_add_cleanup(&writer, g_free, hex);
gbinder_writer_append_hidl_string(&writer, hex);
if (self->interface_aidl == RADIO_AIDL_INTERFACE_NONE) {
gbinder_writer_append_hidl_string(&writer, hex);
} else {
gbinder_writer_append_string16(&writer, hex);
}
radio_request_submit(req);
radio_request_unref(req);
}
@@ -200,12 +232,17 @@ binder_stk_user_confirmation(
struct ofono_stk* stk,
ofono_bool_t confirm)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderStk* self = binder_stk_get_data(stk);
GBinderWriter writer;
guint32 code =
radio_client_aidl_interface(self->voice_client) == RADIO_VOICE_INTERFACE ?
RADIO_VOICE_REQ_HANDLE_STK_CALL_SETUP_REQUEST_FROM_SIM :
RADIO_REQ_HANDLE_STK_CALL_SETUP_REQUEST_FROM_SIM;
/* handleStkCallSetupRequestFromSim(int32 serial, bool accept); */
RadioRequest* req = radio_request_new2(self->g,
RADIO_REQ_HANDLE_STK_CALL_SETUP_REQUEST_FROM_SIM, &writer,
RadioRequest* req = radio_request_new(self->voice_client,
code, &writer,
NULL, NULL, NULL);
DBG_(self, "%d", confirm);
@@ -222,9 +259,10 @@ binder_stk_proactive_command(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderStk* self = user_data;
GBinderReader reader;
const char* pcmd;
char* pcmd;
void* pdu;
guint len;
@@ -237,7 +275,11 @@ binder_stk_proactive_command(
* Refer to ETSI TS 102.223 section 9.4 for command types.
*/
gbinder_reader_copy(&reader, args);
pcmd = gbinder_reader_read_hidl_string_c(&reader);
if (self->interface_aidl == RADIO_AIDL_INTERFACE_NONE) {
pcmd = gbinder_reader_read_hidl_string(&reader);
} else {
pcmd = gbinder_reader_read_string16(&reader);
}
pdu = binder_decode_hex(pcmd, -1, &len);
if (pdu) {
DBG_(self, "pcmd: %s", pcmd);
@@ -246,6 +288,8 @@ binder_stk_proactive_command(
} else {
ofono_warn("Failed to parse STK command %s", pcmd);
}
g_free(pcmd);
}
static
@@ -256,9 +300,10 @@ binder_stk_event_notify(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderStk* self = user_data;
GBinderReader reader;
const char* pcmd;
char* pcmd;
void* pdu;
guint len;
@@ -272,7 +317,11 @@ binder_stk_event_notify(
* Refer to ETSI TS 102.223 section 9.4 for command types.
*/
gbinder_reader_copy(&reader, args);
pcmd = gbinder_reader_read_hidl_string_c(&reader);
if (self->interface_aidl == RADIO_AIDL_INTERFACE_NONE) {
pcmd = gbinder_reader_read_hidl_string(&reader);
} else {
pcmd = gbinder_reader_read_string16(&reader);
}
pdu = binder_decode_hex(pcmd, -1, &len);
if (pdu) {
DBG_(self, "pcmd: %s", pcmd);
@@ -281,6 +330,7 @@ binder_stk_event_notify(
} else {
ofono_warn("Failed to parse STK event %s", pcmd);
}
g_free(pcmd);
}
static
@@ -291,6 +341,7 @@ binder_stk_session_end_notify(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderStk* self = user_data;
DBG_(self, "");
@@ -303,32 +354,58 @@ void
binder_stk_agent_ready(
struct ofono_stk* stk)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderStk* self = binder_stk_get_data(stk);
RadioClient* client = self->g->client;
DBG_(self, "");
if (!self->event_id[STK_EVENT_PROACTIVE_COMMAND]) {
DBG_(self, "Subscribing for notifications");
self->event_id[STK_EVENT_PROACTIVE_COMMAND] =
radio_client_add_indication_handler(client,
RADIO_IND_STK_PROACTIVE_COMMAND,
binder_stk_proactive_command, self);
if (self->interface_aidl == RADIO_AIDL_INTERFACE_NONE) {
if (!self->event_id[STK_EVENT_PROACTIVE_COMMAND]) {
DBG_(self, "Subscribing for notifications");
self->event_id[STK_EVENT_PROACTIVE_COMMAND] =
radio_client_add_indication_handler(client,
RADIO_IND_STK_PROACTIVE_COMMAND,
binder_stk_proactive_command, self);
GASSERT(!self->event_id[STK_EVENT_SESSION_END]);
self->event_id[STK_EVENT_SESSION_END] =
radio_client_add_indication_handler(client,
RADIO_IND_STK_SESSION_END,
binder_stk_session_end_notify, self);
GASSERT(!self->event_id[STK_EVENT_SESSION_END]);
self->event_id[STK_EVENT_SESSION_END] =
radio_client_add_indication_handler(client,
RADIO_IND_STK_SESSION_END,
binder_stk_session_end_notify, self);
GASSERT(!self->event_id[STK_EVENT_NOTIFY]);
self->event_id[STK_EVENT_NOTIFY] =
radio_client_add_indication_handler(client,
RADIO_IND_STK_EVENT_NOTIFY,
binder_stk_event_notify, self);
GASSERT(!self->event_id[STK_EVENT_NOTIFY]);
self->event_id[STK_EVENT_NOTIFY] =
radio_client_add_indication_handler(client,
RADIO_IND_STK_EVENT_NOTIFY,
binder_stk_event_notify, self);
/* reportStkServiceIsRunning(int32 serial); */
binder_submit_request(self->g, RADIO_REQ_REPORT_STK_SERVICE_IS_RUNNING);
/* reportStkServiceIsRunning(int32 serial); */
binder_submit_request(self->g, RADIO_REQ_REPORT_STK_SERVICE_IS_RUNNING);
}
} else {
if (!self->event_id[STK_EVENT_PROACTIVE_COMMAND]) {
DBG_(self, "Subscribing for notifications");
self->event_id[STK_EVENT_PROACTIVE_COMMAND] =
radio_client_add_indication_handler(client,
RADIO_SIM_IND_STK_PROACTIVE_COMMAND,
binder_stk_proactive_command, self);
GASSERT(!self->event_id[STK_EVENT_SESSION_END]);
self->event_id[STK_EVENT_SESSION_END] =
radio_client_add_indication_handler(client,
RADIO_SIM_IND_STK_SESSION_END,
binder_stk_session_end_notify, self);
GASSERT(!self->event_id[STK_EVENT_NOTIFY]);
self->event_id[STK_EVENT_NOTIFY] =
radio_client_add_indication_handler(client,
RADIO_SIM_IND_STK_EVENT_NOTIFY,
binder_stk_event_notify, self);
/* reportStkServiceIsRunning(int32 serial); */
binder_submit_request(self->g, RADIO_SIM_REQ_REPORT_STK_SERVICE_IS_RUNNING);
}
}
}
@@ -336,6 +413,7 @@ static
gboolean binder_stk_register(
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderStk* self = user_data;
DBG("");
@@ -354,11 +432,14 @@ binder_stk_probe(
unsigned int vendor,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderModem* modem = binder_modem_get_data(data);
BinderStk* self = g_new0(BinderStk, 1);
self->stk = stk;
self->g = radio_request_group_new(modem->client); /* Keeps ref to client */
self->g = radio_request_group_new(modem->sim_client); /* Keeps ref to client */
self->interface_aidl = radio_client_aidl_interface(modem->sim_client);
self->voice_client = radio_client_ref(modem->voice_client);
self->log_prefix = binder_dup_prefix(modem->log_prefix);
self->register_id = g_idle_add(binder_stk_register, self);
@@ -372,6 +453,7 @@ void
binder_stk_remove(
struct ofono_stk* stk)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderStk* self = binder_stk_get_data(stk);
DBG_(self, "");
@@ -383,6 +465,7 @@ binder_stk_remove(
radio_client_remove_all_handlers(self->g->client, self->event_id);
radio_request_group_cancel(self->g);
radio_request_group_unref(self->g);
radio_client_unref(self->voice_client);
g_free(self->log_prefix);
g_free(self);
@@ -407,12 +490,14 @@ static const struct ofono_stk_driver binder_stk_driver = {
void
binder_stk_init()
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ofono_stk_driver_register(&binder_stk_driver);
}
void
binder_stk_cleanup()
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ofono_stk_driver_unregister(&binder_stk_driver);
}

View File

@@ -23,6 +23,7 @@
#include <radio_client.h>
#include <radio_request.h>
#include <radio_voice_types.h>
#include <gbinder_reader.h>
#include <gbinder_writer.h>
@@ -37,6 +38,7 @@ typedef struct binder_ussd {
struct ofono_ussd *ussd;
char* log_prefix;
RadioClient* client;
RADIO_AIDL_INTERFACE interface_aidl;
RadioRequest* send_req;
RadioRequest* cancel_req;
gulong event_id;
@@ -61,6 +63,7 @@ binder_ussd_cbd_new(
ofono_ussd_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderUssdCbData* cbd = g_slice_new(struct binder_ussd_cbd);
cbd->self = self;
@@ -74,6 +77,7 @@ void
binder_ussd_cbd_free(
gpointer cbd)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
g_slice_free(BinderUssdCbData, cbd);
}
@@ -87,6 +91,7 @@ binder_ussd_cancel_cb(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderUssdCbData* cbd = user_data;
BinderUssd* self = cbd->self;
struct ofono_error err;
@@ -96,7 +101,10 @@ binder_ussd_cancel_cb(
self->cancel_req = NULL;
if (status == RADIO_TX_STATUS_OK) {
if (resp == RADIO_RESP_CANCEL_PENDING_USSD) {
guint32 code = self->interface_aidl == RADIO_VOICE_INTERFACE ?
RADIO_VOICE_RESP_CANCEL_PENDING_USSD :
RADIO_RESP_CANCEL_PENDING_USSD;
if (resp == code) {
if (error != RADIO_ERROR_NONE) {
ofono_warn("Error cancelling USSD: %s",
binder_radio_error_string(error));
@@ -125,6 +133,7 @@ binder_ussd_send_cb(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderUssdCbData* cbd = user_data;
BinderUssd* self = cbd->self;
struct ofono_error err;
@@ -134,7 +143,9 @@ binder_ussd_send_cb(
self->send_req = NULL;
if (status == RADIO_TX_STATUS_OK) {
if (resp == RADIO_RESP_SEND_USSD) {
guint32 code = self->interface_aidl == RADIO_VOICE_INTERFACE ?
RADIO_VOICE_RESP_SEND_USSD : RADIO_RESP_SEND_USSD;
if (resp == code) {
if (error == RADIO_ERROR_NONE) {
cbd->cb(binder_error_ok(&err), cbd->data);
return;
@@ -161,6 +172,7 @@ binder_ussd_request(
ofono_ussd_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderUssd* self = binder_ussd_get_data(ussd);
char* text = ofono_ussd_decode(dcs, pdu, len);
struct ofono_error err;
@@ -173,13 +185,19 @@ binder_ussd_request(
if (text) {
/* sendUssd(int32 serial, string ussd); */
GBinderWriter writer;
guint32 code = self->interface_aidl == RADIO_VOICE_INTERFACE ?
RADIO_VOICE_REQ_SEND_USSD : RADIO_REQ_SEND_USSD;
RadioRequest* req = radio_request_new(self->client,
RADIO_REQ_SEND_USSD, &writer,
code, &writer,
binder_ussd_send_cb, binder_ussd_cbd_free,
binder_ussd_cbd_new(self, cb, data));
if (self->interface_aidl == RADIO_AIDL_INTERFACE_NONE) {
gbinder_writer_append_hidl_string(&writer, text);
} else {
gbinder_writer_append_string16(&writer, text);
}
/* USSD text will be deallocated together with the request */
gbinder_writer_append_hidl_string(&writer, text);
gbinder_writer_add_cleanup(&writer, (GDestroyNotify)
ofono_ussd_decode_free, text);
@@ -204,6 +222,7 @@ binder_ussd_cancel(
ofono_ussd_cb_t cb,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderUssd* self = binder_ussd_get_data(ussd);
ofono_info("sending ussd cancel");
@@ -211,8 +230,10 @@ binder_ussd_cancel(
radio_request_drop(self->cancel_req);
/* cancelPendingUssd(int32 serial); */
guint32 code = self->interface_aidl == RADIO_VOICE_INTERFACE ?
RADIO_VOICE_REQ_CANCEL_PENDING_USSD : RADIO_REQ_CANCEL_PENDING_USSD;
self->cancel_req = radio_request_new(self->client,
RADIO_REQ_CANCEL_PENDING_USSD, NULL,
code, NULL,
binder_ussd_cancel_cb, binder_ussd_cbd_free,
binder_ussd_cbd_new(self, cb, data));
@@ -234,6 +255,7 @@ binder_ussd_notify(
const GBinderReader* args,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderUssd* self = user_data;
GBinderReader reader;
gint32 type = 0;
@@ -241,10 +263,16 @@ binder_ussd_notify(
ofono_info("ussd received");
/* onUssd(RadioIndicationType, UssdModeType modeType, string msg); */
GASSERT(code == RADIO_IND_ON_USSD);
GASSERT(code == (self->interface_aidl == RADIO_VOICE_INTERFACE ?
RADIO_VOICE_IND_ON_USSD : RADIO_IND_ON_USSD));
gbinder_reader_copy(&reader, args);
if (gbinder_reader_read_int32(&reader, &type)) {
const char* msg = gbinder_reader_read_hidl_string_c(&reader);
char* msg;
if (self->interface_aidl == RADIO_AIDL_INTERFACE_NONE) {
msg = gbinder_reader_read_hidl_string(&reader);
} else {
msg = gbinder_reader_read_string16(&reader);
}
if (msg && msg[0]) {
const int len = (int) strlen(msg);
@@ -274,6 +302,8 @@ binder_ussd_notify(
} else {
ofono_ussd_notify(self->ussd, type, 0, NULL, 0);
}
g_free(msg);
}
}
@@ -282,6 +312,7 @@ gboolean
binder_ussd_register(
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderUssd* self = user_data;
DBG_(self, "");
@@ -291,8 +322,13 @@ binder_ussd_register(
ofono_ussd_register(self->ussd);
/* Register for USSD events */
self->event_id = radio_client_add_indication_handler(self->client,
RADIO_IND_ON_USSD, binder_ussd_notify, self);
if (self->interface_aidl == RADIO_AIDL_INTERFACE_NONE) {
self->event_id = radio_client_add_indication_handler(self->client,
RADIO_IND_ON_USSD, binder_ussd_notify, self);
} else {
self->event_id = radio_client_add_indication_handler(self->client,
RADIO_VOICE_IND_ON_USSD, binder_ussd_notify, self);
}
return G_SOURCE_REMOVE;
}
@@ -304,11 +340,13 @@ binder_ussd_probe(
unsigned int vendor,
void* data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderModem* modem = binder_modem_get_data(data);
BinderUssd* self = g_new0(BinderUssd, 1);
self->ussd = ussd;
self->client = radio_client_ref(modem->client);
self->client = radio_client_ref(modem->voice_client);
self->interface_aidl = radio_client_aidl_interface(modem->voice_client);
self->log_prefix = binder_dup_prefix(modem->log_prefix);
self->register_id = g_idle_add(binder_ussd_register, self);
@@ -322,6 +360,7 @@ void
binder_ussd_remove(
struct ofono_ussd* ussd)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
BinderUssd* self = binder_ussd_get_data(ussd);
DBG_(self, "");
@@ -356,12 +395,14 @@ static const struct ofono_ussd_driver binder_ussd_driver = {
void
binder_ussd_init()
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ofono_ussd_driver_register(&binder_ussd_driver);
}
void
binder_ussd_cleanup()
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ofono_ussd_driver_unregister(&binder_ussd_driver);
}

View File

@@ -36,9 +36,9 @@ static const char PROTO_IPV4V6_STR[] = "IPV4V6";
#define RADIO_ACCESS_FAMILY_GSM \
(RAF_GSM|RAF_GPRS|RAF_EDGE)
#define RADIO_ACCESS_FAMILY_UMTS \
(RAF_UMTS|RAF_HSDPA|RAF_HSUPA|RAF_HSPA|RAF_HSPAP|RAF_TD_SCDMA|RAF_EHRPD)
(RAF_UMTS|RAF_HSDPA|RAF_HSUPA|RAF_HSPA|RAF_HSPAP|RAF_TD_SCDMA)
#define RADIO_ACCESS_FAMILY_LTE \
(RAF_LTE|RAF_LTE_CA|RAF_EHRPD)
(RAF_LTE|RAF_LTE_CA)
#define RADIO_ACCESS_FAMILY_NR \
(RAF_NR)
@@ -47,6 +47,7 @@ const char*
binder_pool_string(
char* str)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
GUtilIdlePool* pool = gutil_idle_pool_get(&binder_util_pool);
gutil_idle_pool_add(pool, str, g_free);
@@ -57,6 +58,7 @@ RADIO_ACCESS_NETWORK
binder_radio_access_network_for_tech(
RADIO_TECH tech)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
switch (tech) {
case RADIO_TECH_GPRS:
case RADIO_TECH_EDGE:
@@ -95,6 +97,7 @@ binder_radio_apn_types_for_profile(
guint profile_id,
const BinderDataProfileConfig* config)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
RADIO_APN_TYPES apn_types = RADIO_APN_TYPE_NONE;
if (profile_id == config->mms_profile_id) {
@@ -138,6 +141,7 @@ RADIO_PDP_PROTOCOL_TYPE
binder_proto_from_ofono_proto(
enum ofono_gprs_proto proto)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
switch (proto) {
case OFONO_GPRS_PROTO_IP:
return RADIO_PDP_PROTOCOL_IP;
@@ -153,6 +157,7 @@ const char*
binder_proto_str_from_ofono_proto(
enum ofono_gprs_proto proto)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
switch (proto) {
case OFONO_GPRS_PROTO_IP:
return PROTO_IP_STR;
@@ -168,6 +173,7 @@ enum ofono_gprs_proto
binder_ofono_proto_from_proto_type(
RADIO_PDP_PROTOCOL_TYPE type)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
switch (type) {
case RADIO_PDP_PROTOCOL_IP:
return OFONO_GPRS_PROTO_IP;
@@ -189,6 +195,7 @@ enum ofono_gprs_proto
binder_ofono_proto_from_proto_str(
const char* type)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (type) {
if (!g_ascii_strcasecmp(type, PROTO_IP_STR)) {
return OFONO_GPRS_PROTO_IP;
@@ -206,6 +213,7 @@ RADIO_APN_AUTH_TYPE
binder_radio_auth_from_ofono_method(
enum ofono_gprs_auth_method auth)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
switch (auth) {
case OFONO_GPRS_AUTH_METHOD_NONE:
return RADIO_APN_AUTH_NONE;
@@ -225,6 +233,7 @@ RADIO_PREF_NET_TYPE
binder_pref_from_raf(
RADIO_ACCESS_FAMILY raf)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (raf & RADIO_ACCESS_FAMILY_GSM) {
if (raf & RADIO_ACCESS_FAMILY_UMTS) {
if (raf & RADIO_ACCESS_FAMILY_LTE) {
@@ -266,6 +275,7 @@ binder_pref_mask(
int lte_mask,
int nr_mask)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
switch (pref) {
case RADIO_PREF_NET_GSM_ONLY:
return gsm_mask;
@@ -333,6 +343,7 @@ RADIO_ACCESS_FAMILY
binder_raf_from_pref(
RADIO_PREF_NET_TYPE pref)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return binder_pref_mask(pref, RAF_NONE,
RADIO_ACCESS_FAMILY_GSM, RADIO_ACCESS_FAMILY_UMTS,
RADIO_ACCESS_FAMILY_LTE, RADIO_ACCESS_FAMILY_NR);
@@ -342,6 +353,7 @@ enum ofono_radio_access_mode
binder_access_modes_from_pref(
RADIO_PREF_NET_TYPE pref)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return binder_pref_mask(pref, OFONO_RADIO_ACCESS_MODE_NONE,
OFONO_RADIO_ACCESS_MODE_GSM, OFONO_RADIO_ACCESS_MODE_UMTS,
OFONO_RADIO_ACCESS_MODE_LTE, OFONO_RADIO_ACCESS_MODE_NR);
@@ -352,6 +364,7 @@ binder_access_modes_from_raf(
RADIO_ACCESS_FAMILY raf)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (raf == RAF_UNKNOWN) {
return OFONO_RADIO_ACCESS_MODE_ALL;
} else {
@@ -377,6 +390,7 @@ enum ofono_radio_access_mode
binder_access_modes_up_to(
enum ofono_radio_access_mode mode)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
/* Make sure only one bit is set in max_mode */
enum ofono_radio_access_mode max_mode = ofono_radio_access_max_mode(mode);
@@ -389,6 +403,7 @@ enum ofono_access_technology
binder_access_tech_from_radio_tech(
RADIO_TECH radio_tech)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
switch (radio_tech) {
case RADIO_TECH_UNKNOWN:
return OFONO_ACCESS_TECHNOLOGY_NONE;
@@ -431,6 +446,7 @@ const char*
binder_ofono_access_technology_string(
enum ofono_access_technology act)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
switch (act) {
case OFONO_ACCESS_TECHNOLOGY_NONE:
return "none";
@@ -464,6 +480,7 @@ const char*
binder_radio_op_status_string(
RADIO_OP_STATUS status)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
switch (status) {
case RADIO_OP_AVAILABLE:
return "available";
@@ -481,6 +498,7 @@ const char*
binder_radio_state_string(
RADIO_STATE state)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
#define RADIO_STATE_(name) case RADIO_STATE_##name: return #name
switch (state) {
RADIO_STATE_(OFF);
@@ -494,6 +512,7 @@ const char*
binder_radio_error_string(
RADIO_ERROR error)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
switch (error) {
#define RADIO_ERROR_STR_(name) case RADIO_ERROR_##name: return #name
RADIO_ERROR_STR_(NONE);
@@ -590,6 +609,7 @@ binder_parse_tech(
const char* stech,
RADIO_TECH* radio_tech)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
int rt = RADIO_TECH_UNKNOWN;
const enum ofono_access_technology at = gutil_parse_int(stech, 0, &rt) ?
binder_access_tech_from_radio_tech(rt) : OFONO_ACCESS_TECHNOLOGY_NONE;
@@ -605,6 +625,7 @@ binder_parse_mcc_mnc(
const char* str,
struct ofono_network_operator* op)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (str) {
int i;
const char* ptr = str;
@@ -652,6 +673,7 @@ binder_encode_hex(
const void* in,
guint size)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
char *out = g_new(char, size * 2 + 1);
ofono_encode_hex(in, size, out);
@@ -664,6 +686,7 @@ binder_decode_hex(
int len,
guint* out_size)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
void* out = NULL;
guint size = 0;
@@ -692,6 +715,7 @@ binder_print_strv(
char** strv,
const char* sep)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (!strv) {
return NULL;
} else if (!strv[0]) {
@@ -710,6 +734,7 @@ binder_print_hex(
const void* data,
gsize size)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (data && size) {
const guint8* bytes = data;
GUtilIdlePool* pool = gutil_idle_pool_get(&binder_util_pool);
@@ -736,6 +761,7 @@ binder_submit_request(
RadioRequestGroup* g,
RADIO_REQ code)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
RadioRequest* req = radio_request_new2(g, code, NULL, NULL, NULL, NULL);
gboolean ok = radio_request_submit(req);
@@ -751,6 +777,7 @@ binder_submit_request2(
GDestroyNotify destroy,
void* user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
RadioRequest* req = radio_request_new2(g, code, NULL, complete, destroy,
user_data);
gboolean ok = radio_request_submit(req);
@@ -763,6 +790,7 @@ const char*
binder_read_hidl_string(
const GBinderReader* args)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
GBinderReader reader;
/* Read a single string arg */
@@ -770,11 +798,24 @@ binder_read_hidl_string(
return gbinder_reader_read_hidl_string_c(&reader);
}
char*
binder_read_string16(
const GBinderReader* args)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
GBinderReader reader;
/* Read a single string arg */
gbinder_reader_copy(&reader, args);
return gbinder_reader_read_string16(&reader);
}
gboolean
binder_read_int32(
const GBinderReader* args,
gint32* value)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
GBinderReader reader;
/* Read a single int32 arg */
@@ -787,6 +828,7 @@ binder_read_hidl_struct1(
const GBinderReader* args,
gsize size)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
GBinderReader reader;
/* Read a single struct */
@@ -794,10 +836,40 @@ binder_read_hidl_struct1(
return gbinder_reader_read_hidl_struct1(&reader, size);
}
const void*
binder_read_parcelable(
const GBinderReader* args,
gsize* out_size)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
GBinderReader reader;
/* Read a single AIDL parcelable */
gbinder_reader_copy(&reader, args);
return gbinder_reader_read_parcelable(&reader, out_size);
}
gsize
binder_read_parcelable_size(
GBinderReader* reader)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
/* Read a single AIDL parcelable header and return inner data size */
guint32 non_null = 0, payload_size = 0;
if (gbinder_reader_read_uint32(reader, &non_null) && non_null &&
gbinder_reader_read_uint32(reader, &payload_size) &&
payload_size >= sizeof(payload_size)) {
return payload_size - sizeof(payload_size);
}
return 0;
}
char**
binder_strv_from_hidl_string_vec(
const GBinderHidlVec* vec)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (vec) {
const GBinderHidlString* strings = vec->data.ptr;
char** out = g_new(char*, vec->count + 1);
@@ -815,6 +887,48 @@ binder_strv_from_hidl_string_vec(
return NULL;
}
gboolean
binder_read_string16_parse_int(
GBinderReader* reader,
gint32* value)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
/* Read a string and parse integer value from it */
gboolean ret = FALSE;
char* str = gbinder_reader_read_string16(reader);
ret = gutil_parse_int(str, 10, value);
g_free(str);
return ret;
}
char**
binder_strv_from_string16_array(
GBinderReader* reader)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (reader) {
gint32 count;
gbinder_reader_read_int32(reader, &count);
if (count < 0) {
count = 0;
}
char** out = g_new(char*, count + 1);
char** ptr = out;
guint i;
for (i = 0; i < count; i++, ptr++) {
char* str = gbinder_reader_read_string16(reader);
*ptr = str ? str : g_strdup("");
}
*ptr = NULL;
return out;
}
return NULL;
}
guint
binder_append_vec_with_data(
GBinderWriter* writer,
@@ -823,6 +937,7 @@ binder_append_vec_with_data(
guint count,
const GBinderParent* parent)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
GBinderHidlVec* vec = gbinder_writer_new0(writer, GBinderHidlVec);
GBinderParent p;
@@ -845,6 +960,7 @@ binder_copy_hidl_string_impl(
const char* src,
gssize len)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
dest->owns_buffer = TRUE;
if (len > 0) {
/* GBinderWriter takes ownership of the string contents */
@@ -863,6 +979,7 @@ binder_copy_hidl_string(
GBinderHidlString* dest,
const char* src)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
binder_copy_hidl_string_impl(writer, dest, src, src ? strlen(src) : 0);
}
@@ -873,6 +990,7 @@ binder_copy_hidl_string_len(
const char* src,
gssize len)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
binder_copy_hidl_string_impl(writer, dest, src, (src && len < 0) ?
strlen(src) : 0);
}
@@ -884,6 +1002,7 @@ binder_append_hidl_string_with_parent(
guint32 index,
guint32 offset)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
GBinderParent parent;
parent.index = index;

View File

@@ -202,6 +202,11 @@ binder_read_hidl_string(
const GBinderReader* args)
BINDER_INTERNAL;
char*
binder_read_string16(
const GBinderReader* args)
BINDER_INTERNAL;
gboolean
binder_read_int32(
const GBinderReader* args,
@@ -216,11 +221,31 @@ binder_read_hidl_struct1(
#define binder_read_hidl_struct(reader,type) \
((const type*)binder_read_hidl_struct1(reader, sizeof(type)))
const void*
binder_read_parcelable(
const GBinderReader* reader,
gsize* out_size);
gsize
binder_read_parcelable_size(
GBinderReader* reader);
char**
binder_strv_from_hidl_string_vec(
const GBinderHidlVec* vec)
BINDER_INTERNAL;
char**
binder_strv_from_string16_array(
GBinderReader* reader)
BINDER_INTERNAL;
gboolean
binder_read_string16_parse_int(
GBinderReader* reader,
gint32* value)
BINDER_INTERNAL;
guint
binder_append_vec_with_data(
GBinderWriter* writer,

File diff suppressed because it is too large Load Diff

View File

@@ -16,12 +16,15 @@ endif
SRC ?= $(EXE).c
# COMMON_SRC += test_main.c
# Allow building against an oFono variant.
OFONO_PKG ?= ofono
#
# Required packages
#
LINK_PKGS += libglibutil glib-2.0 gobject-2.0
PKGS += $(LINK_PKGS) libgbinder libgbinder-radio
PKGS += $(OFONO_PKG) $(LINK_PKGS) libgbinder libgbinder-radio
#
# Default target