]> sjero.net Git - linphone/blob - LinphoneFriendImpl.java
Fix function definition.
[linphone] / LinphoneFriendImpl.java
1 /*
2 LinphoneFriendImpl.java
3 Copyright (C) 2010  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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18 */
19 package org.linphone.core;
20
21 import java.io.Serializable;
22
23 class LinphoneFriendImpl implements LinphoneFriend, Serializable {
24         protected final long nativePtr;
25         private native long newLinphoneFriend(String friendUri);
26         private native void setAddress(long nativePtr,long friend);
27         private native long getAddress(long nativePtr);
28         private native void setIncSubscribePolicy(long nativePtr,int enumValue);
29         private native int  getIncSubscribePolicy(long nativePtr);
30         private native void enableSubscribes(long nativePtr,boolean value);
31         private native boolean isSubscribesEnabled(long nativePtr);
32         private native int getStatus(long nativePtr);
33         private native void edit(long nativePtr);
34         private native void done(long nativePtr);
35         
36         private native void  delete(long ptr);
37         boolean ownPtr = false;
38         protected LinphoneFriendImpl()  {
39                 nativePtr = newLinphoneFriend(null);
40         }       
41         protected LinphoneFriendImpl(String friendUri)  {
42                 nativePtr = newLinphoneFriend(friendUri);
43         }
44         protected LinphoneFriendImpl(long aNativePtr)  {
45                 nativePtr = aNativePtr;
46                 ownPtr=false;
47         }
48         protected void finalize() throws Throwable {
49                 if (ownPtr) delete(nativePtr);
50         }
51         public void setAddress(LinphoneAddress anAddress) {
52                 this.setAddress(nativePtr, ((LinphoneAddressImpl)anAddress).nativePtr);
53         }
54         public LinphoneAddress getAddress() {
55                 return new LinphoneAddressImpl(getAddress(nativePtr));
56         }
57         public void setIncSubscribePolicy(SubscribePolicy policy) {
58                 setIncSubscribePolicy(nativePtr,policy.mValue);
59         }
60         public SubscribePolicy getIncSubscribePolicy() {
61                 return SubscribePolicy.fromInt(getIncSubscribePolicy(nativePtr)) ;
62         }
63         public void enableSubscribes(boolean enable) {
64                 enableSubscribes(nativePtr, enable);
65         }
66         public boolean isSubscribesEnabled() {
67                 return isSubscribesEnabled(nativePtr);
68         }
69         public OnlineStatus getStatus() {
70                 return OnlineStatus.fromInt(getStatus(nativePtr));
71         }
72         public void edit() {
73                 edit(nativePtr);
74         }
75         public void done() {
76                 done(nativePtr);
77         }
78         public long getNativePtr() {
79                 return nativePtr;
80         }
81 }