OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 2017 The WebRTC project authors. All Rights Reserved. | |
3 * | |
4 * Use of this source code is governed by a BSD-style license | |
5 * that can be found in the LICENSE file in the root of the source | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 | |
11 #include <jni.h> | |
12 #undef JNIEXPORT | |
13 #define JNIEXPORT __attribute__((visibility("default"))) | |
14 #include <string> | |
15 | |
16 #include "webrtc/tools/network_tester/test_controller.h" | |
17 | |
18 extern "C" JNIEXPORT jlong JNICALL | |
19 Java_com_google_media_networktester_NetworkTester_CreateTestController( | |
20 JNIEnv* jni, | |
21 jclass) { | |
22 return reinterpret_cast<intptr_t>(new webrtc::TestController( | |
23 0, 0, "/mnt/sdcard/network_tester_client_config.dat", | |
24 "/mnt/sdcard/network_tester_client_packet_log.dat")); | |
25 } | |
26 | |
27 extern "C" JNIEXPORT void JNICALL | |
28 Java_com_google_media_networktester_NetworkTester_TestControllerConnect( | |
29 JNIEnv* jni, | |
30 jclass, | |
31 jlong native_pointer) { | |
32 reinterpret_cast<webrtc::TestController*>(native_pointer) | |
33 ->SendConnectTo("85.195.237.107", 9090); | |
34 } | |
35 | |
36 extern "C" JNIEXPORT bool JNICALL | |
37 Java_com_google_media_networktester_NetworkTester_TestControllerIsDone( | |
38 JNIEnv* jni, | |
39 jclass, | |
40 jlong native_pointer) { | |
41 return reinterpret_cast<webrtc::TestController*>(native_pointer) | |
42 ->IsTestDone(); | |
43 } | |
44 | |
45 extern "C" JNIEXPORT void JNICALL | |
46 Java_com_google_media_networktester_NetworkTester_TestControllerRun( | |
47 JNIEnv* jni, | |
48 jclass, | |
49 jlong native_pointer) { | |
50 reinterpret_cast<webrtc::TestController*>(native_pointer)->Run(); | |
51 } | |
52 | |
53 extern "C" JNIEXPORT void JNICALL | |
54 Java_com_google_media_networktester_NetworkTester_DestroyTestController( | |
55 JNIEnv* jni, | |
56 jclass, | |
57 jlong native_pointer) { | |
58 webrtc::TestController* test_controller = | |
59 reinterpret_cast<webrtc::TestController*>(native_pointer); | |
60 if (test_controller) { | |
61 delete test_controller; | |
62 } | |
63 } | |
OLD | NEW |