Package org.linphone.core
Interface PresenceModel
public interface PresenceModel
Presence model type holding information about the presence of a person.
-
Method Summary
Modifier and TypeMethodDescriptionint
addActivity
(PresenceActivity activity) Adds an activity to a presence model.int
Adds a note to a presence model.int
addPerson
(PresencePerson person) Adds a person to a presence model.int
addService
(PresenceService service) Adds a service to a presence model.int
Clears the activities of a presence model.int
Clears all the notes of a presence model.int
Clears the persons of a presence model.int
Clears 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.int
Gets the capabilities of aPresenceModel
object.float
getCapabilityVersion
(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.long
Gets the latest activity timestamp of a presence model.long
Gets the native pointer used by this class to make native method calls.int
Gets the number of activities included in the presence model.int
Gets the number of persons included in the presence model.int
Gets 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.long
Gets the timestamp of a presence model.Gets the object stored in this object user's databoolean
hasCapability
(Friend.Capability capability) Returns whether or not thePresenceModel
object has a given capability.boolean
hasCapabilityWithVersion
(Friend.Capability capability, float version) Returns whether or not thePresenceModel
object has a given capability
with a certain version.boolean
hasCapabilityWithVersionOrMore
(Friend.Capability capability, float version) Returns whether or not thePresenceModel
object has a given capability
with a certain version or more.boolean
isOnline()
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.int
setActivity
(PresenceActivity.Type activity, String description) Sets the activity of a presence model (limits to only one activity).int
setBasicStatus
(PresenceBasicStatus basicStatus) Sets the basic status of a presence model.int
setContact
(String contact) Sets the contact of a presence model.int
setPresentity
(Address presentity) Sets the presentity of a presence model.void
setUserData
(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
PresenceActivity
object if successful, null otherwise.
-
getBasicStatus
PresenceBasicStatus getBasicStatus()Gets the basic status of a presence model.
- Returns:
- The
PresenceBasicStatus
of thePresenceModel
object
given as parameter.
-
setBasicStatus
Sets the basic status of a presence model.
- Parameters:
basicStatus
- ThePresenceBasicStatus
to 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
ConsolidatedPresence
corresponding 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
PresenceModel
object 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
PresenceModel
object.
-
getNbPersons
int getNbPersons()Gets the number of persons included in the presence model.
- Returns:
- The number of persons included in the
PresenceModel
object.
-
getNbServices
int getNbServices()Gets the number of services included in the presence model.
- Returns:
- The number of services included in the
PresenceModel
object.
-
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
PresenceModel
object or -1 on error.
-
addActivity
Adds an activity to a presence model.
- Parameters:
activity
- ThePresenceActivity
object 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
- ThePresencePerson
object 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
- ThePresenceService
object 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#Capability
to test.- Returns:
- the version of the capability of a
PresenceModel
or -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
PresenceNote
object 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
PresenceActivity
object 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
PresencePerson
object 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
PresenceService
object if successful, null
otherwise.
-
hasCapability
- Parameters:
capability
- The capability to test.- Returns:
- whether or not the
PresenceModel
object has a given capability.
-
hasCapabilityWithVersion
- Parameters:
capability
- TheFriend#Capability
to test.version
- The wanted version to test.- Returns:
- whether or not the
PresenceModel
object has a given capability
with a certain version.
-
hasCapabilityWithVersionOrMore
Returns whether or not thePresenceModel
object has a given capability
with a certain version or more.
- Parameters:
capability
- TheFriend#Capability
to test.version
- The wanted version to test.- Returns:
- whether or not the
PresenceModel
object 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#Type
to 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#Type
to 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#Type
to 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()
-