@@ -59,25 +59,25 @@ void alarm_manager_init() {
5959
6060int alarm_manager_add_alarm (time_t when , bool is_timer , char * name , bool conversational ) {
6161 if (s_manager .pending_alarm_count >= MAX_ALARMS ) {
62- APP_LOG (APP_LOG_LEVEL_WARNING , "Not scheduling alarm because MAX_ALARMS (%d) was already reached." , MAX_ALARMS );
62+ // APP_LOG(APP_LOG_LEVEL_WARNING, "Not scheduling alarm because MAX_ALARMS (%d) was already reached.", MAX_ALARMS);
6363 return E_OUT_OF_RESOURCES ;
6464 }
6565 WakeupId id = wakeup_schedule (when , when , true);
66- APP_LOG (APP_LOG_LEVEL_INFO , "wakeup_schedule(%d, %d, true) -> %d" , when , when , id );
66+ // APP_LOG(APP_LOG_LEVEL_INFO, "wakeup_schedule(%d, %d, true) -> %d", when, when, id);
6767 if (id == E_RANGE ) {
68- APP_LOG (APP_LOG_LEVEL_ERROR , "Scheduling alarm failed: E_RANGE (there's another event already scheduled then)" );
68+ // APP_LOG(APP_LOG_LEVEL_ERROR, "Scheduling alarm failed: E_RANGE (there's another event already scheduled then)");
6969 return id ;
7070 }
7171 if (id == E_INVALID_ARGUMENT ) {
72- APP_LOG (APP_LOG_LEVEL_ERROR , "Scheduling alarm failed: E_INVALID_ARGUMENT (the time is in the past)" );
72+ // APP_LOG(APP_LOG_LEVEL_ERROR, "Scheduling alarm failed: E_INVALID_ARGUMENT (the time is in the past)");
7373 return id ;
7474 }
7575 if (id == E_OUT_OF_RESOURCES ) {
76- APP_LOG (APP_LOG_LEVEL_ERROR , "Scheduling alarm failed: E_OUT_OF_RESOURCES (already eight alarms scheduled)" );
76+ // APP_LOG(APP_LOG_LEVEL_ERROR, "Scheduling alarm failed: E_OUT_OF_RESOURCES (already eight alarms scheduled)");
7777 return id ;
7878 }
7979 if (id < 0 ) {
80- APP_LOG (APP_LOG_LEVEL_ERROR , "Scheduling alarm failed: %d (Pebble internal error)" );
80+ // APP_LOG(APP_LOG_LEVEL_ERROR, "Scheduling alarm failed: %d (Pebble internal error)");
8181 return id ;
8282 }
8383 Alarm * alarm = bmalloc (sizeof (Alarm ));
@@ -187,7 +187,7 @@ static void prv_load_alarms() {
187187 int alarm_count = alarm_count_one < alarm_count_two ? alarm_count_one : alarm_count_two ;
188188
189189 if (alarm_count == 0 ) {
190- APP_LOG (APP_LOG_LEVEL_INFO , "No alarms known. Deleting all alarms to ensure consistency." );
190+ // APP_LOG(APP_LOG_LEVEL_INFO, "No alarms known. Deleting all alarms to ensure consistency.");
191191 wakeup_cancel_all ();
192192 return ;
193193 }
@@ -214,7 +214,7 @@ static void prv_load_alarms() {
214214 int j = 0 ;
215215 for (int i = 0 ; i < alarm_count ; ++ i ) {
216216 if (!wakeup_query (wakeup_ids [i ], NULL ) && (!launched_for_wakeup || launch_id != wakeup_ids [i ])) {
217- APP_LOG (APP_LOG_LEVEL_WARNING , "Alarm %d (scheduled for %d) no longer exists; dropping." , wakeup_ids [i ], times [i ]);
217+ // APP_LOG(APP_LOG_LEVEL_WARNING, "Alarm %d (scheduled for %d) no longer exists; dropping.", wakeup_ids[i], times[i]);
218218 did_drop_entries = true;
219219 continue ;
220220 }
@@ -236,14 +236,14 @@ static void prv_load_alarms() {
236236 s_manager .pending_alarm_count = j ;
237237
238238 if (did_drop_entries ) {
239- APP_LOG (APP_LOG_LEVEL_INFO , "Updating saved data after dropping entries." );
239+ // APP_LOG(APP_LOG_LEVEL_INFO, "Updating saved data after dropping entries.");
240240 prv_save_alarms ();
241241 }
242242}
243243
244244static void prv_save_alarms () {
245245 if (s_manager .pending_alarm_count == 0 ) {
246- APP_LOG (APP_LOG_LEVEL_INFO , "No alarms to save. Deleting everything." );
246+ // APP_LOG(APP_LOG_LEVEL_INFO, "No alarms to save. Deleting everything.");
247247 persist_delete (PERSIST_KEY_ALARM_COUNT_ONE );
248248 persist_delete (PERSIST_KEY_ALARM_TIMES );
249249 persist_delete (PERSIST_KEY_ALARM_WAKEUP_IDS );
@@ -276,7 +276,7 @@ static void prv_save_alarms() {
276276 persist_write_data (PERSIST_KEY_ALARM_IS_TIMERS , & is_timers , sizeof (is_timers ));
277277 persist_write_data (PERSIST_KEY_ALARM_NAMES , & names , sizeof (names ));
278278 persist_write_int (PERSIST_KEY_ALARM_COUNT_TWO , s_manager .pending_alarm_count );
279- APP_LOG (APP_LOG_LEVEL_INFO , "Wrote %d alarms." , s_manager .pending_alarm_count );
279+ // APP_LOG(APP_LOG_LEVEL_INFO, "Wrote %d alarms.", s_manager.pending_alarm_count);
280280}
281281
282282static void prv_remove_alarm (int to_remove ) {
@@ -331,21 +331,21 @@ static void prv_remove_alarm(int to_remove) {
331331
332332bool alarm_manager_maybe_alarm () {
333333 if (launch_reason () != APP_LAUNCH_WAKEUP ) {
334- APP_LOG (APP_LOG_LEVEL_DEBUG , "Not launched by APP_LAUNCH_WAKEUP" );
334+ // APP_LOG(APP_LOG_LEVEL_DEBUG, "Not launched by APP_LAUNCH_WAKEUP");
335335 return false;
336336 }
337- APP_LOG (APP_LOG_LEVEL_INFO , "Launched by APP_LAUNCH_WAKEUP" );
337+ // APP_LOG(APP_LOG_LEVEL_INFO, "Launched by APP_LAUNCH_WAKEUP");
338338 WakeupId id ;
339339 int32_t cookie ;
340340 if (!wakeup_get_launch_event (& id , & cookie )) {
341341 return false;
342342 }
343- APP_LOG (APP_LOG_LEVEL_INFO , "WakeupId: %d, cookie: %d" , id , cookie );
343+ // APP_LOG(APP_LOG_LEVEL_INFO, "WakeupId: %d, cookie: %d", id, cookie);
344344 for (int i = 0 ; i < s_manager .pending_alarm_count ; ++ i ) {
345345 Alarm * alarm = & s_manager .pending_alarms [i ];
346- APP_LOG (APP_LOG_LEVEL_INFO , "comparing %d == %d" , alarm -> wakeup_id , id );
346+ // APP_LOG(APP_LOG_LEVEL_INFO, "comparing %d == %d", alarm->wakeup_id, id);
347347 if (alarm -> wakeup_id == id ) {
348- APP_LOG (APP_LOG_LEVEL_INFO , "alarm found! alarming..." );
348+ // APP_LOG(APP_LOG_LEVEL_INFO, "alarm found! alarming...");
349349 alarm_window_push (alarm -> scheduled_time , alarm -> is_timer , alarm -> name );
350350 prv_remove_alarm (i );
351351 return true;
@@ -389,18 +389,18 @@ static void prv_handle_set_alarm_request(DictionaryIterator *iterator, void *con
389389 StatusCode result = alarm_manager_add_alarm (alarm_time , is_timer , name , true);
390390 prv_send_alarm_response (result );
391391 if (result == S_SUCCESS ) {
392- APP_LOG (APP_LOG_LEVEL_INFO , "Set alarm for %d (is timer: %d)" , alarm_time , is_timer );
392+ // APP_LOG(APP_LOG_LEVEL_INFO, "Set alarm for %d (is timer: %d)", alarm_time, is_timer);
393393 } else {
394- APP_LOG (APP_LOG_LEVEL_ERROR , "Setting alarm for %d failed: %d" , alarm_time , result );
394+ // APP_LOG(APP_LOG_LEVEL_ERROR, "Setting alarm for %d failed: %d", alarm_time, result);
395395 }
396396}
397397
398398static void prv_handle_get_alarm_request (int16_t is_timer , void * context ) {
399399 DictionaryIterator * iter ;
400- APP_LOG (APP_LOG_LEVEL_INFO , "Retrieving alarms or possibly timers (%d)." , is_timer );
400+ // APP_LOG(APP_LOG_LEVEL_INFO, "Retrieving alarms or possibly timers (%d).", is_timer);
401401 AppMessageResult result = app_message_outbox_begin (& iter );
402402 if (result != APP_MSG_OK ) {
403- APP_LOG (APP_LOG_LEVEL_ERROR , "Opening dict to respond failed: %d." , result );
403+ // APP_LOG(APP_LOG_LEVEL_ERROR, "Opening dict to respond failed: %d.", result);
404404 return ;
405405 }
406406 int write_index = 0 ;
@@ -416,10 +416,10 @@ static void prv_handle_get_alarm_request(int16_t is_timer, void* context) {
416416 dict_write_int32 (iter , MESSAGE_KEY_CURRENT_TIME , time (NULL ));
417417 result = app_message_outbox_send ();
418418 if (result != APP_MSG_OK ) {
419- APP_LOG (APP_LOG_LEVEL_ERROR , "Sending alarm list to phone failed: %d." , result );
419+ // APP_LOG(APP_LOG_LEVEL_ERROR, "Sending alarm list to phone failed: %d.", result);
420420 return ;
421421 }
422- APP_LOG (APP_LOG_LEVEL_INFO , "Sent alarm list." );
422+ // APP_LOG(APP_LOG_LEVEL_INFO, "Sent alarm list.");
423423}
424424
425425static void prv_handle_cancel_alarm_request (DictionaryIterator * iterator , void * context ) {
@@ -469,25 +469,25 @@ static void prv_send_alarm_response(StatusCode response) {
469469 DictionaryIterator * iter ;
470470 AppMessageResult result = app_message_outbox_begin (& iter );
471471 if (result != APP_MSG_OK ) {
472- APP_LOG (APP_LOG_LEVEL_ERROR , "Returning status code %d to phone failed in open: %d." , response , result );
472+ // APP_LOG(APP_LOG_LEVEL_ERROR, "Returning status code %d to phone failed in open: %d.", response, result);
473473 return ;
474474 }
475475 dict_write_int32 (iter , MESSAGE_KEY_SET_ALARM_RESULT , response );
476476 result = app_message_outbox_send ();
477477 if (result != APP_MSG_OK ) {
478- APP_LOG (APP_LOG_LEVEL_ERROR , "Returning status code %d to phone failed in send: %d." , response , result );
478+ // APP_LOG(APP_LOG_LEVEL_ERROR, "Returning status code %d to phone failed in send: %d.", response, result);
479479 return ;
480480 }
481- APP_LOG (APP_LOG_LEVEL_INFO , "Sent alarm response %d" , response );
481+ // APP_LOG(APP_LOG_LEVEL_INFO, "Sent alarm response %d", response);
482482}
483483
484484static void prv_wakeup_handler (WakeupId wakeup_id , int32_t cookie ) {
485- APP_LOG (APP_LOG_LEVEL_INFO , "it's the wakeup handler! (%d, %d)" , wakeup_id , cookie );
485+ // APP_LOG(APP_LOG_LEVEL_INFO, "it's the wakeup handler! (%d, %d)", wakeup_id, cookie);
486486 for (int i = 0 ; i < s_manager .pending_alarm_count ; ++ i ) {
487487 Alarm * alarm = & s_manager .pending_alarms [i ];
488- APP_LOG (APP_LOG_LEVEL_INFO , "comparing %d == %d" , alarm -> wakeup_id , wakeup_id );
488+ // APP_LOG(APP_LOG_LEVEL_INFO, "comparing %d == %d", alarm->wakeup_id, wakeup_id);
489489 if (alarm -> wakeup_id == wakeup_id ) {
490- APP_LOG (APP_LOG_LEVEL_INFO , "alarm found! alarming..." );
490+ // APP_LOG(APP_LOG_LEVEL_INFO, "alarm found! alarming...");
491491 alarm_window_push (alarm -> scheduled_time , alarm -> is_timer , alarm -> name );
492492 prv_remove_alarm (i );
493493 break ;
0 commit comments