Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MobileEventLog
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
Data-Logistics-Support
MobileEventLog
Commits
8f678ee1
Commit
8f678ee1
authored
3 years ago
by
Maximilian Betz
Browse files
Options
Downloads
Patches
Plain Diff
corrected urn<=>id handling.
parent
a18c1730
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/addevent.dart
+1
-0
1 addition, 0 deletions
lib/addevent.dart
lib/datamodel.dart
+28
-2
28 additions, 2 deletions
lib/datamodel.dart
lib/main.dart
+12
-6
12 additions, 6 deletions
lib/main.dart
with
41 additions
and
8 deletions
lib/addevent.dart
+
1
−
0
View file @
8f678ee1
...
@@ -75,6 +75,7 @@ class AddEvent extends StatelessWidget {
...
@@ -75,6 +75,7 @@ class AddEvent extends StatelessWidget {
})
.
toList
(),
})
.
toList
(),
onChanged:
(
value
)
{
onChanged:
(
value
)
{
currentEvent
.
store
.
urn
=
value
.
toString
();
currentEvent
.
store
.
urn
=
value
.
toString
();
currentEvent
.
store
.
id
=
availableDevice
.
getDeviceIdFromUrn
(
value
.
toString
());
}
}
),
),
TextFormField
(
TextFormField
(
...
...
This diff is collapsed.
Click to expand it.
lib/datamodel.dart
+
28
−
2
View file @
8f678ee1
...
@@ -64,8 +64,21 @@ class EventType{
...
@@ -64,8 +64,21 @@ class EventType{
}
}
abstract
class
DeviceStoreBase
{
abstract
class
DeviceStoreBase
{
List
<
Device
>
store
=
[];
List
<
Device
>
store
=
[];
int
getDeviceIdFromUrn
(
String
urn
)
{
for
(
var
device
in
store
)
{
if
(
device
.
urn
==
urn
)
{
return
device
.
id
;
}
}
throw
Exception
(
'Device with urn:'
+
urn
+
' was not found.'
);
}
void
reset
(){
store
=
[];
}
}
}
abstract
class
EventStoreBase
{
abstract
class
EventStoreBase
{
...
@@ -90,6 +103,10 @@ class EventStoreInstance extends EventStoreBase {
...
@@ -90,6 +103,10 @@ class EventStoreInstance extends EventStoreBase {
EventStoreInstance
.
_internal
()
{
EventStoreInstance
.
_internal
()
{
store
=
[];
store
=
[];
}
}
void
reset
(){
store
=
[];
}
}
}
class
EventCurrentInstance
extends
EventCurrentBase
{
class
EventCurrentInstance
extends
EventCurrentBase
{
...
@@ -100,7 +117,11 @@ class EventCurrentInstance extends EventCurrentBase {
...
@@ -100,7 +117,11 @@ class EventCurrentInstance extends EventCurrentBase {
}
}
EventCurrentInstance
.
_internal
(){
EventCurrentInstance
.
_internal
(){
store
=
Event
(
0
,
'urn0'
,
''
,
''
,
''
,
'PENDING'
);
store
=
Event
(
-
1
,
'urn0'
,
''
,
''
,
''
,
'PENDING'
);
}
void
reset
(){
store
=
Event
(
-
1
,
'urn0'
,
''
,
''
,
''
,
'PENDING'
);
}
}
}
}
...
@@ -114,6 +135,11 @@ class EventTypeStoreInstance extends EventTypeStoreBase{
...
@@ -114,6 +135,11 @@ class EventTypeStoreInstance extends EventTypeStoreBase{
EventTypeStoreInstance
.
_internal
(){
EventTypeStoreInstance
.
_internal
(){
store
=
[];
store
=
[];
}
}
void
reset
(){
store
=
[];
}
}
}
...
...
This diff is collapsed.
Click to expand it.
lib/main.dart
+
12
−
6
View file @
8f678ee1
...
@@ -12,20 +12,26 @@ void main() {
...
@@ -12,20 +12,26 @@ void main() {
EventStoreInstance
events
=
EventStoreInstance
();
EventStoreInstance
events
=
EventStoreInstance
();
EventTypeStoreInstance
eventTypes
=
EventTypeStoreInstance
();
EventTypeStoreInstance
eventTypes
=
EventTypeStoreInstance
();
EventCurrentInstance
currentEvent
=
EventCurrentInstance
();
EventCurrentInstance
currentEvent
=
EventCurrentInstance
();
DeviceStoreInstance
availableDevice
=
DeviceStoreInstance
();
DeviceStoreInstance
availableDevices
=
DeviceStoreInstance
();
//Reset old data
events
.
reset
();
eventTypes
.
reset
();
currentEvent
.
reset
();
availableDevices
.
reset
();
// Add some dummy devices
// Add some dummy devices
// TODO: load from shared preferences.
// TODO: load from shared preferences.
// TODO: this shall be requested from sensor.awi.de after selecting a collection in configuration.
// TODO: this shall be requested from sensor.awi.de after selecting a collection in configuration.
availableDevice
.
store
.
add
(
Device
.
fromJson
({
'id'
:
8311
,
'urn'
:
'station:neumayer_iii:awi_snow_sampler_1'
}));
availableDevice
s
.
store
.
add
(
Device
.
fromJson
({
'id'
:
8311
,
'urn'
:
'station:neumayer_iii:awi_snow_sampler_1'
}));
availableDevice
.
store
.
add
(
Device
.
fromJson
({
'id'
:
4086
,
'urn'
:
'acoustic_backscatter_sensor:test'
}));
availableDevice
s
.
store
.
add
(
Device
.
fromJson
({
'id'
:
4086
,
'urn'
:
'acoustic_backscatter_sensor:test'
}));
availableDevice
.
store
.
add
(
Device
.
fromJson
({
'id'
:
1393
,
'urn'
:
'vessel:polarstern:hydrosweep_ds3'
}));
availableDevice
s
.
store
.
add
(
Device
.
fromJson
({
'id'
:
1393
,
'urn'
:
'vessel:polarstern:hydrosweep_ds3'
}));
// Fill the textboxes in addevent with some usefull data.
// Fill the textboxes in addevent with some usefull data.
// TODO: store this in shared preferences so that last entered data reappears when restarting the app.
// TODO: store this in shared preferences so that last entered data reappears when restarting the app.
currentEvent
.
store
.
urn
=
'acoustic_backscatter_sensor:test'
;
currentEvent
.
store
.
urn
=
'acoustic_backscatter_sensor:test'
;
currentEvent
.
store
.
id
=
1234
;
currentEvent
.
store
.
id
=
4086
;
currentEvent
.
store
.
description
=
'blabla'
;
currentEvent
.
store
.
description
=
'blabla'
;
currentEvent
.
store
.
label
=
'PS129_ABC'
;
currentEvent
.
store
.
label
=
'PS129_ABC'
;
currentEvent
.
store
.
type
=
'Deployment'
;
currentEvent
.
store
.
type
=
'Deployment'
;
...
...
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