Compare commits

...

24 Commits
0.0.1 ... 1.0.9

Author SHA1 Message Date
Slava Monich
bb61f00d57 Version 1.0.9 2020-03-24 12:37:01 +02:00
Slava Monich
601ef084ee Added AUTHORS file 2020-03-24 12:33:40 +02:00
Slava Monich
3cd41646b4 Merge pull request #5 from Danct12/1.0.8-deb
[debian] Packaging for Debian-based distros. JB#42254
2020-03-24 12:29:17 +02:00
Danct12
d1fb490f9b Initial packaging for Debian
Signed-off-by: Danct12 <danct12@disroot.org>
2020-03-24 09:16:30 +07:00
Slava Monich
7e0c222f1d Version 1.0.8 2019-08-14 18:03:57 +03:00
Slava Monich
f5b2cc062c [gbinder-radio] Added RADIO_DEVICE_STATE enum. JB#46836 2019-08-14 18:00:57 +03:00
Slava Monich
9e246ebb55 Version 1.0.7 2019-07-02 14:23:45 +03:00
Slava Monich
5f5afc3d76 Fixed syntax error in a last-minute change 2019-07-02 14:23:32 +03:00
Slava Monich
eab404c46b Merge pull request #4 from monich/enabled
Add enabled attribute to RadioInstance
2019-07-02 14:11:40 +03:00
Slava Monich
395a50ba3d [gbinder-radio] Added enabled attribute to RadioInstance. JB#46324
And these new functions:

  radio_instance_new_with_modem_and_slot()
  radio_instance_set_enabled()
  radio_instance_add_enabled_handler()
2019-06-28 19:00:26 +03:00
Slava Monich
79379ea3d1 Version 1.0.6 2019-04-30 12:04:25 +03:00
Slava Monich
197e84e71a [gbinder-radio] Added RadioDataProfile enums. JB#45342
RADIO_DATA_PROFILE_ID and RADIO_APN_TYPES
2019-04-30 12:02:32 +03:00
Slava Monich
30ea57a3cb Version 1.0.5 2019-03-19 12:45:16 +02:00
Slava Monich
49fcc2a599 Merge pull request #2 from krnlyng/jb44067
Add HardwareConfig types
2019-03-19 12:43:01 +02:00
Frajo Haider
6d9f87f7ea [gbinder-radio] add HardwareConfig types. JB#44067 2019-03-19 12:39:42 +02:00
Slava Monich
efc30cd06d Version 1.0.4 2019-03-06 00:41:13 +02:00
Slava Monich
6959979384 [gbinder-radio] Fixed death handling. JB#44551
Listeners were being registered for the wrong signal.
2019-03-06 00:38:32 +02:00
Slava Monich
1ebf32bc73 Version 1.0.3 2019-03-05 02:59:50 +02:00
Slava Monich
a119a68374 [gbinder-radio] Added RADIO_APN_AUTH_TYPE enum. JB#44551 2019-03-05 02:56:47 +02:00
Slava Monich
1e7506e7ac Version 1.0.2 2019-02-22 00:14:31 +02:00
Slava Monich
bd20f5aabe [gbinder-radio] Optimize radio_instance_response()
... by using gbinder_reader_read_hidl_struct() instead of
gbinder_reader_read_buffer(). The former doesn't allocate
anything - it returns direct pointer to the memory block
associated with the transaction.
2019-02-22 00:14:00 +02:00
Slava Monich
42fc35fbc7 [gbinder-radio] Moved RadioResponseInfo to radio_types.h. JB#44551 2019-02-22 00:06:45 +02:00
Slava Monich
031228b3a8 Version 1.0.1 2019-01-30 00:06:19 +02:00
Slava Monich
bcb1963582 [gbinder-radio] Added more IRadio types. JB#44067
Specifically, RADIO_ACCESS_FAMILY and RadioActivityStatsInfo.
2019-01-29 23:59:15 +02:00
14 changed files with 283 additions and 30 deletions

3
AUTHORS Normal file
View File

@@ -0,0 +1,3 @@
Danct12 <danct12@disroot.org>
Frajo Haider <f_haider@gmx.at>
Slava Monich <slava@monich.com>

View File

