diff --git a/coreapi/help/java/org/linphone/core/tutorials/TutorialBuddyStatus.java b/coreapi/help/java/org/linphone/core/tutorials/TutorialBuddyStatus.java index ef5dd2fd1..22a850b36 100644 --- a/coreapi/help/java/org/linphone/core/tutorials/TutorialBuddyStatus.java +++ b/coreapi/help/java/org/linphone/core/tutorials/TutorialBuddyStatus.java @@ -35,7 +35,7 @@ import org.linphone.core.LinphoneCore.RegistrationState; import org.linphone.core.LinphoneCore.RemoteProvisioningState; import org.linphone.core.LinphoneCoreException; import org.linphone.core.LinphoneCoreFactory; -import org.linphone.core.LinphoneCoreListener.LinphoneListener; +import org.linphone.core.LinphoneCoreListener; import org.linphone.core.LinphoneEvent; import org.linphone.core.LinphoneFriend; import org.linphone.core.LinphoneFriend.SubscribePolicy; @@ -61,7 +61,7 @@ import org.linphone.core.SubscriptionState; * @author Guillaume Beraudo * */ -public class TutorialBuddyStatus implements LinphoneListener { +public class TutorialBuddyStatus implements LinphoneCoreListener { private boolean running; private TutorialNotifier TutorialNotifier; diff --git a/coreapi/help/java/org/linphone/core/tutorials/TutorialChatRoom.java b/coreapi/help/java/org/linphone/core/tutorials/TutorialChatRoom.java index 046c23ada..e8a7da936 100644 --- a/coreapi/help/java/org/linphone/core/tutorials/TutorialChatRoom.java +++ b/coreapi/help/java/org/linphone/core/tutorials/TutorialChatRoom.java @@ -35,7 +35,7 @@ import org.linphone.core.LinphoneCore.RegistrationState; import org.linphone.core.LinphoneCore.RemoteProvisioningState; import org.linphone.core.LinphoneCoreException; import org.linphone.core.LinphoneCoreFactory; -import org.linphone.core.LinphoneCoreListener.LinphoneListener; +import org.linphone.core.LinphoneCoreListener; import org.linphone.core.LinphoneEvent; import org.linphone.core.LinphoneFriend; import org.linphone.core.LinphoneInfoMessage; @@ -59,7 +59,7 @@ import org.linphone.core.SubscriptionState; * @author Guillaume Beraudo * */ -public class TutorialChatRoom implements LinphoneListener, LinphoneChatMessage.StateListener { +public class TutorialChatRoom implements LinphoneCoreListener, LinphoneChatMessage.StateListener { private boolean running; private TutorialNotifier TutorialNotifier; diff --git a/coreapi/help/java/org/linphone/core/tutorials/TutorialHelloWorld.java b/coreapi/help/java/org/linphone/core/tutorials/TutorialHelloWorld.java index 2e2e50b0b..3fc9b78c5 100644 --- a/coreapi/help/java/org/linphone/core/tutorials/TutorialHelloWorld.java +++ b/coreapi/help/java/org/linphone/core/tutorials/TutorialHelloWorld.java @@ -35,7 +35,7 @@ import org.linphone.core.LinphoneCore.RegistrationState; import org.linphone.core.LinphoneCore.RemoteProvisioningState; import org.linphone.core.LinphoneCoreException; import org.linphone.core.LinphoneCoreFactory; -import org.linphone.core.LinphoneCoreListener.LinphoneListener; +import org.linphone.core.LinphoneCoreListener; import org.linphone.core.LinphoneEvent; import org.linphone.core.LinphoneFriend; import org.linphone.core.LinphoneInfoMessage; @@ -53,7 +53,7 @@ import org.linphone.core.SubscriptionState; * @author Guillaume Beraudo * */ -public class TutorialHelloWorld implements LinphoneListener { +public class TutorialHelloWorld implements LinphoneCoreListener { private boolean running; private TutorialNotifier TutorialNotifier; diff --git a/coreapi/help/java/org/linphone/core/tutorials/TutorialRegistration.java b/coreapi/help/java/org/linphone/core/tutorials/TutorialRegistration.java index ce985d288..44c432271 100644 --- a/coreapi/help/java/org/linphone/core/tutorials/TutorialRegistration.java +++ b/coreapi/help/java/org/linphone/core/tutorials/TutorialRegistration.java @@ -35,7 +35,7 @@ import org.linphone.core.LinphoneCore.RegistrationState; import org.linphone.core.LinphoneCore.RemoteProvisioningState; import org.linphone.core.LinphoneCoreException; import org.linphone.core.LinphoneCoreFactory; -import org.linphone.core.LinphoneCoreListener.LinphoneListener; +import org.linphone.core.LinphoneCoreListener; import org.linphone.core.LinphoneEvent; import org.linphone.core.LinphoneFriend; import org.linphone.core.LinphoneInfoMessage; @@ -58,7 +58,7 @@ import org.linphone.core.SubscriptionState; * @author Guillaume Beraudo * */ -public class TutorialRegistration implements LinphoneListener { +public class TutorialRegistration implements LinphoneCoreListener { private boolean running; private TutorialNotifier TutorialNotifier; diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 8dbb4f382..b159050f0 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -273,7 +273,6 @@ public: globalStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCore$GlobalState")); globalStateFromIntId = env->GetStaticMethodID(globalStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCore$GlobalState;"); globalStateId = env->GetMethodID(listenerClass,"globalState","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCore$GlobalState;Ljava/lang/String;)V"); - env->ExceptionClear(); if (globalStateId) { vTable->global_state_changed = globalStateChange; } @@ -282,7 +281,6 @@ public: registrationStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCore$RegistrationState")); registrationStateFromIntId = env->GetStaticMethodID(registrationStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCore$RegistrationState;"); registrationStateId = env->GetMethodID(listenerClass,"registrationState","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneProxyConfig;Lorg/linphone/core/LinphoneCore$RegistrationState;Ljava/lang/String;)V"); - env->ExceptionClear(); if (registrationStateId) { vTable->registration_state_changed = registrationStateChange; } @@ -291,7 +289,6 @@ public: callStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCall$State")); callStateFromIntId = env->GetStaticMethodID(callStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCall$State;"); callStateId = env->GetMethodID(listenerClass,"callState","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCall;Lorg/linphone/core/LinphoneCall$State;Ljava/lang/String;)V"); - env->ExceptionClear(); if (callStateId) { vTable->call_state_changed = callStateChange; } @@ -304,14 +301,12 @@ public: /*callStatsUpdated(LinphoneCore lc, LinphoneCall call, LinphoneCallStats stats);*/ callStatsUpdatedId = env->GetMethodID(listenerClass, "callStatsUpdated", "(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCall;Lorg/linphone/core/LinphoneCallStats;)V"); - env->ExceptionClear(); if (callStatsUpdatedId) { vTable->call_stats_updated = callStatsUpdated; } /*callEncryption(LinphoneCore lc, LinphoneCall call, boolean encrypted,String auth_token);*/ callEncryptionChangedId = env->GetMethodID(listenerClass,"callEncryptionChanged","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCall;ZLjava/lang/String;)V"); - env->ExceptionClear(); if (callEncryptionChangedId) { vTable->call_encryption_changed = callEncryptionChange; } @@ -320,7 +315,6 @@ public: ecCalibratorStatusClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCore$EcCalibratorStatus")); ecCalibratorStatusFromIntId = env->GetStaticMethodID(ecCalibratorStatusClass,"fromInt","(I)Lorg/linphone/core/LinphoneCore$EcCalibratorStatus;"); ecCalibrationStatusId = env->GetMethodID(listenerClass,"ecCalibrationStatus","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCore$EcCalibratorStatus;ILjava/lang/Object;)V"); - env->ExceptionClear(); /*void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf, String url)*/ newSubscriptionRequestId = env->GetMethodID(listenerClass,"newSubscriptionRequest","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneFriend;Ljava/lang/String;)V"); @@ -362,13 +356,11 @@ public: } dtmfReceivedId = env->GetMethodID(listenerClass,"dtmfReceived","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCall;I)V"); - env->ExceptionClear(); if (dtmfReceivedId) { vTable->dtmf_received = dtmf_received; } infoReceivedId = env->GetMethodID(listenerClass,"infoReceived", "(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCall;Lorg/linphone/core/LinphoneInfoMessage;)V"); - env->ExceptionClear(); if (infoReceivedId) { vTable->info_received = infoReceived; } @@ -376,7 +368,6 @@ public: subscriptionStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/SubscriptionState")); subscriptionStateFromIntId = env->GetStaticMethodID(subscriptionStateClass,"fromInt","(I)Lorg/linphone/core/SubscriptionState;"); subscriptionStateId = env->GetMethodID(listenerClass,"subscriptionStateChanged", "(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneEvent;Lorg/linphone/core/SubscriptionState;)V"); - env->ExceptionClear(); if (subscriptionStateId) { vTable->subscription_state_changed = subscriptionStateChanged; } @@ -384,13 +375,11 @@ public: publishStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/PublishState")); publishStateFromIntId = env->GetStaticMethodID(publishStateClass,"fromInt","(I)Lorg/linphone/core/PublishState;"); publishStateId = env->GetMethodID(listenerClass,"publishStateChanged", "(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneEvent;Lorg/linphone/core/PublishState;)V"); - env->ExceptionClear(); if (publishStateId) { vTable->publish_state_changed = publishStateChanged; } notifyRecvId = env->GetMethodID(listenerClass,"notifyReceived", "(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneEvent;Ljava/lang/String;Lorg/linphone/core/LinphoneContent;)V"); - env->ExceptionClear(); if (notifyRecvId) { vTable->notify_received = notifyReceived; } @@ -398,25 +387,21 @@ public: configuringStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCore$RemoteProvisioningState")); configuringStateFromIntId = env->GetStaticMethodID(configuringStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCore$RemoteProvisioningState;"); configuringStateId = env->GetMethodID(listenerClass,"configuringStatus","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCore$RemoteProvisioningState;Ljava/lang/String;)V"); - env->ExceptionClear(); if (configuringStateId) { vTable->configuring_status = configuringStatus; } fileTransferProgressIndicationId = env->GetMethodID(listenerClass, "fileTransferProgressIndication", "(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneChatMessage;Lorg/linphone/core/LinphoneContent;I)V"); - env->ExceptionClear(); if (fileTransferProgressIndicationId) { vTable->file_transfer_progress_indication = fileTransferProgressIndication; } fileTransferSendId = env->GetMethodID(listenerClass, "fileTransferSend", "(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneChatMessage;Lorg/linphone/core/LinphoneContent;Ljava/nio/ByteBuffer;I)I"); - env->ExceptionClear(); if (fileTransferSendId) { vTable->file_transfer_send = fileTransferSend; } fileTransferRecvId = env->GetMethodID(listenerClass, "fileTransferRecv", "(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneChatMessage;Lorg/linphone/core/LinphoneContent;[BI)V"); - env->ExceptionClear(); if (fileTransferRecvId) { vTable->file_transfer_recv = fileTransferRecv; } @@ -424,12 +409,10 @@ public: logCollectionUploadStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCore$LogCollectionUploadState")); logCollectionUploadStateFromIntId = env->GetStaticMethodID(logCollectionUploadStateClass, "fromInt", "(I)Lorg/linphone/core/LinphoneCore$LogCollectionUploadState;"); logCollectionUploadProgressId = env->GetMethodID(listenerClass, "uploadProgressIndication", "(Lorg/linphone/core/LinphoneCore;II)V"); - env->ExceptionClear(); if (logCollectionUploadProgressId) { vTable->log_collection_upload_progress_indication = logCollectionUploadProgressIndication; } logCollectionUploadStateId = env->GetMethodID(listenerClass, "uploadStateChanged", "(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCore$LogCollectionUploadState;Ljava/lang/String;)V"); - env->ExceptionClear(); if (logCollectionUploadStateId) { vTable->log_collection_upload_state_changed = logCollectionUploadStateChange; } @@ -1120,19 +1103,20 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_addListener(JNIEnv* env, extern "C" void Java_org_linphone_core_LinphoneCoreImpl_removeListener(JNIEnv* env, jobject thiz, jlong lc, jobject jlistener) { MSList* iterator; LinphoneCore *core = (LinphoneCore*)lc; - jobject listener = env->NewGlobalRef(jlistener); - for (iterator = core->vtables; iterator != NULL; iterator = iterator->next) { + //jobject listener = env->NewGlobalRef(jlistener); + for (iterator = core->vtables; iterator != NULL; ) { LinphoneCoreVTable *vTable = (LinphoneCoreVTable*)(iterator->data); + iterator = iterator->next; //Because linphone_core_remove_listener may change the list if (vTable) { LinphoneCoreData *data = (LinphoneCoreData*) linphone_core_v_table_get_user_data(vTable); - if (data && env->IsSameObject(data->listener, listener)) { + if (data && env->IsSameObject(data->listener, jlistener)) { linphone_core_remove_listener(core, vTable); + delete data; linphone_core_v_table_destroy(vTable); - break; } } } - env->DeleteGlobalRef(listener); + //env->DeleteGlobalRef(listener); } diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 0a50f4f3d..3ff4a3865 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -20,7 +20,7 @@ package org.linphone.core; import java.util.Vector; -import org.linphone.core.LinphoneCoreListener.LinphoneEchoCalibrationListener; +import org.linphone.core.LinphoneCoreListener; import org.linphone.mediastream.video.AndroidVideoWindowImpl; import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration; @@ -1123,7 +1123,7 @@ public interface LinphoneCore { * @param listener the LinphoneEchoCalibrationListener to call when the calibration is done * @throws LinphoneCoreException if operation is still in progress; **/ - void startEchoCalibration(LinphoneEchoCalibrationListener listener) throws LinphoneCoreException; + void startEchoCalibration(LinphoneCoreListener listener) throws LinphoneCoreException; /** * Returns true if echo calibration is recommended. diff --git a/java/common/org/linphone/core/LinphoneCoreListener.java b/java/common/org/linphone/core/LinphoneCoreListener.java index 42a59a4a7..4067380a0 100644 --- a/java/common/org/linphone/core/LinphoneCoreListener.java +++ b/java/common/org/linphone/core/LinphoneCoreListener.java @@ -26,238 +26,214 @@ import java.nio.ByteBuffer; *This interface holds all callbacks that the application should implement. None is mandatory. */ public interface LinphoneCoreListener { - - public interface LinphoneListener extends LinphoneCoreListener, - LinphoneRemoteProvisioningListener, LinphoneMessageListener, LinphoneCallStateListener, - LinphoneCallEncryptionStateListener, LinphoneNotifyListener, LinphoneComposingListener, - LinphoneGlobalStateListener, LinphoneRegistrationStateListener, LinphoneLogCollectionUploadListener { - /**< Ask the application some authentication information - * @return */ - void authInfoRequested(LinphoneCore lc, String realm, String username, String Domain); - /** - * Call stats notification - */ - void callStatsUpdated(LinphoneCore lc, LinphoneCall call, LinphoneCallStats stats); + /**< Ask the application some authentication information + * @return */ + void authInfoRequested(LinphoneCore lc, String realm, String username, String Domain); - /** - * Reports that a new subscription request has been received and wait for a decision. - *Status on this subscription request is notified by changing policy for this friend - *@param lc LinphoneCore - *@param lf LinphoneFriend corresponding to the subscriber - *@param url of the subscriber - * - */ - void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf, String url); + /** + * Call stats notification + */ + void callStatsUpdated(LinphoneCore lc, LinphoneCall call, LinphoneCallStats stats); - /** - * Report status change for a friend previously added to LinphoneCore. - * @param lc LinphoneCore - * @param lf updated LinphoneFriend - */ - void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf); + /** + * Reports that a new subscription request has been received and wait for a decision. + *Status on this subscription request is notified by changing policy for this friend + *@param lc LinphoneCore + *@param lf LinphoneFriend corresponding to the subscriber + *@param url of the subscriber + * + */ + void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf, String url); - /** - * invoked when a new text message is received - * @param lc LinphoneCore - * @param room LinphoneChatRoom involved in this conversation. Can be be created by the framework in case the from is not present in any chat room. - * @param from LinphoneAddress from - * @param message incoming message - */ - void textReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneAddress from, String message); - - /** - * invoked when a new dtmf is received - * @param lc LinphoneCore - * @param call LinphoneCall involved in the dtmf sending - * @param dtmf value of the dtmf sent - */ - void dtmfReceived(LinphoneCore lc, LinphoneCall call, int dtmf); - - /** - * Report Notified message received for this identity. - * @param lc LinphoneCore - * @param call LinphoneCall in case the notify is part of a dialog, may be null - * @param from LinphoneAddress the message comes from - * @param event String the raw body of the notify event. - * - */ - void notifyReceived(LinphoneCore lc, LinphoneCall call, LinphoneAddress from, byte[] event); + /** + * Report status change for a friend previously added to LinphoneCore. + * @param lc LinphoneCore + * @param lf updated LinphoneFriend + */ + void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf); - /** - * Notifies progress of a call transfer. - * @param lc the LinphoneCore - * @param call the call through which the transfer was sent. - * @param new_call_state the state of the call resulting of the transfer, at the other party. - **/ - void transferState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State new_call_state); - - /** - * Notifies an incoming INFO message. - * @param lc the LinphoneCore. - * @param info the info message - */ - void infoReceived(LinphoneCore lc, LinphoneCall call, LinphoneInfoMessage info); - - /** - * Notifies of subscription requests state changes, including new incoming subscriptions. - * @param lc the LinphoneCore - * @param ev LinphoneEvent object representing the subscription context. - * @param state actual state of the subscription. - */ - void subscriptionStateChanged(LinphoneCore lc, LinphoneEvent ev, SubscriptionState state); - - /** - * Notifies about outgoing generic publish states. - * @param lc the LinphoneCore - * @param ev a LinphoneEvent representing the publish, typically created by {@link LinphoneCore#publish} - * @param state the publish state - */ - void publishStateChanged(LinphoneCore lc, LinphoneEvent ev, PublishState state); - - /**< @Deprecated Notifies the application that it should show up - * @return */ - void show(LinphoneCore lc); - - /**< @Deprecated Callback that notifies various events with human readable text. - * @return */ - void displayStatus(LinphoneCore lc,String message); + /** + * invoked when a new text message is received + * @param lc LinphoneCore + * @param room LinphoneChatRoom involved in this conversation. Can be be created by the framework in case the from is not present in any chat room. + * @param from LinphoneAddress from + * @param message incoming message + */ + void textReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneAddress from, String message); - /**< @Deprecated Callback to display a message to the user - * @return */ - void displayMessage(LinphoneCore lc,String message); + /** + * invoked when a new dtmf is received + * @param lc LinphoneCore + * @param call LinphoneCall involved in the dtmf sending + * @param dtmf value of the dtmf sent + */ + void dtmfReceived(LinphoneCore lc, LinphoneCall call, int dtmf); - /** @Deprecated Callback to display a warning to the user - * @return */ - void displayWarning(LinphoneCore lc,String message); - - /** - * Callback to be notified about the transfer progress. - * @param lc the LinphoneCore - * @param message the LinphoneChatMessage - * @param content the LinphoneContent - * @param progress percentage of the transfer done - */ - void fileTransferProgressIndication(LinphoneCore lc, LinphoneChatMessage message, LinphoneContent content, int progress); - - /** - * Callback to be notified when new data has been received - * @param lc the LinphoneCore - * @param message the LinphoneChatMessage - * @param content the LinphoneContent - * @param buffer - * @param size - */ - void fileTransferRecv(LinphoneCore lc, LinphoneChatMessage message, LinphoneContent content, byte[] buffer, int size); - - /** - * Callback to be notified when new data needs to be sent - * @param lc the LinphoneCore - * @param message the LinphoneChatMessage - * @param content the LinphoneContent - * @param buffer - * @param size - * @return the number of bytes written into buffer - */ - int fileTransferSend(LinphoneCore lc, LinphoneChatMessage message, LinphoneContent content, ByteBuffer buffer, int size); - } - - public interface LinphoneGlobalStateListener extends LinphoneCoreListener { - /** General State notification - * @param state LinphoneCore.State - * @return - * */ - void globalState(LinphoneCore lc,LinphoneCore.GlobalState state, String message); - } - - public interface LinphoneRegistrationStateListener extends LinphoneCoreListener { - /** - * Registration state notification - * */ - void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, LinphoneCore.RegistrationState state, String smessage); - } - - public interface LinphoneRemoteProvisioningListener extends LinphoneCoreListener { - /** - * Notifies the changes about the remote provisioning step - * @param lc the LinphoneCore - * @param state the RemoteProvisioningState - * @param message the error message if state == Failed - */ - void configuringStatus(LinphoneCore lc, LinphoneCore.RemoteProvisioningState state, String message); - } - - public interface LinphoneMessageListener extends LinphoneCoreListener { - /** - * invoked when a new linphone chat message is received - * @param lc LinphoneCore - * @param room LinphoneChatRoom involved in this conversation. Can be be created by the framework in case the from is not present in any chat room. - * @param message incoming linphone chat message message - */ - void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message); - } - - public interface LinphoneCallStateListener extends LinphoneCoreListener { - /** Call State notification - * @param state LinphoneCall.State - * @return - * */ - void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State state, String message); - } - - public interface LinphoneCallEncryptionStateListener extends LinphoneCoreListener { - /** - * Callback to display change in encryption state. - * @param encrypted true if all streams of the call are encrypted - * @param authenticationToken token like ZRTP SAS that may be displayed to user - */ - void callEncryptionChanged(LinphoneCore lc, LinphoneCall call, boolean encrypted, String authenticationToken); - } - - public interface LinphoneNotifyListener extends LinphoneCoreListener { - /** - * Notifies of an incoming NOTIFY received. - * @param lc the linphoneCore - * @param ev a LinphoneEvent representing the subscription context for which this notify belongs, or null if it is a NOTIFY out of of any subscription. - * @param eventName the event name - * @param content content of the NOTIFY request. - */ - void notifyReceived(LinphoneCore lc, LinphoneEvent ev, String eventName, LinphoneContent content); - } + /** + * Report Notified message received for this identity. + * @param lc LinphoneCore + * @param call LinphoneCall in case the notify is part of a dialog, may be null + * @param from LinphoneAddress the message comes from + * @param event String the raw body of the notify event. + * + */ + void notifyReceived(LinphoneCore lc, LinphoneCall call, LinphoneAddress from, byte[] event); - public interface LinphoneComposingListener extends LinphoneCoreListener { - /** - * invoked when a composing notification is received - * @param lc LinphoneCore - * @param room LinphoneChatRoom involved in the conversation. - */ - void isComposingReceived(LinphoneCore lc, LinphoneChatRoom cr); - } - - public interface LinphoneEchoCalibrationListener extends LinphoneCoreListener { - /** - * Invoked when echo cancalation calibration is completed - * @param lc LinphoneCore - * @param status - * @param delay_ms echo delay - * @param data - */ - void ecCalibrationStatus(LinphoneCore lc, LinphoneCore.EcCalibratorStatus status, int delay_ms, Object data); - } - - public interface LinphoneLogCollectionUploadListener extends LinphoneCoreListener { - /** - * Callback prototype for reporting log collection upload progress indication. - */ - void uploadProgressIndication(LinphoneCore lc, int offset, int total); - - /** - * Callback prototype for reporting log collection upload state change. - * @param lc LinphoneCore object - * @param state The state of the log collection upload - * @param info Additional information: error message in case of error state, URL of uploaded file in case of success. - */ - void uploadStateChanged(LinphoneCore lc, LinphoneCore.LogCollectionUploadState state, String info); - } + /** + * Notifies progress of a call transfer. + * @param lc the LinphoneCore + * @param call the call through which the transfer was sent. + * @param new_call_state the state of the call resulting of the transfer, at the other party. + **/ + void transferState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State new_call_state); + + /** + * Notifies an incoming INFO message. + * @param lc the LinphoneCore. + * @param info the info message + */ + void infoReceived(LinphoneCore lc, LinphoneCall call, LinphoneInfoMessage info); + + /** + * Notifies of subscription requests state changes, including new incoming subscriptions. + * @param lc the LinphoneCore + * @param ev LinphoneEvent object representing the subscription context. + * @param state actual state of the subscription. + */ + void subscriptionStateChanged(LinphoneCore lc, LinphoneEvent ev, SubscriptionState state); + + /** + * Notifies about outgoing generic publish states. + * @param lc the LinphoneCore + * @param ev a LinphoneEvent representing the publish, typically created by {@link LinphoneCore#publish} + * @param state the publish state + */ + void publishStateChanged(LinphoneCore lc, LinphoneEvent ev, PublishState state); + + /**< @Deprecated Notifies the application that it should show up + * @return */ + void show(LinphoneCore lc); + + /**< @Deprecated Callback that notifies various events with human readable text. + * @return */ + void displayStatus(LinphoneCore lc,String message); + + /**< @Deprecated Callback to display a message to the user + * @return */ + void displayMessage(LinphoneCore lc,String message); + + /** @Deprecated Callback to display a warning to the user + * @return */ + void displayWarning(LinphoneCore lc,String message); + + /** + * Callback to be notified about the transfer progress. + * @param lc the LinphoneCore + * @param message the LinphoneChatMessage + * @param content the LinphoneContent + * @param progress percentage of the transfer done + */ + void fileTransferProgressIndication(LinphoneCore lc, LinphoneChatMessage message, LinphoneContent content, int progress); + + /** + * Callback to be notified when new data has been received + * @param lc the LinphoneCore + * @param message the LinphoneChatMessage + * @param content the LinphoneContent + * @param buffer + * @param size + */ + void fileTransferRecv(LinphoneCore lc, LinphoneChatMessage message, LinphoneContent content, byte[] buffer, int size); + + /** + * Callback to be notified when new data needs to be sent + * @param lc the LinphoneCore + * @param message the LinphoneChatMessage + * @param content the LinphoneContent + * @param buffer + * @param size + * @return the number of bytes written into buffer + */ + int fileTransferSend(LinphoneCore lc, LinphoneChatMessage message, LinphoneContent content, ByteBuffer buffer, int size); + + /** General State notification + * @param state LinphoneCore.State + * @return + * */ + void globalState(LinphoneCore lc,LinphoneCore.GlobalState state, String message); + + /** + * Registration state notification + * */ + void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, LinphoneCore.RegistrationState state, String smessage); + + /** + * Notifies the changes about the remote provisioning step + * @param lc the LinphoneCore + * @param state the RemoteProvisioningState + * @param message the error message if state == Failed + */ + void configuringStatus(LinphoneCore lc, LinphoneCore.RemoteProvisioningState state, String message); + + /** + * invoked when a new linphone chat message is received + * @param lc LinphoneCore + * @param room LinphoneChatRoom involved in this conversation. Can be be created by the framework in case the from is not present in any chat room. + * @param message incoming linphone chat message message + */ + void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message); + + + /** Call State notification + * @param state LinphoneCall.State + * @return + * */ + void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State state, String message); + + /** + * Callback to display change in encryption state. + * @param encrypted true if all streams of the call are encrypted + * @param authenticationToken token like ZRTP SAS that may be displayed to user + */ + void callEncryptionChanged(LinphoneCore lc, LinphoneCall call, boolean encrypted, String authenticationToken); + + /** + * Notifies of an incoming NOTIFY received. + * @param lc the linphoneCore + * @param ev a LinphoneEvent representing the subscription context for which this notify belongs, or null if it is a NOTIFY out of of any subscription. + * @param eventName the event name + * @param content content of the NOTIFY request. + */ + void notifyReceived(LinphoneCore lc, LinphoneEvent ev, String eventName, LinphoneContent content); + + /** + * invoked when a composing notification is received + * @param lc LinphoneCore + * @param room LinphoneChatRoom involved in the conversation. + */ + void isComposingReceived(LinphoneCore lc, LinphoneChatRoom cr); + + /** + * Invoked when echo cancalation calibration is completed + * @param lc LinphoneCore + * @param status + * @param delay_ms echo delay + * @param data + */ + void ecCalibrationStatus(LinphoneCore lc, LinphoneCore.EcCalibratorStatus status, int delay_ms, Object data); + + /** + * Callback prototype for reporting log collection upload progress indication. + */ + void uploadProgressIndication(LinphoneCore lc, int offset, int total); + + /** + * Callback prototype for reporting log collection upload state change. + * @param lc LinphoneCore object + * @param state The state of the log collection upload + * @param info Additional information: error message in case of error state, URL of uploaded file in case of success. + */ + void uploadStateChanged(LinphoneCore lc, LinphoneCore.LogCollectionUploadState state, String info); } diff --git a/java/common/org/linphone/core/LinphoneCoreListenerBase.java b/java/common/org/linphone/core/LinphoneCoreListenerBase.java new file mode 100644 index 000000000..158a871af --- /dev/null +++ b/java/common/org/linphone/core/LinphoneCoreListenerBase.java @@ -0,0 +1,208 @@ +package org.linphone.core; + +import java.nio.ByteBuffer; + +import org.linphone.core.LinphoneCall.State; +import org.linphone.core.LinphoneCore.EcCalibratorStatus; +import org.linphone.core.LinphoneCore.GlobalState; +import org.linphone.core.LinphoneCore.LogCollectionUploadState; +import org.linphone.core.LinphoneCore.RegistrationState; +import org.linphone.core.LinphoneCore.RemoteProvisioningState; + +public class LinphoneCoreListenerBase implements LinphoneCoreListener { + + @Override + public void authInfoRequested(LinphoneCore lc, String realm, + String username, String Domain) { + // TODO Auto-generated method stub + + } + + @Override + public void callStatsUpdated(LinphoneCore lc, LinphoneCall call, + LinphoneCallStats stats) { + // TODO Auto-generated method stub + + } + + @Override + public void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf, + String url) { + // TODO Auto-generated method stub + + } + + @Override + public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) { + // TODO Auto-generated method stub + + } + + @Override + public void textReceived(LinphoneCore lc, LinphoneChatRoom cr, + LinphoneAddress from, String message) { + // TODO Auto-generated method stub + + } + + @Override + public void dtmfReceived(LinphoneCore lc, LinphoneCall call, int dtmf) { + // TODO Auto-generated method stub + + } + + @Override + public void notifyReceived(LinphoneCore lc, LinphoneCall call, + LinphoneAddress from, byte[] event) { + // TODO Auto-generated method stub + + } + + @Override + public void transferState(LinphoneCore lc, LinphoneCall call, + State new_call_state) { + // TODO Auto-generated method stub + + } + + @Override + public void infoReceived(LinphoneCore lc, LinphoneCall call, + LinphoneInfoMessage info) { + // TODO Auto-generated method stub + + } + + @Override + public void subscriptionStateChanged(LinphoneCore lc, LinphoneEvent ev, + SubscriptionState state) { + // TODO Auto-generated method stub + + } + + @Override + public void publishStateChanged(LinphoneCore lc, LinphoneEvent ev, + PublishState state) { + // TODO Auto-generated method stub + + } + + @Override + public void show(LinphoneCore lc) { + // TODO Auto-generated method stub + + } + + @Override + public void displayStatus(LinphoneCore lc, String message) { + // TODO Auto-generated method stub + + } + + @Override + public void displayMessage(LinphoneCore lc, String message) { + // TODO Auto-generated method stub + + } + + @Override + public void displayWarning(LinphoneCore lc, String message) { + // TODO Auto-generated method stub + + } + + @Override + public void fileTransferProgressIndication(LinphoneCore lc, + LinphoneChatMessage message, LinphoneContent content, int progress) { + // TODO Auto-generated method stub + + } + + @Override + public void fileTransferRecv(LinphoneCore lc, LinphoneChatMessage message, + LinphoneContent content, byte[] buffer, int size) { + // TODO Auto-generated method stub + + } + + @Override + public int fileTransferSend(LinphoneCore lc, LinphoneChatMessage message, + LinphoneContent content, ByteBuffer buffer, int size) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public void globalState(LinphoneCore lc, GlobalState state, String message) { + // TODO Auto-generated method stub + + } + + @Override + public void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, + RegistrationState state, String smessage) { + // TODO Auto-generated method stub + + } + + @Override + public void configuringStatus(LinphoneCore lc, + RemoteProvisioningState state, String message) { + // TODO Auto-generated method stub + + } + + @Override + public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, + LinphoneChatMessage message) { + // TODO Auto-generated method stub + + } + + @Override + public void callState(LinphoneCore lc, LinphoneCall call, State state, + String message) { + // TODO Auto-generated method stub + + } + + @Override + public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call, + boolean encrypted, String authenticationToken) { + // TODO Auto-generated method stub + + } + + @Override + public void notifyReceived(LinphoneCore lc, LinphoneEvent ev, + String eventName, LinphoneContent content) { + // TODO Auto-generated method stub + + } + + @Override + public void isComposingReceived(LinphoneCore lc, LinphoneChatRoom cr) { + // TODO Auto-generated method stub + + } + + @Override + public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status, + int delay_ms, Object data) { + // TODO Auto-generated method stub + + } + + @Override + public void uploadProgressIndication(LinphoneCore lc, int offset, int total) { + // TODO Auto-generated method stub + + } + + @Override + public void uploadStateChanged(LinphoneCore lc, + LogCollectionUploadState state, String info) { + // TODO Auto-generated method stub + + } + +} diff --git a/java/impl/org/linphone/core/LinphoneCoreImpl.java b/java/impl/org/linphone/core/LinphoneCoreImpl.java index 4823a2a2b..d69d53ef0 100644 --- a/java/impl/org/linphone/core/LinphoneCoreImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreImpl.java @@ -24,7 +24,7 @@ import java.io.File; import java.io.IOException; import org.linphone.core.LinphoneCall.State; -import org.linphone.core.LinphoneCoreListener.LinphoneEchoCalibrationListener; +import org.linphone.core.LinphoneCoreListener; import org.linphone.mediastream.Log; import org.linphone.mediastream.video.AndroidVideoWindowImpl; import org.linphone.mediastream.video.capture.hwconf.Hacks; @@ -563,7 +563,7 @@ public class LinphoneCoreImpl implements LinphoneCore { public synchronized boolean isKeepAliveEnabled() { return isKeepAliveEnabled(nativePtr); } - public synchronized void startEchoCalibration(LinphoneEchoCalibrationListener listener) throws LinphoneCoreException { + public synchronized void startEchoCalibration(LinphoneCoreListener listener) throws LinphoneCoreException { startEchoCalibration(nativePtr, listener); }