Updates
This commit is contained in:
parent
7388f2b4bb
commit
e7331e7d93
|
|
@ -1,4 +1,22 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- Permissions Internet et réseau -->
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
|
||||
<!-- Permissions Bluetooth -->
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" android:usesPermissionFlags="neverForLocation" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
||||
|
||||
<!-- Permissions de localisation -->
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
|
||||
<!-- Fonctionnalités Bluetooth Low Energy -->
|
||||
<uses-feature android:name="android.hardware.bluetooth_le" android:required="false" />
|
||||
|
||||
|
||||
<application
|
||||
android:label="gps_map_flowpoint"
|
||||
android:name="${applicationName}"
|
||||
|
|
@ -30,4 +48,5 @@
|
|||
android:name="flutterEmbedding"
|
||||
android:value="2" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
buildscript {
|
||||
ext.kotlin_version = '1.7.10'
|
||||
ext.kotlin_version = '2.0.0'
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
|
|
|
|||
91
lib/deviceAdvertizinScan.dart
Normal file
91
lib/deviceAdvertizinScan.dart
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:flutter_osm_plugin/flutter_osm_plugin.dart';
|
||||
|
||||
class DeviceAdvertizinScan extends StatefulWidget {
|
||||
const DeviceAdvertizinScan(
|
||||
{super.key,
|
||||
required this.title,
|
||||
required this.deviceName,
|
||||
required this.deviceAddress,
|
||||
required this.remoteId});
|
||||
|
||||
final String title;
|
||||
final String deviceName;
|
||||
final String deviceAddress;
|
||||
final String remoteId;
|
||||
|
||||
@override
|
||||
State<DeviceAdvertizinScan> createState() => _DeviceAdvertizinScanState();
|
||||
}
|
||||
|
||||
class _DeviceAdvertizinScanState extends State<DeviceAdvertizinScan> {
|
||||
List<ScanResult> scanResults = [];
|
||||
|
||||
TextEditingController tecTakingPoint = TextEditingController();
|
||||
MapController mapController = MapController(
|
||||
initPosition: GeoPoint(latitude: 47.4358055, longitude: 8.4737324),
|
||||
);
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
tecTakingPoint.text = '5';
|
||||
FlutterBluePlus.startScan();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
FlutterBluePlus.stopScan();
|
||||
print('Page disposed');
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
String value = 'Aucune valeur trouvée';
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
FlutterBluePlus.onScanResults.listen((results) {
|
||||
setState(() {
|
||||
if (results.length > 0) value = results[0].toString();
|
||||
});
|
||||
});
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(widget.title, style: const TextStyle(color: Colors.white)),
|
||||
backgroundColor: Colors.blue,
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.arrow_back, color: Colors.white),
|
||||
onPressed: () {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
'(debug) Vous devez redémarrer l application et réaliser un nouveau scan pour voir les nouvelles valeurs (FlutterBluePlus.startScan())'),
|
||||
),
|
||||
);
|
||||
return;
|
||||
},
|
||||
),
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
Container(
|
||||
alignment: Alignment.topCenter,
|
||||
child: Text('Advertizin data value for ${widget.deviceName}' +
|
||||
' with remoteId ${widget.remoteId}')),
|
||||
Container(
|
||||
alignment: Alignment.center,
|
||||
child: Text(value,
|
||||
style: const TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold))),
|
||||
Container(child: CircularProgressIndicator()),
|
||||
Spacer(),
|
||||
Container(
|
||||
child: Text(
|
||||
'La trame publicitaire est en cours de réception et actualisée en temps réel.')),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:gps_map_flowpoint/deviceAdvertizinScan.dart';
|
||||
import 'package:gps_map_flowpoint/deviceFlowMap.dart';
|
||||
|
||||
class DeviceSelection extends StatefulWidget {
|
||||
|
|
@ -58,7 +59,7 @@ class _DeviceSelectionState extends State<DeviceSelection> {
|
|||
Widget build(BuildContext context) {
|
||||
// Filtered list of devices
|
||||
List<ScanResult> filteredDevices = scanResults
|
||||
.where((result) => result.device.name
|
||||
.where((result) => result.device.platformName
|
||||
.toLowerCase()
|
||||
.contains(tecSearch.text.toLowerCase()))
|
||||
.toList();
|
||||
|
|
@ -76,7 +77,7 @@ class _DeviceSelectionState extends State<DeviceSelection> {
|
|||
child: TextFormField(
|
||||
controller: tecSearch,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Rechercher un appareil',
|
||||
hintText: 'Rechercher un appareil par nom',
|
||||
prefixIcon: Icon(Icons.search),
|
||||
),
|
||||
onChanged: (value) {
|
||||
|
|
@ -91,26 +92,55 @@ class _DeviceSelectionState extends State<DeviceSelection> {
|
|||
itemBuilder: (context, index) {
|
||||
ScanResult result = filteredDevices[index];
|
||||
return ListTile(
|
||||
title: Text(result.device.name),
|
||||
subtitle: Text(result.device.id.id),
|
||||
onTap: () {
|
||||
//Stop scanning when a device is selected
|
||||
FlutterBluePlus.stopScan();
|
||||
setState(() {
|
||||
isScanning = false;
|
||||
});
|
||||
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => DeviceFlowMap(
|
||||
title: 'GPS Map Flowpoint',
|
||||
deviceName: result.device.name,
|
||||
deviceAddress: result.device.id.id,
|
||||
),
|
||||
trailing: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
//Stop scanning when a device is selected
|
||||
FlutterBluePlus.stopScan();
|
||||
setState(() {
|
||||
isScanning = false;
|
||||
});
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => DeviceAdvertizinScan(
|
||||
title: 'Advertising Frame View',
|
||||
deviceName: result.device.platformName,
|
||||
deviceAddress: result.device.remoteId.str,
|
||||
remoteId: result.device.remoteId.str,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Icon(Icons.info_outline),
|
||||
),
|
||||
);
|
||||
},
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
//Stop scanning when a device is selected
|
||||
FlutterBluePlus.stopScan();
|
||||
setState(() {
|
||||
isScanning = false;
|
||||
});
|
||||
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => DeviceFlowMap(
|
||||
title: 'GPS Map Flowpoint',
|
||||
deviceName: result.device.platformName,
|
||||
deviceAddress: result.device.remoteId.str,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Icon(Icons.map_outlined),
|
||||
),
|
||||
],
|
||||
),
|
||||
title: Text(result.device.platformName),
|
||||
subtitle: Text(result.device.remoteId.str),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
|
@ -121,6 +151,7 @@ class _DeviceSelectionState extends State<DeviceSelection> {
|
|||
backgroundColor: Colors.blue,
|
||||
onPressed: () {
|
||||
print('Scanning');
|
||||
|
||||
setState(() {
|
||||
isScanning = !isScanning;
|
||||
if (isScanning) {
|
||||
|
|
|
|||
|
|
@ -2,21 +2,33 @@ PODS:
|
|||
- flutter_blue_plus (0.0.1):
|
||||
- FlutterMacOS
|
||||
- FlutterMacOS (1.0.0)
|
||||
- geolocator_apple (1.2.0):
|
||||
- FlutterMacOS
|
||||
- url_launcher_macos (0.0.1):
|
||||
- FlutterMacOS
|
||||
|
||||
DEPENDENCIES:
|
||||
- flutter_blue_plus (from `Flutter/ephemeral/.symlinks/plugins/flutter_blue_plus/macos`)
|
||||
- FlutterMacOS (from `Flutter/ephemeral`)
|
||||
- geolocator_apple (from `Flutter/ephemeral/.symlinks/plugins/geolocator_apple/macos`)
|
||||
- url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
flutter_blue_plus:
|
||||
:path: Flutter/ephemeral/.symlinks/plugins/flutter_blue_plus/macos
|
||||
FlutterMacOS:
|
||||
:path: Flutter/ephemeral
|
||||
geolocator_apple:
|
||||
:path: Flutter/ephemeral/.symlinks/plugins/geolocator_apple/macos
|
||||
url_launcher_macos:
|
||||
:path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
flutter_blue_plus: e2868679021f19d12a8c0c58a33f1df66ec7fa6a
|
||||
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
|
||||
geolocator_apple: 72a78ae3f3e4ec0db62117bd93e34523f5011d58
|
||||
url_launcher_macos: 5f437abeda8c85500ceb03f5c1938a8c5a705399
|
||||
|
||||
PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367
|
||||
|
||||
COCOAPODS: 1.14.2
|
||||
COCOAPODS: 1.15.2
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@
|
|||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0920;
|
||||
LastUpgradeCheck = 1430;
|
||||
LastUpgradeCheck = 1510;
|
||||
ORGANIZATIONNAME = "";
|
||||
TargetAttributes = {
|
||||
331C80D4294CF70F00263BE5 = {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1430"
|
||||
LastUpgradeVersion = "1510"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user