Commit 71c67a04 authored by Simon Morlat's avatar Simon Morlat
Browse files

add java interfaces for LinphoneEvent

parent 31b25e9f
......@@ -23,11 +23,13 @@ import org.linphone.core.LinphoneCall;
import org.linphone.core.LinphoneCallStats;
import org.linphone.core.LinphoneChatMessage;
import org.linphone.core.LinphoneChatRoom;
import org.linphone.core.LinphoneContent;
import org.linphone.core.LinphoneCore;
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.LinphoneCoreFactory;
import org.linphone.core.LinphoneCoreListener;
import org.linphone.core.LinphoneEvent;
import org.linphone.core.LinphoneFriend;
import org.linphone.core.LinphoneInfoMessage;
import org.linphone.core.LinphoneProxyConfig;
......@@ -36,6 +38,7 @@ import org.linphone.core.LinphoneCall.State;
import org.linphone.core.LinphoneCore.GlobalState;
import org.linphone.core.LinphoneCore.RegistrationState;
import org.linphone.core.LinphoneFriend.SubscribePolicy;
import org.linphone.core.SubscriptionState;
/**
*
......@@ -255,5 +258,19 @@ public class TutorialBuddyStatus implements LinphoneCoreListener {
}
@Override
public void subscriptionStateChanged(LinphoneCore lc, LinphoneEvent ev,
SubscriptionState state) {
// TODO Auto-generated method stub
}
@Override
public void notifyReceived(LinphoneCore lc, LinphoneEvent ev,
String eventName, LinphoneContent content) {
// TODO Auto-generated method stub
}
}
......@@ -24,6 +24,7 @@ import org.linphone.core.LinphoneCall.State;
import org.linphone.core.LinphoneCallStats;
import org.linphone.core.LinphoneChatMessage;
import org.linphone.core.LinphoneChatRoom;
import org.linphone.core.LinphoneContent;
import org.linphone.core.LinphoneCore;
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
import org.linphone.core.LinphoneCore.GlobalState;
......@@ -31,9 +32,11 @@ import org.linphone.core.LinphoneCore.RegistrationState;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.LinphoneCoreFactory;
import org.linphone.core.LinphoneCoreListener;
import org.linphone.core.LinphoneEvent;
import org.linphone.core.LinphoneFriend;
import org.linphone.core.LinphoneInfoMessage;
import org.linphone.core.LinphoneProxyConfig;
import org.linphone.core.SubscriptionState;
/**
......@@ -177,5 +180,19 @@ public class TutorialChatRoom implements LinphoneCoreListener, LinphoneChatMessa
}
@Override
public void subscriptionStateChanged(LinphoneCore lc, LinphoneEvent ev,
SubscriptionState state) {
// TODO Auto-generated method stub
}
@Override
public void notifyReceived(LinphoneCore lc, LinphoneEvent ev,
String eventName, LinphoneContent content) {
// TODO Auto-generated method stub
}
}
......@@ -23,17 +23,20 @@ import org.linphone.core.LinphoneCall;
import org.linphone.core.LinphoneCallStats;
import org.linphone.core.LinphoneChatMessage;
import org.linphone.core.LinphoneChatRoom;
import org.linphone.core.LinphoneContent;
import org.linphone.core.LinphoneCore;
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.LinphoneCoreFactory;
import org.linphone.core.LinphoneCoreListener;
import org.linphone.core.LinphoneEvent;
import org.linphone.core.LinphoneFriend;
import org.linphone.core.LinphoneInfoMessage;
import org.linphone.core.LinphoneProxyConfig;
import org.linphone.core.LinphoneCall.State;
import org.linphone.core.LinphoneCore.GlobalState;
import org.linphone.core.LinphoneCore.RegistrationState;
import org.linphone.core.SubscriptionState;
/**
......@@ -181,5 +184,19 @@ public class TutorialHelloWorld implements LinphoneCoreListener {
}
@Override
public void subscriptionStateChanged(LinphoneCore lc, LinphoneEvent ev,
SubscriptionState state) {
// TODO Auto-generated method stub
}
@Override
public void notifyReceived(LinphoneCore lc, LinphoneEvent ev,
String eventName, LinphoneContent content) {
// TODO Auto-generated method stub
}
}
......@@ -23,17 +23,20 @@ import org.linphone.core.LinphoneCall;
import org.linphone.core.LinphoneCallStats;
import org.linphone.core.LinphoneChatMessage;
import org.linphone.core.LinphoneChatRoom;
import org.linphone.core.LinphoneContent;
import org.linphone.core.LinphoneCore;
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.LinphoneCoreFactory;
import org.linphone.core.LinphoneCoreListener;
import org.linphone.core.LinphoneEvent;
import org.linphone.core.LinphoneFriend;
import org.linphone.core.LinphoneInfoMessage;
import org.linphone.core.LinphoneProxyConfig;
import org.linphone.core.LinphoneCall.State;
import org.linphone.core.LinphoneCore.GlobalState;
import org.linphone.core.LinphoneCore.RegistrationState;
import org.linphone.core.SubscriptionState;
/**
......@@ -212,6 +215,20 @@ public class TutorialRegistration implements LinphoneCoreListener {
}
@Override
public void subscriptionStateChanged(LinphoneCore lc, LinphoneEvent ev,
SubscriptionState state) {
// TODO Auto-generated method stub
}
@Override
public void notifyReceived(LinphoneCore lc, LinphoneEvent ev,
String eventName, LinphoneContent content) {
// TODO Auto-generated method stub
}
}
......@@ -1267,5 +1267,27 @@ public interface LinphoneCore {
*/
public LinphoneInfoMessage createInfoMessage();
/**
* Sends an outgoing subscription for a resource with given event, expiration period, and content.
* The state changes of the new subscriptions can be followed thanks to { @link LinphoneCoreListener.subscriptionStateChanged() } and
* { @link LinphoneCoreListener.notifyReceived }.
* @param resource the address of the resource for which the event needs to be monitored.
* @param event the event name, as specified in the event package RFC.
* @param expires the expiration period in seconds.
* @param content optional content of the subscription.
* @return a LinphoneEvent representing the subscription context.
*/
public LinphoneEvent subscribe(LinphoneAddress resource, String event, int expires, LinphoneContent content );
/**
* Publish an event.
* After the initial publication, updates can be done with { @link LinphoneEvent.updatePublish() }
* @param resource the resource to which the event belongs.
* @param event the event name as specified in the event package RFC.
* @param expires valid time for the event.
* @param content content of the publish.
* @return a LinphoneEvent representing the publish context.
*/
public LinphoneEvent publish(LinphoneAddress resource, String event, int expires, LinphoneContent content);
}
......@@ -132,6 +132,23 @@ public interface LinphoneCoreListener {
*/
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 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);
/**< @Deprecated Notifies the application that it should show up
* @return */
void show(LinphoneCore lc);
......
package org.linphone.core;
public interface LinphoneEvent {
/**
* Get the event name as standardized by the event package RFC.
* @return the event name.
*/
String getEventName();
/**
* Accept an incoming subscription. After it is accepted the application can immediately start to send notifications with
* {@link LinphoneEvent.notify() }.
*/
void acceptSubscription();
/**
* Reject an incoming subscription.
* @param reason reason code for rejection.
*/
void denySubscription(Reason reason);
/**
* Sends a NOTIFY request in the context of a LinphoneEvent created by an incoming subscription.
* @param content the data to be put in the notification.
*/
void notify(LinphoneContent content);
/**
* Update a subscription initiated previously with {@link LinphoneCore.subscribe() }
* @param content the data to be put in the subscribe request.
*/
void updateSubscribe(LinphoneContent content);
/**
* Update a Publish previously started with {@link LinphoneCore.publish() }.
* @param content the data to be put in the publish request.
*/
void updatePublish(LinphoneContent content);
/**
* Terminate an outgoing or incoming subscription, depending on the way the LinphoneEvent was created.
*/
void terminate();
/**
* In the event where an error would be returned or notified relatively to this LinphoneEvent, returns a reason error code.
* @return
*/
Reason getReason();
/**
* Assign an application context to the LinphoneEvent, for later use.
* @param obj
*/
void setUserContext(Object obj);
/**
* Retrieve application context previously set by setUserContext().
* @return
*/
Object getUserContext();
}
package org.linphone.core;
public enum SubscriptionDir {
Incoming,
Outgoing,
Invalid
}
package org.linphone.core;
public enum SubscriptionState {
/**
* Initial state, should not be used.
*/
LinphoneSubscriptionNone,
/**
* An outgoing subcription was created.
*/
LinphoneSubscriptionOutoingInit,
/**
* An incoming subcription is received.
*/
LinphoneSubscriptionIncomingReceived,
/**
* Subscription is pending, waiting for user approval
*/
LinphoneSubscriptionPending,
/**
* Subscription is accepted and now active.
*/
LinphoneSubscriptionActive,
/**
* Subscription is terminated normally
*/
LinphoneSubscriptionTerminated,
/**
* Subscription encountered an error, indicated by { @link LinphoneEvent.getReason() }
*/
LinphoneSubscriptionError
}
......@@ -954,4 +954,16 @@ class LinphoneCoreImpl implements LinphoneCore {
public LinphoneInfoMessage createInfoMessage() {
return new LinphoneInfoMessageImpl(createInfoMessage(nativePtr));
}
@Override
public LinphoneEvent subscribe(LinphoneAddress resource, String event,
int expires, LinphoneContent content) {
// TODO Auto-generated method stub
return null;
}
@Override
public LinphoneEvent publish(LinphoneAddress resource, String event,
int expires, LinphoneContent content) {
// TODO Auto-generated method stub
return null;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment