Skip to content

Commit

Permalink
#27,#31 - Cleaned up the reset case, providing a better distribution of
Browse files Browse the repository at this point in the history
intelligence and layering of control.  This version works fine in
Verifier with the watch GUI.  It also fixes the problem with the GPS
timeout events mentioned for the previous commit.
  • Loading branch information
John Wolfe committed Jun 12, 2014
1 parent bb879c0 commit f9697b2
Show file tree
Hide file tree
Showing 17 changed files with 137 additions and 64 deletions.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -640,14 +640,13 @@ INSERT INTO SPR_RS
VALUES ("1628d5aa-2f1f-40ad-9c81-0f1fff03aece",
'startStopPressed',
'',
'// create an instance of the workout timer if it does not exist
select any workoutTimer from instances of WorkoutTimer;
if (empty workoutTimer)
create object instance workoutTimer of WorkoutTimer;
workoutTimer.time = 0;
end if;
'// If necessary, create a workout session and everything required to
// support it. Then, forward this signal to the workout timer.

// forward message to the single instance of WorkoutTimer
WorkoutSession::create();

// Forward this signal, as an event, to the singleton instance of WorkoutTimer.
select any workoutTimer from instances of WorkoutTimer;
generate WorkoutTimer1:startStopPressed() to workoutTimer;',
1);
INSERT INTO C_EP_PROXY
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,19 @@ end for;',
1,
'',
"83ad7ae5-197c-4e8a-b9f5-b7d1c03db0b7");
INSERT INTO O_TFR
VALUES ("b8271f29-92d9-41bb-9c9e-d5f06e16ecaf",
"d2828038-110a-4559-8452-91651af0adcb",
'initialize',
'',
"ba5eda7a-def5-0000-0000-000000000000",
1,
'// Initialize this instance.

self.hasLocation = false;',
1,
'',
"9d05da67-cf3d-4220-b15a-0f2e28652584");
INSERT INTO O_NBATTR
VALUES ("67298965-4a8d-4a30-a7e0-82d1186498ca",
"d2828038-110a-4559-8452-91651af0adcb");
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -719,11 +719,11 @@ INSERT INTO GD_NCS
VALUES ("b8bf682c-54fe-4d15-8a5d-d3ce1bba7d47");
INSERT INTO DIM_ND
VALUES (241.000000,
181.000000,
216.000000,
"b8bf682c-54fe-4d15-8a5d-d3ce1bba7d47");
INSERT INTO DIM_GE
VALUES (4524.000000,
2772.000000,
2749.000000,
"b8bf682c-54fe-4d15-8a5d-d3ce1bba7d47",
"00000000-0000-0000-0000-000000000000");
INSERT INTO DIM_ELE
Expand All @@ -742,8 +742,8 @@ INSERT INTO DIM_CON
"b8bf682c-54fe-4d15-8a5d-d3ce1bba7d47");
INSERT INTO DIM_CON
VALUES ("a849f130-36e3-4242-a3d6-addc4f24fcda",
4571.000000,
2953.000000,
4572.000000,
2965.000000,
"b8bf682c-54fe-4d15-8a5d-d3ce1bba7d47");
INSERT INTO DIM_CON
VALUES ("f94db881-c4fb-4667-a7e8-6b7e6475c3f4",
Expand Down Expand Up @@ -971,8 +971,8 @@ INSERT INTO DIM_ND
0.000000,
"2493fded-d366-4959-a593-42aac0cee653");
INSERT INTO DIM_GE
VALUES (4573.000000,
2954.000000,
VALUES (4574.000000,
2966.000000,
"2493fded-d366-4959-a593-42aac0cee653",
"00000000-0000-0000-0000-000000000000");
INSERT INTO DIM_ELE
Expand All @@ -990,8 +990,8 @@ INSERT INTO DIM_ND
0.000000,
"939b4d18-b91e-4e49-9957-5b92b0d7e8ac");
INSERT INTO DIM_GE
VALUES (4533.000000,
3005.000000,
VALUES (4533.500000,
3011.000000,
"939b4d18-b91e-4e49-9957-5b92b0d7e8ac",
"00000000-0000-0000-0000-000000000000");
INSERT INTO DIM_ELE
Expand Down Expand Up @@ -1025,8 +1025,8 @@ INSERT INTO GD_LS
"0da43a5a-ccd1-479c-9012-8562b2bbab22");
INSERT INTO DIM_WAY
VALUES ("112545ad-719b-4937-8762-939c7d138f29",
4571.000000,
2953.000000,
4572.000000,
2965.000000,
"0c528f56-b0d4-4087-95ad-1da6bd8c3671",
"00000000-0000-0000-0000-000000000000",
"00000000-0000-0000-0000-000000000000");
Expand Down Expand Up @@ -1525,14 +1525,16 @@ INSERT INTO O_OBJ_PROXY
'WorkoutTimer',
1,
'WorkoutTimer',
'The WorkoutTimer controls the lifecycle of workouts. There should
never be more than one instance of this class at any time.
'As a singleton, no more than one instance of this class exists
at any given time.

