Skip to content

Commit

Permalink
Add usb-serial network interface skeleton-code and update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
junghyun397 committed Feb 9, 2020
1 parent da0e10e commit 45fc742
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 7 deletions.
5 changes: 3 additions & 2 deletions README.md
Expand Up @@ -9,18 +9,19 @@
# Main Features

- Supports **all games** that support joystick input
- Support **WIFI**, **USB Serial**(WIP), **Bluetooth**(WIP) for connecting Mobile App with Device Server
- Places and **customize** components to [configure panels](https://github.com/junghyun397/VirtualThrottle/wiki/HELP:-how-to-place-and-modify-components-to-build-panel#eng-help-how-to-place-and-modify-components-to-build-panel)
- Provides 5 components
- [Slider](https://github.com/junghyun397/VirtualThrottle/wiki/HELP:-how-to-place-and-modify-components-to-build-panel#slider)
- [Button](https://github.com/junghyun397/VirtualThrottle/wiki/HELP:-how-to-place-and-modify-components-to-build-panel#button)
- [Toggle Button](https://github.com/junghyun397/VirtualThrottle/wiki/HELP:-how-to-place-and-modify-components-to-build-panel#toggle-button)
- [Toggle Switch](https://github.com/junghyun397/VirtualThrottle/wiki/HELP:-how-to-place-and-modify-components-to-build-panel#toggle-switch)
- [Hat Switch](https://github.com/junghyun397/VirtualThrottle/wiki/HELP:-how-to-place-and-modify-components-to-build-panel#hat-switch)
- **Simple** usage and manuals
- **Simple** usage and [manual](https://github.com/junghyun397/VirtualThrottle/wiki)

# Install VFT

Currently, this project only support Android and Windows. Please download the app from the [release page](https://github.com/junghyun397/VirtualThrottle/releases) or [Google Play](http://cloud.do1ph.in). A complete installation course [tutorial](https://github.com/junghyun397/VirtualThrottle/wiki/STEP-BY-STEP:-how-to-install-VFT-Flight-Throttle) is available.
Currently, this project only support Android and Windows. Please download the Mobile App from the [release page](https://github.com/junghyun397/VirtualThrottle/releases) or [Google Play](http://cloud.do1ph.in) and [download]((https://github.com/junghyun397/VirtualThrottle/releases)) and execution Device Server. A complete installation course [tutorial](https://github.com/junghyun397/VirtualThrottle/wiki/STEP-BY-STEP:-how-to-install-VFT-Flight-Throttle) is available.

# Build and Run with flutter
```sh
Expand Down
2 changes: 1 addition & 1 deletion lib/data/data_settings.dart
Expand Up @@ -50,7 +50,7 @@ class IntegerSettingData extends SettingData<int> {
void setValue(String sourceString) => value = int.parse(sourceString);
}

enum NetworkType {WIFI, BLUETOOTH}
enum NetworkType {WIFI, BLUETOOTH, USB_SERIAL}
class NetworkTypeSettingData extends SettingData<NetworkType> {
NetworkTypeSettingData({NetworkType defaultValue, String Function(BuildContext) getL10nName, String Function(BuildContext) getL10nDescription}) :
super(defaultValue: defaultValue, getL10nName: getL10nName, getL10nDescription: getL10nDescription);
Expand Down
31 changes: 31 additions & 0 deletions lib/network/interface/network_usb_serial.dart
@@ -0,0 +1,31 @@
import 'package:VirtualFlightThrottle/network/interface/network_interface.dart';

class USBSerialNetworkAgent extends NetworkAgent {

USBSerialNetworkAgent(String address, Function onSessionKilled): super(address, onSessionKilled);

@override
void sendData(NetworkData networkData) {}

@override
void removeConnection() {}
}

class USBSerialNetworkManager extends NetworkManager {

@override
Future<bool> checkInterfaceAlive() async => Future<bool>.value(false);

@override
Future<String> getLocalAddress() async => Future<String>.value("None");

@override
Future<List<String>> findAliveTargetList() async {return Future.value([]);}

@override
Future<void> connectToTarget(String targetAddress, Function() onSessionLost) async {return Future.value();}

@override
String toString() => "USB";

}
10 changes: 6 additions & 4 deletions lib/network/network_manager.dart
Expand Up @@ -2,10 +2,10 @@ import 'package:VirtualFlightThrottle/data/data_settings.dart';
import 'package:VirtualFlightThrottle/data/data_sqlite3_helper.dart';
import 'package:VirtualFlightThrottle/network/interface/network_bluetooth.dart';
import 'package:VirtualFlightThrottle/network/interface/network_interface.dart';
import 'package:VirtualFlightThrottle/network/interface/network_usb_serial.dart';
import 'package:VirtualFlightThrottle/network/interface/network_wifi.dart';
import 'package:VirtualFlightThrottle/utility/utility_system.dart';
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';

class AppNetworkManager {

Expand All @@ -18,11 +18,13 @@ class AppNetworkManager {
static NetworkManager _getNetworkManager() {
switch (AppSettings().settingsMap[SettingsType.NETWORK_TYPE].value) {
case NetworkType.WIFI:
return new WifiNetworkManager();
return WifiNetworkManager();
case NetworkType.BLUETOOTH:
return new BlueToothNetworkManager();
return BlueToothNetworkManager();
case NetworkType.USB_SERIAL:
return USBSerialNetworkManager();
default:
return new WifiNetworkManager();
return WifiNetworkManager();
}
}

Expand Down

0 comments on commit 45fc742

Please sign in to comment.