Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SenzorDataCollectorApp_IOS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Miklósi Máté
SenzorDataCollectorApp_IOS
Commits
c76d6b3f
Commit
c76d6b3f
authored
1 year ago
by
miklosimate
Browse files
Options
Downloads
Patches
Plain Diff
Timer works, file often too large
parent
1615a738
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
SenzorDataCollectorApp/Sensors.swift
+0
-1
0 additions, 1 deletion
SenzorDataCollectorApp/Sensors.swift
SenzorDataCollectorApp/StartingView.swift
+27
-10
27 additions, 10 deletions
SenzorDataCollectorApp/StartingView.swift
with
27 additions
and
11 deletions
SenzorDataCollectorApp/Sensors.swift
+
0
−
1
View file @
c76d6b3f
...
...
@@ -109,7 +109,6 @@ class SensorCollector: ObservableObject {
let
altTimestampedTuple
=
(
Int
(
Date
()
.
timeIntervalSince1970
*
1000
),
(
x
:
rel_altitude
,
y
:
pressure
,
z
:
0.0
))
DispatchQueue
.
main
.
async
{
// Append the sensor data to the correct MeasuringSensors instance in the activeSensorsList
if
let
index
=
self
.
activeSensorsList
.
firstIndex
(
where
:
{
$0
.
sensorName
==
Sensors
.
alt
.
rawValue
})
{
self
.
activeSensorsList
[
index
]
.
sensorData
.
append
(
altTimestampedTuple
)
}
...
...
This diff is collapsed.
Click to expand it.
SenzorDataCollectorApp/StartingView.swift
+
27
−
10
View file @
c76d6b3f
...
...
@@ -34,8 +34,10 @@ struct StartingView: View {
//----------TIMER SETUP SETTINGS AND VARS -----------------------------------------------------
@StateObject
var
customTimer
:
CustomTimer
private
let
backgroundTaskIdentifier
=
"hu.itk.ppke.backgroundTask"
private
let
timer
=
Timer
.
publish
(
every
:
1
,
on
:
.
main
,
in
:
.
common
)
.
autoconnect
()
//----------MEASURMENT SETUP AND VARS ---------------------------------------------------------
@State
var
demostart
=
false
@State
var
sensorDetailSheetPresented
=
false
@State
var
showingFilePicker
=
false
@State
var
selectedFolder
:
URL
?
...
...
@@ -58,6 +60,7 @@ struct StartingView: View {
//----------------------------- DEBUG VALUE DISPAY ---------------------------------
Text
(
"Notification list:
\(
manager
.
timerIntervalValues
.
map
{
"
\(
$0
)
"
}
.
joined
(
separator
:
", "
)
)
"
)
.
opacity
(
debug
?
0
:
1
)
Text
(
"Next notification in:
\(
customTimer
.
timerStringValue
)
"
)
.
opacity
(
debug
?
0
:
1
)
Text
(
"
\(
manager
.
serverResponse
)
"
)
.
padding
()
.
opacity
(
debug
?
0
:
1
)
...
...
@@ -95,9 +98,6 @@ struct StartingView: View {
)
}
}
Button
(
"CreateDIR"
){
createDirectory
()
}
.
padding
()
.
opacity
(
debug
?
0
:
1
)
...
...
@@ -198,10 +198,8 @@ struct StartingView: View {
if
manager
.
state
==
"Ready"
{
createDirectory
()
setNextMeasurement
()
sensor
.
startAllRecording
(
motionManager
:
motionManager
,
altimeter
:
altimeter
)
customTimer
.
startTimer
()
first_open
=
false
demostart
=
true
}
}
label
:
{
Text
(
manager
.
state
!=
"Ready"
?
"Get started"
:
manager
.
state
)
...
...
@@ -218,10 +216,10 @@ struct StartingView: View {
})
//----------------------------- TIMER REFRESH ---------------------------------
.
onReceive
(
Timer
.
publish
(
every
:
1
,
on
:
.
main
,
in
:
.
common
)
.
autoconnect
()){
_
in
.
onReceive
(
timer
){
_
in
if
customTimer
.
isStarted
{
customTimer
.
updateTimer
()
print
(
"Timer:
\(
customTimer
.
totalSeconds
)
"
)
}
}
//----------------------------- NOTIFICAION HANDELING ---------------------------------
...
...
@@ -231,9 +229,13 @@ struct StartingView: View {
sensor
.
stopAllRecording
(
motionManager
:
motionManager
,
altimeter
:
altimeter
)
customTimer
.
stopTimer
()
saveAllToJson
()
setNextMeasurement
()
sensor
.
startAllRecording
(
motionManager
:
motionManager
,
altimeter
:
altimeter
)
customTimer
.
startTimer
()
if
customTimer
.
totalSeconds
!=
0
{
sensor
.
startAllRecording
(
motionManager
:
motionManager
,
altimeter
:
altimeter
)
customTimer
.
startTimer
()
}
}
Button
(
"Stop"
,
role
:
.
destructive
){
sensor
.
stopAllRecording
(
motionManager
:
motionManager
,
altimeter
:
altimeter
)
...
...
@@ -241,6 +243,21 @@ struct StartingView: View {
saveAllToJson
()
}
}
//------------------ DEMO NOTIFICATION - MEASUREMENT STARTING ----------------------
.
alert
(
"Demo Alert - press start if you are ready to start!"
,
isPresented
:
$demostart
){
Button
(
"Start"
,
role
:
.
cancel
){
sensor
.
stopAllRecording
(
motionManager
:
motionManager
,
altimeter
:
altimeter
)
customTimer
.
stopTimer
()
setNextMeasurement
()
if
customTimer
.
totalSeconds
!=
0
{
sensor
.
startAllRecording
(
motionManager
:
motionManager
,
altimeter
:
altimeter
)
customTimer
.
startTimer
()
}
}
Button
(
"Stop"
,
role
:
.
destructive
){
first_open
=
true
}
}
}
}
func
saveAllToJson
(){
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment