一点点
This commit is contained in:
15
Makefile
15
Makefile
@@ -33,10 +33,19 @@ STATIC_LIB = $(NAME).a
|
||||
#
|
||||
|
||||
SRC = \
|
||||
sample_ext.c \
|
||||
sample_ims.c \
|
||||
vendor_qti_plugin.c \
|
||||
sample_slot.c
|
||||
vendor_qti_ext.c \
|
||||
vendor_qti_slot.c \
|
||||
vendor_qti_ims_radio.c \
|
||||
|
||||
#
|
||||
# vendor_qti_ims.c \
|
||||
# vendor_qti_ims_call.c \
|
||||
# vendor_qti_ims_conf.c \
|
||||
# vendor_qti_ims_radio.c \
|
||||
# vendor_qti_ims_sms.c \
|
||||
# vendor_qti_ims_state.c \
|
||||
# vendor_qti_util.c
|
||||
|
||||
#
|
||||
# Directories
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
|
||||
#include <binder_ext_types.h>
|
||||
|
||||
extern const char qti_plugin_name[];
|
||||
|
||||
BinderExtPlugin* vendor_qti_ext_new(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#ifndef VENDOR_QTI_SLOT_H
|
||||
#define VENDOR_QTI_SLOT_H
|
||||
#ifndef VENDOR_QTI_IMS_RADIO_H
|
||||
#define VENDOR_QTI_IMS_RADIO_H
|
||||
|
||||
#include <binder_ext_slot.h>
|
||||
|
||||
#include <radio_types.h>
|
||||
#include "vendor_qti_types.h"
|
||||
|
||||
#define IMS_RADIO_IFACE_PREFIX "vendor.qti.hardware.radio.ims@"
|
||||
#define IMS_RADIO_IFACE "IImsRadio"
|
||||
@@ -23,6 +24,6 @@
|
||||
#define IMS_RADIO_INDICATION_1_2 IMS_RADIO_IFACE_1_2(IMS_RADIO_INDICATION_IFACE)
|
||||
|
||||
|
||||
VendorQtiImsRadio* vendor_qti_ims_radio_new(RadioInstance* radio, GHashTable* params);
|
||||
VendorQtiImsRadio* vendor_qti_ims_radio_new(const char* dev, const char* name);
|
||||
|
||||
#endif
|
||||
|
||||
8
include/vendor_qti_ims_state.h
Normal file
8
include/vendor_qti_ims_state.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef VENDOR_QTI_IMS_STATE_H
|
||||
#define VENDOR_QTI_IMS_STATE_H
|
||||
|
||||
#include "vendor_qti_types.h"
|
||||
|
||||
VendorQtiImsStateObject* vendor_qti_ims_state_new(VendorQtiImsRadio* ims_radio);
|
||||
|
||||
#endif
|
||||
18
include/vendor_qti_types.h
Normal file
18
include/vendor_qti_types.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef VENDOR_QTI_TYPES_H
|
||||
#define VENDOR_QTI_TYPES_H
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct qti_slot VendorQtiSlot;
|
||||
typedef struct qti_ims VendorQtiIms;
|
||||
typedef struct qti_ims_sms VendorQtiImsSms;
|
||||
typedef struct qti_ims_radio VendorQtiImsRadio;
|
||||
typedef struct qti_ims_call VendorQtiImsCall;
|
||||
typedef struct qti_ims_state VendorQtiImsStateObject;
|
||||
typedef struct qti_ims_conf VendorQtiImsConfObject;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* VENDOR_QTI_TYPES_H */
|
||||
@@ -24,7 +24,7 @@ G_DEFINE_TYPE(VendorQtiExt, qti_plugin, BINDER_EXT_TYPE_PLUGIN)
|
||||
#define THIS_TYPE qti_plugin_get_type()
|
||||
#define THIS(obj) G_TYPE_CHECK_INSTANCE_CAST(obj, THIS_TYPE, VendorQtiExt)
|
||||
|
||||
static const char qti_plugin_name[] = "qti";
|
||||
const char qti_plugin_name[] = "qti";
|
||||
|
||||
/*==========================================================================*
|
||||
* BinderExtPluginClass
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
#include <ofono/log.h>
|
||||
#include "vendor_qti_types.h"
|
||||
|
||||
|
||||
#include <binder_ext_ims_impl.h>
|
||||
|
||||
#include <ofono/log.h>
|
||||
|
||||
typedef BinderExtImsClass VendorQtiImsClass;
|
||||
struct qti_ims {
|
||||
BinderExtIms parent;
|
||||
char* slot;
|
||||
};
|
||||
|
||||
static
|
||||
void
|
||||
qti_ims_iface_init(
|
||||
BinderExtImsInterface* iface);
|
||||
|
||||
GType qti_ims_get_type() G_GNUC_INTERNAL;
|
||||
G_DEFINE_TYPE_WITH_CODE(VendorQtiIms, qti_ims, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE(BINDER_EXT_TYPE_IMS, qti_ims_iface_init))
|
||||
|
||||
#define THIS_TYPE qti_ims_get_type()
|
||||
#define THIS(obj) G_TYPE_CHECK_INSTANCE_CAST(obj, THIS_TYPE, VendorQtiIms)
|
||||
#define PARENT_CLASS qti_ims_parent_class
|
||||
|
||||
enum qti_ims_signal {
|
||||
SIGNAL_STATE_CHANGED,
|
||||
SIGNAL_COUNT
|
||||
};
|
||||
|
||||
#define SIGNAL_STATE_CHANGED_NAME "qti-ims-state-changed"
|
||||
|
||||
static guint qti_ims_signals[SIGNAL_COUNT] = { 0 };
|
||||
|
||||
/*==========================================================================*
|
||||
* BinderExtImsInterface
|
||||
*==========================================================================*/
|
||||
|
||||
static
|
||||
BINDER_EXT_IMS_STATE
|
||||
qti_ims_get_state(
|
||||
BinderExtIms* ext)
|
||||
{
|
||||
VendorQtiIms* self = THIS(ext);
|
||||
|
||||
DBG("%s", self->slot);
|
||||
#pragma message("TODO: return the actual state")
|
||||
return BINDER_EXT_IMS_STATE_UNKNOWN;
|
||||
}
|
||||
|
||||
static
|
||||
guint
|
||||
qti_ims_set_registration(
|
||||
BinderExtIms* ext,
|
||||
BINDER_EXT_IMS_REGISTRATION registration,
|
||||
BinderExtImsResultFunc complete,
|
||||
GDestroyNotify destroy,
|
||||
void* user_data)
|
||||
{
|
||||
VendorQtiIms* self = THIS(ext);
|
||||
const gboolean on = (registration != BINDER_EXT_IMS_REGISTRATION_OFF);
|
||||
|
||||
DBG("%s %s", self->slot, on ? "on" : "off");
|
||||
if (on) {
|
||||
#pragma message("TODO: turn IMS registration on")
|
||||
} else {
|
||||
#pragma message("TODO: turn IMS registration off")
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
qti_ims_cancel(
|
||||
BinderExtIms* ext,
|
||||
guint id)
|
||||
{
|
||||
VendorQtiIms* self = THIS(ext);
|
||||
|
||||
/*
|
||||
* Cancel a pending operation identified by the id returned by the
|
||||
* above qti_ims_set_registration() call.
|
||||
*/
|
||||
DBG("%s %u", self->slot, id);
|
||||
}
|
||||
|
||||
static
|
||||
gulong
|
||||
qti_ims_add_state_handler(
|
||||
BinderExtIms* ext,
|
||||
BinderExtImsFunc handler,
|
||||
void* user_data)
|
||||
{
|
||||
VendorQtiIms* self = THIS(ext);
|
||||
|
||||
DBG("%s", self->slot);
|
||||
return G_LIKELY(handler) ? g_signal_connect(self,
|
||||
SIGNAL_STATE_CHANGED_NAME, G_CALLBACK(handler), user_data) : 0;
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
qti_ims_iface_init(
|
||||
BinderExtImsInterface* iface)
|
||||
{
|
||||
iface->version = BINDER_EXT_IMS_INTERFACE_VERSION;
|
||||
iface->get_state = qti_ims_get_state;
|
||||
iface->set_registration = qti_ims_set_registration;
|
||||
iface->cancel = qti_ims_cancel;
|
||||
iface->add_state_handler = qti_ims_add_state_handler;
|
||||
}
|
||||
|
||||
/*==========================================================================*
|
||||
* API
|
||||
*==========================================================================*/
|
||||
|
||||
BinderExtIms*
|
||||
qti_ims_new(
|
||||
const char* slot)
|
||||
{
|
||||
VendorQtiIms* self = g_object_new(THIS_TYPE, NULL);
|
||||
|
||||
/*
|
||||
* This could be the place to register a listener that gets invoked
|
||||
* on registration state change and emits SIGNAL_STATE_CHANGED.
|
||||
*/
|
||||
self->slot = g_strdup(slot);
|
||||
return BINDER_EXT_IMS(self);
|
||||
}
|
||||
|
||||
/*==========================================================================*
|
||||
* Internals
|
||||
*==========================================================================*/
|
||||
|
||||
static
|
||||
void
|
||||
qti_ims_finalize(
|
||||
GObject* object)
|
||||
{
|
||||
VendorQtiIms* self = THIS(object);
|
||||
|
||||
g_free(self->slot);
|
||||
G_OBJECT_CLASS(PARENT_CLASS)->finalize(object);
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
qti_ims_init(
|
||||
VendorQtiIms* self)
|
||||
{
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
qti_ims_class_init(
|
||||
VendorQtiImsClass* klass)
|
||||
{
|
||||
G_OBJECT_CLASS(klass)->finalize = qti_ims_finalize;
|
||||
qti_ims_signals[SIGNAL_STATE_CHANGED] =
|
||||
g_signal_new(SIGNAL_STATE_CHANGED_NAME, G_OBJECT_CLASS_TYPE(klass),
|
||||
G_SIGNAL_RUN_FIRST, 0, NULL, NULL, NULL, G_TYPE_NONE, 0);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
|
||||
|
||||
#include <ofono/log.h>
|
||||
#include "vendor_qti_types.h"
|
||||
|
||||
typedef BinderExtCallClass VendorQtiImsCallClass;
|
||||
typedef struct QtiImsCall {
|
||||
struct qti_ims_call {
|
||||
BinderExtCall parent;
|
||||
void * v_1;
|
||||
void * v_2;
|
||||
@@ -10,7 +10,7 @@ typedef struct QtiImsCall {
|
||||
void * v_4;
|
||||
void * v_5;
|
||||
void * v_6;
|
||||
} VendorQtiImsCall;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(VendorQtiImsCall, qti_ims_call, BINDER_EXT_TYPE_CALL)
|
||||
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
#include <ofono/log.h>
|
||||
#include "vendor_qti_types.h"
|
||||
|
||||
|
||||
struct qti_ims_conf{
|
||||
GObject parent;
|
||||
};
|
||||
/**
|
||||
vendor_qti_ims_conf_info_state
|
||||
vendor_qti_ims_conf_info_apply
|
||||
vendor_qti_ims_conf_info_endpoint_status
|
||||
*/
|
||||
@@ -1,14 +1,23 @@
|
||||
#include <ofono/log.h>
|
||||
#include <gbinder.h>
|
||||
|
||||
#include "vendor_qti_ims_radio.h"
|
||||
|
||||
typedef VendorQtiImsRadioClass VendorQtiExtClass;
|
||||
typedef struct qti_ims_radio {
|
||||
BinderExtPlugin parent;
|
||||
typedef struct radio_interface_desc {
|
||||
RADIO_INTERFACE version;
|
||||
const char* radio_iface;
|
||||
const char* const* ind_ifaces;
|
||||
const char* const* resp_ifaces;
|
||||
} RadioInterfaceDesc;
|
||||
|
||||
typedef GObjectClass VendorQtiImsRadioClass;
|
||||
struct qti_ims_radio {
|
||||
GObject parent;
|
||||
int num;
|
||||
|
||||
} VendorQtiImsRadio;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
vendor_qti_ims_radio_registration_info
|
||||
vendor_qti_ims_radio_get_reg_state_response
|
||||
vendor_qti_ims_radio_send_ims_sms_response
|
||||
@@ -20,15 +29,13 @@ vendor_qti_ims_radio_handle_supp_service_notification
|
||||
vendor_qti_ims_radio_handle_call_state_changed
|
||||
vendor_qti_ims_radio_handle_sms_status_report
|
||||
vendor_qti_ims_radio_handle_incoming_ims_sms
|
||||
|
||||
*/
|
||||
#define DEFAULT_INTERFACE 2
|
||||
|
||||
/*==========================================================================*
|
||||
* API
|
||||
*==========================================================================*/
|
||||
VendorQtiImsRadio* vendor_qti_ims_radio_new(
|
||||
const char* dev,
|
||||
const char* name)
|
||||
VendorQtiImsRadio* vendor_qti_ims_radio_new(const char* dev, const char* name)
|
||||
{
|
||||
return vendor_qti_ims_radio_new_with_version(dev, name, DEFAULT_INTERFACE);
|
||||
}
|
||||
@@ -41,14 +48,13 @@ VendorQtiImsRadio* radio_instance_new_with_version(
|
||||
GBinderServiceManager* sm = gbinder_servicemanager_new(dev);
|
||||
if (sm) {
|
||||
guint i;
|
||||
|
||||
/**
|
||||
for (i = 0; i < G_N_ELEMENTS(radio_interfaces) && !self; i++) {
|
||||
const RadioInterfaceDesc* desc = radio_interfaces + i;
|
||||
|
||||
if (desc->version <= max_version) {
|
||||
char* fqname = g_strconcat(desc->radio_iface, "/", name, NULL);
|
||||
GBinderRemoteObject* obj = /* autoreleased */
|
||||
gbinder_servicemanager_get_service_sync(sm, fqname, NULL);
|
||||
GBinderRemoteObject* obj = gbinder_servicemanager_get_service_sync(sm, fqname, NULL);
|
||||
|
||||
if (obj) {
|
||||
GINFO("Connected to %s", fqname);
|
||||
@@ -58,11 +64,12 @@ VendorQtiImsRadio* radio_instance_new_with_version(
|
||||
g_free(fqname);
|
||||
}
|
||||
}
|
||||
*/
|
||||
gbinder_servicemanager_unref(sm);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
/**
|
||||
VendorQtiImsRadio* vendor_qti_ims_radio_create(
|
||||
GBinderServiceManager* sm,
|
||||
GBinderRemoteObject* remote,
|
||||
@@ -75,4 +82,5 @@ VendorQtiImsRadio* vendor_qti_ims_radio_create(
|
||||
{
|
||||
int status;
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1,15 +1,16 @@
|
||||
|
||||
|
||||
#include <ofono/log.h>
|
||||
#include "binder_ext_sms_impl.h"
|
||||
|
||||
#include "vendor_qti_types.h"
|
||||
|
||||
|
||||
typedef GObjectClass VendorQtiImsSmsClass;
|
||||
typedef struct qti_ims_sms {
|
||||
struct qti_ims_sms {
|
||||
GObject parent;
|
||||
int cancelled;
|
||||
VendorQtiImsRadio* ims_radio;
|
||||
VendorQtiImsStateObject* ims_state;
|
||||
} VendorQtiImsSms;
|
||||
};
|
||||
|
||||
static void qti_ims_sms_iface_init(BinderExtSmsInterface* iface);
|
||||
G_DEFINE_TYPE_WITH_CODE(VendorQtiImsSms, qti_ims_sms, G_TYPE_OBJECT,
|
||||
|
||||
10
src/vendor_qti_ims_state.c
Normal file
10
src/vendor_qti_ims_state.c
Normal file
@@ -0,0 +1,10 @@
|
||||
#include <ofono/log.h>
|
||||
#include "vendor_qti_ims_state.h"
|
||||
|
||||
struct qti_ims_state{
|
||||
GObject parent;
|
||||
};
|
||||
|
||||
VendorQtiImsStateObject* vendor_qti_ims_state_new(VendorQtiImsRadio* ims_radio){
|
||||
return NULL;
|
||||
}
|
||||
@@ -7,6 +7,7 @@
|
||||
/*==========================================================================*
|
||||
* QTI plugin
|
||||
*==========================================================================*/
|
||||
extern const char qti_plugin_name[];
|
||||
|
||||
// sub_B940
|
||||
static int vendor_qti_plugin_init(void){
|
||||
|
||||
@@ -1,7 +1,19 @@
|
||||
|
||||
#include <ofono/log.h>
|
||||
|
||||
#include "radio_instance.h"
|
||||
|
||||
#include "binder_ext_ims.h"
|
||||
#include "binder_ext_sms.h"
|
||||
#include "binder_ext_call.h"
|
||||
|
||||
#include "binder_ext_slot_impl.h"
|
||||
|
||||
#include "vendor_qti_types.h"
|
||||
|
||||
#include "vendor_qti_slot.h"
|
||||
#include "binder_ext_ims.h"
|
||||
#include "binder_ext_slot_impl.h"
|
||||
#include "vendor_qti_ims_radio.h"
|
||||
#include "vendor_qti_ims_state.h"
|
||||
|
||||
|
||||
/*==========================================================================*
|
||||
@@ -9,15 +21,14 @@
|
||||
*==========================================================================*/
|
||||
|
||||
typedef BinderExtSlotClass VendorQtiSlotClass;
|
||||
typedef struct qti_slot {
|
||||
struct qti_slot {
|
||||
BinderExtSlot parent;
|
||||
int* shutdown;
|
||||
BinderExtIms* ims;// 4
|
||||
BinderExtSms* ims_sms;// 5
|
||||
BinderExtCall* ims_call;// 6
|
||||
VendorQtiImsRadio* ims_radio;// 7
|
||||
VendorQtiImsStateObject* ims_state; // 8
|
||||
} VendorQtiSlot;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(VendorQtiSlot, qti_slot, BINDER_EXT_TYPE_SLOT)
|
||||
|
||||
@@ -58,9 +69,6 @@ qti_slot_shutdown(
|
||||
{
|
||||
VendorQtiSlot* self = THIS(slot);
|
||||
|
||||
if (self->shutdown) {
|
||||
(*self->shutdown)++;
|
||||
}
|
||||
BINDER_EXT_SLOT_CLASS(PARENT_CLASS)->shutdown(slot);
|
||||
}
|
||||
|
||||
@@ -69,12 +77,13 @@ qti_slot_shutdown(
|
||||
*==========================================================================*/
|
||||
BinderExtSlot* vendor_qti_slot_new(RadioInstance* radio, GHashTable* params)
|
||||
{
|
||||
VendorQtiSlot* self = g_object_new(QTI_TYPE_SLOT, NULL);
|
||||
VendorQtiSlot* self = g_object_new(THIS_TYPE, NULL);
|
||||
BinderExtSlot* slot = &self->parent;
|
||||
char* ims_radio_name = g_strdup_printf("imsradio%d", radio->slot_index);
|
||||
//
|
||||
VendorQtiImsRadio* ims_radio = vendor_qti_ims_radio_new(radio->dev, ims_radio_name);
|
||||
self->ims_radio = ims_radio;
|
||||
/*
|
||||
if(ims_radio != NULL){
|
||||
VendorQtiImsStateObject* ims_state = vendor_qti_ims_state_new(ims_radio);
|
||||
self->ims_state = ims_state;
|
||||
@@ -82,7 +91,8 @@ qti_slot_shutdown(
|
||||
self->ims_call = vendor_qti_ims_call_new(self->ims_radio,self->ims_state);
|
||||
self->ims_sms = vendor_qti_ims_sms_new(self->ims_radio,self->ims_state);
|
||||
}
|
||||
g_free(ims_radio_num);
|
||||
*/
|
||||
g_free(ims_radio_name);
|
||||
return slot;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user