forked from roc-streaming/roc-droid
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring and fixes in android bridge (roc-streaming#98)
- Loading branch information
Showing
14 changed files
with
296 additions
and
284 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
android/app/src/main/kotlin/org/rocstreaming/connector/AndroidConnectorImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package org.rocstreaming.connector | ||
|
||
import AndroidConnector | ||
import android.util.Log | ||
import org.rocstreaming.service.SenderReceiverService | ||
|
||
private const val LOG_TAG = "[rocdroid.Connector]" | ||
|
||
class AndroidConnectorImpl : AndroidConnector { | ||
//private var senderReceiverService: SenderReceiverService = SenderReceiverService() | ||
|
||
override fun startReceiver() { | ||
Log.d(LOG_TAG, "Start Receiver") | ||
//senderReceiverService.startReceiver() | ||
} | ||
|
||
override fun stopReceiver() { | ||
Log.d(LOG_TAG, "Stop Receiver") | ||
//senderReceiverService.stopReceiver() | ||
} | ||
|
||
override fun isReceiverAlive(): Boolean { | ||
//return senderReceiverService.isReceiverAlive() | ||
return true | ||
} | ||
|
||
override fun startSender(ip: String) { | ||
Log.d(LOG_TAG, "Start Sender") | ||
//senderReceiverService.startSender(ip, null) | ||
} | ||
|
||
override fun stopSender() { | ||
Log.d(LOG_TAG, "Stop Sender") | ||
//senderReceiverService.stopSender() | ||
} | ||
|
||
override fun isSenderAlive(): Boolean { | ||
//return senderReceiverService.isSenderAlive() | ||
return true | ||
} | ||
} |
36 changes: 0 additions & 36 deletions
36
android/app/src/main/kotlin/org/rocstreaming/connector/Connector.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,37 @@ | ||
import 'backend.g.dart'; | ||
import 'android_connector.g.dart'; | ||
import 'backend.dart'; | ||
|
||
/// ???. | ||
class AndroidBackend implements Backend { | ||
final Backend _backend = Backend(); | ||
final AndroidConnector _connector = AndroidConnector(); | ||
|
||
@override | ||
Future<bool> isReceiverAlive() async { | ||
return await _backend.isReceiverAlive(); | ||
Future<void> startReceiver() async { | ||
await _connector.startReceiver(); | ||
} | ||
|
||
@override | ||
Future<bool> isSenderAlive() async { | ||
return await _backend.isSenderAlive(); | ||
Future<void> stopReceiver() async { | ||
await _connector.stopReceiver(); | ||
} | ||
|
||
@override | ||
Future<void> startReceiver() async { | ||
await _backend.startReceiver(); | ||
Future<bool> isReceiverAlive() async { | ||
return await _connector.isReceiverAlive(); | ||
} | ||
|
||
@override | ||
Future<void> startSender(String ip) async { | ||
await _backend.startSender(ip); | ||
await _connector.startSender(ip); | ||
} | ||
|
||
@override | ||
Future<void> stopReceiver() async { | ||
await _backend.stopReceiver(); | ||
Future<void> stopSender() async { | ||
await _connector.stopSender(); | ||
} | ||
|
||
@override | ||
Future<void> stopSender() async { | ||
await _backend.stopSender(); | ||
Future<bool> isSenderAlive() async { | ||
return await _connector.isSenderAlive(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import 'package:pigeon/pigeon.dart'; | ||
|
||
@ConfigurePigeon(PigeonOptions( | ||
dartOut: 'lib/src/agent/android_connector.g.dart', | ||
dartOptions: DartOptions(), | ||
kotlinOut: | ||
'android/app/src/main/kotlin/org/rocstreaming/connector/AndroidConnector.g.kt', | ||
kotlinOptions: KotlinOptions(), | ||
dartPackageName: 'roc_droid', | ||
)) | ||
|
||
/// ???. | ||
@HostApi() | ||
abstract class AndroidConnector { | ||
void startReceiver(); | ||
|
||
void stopReceiver(); | ||
|
||
bool isReceiverAlive(); | ||
|
||
void startSender(String ip); | ||
|
||
void stopSender(); | ||
|
||
bool isSenderAlive(); | ||
} | ||
|
||
// /// ???. | ||
// @FlutterApi() | ||
// abstract class FlutterHandler { | ||
// void textChanged(String text); | ||
// } |
Oops, something went wrong.