]> sjero.net Git - linphone/blob - LinphoneProxyConfigImpl.java
Bigger contacts in contacts list + friend presence started
[linphone] / LinphoneProxyConfigImpl.java
1 /*
2 LinphoneProxyConfigImpl.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 org.linphone.core.LinphoneCore.RegistrationState;
22
23
24
25
26
27 class LinphoneProxyConfigImpl implements LinphoneProxyConfig {
28
29         protected final long nativePtr;
30         
31         private native int getState(long nativePtr);
32         private native void setExpires(long nativePtr, int delay);
33
34         boolean ownPtr = false;
35         protected LinphoneProxyConfigImpl(String identity,String proxy,String route, boolean enableRegister) throws LinphoneCoreException {
36                 nativePtr = newLinphoneProxyConfig();
37                 setIdentity(identity);
38                 setProxy(proxy);
39                 enableRegister(enableRegister);
40                 ownPtr=true;
41         }
42         protected LinphoneProxyConfigImpl(long aNativePtr)  {
43                 nativePtr = aNativePtr;
44                 ownPtr=false;
45         }
46         protected void finalize() throws Throwable {
47                 //Log.e(LinphoneService.TAG,"fixme, should release underlying proxy config");
48                 if (ownPtr) delete(nativePtr);
49         }
50         private native long newLinphoneProxyConfig();
51         private native void  delete(long ptr);
52
53         private native void edit(long ptr);
54         private native void done(long ptr);
55         
56         private native void setIdentity(long ptr,String identity);
57         private native String getIdentity(long ptr);
58         private native int setProxy(long ptr,String proxy);
59         private native String getProxy(long ptr);
60         
61
62         private native void enableRegister(long ptr,boolean value);
63         private native boolean isRegisterEnabled(long ptr);
64         
65         private native boolean isRegistered(long ptr);
66         private native void setDialPrefix(long ptr, String prefix);
67         
68         private native String normalizePhoneNumber(long ptr,String number);
69         
70         private native String getDomain(long ptr);
71         
72         private native void setDialEscapePlus(long ptr, boolean value);
73         
74         private native String getRoute(long ptr);
75         private native int setRoute(long ptr,String uri);
76         private native void enablePublish(long ptr,boolean enable);
77         private native boolean publishEnabled(long ptr);
78         private native void setContactParameters(long ptr, String params);
79         
80         private native int lookupCCCFromIso(long nativePtr, String iso);
81         
82         public void enableRegister(boolean value) {
83                 enableRegister(nativePtr,value);
84         }
85
86         public void done() {
87                 done(nativePtr);
88         }
89
90         public void edit() {
91                 edit(nativePtr);
92         }
93
94         public void setIdentity(String identity) throws LinphoneCoreException {
95                 setIdentity(nativePtr,identity);
96         }
97
98         public void setProxy(String proxyUri) throws LinphoneCoreException {
99                 if (setProxy(nativePtr,proxyUri)!=0) {
100                         throw new LinphoneCoreException("Bad proxy address ["+proxyUri+"]");
101                 }
102         }
103         public String normalizePhoneNumber(String number) {
104                 return normalizePhoneNumber(nativePtr,number);
105         }
106         public void setDialPrefix(String prefix) {
107                 setDialPrefix(nativePtr, prefix);
108         }
109         public String getDomain() {
110                 return getDomain(nativePtr);
111         }
112         public void setDialEscapePlus(boolean value) {
113                  setDialEscapePlus(nativePtr,value);
114         }
115         public String getIdentity() {
116                 return getIdentity(nativePtr);
117         }
118         public String getProxy() {
119                 return getProxy(nativePtr);
120         }
121         public boolean isRegistered() {
122                 return isRegistered(nativePtr);
123         }
124         public boolean registerEnabled() {
125                 return isRegisterEnabled(nativePtr);
126         }
127         public String getRoute() {
128                 return getRoute(nativePtr);
129         }
130         public void setRoute(String routeUri) throws LinphoneCoreException {
131                 if (setRoute(nativePtr, routeUri) != 0) {
132                         throw new LinphoneCoreException("cannot set route ["+routeUri+"]");
133                 }
134         }
135         public void enablePublish(boolean enable) {
136                 enablePublish(nativePtr,enable);
137         }
138         public RegistrationState getState() {
139                 return RegistrationState.fromInt(getState(nativePtr));
140         }
141
142         public void setExpires(int delay) {
143                 setExpires(nativePtr, delay);
144         }
145         public boolean publishEnabled() {
146                 return publishEnabled(nativePtr); 
147         }
148         @Override
149         public void setContactParameters(String params) {
150                 setContactParameters(nativePtr, params);
151         }
152         @Override
153         public int lookupCCCFromIso(String iso) {
154                 return lookupCCCFromIso(nativePtr, iso);
155         }
156 }