feat: implement ble tag scanning
This commit is contained in:
@@ -3,13 +3,15 @@ import 'position.dart';
|
||||
class Tag {
|
||||
const Tag({
|
||||
required this.id,
|
||||
required this.tagId,
|
||||
required this.name,
|
||||
this.currentRoomId,
|
||||
this.lastPosition,
|
||||
this.lastSeen,
|
||||
});
|
||||
|
||||
final String id;
|
||||
final int id;
|
||||
final String tagId; // BLE beacon advertised identifier
|
||||
final String name;
|
||||
final String? currentRoomId;
|
||||
final Position? lastPosition;
|
||||
@@ -18,6 +20,7 @@ class Tag {
|
||||
Tag copyWith({String? name, String? currentRoomId, Position? lastPosition, DateTime? lastSeen}) =>
|
||||
Tag(
|
||||
id: id,
|
||||
tagId: tagId,
|
||||
name: name ?? this.name,
|
||||
currentRoomId: currentRoomId ?? this.currentRoomId,
|
||||
lastPosition: lastPosition ?? this.lastPosition,
|
||||
@@ -26,6 +29,7 @@ class Tag {
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'tag_id': tagId,
|
||||
'name': name,
|
||||
'current_room_id': currentRoomId,
|
||||
'last_position': lastPosition?.toJson(),
|
||||
@@ -33,7 +37,8 @@ class Tag {
|
||||
};
|
||||
|
||||
factory Tag.fromJson(Map<String, dynamic> json) => Tag(
|
||||
id: json['id'] as String,
|
||||
id: json['id'] as int,
|
||||
tagId: json['tag_id'] as String,
|
||||
name: json['name'] as String,
|
||||
currentRoomId: json['current_room_id'] as String?,
|
||||
lastPosition: json['last_position'] == null
|
||||
|
||||
Reference in New Issue
Block a user