diff --git a/source/garmin-padelApp.mc b/source/garmin-padelApp.mc index d5c690d..005b674 100644 --- a/source/garmin-padelApp.mc +++ b/source/garmin-padelApp.mc @@ -3,24 +3,35 @@ import Toybox.Lang; import Toybox.WatchUi; class garmin_padelApp extends Application.AppBase { + private var _rules as RulesConfig; + private var _match as PadelMatch; + private var _hr as HeartRateProvider; - function initialize() { + public function initialize() { AppBase.initialize(); + _rules = new RulesConfig(); + _match = new PadelMatch(_rules); + _hr = new HeartRateProvider(); } - // onStart() is called on application start up - function onStart(state as Dictionary?) as Void { + public function onStart(state as Dictionary?) as Void { + _hr.onStart(); } - // onStop() is called when your application is exiting - function onStop(state as Dictionary?) as Void { + public function onStop(state as Dictionary?) as Void { + _hr.onStop(); } - // Return the initial view of your application here - function getInitialView() as [Views] or [Views, InputDelegates] { + public function getMatch() as PadelMatch { return _match; } + public function getHeartRate() as HeartRateProvider { return _hr; } + + public function resetMatch() as Void { + _match = new PadelMatch(_rules); + } + + public function getInitialView() as [Views] or [Views, InputDelegates] { return [ new garmin_padelView(), new garmin_padelDelegate() ]; } - } function getApp() as garmin_padelApp {