Package org.linphone.core
Interface PresenceModel
public interface PresenceModel
Presence model type holding information about the presence of a person.
-
Method Summary
Modifier and TypeMethodDescriptionintaddActivity(PresenceActivity activity) Adds an activity to a presence model.intAdds a note to a presence model.intaddPerson(PresencePerson person) Adds a person to a presence model.intaddService(PresenceService service) Adds a service to a presence model.intClears the activities of a presence model.intClears all the notes of a presence model.intClears the persons of a presence model.intClears the services of a presence model.Gets the first activity of a presence model (there is usually only one).Gets the basic status of a presence model.intGets the capabilities of aPresenceModelobject.floatgetCapabilityVersion(Friend.Capability capability) Returns the version of the capability of aPresenceModel.Get the consolidated presence from a presence model.Gets the contact of a presence model.longGets the latest activity timestamp of a presence model.longGets the native pointer used by this class to make native method calls.intGets the number of activities included in the presence model.intGets the number of persons included in the presence model.intGets the number of services included in the presence model.Gets the first note of a presence model (there is usually only one).getNthActivity(int index) Gets the nth activity of a presence model.getNthPerson(int index) Gets the nth person of a presence model.getNthService(int index) Gets the nth service of a presence model.Gets the presentity of a presence model.longGets the timestamp of a presence model.Gets the object stored in this object user's databooleanhasCapability(Friend.Capability capability) Returns whether or not thePresenceModelobject has a given capability.booleanhasCapabilityWithVersion(Friend.Capability capability, float version) Returns whether or not thePresenceModelobject has a given capability
with a certain version.booleanhasCapabilityWithVersionOrMore(Friend.Capability capability, float version) Returns whether or not thePresenceModelobject has a given capability
with a certain version or more.booleanisOnline()Tells whether a presence model is considered online.newWithActivity(PresenceActivity.Type activity, String description) Creates a presence model specifying an activity.newWithActivityAndNote(PresenceActivity.Type activity, String description, String note, String lang) Creates a presence model specifying an activity and adding a note.intsetActivity(PresenceActivity.Type activity, String description) Sets the activity of a presence model (limits to only one activity).intsetBasicStatus(PresenceBasicStatus basicStatus) Sets the basic status of a presence model.intsetContact(String contact) Sets the contact of a presence model.intsetPresentity(Address presentity) Sets the presentity of a presence model.voidsetUserData(Object data) Sets the object to store in this object user's datatoString()
-
Method Details
-
getActivity
Gets the first activity of a presence model (there is usually only one).
- Returns:
- A
PresenceActivityobject if successful, null otherwise.
-
getBasicStatus
PresenceBasicStatus getBasicStatus()Gets the basic status of a presence model.
- Returns:
- The
PresenceBasicStatusof thePresenceModelobject
given as parameter.
-
setBasicStatus
Sets the basic status of a presence model.
- Parameters:
basicStatus- ThePresenceBasicStatusto set for thePresenceModel
object.- Returns:
- 0 if successful, a value < 0 in case of error.
-
getCapabilities
int getCapabilities()- Returns:
- the capabilities.
-
getConsolidatedPresence
ConsolidatedPresence getConsolidatedPresence()Get the consolidated presence from a presence model.
- Returns:
- The
ConsolidatedPresencecorresponding to the presence model
-
getContact
Gets the contact of a presence model.
- Returns:
- A pointer to a dynamically allocated string containing the contact, or
null if no contact is found.
The returned string is to be freed by calling ms_free().
-
setContact
Sets the contact of a presence model.
- Parameters:
contact- The contact string to set.- Returns:
- 0 if successful, a value < 0 in case of error.
-
isOnline
boolean isOnline()Tells whether a presence model is considered online.
It is any of theses cases: -
getLatestActivityTimestamp
long getLatestActivityTimestamp()Gets the latest activity timestamp of a presence model.
- Returns:
- The activity timestamp of the
PresenceModelobject or -1 if
there is no activity (such as when status is Online).
-
getNbActivities
int getNbActivities()Gets the number of activities included in the presence model.
- Returns:
- The number of activities included in the
PresenceModelobject.
-
getNbPersons
int getNbPersons()Gets the number of persons included in the presence model.
- Returns:
- The number of persons included in the
PresenceModelobject.
-
getNbServices
int getNbServices()Gets the number of services included in the presence model.
- Returns:
- The number of services included in the
PresenceModelobject.
-
getPresentity
Gets the presentity of a presence model.
- Returns:
- A pointer to a const
Address, or null if no contact is found.
-
setPresentity
Sets the presentity of a presence model.
- Parameters:
presentity- The presentity address to set (presentity is copied).- Returns:
- 0 if successful, a value < 0 in case of error.
-
getTimestamp
long getTimestamp()Gets the timestamp of a presence model.
- Returns:
- The timestamp of the
PresenceModelobject or -1 on error.
-
addActivity
Adds an activity to a presence model.
- Parameters:
activity- ThePresenceActivityobject to add to the model.- Returns:
- 0 if successful, a value < 0 in case of error.
-
addNote
Adds a note to a presence model.
- Parameters:
noteContent- The note to be added to the presence model.lang- The language of the note to be added. Can be null if no language is
to be specified for the note.- Returns:
- 0 if successful, a value < 0 in case of error.
Only one note for each language can be set, so e.g. setting a note for the 'fr'
language if there is only one will replace the existing one.
-
addPerson
Adds a person to a presence model.
- Parameters:
person- ThePresencePersonobject to add to the model.- Returns:
- 0 if successful, a value < 0 in case of error.
-
addService
Adds a service to a presence model.
- Parameters:
service- ThePresenceServiceobject to add to the model.- Returns:
- 0 if successful, a value < 0 in case of error.
-
clearActivities
int clearActivities()Clears the activities of a presence model.
- Returns:
- 0 if successful, a value < 0 in case of error.
-
clearNotes
int clearNotes()Clears all the notes of a presence model.
- Returns:
- 0 if successful, a value < 0 in case of error.
-
clearPersons
int clearPersons()Clears the persons of a presence model.
- Returns:
- 0 if successful, a value < 0 in case of error.
-
clearServices
int clearServices()Clears the services of a presence model.
- Returns:
- 0 if successful, a value < 0 in case of error.
-
getCapabilityVersion
- Parameters:
capability- TheFriend#Capabilityto test.- Returns:
- the version of the capability of a
PresenceModelor -1.0 if the
model has not the capability.
-
getNote
Gets the first note of a presence model (there is usually only one).
- Parameters:
lang- The language of the note to get. Can be null to get a note that has
no language specified or to get the first note whatever language it is written
into.- Returns:
- A pointer to a
PresenceNoteobject if successful, null
otherwise.
-
getNthActivity
Gets the nth activity of a presence model.
- Parameters:
index- The index of the activity to get (the first activity having the
index 0).- Returns:
- A pointer to a
PresenceActivityobject if successful, null
otherwise.
-
getNthPerson
Gets the nth person of a presence model.
- Parameters:
index- The index of the person to get (the first person having the index
0).- Returns:
- A pointer to a
PresencePersonobject if successful, null
otherwise.
-
getNthService
Gets the nth service of a presence model.
- Parameters:
index- The index of the service to get (the first service having the
index 0).- Returns:
- A pointer to a
PresenceServiceobject if successful, null
otherwise.
-
hasCapability
- Parameters:
capability- The capability to test.- Returns:
- whether or not the
PresenceModelobject has a given capability.
-
hasCapabilityWithVersion
- Parameters:
capability- TheFriend#Capabilityto test.version- The wanted version to test.- Returns:
- whether or not the
PresenceModelobject has a given capability
with a certain version.
-
hasCapabilityWithVersionOrMore
Returns whether or not thePresenceModelobject has a given capability
with a certain version or more.
- Parameters:
capability- TheFriend#Capabilityto test.version- The wanted version to test.- Returns:
- whether or not the
PresenceModelobject has a given capability
with a certain version or more.
-
setActivity
Sets the activity of a presence model (limits to only one activity).
- Parameters:
activity- ThePresenceActivity#Typeto set for the model.description- An additional description of the activity to set for the
model. Can be null if no additional description is to be added.- Returns:
- 0 if successful, a value < 0 in case of error.
WARNING: This function will modify the basic status of the model according to
the activity being set. If you don't want the basic status to be modified
automatically, you can use the combination ofsetBasicStatus(org.linphone.core.PresenceBasicStatus),clearActivities()
andaddActivity(org.linphone.core.PresenceActivity).
-
newWithActivity
@Nullable PresenceModel newWithActivity(PresenceActivity.Type activity, @Nullable String description) Creates a presence model specifying an activity.
- Parameters:
activity- ThePresenceActivity#Typeto set for the created
presence model.description- An additional description of the activity (mainly useful for
the 'other' activity). Set it to null to not add a description.- Returns:
- The created
PresenceModel, or null if an error occured.
see: linphone_presence_model_new,newWithActivityAndNote(org.linphone.core.PresenceActivity.Type, java.lang.String, java.lang.String, java.lang.String)
The created presence model has the activity specified in the parameters.
-
newWithActivityAndNote
@Nullable PresenceModel newWithActivityAndNote(PresenceActivity.Type activity, @Nullable String description, @NonNull String note, @Nullable String lang) Creates a presence model specifying an activity and adding a note.
- Parameters:
activity- ThePresenceActivity#Typeto set for the created
presence model.description- An additional description of the activity (mainly useful for
the 'other' activity). Set it to null to not add a description.note- An additional note giving additional information about the contact
presence.lang- The language the note is written in. It can be set to null in order
to not specify the language of the note.- Returns:
- The created
PresenceModel, or null if an error occured.
see:newWithActivity(org.linphone.core.PresenceActivity.Type, java.lang.String),newWithActivityAndNote(org.linphone.core.PresenceActivity.Type, java.lang.String, java.lang.String, java.lang.String)
The created presence model has the activity and the note specified in the
parameters.
-
setUserData
Sets the object to store in this object user's data- Parameters:
data- the object to store
-
getUserData
Object getUserData()Gets the object stored in this object user's data- Returns:
- the object store if any, null otherwise
-
getNativePointer
long getNativePointer()Gets the native pointer used by this class to make native method calls.- Returns:
- the nativer pointer, as long
-
toString
String toString()
-