Skip to content

Commit 45fc742

Browse files
committed
Add usb-serial network interface skeleton-code and update README.md
1 parent da0e10e commit 45fc742

4 files changed

Lines changed: 41 additions & 7 deletions

File tree

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,19 @@
99
# Main Features
1010

1111
- Supports **all games** that support joystick input
12+
- Support **WIFI**, **USB Serial**(WIP), **Bluetooth**(WIP) for connecting Mobile App with Device Server
1213
- 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)
1314
- Provides 5 components
1415
- [Slider](https://github.com/junghyun397/VirtualThrottle/wiki/HELP:-how-to-place-and-modify-components-to-build-panel#slider)
1516
- [Button](https://github.com/junghyun397/VirtualThrottle/wiki/HELP:-how-to-place-and-modify-components-to-build-panel#button)
1617
- [Toggle Button](https://github.com/junghyun397/VirtualThrottle/wiki/HELP:-how-to-place-and-modify-components-to-build-panel#toggle-button)
1718
- [Toggle Switch](https://github.com/junghyun397/VirtualThrottle/wiki/HELP:-how-to-place-and-modify-components-to-build-panel#toggle-switch)
1819
- [Hat Switch](https://github.com/junghyun397/VirtualThrottle/wiki/HELP:-how-to-place-and-modify-components-to-build-panel#hat-switch)
19-
- **Simple** usage and manuals
20+
- **Simple** usage and [manual](https://github.com/junghyun397/VirtualThrottle/wiki)
2021

2122
# Install VFT
2223

23-
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.
24+
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.
2425

2526
# Build and Run with flutter
2627
```sh

lib/data/data_settings.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class IntegerSettingData extends SettingData<int> {
5050
void setValue(String sourceString) => value = int.parse(sourceString);
5151
}
5252

53-
enum NetworkType {WIFI, BLUETOOTH}
53+
enum NetworkType {WIFI, BLUETOOTH, USB_SERIAL}
5454
class NetworkTypeSettingData extends SettingData<NetworkType> {
5555
NetworkTypeSettingData({NetworkType defaultValue, String Function(BuildContext) getL10nName, String Function(BuildContext) getL10nDescription}) :
5656
super(defaultValue: defaultValue, getL10nName: getL10nName, getL10nDescription: getL10nDescription);
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import 'package:VirtualFlightThrottle/network/interface/network_interface.dart';
2+
3+
class USBSerialNetworkAgent extends NetworkAgent {
4+
5+
USBSerialNetworkAgent(String address, Function onSessionKilled): super(address, onSessionKilled);
6+
7+
@override
8+
void sendData(NetworkData networkData) {}
9+
10+
@override
11+
void removeConnection() {}
12+
}
13+
14+
class USBSerialNetworkManager extends NetworkManager {
15+
16+
@override
17+
Future<bool> checkInterfaceAlive() async => Future<bool>.value(false);
18+
19+
@override
20+
Future<String> getLocalAddress() async => Future<String>.value("None");
21+
22+
@override
23+
Future<List<String>> findAliveTargetList() async {return Future.value([]);}
24+
25+
@override
26+
Future<void> connectToTarget(String targetAddress, Function() onSessionLost) async {return Future.value();}
27+
28+
@override
29+
String toString() => "USB";
30+
31+
}

lib/network/network_manager.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import 'package:VirtualFlightThrottle/data/data_settings.dart';
22
import 'package:VirtualFlightThrottle/data/data_sqlite3_helper.dart';
33
import 'package:VirtualFlightThrottle/network/interface/network_bluetooth.dart';
44
import 'package:VirtualFlightThrottle/network/interface/network_interface.dart';
5+
import 'package:VirtualFlightThrottle/network/interface/network_usb_serial.dart';
56
import 'package:VirtualFlightThrottle/network/interface/network_wifi.dart';
67
import 'package:VirtualFlightThrottle/utility/utility_system.dart';
78
import 'package:flutter/material.dart';
8-
import 'package:fluttertoast/fluttertoast.dart';
99

1010
class AppNetworkManager {
1111

@@ -18,11 +18,13 @@ class AppNetworkManager {
1818
static NetworkManager _getNetworkManager() {
1919
switch (AppSettings().settingsMap[SettingsType.NETWORK_TYPE].value) {
2020
case NetworkType.WIFI:
21-
return new WifiNetworkManager();
21+
return WifiNetworkManager();
2222
case NetworkType.BLUETOOTH:
23-
return new BlueToothNetworkManager();
23+
return BlueToothNetworkManager();
24+
case NetworkType.USB_SERIAL:
25+
return USBSerialNetworkManager();
2426
default:
25-
return new WifiNetworkManager();
27+
return WifiNetworkManager();
2628
}
2729
}
2830

0 commit comments

Comments
 (0)