]> sjero.net Git - linphone/blob - LinphoneFriendImpl.java
fix for silk 24khz on Galaxy S
[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 class LinphoneFriendImpl implements LinphoneFriend {
22         protected final long nativePtr;
23         private native long newLinphoneFriend(String friendUri);
24         private native void setAddress(long nativePtr,long friend);
25         private native long getAddress(long nativePtr);
26         private native void setIncSubscribePolicy(long nativePtr,int enumValue);
27         private native int  getIncSubscribePolicy(long nativePtr);
28         private native void enableSubscribes(long nativePtr,boolean value);
29         private native boolean isSubscribesEnabled(long nativePtr);
30         private native int getStatus(long nativePtr);
31         private native void edit(long nativePtr);
32         private native void done(long nativePtr);
33         
34         private native void  delete(long ptr);
35         boolean ownPtr = false;
36         protected LinphoneFriendImpl()  {
37                 nativePtr = newLinphoneFriend(null);
38         }       
39         protected LinphoneFriendImpl(String friendUri)  {
40                 nativePtr = newLinphoneFriend(friendUri);
41         }
42         protected LinphoneFriendImpl(long aNativePtr)  {
43                 nativePtr = aNativePtr;
44                 ownPtr=false;
45         }
46         protected void finalize() throws Throwable {
47                 if (ownPtr) delete(nativePtr);
48         }
49         public void setAddress(LinphoneAddress anAddress) {
50                 this.setAddress(nativePtr, ((LinphoneAddressImpl)anAddress).nativePtr);
51                 
52         }
53         public LinphoneAddress getAddress() {
54                 return new LinphoneAddressImpl(getAddress(nativePtr));
55         }
56         public void setIncSubscribePolicy(SubscribePolicy policy) {
57                 setIncSubscribePolicy(nativePtr,policy.mValue);
58                 
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
70         public OnlineStatus getStatus() {
71                 return OnlineStatus.fromInt(getStatus(nativePtr));
72         }
73         public void edit() {
74                 edit(nativePtr);
75         }
76         public void done() {
77                 done(nativePtr);
78         }
79
80 }