App structure: a swipe-in menu shell; pages/, link/, actions/; Settings
The shell (shell.dart): a drawer from the left edge or each page's menu button. Dash, Signals, Captures; Tools (Camera, Link test, Orin power options), the rarely used ones, after pirate-station-aide; Settings (gateway address, dark/bright, build-time theme and landing). Landing view at build time: YUKART_HOME=dash|signals, signals for now. Dash, Signals and Captures stay alive while hidden; Captures has its own navigator, so a run survives switching views. Back goes inside Captures, then to the landing view, then out. The mock banner sits over every page. main.dart is startup only; the old home screen is pages/signals.dart; dialogs and sheets moved to actions/; the protocol client, USB binding and Reading to link/. lib/README.md catalogues it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DDwfd6Ki8UfG4hK6W5YpJz
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
// Android only: binding the process to the USB (NCM) Ethernet link to the Orin.
|
||||
// See MainActivity.kt for why Android needs telling.
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
class UsbLink extends ChangeNotifier {
|
||||
static const _ch = MethodChannel('yukart/net');
|
||||
|
||||
bool supported = Platform.isAndroid;
|
||||
bool up = false;
|
||||
bool bound = false;
|
||||
|
||||
/// Development hook: a link test requested by launch intent (see MainActivity.kt).
|
||||
void Function(String label)? onLinkTest;
|
||||
|
||||
UsbLink() {
|
||||
if (!supported) return;
|
||||
_ch.setMethodCallHandler((call) async {
|
||||
if (call.method == 'ethernet') {
|
||||
final a = Map<String, dynamic>.from(call.arguments as Map);
|
||||
up = a['up'] == true;
|
||||
bound = a['bound'] == true;
|
||||
notifyListeners();
|
||||
} else if (call.method == 'linktest') {
|
||||
onLinkTest?.call(call.arguments as String);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// A link test requested by the intent that launched the app, once.
|
||||
Future<String?> takeLinkTest() async => supported ? _ch.invokeMethod<String>('takeLinkTest') : null;
|
||||
|
||||
/// Bind only when the target is on the USB link; a workstation over WiFi must stay reachable.
|
||||
Future<void> bindFor(Uri target) async {
|
||||
if (!supported) return;
|
||||
final want = target.host.startsWith('192.168.55.');
|
||||
await _ch.invokeMethod<bool>('bindEthernet', want);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user