Compare commits
	
		
			3 Commits
		
	
	
		
			d5f614e225
			...
			master
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 1fd5760dbc | |||
| 7f7adf1db1 | |||
| b677561d63 | 
							
								
								
									
										4
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								Makefile
									
									
									
									
									
								
							@@ -64,8 +64,8 @@ WARNINGS = -Wall
 | 
			
		||||
INCLUDES = -I$(INCLUDE_DIR)
 | 
			
		||||
BASE_FLAGS = -fPIC -fvisibility=hidden
 | 
			
		||||
FULL_CFLAGS = $(BASE_FLAGS) $(CFLAGS) $(DEFINES) $(WARNINGS) $(INCLUDES) \
 | 
			
		||||
  -MMD -MP -fPIC $(shell pkg-config --cflags $(PKGS))
 | 
			
		||||
FULL_LDFLAGS = $(BASE_FLAGS) $(LDFLAGS) -shared \
 | 
			
		||||
  -MMD -MP $(shell pkg-config --cflags $(PKGS))
 | 
			
		||||
FULL_LDFLAGS = $(BASE_FLAGS) $(LDFLAGS) -shared -fPIC \
 | 
			
		||||
  $(shell pkg-config --libs $(LDPKGS))
 | 
			
		||||
DEBUG_FLAGS = -g
 | 
			
		||||
RELEASE_FLAGS =
 | 
			
		||||
 
 | 
			
		||||
@@ -10,6 +10,8 @@
 | 
			
		||||
2. G_DEFINE_TYPE用法 https://www.codenong.com/cs106693497/  
 | 
			
		||||
3. G_DEFINE_TYPE用法 https://blog.csdn.net/evsqiezi/article/details/83049655
 | 
			
		||||
4. g_type_register_static_simple(type, "A", sizeof(A_class), A_class_init, sizeof(A), A_init, 0LL);
 | 
			
		||||
5. typedef int (*pFunc_t)(char *frame, int len);//定义了一个类型pFunc_t 定义函数指针类型
 | 
			
		||||
6. gulong g_signal_connect_closure_by_id ( GObject* instance, guint signal_id, GQuark detail, GClosure* closure, gboolean after ) 连接信号对象 The handler ID (always greater than 0)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## https://docs.sailfishos.org/Reference/Architecture/
 | 
			
		||||
 
 | 
			
		||||
@@ -10,13 +10,10 @@
 | 
			
		||||
 * QTI ext
 | 
			
		||||
 *==========================================================================*/
 | 
			
		||||
 | 
			
		||||
typedef BinderExtPluginClass VendorQtiExtClass;
 | 
			
		||||
typedef BinderExtPluginClass VendorQtiExtClass;// 232LL
 | 
			
		||||
typedef struct qti_plugin {
 | 
			
		||||
    BinderExtPlugin parent;
 | 
			
		||||
    void* b_40;
 | 
			
		||||
    int num;
 | 
			
		||||
 | 
			
		||||
} VendorQtiExt;
 | 
			
		||||
    BinderExtPlugin parent;// sizeof(BinderExtPlugin) == 32LL
 | 
			
		||||
} VendorQtiExt;// sizeof(VendorQtiExt) == 32LL
 | 
			
		||||
 | 
			
		||||
//GType qti_plugin_get_type();
 | 
			
		||||
G_DEFINE_TYPE(VendorQtiExt, qti_plugin, BINDER_EXT_TYPE_PLUGIN)
 | 
			
		||||
 
 | 
			
		||||
@@ -4,11 +4,13 @@
 | 
			
		||||
#include <binder_ext_ims_impl.h>
 | 
			
		||||
#include "vendor_qti_ims.h"
 | 
			
		||||
 | 
			
		||||
typedef GObjectClass VendorQtiImsClass;
 | 
			
		||||
typedef GObjectClass VendorQtiImsClass;// 136LL == GObjectClass
 | 
			
		||||
struct qti_ims {
 | 
			
		||||
    GObject parent;
 | 
			
		||||
    GObject parent;// sizeof(GObject) == 24LL
 | 
			
		||||
    char* slot;
 | 
			
