0
点赞
收藏
分享

微信扫一扫

linphone-LinphoneCallLogImpl文件对应的JNI层文件分析


说明

本篇所有的功能全部围绕着LinphoneCallLog 展开。

疑惑

这里只是取得里面的值, 但是什么时候设置的值就不得而知了。 估计是接电话的时候创建的值吧。

native函数

private native long getFrom(long nativePtr);
    private native long getTo(long nativePtr);
    private native boolean isIncoming(long nativePtr);
    private native int getStatus(long nativePtr);
    private native String getStartDate(long nativePtr);
    private native int getCallDuration(long nativePtr);
    private native String getCallId(long nativePtr);
    private native long getTimestamp(long nativePtr);
    private native boolean wasConference(long nativePtr);

getFrom

//CallLog
extern "C" jlong Java_org_linphone_core_LinphoneCallLogImpl_getFrom(JNIEnv*  env
                                                                        ,jobject  thiz
                                                                        ,jlong ptr) {
    return (jlong)((LinphoneCallLog*)ptr)->from;
}

LinphoneCallLog

submodules/linphone/coreapi/private.h:struct _LinphoneCallLog{

struct _LinphoneCallLog{
    belle_sip_object_t base;
    void *user_data;
    struct _LinphoneCore *lc;
    LinphoneCallDir dir; /**< The direction of the call*/
    LinphoneCallStatus status; /**< The status of the call*/
    LinphoneAddress *from; /**<Originator of the call as a LinphoneAddress object*/
    LinphoneAddress *to; /**<Destination of the call as a LinphoneAddress object*/
    char start_date[128]; /**<Human readable string containing the start date*/
    int duration; /**<Duration of the call starting in connected state in seconds*/
    char *refkey;
    rtp_stats_t local_stats;
    rtp_stats_t remote_stats;
    float quality;
    time_t start_date_time; /**Start date of the call in seconds as expressed in a time_t */
    time_t connected_date_time; /**Connecting date of the call in seconds as expressed in a time_t */
    char* call_id; /**unique id of a call*/
    struct _LinphoneQualityReporting reporting;
    bool_t video_enabled;
    bool_t was_conference; /**<That call was a call with a conference server */
    unsigned int storage_id;
};

LinphoneCallStatus

submodules/linphone/coreapi/call_log.h:typedef enum _LinphoneCallStatus {

/**
 * Enum representing the status of a call
**/
typedef enum _LinphoneCallStatus {
    LinphoneCallSuccess, /**< The call was sucessful */
    LinphoneCallAborted, /**< The call was aborted */
    LinphoneCallMissed, /**< The call was missed (unanswered) */
    LinphoneCallDeclined /**< The call was declined, either locally or by remote end */
} LinphoneCallStatus;

LinphoneCallDir

submodules/linphone/coreapi/call_log.h:enum _LinphoneCallDir {

/**
 * Enum representing the direction of a call.
**/
enum _LinphoneCallDir {
    LinphoneCallOutgoing, /**< outgoing calls*/
    LinphoneCallIncoming  /**< incoming calls*/
};

_LinphoneCore

struct _LinphoneCore
{
    MSFactory* factory;
    MSList* vtable_refs;
    Sal *sal;
    LinphoneGlobalState state;
    struct _LpConfig *config;
    MSList *default_audio_codecs;
    MSList *default_video_codecs;
    MSList *default_text_codecs;
    net_config_t net_conf;
    sip_config_t sip_conf;
    rtp_config_t rtp_conf;
    sound_config_t sound_conf;
    video_config_t video_conf;
    text_config_t text_conf;
    codecs_config_t codecs_conf;
    ui_config_t ui_conf;
    autoreplier_config_t autoreplier_conf;
    LinphoneProxyConfig *default_proxy;
    MSList *friends_lists;
    MSList *auth_info;
    struct _RingStream *ringstream;
    time_t dmfs_playing_start_time;
    LCCallbackObj preview_finished_cb;
    LinphoneCall *current_call;   /* the current call */
    MSList *calls;              /* all the processed calls */
    MSList *queued_calls;   /* used by the autoreplier */
    MSList *call_logs;
    MSList *chatrooms;
    int max_call_logs;
    int missed_calls;
    VideoPreview *previewstream;
    struct _MSEventQueue *msevq;
    LinphoneRtpTransportFactories *rtptf;
    MSList *bl_reqs;
    MSList *subscribers;    /* unknown subscribers */
    int minutes_away;
    LinphonePresenceModel *presence_model;
    void *data;
    char *play_file;
    char *rec_file;
    uint64_t prevtime_ms;
    int audio_bw; /*IP bw consumed by audio codec, set as soon as used codec is known, its purpose is to know the remaining bw for video*/
    LinphoneCoreWaitingCallback wait_cb;
    void *wait_ctx;
    void *video_window_id;
    void *preview_window_id;
    time_t netup_time; /*time when network went reachable */
    struct _EcCalibrator *ecc;
    LinphoneTaskList hooks; /*tasks periodically executed in linphone_core_iterate()*/
    LinphoneConference *conf_ctx;
    char* zrtp_secrets_cache;
    char* user_certificates_path;
    LinphoneVideoPolicy video_policy;
    time_t network_last_check;

    bool_t use_files;
    bool_t apply_nat_settings;
    bool_t initial_subscribes_sent;
    bool_t bl_refresh;

    bool_t preview_finished;
    bool_t auto_net_state_mon;
    bool_t sip_network_reachable;
    bool_t media_network_reachable;

    bool_t network_reachable_to_be_notified; /*set to true when state must be notified in next iterate*/
    bool_t use_preview_window;
    bool_t network_last_status;
    bool_t ringstream_autorelease;

    bool_t vtables_running;
    bool_t send_call_stats_periodical_updates;
    bool_t forced_ice_relay;
    bool_t pad;
    char localip[LINPHONE_IPADDR_SIZE];
    int device_rotation;
    int max_calls;
    LinphoneTunnel *tunnel;
    char* device_id;
    MSList *last_recv_msg_ids;
    char *chat_db_file;
#ifdef MSG_STORAGE_ENABLED
    sqlite3 *db;
    bool_t debug_storage;
#endif
    char *logs_db_file;
#ifdef CALL_LOGS_STORAGE_ENABLED
    sqlite3 *logs_db;
#endif
    char *friends_db_file;
#ifdef FRIENDS_SQL_STORAGE_ENABLED
    sqlite3 *friends_db;
#endif
#ifdef BUILD_UPNP
    UpnpContext *upnp;
#endif //BUILD_UPNP
    belle_http_provider_t *http_provider;
    belle_tls_verify_policy_t *http_verify_policy;
    belle_http_request_listener_t *provisioning_http_listener;
    MSList *tones;
    LinphoneReason chat_deny_code;
    char *file_transfer_server;
    const char **supported_formats;
    LinphoneContent *log_collection_upload_information;
    LinphoneCoreVTable *current_vtable; // the latest vtable to call a callback, see linphone_core_get_current_vtable
    LinphoneRingtonePlayer *ringtoneplayer;
#ifdef ANDROID
    jobject wifi_lock;
    jclass wifi_lock_class;
    jmethodID wifi_lock_acquire_id;
    jmethodID wifi_lock_release_id;
    jobject multicast_lock;
    jclass multicast_lock_class;
    jmethodID multicast_lock_acquire_id;
    jmethodID multicast_lock_release_id;
#endif
};

这个_LinphoneCore真的是很长啊,真后悔找到它。不过, 这个也是最核心的部分了。 所以早晚得看它, 到底现在看不看呢。 还是随便的看一看就好了。

getTo

extern "C" jlong Java_org_linphone_core_LinphoneCallLogImpl_getTo(JNIEnv*  env
                                                                        ,jobject  thiz
                                                                        ,jlong ptr) {
    return (jlong)((LinphoneCallLog*)ptr)->to;
}

isIncoming

extern "C" jboolean Java_org_linphone_core_LinphoneCallLogImpl_isIncoming(JNIEnv*  env
                                                                        ,jobject  thiz
                                                                        ,jlong ptr) {
    return ((LinphoneCallLog*)ptr)->dir==LinphoneCallIncoming?JNI_TRUE:JNI_FALSE;
}

getStatus

extern "C" jint Java_org_linphone_core_LinphoneCallLogImpl_getStatus(JNIEnv*  env
                                                                        ,jobject  thiz
                                                                        ,jlong ptr) {
    return (jint)((LinphoneCallLog*)ptr)->status;
}

getStartDate

extern "C" jstring Java_org_linphone_core_LinphoneCallLogImpl_getStartDate(JNIEnv*  env
                                                                        ,jobject  thiz
                                                                        ,jlong ptr) {
    jstring jvalue =env->NewStringUTF(((LinphoneCallLog*)ptr)->start_date);
    return jvalue;
}

getCallDuration

extern "C" jint Java_org_linphone_core_LinphoneCallLogImpl_getCallDuration(JNIEnv*  env
                                                                        ,jobject  thiz
                                                                        ,jlong ptr) {
    return (jint)((LinphoneCallLog*)ptr)->duration;
}

getCallId

/*
 * Class:     org_linphone_core_LinphoneCallLogImpl
 * Method:    getCallId
 * Signature: (J)I
 */
JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneCallLogImpl_getCallId(JNIEnv *env, jobject jobj, jlong pcl){
    const char *str = linphone_call_log_get_call_id((LinphoneCallLog*)pcl);
    return str ? env->NewStringUTF(str) : NULL;
}

linphone_call_log_get_call_id

submodules/linphone/coreapi/call_log.c:const char *linphone_call_log_get_call_id(const LinphoneCallLog *cl){
submodules/linphone/coreapi/call_log.h:LINPHONE_PUBLIC const char * linphone_call_log_get_call_id(const LinphoneCallLog *cl);

const char *linphone_call_log_get_call_id(const LinphoneCallLog *cl){
    return cl->call_id;
}

getTimestamp

extern "C" jlong Java_org_linphone_core_LinphoneCallLogImpl_getTimestamp(JNIEnv*  env
                                                                        ,jobject  thiz
                                                                        ,jlong ptr) {
    return static_cast<long> (((LinphoneCallLog*)ptr)->start_date_time);
}

wasConference

extern "C" jboolean Java_org_linphone_core_LinphoneCallLogImpl_wasConference(JNIEnv *env, jobject thiz, jlong ptr) {
    return linphone_call_log_was_conference((LinphoneCallLog *)ptr);
}

linphone_call_log_was_conference

bool_t linphone_call_log_was_conference(LinphoneCallLog *cl) {
    return cl->was_conference;
}


举报

相关推荐

0 条评论