-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #176 from osociety/restore-keys
Store scan results
- Loading branch information
Showing
35 changed files
with
509 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:flutter/material.dart'; | ||
import 'package:isar/isar.dart'; | ||
|
||
part 'device.g.dart'; | ||
|
||
@collection | ||
class Device { | ||
Device({ | ||
required this.internetAddress, | ||
required this.hostMake, | ||
required this.currentDeviceIp, | ||
required this.gatewayIp, | ||
required this.scanId, | ||
this.mdnsDomainName, | ||
this.macAddress, | ||
}); | ||
final Id id = Isar.autoIncrement; | ||
@Index(type: IndexType.value) | ||
final int scanId; | ||
@Index(type: IndexType.value) | ||
final String internetAddress; | ||
final String currentDeviceIp; | ||
final String gatewayIp; | ||
final String? macAddress; | ||
final String? hostMake; | ||
final String? mdnsDomainName; | ||
|
||
@override | ||
bool operator ==(Object other) => | ||
identical(this, other) || | ||
other is Device && | ||
runtimeType == other.runtimeType && | ||
internetAddress == other.internetAddress; | ||
|
||
@override | ||
int get hashCode => internetAddress.hashCode; | ||
|
||
@ignore | ||
String? get deviceMake { | ||
if (currentDeviceIp == internetAddress) { | ||
return 'This device'; | ||
} else if (gatewayIp == internetAddress) { | ||
return 'Router/Gateway'; | ||
} else if (mdnsDomainName != null) { | ||
return mdnsDomainName; | ||
} | ||
return hostMake; | ||
} | ||
|
||
@ignore | ||
IconData get iconData { | ||
if (internetAddress == currentDeviceIp) { | ||
if (Platform.isLinux || Platform.isMacOS || Platform.isWindows) { | ||
return Icons.computer; | ||
} | ||
return Icons.smartphone; | ||
} else if (internetAddress == gatewayIp) { | ||
return Icons.router; | ||
} | ||
return Icons.devices; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import 'package:isar/isar.dart'; | ||
part 'scan.g.dart'; | ||
|
||
@collection | ||
class Scan { | ||
Scan({ | ||
required this.gatewayIp, | ||
this.startTime, | ||
this.endTime, | ||
this.onGoing, | ||
}); | ||
Id id = Isar.autoIncrement; | ||
@Index(type: IndexType.value) | ||
final String gatewayIp; | ||
bool? onGoing; | ||
DateTime? startTime; | ||
DateTime? endTime; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.