@@ -23,7 +23,7 @@ all: debug release pkgconfig
VERSION_MAJOR = 1
VERSION_MINOR = 0
VERSION_RELEASE = 0
VERSION_RELEASE = 9
# Version for pkg-config
PCVERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_RELEASE)
@@ -144,9 +144,6 @@ pkgconfig: $(PKGCONFIG)
clean:
rm -f *~ $(SRC_DIR)/*~ $(INCLUDE_DIR)/*~
rm -fr $(BUILD_DIR) RPMS installroot
rm -fr debian/tmp debian/libgbinder debian/libgbinder-dev
rm -f documentation.list debian/files debian/*.substvars
rm -f debian/*.debhelper.log debian/*.debhelper debian/*~
$(BUILD_DIR):
mkdir -p $@
@@ -199,18 +196,17 @@ $(PKGCONFIG): $(LIB_NAME).pc.in Makefile
# Install
#
INSTALL_PERM = 644
INSTALL = install
INSTALL_DIRS = $(INSTALL) -d
INSTALL_FILES = $(INSTALL) -m $(INSTALL_PERM)
INSTALL_LIBS = $(INSTALL) -m 755
INSTALL_FILES = $(INSTALL) -m 644
INSTALL_LIB_DIR = $(DESTDIR)/usr/lib
INSTALL_INCLUDE_DIR = $(DESTDIR)/usr/include/$(NAME)
INSTALL_PKGCONFIG_DIR = $(DESTDIR)/usr/lib/pkgconfig
install: $(INSTALL_LIB_DIR)
$(INSTALL_FILES) $(RELEASE_SO) $(INSTALL_LIB_DIR)
$(INSTALL_LIBS) $(RELEASE_SO) $(INSTALL_LIB_DIR)
ln -sf $(LIB_SO) $(INSTALL_LIB_DIR)/$(LIB_SYMLINK2)
ln -sf $(LIB_SYMLINK2) $(INSTALL_LIB_DIR)/$(LIB_SYMLINK1)

5
debian/changelog vendored Normal file
View File

@@ -0,0 +1,5 @@
libgbinder-radio (1.0.9) unstable; urgency=medium
* Added packaging for Debian-based distros.
-- Danct12 <danct12@disroot.org> Tue, 24 Mar 2020 02:55:50 +0700

1
debian/compat vendored Normal file
View File

@@ -0,0 +1 @@
9

17
debian/control vendored Normal file
View File

@@ -0,0 +1,17 @@
Source: libgbinder-radio
Priority: optional
Maintainer: Danct12 <danct12@disroot.org>
Build-Depends: debhelper (>=9), libgbinder-dev (>= 1.0.9)
Standards-Version: 3.9.6
Package: libgbinder-radio-dev
Section: libdevel
Architecture: any
Depends: libgbinder-radio (= ${binary:Version}), ${misc:Depends}
Description: Development files for libgbinder-radio
Package: libgbinder-radio
Section: libs
Architecture: any
Depends: libgbinder (>= 1.0.9), ${shlibs:Depends}, ${misc:Depends}
Description: Binder client library for Android radio interfaces

33
debian/copyright vendored Normal file
View File

@@ -0,0 +1,33 @@
Copyright (C) 2018-2019 Jolla Ltd.
Copyright (C) 2018-2019 Slava Monich <slava.monich@jolla.com>
You may use this file under the terms of the BSD license as follows:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the names of the copyright holders nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation
are those of the authors and should not be interpreted as representing
any official policies, either expressed or implied.

3
debian/libgbinder-radio-dev.install vendored Normal file
View File

@@ -0,0 +1,3 @@
debian/tmp/usr/lib/libgbinder-radio.so usr/lib
include/*.h usr/include/gbinder-radio
build/libgbinder-radio.pc usr/lib/pkgconfig

1
debian/libgbinder-radio.install vendored Normal file
View File

@@ -0,0 +1 @@
debian/tmp/usr/lib/libgbinder-radio.so.* usr/lib

9
debian/rules vendored Executable file
View File

@@ -0,0 +1,9 @@
#!/usr/bin/make -f
# Uncomment to enable verbose build
#export DH_VERBOSE = 1
override_dh_auto_install:
dh_auto_install -- install-dev
%:
dh $@

1
debian/source/format vendored Normal file
View File

@@ -0,0 +1 @@
3.0 (native)

View File

@@ -52,14 +52,12 @@ struct radio_instance {
const char* dev;
const char* slot;
const char* key;
/* Since 1.0.7 */
const char* modem; /* D-Bus path */
int slot_index; /* 0 for SIM1, 1 for SIM2 and so on */
gboolean enabled;
};
typedef struct radio_response_info {
RADIO_RESP_TYPE type;
guint32 serial;
guint32 error;
} RadioResponseInfo;
typedef
void
(*RadioInstanceFunc)(
@@ -119,6 +117,13 @@ radio_instance_new(
const char* dev,
const char* name);
RadioInstance*
radio_instance_new_with_modem_and_slot(
const char* dev,
const char* name,
const char* modem,
int slot_index); /* Since 1.0.7 */
RadioInstance*
radio_instance_get(
const char* dev,
@@ -166,6 +171,11 @@ radio_instance_send_request_sync(
RADIO_REQ code,
GBinderLocalRequest* args);
void
radio_instance_set_enabled(
RadioInstance* radio,
gboolean enabled); /* Since 1.0.7 */
gulong
radio_instance_add_indication_handler(
RadioInstance* radio,
@@ -206,6 +216,12 @@ radio_instance_add_death_handler(
RadioInstanceFunc func,
gpointer user_data);
gulong
radio_instance_add_enabled_handler(
RadioInstance* radio,
RadioInstanceFunc func,
gpointer user_data); /* Since 1.0.7 */
void
radio_instance_remove_handler(
RadioInstance* radio,

View File

@@ -151,6 +151,68 @@ typedef enum radio_tech {
} RADIO_TECH;
G_STATIC_ASSERT(sizeof(RADIO_TECH) == 4);
typedef enum radio_access_family {
RAF_UNKNOWN = (1 << RADIO_TECH_UNKNOWN),
RAF_GPRS = (1 << RADIO_TECH_GPRS),
RAF_EDGE = (1 << RADIO_TECH_EDGE),
RAF_UMTS = (1 << RADIO_TECH_UMTS),
RAF_IS95A = (1 << RADIO_TECH_IS95A),
RAF_IS95B = (1 << RADIO_TECH_IS95B),
RAF_ONE_X_RTT = (1 << RADIO_TECH_ONE_X_RTT),
RAF_EVDO_0 = (1 << RADIO_TECH_EVDO_0),
RAF_EVDO_A = (1 << RADIO_TECH_EVDO_A),
RAF_HSDPA = (1 << RADIO_TECH_HSDPA),
RAF_HSUPA = (1 << RADIO_TECH_HSUPA),
RAF_HSPA = (1 << RADIO_TECH_HSPA),
RAF_EVDO_B = (1 << RADIO_TECH_EVDO_B),
RAF_EHRPD = (1 << RADIO_TECH_EHRPD),
RAF_LTE = (1 << RADIO_TECH_LTE),
RAF_HSPAP = (1 << RADIO_TECH_HSPAP),
RAF_GSM = (1 << RADIO_TECH_GSM),
RAF_TD_SCDMA = (1 << RADIO_TECH_TD_SCDMA),
RAF_IWLAN = (1 << RADIO_TECH_IWLAN),
RAF_LTE_CA = (1 << RADIO_TECH_LTE_CA)
} RADIO_ACCESS_FAMILY;
G_STATIC_ASSERT(sizeof(RADIO_ACCESS_FAMILY) == 4);
typedef enum radio_apn_auth_type {
RADIO_APN_AUTH_NONE,
RADIO_APN_AUTH_PAP,
RADIO_APN_AUTH_CHAP,
RADIO_APN_AUTH_PAP_CHAP
} RADIO_APN_AUTH_TYPE;
G_STATIC_ASSERT(sizeof(RADIO_APN_AUTH_TYPE) == 4);
typedef enum radio_apn_types {
RADIO_APN_TYPE_NONE = 0,
RADIO_APN_TYPE_DEFAULT = 1 << 0,
RADIO_APN_TYPE_MMS = 1 << 1,
RADIO_APN_TYPE_SUPL = 1 << 2,
RADIO_APN_TYPE_DUN = 1 << 3,
RADIO_APN_TYPE_HIPRI = 1 << 4,
RADIO_APN_TYPE_FOTA = 1 << 5,
RADIO_APN_TYPE_IMS = 1 << 6,
RADIO_APN_TYPE_CBS = 1 << 7,
RADIO_APN_TYPE_IA = 1 << 8,
RADIO_APN_TYPE_EMERGENCY = 1 << 9,
RADIO_APN_TYPE_ALL = RADIO_APN_TYPE_DEFAULT | RADIO_APN_TYPE_MMS |
RADIO_APN_TYPE_SUPL | RADIO_APN_TYPE_DUN | RADIO_APN_TYPE_HIPRI |
RADIO_APN_TYPE_FOTA | RADIO_APN_TYPE_IMS | RADIO_APN_TYPE_CBS |
RADIO_APN_TYPE_IA | RADIO_APN_TYPE_EMERGENCY
} RADIO_APN_TYPES;
G_STATIC_ASSERT(sizeof(RADIO_APN_TYPES) == 4);
typedef enum radio_data_profile_id {
RADIO_DATA_PROFILE_INVALID = -1,
RADIO_DATA_PROFILE_DEFAULT = 0,
RADIO_DATA_PROFILE_TETHERED = 1,
RADIO_DATA_PROFILE_IMS = 2,
RADIO_DATA_PROFILE_FOTA = 3,
RADIO_DATA_PROFILE_CBS = 4,
RADIO_DATA_PROFILE_OEM_BASE = 1000
} RADIO_DATA_PROFILE_ID;
G_STATIC_ASSERT(sizeof(RADIO_DATA_PROFILE_ID) == 4);
typedef enum radio_card_state {
RADIO_CARD_STATE_ABSENT,
RADIO_CARD_STATE_PRESENT,
@@ -234,6 +296,20 @@ typedef enum radio_capability_status {
} RADIO_CAPABILITY_STATUS;
G_STATIC_ASSERT(sizeof(RADIO_CAPABILITY_STATUS) == 4);
typedef enum radio_device_state {
RADIO_DEVICE_STATE_POWER_SAVE_MODE,
RADIO_DEVICE_STATE_CHARGING_STATE,
RADIO_DEVICE_STATE_LOW_DATA_EXPECTED
} RADIO_DEVICE_STATE;
G_STATIC_ASSERT(sizeof(RADIO_DEVICE_STATE) == 4);
typedef struct radio_response_info {
RADIO_RESP_TYPE type RADIO_ALIGNED(4);
guint32 serial RADIO_ALIGNED(4);
guint32 error RADIO_ALIGNED(4);
} RadioResponseInfo;
G_STATIC_ASSERT(sizeof(RadioResponseInfo) == 12);
typedef struct radio_card_status {
RADIO_CARD_STATE cardState RADIO_ALIGNED(4);
RADIO_PIN_STATE universalPinState RADIO_ALIGNED(4);
@@ -302,11 +378,11 @@ typedef struct radio_operator_info {
G_STATIC_ASSERT(sizeof(RadioOperatorInfo) == 56);
typedef struct radio_data_profile {
gint32 profileId RADIO_ALIGNED(4);
RADIO_DATA_PROFILE_ID profileId RADIO_ALIGNED(4);
GBinderHidlString apn RADIO_ALIGNED(8);
GBinderHidlString protocol RADIO_ALIGNED(8);
GBinderHidlString roamingProtocol RADIO_ALIGNED(8);
gint32 authType RADIO_ALIGNED(4);
RADIO_APN_AUTH_TYPE authType RADIO_ALIGNED(4);
GBinderHidlString user RADIO_ALIGNED(8);
GBinderHidlString password RADIO_ALIGNED(8);
gint32 type RADIO_ALIGNED(4);
@@ -314,8 +390,8 @@ typedef struct radio_data_profile {
gint32 maxConns RADIO_ALIGNED(4);
gint32 waitTime RADIO_ALIGNED(4);
guint8 enabled RADIO_ALIGNED(1);
gint32 supportedApnTypesBitmap RADIO_ALIGNED(4);
gint32 bearerBitmap RADIO_ALIGNED(4);
RADIO_APN_TYPES supportedApnTypesBitmap RADIO_ALIGNED(4);
RADIO_ACCESS_FAMILY bearerBitmap RADIO_ALIGNED(4);
gint32 mtu RADIO_ALIGNED(4);
gint32 mvnoType RADIO_ALIGNED(4);
GBinderHidlString mvnoMatchData RADIO_ALIGNED(8);
@@ -336,7 +412,6 @@ typedef struct radio_data_call {
gint32 mtu RADIO_ALIGNED(4);
} RADIO_ALIGNED(8) RadioDataCall;
G_STATIC_ASSERT(sizeof(RadioDataCall) == 120);
#define DATA_CALL_VERSION (11)
#define DATA_CALL_VERSION (11)
@@ -613,6 +688,37 @@ typedef struct radio_lce_status_info {
} RADIO_ALIGNED(4) RadioLceStatusInfo;
G_STATIC_ASSERT(sizeof(RadioLceStatusInfo) == 8);
typedef struct radio_activity_stats_info {
guint32 sleepModeTimeMs RADIO_ALIGNED(4);
guint32 idleModeTimeMs RADIO_ALIGNED(4);
guint32 txmModetimeMs[5 /* NUM_TX_POWER_LEVELS */] RADIO_ALIGNED(4);
guint32 rxModeTimeMs RADIO_ALIGNED(4);
} RADIO_ALIGNED(4) RadioActivityStatsInfo;
G_STATIC_ASSERT(sizeof(RadioActivityStatsInfo) == 32);
typedef struct radio_hardware_config {
gint32 type RADIO_ALIGNED(4);
GBinderHidlString uuid RADIO_ALIGNED(8);
gint32 state RADIO_ALIGNED(4);
GBinderHidlVec modem RADIO_ALIGNED(8); /* vec<RadioHardwareConfigModem> */
GBinderHidlVec sim RADIO_ALIGNED(8); /* vec<RadioHardwareConfigSim> */
} RADIO_ALIGNED(8) RadioHardwareConfig;
G_STATIC_ASSERT(sizeof(RadioHardwareConfig) == 64);
typedef struct radio_hardware_config_modem {
gint32 rilModel RADIO_ALIGNED(4);
guint32 rat RADIO_ALIGNED(4);
gint32 maxVoice RADIO_ALIGNED(4);
gint32 maxData RADIO_ALIGNED(4);
gint32 maxStandby RADIO_ALIGNED(4);
} RADIO_ALIGNED(4) RadioHardwareConfigModem;
G_STATIC_ASSERT(sizeof(RadioHardwareConfigModem) == 20);
typedef struct radio_hardware_config_sim {
GBinderHidlString modemUuid RADIO_ALIGNED(8);
} RADIO_ALIGNED(8) RadioHardwareConfigSim;
G_STATIC_ASSERT(sizeof(RadioHardwareConfigSim) == 16);
/* c(req,resp,callName,CALL_NAME) */
#define RADIO_CALL_1_0(c) \
c(2,1,getIccCardStatus,GET_ICC_CARD_STATUS) \

View File

@@ -1,14 +1,18 @@
Name: libgbinder-radio
Version: 0.0.1
Version: 1.0.9
Release: 0
Summary: Binder client library for Android radio interfaces
Group: Development/Libraries
License: BSD
URL: https://github.com/mer-hybris/libgbinder-radio
Source: %{name}-%{version}.tar.bz2
%define libgbinder_version 1.0.9
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(libglibutil)
BuildRequires: pkgconfig(libgbinder)
BuildRequires: pkgconfig(libgbinder) >= %{libgbinder_version}
Requires: libgbinder >= %{libgbinder_version}
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig

View File

@@ -59,6 +59,7 @@ struct radio_instance_priv {
char* dev;
char* slot;
char* key;
char* modem;
};
G_DEFINE_TYPE(RadioInstance, radio_instance, G_TYPE_OBJECT)
@@ -70,6 +71,7 @@ enum radio_instance_signal {
SIGNAL_OBSERVE_RESPONSE,
SIGNAL_ACK,
SIGNAL_DEATH,
SIGNAL_ENABLED,
SIGNAL_COUNT
};
@@ -79,6 +81,7 @@ enum radio_instance_signal {
#define SIGNAL_OBSERVE_RESPONSE_NAME "radio-instance-observe-response"
#define SIGNAL_ACK_NAME "radio-instance-ack"
#define SIGNAL_DEATH_NAME "radio-instance-death"
#define SIGNAL_ENABLED_NAME "radio-instance-enabled"
static guint radio_instance_signals[SIGNAL_COUNT] = { 0 };
@@ -217,14 +220,12 @@ radio_instance_response(
} else {
/* All other responses have RadioResponseInfo */
GBinderReader reader;
GBinderBuffer* buf;
const RadioResponseInfo* info;
gbinder_remote_request_init_reader(req, &reader);
buf = gbinder_reader_read_buffer(&reader);
GASSERT(buf && buf->size == sizeof(RadioResponseInfo));
if (buf && buf->size == sizeof(RadioResponseInfo)) {
info = gbinder_reader_read_hidl_struct(&reader, RadioResponseInfo);
if (info) {
GQuark quark = radio_instance_resp_quark(self, code);
const RadioResponseInfo* info = buf->data;
gboolean handled = FALSE;
g_signal_emit(self,
@@ -238,7 +239,6 @@ radio_instance_response(
radio_instance_ack(self);
}
}
gbinder_buffer_free(buf);
}
*status = GBINDER_STATUS_OK;
} else {
@@ -323,7 +323,9 @@ RadioInstance*
radio_instance_create(
const char* dev,
const char* slot,
const char* key)
const char* key,
const char* modem,
int slot_index)
{
RadioInstance* self = NULL;
GBinderServiceManager* sm = gbinder_servicemanager_new(dev);
@@ -351,6 +353,8 @@ radio_instance_create(
self->slot = priv->slot = g_strdup(slot);
self->dev = priv->dev = g_strdup(dev);
self->key = priv->key = g_strdup(key);
self->modem = priv->modem = g_strdup(modem);
self->slot_index = slot_index;
priv->remote = remote;
priv->client = gbinder_client_new(remote, iface);
@@ -403,6 +407,33 @@ RadioInstance*
radio_instance_new(
const char* dev,
const char* name)
{
if (name && name[0]) {
const char* modem;
int slot;
if (!g_strcmp0(name, "slot1")) {
modem = "/ril_0";
slot = 0;
} else if (!g_strcmp0(name, "slot2")) {
modem = "/ril_1";
slot = 1;
} else {
GWARN("Unexpected slot '%s'", name);
modem = NULL;
slot = 0;
}
return radio_instance_new_with_modem_and_slot(dev, name, modem, slot);
}
return NULL;
}
RadioInstance*
radio_instance_new_with_modem_and_slot(
const char* dev,
const char* name,
const char* modem,
int slot) /* Since 1.0.7 */
{
if (dev && dev[0] && name && name[0]) {
char* key = radio_instance_make_key(dev, name);
@@ -415,7 +446,7 @@ radio_instance_new(
g_free(key);
return radio_instance_ref(self);
} else {
self = radio_instance_create(dev, name, key);
self = radio_instance_create(dev, name, key, modem, slot);
if (self) {
if (!radio_instance_table) {
radio_instance_table = g_hash_table_new_full
@@ -596,6 +627,18 @@ radio_instance_send_request_sync(
return FALSE;
}
void
radio_instance_set_enabled(
RadioInstance* self,
gboolean enabled) /* Since 1.0.7 */
{
if (G_LIKELY(self) && self->enabled != enabled) {
self->enabled = enabled;
GDEBUG("%s %sabled", self->slot, enabled ? "en" : "dis");
g_signal_emit(self, radio_instance_signals[SIGNAL_ENABLED], 0);
}
}
gulong
radio_instance_add_indication_handler(
RadioInstance* self,
@@ -668,7 +711,17 @@ radio_instance_add_death_handler(
gpointer user_data)
{
return (G_LIKELY(self) && G_LIKELY(func)) ? g_signal_connect(self,
SIGNAL_ACK_NAME, G_CALLBACK(func), user_data) : 0;
SIGNAL_DEATH_NAME, G_CALLBACK(func), user_data) : 0;
}
gulong
radio_instance_add_enabled_handler(
RadioInstance* self,
RadioInstanceFunc func,
gpointer user_data) /* Since 1.0.7 */
{
return (G_LIKELY(self) && G_LIKELY(func)) ? g_signal_connect(self,
SIGNAL_ENABLED_NAME, G_CALLBACK(func), user_data) : 0;
}
void
@@ -724,6 +777,7 @@ radio_instance_finalize(
g_free(priv->slot);
g_free(priv->dev);
g_free(priv->key);
g_free(priv->modem);
G_OBJECT_CLASS(radio_instance_parent_class)->finalize(object);
}
@@ -764,6 +818,10 @@ radio_instance_class_init(
g_signal_new(SIGNAL_DEATH_NAME, type,
G_SIGNAL_RUN_FIRST, 0, NULL, NULL, NULL,
G_TYPE_NONE, 0);
radio_instance_signals[SIGNAL_ENABLED] =
g_signal_new(SIGNAL_ENABLED_NAME, type,
G_SIGNAL_RUN_FIRST, 0, NULL, NULL, NULL,
G_TYPE_NONE, 0);
}
/*