		||||
};
 | 
			
		||||
    void* v_1;
 | 
			
		||||
    void* v_2;
 | 
			
		||||
};// sizeof(VendorQtiIms) == 48LL arm64
 | 
			
		||||
 | 
			
		||||
static
 | 
			
		||||
void
 | 
			
		||||
 
 | 
			
		||||
@@ -1,37 +1,54 @@
 | 
			
		||||
#include <ofono/log.h>
 | 
			
		||||
#include <glib.h>
 | 
			
		||||
#include <gutil_idlepool.h>
 | 
			
		||||
#include <glib-object.h>
 | 
			
		||||
 | 
			
		||||
#include <binder_ext_call_impl.h>
 | 
			
		||||
 | 
			
		||||
#include "vendor_qti_types.h"
 | 
			
		||||
 | 
			
		||||
#include "vendor_qti_ims_call.h"
 | 
			
		||||
#include "vendor_qti_ims_radio.h"
 | 
			
		||||
#include "vendor_qti_ims_state.h"
 | 
			
		||||
 | 
			
		||||
typedef GObjectClass VendorQtiImsCallClass;
 | 
			
		||||
typedef GObjectClass VendorQtiImsCallClass;//sizeof(GObjectClass) == 136LL arm64
 | 
			
		||||
struct qti_ims_call {
 | 
			
		||||
    GObject parent;
 | 
			
		||||
    void * v_1;
 | 
			
		||||
    void * v_2;
 | 
			
		||||
    void * v_3;
 | 
			
		||||
    GObject parent;// sizeof(GObject) == 24LL arm64
 | 
			
		||||
    GUtilIdlePool* idle;
 | 
			
		||||
    VendorQtiImsRadio* ims_radio;
 | 
			
		||||
    VendorQtiImsStateObject* ims_state;
 | 
			
		||||
    void * v_4;
 | 
			
		||||
    void * v_5;
 | 
			
		||||
    void * v_6;
 | 
			
		||||
};
 | 
			
		||||
    void * v_7;
 | 
			
		||||
    void * v_8;
 | 
			
		||||
    void * v_9;
 | 
			
		||||
    void * v_10;
 | 
			
		||||
    void * v_11;
 | 
			
		||||
    void * v_12;
 | 
			
		||||
    void * v_13;
 | 
			
		||||
    GHashTable* string_table;
 | 
			
		||||
    GHashTable* table;
 | 
			
		||||
    void * v_16;
 | 
			
		||||
}; // sizeof(VendorQtiImsCall) == 152LL arm64
 | 
			
		||||
 | 
			
		||||
static void qti_ims_call_iface_init(BinderExtCallInterface* iface);
 | 
			
		||||
 | 
			
		||||
G_DEFINE_TYPE_WITH_CODE(VendorQtiImsCall, qti_ims_call, G_TYPE_OBJECT,
 | 
			
		||||
G_IMPLEMENT_INTERFACE(BINDER_EXT_TYPE_CALL, qti_ims_call_iface_init))
 | 
			
		||||
 | 
			
		||||
#define QTI_IMS_CALL_TYPE_SLOT qti_ims_call_get_type()
 | 
			
		||||
#define QTI_IMS_CALL_SLOT(obj) G_TYPE_CHECK_INSTANCE_CAST(obj, QTI_IMS_CALL_TYPE_SLOT, VendorQtiImsCall)
 | 
			
		||||
#define QTI_IMS_CALL_IS_SLOT(obj) G_TYPE_CHECK_INSTANCE_TYPE(obj, QTI_IMS_CALL_TYPE_SLOT)
 | 
			
		||||
#define THIS_TYPE qti_ims_call_get_type()
 | 
			
		||||
#define THIS(obj) G_TYPE_CHECK_INSTANCE_CAST(obj, THIS_TYPE, VendorQtiImsCall)
 | 
			
		||||
#define IS_THIS(obj) G_TYPE_CHECK_INSTANCE_TYPE(obj, THIS_TYPE)
 | 
			
		||||
 | 
			
		||||
static
 | 
			
		||||
void
 | 
			
		||||
