Migrate
This commit is contained in:
@@ -1,74 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bluetooth_serial/flutter_bluetooth_serial.dart';
|
||||
|
||||
class BluetoothDeviceListEntry extends ListTile {
|
||||
BluetoothDeviceListEntry({super.key,
|
||||
required BluetoothDevice device,
|
||||
int? rssi,
|
||||
GestureTapCallback? onTap,
|
||||
GestureLongPressCallback? onLongPress,
|
||||
bool enabled = true,
|
||||
}) : super(
|
||||
onTap: onTap,
|
||||
onLongPress: onLongPress,
|
||||
enabled: enabled,
|
||||
leading:
|
||||
const Icon(Icons.devices), // @TODO . !BluetoothClass! class aware icon
|
||||
title: Text(device.name ?? "Unknown device"),
|
||||
subtitle: Text(device.address.toString()),
|
||||
trailing: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
rssi != null
|
||||
? Container(
|
||||
margin: const EdgeInsets.all(8.0),
|
||||
child: DefaultTextStyle(
|
||||
style: _computeTextStyle(rssi),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text(rssi.toString()),
|
||||
const Text('dBm'),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: const SizedBox(width: 0, height: 0),
|
||||
device.isConnected
|
||||
? const Icon(Icons.import_export)
|
||||
: const SizedBox(width: 0, height: 0),
|
||||
device.isBonded
|
||||
? const Icon(Icons.link)
|
||||
: const SizedBox(width: 0, height: 0),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
static TextStyle _computeTextStyle(int rssi) {
|
||||
/**/ if (rssi >= -35) {
|
||||
return TextStyle(color: Colors.greenAccent[700]);
|
||||
} else if (rssi >= -45) {
|
||||
return TextStyle(
|
||||
color: Color.lerp(
|
||||
Colors.greenAccent[700], Colors.lightGreen, -(rssi + 35) / 10));
|
||||
} else if (rssi >= -55) {
|
||||
return TextStyle(
|
||||
color: Color.lerp(
|
||||
Colors.lightGreen, Colors.lime[600], -(rssi + 45) / 10));
|
||||
} else if (rssi >= -65) {
|
||||
return TextStyle(
|
||||
color: Color.lerp(Colors.lime[600], Colors.amber, -(rssi + 55) / 10));
|
||||
} else if (rssi >= -75) {
|
||||
return TextStyle(
|
||||
color: Color.lerp(
|
||||
Colors.amber, Colors.deepOrangeAccent, -(rssi + 65) / 10));
|
||||
} else if (rssi >= -85) {
|
||||
return TextStyle(
|
||||
color: Color.lerp(
|
||||
Colors.deepOrangeAccent, Colors.redAccent, -(rssi + 75) / 10));
|
||||
} else {
|
||||
/*code symetry*/
|
||||
return const TextStyle(color: Colors.redAccent);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
// ignore_for_file: public_member_api_docs, sort_constructors_first
|
||||
import 'dart:convert';
|
||||
|
||||
class PointToMeasure {
|
||||
int id;
|
||||
double coordX;
|
||||
double coordY;
|
||||
PointToMeasure({
|
||||
required this.id,
|
||||
required this.coordX,
|
||||
required this.coordY,
|
||||
});
|
||||
|
||||
PointToMeasure copyWith({
|
||||
int? id,
|
||||
double? coordX,
|
||||
double? coordY,
|
||||
}) {
|
||||
return PointToMeasure(
|
||||
id: id ?? this.id,
|
||||
coordX: coordX ?? this.coordX,
|
||||
coordY: coordY ?? this.coordY,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return <String, dynamic>{
|
||||
'id': id,
|
||||
'coordX': coordX,
|
||||
'coordY': coordY,
|
||||
};
|
||||
}
|
||||
|
||||
factory PointToMeasure.fromMap(Map<String, dynamic> map) {
|
||||
return PointToMeasure(
|
||||
id: map['id'] as int,
|
||||
coordX: map['coordX'] as double,
|
||||
coordY: map['coordY'] as double,
|
||||
);
|
||||
}
|
||||
|
||||
String toJson() => json.encode(toMap());
|
||||
|
||||
factory PointToMeasure.fromJson(String source) =>
|
||||
PointToMeasure.fromMap(json.decode(source) as Map<String, dynamic>);
|
||||
|
||||
@override
|
||||
String toString() =>
|
||||
'PointToMeasure(id: $id, coordX: $coordX, coordY: $coordY)';
|
||||
|
||||
@override
|
||||
bool operator ==(covariant PointToMeasure other) {
|
||||
if (identical(this, other)) return true;
|
||||
|
||||
return other.id == id && other.coordX == coordX && other.coordY == coordY;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => id.hashCode ^ coordX.hashCode ^ coordY.hashCode;
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
class PointWithDescription {
|
||||
final int Id;
|
||||
final DateTime dateTime;
|
||||
final String description;
|
||||
final double eovX;
|
||||
final double eovY;
|
||||
final double latitude;
|
||||
final double longitude;
|
||||
final double horizontalError;
|
||||
final double verticalError;
|
||||
|
||||
PointWithDescription(
|
||||
this.Id,
|
||||
this.dateTime,
|
||||
this.description,
|
||||
this.eovX,
|
||||
this.eovY,
|
||||
this.latitude,
|
||||
this.longitude,
|
||||
this.horizontalError,
|
||||
this.verticalError);
|
||||
}
|
||||
@@ -1,131 +0,0 @@
|
||||
// ignore_for_file: public_member_api_docs, sort_constructors_first
|
||||
import 'dart:convert';
|
||||
import 'dart:ffi';
|
||||
|
||||
class SeismicRecord {
|
||||
const SeismicRecord({
|
||||
required this.ffid,
|
||||
required this.gpsDateTime,
|
||||
required this.gpsTimeInMicroseconds,
|
||||
required this.imageUrl,
|
||||
required this.maxReceiverPointFduNumber,
|
||||
required this.minReceiverPointFduNumber,
|
||||
required this.minReceiverPointNumber,
|
||||
required this.maxReceiverPointNumber,
|
||||
required this.sourceLine,
|
||||
required this.sourcePoint,
|
||||
});
|
||||
|
||||
final int ffid;
|
||||
final DateTime gpsDateTime;
|
||||
final int gpsTimeInMicroseconds;
|
||||
final String imageUrl;
|
||||
final int maxReceiverPointFduNumber;
|
||||
final int minReceiverPointFduNumber;
|
||||
final int minReceiverPointNumber;
|
||||
final int maxReceiverPointNumber;
|
||||
final double sourceLine;
|
||||
final double sourcePoint;
|
||||
|
||||
SeismicRecord copyWith({
|
||||
int? ffid,
|
||||
DateTime? gpsDateTime,
|
||||
int? gpsTimeInMicroseconds,
|
||||
String? imageUrl,
|
||||
int? maxReceiverPointFduNumber,
|
||||
int? minReceiverPointFduNumber,
|
||||
int? minReceiverPointNumber,
|
||||
int? maxReceiverPointNumber,
|
||||
double? sourceLine,
|
||||
double? sourcePoint,
|
||||
}) {
|
||||
return SeismicRecord(
|
||||
ffid: ffid ?? this.ffid,
|
||||
gpsDateTime: gpsDateTime ?? this.gpsDateTime,
|
||||
gpsTimeInMicroseconds:
|
||||
gpsTimeInMicroseconds ?? this.gpsTimeInMicroseconds,
|
||||
imageUrl: imageUrl ?? this.imageUrl,
|
||||
maxReceiverPointFduNumber:
|
||||
maxReceiverPointFduNumber ?? this.maxReceiverPointFduNumber,
|
||||
minReceiverPointFduNumber:
|
||||
minReceiverPointFduNumber ?? this.minReceiverPointFduNumber,
|
||||
minReceiverPointNumber:
|
||||
minReceiverPointNumber ?? this.minReceiverPointNumber,
|
||||
maxReceiverPointNumber:
|
||||
maxReceiverPointNumber ?? this.maxReceiverPointNumber,
|
||||
sourceLine: sourceLine ?? this.sourceLine,
|
||||
sourcePoint: sourcePoint ?? this.sourcePoint,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return <String, dynamic>{
|
||||
'ffid': ffid,
|
||||
'gpsDateTime': gpsDateTime.millisecondsSinceEpoch,
|
||||
'gpsTimeInMicroseconds': gpsTimeInMicroseconds,
|
||||
'imageUrl': imageUrl,
|
||||
'maxReceiverPointFduNumber': maxReceiverPointFduNumber,
|
||||
'minReceiverPointFduNumber': minReceiverPointFduNumber,
|
||||
'minReceiverPointNumber': minReceiverPointNumber,
|
||||
'maxReceiverPointNumber': maxReceiverPointNumber,
|
||||
'sourceLine': sourceLine,
|
||||
'sourcePoint': sourcePoint,
|
||||
};
|
||||
}
|
||||
|
||||
factory SeismicRecord.fromMap(Map<String, dynamic> map) {
|
||||
return SeismicRecord(
|
||||
ffid: map['ffid'] as int,
|
||||
gpsDateTime:
|
||||
DateTime.fromMillisecondsSinceEpoch(map['gpsDateTime'] as int),
|
||||
gpsTimeInMicroseconds: map['gpsTimeInMicroseconds'] as int,
|
||||
imageUrl: map['imageUrl'] as String,
|
||||
maxReceiverPointFduNumber: map['maxReceiverPointFduNumber'] as int,
|
||||
minReceiverPointFduNumber: map['minReceiverPointFduNumber'] as int,
|
||||
minReceiverPointNumber: map['minReceiverPointNumber'] as int,
|
||||
maxReceiverPointNumber: map['maxReceiverPointNumber'] as int,
|
||||
sourceLine: map['sourceLine'] as double,
|
||||
sourcePoint: map['sourcePoint'] as double,
|
||||
);
|
||||
}
|
||||
|
||||
String toJson() => json.encode(toMap());
|
||||
|
||||
factory SeismicRecord.fromJson(String source) =>
|
||||
SeismicRecord.fromMap(json.decode(source) as Map<String, dynamic>);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SeismicRecord(ffid: $ffid, gpsDateTime: $gpsDateTime, gpsTimeInMicroseconds: $gpsTimeInMicroseconds, imageUrl: $imageUrl, maxReceiverPointFduNumber: $maxReceiverPointFduNumber, minReceiverPointFduNumber: $minReceiverPointFduNumber, minReceiverPointNumber: $minReceiverPointNumber, maxReceiverPointNumber: $maxReceiverPointNumber, sourceLine: $sourceLine, sourcePoint: $sourcePoint)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(covariant SeismicRecord other) {
|
||||
if (identical(this, other)) return true;
|
||||
|
||||
return other.ffid == ffid &&
|
||||
other.gpsDateTime == gpsDateTime &&
|
||||
other.gpsTimeInMicroseconds == gpsTimeInMicroseconds &&
|
||||
other.imageUrl == imageUrl &&
|
||||
other.maxReceiverPointFduNumber == maxReceiverPointFduNumber &&
|
||||
other.minReceiverPointFduNumber == minReceiverPointFduNumber &&
|
||||
other.minReceiverPointNumber == minReceiverPointNumber &&
|
||||
other.maxReceiverPointNumber == maxReceiverPointNumber &&
|
||||
other.sourceLine == sourceLine &&
|
||||
other.sourcePoint == sourcePoint;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
return ffid.hashCode ^
|
||||
gpsDateTime.hashCode ^
|
||||
gpsTimeInMicroseconds.hashCode ^
|
||||
imageUrl.hashCode ^
|
||||
maxReceiverPointFduNumber.hashCode ^
|
||||
minReceiverPointFduNumber.hashCode ^
|
||||
minReceiverPointNumber.hashCode ^
|
||||
maxReceiverPointNumber.hashCode ^
|
||||
sourceLine.hashCode ^
|
||||
sourcePoint.hashCode;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user