Changeset 4576
- Timestamp:
- Jul 26, 2013 2:20:15 PM (11 years ago)
- Location:
- pjproject/branches/projects/jni/pjsip-apps/src/jni
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/jni/pjsip-apps/src/jni/Makefile
r4575 r4576 83 83 $(MY_JAVAC) -d $(MY_PACKAGE_BIN) -classpath "$(MY_PACKAGE_BIN)" $(TEST_SRC)/hello.java 84 84 85 test: $(MY_PACKAGE_BIN)/hello.class85 test: 86 86 @# Need to specify classpath and library path, alternatively, they can be set via 87 87 @# CLASSPATH and java.library.path env settings 88 $(MY_JAVA) -cp $(MY_PACKAGE_BIN) -Djava.library.path="$(MY_PACKAGE_BIN)" hello88 $(MY_JAVA) -cp $(MY_PACKAGE_BIN) -Djava.library.path="$(MY_PACKAGE_BIN)" $(TEST_PACKAGE).hello -
pjproject/branches/projects/jni/pjsip-apps/src/jni/jni/header.i
r4570 r4576 77 77 MY_JAVA_MEMBER_ARRAY_OF_POINTER(pjmedia_sdp_media, pjmedia_sdp_bandw, bandw, bandw_count) 78 78 MY_JAVA_MEMBER_ARRAY_OF_POINTER(pjmedia_sdp_media, pjmedia_sdp_attr, attr, attr_count) 79 MY_JAVA_MEMBER_ARRAY_OF_POINTER(pjsua_acc_config, pjsip_cred_info, cred_info, cred_count) 79 80 80 81 %include "../callbacks.i" -
pjproject/branches/projects/jni/pjsip-apps/src/jni/jni/my_typemaps.i
r4570 r4576 279 279 280 280 %ignore CLASS_NAME::COUNT_NAME; 281 %typemap(jni) TYPE* NAME[ANY] "jlongArray"282 %typemap(jtype) TYPE* NAME[ANY] "long[]"283 %typemap(jstype) TYPE* NAME[ANY] "TYPE[]"284 %typemap(javain) TYPE* NAME[ANY] "TYPE.cArrayUnwrap($javainput)"285 %typemap(javaout) TYPE* NAME[ANY] {return TYPE.cArrayWrap($jnicall, $owner);}281 %typemap(jni) TYPE* NAME[ANY], TYPE NAME[ANY] "jlongArray" 282 %typemap(jtype) TYPE* NAME[ANY], TYPE NAME[ANY] "long[]" 283 %typemap(jstype) TYPE* NAME[ANY], TYPE NAME[ANY] "TYPE[]" 284 %typemap(javain) TYPE* NAME[ANY], TYPE NAME[ANY] "TYPE.cArrayUnwrap($javainput)" 285 %typemap(javaout) TYPE* NAME[ANY], TYPE NAME[ANY] {return TYPE.cArrayWrap($jnicall, $owner);} 286 286 287 287 %typemap(in) TYPE* NAME[ANY] (jlong *jarr) %{ … … 291 291 %} 292 292 293 %typemap(freearg) TYPE* NAME[ANY] %{ if ($1) delete [] $1; %} 293 %typemap(in) TYPE NAME[ANY] (jlong *jarr) %{ 294 if (!SWIG_JavaArrayInUlong(jenv, &jarr, (unsigned long**)&$1, $input)) 295 return $null; 296 arg1->COUNT_NAME = jenv->GetArrayLength($input); 297 %} 298 299 %typemap(freearg) TYPE* NAME[ANY], TYPE NAME[ANY] %{ if ($1) delete [] $1; %} 294 300 295 301 %typemap(memberin) TYPE* NAME[ANY] %{ … … 297 303 %} 298 304 299 %typemap(out) TYPE* NAME[ANY] %{ 305 %typemap(memberin) TYPE NAME[ANY] %{ 306 for (size_t i = 0; i < (size_t)arg1->COUNT_NAME; i++) $1[i] = **(TYPE**)(&$input[i]); 307 %} 308 309 %typemap(out) TYPE* NAME[ANY], TYPE NAME[ANY] %{ 300 310 $result = SWIG_JavaArrayOutUlong(jenv, (unsigned long*)$1, arg1->COUNT_NAME); 301 311 %} -
pjproject/branches/projects/jni/pjsip-apps/src/jni/jni/output
-
Property
svn:ignore
set to
pjsua_wrap*.*
pjsua.i.tmp
-
Property
svn:ignore
set to
-
pjproject/branches/projects/jni/pjsip-apps/src/jni/jni/output/pjsua.i
r4575 r4576 77 77 MY_JAVA_MEMBER_ARRAY_OF_POINTER(pjmedia_sdp_media, pjmedia_sdp_bandw, bandw, bandw_count) 78 78 MY_JAVA_MEMBER_ARRAY_OF_POINTER(pjmedia_sdp_media, pjmedia_sdp_attr, attr, attr_count) 79 MY_JAVA_MEMBER_ARRAY_OF_POINTER(pjsua_acc_config, pjsip_cred_info, cred_info, cred_count) 79 80 80 81 %include "../callbacks.i" -
pjproject/branches/projects/jni/pjsip-apps/src/jni/src/org/pjsip/hello/hello.java
r4575 r4576 12 12 public static int cur_call_id = -1; 13 13 public static int cur_acc_id = -1; 14 15 public static int sip_port = 6000; 16 17 public static boolean is_reg = true; 18 public static String user = "301"; 19 public static String pwd = "pw301"; 20 public static String domain = "pjsip.org"; 21 public static String proxy[] = { "sip:sip.pjsip.org;transport=tcp" }; 14 22 } 15 23 … … 124 132 pjsua_transport_config cfg = new pjsua_transport_config(); 125 133 pjsua.transport_config_default(cfg); 126 cfg.setPort( 6000);134 cfg.setPort(app_config.sip_port); 127 135 status = pjsua.transport_create(pjsip_transport_type_e.PJSIP_TRANSPORT_UDP, cfg, tp_id); 128 136 if (status != pjsua.PJ_SUCCESS) { … … 132 140 } 133 141 134 /* Add local account */142 /* Add UDP local account */ 135 143 { 136 144 status = pjsua.acc_add_local(tp_id[0], true, acc_id); … … 140 148 } 141 149 app_config.cur_acc_id = acc_id[0]; 150 } 151 152 /* Add SIP TCP transport */ 153 { 154 pjsua_transport_config cfg = new pjsua_transport_config(); 155 pjsua.transport_config_default(cfg); 156 cfg.setPort(app_config.sip_port); 157 status = pjsua.transport_create(pjsip_transport_type_e.PJSIP_TRANSPORT_TCP, cfg, tp_id); 158 if (status != pjsua.PJ_SUCCESS) { 159 System.out.println("Error creating transport: " + status); 160 return status; 161 } 162 } 163 164 /* Add TCP local account */ 165 { 166 status = pjsua.acc_add_local(tp_id[0], true, acc_id); 167 if (status != pjsua.PJ_SUCCESS) { 168 System.out.println("Error creating local UDP account: " + status); 169 return status; 170 } 171 app_config.cur_acc_id = acc_id[0]; 172 } 173 174 /* Add registered account */ 175 if (app_config.is_reg) { 176 pjsip_cred_info [] cred_info = { new pjsip_cred_info() }; 177 cred_info[0].setUsername(app_config.user); 178 cred_info[0].setData_type(0); 179 cred_info[0].setData(app_config.pwd); 180 cred_info[0].setRealm("*"); 181 cred_info[0].setScheme("Digest"); 182 183 pjsua_acc_config acc_cfg = new pjsua_acc_config(); 184 pjsua.acc_config_default(acc_cfg); 185 acc_cfg.setId("sip:" + app_config.user + "@" + app_config.domain); 186 acc_cfg.setCred_info(cred_info); 187 acc_cfg.setReg_uri("sip:" + app_config.domain); 188 acc_cfg.setProxy(app_config.proxy); 189 190 status = pjsua.acc_add(acc_cfg, true, acc_id); 191 if (status != pjsua.PJ_SUCCESS) { 192 System.out.println("Error creating account " + acc_cfg.getId() + ": " + status); 193 return status; 194 } 195 app_config.cur_acc_id = acc_id[0]; 142 196 } 143 197
Note: See TracChangeset
for help on using the changeset viewer.