1 /* 2 PresenceServiceImpl.java 3 Copyright (C) 2010-2013 Belledonne Communications, Grenoble, France 4 5 This program is free software; you can redistribute it and/or 6 modify it under the terms of the GNU General Public License 7 as published by the Free Software Foundation; either version 2 8 of the License, or (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program; if not, write to the Free Software 17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 */ 19 20 package org.linphone.core; 21 22 public class PresenceServiceImpl implements PresenceService { 23 private long mNativePtr; 24 PresenceServiceImpl(long nativePtr)25 protected PresenceServiceImpl(long nativePtr) { 26 mNativePtr = nativePtr; 27 } 28 newPresenceServiceImpl(String id, int status, String contact)29 private native long newPresenceServiceImpl(String id, int status, String contact); PresenceServiceImpl(String id, PresenceBasicStatus status, String contact)30 protected PresenceServiceImpl(String id, PresenceBasicStatus status, String contact) { 31 mNativePtr = newPresenceServiceImpl(id, status.toInt(), contact); 32 } 33 unref(long nativePtr)34 private native void unref(long nativePtr); finalize()35 protected void finalize() { 36 unref(mNativePtr); 37 } 38 getId(long nativePtr)39 private native String getId(long nativePtr); 40 @Override getId()41 public String getId() { 42 return getId(mNativePtr); 43 } 44 setId(long nativePtr, String id)45 private native int setId(long nativePtr, String id); 46 @Override setId(String id)47 public int setId(String id) { 48 return setId(mNativePtr, id); 49 } 50 getBasicStatus(long nativePtr)51 private native int getBasicStatus(long nativePtr); 52 @Override getBasicStatus()53 public PresenceBasicStatus getBasicStatus() { 54 return PresenceBasicStatus.fromInt(getBasicStatus(mNativePtr)); 55 } 56 setBasicStatus(long nativePtr, int status)57 private native int setBasicStatus(long nativePtr, int status); 58 @Override setBasicStatus(PresenceBasicStatus status)59 public int setBasicStatus(PresenceBasicStatus status) { 60 return setBasicStatus(mNativePtr, status.toInt()); 61 } 62 getContact(long nativePtr)63 private native String getContact(long nativePtr); 64 @Override getContact()65 public String getContact() { 66 return getContact(mNativePtr); 67 } 68 setContact(long nativePtr, String contact)69 private native int setContact(long nativePtr, String contact); 70 @Override setContact(String contact)71 public int setContact(String contact) { 72 return setContact(mNativePtr, contact); 73 } 74 getNbNotes(long nativePtr)75 private native long getNbNotes(long nativePtr); 76 @Override getNbNotes()77 public long getNbNotes() { 78 return getNbNotes(mNativePtr); 79 } 80 getNthNote(long nativePtr, long idx)81 private native Object getNthNote(long nativePtr, long idx); 82 @Override getNthNote(long idx)83 public PresenceNote getNthNote(long idx) { 84 return (PresenceNote)getNthNote(mNativePtr, idx); 85 } 86 addNote(long nativePtr, long notePtr)87 private native int addNote(long nativePtr, long notePtr); 88 @Override addNote(PresenceNote note)89 public int addNote(PresenceNote note) { 90 return addNote(mNativePtr, note.getNativePtr()); 91 } 92 clearNotes(long nativePtr)93 private native int clearNotes(long nativePtr); 94 @Override clearNotes()95 public int clearNotes() { 96 return clearNotes(mNativePtr); 97 } 98 getNativePtr()99 public long getNativePtr() { 100 return mNativePtr; 101 } 102 } 103