linphone-LinphoneChatMessageImpl文件对应的JNI层文件分析
来源:互联网 发布:嘉兴旅游攻略知乎 编辑:程序博客网 时间:2024/06/05 06:05
说明
native函数
private native byte[] getText(long ptr);private native long getPeerAddress(long ptr);private native String getExternalBodyUrl(long ptr);private native void setExternalBodyUrl(long ptr, String url);private native long getFrom(long ptr);private native long getTime(long ptr);private native int getStatus(long ptr);private native boolean isRead(long ptr);private native boolean isOutgoing(long ptr);private native void store(long ptr);private native int getStorageId(long ptr);private native void setFileTransferFilepath(long ptr, String path);private native int downloadFile(long ptr);private native void setListener(long ptr, LinphoneChatMessageListener listener);private native void unref(long ptr);private native long getTo(long ptr);private native void addCustomHeader(long nativePtr, String name, String value);private native String getCustomHeader(long nativePtr, String name);private native int getReason(long ptr);private native long getErrorInfo(long nativePtr);private native Object getFileTransferInformation(long ptr);private native void setAppData(long ptr, String data);private native String getAppData(long ptr);private native void cancelFileTransfer(long messagePtr);private native void putChar(long nativePtr, long character);
getText
extern "C" jbyteArray Java_org_linphone_core_LinphoneChatMessageImpl_getText(JNIEnv* env ,jobject thiz ,jlong ptr) { const char *message = linphone_chat_message_get_text((LinphoneChatMessage*)ptr); if (message){ size_t length = strlen(message); jbyteArray array = env->NewByteArray(length); env->SetByteArrayRegion(array, 0, length, (const jbyte*)message); return array; } return NULL;}
getPeerAddress
extern "C" jlong Java_org_linphone_core_LinphoneChatMessageImpl_getPeerAddress(JNIEnv* env ,jobject thiz ,jlong ptr) { return (jlong) linphone_chat_message_get_peer_address((LinphoneChatMessage*)ptr);}
linphone_chat_message_get_peer_address
submodules/linphone/coreapi/chat.c:const LinphoneAddress *linphone_chat_message_get_peer_address(LinphoneChatMessage *msg) {submodules/linphone/coreapi/linphonecore.h:LINPHONE_PUBLIC const LinphoneAddress* linphone_chat_message_get_peer_address(LinphoneChatMessage *msg);
linphone_chat_message_get_peer_address
const LinphoneAddress *linphone_chat_message_get_peer_address(LinphoneChatMessage *msg) { return linphone_chat_room_get_peer_address(msg->chat_room);}
const LinphoneAddress *linphone_chat_room_get_peer_address(LinphoneChatRoom *cr) { return cr->peer_url;}
LinphoneChatRoom
submodules/linphone/coreapi/private.h:struct _LinphoneChatRoom{
struct _LinphoneChatRoom{ belle_sip_object_t base; void *user_data; struct _LinphoneCore *lc; char *peer; LinphoneAddress *peer_url; MSList *messages_hist; MSList *transient_messages; int unread_count; LinphoneIsComposingState remote_is_composing; LinphoneIsComposingState is_composing; belle_sip_source_t *remote_composing_refresh_timer; belle_sip_source_t *composing_idle_timer; belle_sip_source_t *composing_refresh_timer; LinphoneCall *call; LinphoneChatMessage *pending_message; MSList *received_rtt_characters;};
getExternalBodyUrl
extern "C" jstring Java_org_linphone_core_LinphoneChatMessageImpl_getExternalBodyUrl(JNIEnv* env ,jobject thiz ,jlong ptr) { jstring jvalue =env->NewStringUTF(linphone_chat_message_get_external_body_url((LinphoneChatMessage*)ptr)); return jvalue;}
linphone_chat_message_get_external_body_url
const char *linphone_chat_message_get_external_body_url(const LinphoneChatMessage *msg) { return msg->external_body_url;}
setExternalBodyUrl
extern "C" void Java_org_linphone_core_LinphoneChatMessageImpl_setExternalBodyUrl(JNIEnv* env ,jobject thiz ,jlong ptr ,jstring jurl) { const char* url = env->GetStringUTFChars(jurl, NULL); linphone_chat_message_set_external_body_url((LinphoneChatMessage *)ptr, url); env->ReleaseStringUTFChars(jurl, url);}
linphone_chat_message_set_external_body_url
void linphone_chat_message_set_external_body_url(LinphoneChatMessage *msg, const char *url) { if (msg->external_body_url) { ms_free(msg->external_body_url); } msg->external_body_url = url ? ms_strdup(url) : NULL;}
getFrom
extern "C" jlong Java_org_linphone_core_LinphoneChatMessageImpl_getFrom(JNIEnv* env ,jobject thiz ,jlong ptr) { return (jlong) linphone_chat_message_get_from((LinphoneChatMessage*)ptr);}
linphone_chat_message_get_from
const LinphoneAddress *linphone_chat_message_get_from_address(const LinphoneChatMessage *msg) { return msg->from;}
getTime
extern "C" jlong Java_org_linphone_core_LinphoneChatMessageImpl_getTime(JNIEnv* env ,jobject thiz ,jlong ptr) { return (jlong) linphone_chat_message_get_time((LinphoneChatMessage*)ptr);}
linphone_chat_message_get_time
time_t linphone_chat_message_get_time(const LinphoneChatMessage *msg) { return msg->time;}
getStatus
extern "C" jint Java_org_linphone_core_LinphoneChatMessageImpl_getStatus(JNIEnv* env ,jobject thiz ,jlong ptr) { return (jint) linphone_chat_message_get_state((LinphoneChatMessage*)ptr);}
linphone_chat_message_get_state
LinphoneChatMessageState linphone_chat_message_get_state(const LinphoneChatMessage *msg) { return msg->state;}
isRead
extern "C" jboolean Java_org_linphone_core_LinphoneChatMessageImpl_isRead(JNIEnv* env ,jobject thiz ,jlong ptr) { return (jboolean) linphone_chat_message_is_read((LinphoneChatMessage*)ptr);}
linphone_chat_message_is_read
bool_t linphone_chat_message_is_read(LinphoneChatMessage *msg) { return msg->is_read;}
isOutgoing
extern "C" jboolean Java_org_linphone_core_LinphoneChatMessageImpl_isOutgoing(JNIEnv* env ,jobject thiz ,jlong ptr) { return (jboolean) linphone_chat_message_is_outgoing((LinphoneChatMessage*)ptr);}
linphone_chat_message_is_outgoing
bool_t linphone_chat_message_is_outgoing(LinphoneChatMessage *msg) { return msg->dir == LinphoneChatMessageOutgoing;}
store
extern "C" void Java_org_linphone_core_LinphoneChatMessageImpl_store(JNIEnv* env ,jobject thiz ,jlong ptr) { linphone_chat_message_store((LinphoneChatMessage*)ptr);}
linphone_chat_message_store
submodules/linphone/coreapi/message_storage.c:unsigned int linphone_chat_message_store(LinphoneChatMessage *cr){
static int linphone_chat_message_store_content(LinphoneChatMessage *msg) { LinphoneCore *lc = linphone_chat_room_get_core(msg->chat_room); int id = -1; if (lc->db) { LinphoneContent *content = msg->file_transfer_information; char *buf = sqlite3_mprintf("INSERT INTO content VALUES(NULL,%Q,%Q,%Q,%Q,%i,%Q);", linphone_content_get_type(content), linphone_content_get_subtype(content), linphone_content_get_name(content), linphone_content_get_encoding(content), linphone_content_get_size(content), NULL ); linphone_sql_request(lc->db, buf); sqlite3_free(buf); id = (unsigned int) sqlite3_last_insert_rowid (lc->db); } return id;}
getStorageId
extern "C" jint Java_org_linphone_core_LinphoneChatMessageImpl_getStorageId(JNIEnv* env ,jobject thiz ,jlong ptr) { return (jint) linphone_chat_message_get_storage_id((LinphoneChatMessage*)ptr);}
linphone_chat_message_get_storage_id
unsigned int linphone_chat_message_get_storage_id(LinphoneChatMessage *msg) { return msg->storage_id;}
setFileTransferFilepath
extern "C" void Java_org_linphone_core_LinphoneChatMessageImpl_setFileTransferFilepath(JNIEnv* env ,jobject thiz ,jlong ptr, jstring jpath) { const char* path = env->GetStringUTFChars(jpath, NULL); linphone_chat_message_set_file_transfer_filepath((LinphoneChatMessage*)ptr, path); env->ReleaseStringUTFChars(jpath, path);}
linphone_chat_message_set_file_transfer_filepath
submodules/linphone/coreapi/linphonecore.h:LINPHONE_PUBLIC void linphone_chat_message_set_file_transfer_filepath(LinphoneChatMessage *msg, const char *filepath);submodules/linphone/coreapi/chat_file_transfer.c:void linphone_chat_message_set_file_transfer_filepath(LinphoneChatMessage *msg, const char *filepath) {
void linphone_chat_message_set_file_transfer_filepath(LinphoneChatMessage *msg, const char *filepath) { if (msg->file_transfer_filepath != NULL) { ms_free(msg->file_transfer_filepath); } msg->file_transfer_filepath = ms_strdup(filepath);}
downloadFile
extern "C" jint Java_org_linphone_core_LinphoneChatMessageImpl_downloadFile(JNIEnv* env ,jobject thiz ,jlong ptr) { return (jint) linphone_chat_message_download_file((LinphoneChatMessage*)ptr);}
linphone_chat_message_download_file
int linphone_chat_message_download_file(LinphoneChatMessage *msg) { belle_http_request_listener_callbacks_t cbs = {0}; int err; if (msg->http_request){ ms_error("linphone_chat_message_download_file(): there is already a download in progress"); return -1; } cbs.process_response_headers = linphone_chat_process_response_headers_from_get_file; cbs.process_response = linphone_chat_process_response_from_get_file; cbs.process_io_error = linphone_chat_message_process_io_error_download; cbs.process_auth_requested = linphone_chat_message_process_auth_requested_download; err = _linphone_chat_room_start_http_transfer(msg, msg->external_body_url, "GET", &cbs); if (err == -1) return -1; /* start the download, status is In Progress */ linphone_chat_message_set_state(msg, LinphoneChatMessageStateInProgress); return 0;}
setListener
extern "C" void Java_org_linphone_core_LinphoneChatMessageImpl_setListener(JNIEnv* env, jobject thiz, jlong ptr, jobject jlistener) { jobject listener = env->NewGlobalRef(jlistener); LinphoneChatMessage *message = (LinphoneChatMessage *)ptr; LinphoneChatMessageCbs *cbs; message->message_state_changed_user_data = listener; cbs = linphone_chat_message_get_callbacks(message); linphone_chat_message_cbs_set_msg_state_changed(cbs, message_state_changed); linphone_chat_message_cbs_set_file_transfer_progress_indication(cbs, file_transfer_progress_indication); linphone_chat_message_cbs_set_file_transfer_recv(cbs, file_transfer_recv); linphone_chat_message_cbs_set_file_transfer_send(cbs, file_transfer_send);}
linphone_chat_message_cbs_set_msg_state_changed
void linphone_chat_message_cbs_set_msg_state_changed(LinphoneChatMessageCbs *cbs, LinphoneChatMessageCbsMsgStateChangedCb cb) { cbs->msg_state_changed = cb;}
linphone_chat_message_cbs_set_file_transfer_progress_indication
void linphone_chat_message_cbs_set_file_transfer_progress_indication( LinphoneChatMessageCbs *cbs, LinphoneChatMessageCbsFileTransferProgressIndicationCb cb) { cbs->file_transfer_progress_indication = cb;}
linphone_chat_message_cbs_set_file_transfer_recv
void linphone_chat_message_cbs_set_file_transfer_recv(LinphoneChatMessageCbs *cbs, LinphoneChatMessageCbsFileTransferRecvCb cb) { cbs->file_transfer_recv = cb;}
linphone_chat_message_cbs_set_file_transfer_send
void linphone_chat_message_cbs_set_file_transfer_send(LinphoneChatMessageCbs *cbs, LinphoneChatMessageCbsFileTransferSendCb cb) { cbs->file_transfer_send = cb;}
unref
extern "C" void Java_org_linphone_core_LinphoneChatMessageImpl_unref(JNIEnv* env ,jobject thiz ,jlong ptr) { linphone_chat_message_unref((LinphoneChatMessage*)ptr);}
linphone_chat_message_unref
void linphone_chat_message_unref(LinphoneChatMessage *msg) { belle_sip_object_unref(msg);}
getTo
extern "C" jlong Java_org_linphone_core_LinphoneCallLogImpl_getTo(JNIEnv* env ,jobject thiz ,jlong ptr) { return (jlong)((LinphoneCallLog*)ptr)->to;}
addCustomHeader
extern "C" void Java_org_linphone_core_LinphoneChatMessageImpl_addCustomHeader(JNIEnv* env ,jobject thiz ,jlong ptr, jstring jheader_name, jstring jheader_value) { const char *name=env->GetStringUTFChars(jheader_name,NULL); const char *value=env->GetStringUTFChars(jheader_value,NULL); linphone_chat_message_add_custom_header((LinphoneChatMessage*)ptr,name,value); env->ReleaseStringUTFChars(jheader_name, name); env->ReleaseStringUTFChars(jheader_value, value);}
getCustomHeader
extern "C" jstring Java_org_linphone_core_LinphoneCallParamsImpl_getCustomHeader(JNIEnv *env, jobject thiz, jlong lcp, jstring jheader_name){ const char* header_name=env->GetStringUTFChars(jheader_name, NULL); const char *header_value=linphone_call_params_get_custom_header((LinphoneCallParams*)lcp,header_name); env->ReleaseStringUTFChars(jheader_name, header_name); return header_value ? env->NewStringUTF(header_value) : NULL;}
getReason
/* * Class: org_linphone_core_LinphoneEventImpl * Method: getReason * Signature: (J)I */JNIEXPORT jint JNICALL Java_org_linphone_core_LinphoneEventImpl_getReason(JNIEnv *env, jobject jobj, jlong evptr){ LinphoneEvent *ev=(LinphoneEvent*)evptr; return linphone_event_get_reason(ev);}
linphone_event_get_reaso
submodules/linphone/coreapi/event.h:LINPHONE_PUBLIC LinphoneReason linphone_event_get_reason(const LinphoneEvent *lev);submodules/linphone/coreapi/event.c:LinphoneReason linphone_event_get_reason(const LinphoneEvent *lev){
getErrorInfo
JNIEXPORT jlong JNICALL Java_org_linphone_core_LinphoneEventImpl_getErrorInfo(JNIEnv *env, jobject jobj, jlong evptr){ LinphoneEvent *ev=(LinphoneEvent*)evptr; return (jlong)linphone_event_get_error_info(ev);}
linphone_event_get_error_info
submodules/linphone/coreapi/event.h:LINPHONE_PUBLIC const LinphoneErrorInfo *linphone_event_get_error_info(const LinphoneEvent *lev);submodules/linphone/coreapi/event.c:const LinphoneErrorInfo *linphone_event_get_error_info(const LinphoneEvent *lev){
getFileTransferInformation
extern "C" jobject Java_org_linphone_core_LinphoneChatMessageImpl_getFileTransferInformation(JNIEnv* env, jobject thiz, jlong ptr) { const LinphoneContent *content = linphone_chat_message_get_file_transfer_information((LinphoneChatMessage *)ptr); if (content) return create_java_linphone_content(env, content); return NULL;}
linphone_chat_message_get_file_transfer_information
const LinphoneContent *linphone_chat_message_get_file_transfer_information(const LinphoneChatMessage *msg) { return msg->file_transfer_information;}
create_java_linphone_content
static jobject create_java_linphone_content(JNIEnv *env, const LinphoneContent *icontent){ jclass contentClass; jmethodID ctor; jstring jtype, jsubtype, jencoding, jname; jbyteArray jdata = NULL; jint jsize = 0; const char *tmp; void *data; contentClass = (jclass)env->FindClass("org/linphone/core/LinphoneContentImpl"); ctor = env->GetMethodID(contentClass,"<init>", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[BLjava/lang/String;I)V"); jtype = env->NewStringUTF(linphone_content_get_type(icontent)); jsubtype = env->NewStringUTF(linphone_content_get_subtype(icontent)); jencoding = ((tmp = linphone_content_get_encoding(icontent))) ? env->NewStringUTF(tmp) : NULL; jname = ((tmp = linphone_content_get_name(icontent))) ? env->NewStringUTF(tmp) : NULL; jsize = (jint) linphone_content_get_size(icontent); data = (!linphone_content_is_multipart(icontent) ? linphone_content_get_buffer(icontent) : NULL); if (data){ jdata = env->NewByteArray(linphone_content_get_size(icontent)); env->SetByteArrayRegion(jdata, 0, linphone_content_get_size(icontent), (jbyte*)data); } jobject jobj = env->NewObject(contentClass, ctor, jname, jtype, jsubtype, jdata, jencoding, jsize); env->DeleteLocalRef(contentClass); env->DeleteLocalRef(jtype); env->DeleteLocalRef(jsubtype); if (jencoding) { env->DeleteLocalRef(jencoding); } if (jname) { env->DeleteLocalRef(jname); } return jobj;}
setAppData
extern "C" void Java_org_linphone_core_LinphoneChatMessageImpl_setAppData(JNIEnv* env, jobject thiz, jlong ptr, jstring appdata) { const char * data = appdata ? env->GetStringUTFChars(appdata, NULL) : NULL; linphone_chat_message_set_appdata((LinphoneChatMessage *)ptr, data); if (appdata) env->ReleaseStringUTFChars(appdata, data);}
linphone_chat_message_set_appdata
void linphone_chat_message_set_appdata(LinphoneChatMessage *msg, const char *data) { if (msg->appdata) { ms_free(msg->appdata); } msg->appdata = data ? ms_strdup(data) : NULL; linphone_chat_message_store_appdata(msg);}
linphone_chat_message_store_appdata
submodules/linphone/coreapi/chat.c: linphone_chat_message_store_appdata(msg);submodules/linphone/coreapi/private.h:void linphone_chat_message_store_appdata(LinphoneChatMessage* msg);submodules/linphone/coreapi/message_storage.c:void linphone_chat_message_store_appdata(LinphoneChatMessage* msg){submodules/linphone/coreapi/message_storage.c:void linphone_chat_message_store_appdata(LinphoneChatMessage *msg){
void linphone_chat_message_store_appdata(LinphoneChatMessage* msg){ LinphoneCore *lc=msg->chat_room->lc; if (lc->db){ char *buf=sqlite3_mprintf("UPDATE history SET appdata=%Q WHERE id=%i;", msg->appdata,msg->storage_id); linphone_sql_request(lc->db,buf); sqlite3_free(buf); }}
getAppData
extern "C" jstring Java_org_linphone_core_LinphoneChatMessageImpl_getAppData(JNIEnv* env, jobject thiz, jlong ptr) { const char * app_data = linphone_chat_message_get_appdata((LinphoneChatMessage *)ptr); return app_data ? env->NewStringUTF(app_data) : NULL;}
linphone_chat_message_get_appdata
const char *linphone_chat_message_get_appdata(const LinphoneChatMessage *msg) { return msg->appdata;}
cancelFileTransfer
extern "C" void Java_org_linphone_core_LinphoneChatMessageImpl_cancelFileTransfer(JNIEnv* env, jobject thiz, jlong ptr) { linphone_chat_message_cancel_file_transfer((LinphoneChatMessage *)ptr);}
linphone_chat_message_cancel_file_transfer
void linphone_chat_message_cancel_file_transfer(LinphoneChatMessage *msg) { if (msg->http_request) { if (msg->state == LinphoneChatMessageStateInProgress) { linphone_chat_message_set_state(msg, LinphoneChatMessageStateNotDelivered); } if (!belle_http_request_is_cancelled(msg->http_request)) { if (msg->chat_room) { ms_message("Canceling file transfer %s - msg [%p] chat room[%p]" , (msg->external_body_url == NULL) ? linphone_core_get_file_transfer_server(msg->chat_room->lc) : msg->external_body_url , msg , msg->chat_room); belle_http_provider_cancel_request(msg->chat_room->lc->http_provider, msg->http_request); } else { ms_message("Warning: http request still running for ORPHAN msg [%p]: this is a memory leak", msg); } } _release_http_request(msg); } else { ms_message("No existing file transfer - nothing to cancel"); }}
putChar
extern "C" void Java_org_linphone_core_LinphoneChatMessageImpl_putChar(JNIEnv* env ,jobject thiz, jlong ptr, jlong character) { linphone_chat_message_put_char((LinphoneChatMessage *)ptr, character);}
linphone_chat_message_put_char
int linphone_chat_message_put_char(LinphoneChatMessage *msg, uint32_t charater) { LinphoneChatRoom *cr = linphone_chat_message_get_chat_room(msg); LinphoneCall *call = cr->call; if (!call || !call->textstream) { return -1; } text_stream_putchar32(call->textstream, charater); return 0;}
0 0
- linphone-LinphoneChatMessageImpl文件对应的JNI层文件分析
- linphone-LinphoneAddressImpl文件对应的JNI层文件分析
- linphone-LinphoneProxyConfigImpl文件对应的JNI层文件分析
- linphone-LinphoneCallLogImpl文件对应的JNI层文件分析
- linphone-LinphoneCallParamsImpl文件对应的JNI层文件分析
- linphone-LinphoneChatRoomImpl文件对应的JNI层文件分析
- linphone-LinphoneCoreFactoryImpl文件对应的JNI层文件分析
- linphone-LinphoneFriendImpl文件对应的JNI层文件分析
- linphone-PayloadTypeImpl文件对应的JNI层文件分析
- linphone-LpConfigImpl文件对应的JNI层文件分析
- linphone-LinphoneInfoMessageImpl文件对应的JNI层文件分析
- linphone-LinphoneEventImpl文件对应的JNI层文件分析
- linphone-PresenceActivityImpl文件对应的JNI层文件分析
- linphone-PresenceModelImpl文件对应的JNI层文件分析
- linphone-PresenceNoteImpl文件对应的JNI层文件分析
- linphone-PresencePersonImpl文件对应的JNI层文件分析
- linphone-PresenceServiceImpl文件对应的JNI层文件分析
- linphone-ErrorInfoImpl文件对应的JNI层文件分析
- 安卓开发中自定义属性枚举值设置(固定属性值)
- 实现大堆小堆——仿函数的应用
- GlobalConfiguration 的命名空间
- java琐碎的知识
- android自定义View
- linphone-LinphoneChatMessageImpl文件对应的JNI层文件分析
- 5-1 数列求和-加强版
- Spark 中Accumulators 和 Broadcast Variables的使用
- C++中substr函数的用法
- 18 个锻炼编程技能的网站
- C++模板和容器的介绍
- Android 屏幕适配方案
- ios支付宝支付--看我就够了
- shell 脚本程序中空格 $符号的使用