mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Added initial detection sensor log
This commit is contained in:
parent
c9d9a38c91
commit
3275bbf348
9 changed files with 240 additions and 2 deletions
|
|
@ -60,3 +60,23 @@ public func getWaypoint(id: Int64, context: NSManagedObjectContext) -> WaypointE
|
|||
}
|
||||
return WaypointEntity(context: context)
|
||||
}
|
||||
|
||||
|
||||
public func getDetectionSensorMessages(nodeNum: Int64?, context: NSManagedObjectContext) -> [MessageEntity] {
|
||||
|
||||
let fetchDetectionMessagesPredicate: NSFetchRequest<NSFetchRequestResult> = NSFetchRequest.init(entityName: "MessageEntity")
|
||||
fetchDetectionMessagesPredicate.predicate = NSPredicate(format: "portNum == %d", Int32(PortNum.detectionSensorApp.rawValue))
|
||||
|
||||
do {
|
||||
let fetched = try context.fetch(fetchDetectionMessagesPredicate) as? [MessageEntity] ?? []
|
||||
if nodeNum == nil {
|
||||
return fetched.reversed()
|
||||
}
|
||||
return fetched.filter { message in
|
||||
return message.fromUser?.num == nodeNum!
|
||||
}.reversed()
|
||||
}
|
||||
catch {
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue