prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
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 in writing, softw...
sniprintf(crash_reason, CRASH_REASON_BUFFER_SIZE, i18n_get(crash_str, crash_reason), app_found ? " " : "", MAX_APP_NAME_STRING_LENGTH, app_found ? entry.name : "")
; i18n_free(crash_str, crash_reason); return crash_reason; } static void prv_push_worker_crash_dialog(void *context) { const AppInstallId app_install_id = (AppInstallId) context; WorkerCrashDialogData *data = kernel_zalloc_check(sizeof(WorkerCrashDialogData)); data->app_install_id = app_install_id; // 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...
{ AttributeList attr_list = {}; uint8_t metric_buffer[Uint32ListSize(3)]; Uint32List *metric_values = (Uint32List *)metric_buffer; metric_values->num_values = 3; metric_values->values[0] = 100; metric_values->values[1] = 200; metric_values->values[2] = 300; attribute_list_add_uint32_list(&attr_list, Att...
static void prv_check_attribute_list_serialize(AttributeList *attr_list_to_serialize, const uint8_t *expected_attr_list_serialized, size_t expected_attr_list_serialized_size) { uint8_t buffer[expected_attr_list_serialized_size]; const...
/* * 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...
RCC_MCO1Config(RCC_MCO1Source_LSE, RCC_MCO1Div_1)
; ++s_refcount; } else { PBL_ASSERTN(s_refcount > 0); --s_refcount; if (s_refcount == 0) { PBL_LOG(LOG_LEVEL_DEBUG, "Disabling MCO1"); gpio_analog_init(&BOARD_CONFIG_MCO1.an_cfg); } } portEXIT_CRITICAL(); }
15 seconds { -928, -224, -24}, { -896, -232, -72}, { -952, -224, -72}, { -880, -96, -136}, { -872, -8, -248}, { -840, 416, -528}, { -864, 368, -944}, { -736, 216, -800}, { -824, 368, -760}, { -840, 280, -552}, { -888, 128, -304}, { -848, -104, -152}, { -944, -32, -10...
{ -880, 32, -40}, { -888, 40, 64}, { -984, 24, 112}, { -920, -88, 64}, { -944, -224, 72}, { -936, -296, 40}, { -912, -384, 112}, { -864, -384, 184}, { -848, -288, 216}, { -888, -208, 160}, { -824, -56, -24}, { -960, 32, 8}, { -768, 192, 96}, { -832, 664, -24}, ...
{ -968, 320, -208}, // 23 seconds { -928, 280, -272}, { -936, 160, -320}, { -1056, -56, -104}, { -1024, -8, -64}, { -880, -24, -144}, { -904, 80, -344}, { -672, 112, -472}, { -752, 368, -504}, { -680, 560, -504}, { -712, 664, -416}, { -784, 512, -320}, { -928, 28...
Attribute action1_attributes[] = { {.id = AttributeIdTitle, .cstring = "Dismiss"}, }; static Attribute action2_attributes[] = { {.id = AttributeIdTitle, .cstring = "Like"}, {.id = AttributeIdAncsAction, .int8 = 1} }; static Attribute attributes[] = { {.id = AttributeIdTitle, .cstring = "Test Notification"}...
string_list_get_at(list, 3)
); // 2 strings (last is not terminated and will fall through) will return 2 strings // when deserializing, the deserializer puts a \0 at the end // this case demonstrates the problem with incorrectly initialized data list->serialized_byte_length = 3; list->data[0] = 'a'; list->data[1] = '\0'; list->data...
/* * 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(system_flash_erase(FLASH_BASE, 0, NULL, NULL)); cl_assert_equal_i(0, erased_sector); cl_assert(flash_locked); }
void test_system_flash__erase_one_byte(void) { cl_assert(system_flash_erase(FLASH_BASE, 1, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(0, 0), erased_sector); cl_assert(flash_locked); } void test_system_flash__erase_one_byte_in_middle_of_sector(void) { cl_assert(system_flash_erase(FLASH_BASE + 12345, 1, NULL...
_write(attr, NULL, &buffer_len)); // smartstrap_attribute_end_write() assert_result_invalid(app_smartstrap_attribute_end_write(NULL, 0, false)); assert_result_invalid(app_smartstrap_attribute_end_write(NULL, 0, true)); assert_result_invalid(app_smartstrap_attribute_end_write(NULL, 100, false)); assert_result...
app_smartstrap_attribute_begin_write(attr, &write_buffer2, &write_length2)
); cl_assert(write_buffer2 == NULL); cl_assert(write_length2 == 0); // end the write request without sending anything assert_result_invalid(app_smartstrap_attribute_end_write(attr, 0, false)); // start the write request again write_buffer = NULL; write_length = 0; assert_result_ok(app_smartstrap_attri...
s status, PebbleVoiceServiceEventData *data) { PebbleEvent event = { .type = PEBBLE_VOICE_SERVICE_EVENT, .voice_service = { .type = event_type, .status = status, .data = data, } }; event_put(&event); } //! Expects s_lock is held by caller static void prv_h...
(&s_app_uuid, uuid_str)
; PBL_LOG(LOG_LEVEL_INFO, "Starting app-initiated voice dictation session for app %s", uuid_str); } #if !defined(TARGET_QEMU) // TODO: replace stub #endif // TODO: replace fake values AudioTransferInfoSpeex transfer_info = (AudioTransferInfoSpeex) { .sample_rate = 0, .bit_rate = 0, .frame_size...
*context) { ActivityDemoAppData *data = context; activity_test_set_sleep_history(); snprintf(data->debug_card.dialog_text, sizeof(data->debug_card.dialog_text), "Sleep history changed"); prv_display_alert(data->debug_card.dialog_text); } // --------------------------------------------------------...
(&num_sessions, sessions)
/* * 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 (s_charging_forced_disable) { return false; }
return battery_charge_controller_thinks_we_are_charging_impl(); } bool battery_is_usb_connected(void) { if (s_charging_forced_disable) { return false; } return battery_is_usb_connected_impl(); } void battery_force_charge_enable(bool charging_enabled) { s_charging_forced_disable = !charging_enabled; ...
y 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. * See the License for the s...
(ctx, cell_layer, highlight)
; if (callbacks->draw_row) { const bool is_selected = menu_cell_layer_is_highlighted(cell_layer); callbacks->draw_row(callbacks, ctx, cell_layer, row, is_selected); } } static uint16_t prv_get_num_rows_callback(MenuLayer *menu_layer, uint16_t section_index, void *c...
read_and_consume(&buffer, &client, storage, 2); cl_assert_equal_i(shared_circular_buffer_get_read_space_remaining(&buffer, &client), 0); } void test_shared_circular_buffer__subsampling_2of5(void) { SharedCircularBuffer buffer; uint16_t item_size = 2; uint8_t storage[12*item_size]; uint8_t out_buffer[12*item...
subsampled_shared_circular_buffer_client_set_ratio(&client, 2, 3)
; // Consume "5f6g7h8i" cl_assert_equal_i(shared_circular_buffer_read_subsampled( &buffer, &client, item_size, out_buffer, 3), 3); // Normally the next read would skip 5f, but changing the ratio resets the // subsampling state and the first sample after resetting the state is never // skipped. cl_asse...
/* * 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...
attributes_actions_init(&item->attr_list, &item->action_group, &buffer, num_attributes, num_actions, attributes_per_action)
; if (string_buffer != NULL) { *string_buffer = buffer; } return true; } T_STATIC bool prv_deep_copy_attributes_actions(AttributeList *attr_list, TimelineItemActionGroup *action_group, TimelineItem *item_out) { ...
/* * 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_last_event = *e; 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...
(ORDER_FILE, OP_FLAG_OVERWRITE, FILE_TYPE_STATIC, storage_size)
; if (fd == E_DOES_NOT_EXIST) { // File doesn't exist, need to create a new file. fd = pfs_open(ORDER_FILE, OP_FLAG_WRITE, FILE_TYPE_STATIC, storage_size); } if (fd < 0) { PBL_LOG(LOG_LEVEL_ERROR, "Could not create app menu order file"); goto cleanup; } // write back the whole file int wro...
pute the absolute start time of this animation, backing it up by the // delay and any repeats we have already done uint32_t start_ms = parent->abs_start_time_ms; start_ms -= parent->times_played * (parent->duration_ms + parent->delay_ms); // Loop through animation and all of it's children until the "virtual no...
(!animation_private_using_legacy_2(state))
; AnimationPrivate *animation = prv_find_animation_by_handle(state, animation_h, false /*quiet*/); if (!animation) { return false; } return prv_animation_clone(state, animation); } // ------------------------------------------------------------------------------------------ static void prv_dump_animation...
in consequat sapien tincidunt vitae. " "Duis ipsum nunc, tristique sit amet blandit non, scelerisque non diam. " "Etiam condimentum aliquam dictum. Nam nisi ex, cursus in ligula sit amet, " "ultricies egestas libero. Aliquam luctus, metus quis ultricies sagittis, " "nisi orci viverra felis, vitae luctus massa ...
cl_assert_equal_i(persist_write_data(0, data, sizeof(data)), sizeof(data))
; cl_assert_equal_i(persist_get_size(0), sizeof(data)); } void test_persist__exists(void) { cl_assert_equal_i(persist_exists(0), S_FALSE); cl_assert(PASSED(persist_write_int(0, 0))); cl_assert_equal_i(persist_exists(0), S_TRUE); } void test_persist__delete(void) { cl_assert_equal_i(persist_delete(0), E_DOES...
prv_erase_complete, NULL); } } static void prv_handle_flash_write_request(const void *payload, uint32_t length) { if (length < sizeof(FlashWriteRequest)) { PBL_LOG(LOG_LEVEL_ERROR, "Invalid length (%"PRIu32")", length); return; } const FlashWriteRequest *request = payload; length -= offsetof(Fla...
(payload, payload_length)
; } else if (header->opcode == OPCODE_RESET) { prv_handle_reset_request(payload, payload_length); } else if (header->opcode == OPCODE_FLASH_GEOMETRY) { prv_handle_flash_geometry_request(payload, payload_length); } else if (header->opcode == OPCODE_FLASH_ERASE) { prv_handle_flash_erase_request(payload,...
O_RESP_MALFORMED_CMD (192) #define BULKIO_RESP_INTERNAL_ERROR (193) typedef struct PACKED Command { uint8_t opcode; union { uint8_t fd; struct PACKED OpenCommand { uint8_t domain; uint8_t data[0]; } open; struct PACKED CloseCommand { uint8_t fd; } close; struct PACKED Read...
{ s_transfer_fds[i] = (PulseTransferFD) { .impl = domain_handler, .domain_state = NULL, .transfer_state = { 0 } }; *fd = &s_transfer_fds[i]; return i; }
} return -1; } static void prv_free_fd(int fd) { s_transfer_fds[fd].impl = NULL; } PulseTransferFD* prv_get_fd(Command *cmd, size_t length) { int fd = cmd->fd; PulseTransferFD *pulse_fd = &s_transfer_fds[fd]; if (fd >= 0 && fd < MAX_PULSE_FDS && pulse_fd && pulse_fd->impl) { return pulse_fd; } else...
24 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 in writing, softwar...
portEXIT_CRITICAL()
; } SerialConsoleState serial_console_get_state(void) { SerialConsoleState state = __atomic_load_n(&s_serial_console_state, __ATOMIC_RELAXED); return state; }
/* * 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 < NUM_ACTION_BAR_ITEMS; ++i) { if ((action_bar->state_change_times[i] != 0 && (now - action_bar->state_change_times[i]) <= PRESS_ANIMATION_DURATION_MS) || (action_bar->icon_change_times[i] != 0 && (now - action_bar->icon_change_times[i]) <= ICON_CHANGE_ANIMATION_DURATIO...
} static void prv_register_redraw_timer(ActionBarLayer *action_bar) { if (!action_bar->redraw_timer) { action_bar->redraw_timer = app_timer_register(MILLISECONDS_PER_FRAME, prv_timed_redraw, action_bar); } } inline static void action_bar_set_highlighted(Actio...
change = prv_will_change, .change = prv_change, }; app_unobstructed_area_service_subscribe(handlers, s_data.context); cl_assert(fake_event_service_get_info(PEBBLE_UNOBSTRUCTED_AREA_EVENT)->handler); cl_assert_equal_p(app_state_get_unobstructed_area_state()->handlers.change, prv_change); const GRect to_ar...
cl_assert_equal_grect(unobstructed_bounds, GRect(0, 0, 190, 180))
; } void test_unobstructed_area_service__nested_layer_no_clip(void) { app_state_get_unobstructed_area_state()->area = GRect(0, 0, 400, 400); Layer root_layer = { .bounds = GRect(30, 30, 30, 30), }; Layer layer = { .bounds = GRect(20, 20, 20, 20), }; layer_add_child(&root_layer, &layer); GRect un...
dent on the sampling frequency bool toggled_power_mode = (s_accel_power_mode == BMI160_Accel_Mode_Low); if (toggled_power_mode) { bmi160_set_accel_power_mode(BMI160_Accel_Mode_Normal); } uint8_t int0_status = bmi160_read_reg(BMI160_REG_INT_STATUS_0); uint8_t int2_status = bmi160_read_reg(BMI160_REG_INT_S...
PBL_ASSERTN(retries < 10)
; return 0; } static void prv_process_fifo_frame(const uint8_t *frame_buf, AccelDriverSample *data) { const int a_begin = 0; // index within the frame where accel data starts prv_convert_accel_raw_data_to_mgs(&frame_buf[a_begin], data); } static void prv_drain_fifo(void) { // we can't drain the fifo if we are...
_InitTypeDef NVIC_InitStructure; NVIC_InitStructure.NVIC_IRQChannel = OTG_FS_WKUP_IRQn; // Lower values are higher priority - make this same or lower priority than a FreeRTOS ISR NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = (configMAX_SYSCALL_INTERRUPT_PRIORITY >> 4); NVIC_InitStructure.NVIC_I...
{ TestTimersAppData *data = app_malloc_check(sizeof(TestTimersAppData)); memset(data, 0, sizeof(TestTimersAppData)); s_app_data = data; data->window = window_create(); if (data->window == NULL) { return; } window_init(data->window, ""); window_set_window_handlers(data->window, &(WindowHandlers) { ...
/* * 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_ASSERT_TASK(PebbleTask_KernelBackground)
64, 632, -768}, { 56, 632, -768}, { 64, 632, -768}, { 56, 640, -768}, { 56, 632, -760}, { 56, 640, -760}, { 64, 632, -768}, { 56, 632, -768}, // 39 seconds { 64, 640, -760}, { 56, 632, -768}, { 64, 632, -768}, { 56, 632, -768}, { 64, 632, -760}, { 64, 632, -768},...
{ 48, 640, -760}, { 56, 640, -760}, { 56, 640, -760}, { 56, 640, -760}, { 56, 640, -760}, { 56, 648, -760}, { 56, 640, -760}, { 48, 648, -760}, { 56, 640, -760}, { 56, 640, -768}, { 64, 640, -760}, { 56, 648, -752}, // 45 seconds { 48, 640, -760}, { 48, 648, -...
{ 56, 640, -760}, { 56, 640, -768}, { 56, 648, -760}, { 56, 648, -752}, { 56, 640, -760}, { 56, 640, -760}, { 56, 640, -760}, { 56, 648, -752}, { 56, 640, -760}, { 56, 640, -752}, { 56, 640, -760}, { 56, 648, -760}, { 56, 640, -760}, { 48, 640, -760}, { 56, 6...
hWrite); flash_unlock(); } void flash_erase_subsector_blocking(uint32_t subsector_addr) { assert_usable_state(); PBL_LOG(LOG_LEVEL_DEBUG, "Erasing subsector 0x%"PRIx32" (0x%"PRIx32" - 0x%"PRIx32")", subsector_addr, subsector_addr & SUBSECTOR_ADDR_MASK, (subsector_addr & SUBSECTOR_ADDR_MASK) + ...
(LOG_LEVEL_DEBUG, "Flag Status Register: 0x%x", flag_status_register)
; PBL_LOG(LOG_LEVEL_DEBUG, "Nonvolatile Configuration Register: 0x%x", nonvolatile_config_register); PBL_LOG(LOG_LEVEL_DEBUG, "Volatile Configuration Register: 0x%x", volatile_config_register); #endif } bool flash_is_initialized(void) { return (s_flash_state.mutex != 0); } size_t flash_get_size(void) { uint32...
/* * 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...
{ #ifdef BLANK_FPGA return display_program(s_fpga_bitstream, sizeof(s_fpga_bitstream)); #endif const struct FlashBitstream *bitstream = (void *)FPGA_BITSTREAM_FLASH_ADDR; // Work around GCC bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38341 uint16_t len_complement_complement = ~bitstream->len_complement; ...
static void prv_start_command(uint8_t cmd) { GPIO_WriteBit(DISP_GPIO, DISP_PIN_SCS, Bit_RESET); delay_us(100); display_write_byte(cmd); } static void prv_send_command_arg(uint8_t arg) { display_write_byte(arg); } static void prv_end_command(void) { while (SPI_I2S_GetFlagStatus(DISP_SPI, SPI_I2S_FLAG_BSY))...
-88}, { -224, 936, -88}, { -216, 944, -88}, { -224, 936, -96}, { -224, 936, -88}, { -216, 936, -80}, { -216, 936, -88}, { -224, 936, -88}, { -224, 936, -88}, { -224, 936, -80}, { -224, 936, -80}, { -216, 928, -88}, { -216, 936, -88}, { -216, 936, -80}, { -224, 936...
{ -224, 936, -96}, // 287 seconds { -216, 936, -96}, { -216, 936, -96}, { -216, 936, -104}, { -216, 936, -96}, { -216, 936, -104}, { -224, 936, -104}, { -224, 928, -104}, { -224, 936, -104}, { -224, 936, -104}, { -216, 936, -104}, { -224, 936, -104}, { -216, 936, ...
const char *title = arg1; const char *subtitle = arg2; menu_cell_basic_draw(ctx, cell_layer, title, subtitle, NULL); } static void prv_draw_korea_regulatory_cell( GContext *ctx, const Layer *cell_layer, SystemCertificationData *cd, bool is_selected, const void *arg1, const void *arg2) { const char *title...
prv_append_certification_menu(cd, &(SystemCertificationMenuItem) { .draw_cell_fn = prv_draw_regulatory_id_cell, .arg1 = "IFETEL", .arg2 = prv_get_mexico_ifetel_id(), })
; } if (flags->has_korea_kcc) { prv_append_regulatory_compliance_mark(cd, &cd->kcc_mark); } if (flags->has_eu_ce) { prv_append_regulatory_compliance_mark(cd, &cd->ce_mark); } if (flags->has_eu_weee) { prv_append_regulatory_compliance_mark(cd, &cd->weee_mark); } if (flags->has_australia_rcm)...
ne MIN_OPS 0 #define OP_ROTATE 0 #define OP_CHANGE_WIDTH 1 #define OP_MOVE_P1_X 2 #define OP_MOVE_P1_Y 3 #define OP_MOVE_P2_X 4 #define OP_MOVE_P2_Y 5 #define OP_TEST 6 #define OP_TEST2 7 #define OP_TEST3 8 #define OP_TEST4 9 #define OP_TEST5 10 #define OP_ROTATE2 11 #define OP_ROTATE3 12 #define MAX_OPS 13 #define MI...
{ // For frame/bounds/clipping rect debugging AppData *data = window_get_user_data(s_window); const GRect *bounds = &data->canvas_layer->bounds; const GRect *frame = &data->canvas_layer->frame; graphics_context_set_stroke_color(ctx, GColorGreen); graphics_draw_rect(ctx, &GRect(bounds->origin.x + frame->or...
/* * 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, data)
; window_set_window_handlers(window, &(WindowHandlers) { .load = prv_window_load }); const bool animated = true; app_window_stack_push(window, animated); } static void handle_deinit(void) { AppData *data = app_state_get_user_data(); simple_menu_layer_deinit(&data->menu); app_free(data); } static vo...
prv_text_layer_width(), config->title_field.size_h); } static GRect prv_time_rect(void) { const MusicAppSizeConfig *config = prv_config(); return GRect(config->horizontal_margin, config->time_field.origin_y, prv_content_width(), config->time_field.size_h); } static GRect prv_cassette_rect(v...
app_state_get_user_data()
; prv_show_volume_image(volume_is_up ? &data->image_volume_up : &data->image_volume_down); music_command_send(volume_is_up ? MusicCommandVolumeUp : MusicCommandVolumeDown); } static Animation* prv_create_layer_upwards_animation(Layer *layer, int16_t offset) { GPoint target = GPoint(0, -layer->bounds.size.h - off...
er.transition_start.pending = false; compositor_transition(s_deferred_render.transition_start.compositor_animation); } } static void prv_compositor_flush(void) { PBL_ASSERT_TASK(PebbleTask_KernelMain); // Stop the framebuffer_prepare performance timer. This timer was started when the client // first poste...
func(ctx, animation, distance_normalized)
; ctx->draw_state = prev_state; if (!s_animation_state.impl->skip_modal_render_after_update) { compositor_render_modal(); } prv_compositor_flush(); } static void prv_animation_update(Animation *animation, const AnimationProgress distance_normalized) { PBL_ASSERT_TASK(P...
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 in writing, software * distributed under the License is distributed on an "AS IS...
(walk_max_used_id, &max_used_id)
; return (max_used_id + 1); } // grows the size of the pmap file to the new_size specified static status_t enlarge_pmap_file(int *fd, size_t new_size) { const size_t hunk_size = 256; uint8_t *buf = kernel_malloc(hunk_size); if (buf == NULL) { return (E_OUT_OF_MEMORY); } PBL_LOG(LOG_LEVEL_DEBUG, "Growin...
rand for routines that need it if (test->setup) { test->setup(layer->window); } PROFILER_INIT; PROFILER_START; while (PROFILER_NODE_GET_TOTAL_US(gfx_test_update_proc) < (test->duration * US_PER_S)) { PROFILER_NODE_START(gfx_test_update_proc); test->test_proc(layer, ctx); PROFILER_NODE_STOP(g...
("Test Results")
); window_set_user_data(window, app_data); window_set_fullscreen(window, false); window_set_window_handlers(window, &(WindowHandlers) { .load = prv_results_window_load, .unload = prv_results_window_unload, }); window_set_click_config_provider(window, prv_results_window_click_config_provider); TextL...
/* * 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...
(normalized, from, to)
; return (int16_t)CLIP(interpolated, INT16_MIN, INT16_MAX); } uint32_t interpolate_uint32(int32_t normalized, uint32_t from, uint32_t to) { const int64_t interpolated = interpolate_int64(normalized, from, to); return (uint32_t)CLIP(interpolated, 0, UINT32_MAX); } Fixed_S32_16 interpolate_fixed32(int32_t normali...
/* * 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...
pulse_end()
; #endif } else { pulse_prepare_to_crash(); } }
compositing_mode) { GRect destination = bitmap->bounds; destination.origin = gpoint_add(destination.origin, offset); graphics_context_set_compositing_mode(ctx, GCompOpAssign); graphics_draw_bitmap_in_rect(ctx, bitmap, &destination); destination.origin = gpoint_add(destination.origin, GPoint(COMPOSITE_TEST_OFF...
(&s_ctx.dest_bitmap, TEST_PBI_FILE)
); } void test_graphics_draw_bitmap__origin_bitmap_layer_across_y(void) { prv_origin_bitmap_layer_test(GPoint(0, 75)); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_graphics_draw_bitmap__origin_bitmap_layer_across_ny(void) { prv_origin_bitmap_layer_test(GPoint(0, -25)); cl_check(gbi...
{ ScaleSegmentedData *data = kino_reel_transform_get_context(reel); if (data) { data->effect_duration = effect_duration; } }
void kino_reel_scale_segmented_set_interpolate(KinoReel *reel, InterpolateInt64Function interpolate) { ScaleSegmentedData *data = kino_reel_transform_get_context(reel); if (data) { data->interpolate = interpolate; } } void kino_reel_scale_segmented_set_deflate...
/* * 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 (!workout_service_is_workout_ongoing()) { return; }
time_t now_utc = rtc_get_time(); time_t total_paused_time_s = s_workout_data.current_workout->duration_completed_pauses_s; if (workout_service_is_paused()) { const time_t duration_current_pause = now_utc - s_workout_data.current_workout->last_paused_utc; total_paused_time_s += duration_current_pause; ...
ither express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "popups/phone_formatting.h" #include "clar.h" #include <string.h> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> // Stubs //////////////////////////////////////...
(dest_len)
; // malloc'd memory is protected by DUMA phone_format_phone_number(test_number, dest, dest_len); cl_assert_equal_s(dest, "+55 408\n555-1212"); } void test_phone_formatting__phone_number_intl_parens(void) { char test_number[] = "+55 (408) 555-1212"; int dest_len = sizeof(test_number) + 1; char *dest = mal...
(s_resource_mutex)
; // FIXME PBL-28781: This operation touches flash. Even though this is the cleanest approach // to detect if the resource is a builtin, it is a slow one. We should instead only search // in the builtin table for the resource_ids and if there are no matches, bail early. ResourceStoreEntry resource; prv_get_r...
id prv_confirm_pop(ClickRecognizerRef recognizer, void *context) { confirmation_dialog_pop((ConfirmationDialog *)context); } static void prv_coredump_click_config(void *context) { window_single_click_subscribe(BUTTON_ID_UP, prv_coredump_confirm_cb); window_single_click_subscribe(BUTTON_ID_DOWN, prv_confirm_pop);...
(menu_layer, SETTINGS_MENU_HIGHLIGHT_COLOR, GColorWhite)
; menu_layer_set_click_config_onto_window(menu_layer, &data->window); layer_add_child(&data->window.layer, menu_layer_get_layer(menu_layer)); } static void prv_information_window_unload(Window *window) { SettingsSystemData *data = (SettingsSystemData*) window_get_user_data(window); menu_layer_deinit(&data->me...
/* * 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...
stop_mode_enable(InhibitorBacklight)
; } } s_backlight_pwm_enabled = on; } void backlight_init(void) { if (s_initialized) { return; } s_led_enable = 0; if (BOARD_CONFIG_BACKLIGHT.options & ActuatorOptions_Ctl) { periph_config_acquire_lock(); gpio_output_init(&BOARD_CONFIG_BACKLIGHT.ctl, GPIO_OType_PP, GPIO_Speed_2MHz); ...
erning permissions and * limitations under the License. */ #include "drivers/accessory.h" #include "drivers/rtc.h" #include "kernel/pebble_tasks.h" #include "services/normal/accessory/smartstrap_comms.h" #include "services/normal/accessory/smartstrap_link_control.h" #include "services/normal/accessory/smartstrap_pro...
(LOG_LEVEL_WARNING, "Invalid link control response (type=%d).", s_type)
; if (s_type == LinkControlTypeStatus) { prv_fatal_error_strike(); } else if (!s_profiles) { smartstrap_link_control_disconnect(); } return false; } s_strikes = 0; if (header->type == LinkControlTypeStatus) { // status message const LinkControlStatus status = header->data[0]; ...
line_draw_precise_stroked = (MockCallRecordings){0}; s_graphics_draw_arc_precise = (MockCallRecordings){0}; s_gpath_draw_filled = (MockCallRecordings){0}; } void test_rocky_api_graphics_path2d__cleanup(void) { fake_app_timer_deinit(); // Frees the internal path steps array (): rocky_api_graphics_path2d_rese...
cl_assert_equal_i(3, lc->path.num_points)
/* * 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...
(ctx, GPoint(14, -14), 12)
; } void test_graphics_draw_circle_${BIT_DEPTH_NAME}__origin_layer(void) { GContext ctx; Layer layer; test_graphics_context_init(&ctx, fb); layer_init(&layer, &GRect(0, 0, 28, 28)); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx...
prv_display_write_byte(0x00); prv_disable_display_access(); } //! Static mode is entered by sending 0x00 to the panel //! This stops any further updates being registered by //! the display, preventing corruption on shutdown / boot static void prv_display_enter_static(void) { prv_enable_display_access(); prv_...
(dead_face_bits, 24, 32, dead_face_width, dead_face_height, buffer)
; prv_draw_code(code, buffer); prv_draw_bitmap(error_url_bits, 16, 144, error_url_width, error_url_height, buffer); prv_display_buffer(buffer); } //! Do whatever is necessary to prevent visual artifacts when resetting //! the watch. void display_prepare_for_reset(void) { prv_display_enter_static(); } //! D...
* multiple; case RoundTypeAlwaysUp: return ((round_me + multiple - 1) / multiple) * multiple; case RoundTypeAlwaysDown: return (round_me / multiple) * multiple; case RoundTypeHalfUp: default: return ((round_me + multiple / 2) / multiple) * multiple; } } enum { FullStyleLower12h, ...
prv_round(difference, SECONDS_PER_HOUR, RoundTypeHalfUp)
return "pass"; } } // --------------------------------------------------------------------------------------- // Returns the weighted error of this test static float prv_compute_test_error(const char *name, ExpectedValue *exp, ActualValue *act, float weight, bool *all_passed...
{ *results = (SleepTestResults) { }; // Iterate through the sleep sessions KAlgTestSleepSession *session = s_captured_sleep_sessions; time_t enter_utc = 0; time_t exit_utc = 0; time_t deep_exit_utc = 0; uint16_t last_session_len_m = 0; uint16_t last_deep_session_len_m = 0; bool first_container = true...
st activity found if (!found_activity) { result.activity_type.value = (int)session->activity; result.len.value = (int)session->len_minutes; result.start_at.value = start_idx; found_activity = true; } } result.weighted_err = 0.0; result.all_passed = true; Act...
{ int num_samples; AccelRawData *samples = activity_sample_working_at_desk(&num_samples); TestMinuteData exp_minutes[] = { { .steps = 0, .orientation = 0x72, .vmc = 1787, }, }; prv_test_minute_data(samples, num_samples, exp_minutes, ARRAY_LENGTH(exp_minutes)); }
// Run the not moving sample // The expected results were obtained empirically on a known good commit { int num_samples; AccelRawData *samples = activity_sample_not_moving(&num_samples); TestMinuteData exp_minutes[2] = { { .steps = 0, .orientation = 0x81, .vmc = 181, ...
.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 * limitations under the Li...
layer_init(&scroll_layer->layer, frame)
; const GRect *bounds = &scroll_layer->layer.bounds; scroll_layer->layer.property_changed_proc = scroll_layer_property_changed_proc; layer_init(&scroll_layer->content_sublayer, bounds); layer_add_child(&scroll_layer->layer, &scroll_layer->content_sublayer); prv_setup_shadow_layer(scroll_layer); } ScrollLay...
{ return; }
prv_send_request(&s_poll_remote_contexts[msg->service]); break; } case LEGACY_CMD_REQUEST_INTERVAL: { PollLegacySetIntervalMessage *msg = (PollLegacySetIntervalMessage *)data; poll_remote_set_intervals(POLL_REMOTE_SERVICE_MAIL, MIN_INTERVAL_MINUTES, msg->interval_minutes); break; ...
s wrong // it'll just give us the wrong time anyway unsigned days = rtc_date.RTC_Year * 365; // RTC_Year is 0-99 days += (rtc_date.RTC_Year / 4); // Leap years // Cumulative days from previous months const unsigned month_days[] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; days += month_days...
RTC_StructInit(&rtc_init_struct)
; RTC_Init(&rtc_init_struct); // Set the RTC to default date and time. // When we speed up the clock we'll add the elapsed seconds // to the saved register to get the correct time RTC_TimeTypeDef rtc_default_time; RTC_TimeStructInit(&rtc_default_time); RTC_SetTime(RTC_Format_BIN, &rtc_default_time); RT...
e can be called from the stopped handler void test_animation__unschedule_from_stopped_handler(void) { Animation *h; const int duration = 100; const AnimationHandlers handlers = { .started = prv_started_handler, .stopped = prv_stopped_handler_unschedule }; Animation *a = prv_create_test_animation(); ...
prv_clear_handler_histories()
_ref = sys_hrm_manager_app_subscribe(app_id, update_interval_s, expire_s, features); fake_system_task_callbacks_invoke_pending(); HRMSubscriberState *subscriber = prv_get_subscriber_state_from_ref(session_ref); cl_assert(subscriber); cl_assert(subscri...
(session_ref)
== NULL); cl_assert(sys_hrm_manager_get_app_subscription(app_id) == HRM_INVALID_SESSION_REF); } // Test that system subscriptions expire correctly void test_hrm_manager__kernel_expiration(void) { stub_pebble_tasks_set_current(PebbleTask_KernelBackground); const uint16_t expire_s = SECONDS_PER_MINUTE; HRMSess...
Iter *iter) { return sfs_seek(iter, 0, FSeekCur); } static int sfs_read(SettingsRawIter *iter, uint8_t *data, int data_len) { status_t status = pfs_read(iter->fd, data, data_len); if (status >= 0) { return status; } int pos = pfs_seek(iter->fd, 0, FSeekCur); PBL_LOG(LOG_LEVEL_ERROR, "Could not read da...
if (iter->hdr.val_len == 0) return;
sfs_seek(iter, iter->hdr_pos + sizeof(SettingsRecordHeader) + iter->hdr.key_len, FSeekSet); sfs_write(iter, val, iter->hdr.val_len); } void settings_raw_iter_write_byte(SettingsRawIter *iter, int offset, uint8_t byte) { sfs_seek(iter, iter->hdr_pos + sizeof(SettingsRecordHeader) + iter->hdr.key_len + offse...
{}; TimelineIterState state = {}; TimelineNode *head = NULL; cl_assert_equal_i(timeline_init(&head), S_SUCCESS); const time_t time_21_00_march_1_pst = 1425272400; cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, time_21_00_mar...
timeline_init(&head)
/* * 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...
{ HcProtocolMessage *msg = hc_protocol_enqueue_with_payload_and_expect( HcEndpointID_Analytics, HcMessageID_Analytics_GetConnectionQuality, (uint8_t *)device, sizeof(*device)); if (!msg) { // Should be a basic log for timed out expect in hc_protocol layer return false; } HcAnalyticsGetConn...
static AnalyticsMetric prv_get_fw_metric(DialogAnalyticsMetric metric) { switch (metric) { // insert future DialogAnalyticsMetric's here case DialogAnalyticMetric_Test: case DialogAnalyticMetric_Count: return ANALYTICS_METRIC_INVALID; // no default so that any DialogAnalyticsMetric's that get ...
pare_recognizers_processed((int[]) {3}, 1, &s_recognizers_handled); prv_compare_recognizers_processed((int[]) {4, 0, 3, 1}, 4, &s_recognizers_reset); cl_assert_equal_i(manager.state, RecognizerManagerState_WaitForTouchdown); cl_assert_equal_i(recognizers[0]->state, RecognizerState_Possible); cl_assert_equal_i(r...
prv_compare_recognizers_processed((int[]) {4, 0 }, 2, &s_recognizers_handled)
; prv_compare_recognizers_processed(NULL, 0, &s_recognizers_reset); cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersTriggered); cl_assert_equal_i(recognizers[0]->state, RecognizerState_Started); cl_assert_equal_i(recognizers[2]->state, RecognizerState_Failed); cl_assert_equal_i(recognizers[...
PBL_LOG(LOG_LEVEL_DEBUG, "start total: %d, start deep: %d", (int)before_total, (int)before_deep)
; // Capture steps before sleep int32_t steps_before; activity_get_metric(ActivityMetricStepCount, 1, &steps_before); // Do some light and deep sleep prv_feed_deep_sleep_min(60); prv_feed_light_sleep_min(180); prv_feed_deep_sleep_min(20); // Capture steps before sleep activity_get_metric(ActivityMe...
cl_assert((resp_ptr - s_data) == s_sending_data_length)
; } /************************************************** * Checking for length data mismatch INSERT command * **************************************************/ static const uint8_t s_insert_cmd_size_value_wrong[] = { // Message Header 0x01, // Pebble protocol message ID: INSERT 0x17, 0x00...
s/alerts_preferences.h" #include "services/normal/notifications/ancs/ancs_notifications.h" #include "services/normal/notifications/notification_constants.h" #include "services/normal/notifications/notification_storage.h" #include "services/normal/timeline/timeline.h" #include "services/normal/timeline/timeline_resource...
(data->progress_window)
; data->progress_window = NULL; } applib_free(data->dialog.message); data->dialog.message = NULL; event_service_client_unsubscribe(&data->event_service_info); prv_cancel_response_timer(data); applib_free(data); } static void prv_show_result_window(ActionResultData *data, const TimelineResourceId time...
const GTextOverflowMode overflow_mode, const GTextAlignment alignment, GTextLayoutCacheRef layout) { return GSizeZero; } uint32_t resource_storage_get_num_entries(ResAppNum app_num, uint32_t resource_id) { ret...
(0, s_graphics_draw_line.call_count)
; cl_assert_equal_i(1, s_graphics_context_set_fill_color.call_count); cl_assert_equal_i(4, s_graphics_context_set_stroke_color.call_count); cl_assert_equal_i(4, s_graphics_context_set_stroke_width.call_count); } else { cl_assert_equal_i(2, s_graphics_fill_rect.call_count); cl_assert_equal_i(0, s_g...
/* * 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...
strlen(str)
; HdlcStreamingContext ctx; hdlc_streaming_decode_reset(&ctx); for (int i = 0; i < len; i++) { char c = str[i]; bool should_store, is_invalid; bool is_complete = hdlc_streaming_decode(&ctx, (uint8_t *)&c, &should_store, &is_invalid); cl_assert(is_invalid == false); if (i == 0 || i == len - 1) ...
wo recognizers attached to the active layer - processed in order that they were added recognizer_add_to_list(recognizers[1], &layer_c.recognizer_list); cl_assert(prv_process_all_recognizers(&manager, prv_handle_dummy_touch_event, NULL)); prv_compare_recognizers_processed((int[]) {0, 1}, 2, &s_recognizers_handled)...
NEW_RECOGNIZER(r1)
= test_recognizer_create(&s_test_impl_data, NULL); NEW_RECOGNIZER(r2) = test_recognizer_create(&s_test_impl_data, NULL); r2->state = RecognizerState_Started; // copied from recognizer_manager.c struct FailRecognizerCtx { Recognizer *triggered; bool recognizers_active; } ctx = { .triggered = r2, .rec...
~gap_le_pebble_task_bit_for_client(c); // Update the local state for the client. An event is sent shortly after. intent->client[c].connected = connected; } } if (task_mask != task_mask_none) { // Send event to the client(s) that need to be notified: const BTBondingID bonding_id = prv_get_...
PBL_LOG(LOG_LEVEL_ERROR, "Not adding connection for device. It is already connected .. disconnecting")
cl_assert_equal_i(s_close_count, 0); Transport *system_transport2 = (Transport *) TransportID2; CommSession *system_session2 = comm_session_open(system_transport2, &s_transport_imp, TransportDestinationSystem); cl_assert(system_session2); cl_assert_equal_p(...
(fake_system_task_count_callbacks(), 0)
; cl_assert_equal_i(s_send_next_count, 1); comm_session_send_next(session); cl_assert_equal_i(fake_system_task_count_callbacks(), 1); comm_session_send_next(session); cl_assert_equal_i(fake_system_task_count_callbacks(), 1); cl_assert_equal_i(s_send_next_count, 1); fake_system_task_callbacks_invoke_pend...
/* * 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...
(PWR, RCC_APB1Periph_PWR)
; pwr_enable_wakeup(true); PWR_EnterSTANDBYMode(); #endif #endif PBL_LOG(LOG_LEVEL_ALWAYS, "Using the PMIC to enter standby mode."); pmic_power_off(); PBL_CROAK("PMIC didn't shut us down!"); } NORETURN enter_standby(RebootReasonCode reason) { PBL_LOG(LOG_LEVEL_ALWAYS, "Preparing to enter standby mode."); ...
_info.value_p); settings_file_get(file, &m_info.settings_key, sizeof(m_info.settings_key), &history, sizeof(history)); for (int i = ACTIVITY_HISTORY_DAYS - 1; i >= 1; i--) { history.values[i] = history.values[i - 1]; } // We just wrapped up yesterday ...
if (median_hr > 0) { PebbleEvent event = { .type = PEBBLE_HEALTH_SERVICE_EVENT, .health_event = { .type = HealthEventHeartRateUpdate, .data.heart_rate_update = { .current_bpm = median_hr, .is_filtered = true, } } }; event_put(&event); }
} // ------------------------------------------------------------------------------------------ // Calculates and stores the most recent minutes median heart rate value. // Used for the health_service and the minute level data. static void prv_update_median_hr_bpm(ActivityState *state) { const ActivityHRSupport *h...
LATIVE_HRS); cl_assert_equal_s("12:00 PM", time_buf); // June 10th 2015, 00:00:00 (T+12:00:00) rtc_set_time(event_time + (12 * SECONDS_PER_HOUR)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("Yesterday, 12:00 PM", time_buf); // June 10th 20...
(event_time + SECONDS_PER_HOUR + (30 * SECONDS_PER_MINUTE))
; clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("2 H AGO", time_buf); // June 9th 2015, 16:01:00 (T+00:01:00) rtc_set_time(event_time + (1 * SECONDS_PER_MINUTE)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELAT...
HT)) / 2) - 1); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax_aa_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); #endif // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_D...
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 3)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r3_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 11); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1); cl_check(gbitmap_pb...
t_equal_i(4, s_graphics_context_set_stroke_width.call_count); } else { cl_assert_equal_i(2, s_graphics_fill_rect.call_count); cl_assert_equal_i(0, s_graphics_line_draw_precise_stroked.call_count); cl_assert_equal_i(0, s_graphics_draw_line.call_count); cl_assert_equal_i(1, s_graphics_context_set_fill_c...
prv_js_global_get_value("e1")
; jerry_value_t e2 = prv_js_global_get_value("e2"); jerry_value_t e3 = prv_js_global_get_value("e3"); // error s_log_internal__expected = (const char *[]){ "Exception while e1", "Error: test", NULL, }; rocky_log_exception("e1", e1); cl_assert(*s_log_internal__expected == NULL); // string s_log_i...
t bool is_dst = time_get_isdst(rtc_get_time()); if (is_dst != was_dst) { PebbleEvent e = { .type = PEBBLE_SET_TIME_EVENT, .set_time_info = { .utc_time_delta = 0, .gmt_offset_delta = 0, .dst_changed = true, } }; event_put(&e); s_dst_checker.cb_data = (void*)is_...
("Now", word_buffer, word_buffer_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...
if (charge.is_charging) { status_led_set(StatusLedState_Charging); } else { status_led_set(StatusLedState_FullyCharged); }
} else { status_led_set(StatusLedState_Off); } data->was_plugged = charge.is_plugged; data->last_dialog_state = next_dialog_state; } static void prv_handle_init(void) { struct AppData *data = app_malloc_check(sizeof(struct AppData)); *data = (struct AppData){}; app_state_set_user_data(data); dat...
/* * 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...
while (num_bytes) { uint16_t chunk; const uint8_t *read_ptr; cl_assert(shared_circular_buffer_read(buffer, client, num_bytes, &read_ptr, &chunk)); memcpy(data, read_ptr, chunk); cl_assert(shared_circular_buffer_consume(buffer, client, chunk)); buffer += chunk; num_bytes -= chunk; }
s 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 * limitations under the License. */ #include "dictation_session.h" #include "dictation_session_private.h" #include "voice_window_privat...
{ // we can't destroy a session while it is in progress, // so we mark it as destroy pending and we'll destroy it later session->destroy_pending = true; return; }
prv_stop_session(session); voice_window_destroy(session->voice_window); applib_free(session); #endif } void dictation_session_enable_confirmation(DictationSession *session, bool is_enabled) { #if CAPABILITY_HAS_MICROPHONE if (!session || session->in_progress) { return; } voice_window_set_confirmation...
, index); TimelineIterState *iter_state = timeline_model_get_iter_state_with_timeline_idx(index); if (!iter_state) { return; } if (layer->layouts[s_nonvisible_items[1]]) { prv_destroy_layout(layer, s_nonvisible_items[1]); } prv_create_layout(layer, iter_state, s_nonvisible_items[1]); } void timelin...
((Layer *)timeline_layer)
; } static int16_t prv_sidebar_getter(void *context) { TimelineLayer *timeline_layer = context; return timeline_layer->sidebar_width; } Animation *timeline_layer_create_sidebar_animation(TimelineLayer *timeline_layer, int16_t to_sidebar_width) { static const Pr...
ctx, data->current_steps, data->daily_steps_avg, fill_thickness, bounds, fill_color); const int goal_line_length = PBL_IF_COLOR_ELSE(fill_thickness + 3, 12); const int goal_line_width = 4; // draw yellow goal line prv_draw_goal_line(ctx, data->typical_steps, MAX(data->daily_steps_avg, da...
{ data->current_steps = current_steps; data->typical_steps = typical_steps; data->daily_steps_avg = daily_steps_avg; data->current_bpm = current_bpm; prv_normalize_data(data); }
#endif //////////////////////////////////////////////////////////////////////////////////////////////////// // Handlers static void prv_health_service_events_handler(HealthEventType event, void *context) { if (event == HealthEventMovementUpdate) { prv_update_current_steps(context); } } static void prv_tick_...
| RCC_APB1Periph_UART7 | RCC_APB1Periph_UART8; const uint32_t apb2_periphs = RCC_APB2Periph_TIM1 | RCC_APB2Periph_TIM8 | RCC_APB2Periph_USART1 | RCC_APB2Periph_USART6 | RCC_APB2Periph_SDMMC2 | RCC_APB2Periph_ADC | RCC_APB2Periph_SDMMC1 | RCC_APB2Periph_SPI1 | RCC_APB2Periph_SPI4 | RCC_APB2Periph_SYSCF...
boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_TWO)
; return false; } // We failed to start our firmware successfully! if (watchdog_check_reset_flag()) { dbgserial_putstr("Watchdog caused a reset"); } if (boot_bit_test(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED)) { dbgserial_putstr("Software failure caused a reset"); } // Clean up after the last fail...
/* * 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...
(" ---\n")
; printf(" message : %s\n", error->error_msg); printf(" severity: fail\n"); printf(" suite : %s\n", error->suite); printf(" test : %s\n", error->test); printf(" file : %s\n", error->file); printf(" line : %d\n", error->line_number); if (error->description != NULL) printf(" description: %s\n"...
12, 448, 16}, { 1320, 440, 0}, // 97 seconds { 1424, 400, 16}, { 1392, 304, 88}, { 1328, 224, 120}, { 1296, 208, 56}, { 1216, 200, 56}, { 976, 208, 48}, { 832, 184, 24}, { 1000, 224, 0}, { 1048, 240, -88}, { 904, 192, -24}, { 1168, 152, -40}, { 1096, 152, 48}, ...
{ 1696, 448, 120}, { 1328, 608, 208}, { 1320, 936, 56}, { 976, 1416, 120}, { 864, 912, -200}, { 688, 552, -120}, { 912, 624, -8}, { 1392, 560, 96}, { 1432, 392, 72}, { 1400, 328, 16}, { 1528, 304, 40}, { 1608, 344, 64}, // 103 seconds { 1544, 320, 88}, { 1312,...
_relaunches_disabled; // --------------------------------------------------------------------------------------------- void worker_manager_init(void) { s_to_worker_event_queue = xQueueCreate(MAX_TO_WORKER_EVENTS, sizeof(PebbleEvent)); } // ---------------------------------------------------------------------------...
(memory_segment_split(&worker_ram, &worker_segment, worker_segment_size))
/////////////////////////////// // Tests static CommSession *s_session = (CommSession *)0xaabbccdd; void test_app_message_receiver__initialize(void) { s_kernel_receiver_available = true; s_kernel_receiver = (Receiver *)0xffaaffaa; s_kernel_receiver_is_receiving = false; s_kernel_receiver_finish_called = false...
prv_create_inbox_prepare_and_write()
; s_rcv_imp->finish(r); prv_process_events(); cl_assert_equal_b(false, s_kernel_receiver_is_receiving); cl_assert_equal_b(false, s_kernel_receiver_finish_called); cl_assert_equal_m(&s_push, s_app_message_pp_buffer, sizeof(s_push)); cl_assert_equal_i(s_app_message_pp_received_length, sizeof(s_push)); cl...
low memory? void window_set_on_screen(Window *window, bool new_on_screen, bool call_window_appear_handlers) { PBL_ASSERTN(window != NULL); // This tripped me up for about a day if (new_on_screen == window->on_screen) { return; } // Window went from offscreen to onscreen (or vice versa) // Provides in...
if (!window->is_fullscreen) { return true; }
StatusBarLayer *status_bar = NULL; layer_process_tree(&window->layer, &status_bar, prv_find_status_bar_layer); return status_bar && !layer_get_hidden(&status_bar->layer); } void window_attach_recognizer(Window *window, Recognizer *recognizer) { if (!window) { return; } layer_attach_recognizer(window_...
ts_sent; bool process_manager_send_event_to_process(PebbleTask task, PebbleEvent* e) { cl_assert_equal_i(e->type, PEBBLE_APP_OUTBOX_SENT_EVENT); cl_assert(e->app_outbox_sent.sent_handler); e->app_outbox_sent.sent_handler(e->app_outbox_sent.status, e->app_outbox_sent.cb_ctx); ++...
app_outbox_service_max_pending_messages(AppOutboxServiceTagUnitTest)
out, graphics_context_get_current_context(), &layout->view_size); } void timeline_layout_deinit_view(TimelineLayout *layout) { if (layout->layout_layer.mode == LayoutLayerModeCard && layout->impl->card_view_deinitializer) { layout->impl->card_view_deinitializer(layout); } graphics_text_node_destroy(layout->v...
{ return prv_create_hour_text_node(layout); }
} static const char *prv_get_secondary_text(const TimelineLayout *layout) { const AttributeList *attributes = layout->layout_layer.attributes; return attribute_get_string(attributes, AttributeIdShortSubtitle, NULL) ?: attribute_get_string(attributes, layout->impl->attributes.secondary_id, ""); } static voi...
/* * 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...
{ init(); app_event_loop(); deinit(); }
_data(window); prv_init_status_bar(&data->status_layer, &data->window, i18n_get("Information", data)); // Create the menu MenuLayer *menu_layer = &data->menu_layer; GRect bounds = data->window.layer.bounds; const GEdgeInsets menu_layer_insets = (GEdgeInsets) { .top = STATUS_BAR_LAYER_HEIGHT, .bottom...
graphics_draw_bitmap_in_rect(ctx, mark, box)
; } static int16_t prv_draw_generic_mark(GContext *ctx, GBitmap *mark, GPoint origin, bool highlight) { GRect box = (GRect) { .origin = origin, .size = mark->bounds.size }; prv_draw_mark_with_inversion(ctx, mark, &box, highlight); return origin.x + box.size.w; } #define MARK_PADDING 10 static void pr...
animation_schedule(spawn); // Test the elapsed int32_t elapsed_ms; animation_get_elapsed(spawn, &elapsed_ms); cl_assert_equal_i(elapsed_ms, -1 * (delay_spawn)); animation_get_elapsed(a, &elapsed_ms); cl_assert_equal_i(elapsed_ms, -1 * (delay_spawn + delay_a)); animation_get_elapsed(b, &elapsed_ms); ...
(prv_count_handler_entries(&s_started_handler_calls, b), 0)
; cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, b), 0); // Just before A completes prv_advance_to_ms_with_timers(start_ms + durati...
resource_storage_file_readonly_bytes_unsupported(ResourceStoreEntry *entry, bool has_privileged_access) { return NULL; } static bool resource_storage_file_find_resource(ResourceStoreEntry *entry, ResAppNum app_num, ...
pfs_open(filename, op_flags, FILE_TYPE_STATIC, 0)
; if ((fd < 0) && (fd != E_DOES_NOT_EXIST)) { PBL_LOG(LOG_LEVEL_WARNING, "Could not open resource pfs file <%s>, fd: %d", filename, fd); } return fd; } static bool resource_storage_app_file_find_resource(ResourceStoreEntry *entry, ResAppNum app_num, uint3...
--------------------------------- static void steps_down_click_handler(ClickRecognizerRef recognizer, void *context) { HealthAPITestAppData *data = (HealthAPITestAppData *)context; window_stack_pop(true); window_stack_push(data->hr_window, true /* Animated */); } // ---------------------------------------------...
battery_state_service_peek()
; const int percent = charge_state.charge_percent; graphics_context_set_fill_color(ctx, GColorDarkCandyAppleRed); graphics_fill_radial(ctx, bounds, GOvalScaleModeFitCircle, 15, 0, TRIG_MAX_ANGLE); graphics_context_set_stroke_color(ctx, GColorJaegerGreen); graphics_context_set_fill_color(ctx, GColorJaegerGre...
, -40, -992}, { -192, -24, -992}, { -208, -16, -992}, { -200, -16, -992}, { -208, -16, -992}, { -200, -16, -976}, { -200, -32, -984}, { -200, -32, -992}, { -200, -32, -992}, { -192, -16, -1000}, { -200, -16, -1000}, { -200, -40, -984}, { -200, -8, -984}, { -200, -8, -...
{ -208, -24, -992}, { -208, -32, -976}, { -200, -32, -984}, { -200, -32, -992}, { -192, -32, -1000}, { -200, -40, -992}, { -200, -32, -984}, { -200, -32, -992}, { -208, -48, -992}, { -200, -40, -1000}, { -200, -48, -984}, // 154 seconds { -208, -32, -984}, { -208,...
void test_window_stack__modal_and_app(void) { Window *window1 = window_create(); Window *window2 = window_create(); 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_chec...
modal_manager_event_loop_upkeep()
>remote_param_mgmt_settings, length); break; case PebblePairingServiceConnParamsWriteCmd_SetRemoteDesiredState: rv = prv_validate_set_desired_state_cmd(&conn_params->remote_desired_state, length); break; case PebblePairingServiceConnPara...
prv_convert_uuid_to_little_endian( (const uint8_t[]){PEBBLE_BT_PAIRING_SERVICE_CONNECTION_STATUS_UUID}, &uuid)
; PBL_ASSERTN(ble_gatts_add_characteristic(&uuid, GATT_PROP_READ | GATT_PROP_NOTIFY, ATT_PERM_READ, sizeof(PebblePairingServiceConnectivityStatus), enable_read_cb_flag, NULL, &ctx->att_hdl....
ation_set_curve(animation2, AnimationCurveLinear); animation_set_handlers(animation2, (AnimationHandlers) { .stopped = prv_animation_stopped_success, }, data); Animation *animation = animation_sequence_create(animation1, animation2, NULL); data->result_animation = animation; animation_schedule(animation...
prv_set_progress(window, progress)
; } void progress_window_set_result_success(ProgressWindow *window) { if (window->state == ProgressWindowState_Result) { // Ignore requests to change the result once we already have one return; } window->state = ProgressWindowState_Result; prv_cancel_fake_progress_timer(window); prv_set_progress(win...
/* * 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 (*result_string != ' ' && *result_string != '\n') { break; } result_string++; }
return result_string; } WEAK int time_util_get_num_hours(int hours, bool is24h) { return is24h ? hours : (hours + 12 - 1) % 12 + 1; } WEAK bool clock_is_24h_style() { return false; } static size_t prv_format_time(char *buffer, int buf_size, const char *format, time_t timestamp) { struct tm time_tm; local...
-232}, { 1184, 296, -168}, { 1048, 296, -160}, { 904, 280, -144}, { 864, 256, -88}, { 888, 216, -40}, { 880, 200, -24}, { 848, 240, -48}, { 944, 272, -104}, { 1136, 368, -240}, { 1032, 408, -240}, { 1152, 528, -360}, { 1304, 696, -416}, { 712, 408, -456}, { 824, ...
ARRAY_LENGTH(samples)
; return samples; } // ---------------------------------------------------------------- // Sample captured: 2015-10-02 15:26:06 local AccelRawData *activity_sample_walk_100_pbl_25477_20(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_pbl_25477_20 //> TE...
ge governing permissions and * limitations under the License. */ #include "clar.h" #include "applib/app_message/app_message_internal.h" #include "process_management/app_run_state.h" #include "process_management/launcher_app_message.h" #include "services/common/comm_session/session_internal.h" #include "system/passe...
launcher_app_message_protocol_msg_callback_deprecated(s_session, &too_short, sizeof(too_short))
; fake_comm_session_process_send_next(); fake_transport_assert_nothing_sent(s_transport); } void test_launcher_app_message__receive_unknown_key(void) { prv_receive(INVALID_KEY, 0); assert_ack(false); } void test_launcher_app_message__receive_push_start(void) { prv_receive(RUN_STATE_KEY, RUNNING); assert_a...