prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (action) { timeline_invoke_action(notification, action, NULL); } else { char uuid_buffer[UUID_STRING_BUFFER_LENGTH]; uuid_to_string(&notification->header.id, uuid_buffer); PBL_LOG(LOG_LEVEL_ERROR, "Failed to load action for dismissal from %s", uuid_buffer); }
case FullStyleLower12h: case FullStyleCapital12h: if (with_fulltime) { time_fmt = i18n_noop("Yesterday, %l:%M %p"); } else { time_fmt = i18n_noop("Yesterday"); } break; case FullStyleLower24h: case FullStyleCapital24h: if (with_fulltime) { ...
str_fmt = i18n_noop("In %lu minutes"); } snprintf(buffer, buf_size, i18n_get(str_fmt, buffer), num_minutes); } else if (difference >= -(SECONDS_PER_HOUR * max_relative_hrs)) { const int num_hrs = prv_round(-difference, SECONDS_PER_HOUR, RoundTypeHalfDown) / SECONDS_PER_HOUR; const char...
i18n_free_all(buffer); } size_t clock_get_date(char *buffer, int buf_size, time_t timestamp) { return prv_format_time(buffer, buf_size, i18n_noop("%m/%d"), timestamp); } size_t clock_get_day_date(char *buffer, int buf_size, time_t timestamp) { return prv_format_time(buffer, buf_size, i18n_noop("%d"), timestamp...
_r1_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, 1); graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT_NXNY, RADIUS_SMALL); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_origin_aa_r1_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // Testing of t...
(&ctx.dest_bitmap, "draw_circle_offset_aa_r8_no_clip.${BIT_DEPTH_NAME}.pbi")
AppName, "GMail"); TimelineItemActionGroup action_group = { .num_actions = 0, }; // Store them in the DB char *key = "key1"; int key_len = strlen(key); ios_notif_pref_db_store_prefs((uint8_t *)key, key_len, &attr_list, &action_group); // Make sure we can get the data back iOSNotifPrefs *notif_pref...
(&is_dirty)
, S_SUCCESS); cl_assert(is_dirty); dirty_list = ios_notif_pref_db_get_dirty_list(); cl_assert(dirty_list); cl_assert_equal_i(list_count((ListNode *)dirty_list), 2); // Mark the final 2 items as synced ios_notif_pref_db_mark_synced((uint8_t *)keys[3], key_len); ios_notif_pref_db_mark_synced((uint8_t *)ke...
(sector_start, subsector_start)
; int32_t end_addr = MAX(sector_end, subsector_end); if (sector_start >= sector_end) { // Can't erase any full sectors; just erase subsectors the whole way. start_addr = subsector_start; end_addr = subsector_end; } if (start_addr == end_addr) { // Nothing to do! on_complete(context, S_NO_A...
}, { -1400, 200, 16}, { -1272, 120, 16}, { -1296, 120, 64}, { -1224, 56, 72}, { -976, -32, 32}, { -1280, -280, 16}, { -1064, -360, -192}, { -1408, -176, -280}, { -1792, 208, -504}, { -1752, 88, -216}, { -1632, -8, 64}, { -1552, 160, 96}, { -1544, 416, 120}, // 28 ...
{ -1392, 16, -160}, { -1232, 40, -32}, { -1168, 176, 48}, { -1208, 152, 80}, // 33 seconds { -1432, 248, 104}, { -1696, 344, 48}, { -2016, 280, 304}, { -1808, 1504, 240}, { -1392, 760, -240}, { -976, 664, -200}, { -984, 800, -248}, { -1328, 744, -328}, { -1744, 37...
{ -1776, 64, 88}, { -1376, 112, -24}, { -1240, -72, 64}, { -1128, 136, -8}, { -1040, 152, 24}, { -1056, -24, 200}, { -1224, -528, 624}, { -1400, -376, 424}, { -1480, -480, 680}, { -1512, 72, -496}, { -1624, 88, -680}, { -1880, -280, -632}, { -2608, -352, -496}, {...
l_strdup(name)) == NULL) { res = E_OUT_OF_MEMORY; goto cleanup; } file->namelen = strlen(name); file->start_offset = FILEDATA_LEN + file->namelen; if (is_tmp || ((res == E_DOES_NOT_EXIST) && ((op_flags & OP_FLAG_WRITE) != 0))) { res = pfs_open_handle_create_request(fd, file_type, start_size); } e...
{ pfs_read(fd, buf, to_copy); prv_flash_write(buf, to_copy, base_addr + i); }
} } kernel_free(buf); return (S_SUCCESS); } static void recover_region_from_file(int fd) { GCData gcdata; pfs_seek(fd, 0, FSeekSet); pfs_read(fd, &gcdata, sizeof(gcdata)); if (!GCDATA_VALID(gcdata.flags)) { // we never completed setting up the migration goto done; } // at this point ...
yer, image, true); s_phone_ui_data->current_icon = image; s_phone_ui_data->current_icon_id = resource; #endif } #if !PLATFORM_TINTIN static void prv_update_color_boundary(void *subject, int16_t boundary) { s_phone_ui_data->bg_color.boundary = boundary; layer_mark_dirty(&s_phone_ui_data->window.layer); } stati...
{ phone_format_phone_number(caller_text, s_phone_ui_data->caller_id_text_buf, NAME_BUFFER_LENGTH); text_layer_set_overflow_mode(&s_phone_ui_data->caller_id_text_layer, GTextOverflowModeWordWrap); }
else { phone_format_caller_name(caller_text, s_phone_ui_data->caller_id_text_buf, NAME_BUFFER_LENGTH); } if (s_phone_ui_data->style->large_caller_id) { caller_id_font = s_phone_ui_data->name_font; lines++; } else if (prv_has_long_name(s_phone_ui_data->name_font)) { caller_id_font = s_phone_ui_da...
{ 0, -88, -856}, { -64, -24, -864}, { -64, -88, -792}, { -48, -40, -672}, { -72, -56, -584}, { -104, 56, -656}, { -176, 48, -640}, { -368, 240, -952}, { -320, 160, -768}, { -440, 216, -864}, { -560, 384, -1072}, { -680, 40, -1256}, { -592, 232, -1200}, { -416, 11...
{ -808, 496, -296}, { -824, 520, -336}, { -984, 488, -304}, { -1152, 504, -320}, { -1432, 624, -472}, { -1224, 520, -224}, { -1040, 472, -240}, { -848, 392, -152}, { -520, 304, -128}, { -352, 344, -224}, { -384, 272, -120}, { -448, 208, -8}, { -496, 240, -24}, // ...
{ -1000, 552, -128}, { -832, 576, -288}, { -744, 392, -32}, { -560, 320, -16}, { -536, 296, -16}, { -480, 288, 16}, { -456, 264, 24}, { -456, 280, 56}, { -408, 312, 24}, { -520, 336, 0}, { -840, 456, -88}, { -880, 424, -16}, { -1120, 488, -80}, { -1360, 744, -448...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
window_single_click_subscribe(BUTTON_ID_SELECT, prv_select_click_handler)
; window_set_click_context(BUTTON_ID_UP, context); window_set_click_context(BUTTON_ID_SELECT, context); window_set_click_context(BUTTON_ID_DOWN, context); } static void prv_window_load(Window *window) { MorphSquareDemoData *data = window_get_user_data(window); Layer *window_layer = window_get_root_layer(wind...
{ "Africa", "America", "Antarctica", "Asia", "Atlantic", "Australia", "Eur...
(region_offset + 1 /* continent index */, city_name, remaining_size)
; // FIXME: Perhaps we should refactor this to do one read instead of two? The information is // right beside each other and it's pretty wasteful to do a 1 byte read followed by a 15 byte // read as separate reads. return true; } bool timezone_database_load_dst_rule(uint8_t dst_id, TimezoneDSTRule *start, Ti...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ GenericAttribute *uuid_attr = generic_attribute_find_attribute(attr_list, VEAttributeIdAppUuid, attr_list_size); if (app_initiated && !uuid_attr) { PBL_LOG(LOG_LEVEL_WARNING, "No ...
static void prv_handle_dictation_result(VoiceSessionResultMsg *msg, size_t size) { const size_t attr_list_size = size - sizeof(VoiceSessionResultMsg) + sizeof(GenericAttributeList); const bool app_initiated = (msg->flags.app_initiated == 1); Uuid *app_uuid = NULL; if (!prv_handle_result_common(msg->result, a...
equal(&t, &t_c)); // Test Rotation Matrix int32_t angle = DEG_TO_TRIGANGLE(45); t = GTransformRotation(angle); int32_t cosine = cos_lookup(angle); int32_t sine = sin_lookup(angle); t_c = GTransform(GTransformNumberFromNumber((float)cosine / TRIG_MAX_RATIO), GTransformNumberFromNumber(-...
gtransform_is_equal(&t_new, &t_c)
); cl_assert(gtransform_is_equal(&t1, &t2)); // ensure t1 has not changed gtransform_translate_number(&t_new, &t1, 10, 200); cl_assert(gtransform_is_equal(&t_new, &t_c)); cl_assert(gtransform_is_equal(&t1, &t2)); // ensure t1 has not changed // Test pointer re-use gtransform_translate(&t1, &t1, GTransform...
TE_SCRIPT_EXPECT_ERROR( "d.toLocaleTimeString('en-us');", "TypeError: Unsupported locale" ); EXECUTE_SCRIPT( "var d = new Date();\n" "d.toLocaleDateString(undefined);\n" ); EXECUTE_SCRIPT_EXPECT_ERROR( "d.toLocaleDateString('de');", "TypeError: Unsupported locale" ); EXECUTE_SCRIPT...
("s", "Monday")
; EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {month: 'numeric'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "7"); EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {month: '2-digit'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "07"); EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {month: 'short'});"); ASSER...
ModalPriorityDiscreet + 3; window_set_click_config_provider(window1, prv_click_config_provider); window_set_click_config_provider(window2, prv_click_config_provider); modal_window_push(window1, base_priority, false); cl_assert_equal_i(window1->on_screen, true); modal_window_push(window2, base_priority -...
window_is_transparent(window2)
, true); WindowStack *app_stack = app_state_get_window_stack(); WindowStack *modal_stack = modal_manager_get_window_stack(ModalPriorityGeneric); cl_check(app_stack); cl_check(modal_stack); cl_check(!app_stack->list_head); cl_check(!modal_stack->list_head); // Switch to the app state to push a window ...
de_from_config(layout, config->nodes[i]); graphics_text_node_container_add_child(container_node, node); } prv_set_text_node_extent(&container_node->node, &config->extent); } static GTextNodeHorizontal *prv_create_horizontal_container_node_from_config( const LayoutLayer *layout, const LayoutNodeHorizontalCo...
graphics_text_node_container_add_child(&vertical_node->container, &paragraph_node->node); } return vertical_node; }
static GTextNode *prv_create_headings_paragraphs_node( const LayoutLayer *layout, const LayoutNodeHeadingsParagraphsConfig *config) { GTextNode *node = &layout_create_headings_paragraphs_node(layout, config)->container.node; if (node) { prv_set_text_node_extent(node, (LayoutNodeExtentConfig *)config); }...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
recognizer_is_active(recognizer)
) { return true; } // If there is another recognizer that has started recognizing a gesture, then skip this // recognizer, unless it has been configured to operate simultaneously with the recognizer // that has started recognizing a gesture. if (ctx->triggered && !recognizer_should_evaluate_simultaneously...
asks_set_current(PebbleTask_KernelMain); } void test_window_stack__cleanup(void) { stub_pebble_tasks_set_current(PebbleTask_App); app_window_stack_pop_all(false); stub_pebble_tasks_set_current(PebbleTask_KernelMain); modal_manager_pop_all(); fake_animation_cleanup(); cl_assert_equal_i(fake_pbl_malloc_...
cl_assert_equal_i(windows[1]->on_screen, false)
; cl_assert_equal_i(windows[2]->on_screen, true); window_stack_pop_all(stack, true); cl_assert_equal_i(window_stack_count(stack), 0); cl_assert_equal_i(windows[0]->on_screen, false); cl_assert_equal_i(windows[1]->on_screen, false); cl_assert_equal_i(windows[2]->on_screen, false); for (uint8_t idx = 0; ...
--------------------------------- Animation *animation_private_animation_init(AnimationPrivate *animation) { AnimationState *state = prv_animation_state_get(PebbleTask_Current); *animation = (AnimationPrivate) { .handle = (Animation *)(uintptr_t)(++state->aux->next_handle), .duration_ms = ANIMATION_DEFAULT...
if (animation_private_using_legacy_2(state)) { // We need to enable other applib modules like scroll_layer, menu_layer, etc. which are // compiled to use the 3.0 animation API to work with 2.0 apps. PBL_ASSERTN(!auto_destroy); return true; }
AnimationPrivate *animation = prv_find_animation_by_handle(state, animation_h, false /*quiet*/); if (!prv_is_mutable(state, animation)) { return false; } animation->auto_destroy = auto_destroy; return true; } // -----------------------------------------------------------------------------------------...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
gdraw_command_frame_draw_processed(ctx, dcs_reel->sequence, dcs_reel->current_frame, offset, NULL_SAFE_FIELD_ACCESS(processor, draw_command_processor, NULL))
; } static GDrawCommandSequence *prv_get_gdraw_command_sequence(KinoReel *reel) { if (reel) { return ((KinoReelImplPDCS*)reel)->sequence; } return NULL; } static GDrawCommandList *prv_get_gdraw_command_list(KinoReel *reel) { KinoReelImplPDCS *dcs_reel = (KinoReelImplPDCS *)reel; if (dcs_reel) { retu...
{ prv_resume_transfer(bus, false /* !generate_start */); }
if ((i2c->ISR & I2C_ISR_TC) != 0) { return prv_end_transfer_irq(bus, I2CTransferEvent_TransferComplete); } break; case I2CTransferState_Complete: if (i2c->ISR & I2C_ISR_TXE) { // We seem to get a spurious interrupt after the last byte is sent // There is no bit to s...
ATCHDOG_FREERTOS_IRQHandler CAN2_SCE_IRQHandler static void prv_task_watchdog_feed(void); static void prv_log_stuck_timer_task(RebootReason *reboot_reason) { void* current_cb = new_timer_debug_get_current_callback(); if (!current_cb) { PBL_LOG_SYNC(LOG_LEVEL_WARNING, "No timer in progress."); return; ...
PBL_LOG(LOG_LEVEL_INFO, "Starting App Throttling for %s", curr_task)
; } else { PBL_LOG(LOG_LEVEL_DEBUG, "Starting App Throttling for %s", curr_task); } analytics_inc(ANALYTICS_DEVICE_METRIC_APP_THROTTLED_COUNT, AnalyticsClient_System); vTaskPrioritySet(pebble_task_get_handle_for_task(PebbleTask_App), tskIDLE_PRIORITY | portPRIVILEGE_BIT); } static void prv_system_ta...
TY_ALGORITHM_MAX_SAMPLES, num_samples); // Allocate space for the samples uint16_t req_size = sizeof(ActivityFeedSamples) + chunk_size * sizeof(AccelRawData); ActivityFeedSamples *context = kernel_malloc(req_size); if (!context) { PBL_LOG(LOG_LEVEL_ERROR, "Not enough memory"); return false;...
{ *num_records = 0; *data_bytes = 0; *minutes = 0; }
return success; } // ------------------------------------------------------------------------------------------------ // Fill the sleep file typedef struct { bool success; bool completed; } ActivityFillSleepFileContext; static void prv_fill_minute_file_system_cb(void *context_param) { ActivityFillSleepFileC...
et_count(); default: return 0; } } static int16_t menu_get_header_height_callback(MenuLayer *menu_layer, uint16_t section_index, void *data) { return MENU_CELL_BASIC_HEADER_HEIGHT; } static void menu_draw_heade...
(window_layer, menu_layer_get_layer(s_menu_layer))
ed; } else if (response_msg->response == ResponseNack) { ++s_nacks_received; } } void test_put_bytes__initialize(void) { fake_pb_storage_mem_reset(); fake_pb_storage_mem_set_crc(EXPECTED_CRC); fake_comm_session_init(); fake_event_reset_count(); Transport *transport = fake_transport_create(TransportD...
cl_assert_equal_b(event.put_bytes.failed, false)
; } void test_put_bytes__init_while_already_busy(void) { prv_receive_init(VALID_OBJECT_SIZE, ObjectFirmware); prv_receive_init(VALID_OBJECT_SIZE, ObjectFirmware); assert_nack_count(1); } void test_put_bytes__init_too_large(void) { prv_receive_init(UINT_MAX, ObjectFirmware); // Fail due to massive total_siz...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ AppData *data = ctx; text_layer_set_text(&data->thumbsup_layer, ""); }
static void prv_show_thumbsup(AppData *data) { app_timer_cancel(data->thumbsup_timer); text_layer_set_text(&data->thumbsup_layer, "👍"); data->thumbsup_timer = app_timer_register(1000, prv_hide_thumbsup, data); } static void prv_set_tap_text(AppData *data, uint32_t count, AccelAxisType axis) { char axes[] = ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
("ASSERT: ")
; dbgserial_print(expr); dbgserial_print(" "); dbgserial_print(filename); dbgserial_print(":"); dbgserial_print_hex(line_number); if (fmt) { dbgserial_print(" "); dbgserial_print(fmt); } dbgserial_putstr(""); reset_due_to_software_failure(); } static __attribute__((noreturn)) void handle_pa...
VENT); if (is_subscribed) { cl_assert(info->handler); } else { cl_assert_equal_p(NULL, info->handler); } } void test_ble_hrm__cleanup(void) { ble_hrm_deinit(); prv_assert_event_service_subscribed(false); // hrm manager sub vs unsub calls should be the same, there should be no subscription any more...
(s_device_b, true)
; cl_assert_equal_b(false, ble_hrm_is_sharing_to_connection(&s_conn_b)); prv_assert_permissions_ui_and_respond(true /* is_granted */); cl_assert_equal_b(true, ble_hrm_is_sharing_to_connection(&s_conn_b)); prv_assert_event_service_subscribed(true); cl_assert_equal_i(s_hrm_manager_subscribe_with_callback_call_c...
(s_data.pins_added, 1)
; // Make sure we still trigger properly after a power cycle activity_insights_init(rtc_get_time()); rtc_set_time(rtc_get_time() + 2 * SECONDS_PER_HOUR); prv_add_nap_session(0.5, 1.5); activity_insights_process_minute_data(rtc_get_time()); cl_assert_equal_i(s_data.pins_added, 2); #endif } // Make sure tha...
13 11:40:00 PST 2015 rtc_set_time(1421178000); fake_pbl_malloc_clear_tracking(); cl_assert_equal_i(fake_pbl_malloc_num_net_allocs(), 0); timeline_init(&head); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, 1421178000), 0); cl_assert_equal_i(prv_num_items(iter...
(&state.pin.header.id, &s_items[5].header.id)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&(text_layer->layer))
; } void text_layer_init(TextLayer *text_layer, const GRect *frame) { text_layer_init_with_parameters(text_layer, frame, NULL, NULL, GColorBlack, GColorWhite, GTextAlignmentLeft, GTextOverflowModeTrailingEllipsis); } TextLayer* text_layer_create(GRect frame) { TextLayer* layer = ...
.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * l...
(client == AnalyticsClient_Ignore || client != AnalyticsClient_System)
; const Uuid uuid_system = UUID_SYSTEM; if (!uuid) { uuid = analytics_uuid_for_client(client); if (!uuid) { // There is a brief period of time where no app is running, which we // attribute to the system UUID. For now, this lets us track how // much time we are missing, altho...
ons and * limitations under the License. */ #include "clar.h" #include "services/normal/timezone_database.h" #include "services/common/clock.h" #include "../timezone_fixture.auto.h" #include "stubs_logging.h" #include "stubs_passert.h" #include <string.h> //! Find a region ID for the given region name. //! @ret...
cl_assert(result)
; cl_assert_equal_i(tz_info.dst_id, 0); // No DST cl_assert_equal_i(tz_info.tm_gmtoff, 6 * 60 * 60); // +6 hours } }
he file and create a new one PBL_LOG(LOG_LEVEL_ERROR, "Unknown settings file verison %"PRIu16"", version); } if (result != S_SUCCESS) { // Delete the old file and create a new one if migration failed activity_private_settings_close(file); pfs_remove(ACTIVITY_SETTINGS_FILE_NAME); file = activity...
{ bool need_history_update_event; uint16_t cur_day_index; mutex_lock_recursive(s_activity_state.mutex); { cur_day_index = time_util_get_day(utc_sec); need_history_update_event = (cur_day_index != s_activity_state.cur_day_index); // Call the activity sessions minute handler activity_sessions_prv...
// Send the history update event now if history has changed if (need_history_update_event) { PBL_LOG(LOG_LEVEL_DEBUG, "Sending history update event"); PebbleEvent e = { .type = PEBBLE_HEALTH_SERVICE_EVENT, .health_event = { .type = HealthEventSignificantUpdate, .data.significant...
open_and_lock(&file)) { return false; } bool alarm_is_scheduled = false; AlarmConfig config; bool rv = prv_alarm_get_config(&file, id, &config); if (!rv) { goto cleanup; } if (time_out) { CronJob cron; *time_out = prv_build_cron(&config, &cron) - rtc_get_time(); } alarm_is_scheduled ...
prv_file_close_and_unlock(&file)
; } // ---------------------------------------------------------------------------------------------- bool alarm_can_schedule(void) { SettingsFile file; if (!prv_file_open_and_lock(&file)) { return false; } bool rv = false; for (int i = 0; i < MAX_CONFIGURED_ALARMS; ++i) { AlarmConfig config; if...
etNotificationAttributesMsg*)s_this_message_has_no_content_response)->notification_uid; const uint32_t multiple_complete_dict_uid = ((GetNotificationAttributesMsg*)s_multiple_complete_dicts)->notification_uid; const uint32_t split_timestamp_uid = ((GetNotificationAttributesMsg*)s_split_timestamp_dict_part_one)->not...
prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_split_timestamp_dict_part_two), (uint8_t*) s_split_timestamp_dict_part_two)
; s_num_ds_notifications_received += 2; } else if (uid == message_dict_uid) { prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_message_dict), (uint8_t*) s_message_dict); s_num_ds_notifications_received++; } else if (uid == app_name_title_dict_uid) { prv_fake_receiving_ds_notification(ARRAY_LENGTH(s...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
list_append(head, (ListNode *)job)
; } else { session->send_queue_head = job; } // Schedule to let the transport to send the enqueued data: comm_session_send_next(session); } unlock: bt_unlock(); } // ------------------------------------------------------------------------------------------------- // Interface towards Transpor...
c_avg(data, HealthMetricActiveSeconds, "Active seconds:"); } // ----------------------------------------------------------------------------------------- static void prv_debug_cmd_intraday_active_seconds_avg(int index, void *context) { HealthAPITestAppData *data = context; prv_intraday_metric_avg(data, HealthMetr...
strcpy(data->debug_card.dialog_text, "HR stats")
; // Get various stats time_t end_time = time(NULL); // List of time ranges typedef struct { uint32_t seconds; char *desc; } TimeRange; TimeRange ranges[] = { {1 * SECONDS_PER_HOUR, "1 hour"}, {30 * SECONDS_PER_MINUTE, "30 min"}, }; unsigned num_ranges = ARRAY_LENGTH(ranges); for (...
// Shift UTC time back by 75 days rtc_set_time(rtc_get_time() - 75 * SECONDS_PER_DAY - 6 * SECONDS_PER_HOUR); // Sleep a little more prv_feed_light_sleep_min(10); // Restore time to just after we started sleeping before rtc_set_time(start_sleep_time + 5 * SECONDS_PER_MINUTE); // Sleep a little more, sho...
PBL_LOG(LOG_LEVEL_DEBUG, "Found %d sleep sessions and %d nap sessions", sleep_count, nap_count); if (nap_count > 0 || sleep_count == 0) { PBL_LOG(LOG_LEVEL_ERROR, "FAILED: expected only sleep but got %d naps and %d sleep", nap_count, sleep_count); prv_test_end(context, false); return; } ...
// ------------------------------------------------------------------------------- static void prv_test_sleep_reward(void *context) { bool passed = true; const ActivityScalarStore AVERAGE_SLEEP = 1 * MINUTES_PER_HOUR; const ActivityScalarStore GOOD_SLEEP = 2 * MINUTES_PER_HOUR; // Hack to get around midnigh...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ for (int i = 0; i < (int)num_lines; i++) { GRect box = { .origin = gpoint_add(GPoint((spacing + width) * i - width, offsets_y ? offsets_y[i] : 0), offset), .size = { width, heights[i] }, }; graphics_fill_rect(ctx, &box); } }
NUTES_PER_RECORD records each time. We know that the activity algorithm code only // writes a new minute data record to flash once every ALG_MINUTES_PER_RECORD minutes, but // the records that are not yet saved to flash should be correctly retrieved from RAM. time_t oldest_to_fetch = rtc_get_time() - (ALG_MINUTES...
{ // Create a 4 hour session at 1pm ==> should be regular sleep ActivitySession sessions[] = { { .start_utc = start_of_today + (13 * (SECONDS_PER_HOUR)), // 1pm .length_min = 4 * MINUTES_PER_HOUR, .type = ActivitySessionType_Sleep, }, }; uint16_t session_entries = ARRAY...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(new_reel, duration)
; kino_reel_scale_segmented_set_deflate_effect(new_reel, CARD_TRANSITION_ICON_EXPAND); kino_reel_scale_segmented_set_delay_by_distance(new_reel, GPoint(0, icon_to.size.h / 2)); prv_change_reel(card_timeline_layout, new_reel); kino_layer_play_section(&card_timeline_layout->icon_layer, duration / 2, duration); ...
t(offsetof(SleepData, version) == 0, "Version not at the start of SleepData"); _Static_assert(sizeof(SleepData) % sizeof(uint32_t) == 0, "SleepData size is invalid"); // The phone doesn't send us Zone0 minutes typedef struct PACKED HeartRateZoneData { uint32_t version; uint32_t last_processed_timestamp; uint32_t...
(ActivityMetricSleepExitAtSeconds, wday, data->wakeup_time)
; } else if (strstr(key, HR_ZONE_DATA_KEY_SUFFIX)) { HeartRateZoneData *data = (HeartRateZoneData *)val; if (!prv_is_last_processed_timestamp_valid(data->last_processed_timestamp)) { return; } if (data->num_zones != HRZone_Max) { return; } PBL_LOG(LOG_LEVEL_INFO, "Got HeartRateZone...
< FIXED_S32_16_PRECISION)) }; sum = Fixed_S32_16_add(num1, num2); sum_c = (Fixed_S32_16){ .raw_value = (int32_t)((float)3 * (1 << FIXED_S32_16_PRECISION)) }; cl_assert(sum.raw_value == sum_c.raw_value); // sum = -2.1 + 5.4 = 3.3 // math is as follows: // -2.1 * (1 << 16) = -137625.6 = -137625 (drop fractio...
(num1, num2)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_assert_sane_segment(segment)
; return (size_t)((uintptr_t)segment->end - (uintptr_t)segment->start); } void memory_segment_align(MemorySegment *segment) { segment->start = prv_align(segment->start); prv_assert_sane_segment(segment); } void * memory_segment_split(MemorySegment * restrict parent, MemorySegment * r...
ATIVE_FORMAT); ctx.dest_bitmap = *s_dest_bitmap; ctx.draw_state.clip_box = (GRect){.size = size}; ctx.draw_state.drawing_box = ctx.draw_state.clip_box; graphics_context_set_text_color(&ctx, GColorBlack); graphics_context_set_fill_color(&ctx, GColorLightGray); memset(s_dest_bitmap->addr, 0xff, s_dest_bitmap-...
cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE))
; } void test_graphics_draw_text_flow__flow_no_paging_draw_box(void) { TextLayoutExtended layout = { .flow_data = { .perimeter.impl = &(GPerimeter){.callback=perimeter_for_display_round}, .perimeter.inset = 8, }, }; render_steps(&layout, RenderMoveDrawBox, DELTA, DISP_ROWS, NULL); // should...
_disturb_is_active(); cl_assert(active == false); // Timer will go off at 01:00 on Sunday. (14.5 hours) cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 52200 * MS_PER_SECOND); do_not_disturb_set_schedule_enabled(WeekendSchedule, false); rtc_set_time(s_saturday_01_30); do_not_disturb_handle_cl...
do_not_disturb_is_active()
; cl_assert(active == false); // Timer will go off at 01:00 on Sunday. (14 hours) cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 50400 * MS_PER_SECOND); rtc_set_time(s_sunday_23_30); do_not_disturb_handle_clock_change(); active = do_not_disturb_is_active(); cl_assert(active == false); //...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ // Set all handlers to NULL, so the ble_service dispatcher won't ever try to call us: s_hrs.svc = (const ble_service_t) {}; return; }
const hrs_body_sensor_location_t sensor_location = HRS_SENSOR_LOC_WRIST; static const hrs_callbacks_t s_callbacks = { .ee_reset = NULL, // Beat-to-beat interval data is not supported at the moment. .notif_changed = prv_handle_subscribe, }; hrs_init(&s_hrs, sensor_location, &s_callbacks, start_hdl); ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
layer_mark_dirty(&(path_layer->layer))
; } void path_layer_set_fill_color(PathLayer *path_layer, GColor color) { if (gcolor_equal(color, path_layer->fill_color)) { return; } path_layer->fill_color = color; layer_mark_dirty(&(path_layer->layer)); } Layer* path_layer_get_layer(const PathLayer *path_layer) { return &((PathLayer *)path_layer)->l...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (left_edge_bits_count) { mask = 0xffffffff << left_edge_bits_count; *(block) = (*(block) & ~mask) | (pattern & mask); block++; width -= (32 - left_edge_bits_count); }
if (right_edge_bits_count) { mask = 0xffffffff >> (32 - right_edge_bits_count); *(block + (width / 32)) = (*(block + (width / 32)) & ~mask) | (pattern & mask); width -= right_edge_bits_count; } if (width > 0) { memset(block, pattern, (width / 8)); } } } // ## Line blending fu...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(progress_layer, frame)
; progress_layer_set_corner_radius(progress_layer, PROGRESS_SUGGESTED_CORNER_RADIUS); } void loading_layer_deinit(LoadingLayer *loading_layer) { loading_layer_pause(loading_layer); progress_layer_deinit(&loading_layer->progress_layer); } void loading_layer_shrink(LoadingLayer *loading_layer, uint32_t delay, uin...
const uint32_t split_timestamp_uid = ((GetNotificationAttributesMsg*)s_split_timestamp_dict_part_one)->notification_uid; const uint32_t message_dict_uid = ((GetNotificationAttributesMsg*)s_message_dict)->notification_uid; const uint32_t app_name_title_dict_uid = ((GetNotificationAttributesMsg*)s_app_name_title_dic...
(ARRAY_LENGTH(s_message_dict), (uint8_t*) s_message_dict)
!(modal_manager_get_properties() & ModalProperty_Unfocused)); if (is_modal_focused) { // mask the app task if a modal is on top e->task_mask |= 1 << PebbleTask_App; modal_manager_handle_button_event(e); return; } if (watchface_running) { watchface_handle_button_event(e); ...
app_fetch_put_bytes_event_handler(&e->put_bytes)
ew_size.h += LAYOUT_TOP_BANNER_HEIGHT; #if PBL_ROUND // Notification text is paged by LAYOUT_HEIGHT, so make full page height layout->view_size.h = ROUND_TO_MOD_CEIL(layout->view_size.h, LAYOUT_HEIGHT); // Notifications are swapped using frame height, so last page includes additional arrow height layout->view_...
layer_set_clips(&layout->layout.layer, false)
; #endif prv_layout_init_colors(layout); switch (layout->layout.mode) { case LayoutLayerModeCard: prv_card_init(layout, config->attributes, config->app_id); break; default: break; } layer_mark_dirty(&(layout->layout.layer)); } #else LayoutLayer *notification_layout_create(const Layo...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return NULL; }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_i(b->data[1], b2)
; cl_assert_equal_i(b->data[2], b3); cl_assert_equal_i(b->data[3], b4); // moves removed remaining bytes to close the gap cl_assert_equal_i(2, buffer_remove(b, 1*sizeof(uint8_t), 2*sizeof(uint8_t))); cl_assert_equal_i(2, b->bytes_written); cl_assert_equal_i(b->data[0], b1); cl_assert_equal_i(b->data[1], ...
// We have modal windows and we should render them, either because they asked to or because // they recently became the top window in their respective modal stacks and haven't noticed yet. // See the handling for off screen windows in prv_render_modal_stack. if (update.properties & ModalProperty_RenderRequeste...
{ if (!window->is_transparent) { // There is a visible opaque window, remove the transparent property ctx->properties &= ~ModalProperty_Transparent; } if (window->is_render_scheduled) { // There is a visible window that will render, add the render requested property ctx->properties |...
if (is_focused) { // There is a modal with focus, remove the unfocused property ctx->properties &= ~ModalProperty_Unfocused; } return true; } static bool prv_render_modal_stack_callback(ModalContext *modal, IterContext *iter, void *data) { if (iter->current_idx < iter->first_opaque_idx) { return...
blocked_on_children_complete = true; } } return blocked_on_children_complete; } // ------------------------------------------------------------------------------------------- // @param state our context // @param now the time we are running to. When called from animation_set_elapsed, this will // be i...
if (animation_c) { // If c is not NULL, we need to figure out the array length animation_array[array_len++] = animation_c; while (array_len < max_args) { void *arg = va_arg(args, void *); if (arg == NULL) { break; } animation_array[array_len++] = arg; } }
// Create from an array return func(animation_array, array_len); } // ------------------------------------------------------------------------------------------- // Complex animations don't perform any logic in their update callback static void prv_complex_animation_update(Animation * animation, uint32_t distan...
(uint8_t *)&app_glance, sizeof(app_glance)), S_SUCCESS); // Verify that trying to read the blob back fails due to it not existing SerializedAppGlanceHeader glance_out = {}; cl_assert_equal_i(app_glance_db_read((uint8_t *)&APP_GLANCE_TEST_UUID, UUID_SIZE, ...
(app_glance_db_insert_glance(&APP_GLANCE_TEST_UUID, NULL), E_INVALID_ARGUMENT)
; // Glance with too many slices fails const AppGlance glance_with_too_many_slices = (AppGlance) { .num_slices = 1337, }; cl_assert(glance_with_too_many_slices.num_slices > APP_GLANCE_DB_MAX_SLICES_PER_GLANCE); cl_assert_equal_i(app_glance_db_insert_glance(&APP_GLANCE_TEST_UUID, ...
h" #include "util/size.h" #include "util/uuid.h" // This is used to determine whether this app was launched as Timeline or Timeline Past. // See timeline_get_app_info, timeline_past_get_app_info, and the usage of sys_get_app_uuid. // uuid: DAAE3686-BFF6-4BA5-921B-262F847BB6E8 #define TIMELINE_PAST_UUID_INIT {0xDA, 0xA...
PBL_LOG(LOG_LEVEL_DEBUG, "state transition %d->%d valid:%d", data->state, next_state, can_transition)
; if (can_transition) { data->state = next_state; } return can_transition; } ///////////////////////////////////// // Exit Animation & Inactivity Timer ///////////////////////////////////// T_STATIC void prv_init_peek_layer(TimelineAppData *data); static void prv_launch_watchface(void *data) { #ifdef SHELL...
et_data_row_info(const GBitmap *bitmap, uint16_t y) { return prv_gbitmap_get_data_row_info(bitmap, y); } void gbitmap_init_with_data(GBitmap *bitmap, const uint8_t *data) { BitmapData* bitmap_data = (BitmapData*) data; memset(bitmap, 0, prv_gbitmap_size()); bitmap->row_size_bytes = bitmap_data->row_size_byte...
prv_gbitmap_size_for_data(size, format)
; bitmap->addr = applib_zalloc(data_size); if (bitmap->addr) { bitmap->info.is_bitmap_heap_allocated = true; return true; } return false; } static GBitmap* prv_gbitmap_create_blank(GSize size, GBitmapFormat format) { GBitmap *bitmap = prv_allocate_gbitmap(); if (bitmap) { if (!prv_gbitmap_allo...
anager.h" #include "resource/resource_ids.auto.h" #include "services/normal/timeline/timeline_resources.h" #include "system/passert.h" #include "util/struct.h" // Stubs ///////////////////////// #include "stubs_kino_reel.h" #include "stubs_logging.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "...
prv_get_data_for_app_with_id(res_app_num)
; return data ? (data->resource_lut != NULL) : false; } uint32_t prv_get_app_resource_id(ResAppNum res_app_num, TimelineResourceId timeline_id, TimelineResourceSize size) { // Size must be valid if (size >= TimelineResourceSizeCount) { return RESOURCE_ID_INVALID; } // Th...
typedef enum ReplyOption { ReplyOption_Voice, ReplyOption_Template, ReplyOption_Emoji, ReplyOptionCount, } ReplyOption; static bool prv_is_reply_option_supported(ReplyOption option, TimelineItemAction *action) { switch (option) { case ReplyOption_Voice: #if CAPABILITY_HAS_MICROPHONE return true; #...
mktime(&local_tm)
s_short_data_fragment, sizeof(s_short_data_fragment)), true); ppogatt_send_next(transport); fake_gatt_client_op_assert_no_write(); fake_gatt_client_op_set_write_return_value(BTErrnoOK); ppogatt_handle...
(&s_meta_v0_system.app_uuid)
; // Get s_tx_window_size packets in flight: uint8_t sn = 0; for (; sn < s_tx_window_size; ++sn) { cl_assert_equal_b(fake_comm_session_send_buffer_write_raw_by_transport(transport, s_short_data_fragment, ...
KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <bluetooth/gatt.h> #include "comm/ble/gatt_client_subscriptions.h" #include "comm/ble/gap_le_connection.h" #include "comm/ble/gap_le_task.h" #include "comm/ble/gatt_se...
(event.type, PEBBLE_BLE_GATT_CLIENT_EVENT)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ PBL_LOG(LOG_LEVEL_ERROR, "No connection found for pairing complete"); return; }
const bool success = (status == HciStatusCode_Success); if (!success) { bluetooth_analytics_handle_ble_pairing_error(status); PBL_LOG(LOG_LEVEL_ERROR, "Pairing failed w/ status: 0x%x", status); } bt_driver_cb_pairing_confirm_handle_completed(ctx, success); }
SleepFileTestEntry test_entry; } SleepSampleDiscoveryState; static SleepSampleDiscoveryState s_sleep_sample_discovery_state; #define ACTIVITY_SAMPLES_DISCOVERY_MAX_SAMPLES (40 * MINUTES_PER_HOUR) typedef struct { SampleDiscoveryState common; AlgMinuteFileSample samples[ACTIVITY_SAMPLES_DISCOVERY_MAX_SAMPLES]; Ac...
(line_buf, sizeof(line_buf), state->common.file)
; if (!line) { // EOF break; } //printf("\nGot line: %s", line); // Find first token char *token = strtok(line, " \t\n"); if (!token) { continue; } // If this is a pre-processor directive, skip it if (token[0] == '#') { continue; } // If this is a c...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ layer->property_changed_proc(layer); }
if (layer->window) { window_schedule_render(layer->window); } } static bool layer_process_tree_level(Layer *node, void *ctx, LayerIteratorFunc iterator_func); static bool layer_property_changed_tree_node(Layer *node, void *ctx) { if (node) { if (node->property_changed_proc) { node->property_chang...
ttr_list, action_group, &item_out->action_group, item_out->allocated_buffer, buf_end); if (!rv) { timeline_item_free_allocated_buffer(item_out); return false; } } return true; } bool timeline_item_create_from...
(item_out, buffer, string_alloc_size, payload, header->payload_length)
) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to deserialize payload"); goto cleanup; } return true; cleanup: timeline_item_free_allocated_buffer(item_out); return false; } void timeline_item_serialize_header(TimelineItem *item, SerializedTimelineItemHeader *header) { PBL_ASSERTN(item != NULL); PBL_A...
lor(); char *model_name = NULL; if (color < WATCH_INFO_COLOR__MAX) { switch (color) { case WATCH_INFO_COLOR_BLACK: model_name = TINTIN_MODEL("pebble_black"); break; case WATCH_INFO_COLOR_WHITE: model_name = TINTIN_MODEL("pebble_white"); break; case WATCH_INFO_C...
strlen(platform_name)
+ 1]; strcpy(combined_string, qemu_prefix); strcat(combined_string, platform_name); return jerry_create_string((const jerry_char_t *)combined_string); } } static jerry_value_t prv_get_language(void) { return jerry_create_string((const jerry_char_t *)app_get_system_locale()); } static jerry_value_t pr...
Main // queue if (!s_pending_accel_event) { s_pending_accel_event = true; PebbleEvent e = { .type = PEBBLE_CALLBACK_EVENT, .callback = { .callback = prv_read_samples, .data = NULL } }; *should_context_switch = event_put_isr(&e); } } //! Returns the latest accel r...
analytics_set(ANALYTICS_DEVICE_METRIC_ACCEL_XYZ_DELTA, delta, AnalyticsClient_System)
; } } // Self Test ////////////////////////////////////////////////////////////////////// bool accel_self_test(void) { AccelRawData data; AccelRawData data_st; if (!accel_start()) { PBL_LOG(LOG_LEVEL_ERROR, "Self test failed, could not start accel"); return false; } psleep(10); accel_get_dat...
EL_WARNING, "pmap enlarge (overwrite) failed: %d", new_fd); kernel_free(buf); return (new_fd); } size_t curr_file_len = pfs_get_file_size(*fd); int rv = S_SUCCESS; while (curr_file_len != 0) { size_t bytes_to_read = MIN(curr_file_len, hunk_size); if ((rv = pfs_read(*fd, buf, bytes_to_read)) !=...
search_map(prv_dump_callback, NULL)
; } status_t persist_map_init() { const char * const name = s_map_filename; status_t status = S_SUCCESS; // create a new map file if needed. We may fail on init so don't call it through the debug_wrapper int fd = pfs_open(name, OP_FLAG_READ, 0, 0); if (fd < 0) { if ((fd = prv_pmap_open_debug_wrapper(nam...
ce time to just before the expiration time rtc_set_time(rtc_get_time() + expire_s - 1); // Send more data, the callback should get the expiring event prv_fake_send_new_data(); fake_system_task_callbacks_invoke_pending(); cl_assert_equal_i(s_num_cb_events_1, 3); cl_assert_equal_i(s_cb_events_1[1].event_typ...
cl_assert_equal_i(s_event_count, 4)
ct clar_func initialize; struct clar_func cleanup; const char **categories; const struct clar_func *tests; size_t test_count; }; /* From clar_print_*.c */ static void clar_print_init(int test_count, int suite_count, const char *suite_names); static void clar_print_shutdown(int test_count, int suite_count, int ...
(" -l \t\tPrint suite, category, and test names\n")
verning permissions and * limitations under the License. */ #include "switch_worker_ui.h" #include <stdio.h> #include <string.h> #include "applib/ui/action_bar_layer.h" #include "applib/ui/dialogs/confirmation_dialog.h" #include "kernel/event_loop.h" #include "kernel/pbl_malloc.h" #include "kernel/ui/modals/modal_...
dialog_set_background_color(dialog, GColorCobaltBlue)
; dialog_set_text_color(dialog, GColorWhite); dialog_set_text(dialog, msg_buffer); task_free(msg_buffer); i18n_free_all(confirmation_dialog); SwitchWorkerUIArgs *args = task_malloc_check(sizeof(SwitchWorkerUIArgs)); *args = (SwitchWorkerUIArgs) { .new_worker_id = new_worker_id, .set_as_default...
tamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS); cl_assert(!alerts_should_enable_backlight_for_type(AlertMobile)); cl_assert(alerts_should_notify_for_type(AlertReminder)); cl_assert(!alerts_should_vibrate_for_type(AlertReminder)); alerts_set_notification_vibe_timestamp(); fake...
(alerts_should_enable_backlight_for_type(AlertPhoneCall))
ssion_open_call_count; bool comm_session_is_valid(const CommSession *session) { return list_contains((ListNode *) s_session_head, &session->node); } static bool prv_find_session_is_system_filter(ListNode *found_node, void *data) { const CommSessionType requested_type = (const bool) (uintptr_t) data; const Trans...
list_contains((const ListNode *) s_session_head, &session->node)
); return circular_buffer_copy_offset(&session->send_buffer, start_off, data_out, length); } void comm_session_send_queue_consume(CommSession *session, size_t length) { circular_buffer_consume(&session->send_buffer, length); } static void prv_send_next_kernel_bg_cb(void *data) { CommSession *session = (CommSess...
whole_word_bytes = length / 4; while (num_whole_word_bytes--) { crc = crc ^ *((uint32_t*)data); for(int bit = 0; bit < 32; ++bit) { if ((crc & 0x80000000) != 0) { crc = (crc << 1) ^ CRC_POLY; } else { crc = (crc << 1); } } data += 4; } if (num_remainder_bytes) {...
(0, bounds->size.w / 2, bounds->size.w, bounds->size.w / 2)
); layer_add_child(&s_data.window.layer, &s_data.log_layer.layer); start_logging(); comm_session_set_responsiveness(comm_session_get_system_session(), BtConsumerApp, ResponseTimeMax, MAX_PERIOD_RUN_FOREVER); } //////////////////// // App boilerplate static void s_main(void) {...
"FreeRTOSConfig.h" #define NUM_MENU_ITEMS 13 static bool s_call_core_dump_from_isr = false; // ================================================================================= // Application Data typedef struct { Window *window; SimpleMenuLayer *menu_layer; SimpleMenuSection menu_section; SimpleMenuItem me...
core_dump_reset(false /* don't force overwrite */)
; } else if (index == 7) { PBL_LOG(LOG_LEVEL_INFO, "Forcing inf loop during core dump"); core_dump_test_force_inf_loop(); core_dump_reset(false /* don't force overwrite */); } else if (index == 8) { PBL_LOG(LOG_LEVEL_INFO, "Forcing assert loop during core dump"); core_dump_test_force_assert(...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
evented_timer_register(100, true, stub_evented_timer_callback, 0)
; // NOTE: We are leveraging the fact that we know the system timer ID is the same as the // EventedTimer ID TimerID sys_timer_id = e_timer; cl_assert(stub_new_timer_is_scheduled(sys_timer_id)); cl_assert_equal_i(s_last_event.type, PEBBLE_NULL_EVENT); cl_assert(!s_times_callback_executed); for (int i = ...
lue_t v = jerry_create_number(cases[i].input); JERRY_ARGS_MAKE(v); ROCKY_ARGS_ASSIGN(ROCKY_ARG(output)); cl_assert_equal_i(output, cases[i].expected_output); ASSERT_JS_ERROR(error_value, NULL); jerry_release_value(v); } } void test_rocky_api_util_args__numbers(void) { uint8_t u8; uint16_t u16...
{ cl_assert_equal_i(u8, (uint8_t)c->u8); cl_assert_equal_i(u16, (uint16_t)c->u16); cl_assert_equal_i(u32, (uint32_t)c->u32); cl_assert_equal_i(u64, (uint64_t)c->u64); cl_assert_equal_i(s8, (int8_t)c->s8); cl_assert_equal_i(s16, (int16_t)c->s16); cl_assert_equal_i(s32, (int32_t)...
JERRY_ARGS_RELEASE(); } } void test_rocky_api_util_args__number_type_mismatch(void) { jerry_value_t mismatch_args[] = { jerry_create_null(), jerry_create_string((const jerry_char_t *)"one"), jerry_create_string((const jerry_char_t *)"1"), jerry_create_array(1), jerry_create_boolean(true), ...
First alarm goes off. Second one should be up s_current_hour = 10; s_current_minute = 30; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 1); cl_assert_equal_i(s_num_alarm_events_put, 1); cl_assert_equal_i(s_num_timeline_adds, 8); cl_assert_equal_i(s_num_timeline_removes, 4); cl_assert_equ...
(s_num_alarm_events_put, 2)
; cl_assert_equal_i(s_num_timeline_adds, 5); cl_assert_equal_i(s_num_timeline_removes, 3); cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); } void test_alarm__custom_alarm_everyday(void) { AlarmId id1; bool schedule_1[7] = {true, true, true, true, true, true, true}; id1 = a...
2_sdk(void) { return false; } GDrawState graphics_context_get_drawing_state(GContext *ctx) { return (GDrawState) { }; } bool graphics_release_frame_buffer(GContext *ctx, GBitmap *buffer) { return false; } void graphics_context_set_drawing_state(GContext *ctx, GDrawState draw_state) { } void window_schedule_re...
cl_assert_equal_i(evt.type, PEBBLE_CALLBACK_EVENT)
; evt.callback.callback(evt.callback.data); } // -------------------------------------------------------------------------------------- // Advance to the given time, firing all timers that are scheduled along the way static void prv_advance_to_ms_with_timers(uint64_t dst_time) { uint64_t now = prv_now_ms(); w...
(expr) #define I2C_ERROR_TIMEOUT_MS (1000) #define I2C_TIMEOUT_ATTEMPTS_MAX (2 * 1000 * 1000) #define I2C_NORMAL_MODE_CLOCK_SPEED_MAX (100000) #define I2C_NACK_COUNT_MAX (1000) // MFI NACKs while busy. We delay ~1ms between retries so this is approximately a 1s timeout #define I2C_READ_WRITE_BIT (0x01) type...
GPIO_Init(pin_config.gpio, &gpio_init_struct)
; // Set bit high or low GPIO_WriteBit(pin_config.gpio, pin_config.gpio_pin, (pin_state) ? Bit_SET : Bit_RESET); } //! Power down I2C bus power supply //! Always lock bus and peripheral config access before use static void bus_rail_power_down(uint8_t bus_idx) { if (BOARD_CONFIG.i2c_bus_configs[bus_idx].rail_ctl...
, 0x2d, 0x7c, 0x2c}, .info_flags = PROCESS_INFO_WATCH_FACE, .icon_resource_id = 0, .app_version = { .major = 6, .minor = 0, }, .sdk_version = { .major = 5, .minor = 17, }, .app_face_bg_color = {0}, .template_id = 0, }; AppInstallId bg_counter_app_id; AppInstallId menu_layer_app_id; AppI...
{ // settings has to be at the beginning. The app_menu_data_source module enforces it static const AppInstallId app_default_order[] = {APP_ID_SETTINGS, APP_ID_MUSIC, APP_ID_NOTIFICATIONS, APP_ID_ALARMS, APP_ID_WATC...
static uint16_t prv_reverse_index(AppMenuDataSource *data_source, uint16_t original_index, void *context) { return app_menu_data_source_get_count(data_source) - 1 - original_index; } void test_app_menu_data_source__transform_index(void) { // settings has to be at the beginning. ...
ng to remove/upgrade // OR // If we are doing an APP_DB_CLEAR and the currently running worker is from the app_db, // also clear it. const AppInstallId cur_worker_id = worker_manager_get_current_worker_id(); if (prv_ids_equal(cur_worker_id, to_kill) || ((s_install_callback_data.i...
if (!s_install_callback_data.callback_paused_for_worker) { app_install_launcher_task_callback(NULL); } else { s_install_callback_data.callback_paused_for_app = false; }
} } void app_install_notify_worker_closed(void) { PBL_ASSERT_TASK(PebbleTask_KernelMain); // If we've previously paused doing app callbacks to wait for the app to close, resume them // now if the worker is also done if (s_install_callback_data.callback_paused_for_worker) { if (!s_install_callback_data.c...
ndle_touch_event(r, &(TouchEvent) { .type = TouchEvent_Touchdown }); cl_assert_equal_i(last_touch_event.type, TouchEvent_Touchdown); cl_assert_equal_b(updated, true); cl_assert_equal_i(rec_event, RecognizerEvent_Started); updated = false; new_state = RecognizerState_Updated; recognizer_handle_touch_event(r...
(NULL, NULL)
); cl_assert(!recognizer_should_evaluate_simultaneously(r1, NULL)); cl_assert(!recognizer_should_evaluate_simultaneously(NULL, r2)); cl_assert(!recognizer_should_evaluate_simultaneously(r1, r2)); s_simultaneous = true; cl_assert(!recognizer_should_evaluate_simultaneously(NULL, NULL)); cl_assert(!recognizer...
c bool s_abandoned_workout_notification_sent; void workout_utils_send_abandoned_workout_notification() { s_abandoned_workout_notification_sent = true; } // --------------------------------------------------------------------------------------- static void prv_inc_steps_and_put_event(int steps) { s_total_step_count...
cl_assert_equal_i(bpm, 180)
; cl_assert_equal_i(hr_zone, 3); cl_assert_equal_i(duration_s, 10 * SECONDS_PER_MINUTE + 10); cl_assert(workout_service_stop_workout()); cl_assert(!workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone)); } // ----------...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&ICE40LP->spi.scs, GPIO_OType_PP, GPIO_Speed_25MHz)
; gpio_output_set(&ICE40LP->spi.scs, false); gpio_input_init(&ICE40LP->cdone); gpio_input_init(&ICE40LP->busy); gpio_output_init(&ICE40LP->creset, GPIO_OType_OD, GPIO_Speed_25MHz); prv_spi_init(); } bool display_program(const uint8_t *fpga_bitstream, uint32_t bitstream_size) { InputConfig creset_input = {...
prv_item_init(TimelineItem *item, int num_attributes, int num_actions, uint8_t attributes_per_action[], size_t required_size_for_strings, uint8_t **string_buffer) { if (num_actions > 0) { PBL_ASSERTN(attributes_per_action != NULL); } const size_t alloc_size = attributes_actions_get_required_buffer_...
if (!prv_deep_copy_attributes_actions(&src->attr_list, &src->action_group, item_out)) { timeline_item_destroy(item_out); return NULL; }
return item_out; } size_t timeline_item_get_serialized_payload_size(TimelineItem *item) { PBL_ASSERTN(item); return attributes_actions_get_serialized_payload_size(&item->attr_list, &item->action_group); } bool timeline_item_deserialize_item(TimelineItem *item_out, const Ser...
); cl_assert(gcolor_equal(value, mid_value)); // End prv_advance_to_ms_with_timers(start_ms + duration + MIN_FRAME_INTERVAL_MS*2); cl_assert(gcolor_equal(value, end_value)); #endif } // -------------------------------------------------------------------------------------- // Test that the schedule/unschedul...
cl_assert_equal_point(layer.frame.origin, to_r.origin)
; // ------------------------------------------------------------------------------- // Now, reschedule it prv_advance_by_ms_no_timers(10); prv_clear_handler_histories(); animation_schedule(h); max_loops = 20; start_ms = prv_now_ms(); while (s_stopped_handler_calls.num_calls == 0) { prv_fire_anima...
e.h" #include "applib/applib_malloc.auto.h" #include "applib/ui/layer.h" #include "system/passert.h" #include "util/list.h" #include <stddef.h> static void prv_set_state(Recognizer *recognizer, RecognizerState new_state) { switch (recognizer->state) { case RecognizerState_Possible: PBL_ASSERTN((new_state...
PBL_ASSERTN(new_state != RecognizerState_Possible)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ ++s_count_animation_schedule; s_scheduled_animation = animation; return true; }
bool animation_set_auto_destroy(Animation *animation, bool auto_destroy) { return true; } bool animation_is_scheduled(Animation *animation_h) { return animation_h && animation_h == s_scheduled_animation; } static int s_count_animation_destroy = 0; bool animation_unschedule(Animation *animation) { ++s_count_an...
ense. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied....
{ return max_value; }
n_get_custom_curve(h) == prv_custom_curve); // Reverse cl_assert(animation_get_reverse(h) == false); animation_set_reverse(h, true); cl_assert(animation_get_reverse(h) == true); animation_set_reverse(h, false); // Position int32_t elapsed_ms = 0; AnimationProgress progress = 0; animation_schedule(...
animation_schedule(seq)
208, -8}, { 608, 160, 0}, { 608, 152, 48}, { 688, 80, 64}, { 824, 96, 56}, { 968, 208, 48}, { 1112, 200, 0}, { 1152, 168, 56}, { 1288, 168, 56}, // 21 seconds { 1184, 128, 24}, { 1056, 152, 0}, { 1232, 192, -88}, { 1296, 216, -144}, { 1040, 256, -176}, { 672,...
{ 1144, 352, -136}, { 1168, 280, -104}, { 1040, 216, -40}, { 872, 168, 16}, { 768, 136, -24}, { 744, 136, -24}, { 808, 128, 72}, { 896, 136, 72}, { 1064, 96, 24}, { 1160, 80, 8}, { 1040, 48, -80}, { 1200, 80, -24}, { 1184, 112, -56}, { 1152, 208, -128}, { 1280...
// 29 seconds { 1072, 112, -64}, { 1032, 112, -112}, { 1168, 160, -152}, { 1168, 160, -56}, { 1056, 208, -104}, { 1232, 216, -152}, { 1256, 272, -160}, { 1000, 288, -184}, { 688, 136, -192}, { 544, 232, -96}, { 488, 232, -136}, { 504, 208, -160}, { 640, 224, -136...
SSORY.int_gpio, GPIO_PuPd_DOWN); // budget for a capacitance up to ~1uF and a resistance of 10kOhm psleep(10); bool result = (gpio_input_read(&BOARD_CONFIG_ACCESSORY.int_gpio) == SET); gpio_input_init(&BOARD_CONFIG_ACCESSORY.int_gpio); return result; } // ISRs ////////////////////////////////////////////////...
(buffer, sizeof(buffer), "FAILED: %"PRId32" bytes left!", s_num_test_bytes)
; } }
(window->is_waiting_for_click_config)
; WindowStack *stack = app_state_get_window_stack(); cl_check(stack); cl_check(!stack->list_head); // Switch to the app state to push the window stub_pebble_tasks_set_current(PebbleTask_App); window_stack_push(stack, window, true); cl_assert_equal_i(window->on_screen, 1); cl_assert_equal_i(window_s...
exOverflow) { data->word_wrap = !(data->word_wrap); } } else if (button == BUTTON_ID_SELECT) { data->select_index = (data->select_index + 1) % SelectIndexMax; } else if (button == BUTTON_ID_DOWN) { if (data->select_index == SelectIndexPixels) { // Do inverse if (data->up_down_direction...
(&data->word_wrap_layer, gothic_14_bold)
jerry_size_t jerry_string_to_utf8_char_buffer(const jerry_value_t value, jerry_char_t *buffer_p, jerry_size_t buffer_size) { const jerry_size_t str_size = jerry_get_utf8_string_size(value); if (str_size == 0 || buffer_size ...
JERRY_CREATE_VALUE(NaN)
; } jerry_value_t jerry_create_null(void) { return JERRY_CREATE_VALUE(null); } jerry_value_t jerry_create_object(void) { return JERRY_CREATE_VALUE(new Object()); } jerry_value_t jerry_create_string(const jerry_char_t *str_p) { if (!str_p) { return jerry_create_undefined(); } return jerry_create_string_...