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...
(data->icon, ctx, GPoint(base_layer->bounds.size.w / 2 - x_center_offset, y))
; } static void prv_render_current_steps(GContext *ctx, Layer *base_layer) { HealthActivitySummaryCardData *data = layer_get_data(base_layer); char buffer[8]; GFont font; if (data->current_steps) { font = fonts_get_system_font(FONT_KEY_LECO_26_BOLD_NUMBERS_AM_PM); snprintf(buffer, sizeof(buffer), "%"P...
"aaaa aaaa aaaa aaaa " // 20- 40 "aaaa aaaa aaaa aaaa " // 40- 60 "aaaa aaaa aaaa aaaa " // 60- 80 "aaaa aaaa aaaa aaaa " // 80-100 "aaaa aaaa aaaa aaaa " //100-120 "aaaa aaaa...
cl_assert_equal_i(tntest[1], 0)
; }
_presented_list_init(); fail: mutex_unlock(s_notification_window_mutex); } void notification_window_init(bool is_modal) { prv_init_notification_window(is_modal); if (is_modal && notification_window_is_modal()) { // If we didn't ask for a modal window, it means some other task already created it, // so ...
(true /*is_modal*/)
; if (data->is_modal) { WindowStack *window_stack = modal_manager_get_window_stack(NOTIFICATION_PRIORITY); bool is_new = !window_stack_contains_window(window_stack, &data->window); bool in_view = window_is_on_screen(&data->window); prv_notification_window_add_notification(id, type); if (is_new)...
uint8_t *const from = delta_neg ? right_pixel : left_pixel; uint8_t *const to = delta_neg ? left_pixel : right_pixel; uint8_t *const garbage_start = delta_neg ? left_pixel + pixels_to_move : left_pixel; const uint8_t fill_byte = delta_neg ? right_pixel[pixels_to_move - 1] : left_pixel[0]...
{ return fallback; }
} return color; }
SET); // CRESET needs to be low for at least 200 ns GPIO_WriteBit(DISP_GPIO, DISP_PIN_CRESET, Bit_RESET); delay_ms(1); GPIO_WriteBit(DISP_GPIO, DISP_PIN_CRESET, Bit_SET); return prv_wait_programmed(); } static bool prv_reset_fpga(void) { #ifdef BLANK_FPGA return display_program(s_fpga_bitstream, sizeof(s_f...
dbgserial_print("Does the draw-scene command complete? ")
/* * 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...
(validate_test, sizeof(Transcription))
; cl_assert_equal_p(result, false); result = transcription_validate(validate_test, sizeof(Transcription) - 1); cl_assert_equal_p(result, false); s_test_transcription_example[0] = 0; result = transcription_validate(validate_test, test_size); cl_assert_equal_p(result, false); s_test_transcription_example[...
_hci_passthrough_character( char c, bool *should_context_switch) { static HciCmdInfo s_hci_cmd_info = {}; if (!s_hci_cmd_info.found_cmd_start) { if (c == 0x4) { // Exit bypass mode sequence serial_console_set_state(SERIAL_CONSOLE_STATE_LOGGING); s_hci_passthrough_enabled = false; return; ...
if (!s_test_mode_enabled) { char buf[80]; prompt_send_response_fmt( buf, sizeof(buf), "Not in test mode, run 'bt test start' first!"); return false; }
return true; } void bt_driver_le_transmitter_test( uint8_t tx_channel, uint8_t tx_packet_length, uint8_t packet_payload_type) { if (!prv_in_test_mode()) { return; } uint8_t tx_test_cmd[] = { HCI_CMD_START, HCI_LE_TX_TEST_OCF, OPCODE_TEST_CMDS_MSB, 0x3, // param length tx_channel, ...
(date_builtin)
; } void test_js__capture_mem_stats_upon_exiting_event_loop(void) { prv_deinit(); s_app_event_loop_callback = NULL; const char *source = ";"; cl_assert_equal_b(true, rocky_event_loop_with_string_or_snapshot(source, strlen(source))); cl_assert_equal_i(s_app_heap_analytics_log_stats_to_app_heartbeat_call_coun...
r or firing interrupts. static bool prv_enter_standby_mode(void) { // Ask to enter standby mode if (!mag3110_write(CTRL_REG1, 0x00)) { return false; } // Wait for the sysmod register to read that we're now in standby mode. This can take up to // 1/ODR to respond. Since we only support speeds as slow as 5...
(s_mag_mutex)
; if (s_use_refcount == 0) { mutex_unlock(s_mag_mutex); return (true); } bool success = false; // Enter standby state since we can only change sample rate in this mode. if (!prv_enter_standby_mode()) { goto done; } // See Table 25 in the data sheet for these values for the CTRL_REG1 regist...
temAction actions[max_num_actions]; actions[num_actions++] = (TimelineItemAction) { .id = action_id++, .type = TimelineItemActionTypeDismiss, .attr_list = dismiss_action_attr_list, }; if (config->open_pin.enabled) { actions[num_actions++] = (TimelineItemAction) { .id = action_id++, .ty...
i18n_noop("Someone's on the move 👊 You walked %d steps today; " "keep doing what you're doing!")
, i18n_noop("You keep moving, we'll keep counting! You've clocked in %d steps today. " "Keep it rolling, hot stuff."), }, }, [PercentTier_BelowAverage] = { .num_variants = 4, .variants = { i18n_noop("You walked %d steps today which is %d%% below your typical. ...
NULL, prv_system_msg_sent_callback); s_session = fake_transport_set_connected(transport, true /* connected */); cl_assert_equal_p(comm_session_get_system_session(), s_session); prv_process_and_reset_test_counters(); s_last_response_cookie = 0; s_boot_bits_orred ...
{ prv_receive_init(UINT_MAX, ObjectFirmware); // Fail due to massive total_size in our init message assert_ack_count(0); assert_nack_count(1); }
void test_put_bytes__init_msg_incomplete(void) { const uint8_t incomplete_init_msg = CmdInit; prv_receive_data(s_session, (const uint8_t *) &incomplete_init_msg, sizeof(incomplete_init_msg)); assert_ack_count(0); assert_nack_count(1); } void test_put_bytes__init_invalid_obje...
_feb_5_midnight + 11 * 60 * 60), 0); cl_assert(uuid_equal(&state.pin.header.id, &s_extra_case_items[2].header.id)); cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_extra_case_items[1].header.id)); cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_e...
(&state.pin.header.id, &s_items[5].header.id)
); // check second again cl_assert(iter_prev(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[4].header.id)); // check fourth cl_assert(iter_next(&iterator)); cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[1].header.id)); // check fifth cl_assert(i...
// This is the initial position that takes into account destination delta shift const int16_t src_initial_x = src_bitmap->bounds.origin.x + dest_delta_begin_x; const int16_t src_begin_x = MAX(src_row_info.min_x, src_bitmap->bounds.origin.x); const int16_t src_end_x = MIN(grect_get_max_x(&src_bit...
gcolor_alpha_blend(actual_color, (GColor8)dest[dest_x])
.argb; } } break; } } } void bitblt_bitmap_into_bitmap_tiled_1bit_to_8bit(GBitmap* dest_bitmap, const GBitmap* src_bitmap, GRect dest_rect, GPo...
ATION_TINY, i18n_get(text, i18n_owner), GColorWhite, GColorCobaltBlue, &callback, RESOURCE_ID_ACTION_BAR_ICON_CHECK, expandable_dialog_close_cb); i18n_free(text, i18n_owner); expandable_dialog_show_action_bar(e_dialog, true); expandable_dialog_set_header(e_dialog, i18n_get("You're all set", e_dialog)...
("Forget", data)
, .perform_action = prv_forget_item, .action_data = data, }; #if CAPABILITY_HAS_BUILTIN_HRM if (is_sharing_hr) { level->items[RemoteMenuStopSharingHeartRate] = (ActionMenuItem) { .label = i18n_get("Stop Sharing Heart Rate", data), .perform_action = prv_stop_sharing_heart_rate, .action...
// ANIMATION_NORMALIZED_MAX * elapsed / duration = whole_number test_reel_data->duration_ms = ANIMATION_DURATION_INFINITE; Animation *animation = (Animation *)kino_player_create_play_animation(test_player); cl_assert_equal_i(animation_is_scheduled(animation), false); animation_schedule(animation); animation_...
cl_assert_equal_i(s_num_destructor_calls, 1)
= dst_index; // Put it in uint32_t raw_light = base_fields->light * ALG_RAW_LIGHT_SENSOR_DIVIDE_BY; AmbientLightLevel health_light_level = ambient_light_level_to_enum(raw_light); HealthMinuteData record = { .steps = base_fields->steps, .orientation = base_fields->orientation, .vmc = base_fields->vm...
(context, minute_utc, &current_minute.base, current_minute.heart_rate_bpm)
; } exit: // Restore the circular buffer client to where it was before *cbuf_client = cbuf_client_bck; } // ------------------------------------------------------------------------------- bool activity_algorithm_get_minute_history(HealthMinuteData *minute_data, uint32_t *num_records, ...
data->subtype = subtype; data->obj_ref = obj_ref; ret_val = bt_driver_gatt_write(connection, value, value_length, att_handle, data); } unlock: bt_unlock(); return ret_val; } BTErrno gatt_client_op_read(BLECharacteristic characteristic, GAPLEClient client) { return prv_read...
while (read_response) { ReadResponseData *next_read_response = (ReadResponseData *) read_response->node.next; kernel_free(read_response); read_response = next_read_response; }
s_read_responses[client] = NULL; } bt_unlock(); }
ENT_SIZE units this segment requires. static HeapInfo_t *find_segment(Heap* const heap, unsigned long n_units) { HeapInfo_t *heap_info_ptr = NULL; /* If we are allocating a large segment, then start at the */ /* end of the heap. Otherwise, start at the beginning of */ /* the heap. If there is only one segm...
split_block(heap, heap_info_ptr, heap_info_ptr->Size - n_units)
; second_block->is_allocated = true; return second_block; } split_block(heap, heap_info_ptr, n_units); heap_info_ptr->is_allocated = true; return heap_info_ptr; } // A very naive realloc implementation void* heap_realloc(Heap* const heap, void *ptr, unsigned long nbytes, uintptr_t client_pc) { #if !de...
/* * 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...
bitmap_layer_get_layer(&data->bitmap_layer)
); } static void push_window(FSResourceAppData *data) { Window *window = &data->window; window_init(window, WINDOW_NAME("FS Resource Demo")); window_set_user_data(window, data); window_set_window_handlers(window, &(WindowHandlers) { .load = prv_window_load, }); const bool animated = true; app_window_...
specific language governing permissions and * limitations under the License. */ #include "data_logging_test.h" #include "system/logging.h" #include "services/common/comm_session/session.h" #include "services/normal/data_logging/data_logging_service.h" #include "services/normal/data_logging/dls_private.h" #include ...
comm_session_get_system_session()
, BtConsumerApp, ResponseTimeMax, MAX_PERIOD_RUN_FOREVER); } static void handle_init(void) { dls_clear(); memset(&s_data, 0, sizeof(s_data)); // Init window window_init(&s_data.window, "Logging Demo"); app_window_stack_push(&s_data.window, true /* Animated */); window_set...
ex.row < num_rows_in_section - 1 || it->cursor.index.section < num_sections - 1) { it->cursor.y += it->cursor.sep; } ++(it->cursor.index.row); } // for() rows // Next section: ++(it->cursor.index.section); if (it->cursor.index.section >= num_sections) { break; // Reached...
graphics_fill_rect(ctx, bounds)
; } else { ctx->draw_state.fill_color = menu_layer->normal_colors[MenuLayerColorBackground]; graphics_fill_rect(ctx, bounds); } graphics_context_set_drawing_state(ctx, prev_state); } void menu_layer_update_proc(Layer *scroll_content_layer, GContext* ctx) { MenuLayer *menu_layer = (MenuLayer*)(((uint8_...
/* * 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...
{ JS_VAR rocky = rocky_get_rocky_singleton(); JS_VAR all_listeners = rocky_get_or_create_object(rocky, ROCKY_LISTENERS, rocky_creator_object, NULL, NULL); return rocky_get_or_create_object(all_lis...
// callback while iterating over listeners // @param event_listeners the array this listener is part of // @param idx position within the array at which the listener exists // @param listener the JS function that's registered as listener // @param data pointer provided when calling prv_iterate_event_listeners() // @r...
/* * 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...
mutex_unlock(global_lock)
; } void stuff2() { mutex_lock(m_wrapper.m); do_stuff2(); mutex_unlock(m_wrapper.m); } void nest2() { mutex_lock(global_lock); printf("blah %p", global_lock); mutex_unlock(global_lock); } void nest() { nest2(); } void cond(void *glob_ptr) { mutex_lock(global_lock); while (glob_ptr) { printf...
nooze_text = i18n_noop("Snooze delay set to %d minutes"); char snooze_buf[64]; snprintf(snooze_buf, sizeof(snooze_buf), i18n_get(snooze_text, dialog), alarm_get_snooze_delay()); i18n_free(snooze_text, dialog); dialog_set_text(dialog, snooze_buf); dialog_set_icon(dialog, RESOURCE_ID_GENERIC_CONFIRMATION_LARGE)...
(action_menu)
; AlarmDetailData *data = (AlarmDetailData *) context; i18n_free_all(data); task_free((void *)root_level->items[DetailMenuItemIndexSnooze].next_level); task_free((void *)root_level); task_free(data); data = NULL; } void alarm_detail_window_push(AlarmId alarm_id, AlarmInfo *alarm_info, ...
, void *context) { if (!animation) { return false; } ((AnimationPrivate*)animation)->context = context; return true; } void *WEAK animation_get_context(Animation *animation) { if (!animation) { return false; } return ((AnimationPrivate*)animation)->context; } boo...
property_animation_get_animation(PropertyAnimation *property_animation)
{ return (Animation *)property_animation; } InterpolateInt64Function WEAK animation_private_current_interpolate_override(void) { return NULL; } void WEAK property_animation_update_int16(PropertyAnimation *property_animation, const uint32_t distance_normalized) {}
T)) { // unexpected error goto cleanup; } // check to see if we are trying to read the file and it doesn't exist bool is_read_only = (op_flags & (OP_FLAG_READ | OP_FLAG_WRITE | OP_FLAG_OVERWRITE)) == OP_FLAG_READ; bool is_tmp = ((op_flags & OP_FLAG_OVERWRITE) != 0); if ((is_read_only || is_tmp) && ...
pfs_write(fd, &hdr, sizeof(hdr))
; pfs_write(fd, &data_len, sizeof(data_len)); } else { // recover pfs_read(fd, &hdr, sizeof(hdr)); pfs_read(fd, &data_len, sizeof(data_len)); prv_flash_write(&hdr, sizeof(hdr), base_addr); } base_addr += sizeof(PageHeader); for (int i = 0; i < (int)data_len; i += copy_buf_size) ...
/* * 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; }
/* * 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...
strncpy(buffer, music_glance->subtitle, buffer_size)
; buffer[buffer_size - 1] = '\0'; } } static GTextNode *prv_create_subtitle_node(LauncherAppGlanceStructured *structured_glance) { return launcher_app_glance_structured_create_subtitle_text_node( structured_glance, prv_music_glance_subtitle_dynamic_text_node_update); } static void prv_destructor(Launche...
/* * 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_INFO, "Unexpected ANCS attribute. ID = %d. The dictionary is malformed", attr->id)
; *out_error = true; return false; } extracted_complete_attribute = ((uint8_t*)attr->value + attr->length <= data + length); iter = next_iter; } // The dictionary was well-formed, all the attributes found so far are ones // that were in the FetchedNotifAttribute list // Check if there ...
eel_transform_set_transform_duration(kino_reel, UNFOLD_DURATION); kino_reel_scale_segmented_set_deflate_effect(kino_reel, UNFOLD_EXPAND); kino_layer_set_reel(&s_phone_ui_data->icon_layer, kino_reel, true); kino_layer_play(&s_phone_ui_data->icon_layer); s_phone_ui_data->current_icon = image; s_phone_ui_data->c...
if (!caller->name && !caller->number) { return; }
{ 784, 160, -16}, { 816, 184, -32}, { 1056, 200, -144}, { 1352, 176, -16}, { 1384, 320, -328}, { 1560, 304, -344}, { 1440, 192, -120}, { 1096, 272, -240}, { 872, 472, -352}, { 680, 472, -208}, { 688, 512, -224}, { 824, 552, -256}, { 944, 592, -280}, { 944, 616, -312},...
{ 1176, 344, -200}, { 1016, 304, -136}, { 824, 384, -56}, { 584, 264, 120}, { 464, -128, 24}, { 472, -64, -120}, // 56 seconds { 568, -104, -192}, { 672, -288, -168}, { 848, -136, -144}, { 1216, -16, -104}, { 1512, 192, -128}, { 1776, 256, -224}, { 2096, 392, -160...
one1], 20); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone2], 10); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone3], 10); // Pause the workout. Don't accumulate time in zones cl_assert(workout_service_pause_workout(true)); prv_inc_time(10); prv_put_bpm_event(ZONE_3_HR, HRMQuality_Good); cl_assert(workout_se...
prv_inc_time(25 * SECONDS_PER_MINUTE)
; prv_abandoned_notification_timer_callback(NULL); cl_assert_equal_b(s_abandoned_workout_notification_sent, true); // Wait 5 minutes, call evented timer callback and make sure the workout was ended prv_inc_time(5 * SECONDS_PER_MINUTE); prv_abandon_workout_timer_callback(NULL); cl_assert_equal_b(workout_ser...
ag to done, the tmp & // original file will be deleted. This is an extremely small window, but // could be resolved by checking on reboot to see if both versions exist. // If both exist, the orig is valid. Iff tmp exists, the tmp file is valid update_curr_state(f->start_page, TMP_STATE_OFFSET, TMP_STATE...
(head, &entry->list_node)
; } mutex_unlock_recursive(s_pfs_mutex); return (PFSFileListEntry *)head; } void pfs_delete_file_list(PFSFileListEntry *head) { ListNode *node = (ListNode *)head; ListNode *next; while (node) { next = node->next; kernel_free(node); node = next; } } // PBL-19098 Refactor this to share code wi...
/* * 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...
{ failed = true; }
} // Lock the OTP sector if (FLASH_ProgramByte((uint32_t)lock, 0) != FLASH_COMPLETE) { failed = true; } FLASH_Lock(); if(failed) { return OtpWriteFailCorrupt; } else { return OtpWriteSuccess; } }
if (fpc[optimal_idx].contiguous_pgs > toadd->contiguous_pgs) { return; } } else { (*cur_idx)++; // we are adding a new entry } fpc[optimal_idx] = *toadd; } static NOINLINE void allocate_page_cache(int fd) { File *f = &PFS_FD(fd).file; if (f->pg_cache != NULL) { return; // already cac...
(s_pfs_mutex)
; file_desc->fd_status = curr_status; } int res = create_flash_file(file); return (res); } // given the fd and start page of a file, loads file description with relevent // info about file so it can be read from static NOINLINE status_t pfs_open_handle_read_request(int fd, uint16_t page) { PageHeader pg_h...
tart(s_stop_mode_monitor.timer, ACCESSORY_STOP_INTERVAL_PERIOD_MS, prv_timer_interval_expired_cb, NULL, TIMER_START_FLAG_REPEATING); } //! Callback run whenever the EXTI fires static void prv_exti_cb(bool *should_context_switch) { if (!s_stop_mode_monitor.active) { // First time seeing data, le...
if (s_send_history.has_data) { // The send buffer is full. This means that the receive interrupt hasn't fired to clear the // buffer which indicates that there is bus contention preventing a stop bit from occuring. s_bus_contention_detected = true; } else { s_send_history.data = data; s_send_histo...
portEXIT_CRITICAL(); uart_write_byte(ACCESSORY_UART, data); s_sent_data = true; prv_unlock(); } void accessory_send_data(const uint8_t *data, size_t length) { // NOTE: this may be run within an ISR prv_lock(); // When sending data, we need to temporarily disable input, as there's only one data line for ...
lock.has_lock_data) { qspi_indirect_write(dev->qspi, instruction, addr, &dev->state->part->block_lock.lock_data, 1); } else { qspi_indirect_write(dev->qspi, instruction, addr, NULL, 0); } // Poll busy status until done qspi_poll_bit(dev->qspi, dev->state->part->instructions.read_status, ...
{ ++failures; prompt_send_response("ERROR: Who am I failed"); }
else { ++passes; } prompt_send_response("Exit low power mode"); flash_impl_exit_low_power_mode(); prompt_send_response("Start flash_read_verify test"); qspi_use(QSPI); const int final_size = atoi(len_str); // If size is 0 run through a pre-defined table if (final_size == 0) { for (unsigned ...
4_t start_ms = prv_now_ms(); animation_schedule(seq); // Start A prv_advance_to_ms_with_timers(start_ms + 2 * MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); cl_assert_equal...
animation_destroy(seq)
; prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); animation_schedule(clone); // Start A prv_advance_to_ms_with_timers(start_ms + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, NULL), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, NU...
t *touch_event = touch_event_queue_get_event(0, 0); prv_test_touch_event(touch_event, 0, TouchEvent_PositionUpdate, &GPointZero, 3686380, 0, &GPoint(10, 10), 20, 5, true); touch_handle_update(0, TouchState_FingerDown, &GPoint(13, 13), 6, 3686420); touch_event = touch_event_queue_get_event(...
(&ctx.touch_events[0], 0, TouchEvent_Touchdown, &GPoint(13, 13), 3686420, 6, NULL, 0, 0, false)
; prv_test_touch_event(&ctx.touch_events[1], 0, TouchEvent_PositionUpdate, &GPoint(13, 13), 3686420, 6, &GPoint(2, 2), 20, 0, true); touch_dispatch_touch_events(1, prv_touch_event_dispatch_cb, &ctx); cl_assert_equal_i(ctx.idx, 4); prv_test_touch_event(&ctx.touch_events[2], 1, TouchEvent_...
lude "kernel/ui/kernel_ui.h" #include "kernel/ui/modals/modal_manager.h" #include "popups/ble_hrm/ble_hrm_stop_sharing_popup.h" #include "popups/notifications/notification_window.h" #include "process_state/app_state/app_state.h" #include "services/common/analytics/analytics.h" #include "services/common/comm_session/ses...
data->action_complete.callback(succeeded, data->action_complete.callback_data)
; } if (data->action_menu) { action_menu_close(data->action_menu, true); data->action_menu = NULL; } else if (data->chaining_data.action_chaining_window) { window_stack_remove(data->chaining_data.action_chaining_window, true); data->chaining_data.action_chaining_window = NULL; } if (data->vo...
s_stopped_handler_calls, a), 2); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 2); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 2); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, c), 2); cl_assert_equal_i(prv_count_handler_entries...
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); // A should end high distance = prv_last_update_distance(a); cl_assert(distance > TEST_ANIMATION_NORMALIZED_HIGH); // B should start high distance = prv_last_update_distance(b); cl_assert(distance > TEST_ANIMATION_NORMALIZED_H...
cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, b), 1); // A should end up at max // A should end high distance = prv_last_update_distance(a); cl_assert_equal_i(distance, ANIMATION_NORMALIZED_MAX); // B should start high distance = prv_last_update_distance(b); cl_assert_equal_i...
/* * 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...
prompt_send_response("OK")
; } bool prv_print_app_info(AppInstallEntry *entry, void *data) { if (app_install_id_from_system(entry->install_id)) { return true; } char buffer[120]; char uuid_buffer[UUID_STRING_BUFFER_LENGTH]; uuid_to_string(&entry->uuid, uuid_buffer); prompt_send_response_fmt(buffer, sizeof(buffer), "%"PRIi32":...
/* * 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...
DEFINE_SYSCALL(void, sys_resource_mapped_release)
/* * 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...
{ case OP_ROTATE: data->rotation_angle = (data->rotation_angle - STEP_ROTATION_ANGLE) % TRIG_MAX_ANGLE; break; case OP_CHANGE_WIDTH: case OP_TEST: case OP_TEST2: case OP_TEST3: case OP_TEST4: case OP_ROTATE2: case OP_ROTATE3: if (data->stroke_width > MIN_STROKE) data->s...
layer_mark_dirty(data->canvas_layer); PBL_LOG(LOG_LEVEL_DEBUG, "line(p1(%d, %d), p2(%d, %d), width=%d), angle=%d)", data->p1.x, data->p1.y, data->p2.x, data->p2.y, data->stroke_width, (int)(data->rotation_angle * 360 / TRIG_MAX_ANGLE)); } static void select_handler(ClickRecognizerRef recogni...
aller_messages(void) { s_valid_session = &s_session; // This length excludes the sizeof(PebbleProtocolHeader). size_t bytes_free = comm_session_send_buffer_get_max_payload_length(&s_session); bytes_free += sizeof(PebbleProtocolHeader); const int num_sbs = 1 + (bytes_free / (sizeof(PebbleProtocolHeader) + 1 ...
(write_sb)
/* * 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...
f(two_third, 0, half)
); cl_assert_equal_i(174762, f(four_third, 0, half)); cl_assert_equal_i(-131066, f(-half, half, ANIMATION_NORMALIZED_MAX)); cl_assert_equal_i(-65533, f(0, half, ANIMATION_NORMALIZED_MAX)); cl_assert_equal_i(-21843, f(third, half, ANIMATION_NORMALIZED_MAX)); cl_assert_equal_i(21845, f(two_third, half, ANI...
; attribute_list_add_cstring(&list, AttributeIdSubtitle, "Subtitle"); cl_assert_equal_s(attribute_get_string(&list, AttributeIdSubtitle, ""), "Subtitle"); cl_assert_equal_s(attribute_get_string(&list, AttributeIdTitle, ""), "Title1"); cl_assert_equal_i(list.num_attributes, 2); attribute_list_add_cstring(&li...
attribute_deserialize_list(&attribute_data_buffer_pointer, attribute_data_buffer + buffer_size, &deserialization_cursor, end, deserialization_result_attribute_list)
, true); // Check that the app glance subtitle string we deserialized matches the string we expect cl_assert_equal_s(attribute_get_string(&deserialization_result_attribute_list, AttributeIdSubtitleTemplateString, NULL), expected_app_gl...
p://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. * See the License for the specific language governing permis...
for (int i = 0; i < checksum->accumulated_length; ++i) { checksum->reg = prv_crc_byte(checksum->reg, checksum->accumulator[i]); }
} return checksum->reg; } uint32_t legacy_defective_checksum_memory(const void * restrict data, size_t length) { LegacyChecksum checksum; legacy_defective_checksum_init(&checksum); legacy_defective_checksum_update(&checksum, data, length); return legacy_defective...
origin.x; const int16_t dest_end_x = MIN(grect_get_max_x(&dest_rect), dest_row_info.max_x + 1); if (dest_end_x < dest_begin_x) { continue; } const GBitmapDataRowInfo src_row_info = gbitmap_get_data_row_info(src_bitmap, src_y); const uint8_t *src = src_row_info.data; // This is the initial...
MIN(grect_get_max_x(&dest_rect), dest_row_info.max_x + 1)
; if (dest_end_x < dest_begin_x) { continue; } const GBitmapDataRowInfo src_row_info = gbitmap_get_data_row_info(src_bitmap, src_y); const uint8_t *src = src_row_info.data; // This is the initial position that takes into account destination delta shift const in...
/* * 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...
{ // Special case: the final encoded block is 254 bytes long with no // zero after it. While it's technically a valid encoding if a // trailing zero is appended, it causes the output to be one byte // longer than it needs to be. This violates consistent overhead // cont...
urces_get_glyph_horiz_advance(&s_font_cache, 'a', &s_font_info)); } void test_text_resources__horiz_advance_multiple(void) { uint32_t gothic_18_handle = RESOURCE_ID_GOTHIC_18; cl_assert(text_resources_init_font(0, gothic_18_handle, 0, &s_font_info)); int8_t horiz_advance = text_resources_get_glyph_horiz_advance...
(&s_font_cache, WILDCARD_CODEPOINT, &s_font_info)
); const GlyphData *glyph = text_resources_get_glyph(&s_font_cache, WILDCARD_CODEPOINT, &s_font_info); cl_assert_equal_i(glyph->header.width_px, 7); cl_assert_equal_i(glyph->header.height_px, 15); uint8_t gl...
/* * 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_update_struct(&data)
; } uint32_t mfg_info_get_rtc_freq(void) { return prv_fetch_struct().rtc_freq; } void mfg_info_set_rtc_freq(uint32_t rtc_freq) { MfgData data = prv_fetch_struct(); data.rtc_freq = rtc_freq; prv_update_struct(&data); } void mfg_info_get_model(char* buffer) { MfgData data = prv_fetch_struct(); strncpy(buff...
ct app_fetch_put_bytes_event_handler() to be called when the phone // gets our fetch request and issues a putbytes request. // Start the timeout watchdog to catch us in case the phone never issues the putbytes request. put_bytes_expect_init(FETCH_TIMEOUT_MS); } //! Called from the system task. Translates an Endp...
{ case APP_FETCH_INSTALL_RESPONSE: prv_handle_app_fetch_install_response(response_data->result_code); break; default: PBL_LOG(LOG_LEVEL_ERROR, "Invalid message received, command: %u result: %u", response_data->command, response_data->result_code); prv_cleanup(AppFetchResultGene...
} //! Callback that is placed in the endpoints table. As of now, only responses will come through this //! callback as all commands are originally sent to the phone. void app_fetch_protocol_msg_callback(CommSession *session, const uint8_t *data, size_t length) { if (length < sizeof(AppFetchResponseData)) { PBL_...
/* * 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...
app_malloc_check(sizeof(LowPowerAppData))
/* * 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...
(NULL == bmp)
; #endif #ifdef PLATFORM_SNOWY bmp = gbitmap_create_blank(s10, GBitmapFormat1Bit); cl_assert(NULL != bmp); cl_assert(NULL == bmp->data_row_infos); bmp = gbitmap_create_blank(s10, GBitmapFormat8Bit); cl_assert(NULL != bmp); cl_assert(NULL == bmp->data_row_infos); bmp = gbitmap_create_blank(s10, GBitmapFo...
/* * 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 JERRY_VALUE_HAS_TYPE(value, 'function'); }
bool jerry_value_is_number(const jerry_value_t value) { return JERRY_VALUE_HAS_TYPE(value, 'number'); } bool jerry_value_is_null(const jerry_value_t value) { return ((bool)EM_ASM_INT({ return __jerryRefs.get($0) === null; }, value)); } bool jerry_value_is_object(const jerry_value_t value) { return !...
is(TO_TRIG(90), TO_TRIG(360)), ((EllipsisDrawConfig){ .start_quadrant = (EllipsisPartDrawConfig){TO_TRIG(90),GCornerBottomRight}, .full_quadrants = (GCornersBottom | GCornerTopLeft), .end_quadrant = (EllipsisPartDrawConfig){TO_TRIG(0),GCornerTopRight} })); cl_assert_equal_edc(prv_calc_draw_config_ellip...
TO_TRIG(90 + 45 - 360)
, TO_TRIG(360 + 45 - 360)), ((EllipsisDrawConfig){ .start_quadrant = (EllipsisPartDrawConfig){TO_TRIG(90 + 45),GCornerBottomRight}, .full_quadrants = GCornersLeft, .end_quadrant = (EllipsisPartDrawConfig){TO_TRIG(45),GCornerTopRight} })); // Pair of quadrants cl_assert_equal_edc(prv_calc_draw_config_...
NT16_MAX; // height is clamped to content size GFont font = fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD); TextLayer *text_layer = &dialog->text_layer; text_layer_init_with_parameters(text_layer, &GRect(x, y, w, h), dialog->buffer, font, dialog->text_color, GColorClear, ...
{ // If there isn't an action bar and there is more content than fits the screen // setup the status layer and content_down_arrow_layer ContentIndicator *indicator = scroll_layer_get_content_indicator(scroll_layer); content_indicator_configure_direction( indicator, ContentIndicatorDire...
} dialog_load(dialog); } static void prv_expandable_dialog_appear(Window *window) { ExpandableDialog *expandable_dialog = window_get_user_data(window); Dialog *dialog = expandable_dialog_get_dialog(expandable_dialog); scroll_layer_update_content_indicator(&expandable_dialog->scroll_layer); dialog_appear(...
/! @note this is the same as Large until ExtraLarge is designed [PreferredContentSizeExtraLarge] = menu_cell_basic_cell_height(), })[runtime_platform_content_size]; } static void prv_draw_row_callback(GContext *ctx, const Layer *cell_layer, MenuIndex *cell_index, void *data) { ...
notification_storage_get(id, &notification)
) { return; } prv_add_notification(s_data, id); // NOTE: To avoid having two flash reads, we only read and validate the notification once. // We do it here, instead of in the function call below. If the above // notification_storage validation above is removed, then we should at least valida...
animation_get_curve(a)
, AnimationCurveDefault); animation_destroy(a); } void test_animation__current_interpolate_override(void) { // just some pointer to compare against AnimationCurveFunction curve = (void*)1; InterpolateInt64Function interpolation = (void*)2; AnimationState *state = kernel_applib_get_animation_state(); cl_a...
LEGATTErrorSuccess); ams_handle_write_response(entity_update, BLEGATTErrorSuccess); cl_assert_equal_b(ams_is_registered_for_all_entity_updates(), true); fake_gatt_client_op_clear_write_list(); } static uint8_t prv_ams_command_for_music_command(MusicCommand command) { switch (command) { case MusicCommandP...
(s_conn_mgr_states[BtConsumerMusicServiceIndefinite].state, ResponseTimeMiddle)
; cl_assert_equal_i(s_conn_mgr_states[BtConsumerMusicServiceIndefinite].max_period_secs, MAX_PERIOD_RUN_FOREVER); music_request_reduced_latency(false /* reduced_latency */); cl_assert_equal_i(s_conn_mgr_states[BtConsumerMusicServiceIndefinite].state, ResponseTimeMax); } v...
5, alarm_day_text_5); cl_assert_equal_s(alarm_day_text_5, "Wednesdays"); bool schedule_6[7] = {false, false, false, false, true, false, false}; char alarm_day_text_6[32] = {0}; alarm_get_string_for_custom(schedule_6, alarm_day_text_6); cl_assert_equal_s(alarm_day_text_6, "Thursdays"); bool schedule_7[7] =...
(ALARM_KIND_WEEKDAYS, all_caps)
left corner rotation point, Angle 45 setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpSet); graphics_draw_rotated_bitmap(&ctx, test_image_color, GPointZero, DEG_TO_TRIGANGLE(45), GPointZero); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "d...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_offset_rightedge_2.Xbit.pbi")
nt16_t length_out; const bool success = circular_buffer_read(buffer, remaining, &data_out, &length_out); PBL_ASSERTN(success); memcpy(out_buf, data_out, length_out); out_buf += length_out; remaining -= length_out; } PBL_ASSERTN(remaining == 0); circular_buffer_consume(buffer, sizeof(*event)...
if (s_manager_state.sensor_stable) { // If we just went on-wrist or off-wrist, reset the stable state bool off_wrist_now = (data->hrm_quality == HRMQuality_OffWrist); if (off_wrist_now != s_manager_state.off_wrist_when_stable) { s_manager_state.sensor_stable = false; s_manager_state.sensor_start...
// Start the tick counter if this is the first reading since power-on or off-wrist if (s_manager_state.sensor_start_ticks == 0) { s_manager_state.sensor_start_ticks = rtc_get_ticks(); } // When first powering up, we can get "Excellent" quality readings the first few seconds, even // though the BPM is 0...
, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, STROKE_SMALL); graphics_draw_circle(&ctx, CENTER_OF_OFFSET_RECT, RADIUS_SMALL); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_aa_r1_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, tr...
gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_aa_r8_quad_top_left.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, STROKE_SMALL); graphics_circle_quadrant_draw_stroked_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, STROKE_SMALL,GCornerTopRight); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_aa_r8_quad_top_right.${BIT_DEPTH_NAME}.p...
se static void prv_receiver_reset(void); static void prv_send_response(ResponseCode code, uint32_t token); static void prv_lock_pb_job_state(void) { taskENTER_CRITICAL(); } static void prv_unlock_pb_job_state(void) { taskEXIT_CRITICAL(); } //! Simply returns the next free buffer from the PB jobs array. Returns ...
{ PBL_LOG(LOG_LEVEL_INFO, "Not enough memory for PB pre-ack, falling back to legacy mode"); put_jobs->enable_preack = false; break; }
else { break; } } put_jobs->job[i].buffer = buffer; } put_jobs->num_allocated_pb_jobs = i; return true; } static void prv_set_responsiveness(ResponseTimeState state, uint16_t timeout_secs) { comm_session_set_responsiveness(comm_session_get_system_session(), ...
tributeList *out, const AttributeList *in, uint8_t *buffer, uint8_t *const buffer_end) { out->num_attributes = in->num_attributes; uint8_t *write_ptr = buffer; out->attributes = (Attribute *)write_ptr; // shallow copy the attributes for (int i = 0; i < in->num_attributes; i++) { i...
if (attrib_hdr->length != sizeof(uint32_t)) { return false; }
break; case AttributeTypeStringList: break; default: break; } cursor += attrib_hdr->length; if (cursor > val_end) { return false; } else { has_attribute[attrib_hdr->id] = true; } } return true; } void attribute_init_string(Attribute *attribute, c...
const ANCSAttribute *app_id, const TimelineItemActionGroup *pebble_actions, ANCSProperty properties) { TimelineItemAction *action = item->action_group.actions; // The order the actions get filled is important. See commen...
prv_max_ellipsified_cstring_size(app_id)
; if (prv_should_add_sender_attr(app_id, title)) { required_space_for_strings += prv_max_ellipsified_cstring_size(title); } int num_pebble_actions = 0; if (notif_prefs) { for (int i = 0; i < notif_prefs->action_group.num_actions; i++) { TimelineItemAction *action = &notif_prefs->action_group.act...
(status_layer)
; status_bar_layer_set_title(status_layer, text, false, false); status_bar_layer_set_separator_mode(status_layer, OPTION_MENU_STATUS_SEPARATOR_MODE); status_bar_layer_set_colors(status_layer, GColorWhite, GColorBlack); layer_add_child(&window->layer, status_bar_layer_get_layer(status_layer)); } // Deinit the c...
, AttributeIdAppName, "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 iOSNotifPref...
ios_notif_pref_db_is_dirty(&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...
/* * 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 bt_uuid_expand_32bit(uuid16); }
Uuid bt_uuid_expand_32bit(uint32_t uuid32) { return (const Uuid) { BT_UUID_EXPAND(uuid32) }; }
, 0x22, 0xb4, }; void test_blob_db_endpoint__handle_insert_command_success(void) { uint8_t *cmd_ptr = (uint8_t*)s_insert_cmd_success; // check for INSERT cl_assert(BLOB_DB_COMMAND_INSERT == *(uint8_t*)cmd_ptr); cmd_ptr += sizeof(uint8_t); // check for token uint16_t token = *(uint16_t*)cmd_ptr; cl_ass...
cl_assert(sizeof(s_insert_cmd_no_value_size) < 8)
; // Process Command uint8_t *resp_ptr = process_blob_db_command(s_insert_cmd_no_value_size, sizeof(s_insert_cmd_no_value_size)); // Check Response cl_assert(0 < *(uint16_t*)resp_ptr); resp_ptr += sizeof(uint16_t); cl_assert(BLOB_DB_INVALID_DATA == *resp_ptr); resp_ptr += sizeof(uint8_t); cl_assert(...
------------------------ // Get the state variables for the given task static AccelSubscriberState* prv_subscriber_state(AccelSessionRef session) { if (session == NULL) { return NULL; } // Look for this session in our list of subscribers ListNode* node = list_find(s_data_subscribers, prv_session_ref_list_f...
{ ACCEL_LOG_DEBUG("Restoring FIFO settings after peek"); prv_update_driver_config(); }
mutex_unlock_recursive(s_mutex); } // ---------------------------------------------------------------------------------------------- // Reset the FIFO mode restoration timer for another N seconds static void prv_set_restore_fifo_mode_timer(void) { s_temp_peek_mode = true; bool success = new_timer_start(s_timer...
/* * 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...
utf8_iter_init(utf8_iter, utf8_iter_state, text_box_params->utf8_bounds, start)
; char_iter_state->text_box_params = text_box_params; iter_init(char_iter, (IteratorCallback) char_iter_next, char_iter_prev, (IteratorState) char_iter_state); } typedef enum { WordStateStart, WordStateIdeograph, WordStateGrowing, WordStateJoining, WordStateEnd, } WordState; WordState word_state_updat...
/* * 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...
(test->name)
); window_set_user_data(window, app_data); window_set_fullscreen(window, true); layer_set_update_proc((Layer *) window, prv_test_update_proc); app_window_stack_push(window, false); } static uint16_t prv_get_num_rows(struct MenuLayer *menu_layer, uint16_t section, void *callback...
keupId), (uint8_t*)&entry, sizeof(WakeupEntry)); } } DEFINE_SYSCALL(void, sys_wakeup_cancel_all_for_app, void) { mutex_lock(s_mutex); { SettingsFile wakeup_settings; if (settings_file_open(&wakeup_settings, SETTINGS_FILE_NAME, SETTINGS_FILE_SIZE) == S_SUCCESS) { // Update settings file rem...
prv_wakeup_rewrite_kernel_bg_cb(NULL)
; } else { system_task_add_callback(prv_wakeup_rewrite_kernel_bg_cb, NULL); } }
param max_elapsed_ticks - The max amount of time to spend attempting to //! find / create the free space. If 0, then there is no timeout static void pfs_prepare_for_file_creation(uint32_t file_size, uint32_t max_elapsed_ticks) { uint16_t pages_to_find = (file_size + PFS_PA...
find_free_page(&next_page, use_gc_allocator, 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...
cl_assert_equal_i(s_callback_status, expected_status)
; } static void prv_test_erase_optimal_range( uint32_t min_start, uint32_t max_start, uint32_t min_end, uint32_t max_end, EraseCommand *expected_commands) { flash_erase_optimal_range(min_start, max_start, min_end, max_end, prv_callback, s_callback_ctx); prv_assert_erase_commands...
id menu_select_callback(int index, void *ctx) { PBL_LOG(LOG_LEVEL_DEBUG, "Selected menu item %d", index); // Here we just change the subtitle to a literal string s_app_data->menu_items[index].subtitle = "You've hit select here!"; // Mark the layer to be updated layer_mark_dirty(simple_menu_layer_get_lay...
if (index == 10) { PBL_LOG(LOG_LEVEL_INFO, "Causing bus fault in app"); typedef void (*KaboomCallback)(void); KaboomCallback kaboom = 0; kaboom(); } else if (index == 11) { PBL_LOG(LOG_LEVEL_INFO, "Infinite Loop on system task"); system_task_add_callback(stuck_system_task_callback, NULL); ...
} // ================================================================================= static void prv_window_load(Window *window) { TestTimersAppData *data = s_app_data; int i = 0; data->menu_items[i++] = (SimpleMenuItem) { .title = "croak", .callback = menu_select_callback, }; data->menu_...
rev_state == SmartstrapStateReadComplete) && (new_state == SmartstrapStateReadReady)) { PBL_ASSERT_TASK(PebbleTask_KernelBackground); } else { // all other transitions are invalid WTF; } } bool smartstrap_fsm_state_test_and_set(SmartstrapState expected_state, SmartstrapState next_state) { ...
mutex_lock(s_state_lock)
; } void smartstrap_state_unlock(void) { mutex_unlock(s_state_lock); } void smartstrap_state_assert_locked_by_current_task(void) { mutex_assert_held_by_curr_task(s_state_lock, true); }
f(raw_buf)); prv_convert_accel_raw_data_to_mgs(raw_buf, data); // FIXME: assuming the timestamp on the samples is NOW! PBL-33765 data->timestamp_us = prv_get_curr_system_time_ms() * 1000; BMA255_DBG("%"PRId16" %"PRId16" %"PRId16, data->x, data->y, data->z); } typedef enum { BMA255Axis_X = 0, BMA255Axis_Y...
BMA255_DBG("Slope Int")
/* * 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_init_with_parameters(text_layer, frame, NULL, NULL, GColorBlack, GColorWhite, GTextAlignmentLeft, GTextOverflowModeTrailingEllipsis); }
TextLayer* text_layer_create(GRect frame) { TextLayer* layer = applib_type_malloc(TextLayer); if (layer) { text_layer_init(layer, &frame); } return layer; } void text_layer_destroy(TextLayer* text_layer) { if (!text_layer) { return; } text_layer_deinit(text_layer); applib_free(text_layer); } ...
fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, 3); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw3_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8...
(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, false, 2)
; graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw2_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // SW = 3 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, false, 3); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP); cl_chec...
others Codepoint codepoint = utf8_iter_state->codepoint; if (codepoint_should_skip(codepoint) || codepoint_is_formatting_indicator(codepoint)) { if (!iter_next(char_iter)) { return false; } } while (codepoint_is_zero_width(utf8_iter_state->codepoint)) { if (utf8_iter_state->codepoint == 0) { ...
iter_next(utf8_iter)
Task static void prv_schedule_consumer_message_handler(AppOutboxConsumer *consumer, AppOutboxMessage *message) { void (*callback)(void *) = (__typeof__(callback))consumer->message_handler; PebbleEvent event = { .type = PEBBLE_APP_OUTBOX_MSG_EVENT, .app_outb...
prv_schedule_sent_handler(sent_handler, cb_ctx, status)
IT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_ellipsis_clip_across_nx); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_ellipsis_clip_across_nx.${BIT_DEPTH_NAME}.pbi")); test_graphics_cont...
layer_render_tree(&canvas, &ctx)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_wordwrap_clip_outside_nx.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_wordwrap_clip_outside_x); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitma...
e(const PebbleProcessMd *app_md) { return 1400; } // ------------------------------------------------------------------------------------------------ bool worker_manager_launch_new_worker_with_args(const PebbleProcessMd *app_md, const void *args) { PBL_ASSERT_TASK(PebbleTask_KernelMain); // Don't launch workers...
heap_init(worker_heap, worker_segment.start, worker_segment.end, /* enable_heap_fuzzing */ false)
rmal/contacts/contacts.h" #include "os/mutex.h" #include "system/passert.h" #include "system/status_codes.h" #include "util/units.h" #include "util/uuid.h" #define SETTINGS_FILE_NAME "contactsdb" #define SETTINGS_FILE_SIZE (KiBYTES(30)) static struct { SettingsFile settings_file; PebbleMutex *mutex; } s_contacts_...
(SETTINGS_FILE_NAME)
; mutex_unlock(s_contacts_db.mutex); return rv; }
/* * 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_ASSERTN(index < NUM_ACTION_BAR_ITEMS)
; return (bool) (action_bar->is_highlighted & (1 << index)); } static void prv_register_redraw_timer(ActionBarLayer *layer); static void prv_timed_redraw(void *context) { ActionBarLayer *action_bar = context; layer_mark_dirty(&action_bar->layer); action_bar->redraw_timer = NULL; int64_t now = prv_get_precis...
1184, 152, -152}, { 1344, 104, -152}, { 1600, 64, -152}, { 1328, -40, -96}, { 1096, -96, -160}, { 1080, -72, -72}, // 10 seconds { 1016, -32, -192}, { 1216, -40, -248}, { 1192, 8, -256}, { 888, 16, -248}, { 680, 48, -304}, { 672, 88, -248}, { 784, 128, -232}, { 1...
{ 1296, -24, -232}, { 1440, 0, -224}, { 1176, 48, -216}, { 920, 120, -280}, { 936, 160, -208}, { 1080, 216, -120}, { 1240, 336, -152}, { 1272, 520, -216}, { 1632, 520, -16}, { 1400, 616, -248}, { 1056, 496, -200}, { 1272, 656, -288}, { 976, 616, -296}, { 1184, 448...
{ 1536, 368, -200}, { 1360, 152, -24}, { 1288, -8, 24}, // 18 seconds { 1336, 24, -80}, { 1320, 160, -80}, { 1200, 136, -88}, { 1328, -24, -104}, { 1072, -32, -128}, { 912, 8, -168}, { 1120, 40, -168}, { 848, 8, -160}, { 992, 32, -176}, { 1344, 32, -256}, { 1...
(handler, offset)
; } BTErrno ble_client_set_subscribe_handler(BLEClientSubscribeHandler handler) { const off_t offset = offsetof(BLEAppState, gatt_characteristic_subscribe_handler); return prv_set_handler(handler, offset); } BTErrno ble_client_set_buffer_empty_handler(BLEClientBufferEmptyHandler empty_handler) { // TODO retur...
= layer_get_bounds(layer); // Draw lines to contain 'hole' and 'par' sections. // Magic numbers measured from design spec const int16_t vertical_divider_height = PBL_IF_ROUND_ELSE(107, 50); const int16_t horizontal_divider_width = PBL_IF_ROUND_ELSE(51, bounds.size.w - ACTION_BAR_WIDTH); const int16_t vertica...
status_bar_layer_set_separator_mode(data->status_layer, StatusBarLayerSeparatorModeDotted)
; #endif layer_add_child(background, status_bar_layer_get_layer(data->status_layer)); // labels const char * const font_key_label = FONT_KEY_GOTHIC_09; // back, mid, front numbers const char * const font_key_small_numbers = PBL_IF_ROUND_ELSE(FONT_KEY_LECO_20_BOLD_NUMBERS, ...
60, 440, 688}, { -2928, 640, 592}, { -2872, 400, 656}, { -2408, 728, 656}, // 57 seconds { -1864, -96, 200}, { -1616, 360, 280}, { -1064, 480, 288}, { -800, 472, 120}, { -640, 416, 112}, { -568, 304, 96}, { -784, 424, 232}, { -1152, 600, 240}, { -1096, 488, 288}, ...
{ -920, -280, -216}, { -816, 160, -384}, { -1160, -112, -64}, { -1256, 112, -8}, { -1504, 232, 176}, { -1936, 192, 216}, { -2288, 504, 224}, { -1904, 288, 272}, { -1216, 552, 384}, { -1112, -160, 224}, { -1152, 200, 224}, { -1104, 192, 264}, { -1096, 240, 264}, { ...
{ -1304, 176, 344}, { -1504, 272, 344}, { -1520, 352, 336}, // 65 seconds { -1480, 624, 560}, { -1120, 424, 232}, { -784, 544, 224}, { -944, 656, 152}, { -1400, 520, 112}, { -1832, 352, 64}, { -1720, 264, 152}, { -1488, 224, 152}, { -1320, 208, 160}, { -1192, 216...
i/kino/kino_reel/scale_segmented.h" #include "applib/ui/kino/kino_reel/transform.h" #include "applib/ui/kino/kino_reel/unfold.h" #include "kernel/pbl_malloc.h" #include "kernel/ui/kernel_ui.h" #include "services/common/evented_timer.h" #include "services/normal/timeline/notification_layout.h" #include "services/normal/...
{ if (peek_layer) { peek_layer_deinit(peek_layer); } task_free(peek_layer); }
void peek_layer_init(PeekLayer *peek_layer, const GRect *frame) { *peek_layer = (PeekLayer) { .icon_offset_y = PEEK_LAYER_ICON_OFFSET_Y, .subtitle_margin = PEEK_LAYER_SUBTITLE_MARGIN, .dot_diameter = 9, }; // peek layer layer_init(&peek_layer->layer, frame); layer_set_clips(&peek_layer->layer, f...
/* * 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...
(LOG_LEVEL_DEBUG, "Sending sysmsg: %u", type)
; } static void prv_reset_kernel_bg_cb(void *unused) { PBL_LOG(LOG_LEVEL_ALWAYS, "Rebooting to install firmware..."); RebootReason reason = { RebootReasonCode_SoftwareUpdate, 0 }; reboot_reason_set(&reason); system_reset(); } static void prv_ui_update_reset_delay_timer_callback(void *unused) { system_task_a...
/* * 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 (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)->layer; }
} static void prv_run_accel_test(int *sample_arr, int num_items) { PebbleTask tasks[] = { PebbleTask_KernelMain, PebbleTask_Worker, PebbleTask_App }; AccelManagerState* sessions[3]; if (num_items > 3) { return; // we only support 3 simultaneous subscribers } int fastest_rate = 0; AccelRawData fake_bu...
{ AccelRawData fake_buf[30]; stub_pebble_tasks_set_current(PebbleTask_KernelMain); AccelManagerState *main_session = sys_accel_manager_data_subscribe( ACCEL_SAMPLING_10HZ, prv_noop_sample_handler, NULL, PebbleTask_KernelMain); sys_accel_manager_set_sample_buffer(main_session, fake_buf, 11); stub_pebbl...
/* * 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(gbitmap_get_format(bitmap), GBitmapFormat4BitPalette)
; } // Tests 8-bit palettized 64-color PNG loading into gbitmap // Result: // - gbitmap matches platform loaded PNG void test_png__color_8_bit(void) { GBitmap *bitmap = setup_png_test(TEST_PNG_FILE_FMT(8bit)); cl_assert(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE_FMT(8bit))); cl_assert_equal_i(gbitmap_get_format(bitm...
{ 1528, 344, -16}, { 1536, 336, -40}, { 1592, 384, -32}, { 1560, 368, 136}, { 1328, 304, 96}, { 1112, 272, 32}, { 936, -1024, 160}, { 576, -240, 32}, { 840, -296, -264}, { 1432, -48, 40}, { 1416, 296, -40}, { 1496, 280, 72}, { 1616, 480, -64}, { 1760, 768, -80}, ...
{ -400, 752, -280}, { -496, 808, -264}, { -472, 888, -312}, { -480, 840, -224}, { -560, 968, -160}, { -496, 904, -240}, { -504, 744, -168}, // 26 seconds { -520, 736, -96}, { -544, 912, -56}, { -432, 848, -64}, { -400, 888, 48}, { -432, 752, -16}, { -368, 768, 312...
layer, prv_direction_for_recognizer(recognizer), is_repeating); } } static void prv_swap_layer_click_config_provider(void *context) { // Use raw clicks to avoid single click delay which results from having multi-click enabled window_raw_click_subscribe(BUTTON_ID_UP, prv_raw_click_handler, NULL, context); windo...
(&swap_layer->arrow_layer.arrow_bitmap, RESOURCE_ID_ARROW_DOWN)
; const GRect arrow_frame = GRect( 0, frame->size.h - LAYOUT_ARROW_HEIGHT, frame->size.w, LAYOUT_ARROW_HEIGHT); layer_init(&swap_layer->arrow_layer.layer, &arrow_frame); layer_set_update_proc(&swap_layer->arrow_layer.layer, prv_arrow_layer_update_proc); layer_add_child(layer, &swap_layer->arrow_layer.lay...