Compare commits
	
		
			18 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					9e246ebb55 | ||
| 
						 | 
					5f5afc3d76 | ||
| 
						 | 
					eab404c46b | ||
| 
						 | 
					395a50ba3d | ||
| 
						 | 
					79379ea3d1 | ||
| 
						 | 
					197e84e71a | ||
| 
						 | 
					30ea57a3cb | ||
| 
						 | 
					49fcc2a599 | ||
| 
						 | 
					6d9f87f7ea | ||
| 
						 | 
					efc30cd06d | ||
| 
						 | 
					6959979384 | ||
| 
						 | 
					1ebf32bc73 | ||
| 
						 | 
					a119a68374 | ||
| 
						 | 
					1e7506e7ac | ||
| 
						 | 
					bd20f5aabe | ||
| 
						 | 
					42fc35fbc7 | ||
| 
						 | 
					031228b3a8 | ||
| 
						 | 
					bcb1963582 | 
							
								
								
									
										12
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								Makefile
									
									
									
									
									
								
							@@ -23,7 +23,7 @@ all: debug release pkgconfig
 | 
			
		||||
 | 
			
		||||
VERSION_MAJOR = 1
 | 
			
		||||
VERSION_MINOR = 0
 | 
			
		||||
VERSION_RELEASE = 0
 | 
			
		||||
VERSION_RELEASE = 7
 | 
			
		||||
 | 
			
		||||
# 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)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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,
 | 
			
		||||
 
 | 
			
		||||
@@ -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,13 @@ typedef enum radio_capability_status {
 | 
			
		||||
} RADIO_CAPABILITY_STATUS;
 | 
			
		||||
G_STATIC_ASSERT(sizeof(RADIO_CAPABILITY_STATUS) == 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 +371,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 +383,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 +405,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 +681,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) \
 | 
			
		||||
 
 | 
			
		||||
@@ -1,14 +1,18 @@
 | 
			
		||||
Name: libgbinder-radio
 | 
			
		||||
Version: 0.0.1
 | 
			
		||||
Version: 1.0.7
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user