Esempio n. 1
0
        public override void OnCreate()
        {
            // This method is optional to implement
            base.OnCreate();
            Log.Debug(TAG, "OnCreate");



            mapref        = Sensors.MapsPage.mapRef;
            lowController = new Wifi_coarse(this);

            //et = new EventTrigger();
            //te = new Threadevent(et, this);

            lowController.Start();
            //startTrack();

            tz = new Sensors.TipZemljevida();
            tz.attach(tz);



            //Intent intent = new Intent(this, typeof(Wifi_coarse));
            //StartActivity(intent);

            /*var startTimeSpan = TimeSpan.Zero;
             * var periodTimeSpan = TimeSpan.FromMinutes(5);
             *
             * var timer = new System.Threading.Timer((e) =>
             * {
             *  track();
             * }, null, startTimeSpan, periodTimeSpan);
             * //timestamper = new UtcTimestamper();*/
        }
Esempio n. 2
0
        public override void OnCreate()
        {
            mBinder = new LocalBinder(this);

            base.OnCreate();

            Log.Debug(TAG, "OnCreate");


            //Toast.MakeText(this, "Pride do Servisa", ToastLength.Long).Show();

            /*if (MainActivity.InstanceCount < 1)
             * {
             *  StartActivity(new Intent(this,typeof(MainActivity)));
             * }*/

            //handler = new Handler();
            handlermain = new Handler(Looper.MainLooper);



            //var test = ((FileHelper)new FileHelper()).GetLocalFilePath("BazaGpsPodatkov.db3");


            lowController = new Wifi_coarse(this);


            lowController.Start();
            //StartTrack(); //ta ali pa lowcontroller.start() je lahko naenkrat przgan drugac bo exception unhandled

            tz = new Sensors.TipZemljevida(); // za hendlanje izpisa na mapspageu
            tz.attach(tz);


            tdp = new TriDimPodatek();
            gp  = new GpsPodatek();
            gp.resetAccelerationData();
            gp.resetLinearAccelerationData();

            //LastPosition = null;

            try
            {
                //LoadSave<string> ls = new LoadSave<string>();
                //username = ls.LoadJson("username.json");
                Json js = new Json();
                username = js.LoadJson("username.json");
            }catch (Exception e)
            {
                username = Guid.NewGuid().ToString();
            }

            lai = new LinearAccelerationImplementation();


            lai.SensorValueChanged += (s, a) =>
            {
                //TODO - dodej še 12 polj za podatke linearnega senzorja v gpspodatek DB

                switch (a.SensorType)
                {
                case SensorType.Accelerometer:
                    gp.CheckAccelerationData(((MotionVector)a.Value).X, ((MotionVector)a.Value).Y, ((MotionVector)a.Value).Z, DateTimeOffset.Now);
                    tdp.Set(TriDimPodatek.Tip.Accelerometer, ((MotionVector)a.Value).X, ((MotionVector)a.Value).Y, ((MotionVector)a.Value).Z, DateTimeOffset.Now);
                    break;

                case SensorType.LinearAcceleration:
                    gp.CheckLinearAccelerationData(((MotionVector)a.Value).X, ((MotionVector)a.Value).Y, ((MotionVector)a.Value).Z, DateTimeOffset.Now);
                    tdp.Set(TriDimPodatek.Tip.LinearAcceleration, ((MotionVector)a.Value).X, ((MotionVector)a.Value).Y, ((MotionVector)a.Value).Z, DateTimeOffset.Now);
                    break;

                default:
                    Console.WriteLine("noben senzor ne ustreza temu");
                    return;
                }

                Database3D.SaveItemAsync(tdp);
            };

            try
            {
                sendToServer();
            }catch (Exception e)
            {
            }
        }