|
|
|
|
@ -1,3 +1,4 @@
|
|
|
|
|
import 'dart:async';
|
|
|
|
|
import 'dart:developer';
|
|
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
|
|
@ -18,7 +19,6 @@ import 'package:queuing_system/widget/data_display/app_texts_widget.dart';
|
|
|
|
|
|
|
|
|
|
var DEVICE_IP = "10.10.15.11"; // Testing IP
|
|
|
|
|
|
|
|
|
|
String globalInterface = "";
|
|
|
|
|
// var DEVICE_IP = "10.10.14.11"; // Testing IP
|
|
|
|
|
// var DEVICE_IP = "10.10.15.11";
|
|
|
|
|
|
|
|
|
|
@ -46,28 +46,28 @@ class _MyHomePageState extends State<MyHomePage> {
|
|
|
|
|
super.dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future printIps() async {
|
|
|
|
|
Future<String> printIps() async {
|
|
|
|
|
for (var interface in await NetworkInterface.list(type: InternetAddressType.IPv4)) {
|
|
|
|
|
print("interfaces: ${interface.name}");
|
|
|
|
|
globalInterface = globalInterface + " ** " + interface.name;
|
|
|
|
|
|
|
|
|
|
log("interfaces: ${interface.name}");
|
|
|
|
|
if (interface.name == "eth0") {
|
|
|
|
|
for (var address in interface.addresses) {
|
|
|
|
|
DEVICE_IP = address.address;
|
|
|
|
|
log('${address.address} ${address.type.name}');
|
|
|
|
|
log(DEVICE_IP);
|
|
|
|
|
return DEVICE_IP;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
listenNetworkConnectivity();
|
|
|
|
|
printIps();
|
|
|
|
|
scheduleMicrotask(() async {
|
|
|
|
|
if (!signalRHelper.getConnectionState()) {
|
|
|
|
|
signalRHelper.startSignalRConnection(DEVICE_IP, onUpdateAvailable: onUpdateAvailable, onConnect: onConnect, onConnecting: onConnecting, onDisconnect: onDisconnect);
|
|
|
|
|
signalRHelper.startSignalRConnection(await printIps(), onUpdateAvailable: onUpdateAvailable, onConnect: onConnect, onConnecting: onConnecting, onDisconnect: onDisconnect);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
super.initState();
|
|
|
|
|
}
|
|
|
|
|
@ -99,7 +99,6 @@ class _MyHomePageState extends State<MyHomePage> {
|
|
|
|
|
fontFamily: 'Poppins-Medium.ttf',
|
|
|
|
|
),
|
|
|
|
|
Text(DEVICE_IP, style: TextStyle(fontWeight: FontWeight.w500, fontSize: SizeConfig.getWidthMultiplier() * 2.2)),
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(width: 10),
|
|
|
|
|
@ -107,8 +106,6 @@ class _MyHomePageState extends State<MyHomePage> {
|
|
|
|
|
"assets/images/cloud_logo.png",
|
|
|
|
|
height: SizeConfig.getHeightMultiplier() * 4,
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(width: 10),
|
|
|
|
|
Text(globalInterface, style: TextStyle(fontWeight: FontWeight.w500, fontSize: SizeConfig.getWidthMultiplier() * 2.2)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
|