Skip to content
Snippets Groups Projects
main.dart 3.37 KiB
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import 'datamodel.dart';
import 'addevent.dart';
import 'viewevents.dart';
import 'overview.dart';
import 'configuration.dart';

void main() {
  
  EventStoreInstance events = EventStoreInstance();
  EventTypeStoreInstance eventTypes = EventTypeStoreInstance();
  EventCurrentInstance currentEvent = EventCurrentInstance();
  DeviceStoreInstance availableDevices = DeviceStoreInstance();

  //Reset old data
  events.reset();
  eventTypes.reset();
  currentEvent.reset();
  availableDevices.reset();


  // Add some dummy devices
  // TODO: load from shared preferences.
  // TODO: this shall be requested from sensor.awi.de after selecting a collection in configuration.
  availableDevices.store.add(Device.fromJson({'id': 8311, 'urn':'station:neumayer_iii:awi_snow_sampler_1'}));
  availableDevices.store.add(Device.fromJson({'id': 4086, 'urn':'acoustic_backscatter_sensor:test'}));
  availableDevices.store.add(Device.fromJson({'id': 1393, 'urn':'vessel:polarstern:hydrosweep_ds3'}));

  // 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.
  currentEvent.store.urn = 'acoustic_backscatter_sensor:test';
  currentEvent.store.id = 4086;
  currentEvent.store.description = 'blabla';
  currentEvent.store.label = 'PS129_ABC';
  currentEvent.store.type = 'Deployment';
  
  //Add some dummy events to eventstore. Just development purpose. TODO: Remove after development.
  events.store.add(Event.fromJson({
    'id': 8311,
    'urn': 'station:neumayer_iii:awi_snow_sampler_1',
    'label': 'SML_KO21_SC01',
    'type': 'Deployment',
    'description': 'Remi tool Tag1 1 Traverse',
    'status': 'PENDING'
  }));
  events.store.add(Event.fromJson({
    'id': 8311,
    'urn': 'station:neumayer_iii:awi_snow_sampler_1',
    'label': 'SML_KO21_SC01',
    'type': 'Deployment',
    'description': 'Remi tool Tag1 1 Traverse',
    'status': 'PENDING'
  }));
  events.store.add(Event.fromJson({
    'id': 8311,
    'urn': 'station:neumayer_iii:awi_snow_sampler_1',
    'label': 'SML_KO21_SC01',
    'type': 'Deployment',
    'description': 'Remi tool Tag1 1 Traverse',
    'status': 'PENDING'
  }));
  events.store.add(Event.fromJson({
    'id': 8311,
    'urn': 'station:neumayer_iii:awi_snow_sampler_1',
    'label': 'SML_KO21_SC01',
    'type': 'Deployment',
    'description': 'Remi tool Tag1 1 Traverse',
    'status': 'PENDING'