qti_ims_call_init(
 | 
			
		||||
    VendorQtiImsCall* self)
 | 
			
		||||
{
 | 
			
		||||
    
 | 
			
		||||
{;
 | 
			
		||||
    self->idle = gutil_idle_pool_new();
 | 
			
		||||
    self->table = g_hash_table_new(&g_direct_hash, &g_direct_equal);
 | 
			
		||||
    self->string_table = g_hash_table_new_full(&g_str_hash, &g_str_equal, &g_free, &g_free);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static
 | 
			
		||||
@@ -46,7 +63,13 @@ static void qti_ims_call_iface_init(BinderExtCallInterface* iface){
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
BinderExtCall* vendor_qti_ims_call_new(VendorQtiImsRadio* ims_radio, VendorQtiImsStateObject* ims_state){
 | 
			
		||||
    return NULL;
 | 
			
		||||
    
 | 
			
		||||
    VendorQtiImsCall* self = g_object_new(THIS_TYPE, NULL);
 | 
			
		||||
    self->ims_radio = vendor_qti_ims_radio_ref(ims_radio);
 | 
			
		||||
    self->ims_state = vendor_qti_ims_state_ref(ims_state);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    return BINDER_EXT_CALL(self);
 | 
			
		||||
}
 | 
			
		||||
/*
 | 
			
		||||
vendor_qti_ims_call_conference_info_start_element
 | 
			
		||||
 
 | 
			
		||||
@@ -2,9 +2,22 @@
 | 
			
		||||
#include "vendor_qti_types.h"
 | 
			
		||||
#include <glib-object.h>
 | 
			
		||||
 | 
			
		||||
struct qti_ims_conf{
 | 
			
		||||
    GObject parent;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
typedef GObjectClass VendorQtiImsConfObjectClass; //136LL
 | 
			
		||||
 | 
			
		||||
typedef struct qti_ims_conf{
 | 
			
		||||
    GObject parent;// sizeof(GObject) == 24LL
 | 
			
		||||
    void* v_1;
 | 
			
		||||
    void* v_2;
 | 
			
		||||
    void* v_3;
 | 
			
		||||
    void* v_4;
 | 
			
		||||
    void* v_5;
 | 
			
		||||
    void* v_6;
 | 
			
		||||
    void* v_7;
 | 
			
		||||
    void* v_8;
 | 
			
		||||
} VendorQtiImsConfObject;// sizeof(VendorQtiImsConfObject) == 136LL
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
vendor_qti_ims_conf_info_state
 | 
			
		||||
vendor_qti_ims_conf_info_apply
 | 
			
		||||
 
 | 
			
		||||
@@ -55,7 +55,7 @@ G_STATIC_ASSERT(G_N_ELEMENTS(ims_radio_interfaces) == IMS_RADIO_INTERFACE_COUNT)
 | 
			
		||||
 | 
			
		||||
typedef GObjectClass VendorQtiImsRadioClass;
 | 
			
		||||
struct qti_ims_radio {
 | 
			
		||||
    GObject parent;
 | 
			
		||||
    GObject parent;// sizeof(GObject) == 24LL arm64
 | 
			
		||||
    char* name;
 | 
			
		||||
    GBinderClient* client;
 | 
			
		||||
    GBinderRemoteObject* remote;
 | 
			
		||||
@@ -63,7 +63,7 @@ struct qti_ims_radio {
 | 
			
		||||
    GBinderLocalObject* indication;
 | 
			
		||||
    GUtilIdlePool* idle;
 | 
			
		||||
    GHashTable* table;
 | 
			
		||||
};
 | 
			
		||||
};// sizeof(VendorQtiImsRadio) == 80LL arm64
 | 
			
		||||
 | 
			
		||||
G_DEFINE_TYPE(VendorQtiImsRadio, qti_ims_radio, G_TYPE_OBJECT)
 | 
			
		||||
 | 
			
		||||
@@ -178,6 +178,19 @@ vendor_qti_ims_radio_response(
 | 
			
		||||
{
 | 
			
		||||
    VendorQtiImsRadio* self = THIS(user_data);
 | 
			
		||||
    const char* iface = gbinder_remote_request_interface(req);
 | 
			
		||||
    if(gutil_strv_contains((const GStrV*)ims_radio_response_ifaces, iface)){
 | 
			
		||||
        GBinderReader reader;
 | 
			
		||||
        gbinder_remote_request_init_reader(req, &reader);
 | 
			
		||||
        gint32 serial;
 | 
			
		||||
        if (gbinder_reader_read_int32(&reader, &serial)) {
 | 
			
		||||
            g_hash_table_lookup(self->table,serial);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        *status = GBINDER_STATUS_OK;
 | 
			
		||||
    }else{
 | 
			
		||||
        GINFO("[%s] Unexpected %s %u", self->name,iface,code);
 | 
			
		||||
        *status = GBINDER_STATUS_FAILED;
 | 
			
		||||
    }
 | 
			
		||||
    return NULL;
 | 
			
		||||
}
 | 
			
		||||
static
 | 
			
		||||
@@ -264,6 +277,12 @@ VendorQtiImsRadio* vendor_qti_ims_radio_new(const char* dev, const char* name)
 | 
			
		||||
    return vendor_qti_ims_radio_new_with_version(dev, name, DEFAULT_INTERFACE);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
gulong vendor_qti_ims_radio_add_reg_state_changed_handler(VendorQtiImsRadio* self,
 | 
			
		||||
    void* user_data
 | 
			
		||||
    ){
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
VendorQtiImsRadio*
 | 
			
		||||
vendor_qti_ims_radio_ref(
 | 
			
		||||
    VendorQtiImsRadio* self)
 | 
			
		||||
 
 | 
			
		||||
@@ -6,13 +6,12 @@
 | 
			
		||||
 | 
			
		||||
typedef GObjectClass VendorQtiImsSmsClass;
 | 
			
		||||
struct qti_ims_sms {
 | 
			
		||||
    GObject parent;
 | 
			
		||||
    int cancelled;
 | 
			
		||||
    GObject parent;// sizeof(GObject) == 24LL
 | 
			
		||||
    VendorQtiImsRadio* ims_radio;
 | 
			
		||||
    VendorQtiImsStateObject* ims_state;
 | 
			
		||||
    gulong incoming;
 | 
			
		||||
    gulong status_report;
 | 
			
		||||
};
 | 
			
		||||
};// sizeof(VendorQtiImsSms) == 56LL
 | 
			
		||||
 | 
			
		||||
static void qti_ims_sms_iface_init(BinderExtSmsInterface* iface);
 | 
			
		||||
G_DEFINE_TYPE_WITH_CODE(VendorQtiImsSms, qti_ims_sms, G_TYPE_OBJECT,
 | 
			
		||||
@@ -107,8 +106,8 @@ gulong qti_ims_sms_connect_signal_incoming(VendorQtiImsRadio* ims_radio){
 | 
			
		||||
BinderExtSms* vendor_qti_ims_sms_new(VendorQtiImsRadio* ims_radio,VendorQtiImsStateObject* ims_state){
 | 
			
		||||
    VendorQtiImsSms* self = g_object_new(QTI_TYPE_SMS, NULL);
 | 
			
		||||
    
 | 
			
		||||
    self->ims_state = vendor_qti_ims_radio_ref(ims_state);
 | 
			
		||||
    self->ims_radio = vendor_qti_ims_state_ref(ims_radio);
 | 
			
		||||
    self->ims_state = vendor_qti_ims_state_ref(ims_state);
 | 
			
		||||
    self->ims_radio = vendor_qti_ims_radio_ref(ims_radio);
 | 
			
		||||
    
 | 
			
		||||
    //self->incoming = g_signal_connect(ims_radio,"");
 | 
			
		||||
    //self->status_report = ;
 | 
			
		||||
 
 | 
			
		||||
@@ -2,10 +2,15 @@
 | 
			
		||||
#include <glib-object.h>
 | 
			
		||||
#include "vendor_qti_ims_state.h"
 | 
			
		||||
 | 
			
		||||
typedef GObjectClass VendorQtiImsStateObjectClass;
 | 
			
		||||
// G_OBJECT_CLASS(klass)->finalize     *GObjectClass + 48 = finalize arm64
 | 
			
		||||
typedef GObjectClass VendorQtiImsStateObjectClass;// sizeof(GObjectClass) == 136LL
 | 
			
		||||
struct qti_ims_state{
 | 
			
		||||
    GObject parent;
 | 
			
		||||
};
 | 
			
		||||
    GObject parent;// sizeof(GObject) == 24LL
 | 
			
		||||
    gulong l_1;
 | 
			
		||||
    VendorQtiImsRadio* ims_radio;
 | 
			
		||||
    gulong connect_signal_handler_id;
 | 
			
		||||
    void * v_4;
 | 
			
		||||
}; // sizeof(VendorQtiImsStateObject) == 56LL arm64
 | 
			
		||||
 | 
			
		||||
G_DEFINE_TYPE(VendorQtiImsStateObject, qti_ims_state, G_TYPE_OBJECT)
 | 
			
		||||
 | 
			
		||||
@@ -15,8 +20,44 @@ G_DEFINE_TYPE(VendorQtiImsStateObject, qti_ims_state, G_TYPE_OBJECT)
 | 
			
		||||
#define PARENT_CLASS qti_ims_state_parent_class
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define SIGNAL_PROPERTY_CHANGED_NAME "qti-ims-state-property-changed"
 | 
			
		||||
static guint property_changed_signal = 0;
 | 
			
		||||
 | 
			
		||||
static
 | 
			
		||||
void
 | 
			
		||||
qti_ims_state_finalize(
 | 
			
		||||
    GObject* object)
 | 
			
		||||
{
 | 
			
		||||
    VendorQtiImsStateObject* self = THIS(object);
 | 
			
		||||
    // ...
 | 
			
		||||
    G_OBJECT_CLASS(PARENT_CLASS)->finalize(object);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static
 | 
			
		||||
void
 | 
			
		||||
qti_ims_state_init(
 | 
			
		||||
    VendorQtiImsStateObject* self)
 | 
			
		||||
{
 | 
			
		||||
    self->l_1 = 0x1500000003LL;
 | 
			
		||||
}
 | 
			
		||||
static
 | 
			
		||||
void
 | 
			
		||||
qti_ims_state_class_init(
 | 
			
		||||
    VendorQtiImsStateObjectClass* klass)
 | 
			
		||||
{
 | 
			
		||||
    G_OBJECT_CLASS(klass)->finalize = qti_ims_state_finalize;
 | 
			
		||||
    property_changed_signal = g_signal_new(SIGNAL_PROPERTY_CHANGED_NAME,
 | 
			
		||||
        G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_FIRST, 0, NULL, NULL, NULL, G_TYPE_NONE, 1, 28LL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
VendorQtiImsStateObject* vendor_qti_ims_state_new(VendorQtiImsRadio* ims_radio){
 | 
			
		||||
    return NULL;
 | 
			
		||||
 | 
			
		||||
     VendorQtiImsStateObject* self = g_object_new(THIS_TYPE, NULL);
 | 
			
		||||
    
 | 
			
		||||
    self->ims_radio = vendor_qti_ims_radio_ref(ims_radio);
 | 
			
		||||
 | 
			
		||||
    return self;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
VendorQtiImsStateObject*
 | 
			
		||||
 
 | 
			
		||||
@@ -20,15 +20,15 @@
 | 
			
		||||
 * QTI slot
 | 
			
		||||
 *==========================================================================*/
 | 
			
		||||
 | 
			
		||||
typedef BinderExtSlotClass VendorQtiSlotClass;
 | 
			
		||||
typedef BinderExtSlotClass VendorQtiSlotClass;// 232LL
 | 
			
		||||
struct qti_slot {
 | 
			
		||||
    BinderExtSlot parent;
 | 
			
		||||
    BinderExtSlot parent;// sizeof(BinderExtSlot) == 32LL
 | 
			
		||||
    BinderExtIms* ims;// 4
 | 
			
		||||
    BinderExtSms* ims_sms;// 5
 | 
			
		||||
    BinderExtCall* ims_call;// 6
 | 
			
		||||
    VendorQtiImsRadio* ims_radio;// 7
 | 
			
		||||
    VendorQtiImsStateObject* ims_state; // 8
 | 
			
		||||
};
 | 
			
		||||
};// sizeof(VendorQtiSlot) == 72LL
 | 
			
		||||
 | 
			
		||||
G_DEFINE_TYPE(VendorQtiSlot, qti_slot, BINDER_EXT_TYPE_SLOT)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user