The WorkoutTimer has the responsibility to start and stop the GPS
upon activation/deactivation of the timer.
Along with managing the stopwatch portion of the application,
this class also knows:
- Track points are stored only when the stopwatch is running.
- How to handle the lap/reset signal based on whether the
stopwatch is currently running.

While being active, the WorkoutTimer should keep track of elapsed
time. Time can only be reset while being inactive. ',
',
"00000000-0000-0000-0000-000000000000",
"c4cafc68-b5c2-f769-2746-b4aaac0bac84",
"00000000-0000-0000-0000-000000000000",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,69 @@ self.currentSpeed = 0.0;',
1,
'',
"0a3c180b-9d9a-457a-ab39-2114964b5908");
INSERT INTO O_TFR
VALUES ("3c3e9447-7fbe-40c3-835d-aa668b911afa",
"2522ffa2-db69-4807-ab45-06acf4cf893a",
'create',
'',
"ba5eda7a-def5-0000-0000-000000000000",
0,
'// Unless a workout session already exists, create and initialize a
// workout session, workout timer, and tracklog, and relate them all.

select any session from instances of WorkoutSession;

if ( empty session )

// Create a workout session.
create object instance session of WorkoutSession;
session.initialize();

// Create a workout timer.
create object instance workoutTimer of WorkoutTimer;
workoutTimer.initialize();

// Create a track log.
create object instance trackLog of TrackLog;
trackLog.initialize();

// Relate them all together.
relate trackLog to session across R4.''represents path for'';
relate workoutTimer to session across R8.''acts as the stopwatch for'';

end if;
',
1,
'',
"56c15cf0-cc7e-4c80-bed9-75d6c2f085dd");
INSERT INTO O_TFR
VALUES ("a20ddab3-779d-44fd-bea2-d5477b04a7b3",
"2522ffa2-db69-4807-ab45-06acf4cf893a",
'reset',
'',
"ba5eda7a-def5-0000-0000-000000000000",
1,
'// Reset this session, including the timer and track log.

// Reset the timer.
select one workoutTimer related by self->WorkoutTimer[R8.''is timed by''];
workoutTimer.initialize();

// Reset the track log.
select one trackLog related by self->TrackLog[R4.''captures path in''];
trackLog.clearTrackPoints();
trackLog.clearLapMarkers();
trackLog.initialize();

// Reset the session.
self.currentSpeed = 0.0;
self.currentHeartRate = 0;
self.accumulatedDistance = 0.0;
self.clearHeartRateSamples();
',
1,
'',
"3c3e9447-7fbe-40c3-835d-aa668b911afa");
INSERT INTO O_NBATTR
VALUES ("f9ea9144-48ad-45cb-82c6-6320037767b3",
"2522ffa2-db69-4807-ab45-06acf4cf893a");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,22 +224,13 @@ INSERT INTO SM_ACT
VALUES ("60d86bf9-08ac-4175-a409-67bec22595c3",
"c4cafc68-b5c2-f769-2746-b4aaac0bac84",
1,
'// reset
self.time = 0;
send UI::setTime(time: self.time);

select one trackLog related by self->WorkoutSession[R8.''acts as the stopwatch for'']->TrackLog[R4.''captures path in''];
trackLog.clearTrackPoints();
trackLog.clearLapMarkers();
'// Reset the session
select one session related by self->WorkoutSession[R8.''acts as the stopwatch for''];
session.clearHeartRateSamples();

// notify the UI of this change
generate Display_A2:refresh() to Display class;
session.reset();

unrelate session from trackLog across R4.''captures path in'';
unrelate self from session across R8.''acts as the stopwatch for'';
delete object instance trackLog;',
// Update the UI.
send UI::setTime(time: self.time);
generate Display_A2:refresh() to Display class;',
'');
INSERT INTO SM_MOAH
VALUES ("5eef4bed-2b88-4d47-8a15-7a7600a01f7c",
Expand Down Expand Up @@ -278,17 +269,7 @@ INSERT INTO SM_ACT
VALUES ("a9b703ef-5e80-4bc4-a3f9-ab8963f59c86",
"c4cafc68-b5c2-f769-2746-b4aaac0bac84",
1,
'// Create and initialize a workout session and relate it to this workout timer.
create object instance session of WorkoutSession;
relate self to session across R8.''acts as the stopwatch for'';
session.initialize();

// Create and initialize a track log and relate it to newly created session.
create object instance trackLog of TrackLog;
trackLog.hasLocation = false;
relate trackLog to session across R4.''represents path for'';

// Start the timer.
'// Start the timer.
self.activate();',
'');
INSERT INTO SM_TAH
Expand Down Expand Up @@ -395,11 +376,11 @@ INSERT INTO GD_SHP
INSERT INTO GD_NCS
VALUES ("8e6563ea-9d7f-4127-b681-f8875cfed071");
INSERT INTO DIM_ND
VALUES (200.000000,
150.000000,
VALUES (443.000000,
168.000000,
"8e6563ea-9d7f-4127-b681-f8875cfed071");
INSERT INTO DIM_GE
VALUES (4188.000000,
VALUES (4069.000000,
3096.000000,
"8e6563ea-9d7f-4127-b681-f8875cfed071",
"00000000-0000-0000-0000-000000000000");
Expand All @@ -409,7 +390,7 @@ INSERT INTO DIM_ELE
"00000000-0000-0000-0000-000000000000");
INSERT INTO DIM_CON
VALUES ("3df7e776-d69a-41cd-9306-ed74f6277a4d",
4388.000000,
4512.000000,
3126.000000,
"8e6563ea-9d7f-4127-b681-f8875cfed071");
INSERT INTO DIM_CON
Expand All @@ -420,7 +401,7 @@ INSERT INTO DIM_CON
INSERT INTO DIM_CON
VALUES ("fd311c02-b870-4c32-b866-79bd0b84d244",
4284.000000,
3246.000000,
3264.000000,
"8e6563ea-9d7f-4127-b681-f8875cfed071");
INSERT INTO GD_GE
VALUES ("99d164e6-709c-46e4-98c9-4b6892972d43",
Expand Down Expand Up @@ -507,7 +488,7 @@ INSERT INTO DIM_ND
24.000000,
"2627fdea-ff4b-4567-908b-9030c653614f");
INSERT INTO DIM_GE
VALUES (4148.000000,
VALUES (4272.000000,
2928.000000,
"2627fdea-ff4b-4567-908b-9030c653614f",
"00000000-0000-0000-0000-000000000000");
Expand All @@ -526,7 +507,7 @@ INSERT INTO DIM_ND
36.000000,
"2dce6731-5671-4446-ab99-b50371c3aefb");
INSERT INTO DIM_GE
VALUES (4514.000000,
VALUES (4576.000000,
3078.000000,
"2dce6731-5671-4446-ab99-b50371c3aefb",
"00000000-0000-0000-0000-000000000000");
Expand Down Expand Up @@ -561,7 +542,7 @@ INSERT INTO GD_LS
"63c9065f-c047-4cae-a6ea-e63e442b4f7a");
INSERT INTO DIM_WAY
VALUES ("2ebe9c15-a059-4350-b906-52cf6e3ee0c4",
4388.000000,
4512.000000,
3126.000000,
"83e96639-9df4-411d-a95a-bdcd0c6a8421",
"00000000-0000-0000-0000-000000000000",
Expand Down Expand Up @@ -792,7 +773,7 @@ INSERT INTO DIM_ND
"c589d244-e9a6-4358-8d83-9f4637cd5a92");
INSERT INTO DIM_GE
VALUES (4308.000000,
3364.500000,
3373.500000,
"c589d244-e9a6-4358-8d83-9f4637cd5a92",
"00000000-0000-0000-0000-000000000000");
INSERT INTO DIM_ELE
Expand Down Expand Up @@ -840,7 +821,7 @@ INSERT INTO DIM_WAY
INSERT INTO DIM_WAY
VALUES ("c146a899-8248-4fb5-a272-796bec7ec395",
4284.000000,
3246.000000,
3264.000000,
"bcab8b28-f5ee-4440-93e7-012734a36611",
"00000000-0000-0000-0000-000000000000",
"00000000-0000-0000-0000-000000000000");
Expand Down Expand Up @@ -1228,14 +1209,16 @@ INSERT INTO O_OBJ_PROXY
'WorkoutTimer',
1,
'WorkoutTimer',
'The WorkoutTimer controls the lifecycle of workouts. There should
never be more than one instance of this class at any time.
'As a singleton, no more than one instance of this class exists
at any given time.

The WorkoutTimer has the responsibility to start and stop the GPS
upon activation/deactivation of the timer.
Along with managing the stopwatch portion of the application,
this class also knows:
- Track points are stored only when the stopwatch is running.
- How to handle the lap/reset signal based on whether the
stopwatch is currently running.

While being active, the WorkoutTimer should keep track of elapsed
time. Time can only be reset while being inactive. ',
',
"00000000-0000-0000-0000-000000000000",
"c4cafc68-b5c2-f769-2746-b4aaac0bac84",
"00000000-0000-0000-0000-000000000000",
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ send HeartRateProvider::unregisterListener();',
1,
'',
"1363f0df-e630-4deb-a831-ed6cbcc9a974");
INSERT INTO O_TFR
VALUES ("e8f31568-926d-492c-b21d-afc08ba9b69c",
"8d4b82cf-ec16-4fd9-925b-0e51eb64a2f7",
'initialize',
'',
"ba5eda7a-def5-0000-0000-000000000000",
1,
'// Initialize this instance.

self.time = 0;',
1,
'',
"e44223c1-ae4c-4d58-a2d6-8d8f3cd56581");
INSERT INTO O_NBATTR
VALUES ("fd184578-6989-4116-a696-87c76c28c472",
"8d4b82cf-ec16-4fd9-925b-0e51eb64a2f7");
Expand Down
Binary file not shown.

0 comments on commit f9697b2

Please sign in to comment.