prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
false /* is_next */); resource_init(); // Initialize peek s_is_watchface_running = true; timeline_peek_init(); } void test_timeline_peek__cleanup(void) { } // Helpers ////////////////////// static void prv_render_layer(Layer *layer, const GRect *box, bool use_screen) { gbitmap_destroy(s_dest_b...
prv_render_timeline_peek(&(TimelinePeekItemConfig) { .title = "NY 3 - SF 12", .subtitle = "Bottom of the 9th", .icon = TIMELINE_RESOURCE_TIMELINE_BASEBALL, .num_concurrent = 1, })
/* * 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...
(entry_size)
; WeatherDBKey key = (WeatherDBKey) { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5 }; cl_assert_equal_i(E_INVALID_ARGUMENT, weather_db_insert((uint8_t*)&key, sizeof(WeatherDBKey), (uint8_t*)e...
536] = { 0 }; // make sure snapshot data starts with expected Rocky header const size_t header_size = sizeof(ROCKY_EXPECTED_SNAPSHOT_HEADER); cl_assert_equal_i(8, header_size); // NOTE: the snapshot header in this unit test is fixed to // CAPABILITY_JAVASCRIPT_BYTECODE_VERSION=1 only use the resulting ...
(global_object, "Date")
i++) { cl_assert_equal_i(metric_values->values[i], other->values[i]); } } static void prv_check_attribute_list_serialize(AttributeList *attr_list_to_serialize, const uint8_t *expected_attr_list_serialized, size_t expected_attr_list_s...
(&list, AttributeIdTitle, "")
, "Title2"); cl_assert_equal_s(attribute_get_string(&list, AttributeIdSubtitle, ""), "Subtitle"); cl_assert_equal_i(list.num_attributes, 2); attribute_list_add_uint32(&list, AttributeIdLastUpdated, value_uint32); attribute_list_add_uint8(&list, AttributeIdBgColor, value_uint8); cl_assert_equal_i(value_uint32...
0; // We want the SPI clock to run at 2MHz by default static uint32_t s_spi_clock_hz; // DMA constants static DMA_Stream_TypeDef* DISPLAY_DMA_STREAM = DMA1_Stream4; static const uint32_t DISPLAY_DMA_CLOCK = RCC_AHB1Periph_DMA1; static bool s_initialized = false; // DMA state static DisplayContext s_display_context;...
vSemaphoreCreateBinary(s_dma_update_in_progress_semaphore)
; dma_request_init(SHARP_SPI_TX_DMA); prv_enable_display_spi_clock(); prv_display_start(); prv_disable_display_spi_clock(); s_initialized = true; } static void prv_display_context_init(DisplayContext* context) { context->state = DISPLAY_STATE_IDLE; context->get_next_row = NULL; context->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...
task_free(contact)
; } ///////////////////////// // Blob DB API ///////////////////////// void contacts_db_init(void) { memset(&s_contacts_db, 0, sizeof(s_contacts_db)); s_contacts_db.mutex = mutex_create(); } status_t contacts_db_insert(const uint8_t *key, int key_len, const uint8_t *val, int val_len) { if (key_len != UUID_SIZE...
uteList *attr_list, size_t attr_list_size, Uuid **app_uuid_out) { GenericAttribute *uuid_attr = generic_attribute_find_attribute(attr_list, VEAttributeIdAppUuid, ...
(reminder_str, reminder_attr->data, reminder_attr->length)
a *data) { AlertMask mask = alerts_get_mask(); size_t cycle_len = ARRAY_LENGTH(s_alert_mode_values); size_t index = 0; // TODO PBL-24306: update once AlertMask logic is made safer for (size_t i = 0; i < cycle_len; i++) { if (s_alert_mode_values[i] == mask) { index = i; break; } } const...
(ARRAY_LENGTH(s_window_timeouts_ms) == ARRAY_LENGTH(s_window_timeouts_labels), "")
ient, ask_for, state->subsample_numerator, state->subsample_denominator); // Set the timestamp if we just put the first item in the buffer. If we emptied accel's // buffer, we can ...
if (samples_per_update > ACCEL_MAX_SAMPLES_PER_UPDATE) { return -1; }
// The buffer must be big enough to hold at least 1 more item to support 2/5 subsampling if (buffer_size < samples_per_update + 1) { PBL_LOG(LOG_LEVEL_ERROR, "Invalid buffer size"); return -1; } if (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(buffer, samples_per_update * sizeof(Acce...
// --------------------------------------------------------------------------------------- static bool prv_parse_sleep_samples_file(SleepSampleDiscoveryState *state) { // Init for next set of samples state->test_entry = (SleepFileTestEntry) { .samples = state->samples, .version = 1, .total = {-1, -1, -...
(token, "TEST_IN_SLEEP_MIN")
== 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.in_sleep.min); } else if (strcmp(token, "TEST_IN_SLEEP_MAX") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.in_sleep.max); } else if (strcmp(token, "TEST_IN_DEEP_SLEEP") == 0) { sscanf(token + s...
160, 224, -1032}, // 2 seconds { 136, 352, -1032}, { 176, 440, -960}, { 88, 672, -952}, { 80, 736, -936}, { 64, 752, -888}, { 112, 672, -800}, { 112, 624, -784}, { 120, 648, -816}, { 104, 656, -848}, { 152, 512, -888}, { 200, 520, -904}, { 288, 312, -856}, { 296, ...
{ 1312, 352, -272}, { 1352, 464, -208}, { 1480, 336, -128}, { 1224, 248, -88}, { 1024, 144, 24}, { 1072, 232, -96}, { 1224, 280, -80}, { 1280, 264, -32}, { 1064, 120, 88}, { 1216, 80, 80}, { 992, 56, 80}, { 1080, 0, 104}, { 1280, 192, 104}, // 8 seconds { 1464...
{ 912, 104, -136}, { 976, 168, -240}, { 1104, 216, -216}, { 1248, 248, -192}, { 1688, 328, -272}, { 1720, 1064, -776}, { 1208, 384, -352}, { 1328, 568, -456}, { 1288, 416, -400}, { 1272, 400, -248}, { 1432, 416, -136}, { 1392, 272, -112}, { 1096, 136, -48}, { 968...
/* * 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_phone_ui_event = PhoneEventType_Missed; }
void phone_ui_handle_call_start(bool can_decline) { s_last_phone_ui_event = PhoneEventType_Start; } void phone_ui_handle_call_end(bool call_accepted, bool disconnected) { s_last_phone_ui_event = PhoneEventType_End; } void phone_ui_handle_call_hide(void) { s_last_phone_ui_event = PhoneEventType_Hide; } void p...
orizontal_line_dotted(&ctx, GPoint(0, 18), 22); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 20), 143); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 22), 145); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_origin_even_rows_no_clip"))); // Odd row...
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 16), 21)
; graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 18), 22); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 20), MAX_NUM_COLS - 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 22), MAX_NUM_COLS + 1); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_horiz_dotted_lin...
0}, { 0, 0x6f, 33}, { 0, 0x6f, 0}, { 0, 0x60, 18}, { 0, 0x60, 0}, { 0, 0x6f, 25}, // 630: Local time: 04:06:00 AM { 0, 0x61, 0}, { 0, 0x61, 0}, { 0, 0x61, 31}, { 0, 0x60, 0}, { 0, 0x60, 0}, { 0, 0x60, 0}, { 0, 0x60, 21}, { 0, 0x6f, 0}, { 7, 0x6f, 48}, { 0...
{ 8, 0x51, 80}, { 8, 0x62, 47}, { 0, 0x62, 22}, // start light { 0, 0x62, 0}, { 0, 0x62, 0}, { 0, 0x63, 17}, { 0, 0x54, 32}, { 0, 0x64, 24}, // 45: Local time: 09:59:00 PM { 0, 0x64, 10}, { 0, 0x74, 0}, // start deep { 0, 0x74, 0}, { 0, 0x74, 0}, { 0, 0x74, ...
{ 0, 0x75, 0}, { 0, 0x75, 0}, { 0, 0x64, 13}, { 0, 0x64, 0}, { 0, 0x64, 0}, { 0, 0x64, 0}, { 0, 0x64, 0}, { 0, 0x64, 0}, { 0, 0x64, 0}, { 0, 0x64, 0}, { 0, 0x64, 0}, { 0, 0x64, 0}, { 0, 0x64, 0}, { 0, 0x64, 0}, // 120: Local time: 11:14:00 PM { 0, 0x73, 3...
/* * 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...
hc_protocol_enqueue_with_payload(HcEndpointID_PebblePairingService, HcMessageID_PebblePairingServiceiOSAppTerminationDetected, NULL, 0)
; } void hc_endpoint_pebble_pairing_service_found_gateway(BTDeviceInternal *device) { hc_protocol_enqueue_with_payload(HcEndpointID_PebblePairingService, HcMessageID_PebblePairingServiceFoundGateway, (uint8_t *)device, sizeof(*device)); } void hc...
cl_assert_equal_i(pairing_info->local_encryption_info.div, pairing_info_out.local_encryption_info.div); cl_assert_equal_i(pairing_info->identity.opaque.opaque_64, pairing_info_out.identity.opaque.opaque_64); cl_assert_equal_i(pairing_info->remote_encryption_info.rand, ...
(&link_key_out, &link_key_out, sizeof(link_key))
ense 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 License. */ #include "applib/graphics/utf8.h" #include "utf8_test_data.h" #include "clar.h" #include <s...
{ utf8_t dest[5]; memset(dest, 0, 5); size_t copied = utf8_copy_character(dest, (utf8_t *)NIHAO_FIRST_CHARACTER, 5); cl_assert_equal_i(copied, NIHAO_FIRST_CHARACTER_BYTES); cl_assert_equal_s((char *)dest, NIHAO_FIRST_CHARACTER); }
void test_utf8__copy_invalid_last_character(void) { utf8_t dest[5]; memset(dest, 0, 5); size_t copied = utf8_copy_character(dest, (utf8_t *)"\xf0", 5); cl_assert_equal_i(copied, 0); cl_assert_equal_s((char *)dest, ""); } void test_utf8__invalid_character(void) { utf8_t dest[5]; memset(dest, 0, 5); ...
/* * 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(bonding->name, name, BT_DEVICE_NAME_BUFFER_SIZE)
; s_head = (FakeBonding *) list_prepend(&s_head->node, &bonding->node); return bonding->id; } BTBondingID bt_persistent_storage_store_ble_pairing(const SMPairingInfo *pairing_info, bool is_gateway, const char *device_name, bool requires_address_pinning, uint8_t flags) { const SMIdentityResolvingKey *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...
cl_assert(num.integer == -1)
; cl_assert(num.fraction == 5); test_num = (int32_t)((float)-0.250 * (1 << FIXED_S16_3_PRECISION)); num = (Fixed_S16_3){ .raw_value = test_num }; cl_assert(num.integer == -1); cl_assert(num.fraction == 6); test_num = (int32_t)((float)-0.125 * (1 << FIXED_S16_3_PRECISION)); num = (Fixed_S16_3){ .raw_valu...
/* * 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 (!data->alarm_info.is_smart && !activity_prefs_tracking_is_enabled()) { // Notify about Health and keep the menu open health_tracking_ui_feature_show_disabled(); return; }
// #include "stubs_analytics.h" #include "stubs_app_state.h" #include "stubs_bootbits.h" #include "stubs_heap.h" #include "stubs_logging.h" #include "stubs_memory_layout.h" #include "stubs_mutex.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_pebble_tasks.h" #include "stubs_print.h" #includ...
(max_size, GColorWhite)
; const GRect max_draw_frame = grect_inset_internal((GRect){ .size = max_size }, margin.x, margin.y); const GSize used_size = prv_draw_emoji(&s_ctx, &max_draw_frame, &s_font_info, false /* render */); // Resize the canv...
ch.c#L2687 extern ble_error_t __real_patch_rom_functions(void); static bool s_should_log_about_mic_error = false; static uint32_t s_max_subsequent_error_count_since_last_log = 0; static uint32_t s_subsequent_mic_errors = 0; #define MAX_SUBSEQUENT_MIC_ERRORS (16) bool should_log_about_mic_error(uint32_t *max_subsequen...
(uint32_t)
zeof(uint32_t)] != 0x4E65576F) { // NeWo return false; } // TODO: Additional checks? return true; } static void prv_get_fw_reset_vector(void **reset_handler, void **initial_stack_pointer) { void** fw_vector_table; if (firmware_is_new_world(NULL)) { fw_vector_table = (...
{ void *initial_stack_pointer, *reset_handler; prv_get_fw_reset_vector(&reset_handler, &initial_stack_pointer); dbgserial_print("Booting firmware @ "); dbgserial_print_hex((uintptr_t)reset_handler); dbgserial_newline(); dbgserial_newline(); prv_hw_reset(); // The Cortex-M user guide states that the r...
lock(&file); if (rv != S_SUCCESS) { return rv; } size_t payload_size = attributes_actions_get_serialized_payload_size(attr_list, action_group); size_t serialized_prefs_size = sizeof(SerializedNotifPrefs) + payload_size; SerializedNotifPrefs *new_prefs = kernel_zalloc_check(serialized_prefs_size); *new_...
{ return rv; }
rv = settings_file_mark_synced(&file, key, key_len); prv_file_close_and_unlock(&file); return rv; } // ---------------------------------------------------------------------------------------------- #if UNITTEST uint32_t ios_notif_pref_db_get_flags(const uint8_t *app_id, int key_len) { SettingsFile file; ...
GPoint *copied_points = malloc(num_points * sizeof(GPoint)); cl_assert(copied_points != NULL); for (int i = 0; i < num_points; i++) { copied_points[i] = gpoint_add(points[i], offset); } return copied_points; } static bool prv_compare_points(GPoint *a, GPoint *b, uint16_t num_points) { return (memcmp(a...
(s_path_open, false)
; cl_assert_equal_i(s_path_fill_count, 1); cl_assert_equal_i(s_path_stroke_count, 1); cl_assert(prv_compare_points(points, s_stroke_points, s_path_num_points)); cl_assert(prv_compare_points(points, s_fill_points, s_path_num_points)); prv_reset(); // set stroke width to zero - fill should be drawn, but not ...
t_len, .read = prefs_db_read, .del = prefs_db_delete, .flush = prefs_db_flush, }, [BlobDBIdContacts] = { #if !PLATFORM_TINTIN .init = contacts_db_init, .insert = contacts_db_insert, .get_len = contacts_db_get_len, .read = contacts_db_read, .del = contacts_db_delete, .flush = cont...
{ status_t rv = db->flush(); if (rv == S_SUCCESS) { PBL_LOG(LOG_LEVEL_INFO, "Flushing BlobDB with Id %d", db_id); blob_db_event_put(BlobDBEventTypeFlush, db_id, NULL, 0); } return rv; }
return E_INVALID_OPERATION; } BlobDBDirtyItem *blob_db_get_dirty_list(BlobDBId db_id) { if (!prv_db_valid(db_id)) { return NULL; } const BlobDB *db = &s_blob_dbs[db_id]; if (db->get_dirty_list) { return db->get_dirty_list(); } return NULL; } status_t blob_db_mark_synced(BlobDBId db_id, uint8...
for (uint32_t offset = 0; offset < SHORT_TEST_LENGTH ; offset++) { uint8_t memmap_buffer[130]; // > 128 bytes, triggers a memmap read for QSPI memset(memmap_buffer, 0x00, sizeof(memmap_buffer)); const uint32_t pre_addr = TEST_ADDR + offset - MIN(offset, 1); uint8_t pre_byte; flash_read_bytes(&pre...
prompt_command_finish()
; RebootReason reason = { RebootReasonCode_Serial, 0 }; reboot_reason_set(&reason); system_reset(); } void command_crash() { prompt_command_finish(); RebootReason reason = { RebootReasonCode_LauncherPanic, 0 }; reboot_reason_set(&reason); system_reset(); } void command_hard_crash() { prompt_command_...
, 328}, { 272, 904, 224}, { 328, 768, 152}, { 304, 760, 352}, { 256, 712, 448}, { 64, 760, 832}, { 0, 624, 880}, { -56, 728, 792}, { -32, 728, 784}, { 72, 680, 640}, { 64, 808, 440}, { 184, 472, 272}, { 168, 928, 232}, { -32, 704, 512}, { -40, 704, 496}, { -72...
{ -488, 784, 256}, { -568, 1016, 160}, { -760, 1000, -280}, { -1048, 1072, -168}, { -672, 1088, -200}, { -256, 1224, -168}, { -64, 1144, -96}, { 40, 872, -216}, // 8 seconds { -24, 752, -192}, { -80, 672, -176}, { -168, 792, -240}, { -272, 720, -240}, { -408, 880,...
/* * 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...
MIN(32 - src_shift_at_line_begin, MIN(dest_rect.size.w + src_origin_offset.x, src_bitmap->bounds.size.w))
; // how many 32-bit blocks do we need to bitblt on this row: const int16_t dest_end_x = (dest_rect.origin.x + dest_rect.size.w); const uint8_t num_dest_blocks_per_row = (dest_end_x / 32) + ((dest_end_x % 32) ? 1 : 0) - dest_begin_x; // The bitblt loops: const int16_t dest_y_end = dest_rect.origin.y + dest_...
nimation_spawn_create(seq, c, NULL); cl_assert(complex != NULL); animation_set_handlers(complex, handlers, complex); prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); animation_schedule(complex); // ------------------------------------------------------------------------------------- // ...
(prv_count_handler_entries(&s_started_handler_calls, a), 1)
; cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 1); 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_setup_handler_calls, b), 1);...
oid phone_ui_handle_incoming_call(PebblePhoneCaller *caller, bool can_answer, bool show_ongoing_call_ui) { s_last_phone_ui_event = PhoneEventType_Incoming; } void phone_ui_handle_outgoing_call(PebblePhoneCaller *caller) { s_last_phone_ui_event = PhoneEventType_Outgoing; } void p...
(PhoneCallSource_PP, true)
; ASSERT_LAST_EVENT(PhoneEventType_Incoming); // Make sure we don't process incoming calls while we're in a call prv_put_incoming_call_event(PhoneCallSource_PP, true); ASSERT_LAST_EVENT(PhoneEventType_Invalid); // Losing ANCS connectivity in this case shouldn't matter prv_ancs_disconnect(); ASSERT_LAST_...
oid) { return (s_flash_state.enabled); } void flash_init(void) { if (s_flash_state.mutex != 0) { return; // Already initialized. } s_flash_state.mutex = mutex_create(); vSemaphoreCreateBinary(s_flash_state.dma_semaphore); flash_lock(); enable_flash_spi_clock(); flash_start(); s_flash_state.en...
enable_flash_spi_clock()
; handle_sleep_when_idle_begin(); flash_write_enable(); flash_start_cmd(); flash_send_and_receive_byte(FLASH_CMD_ERASE_SUBSECTOR); flash_send_24b_address(subsector_addr); flash_end_cmd(); flash_wait_for_write(); prv_check_protection_flag(); disable_flash_spi_clock(); power_tracking_stop(PowerS...
/* * 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...
do_rail_power(enable, GPIOH, GPIO_Pin_0, true)
; } void v1_5_rail_cfg_fn(void) { i2c_bus_rail_ctl_config((OutputConfig){ GPIOH, GPIO_Pin_0, true}); } // v2_0 ///////// void v2_0_rail_ctl_fn(bool enable) { do_rail_power(enable, GPIOH, GPIO_Pin_0, true); } void v2_0_rail_cfg_fn(void) { i2c_bus_rail_ctl_config((OutputConfig){ GPIOH, GPIO_Pin_0, true}); } // ...
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 sp...
("New World firmware system_flash_base")
; system_flash_base = (void*)FIRMWARE_NEWWORLD_BASE; } else { dbgserial_putstr("Old World firmware system_flash_base"); } uint32_t calculated_crc = crc_calculate_bytes((const uint8_t*)system_flash_base, firmware_description->firmware_length); dbgserial_pr...
IconDrawCommandProcessor { GDrawCommandProcessor draw_command_processor; GColor8 *luminance_tint_lookup_table; } GenericGlanceIconDrawCommandProcessor; static void prv_structured_glance_icon_draw_command_processor_process_command( GDrawCommandProcessor *processor, GDrawCommand *processed_command, UNUSED si...
{ const GColor desired_tint_color = launcher_app_glance_structured_get_highlight_color(structured_glance); GenericGlanceIconBitmapProcessor structured_glance_icon_bitmap_processor = { .bitmap_processor = { .pre = prv_strucutred_glance_icon_bitmap_processor_pre_func, .post = prv_structured_gla...
static void prv_structured_glance_icon_node_draw_cb(GContext *ctx, const GRect *rect, UNUSED const GTextNodeDrawConfig *config, bool render, GSize *size_out, void *user_data) { LauncherAppGlanceStructured *struct...
{ action_bar_layer_set_click_config_provider(&data->action_bar, prv_volume_click_config_provider); } action_bar_layer_set_icon_animated(&data->action_bar, BUTTON_ID_UP, &data->icon_volume_up, animated); action_bar_layer_set_i...
prv_do_haptic_feedback_vibe(data)
; } static void prv_volume_long_click_end_handler(ClickRecognizerRef recognizer, void *context) { MusicAppData *data = context; prv_set_action_bar_state(data, ActionBarStateSkip); app_timer_cancel(data->volume_repeat_timer); data->volume_repeat_timer = NULL; } static void prv_play_pause_long_click_start_handl...
istories(); uint64_t start_ms = prv_now_ms(); animation_schedule(seq); // Start A prv_advance_to_ms_with_timers(start_ms + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0); cl_assert_equal_i(pr...
(&s_started_handler_calls, b)
s_stats_num_columns = num_stats; for (int i = 0; i < num_stats; i++) { s_stats_column_names[i] = strdup(names[i]); } } cl_assert_equal_i(num_stats, s_stats_num_columns); // Create a new row of stats StatsRow *stats = malloc(sizeof(StatsRow)); memset(stats, 0, sizeof(*stats)); // Collect the...
{ int chunk_size = MIN(num_samples_left, KALG_SAMPLE_HZ * SECONDS_PER_MINUTE); uint32_t steps; uint32_t consumed_samples; steps = kalg_analyze_samples(s_kalg_state, data, chunk_size, &consumed_samples); minute_steps += steps; total_steps += steps; if (chunk_size == KALG_SAMPLE_HZ * SECONDS_...
// ------------------------------------------------------- // Leftover data in epoch, if any total_steps += kalg_analyze_finish_epoch(s_kalg_state); TestMinuteData minute_data = { .steps = minute_steps, }; bool still; kalg_minute_stats(s_kalg_state, &minute_data.vmc, &minute_data.orientation, &stil...
(CMD_SET_PARAMETER)
; // Send in little-endian byte order prv_send_command_arg(param & 0xff); prv_send_command_arg((param >> 8) & 0xff); prv_send_command_arg((param >> 16) & 0xff); prv_send_command_arg((param >> 24) & 0xff); prv_end_command(); } static uint8_t prv_read_version(void) { GPIO_WriteBit(DISP_GPIO, DISP_PIN_SCS, ...
"); * 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" BASIS, * WITHOU...
(framebuffer->bounds.origin.x == 0 && framebuffer->bounds.origin.y == 0)
; // Clip the line to the bitmap data row's range const GBitmapDataRowInfo data_row_info = gbitmap_get_data_row_info(framebuffer, y); x1.raw_value = MAX(x1.raw_value, data_row_info.min_x << FIXED_S16_3_PRECISION); x2.raw_value = MIN(x2.raw_value, data_row_info.max_x << FIXED_S16_3_PRECISION); if (x1.integer ...
raphics_draw_line(ctx, p3, p0); return; } if (data->operation == OP_TEST2) { int x1 = 50, x2 = 100, y1 = 40, y2 = 120; GPoint p0 = GPoint(x1, y1); GPoint p1 = GPoint(x1, y2); GPoint p2 = GPoint(x2, y2); GPoint p3 = GPoint(x2, y1); graphics_context_set_antialiased(ctx, tru...
(ctx, p0, p1, data->stroke_width)
; } else { graphics_draw_line(ctx, GPoint(p0.x.integer, p0.y.integer), GPoint(p1.x.integer, p1.y.integer)); } return; } int x1, y1, x2, y2; if (data->operation == OP_ROTATE) { int line_length = 60; x1 = data->canvas_layer->bounds.size.w / 2; y1 = data->ca...
ColorMelon, GColorIcterine }; cl_assert(sizeof(s_palette) == (1 << BITS_PER_PIXEL)); GBitmap s_bmp = (GBitmap) { .addr = s_data, .row_size_bytes = ROW_STRIDE, .info.format = GBitmapFormat1BitPalette, .info.version = GBITMAP_VERSION_CURRENT, .bounds = { .size = { WIDTH, HEIGHT } }, .palette...
(gcolor_equal(get_bitmap_color(&s_bmp, x, y), s_palette[x]), print_buf)
+ duration_a + 2 * MIN_FRAME_INTERVAL_MS); #endif } // -------------------------------------------------------------------------------------- // Test creating a sequence where the first argument is already scheduled and started // // Here's a graph of what we are doing // // 0 60 310 360 380 ...
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, seq), 0); cl_assert(prv_last_handler_entry(&s_stopped_handler_calls, a)->fire_order < prv_last_handler_entry(&s_started_handler_calls, b)->fire_order); // Finish the sequence prv_advance_to_ms_with_timers(prv_now_ms() + leftover...
// -------------------------------------------------------------------------------------- // Test creating a sequence where the first argument is already scheduled, but not started // yet (still in the delay portion). // // Here's a graph of what we are doing // // 0 100 200 360 380 ...
/* * 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...
floor(-2.0)
== -2.0); cl_assert(floor( 0.0001) == 0.0); cl_assert(floor(-0.0001) == -1.0); cl_assert(isnan(floor(NAN))); cl_assert(isinf(floor(INFINITY))); }
sport = (Transport *) TransportID1; CommSession *session = comm_session_open(transport, &s_transport_imp, TransportDestinationSystem); cl_assert_equal_b(comm_session_is_valid(session), true); fake_session_send_queue_set_length(1234); cl_assert_equal_i(fake_system_task...
(s_reset_count, 0)
icatable_characteristic(); e = gatt_client_subscriptions_subscribe(characteristic, BLESubscriptionNone, GAPLEClientKernel); cl_assert_equal_i(e, BTErrnoInvalidState); fake_kernel_malloc_mark_assert_equal(); prv_assert_no_event(); } void test_gatt_client_subscriptions__unsubscribe_not_subscribed_but_other_clien...
gatt_client_subscriptions_subscribe(characteristic, BLESubscriptionNone, GAPLEClientKernel)
; cl_assert_equal_i(e, BTErrnoOK); // Kernel should get event immediately: prv_assert_subscription_event(characteristic, BLESubscriptionNone, BLEGATTErrorSuccess, true /* kernel */, false /* app */); // CCCD value should be 0 now: cl_assert_equal_i(s_last_cccd_value, 0); // Verify ever...
/* * 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...
("Button was pushed on boot. Button counter: ")
; dbgserial_print_hex(button_counter_register); dbgserial_newline(); } RTC_WriteBackupRegister(STUCK_BUTTON_REGISTER, button_counter_register); return result; } bool boot_test_is_flash_broken(void) { return !flash_sanity_check(); }
ntext) { window_single_click_subscribe(BUTTON_ID_SELECT, prv_decline_click_handler); } static void prv_show_decline_dialog(DialogsData *data) { ActionableDialog *actionable_dialog = actionable_dialog_create("Decline Dialog"); Dialog *dialog = actionable_dialog_get_dialog(actionable_dialog); dialog_set_text(dia...
(dialog, data->lorem_ipsum)
; dialog_set_background_color(dialog, GColorLightGray); dialog_set_icon(dialog, data->resource_id_25); dialog_show_status_bar_layer(dialog, true); expandable_dialog_set_header(expandable_dialog, "A very long header"); app_expandable_dialog_push(expandable_dialog); } //////////////////////////////////////// ...
/* * 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...
(length_str)
; if (length == 0) { prompt_send_response("Invalid length"); return; } // Temporarily turn on logging so the hexdump comes out. serial_console_set_state(SERIAL_CONSOLE_STATE_LOGGING); uint8_t buffer[128]; while (length) { uint32_t chunk_size = MIN(length, 128); flash_read_bytes(buffer, ad...
/* * 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...
analytics_heartbeat_set(heartbeat, metric, value)
; } analytics_storage_give_lock(); } void analytics_set_entire_array(AnalyticsMetric metric, const void *value, AnalyticsClient client) { analytics_storage_take_lock(); AnalyticsHeartbeat *heartbeat = analytics_storage_find(metric, NULL, client); if (heartbeat) { // We allow only a limited number of ap...
/* * 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...
(l.bounds, GRect(0, 0, 300, 400))
; // only expands .h, keeps .w layer_set_frame(&l, &GRect(10, 20, 200, 500)); cl_assert_equal_grect(l.bounds, GRect(0, 0, 300, 500)); } void test_layer_rect__3_x_sync_if_applicable(void) { Layer l; s_process_manager_compiled_with_legacy2_sdk = false; layer_init(&l, &GRect(10, 20, 30, 40)); cl_assert_eq...
ANALYTICS_LOG_DEBUG("App Crash event: uuid:%s, pc: %p, lr: %p", uuid_string, (void *)pc, (void *)lr)
; #endif analytics_logging_log_event(&event_blob); } extern bool comm_session_is_valid(const CommSession *session); // ------------------------------------------------------------------------------------------ static bool prv_get_connection_details(CommSession *session, bool *is_ppogatt, ...
const GTextAlignment prv_alignment = PBL_IF_RECT_ELSE(GTextAlignmentLeft, GTextAlignmentCenter); static time_t prv_get_parent_timestamp(TimelineItem *reminder) { TimelineItem pin; if (S_SUCCESS != pin_db_get(&reminder->header.parent_id, &pin)) { return reminder->header.timestamp; } timeline_item_free_all...
(codepoint)
) { // Skip this codepoint return true; } else if (codepoint_is_emoji(codepoint)) { if (*emoji_codepoint) { // This has more than one emoji goto fail; } // Found an emoji *emoji_codepoint = codepoint; return true; } // This is not an emoji-only string fail: *emoji_codepoi...
" #include "services/common/comm_session/session.h" #include "services/common/event_service.h" #include "services/common/evented_timer.h" #include "services/common/i18n/i18n.h" #include "services/normal/blob_db/reminder_db.h" #include "services/normal/bluetooth/ble_hrm.h" #include "services/normal/notifications/action_...
{ window_stack_remove(data->chaining_data.action_chaining_window, true); data->chaining_data.action_chaining_window = NULL; }
(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" BAS...
(&DFSDM_InitStruct)
ttp://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 perm...
persist_read_int(COUNT_PKEY)
; persist_write_int(COUNT_PKEY, num_beers + (500 + rand() % 500)); menu_layer_reload_data(menu_layer); break; } case 2: { int num_beers = persist_read_int(COUNT_PKEY); persist_write_int(COUNT_PKEY, num_beers - (500 + rand() % 500)); menu_layer_reload_data(menu_layer); } ...
graphics_draw_line(ctx, GPoint(40,40), GPoint(40,40))
; graphics_context_set_antialiased(ctx, false); graphics_context_set_stroke_width(ctx, 3); graphics_draw_line(ctx, GPoint(50,50), GPoint(50,50)); graphics_context_set_antialiased(ctx, true); graphics_context_set_stroke_width(ctx, 3); graphics_draw_line(ctx, GPoint(60,60), GPoint(60,60)); graphics_conte...
> #include <util/uuid.h> // Dialog SDK #include "ble_gap.h" #include "ble_gatt.h" #include "ble_gattc.h" #include "ble_gatts.h" #include "ble_service.h" #include "ble_uuid.h" #include "storage.h" #include <inttypes.h> #include <string.h> // Hack Alert // // There are some really sad Android phones/versions out ther...
connection_set_ppogatt_wa_state(conn, state)
; } return state; } void ppogatt_destroy_state(PPoGATTWorkAroundState *state) { if (state->pending_response_data) { kernel_free(state->pending_response_data); } kernel_free(state); } static bool prv_is_emulated_server_wa_requested(uint16_t conn_idx) { bool enabled = false; storage_acquire(); devic...
s * sizeof(int32_t)); for (size_t i = 0; i < num_hr_samples; i++) { sample_buf[i] = hr->samples[i]; weight_buf[i] = hr->weights[i]; } // Calculate the total weight stats_calculate_basic(StatsBasicOp_Sum, weight_buf, hr->num_samples, NULL, NULL, &total_weight); ...
time_util_get_day(utc_sec)
arent", GColorClearARGB8}, {"clear", GColorClearARGB8}, // Pebble colors taken from gcolor_defitions.h {"black", GColorBlackARGB8}, {"oxfordblue", GColorOxfordBlueARGB8}, {"dukeblue", GColorDukeBlueARGB8}, {"blue", GColorBlueARGB8}, {"darkgreen", GColorDarkGreenARGB8}, {"midnightgreen", GColorMidnightG...
prv_parse_hex_comp(color_value + 3 * len, len, a)
); } static bool prv_parse_hex(const char *color_value, GColor8 *parsed_color) { const size_t len = strlen(color_value); if (len < 1 || color_value[0] != '#') { return false; } int32_t r, g, b, a; switch (len) { case 4: { // #RGB if (prv_parse_hex_comps(color_value + 1, 1, &r, &g, &b, NULL)) {...
{ bus->busy = false; return; }
/*-------------------BUS/PIN CONFIG FUNCTIONS--------------------------*/ static void prv_rail_ctl(I2CBus *bus, bool enable) { bus->rail_ctl_fn(bus, enable); if (enable) { // wait for the bus supply to stabilize and the peripherals to start up. // the MFI chip requires its reset pin to be stable for at l...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(s_pixels)
X_PAYLOAD_SIZE (MTU_SIZE - 3 /* ATT Header size */ - 1 /* PPoGATT Packet Header */) uint16_t s_mtu_size; int bt_driver_gap_le_disconnect(const BTDeviceInternal *peer_address) { return 0; } uint16_t gap_le_connection_get_gatt_mtu(const BTDeviceInternal *device) { return s_mtu_size; } GAPLEConnection *gap_le_conn...
{ s_client_reset_complete_size += sizeof(PPoGATTResetCompleteClientIDPayloadV1); }
s_client_reset_complete = (PPoGATTPacket *) malloc(s_client_reset_complete_size); *s_client_reset_complete = (const PPoGATTPacket) { .sn = 0, .type = PPoGATTPacketTypeResetComplete, }; if (s_ppogatt_version > 0) { *((PPoGATTResetCompleteClientIDPayloadV1 *)s_client_reset_complete->payload) = ...
oth_types.h> #include <bluetooth/classic_connect.h> #include <bluetooth/reconnect.h> #include <bluetooth/sm_types.h> #include <btutil/bt_device.h> #include <stdio.h> #include <string.h> #define HEADER_BUFFER_SIZE 22 #define SHARING_HEART_RATE_EXTRA_HEIGHT_PX (18) typedef enum SettingsBluetooth { SettingsBluetooth...
(data, remote)
struct { char axis_name; uint8_t register_address; int pass_threshold; int16_t negative_value; int16_t positive_value; } accel_test_axis[] = { { .axis_name = 'X', .register_address = BMI160_REG_ACC_X_LSB, .pass_threshold = 3277 }, { .axis_name = 'Y', .re...
("GYRO: want mode %d, actual %d", mode, status)
; } PBL_ASSERT(retries > 0, "Gyro: Could not set power mode to %d", mode); s_gyro_power_mode = mode; BMI160_DBG("PMU_STATUS: 0x%x", bmi160_read_reg(BMI160_REG_PMU_STATUS)); } /* * accel.h driver interface exposed to higher level code */ static uint32_t prv_get_sampling_interval_from_hw(void) { uint8_t ac...
urrent); if (animation_private_using_legacy_2(state)) { // We need to enable other applib modules like scroll_layer, menu_layer, etc. which are // compiled to use the 3.0 animation API to work with 2.0 apps. animation_legacy2_schedule((AnimationLegacy2 *)animation_h); return true; } AnimationPriv...
prv_animation_state_get(PebbleTask_Current)
; if (animation_private_using_legacy_2(state)) { // We need to enable other applib modules like scroll_layer, menu_layer, etc. which are // compiled to use the 3.0 animation API to work with 2.0 apps. AnimationLegacy2Handlers *legacy_handlers = (AnimationLegacy2Handlers *)&handlers; animation_legacy2_...
otted(&ctx, GPoint(101, 75), 5); // T facing left - odd vert, even horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(131, 71), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(132, 76), 5); // T facing right - lined up graphics_draw_vertical_line_dotted(&ctx, GPoint(10, 90), 10); graphics_draw_...
(&ctx, GPoint(67, 96), 5)
; // T facing left - even vert, even horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(100, 90), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(100, 95), 5); // T facing left - odd vert, odd horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(131, 91), 10); graphics_draw_horizontal_line_dott...
icensed 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, software * distributed unde...
timeline_peek_prefs_get_before_time()
); const OptionMenuCallbacks callbacks = { .select = prv_before_time_menu_select, }; settings_option_menu_push( title, OptionMenuContentType_SingleLine, selected, &callbacks, ARRAY_LENGTH(s_before_time_strings), true /* icons_enabled */, s_before_time_strings, data); } static void prv_deinit_cb(S...
elineItem item = {}; cl_assert_equal_p(timeline_item_find_action_with_id(&item, 0), NULL); // Make sure we actually find the items we're looking for item.action_group.num_actions = ARRAY_LENGTH(s_basic_action_list); item.action_group.actions = s_basic_action_list; cl_assert_equal_p(timeline_item_find_action_...
cl_assert_equal_p(timeline_item_find_reply_action(&item), &action_list[1])
; action_list[1].type = TimelineItemActionTypeAncsResponse; cl_assert_equal_p(timeline_item_find_reply_action(&item), &action_list[1]); item.header.id = UUID_INVALID; cl_assert_equal_p(timeline_item_find_reply_action(&item), NULL); free(action_list); }
TranscriptionDialog *transcription_dialog = &data->transcription_dialog; transcription_dialog_init(transcription_dialog); transcription_dialog_update_text(transcription_dialog, data->message, data->message_len); transcription_dialog_set_callback(transcription_dialog, prv_voice_confirm_cb, dat...
if (next_state == StateFinished) { return next_state; }
break; case StateFinished: if ((next_state == StateWaitForReady) || (next_state == StateStartWaitForReady)) { return StateStartWaitForReady; } break; case StateError: case StateExiting: if (next_state == StateWaitForReady) { return next_state; } b...
/* * 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_cache_buffer[1], &ZERO_ITEM, sizeof(TestCacheItem))
; cl_assert_equal_m(&s_cache_buffer[2], &ZERO_ITEM, sizeof(TestCacheItem)); circular_cache_push(&s_test_cache, &s_test_item[2]); cl_assert_equal_m(&s_cache_buffer[0], &s_test_item[0], sizeof(TestCacheItem)); cl_assert_equal_m(&s_cache_buffer[1], &s_test_item[2], sizeof(TestCacheItem)); cl_assert_equal_m(&s_c...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
kernel_zalloc_check(size)
; } for (ResponseTimeState s = ResponseTimeMax; s < NumResponseTimeState; ++s) { const PebblePairingServiceConnParamSet *pps_params = &settings->connection_parameter_sets[s]; GAPLEConnectRequestParams *params = &connection->connection_parameter_sets[s]; prv_convert_pps_request_params...
Md *app_md) { #if CAPABILITY_HAS_JAVASCRIPT if (app_md->is_rocky_app) { return APP_STACK_ROCKY_SIZE; } #endif return APP_STACK_NORMAL_SIZE; } T_STATIC MemorySegment prv_get_app_ram_segment(void) { return (MemorySegment) { __APP_RAM__, __APP_RAM_end__ }; } T_STATIC size_t prv_get_stack_guard_size(void) { ...
resource_init_app(res_bank_num, res_version_ptr)
) { // The resources are busted! Abort starting this app. APP_LOG(APP_LOG_LEVEL_ERROR, "Checksum for resources differs or insufficient meta data for JavaScript app."); return false; } } // Synchronously handle process start since its new state is needed for app state initializat...
(conn, &device); hc_endpoint_pairing_send_pairing_complete(&device, evt->status); } // Convert to BT Spec error codes and update Pebble Pairing Service's Conn Status characteristic: const uint8_t smp_status = SMP_GET_PAIR_FAIL_REASON(evt->status); connection_set_last_pairing_result(conn_idx, smp_status); ...
(LOG_LEVEL_ERROR, "ble_enable: %u", e)
; } PBL_LOG(LOG_LEVEL_DEBUG, "go go go"); ble_register_app(); advert_init(); local_addr_init(); // Do all the things that clear the ATT table before registering the local services: prv_configure_local_device_properties(init_info->config); gatt_local_services_init(init_info->config); gatt_local_ser...
te(); dev->state->enabled_state = HRMEnabledState_Disabled; // Boot up the HRM so that we can read off the firmware version to see // if it needs to be updated. // First, read the version from the firmware update resource. const uint32_t update_length = resource_size( SYSTEM_APP, RESOURCE_ID_AS7000_FW...
mutex_unlock(dev->state->lock)
-936}, { 32, -320, -872}, { 56, -272, -840}, { 24, -208, -776}, { 80, -208, -680}, { 216, -88, -584}, { 328, -8, -464}, { 552, 32, -184}, { 1016, 136, -32}, { 2096, 464, 48}, { 2416, 784, 464}, { 2272, 792, 592}, // 5 seconds { 1736, 576, -88}, { 1392, 288, 160},...
{ 1408, 472, 96}, { 1624, 256, 128}, { 1632, 168, 104}, { 1664, 80, -24}, { 1528, 64, 0}, { 1208, 72, -8}, { 1048, 40, -216}, { 1008, 64, -264}, { 864, -240, -200}, { 848, -264, -160}, { 648, -144, -312}, { 544, -152, -384}, { 584, -64, -384}, { 856, -48, -408}, ...
{ 1536, 8, -144}, { 1632, 232, 168}, { 1856, 368, 8}, // 13 seconds { 1624, 304, -192}, { 1168, 368, -392}, { 1032, 344, -296}, { 1032, 240, -128}, { 1120, 184, -176}, { 1040, 200, -120}, { 944, 248, -144}, { 960, 280, -152}, { 984, 336, -192}, { 840, 320, -192},...
samples_len) { time_t now = rtc_get_time(); for (int i = 0; i < samples_len; i++) { // NOTE: We feed in a significant VMC to simulate activity so that the sleep algorithm // doesn't think we're sleeping kalg_activities_update(s_kalg_state, now, samples[i].steps, 7000 /*vmc*/, 0 /*orientation*/, ...
(minute_raw_data, k_minute_data_len, &exp_session)
TEXT_ALIGNMENT, (GTextLayoutCacheRef) &layout).h; } static int prv_get_icon_top_margin(bool has_status_bar, int icon_height, int window_height) { const uint16_t status_layer_offset = has_status_bar ? 6 : 0; #if PLATFORM_ROBERT || PLATFOR...
{ applib_free(simple_dialog); }
} static void prv_click_handler(ClickRecognizerRef recognizer, void *context) { SimpleDialog *simple_dialog = context; if (!simple_dialog->buttons_disabled) { dialog_pop(&simple_dialog->dialog); } } static void prv_config_provider(void *context) { // Simple dialogs are dimissed when any button is pushed....
1000); } void test_calendar_handle__ongoing_event_added_and_removed(void) { rtc_set_time(15 * 60); timeline_event_init(); cl_assert_equal_i(fake_event_get_count(), 1); cl_assert(!prv_get_calendar_ongoing()); TimerID timer_id = stub_new_timer_get_next(); cl_assert_equal_i(timer_id, TIMER_INVALID_ID); cl_...
stub_new_timer_is_scheduled(timer_id)
); } void test_calendar__handle_non_calendar_pins(void) { // Insert a random pin (non calendar event) cl_assert(timeline_add(&item5)); timeline_event_handle_blobdb_event(); timeline_event_init(); cl_assert_equal_i(fake_event_get_count(), 1); cl_assert(!prv_get_calendar_ongoing()); TimerID timer_id = stu...
tion_a); // Setup stopped handler for the first child that unschedules the parent const AnimationHandlers special_handlers = { .started = NULL, .stopped = prv_unschedule_parent }; animation_set_handlers(a, special_handlers, NULL); Animation *b = prv_create_test_animation(); animation_set_duration(...
(&s_stopped_handler_calls, c)
, 0); // ------------------------------------------------------------------------------------- // Seek to about the middle of B // Save the current update elapsed animation_set_elapsed(complex, duration_a + duration_b/2); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_as...
we stand heap wise on older platforms like spalding. We don't really //! have any analytics in place to track this. Before changing the behavior, let's back it with //! some data. For now ... live and let live #define DEFAULT_KERNEL_SENDER_MAX_BYTES_ALLOCATED \ ((sizeof(PebbleProtocolHeader) + DEFAULT_KERNEL_SENDER_...
{ return prv_get_remaining_length((SendBuffer *)send_job); }
static size_t prv_send_job_impl_copy(const SessionSendQueueJob *send_job, int start_offset, size_t length, uint8_t *data_out) { SendBuffer *sb = (SendBuffer *)send_job; const size_t length_remaining = prv_get_remaining_length(sb); const size_t length_after_offset = (length_r...
or(GVector(2, 5)); GVectorPrecise vectorP_c = GVectorPrecise((2 % GVECTOR_PRECISE_MAX) << GVECTOR_PRECISE_PRECISION, (5 % GVECTOR_PRECISE_MAX) << GVECTOR_PRECISE_PRECISION); cl_assert(gvectorprecise_equal(&vectorP, &vectorP_c)); } void test_graphics_gtransform_${BIT_DEP...
(&t_new, &t_c)
); } void test_graphics_gtransform_${BIT_DEPTH_NAME}__scale(void) { GTransform t_new; GTransform t1; GTransform t2; GTransform t_c; // matrix to compare against // Test scaling t1 = GTransformFromNumbers(1, 2, 3, 4, 5, 6); t2 = GTransformFromNumbers(1, 2, 3, 4, 5, 6); t_c = GTransformFromNumbers(10, 2...
NO_CLIP, false, 1); for (int16_t col = 0; col < MAX_NUM_COLS; col++) { graphics_draw_vertical_line_dotted(&ctx, GPoint(col, 0), MAX_NUM_ROWS); } cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_vert_dotted_line_origin_checkerboard_no_clip"))); // Clipping on even boundaries - no ...
gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_vert_dotted_line_even_offset_checkerboard_no_clip"))
); // Clipping on even boundaries - no offset setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_EVEN, OFFSET_RECT_EVEN, false, 1); for (int16_t col = 0; col < MAX_NUM_COLS; col++) { graphics_draw_vertical_line_dotted(&ctx, GPoint(col, 0), MAX_NUM_ROWS); } cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_...
nd_color(dialog, GColorRed); dialog_set_icon(dialog, data->resource_id_80); // Create custom action bar for the dialog. // TODO destroy action bar / icon in unload callback ActionBarLayer *custom_action_bar = action_bar_layer_create(); action_bar_layer_set_icon(custom_action_bar, BUTTON_ID_UP, gbitmap_...
(expandable_dialog, "Header")
; app_expandable_dialog_push(expandable_dialog); } //////////////////////////////// // Expandable Dialog with icon static void prv_show_expandable_dialog_no_icon(DialogsData *data) { ExpandableDialog *expandable_dialog = expandable_dialog_create("Expandable Dialog"); Dialog *dialog = expandable_dialog_get_dialog...
sms(app_id, subtitle); } static void prv_populate_actions(TimelineItem *item, uint8_t **buffer, uint8_t *buf_end, const ANCSAttribute *positive_action, const ANCSAttribute *negative_actio...
(subtitle)
; if (has_multimedia) { required_space_for_strings += MULTIMEDIA_INDICATOR_LENGTH; } required_space_for_strings += prv_max_ellipsified_cstring_size(message); required_space_for_strings += prv_max_ellipsified_cstring_size(positive_action); required_space_for_strings += prv_max_ellipsified_cstring_size(nega...
/* * 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...
{ free(fb); }
// Tests //////////////////////////////////// void inside_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_pixel(ctx, GPoint(5, 5)); } void white_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorW...
static bool prv_iter_next(IteratorState state) { TimelineIterState *timeline_iter_state = (TimelineIterState *)state; if (timeline_iter_state->node == NULL) { return false; } // keep a copy of the original node in case we go to the end without finding a new valid node TimelineNode *orig = timeline_iter_st...
pin_db_insert_item(item)
); } bool timeline_exists(Uuid *id) { return (pin_db_get_len((uint8_t *)id, UUID_SIZE) > 0); } bool timeline_remove(const Uuid *id) { // Use BlobDB directly in order to emit the BlobDB delete event return (S_SUCCESS == blob_db_delete(BlobDBIdPins, (uint8_t *)id, UUID_SIZE)); } TimelineIterDirection timeline_di...
.start = &__cache_ram_zi_start__, .length = (uint32_t)__cache_ram_length, }, { .tag = MemoryRegionTag_RebootReason, .start = &__debug_region_start__, .length = (uint32_t)__debug_region_length, }, }; static uint16_t prv_timer_get_ticks(void) { return hw_timer0_get_on(); } static uint16_t prv_t...
(s_spi->bus_id, HW_SPI_FIFO_TX_ONLY)
; rx_mode = false; tx_index = 0; tx_start_ticks = prv_timer_get_ticks(); continue; } else { // Buffer is full. Shift everything down one byte. rx_index--; memmove(&buffer[0], &buffer[1], rx_index); } } ...
void *context) { } static void prv_layout_did_appear_handler(SwapLayer *swap_layer, LayoutLayer *layout, int8_t rel_change, void *context) { SwapLayerDemoData *data = context; data->idx += rel_change; } static void prv_update_colors_handler(SwapLayer *swap_...
(&attr_list, AttributeIdTitle, notif.title)
; } if (notif.subtitle) { attribute_list_add_cstring(&attr_list, AttributeIdSubtitle, notif.subtitle); } if (notif.body) { attribute_list_add_cstring(&attr_list, AttributeIdBody, notif.body); } if (notif.location) { attribute_list_add_cstring(&attr_list, AttributeIdLocationN...
"Cloudy with rain and snow. High 1C. Winds light and variable. " "Chance of precip 100%. 3-7cm of snow expected."); attribute_list_add_uint32(&list, AttributeIdLastUpdated, now); if (!has_timestamp) { attribute_list_add_uint8(&list, AttributeIdDisplayTime, WeatherTimeType_No...
attribute_list_add_string_list(&list, AttributeIdParagraphs, &paragraphs)
; attribute_list_add_cstring(&list, AttributeIdBody, "Topics for the week can be found here: " "http://docs.google.com/u/1/#inbox/14b9fa5f872ebbc6\n\n" "Will email before if we need to cancel"); attribute_list_add_uint32(&list, A...
*) loaded_list, NULL); prv_unload_loaded_notification(old_node); } // load the notification TimelineItem notification; if (!notification_storage_get(&node->id, &notification)) { return NULL; } // track the loaded notification loaded_node = app_malloc_check(sizeof(LoadedNotificationNode)); lis...
app_simple_dialog_push(confirmation_dialog)
; } static void prv_dialog_click_config(void *context) { NotificationsData *data = app_state_get_user_data(); window_single_click_subscribe(BUTTON_ID_SELECT, prv_confirmed_handler); window_set_click_context(BUTTON_ID_SELECT, data); } static void prv_settings_clear_history_window_push(NotificationsData *data) {...
led); } void recognizer_set_failed(Recognizer *recognizer) { PBL_ASSERTN(recognizer); PBL_ASSERTN(recognizer->state == RecognizerState_Possible); prv_set_state(recognizer, RecognizerState_Failed); if (recognizer->impl->on_fail) { recognizer->impl->on_fail(recognizer); } } void recognizer_set_manager(R...
if (!list) { return; }
*list = (RecognizerList){}; } bool recognizer_list_iterate(RecognizerList *list, RecognizerListIteratorCb iter_cb, void *context) { if (!list || !iter_cb) { return true; } ListNode *node = list->node; while (node) { ListNode *next = list_get_next(node); if (!iter_cb(...
/* * 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 = ctx, .color = color, }
; } void graphics_context_set_stroke_width(GContext* ctx, uint8_t stroke_width) {} void graphics_draw_line(GContext* ctx, GPoint p0, GPoint p1) {} void graphics_fill_rect(GContext *ctx, const GRect *rect) {} void graphics_fill_round_rect_by_value(GContext *ctx, GRect rect, uint16_t corner_radius, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ assert_encode("Hello", 5, 6); assert_out_equal("\x06Hello", 6); }
void test_cobs_encode__multiple_blocks(void) { assert_encode("Hello\0w\0rld", 11, 12); assert_out_equal("\x06Hello\x02w\x04rld", 12); } void test_cobs_encode__max_block_1(void) { // vector[] = { 0x01, 0x02, ..., 0xfe }; uint8_t vector[254]; for (size_t i = 0; i < sizeof(vector); ++i) { vector[i] = i + ...
S_SUCCESS); // delete every few files and a bunch of pages near the end if (((i & 0x1) == 0) || ((i > ((num_pages() * 7) / 10)) && (i < ((num_pages() * 8) / 10)))) { cl_assert(pfs_remove(file_small) == S_SUCCESS); } } // We limit this number because we would overflow our uint8_t. const ...
pfs_seek(fd, -6, FSeekCur)
; cl_assert(rv == E_RANGE); rv = pfs_seek(fd, 0, FSeekSet); cl_assert(rv == 0); rv = pfs_seek(fd, len + 1, FSeekCur); cl_assert(rv == E_RANGE); rv = pfs_seek(fd, len + 1, FSeekSet); cl_assert(rv == E_RANGE); rv = pfs_seek(fd, -1, FSeekSet); cl_assert(rv == E_RANGE); } void test_pfs__read(void) { c...
cond away from turning down the sampling rate // Use Acceptable because of the short circuiting in `prv_heart_rate_subscription_update` prv_advance_time_hr(ACTIVITY_DEFAULT_HR_ON_TIME_SEC - 1, 100 /*bpm*/, HRMQuality_Acceptable, false /*force_continuous*/); // The last update time should be...
activity_metrics_prv_get_median_hr_bpm(&median, &total_weight)
; cl_assert_equal_i(median, 0); // But the last stable BPM shouldn't get wiped activity_get_metric(ActivityMetricHeartRateFilteredBPM, 1, &last_median); activity_get_metric(ActivityMetricHeartRateFilteredUpdatedTimeUTC, 1, &last_update_utc); cl_assert_equal_i(last_median, 51); cl_assert(last_update_utc >= ...
|| !node) { return NULL; } Uuid *uuid = &node->uuid; LauncherAppGlance *glance = NULL; // Try to find the requested glance in the cache LauncherAppGlanceCacheEntry *cache_entry = prv_find_glance_entry_in_cache(service, uuid); if (cache_entry) { // Move the found cache entry to the front of the c...
if (!use_glance_cache) { // Don't play glances that we don't store in the cache since they don't live long enough // to advance frames return; }
LauncherAppGlance *glance = prv_fetch_from_cache_or_load_glance_for_node(node, service); PBL_ASSERTN(glance); kino_player_set_reel(glance_reel_player, glance->reel, false /* take_ownership */); kino_player_play(glance_reel_player); } void launcher_app_glance_service_notify_glance_changed(LauncherAppGlanceSer...
ncy_for_le_connection(&s_hdl, &secs_to_wait); cl_assert_equal_i(state, ResponseTimeMiddle); cl_assert_equal_i(secs_to_wait, 30 - BT_CONN_MGR_INACTIVITY_TIMEOUT_SECS); cl_assert_equal_i(fake_gap_le_connect_params_get_last_requested(), ResponseTimeMiddle); // removing all consumers we should fall back to slowest...
cl_assert_equal_i(state, ResponseTimeMax)
; // Requesting ResponseTimeMax should have no effect: conn_mgr_set_ble_conn_response_time(&s_hdl, BtConsumerLeServiceDiscovery, ResponseTimeMax, 1); state = conn_mgr_get_latency_for_le_connection(&s_hdl, &secs_to_wait); cl_assert_equal_i(state, ResponseTimeMax); // Not even after waiting 10 seconds: prv_...
t fraction_mask = 0x7; if (vertical) { // Left and right most point helpers for main loop GPointPrecise lm_p0 = far_top; GPointPrecise lm_p1 = far_left; GPointPrecise rm_p0 = far_top; GPointPrecise rm_p1 = far_right; const int16_t top_point = MIN(p0.y.raw_value, p1.y.raw_value) - radius.raw_...
{ right_margin.raw_value = rm_p0.x.raw_value; }
unt = 0; s_offset = (GPoint){ 0 }; if (s_precise_lines) { free(s_precise_lines); s_precise_lines = NULL; } s_num_precise_lines = 0; } // setup and teardown void test_gdraw_command__initialize(void) { prv_reset(); } void test_gdraw_command__cleanup(void) { if (s_stroke_points) { free(s_stroke_...
cl_assert_equal_i(s_path_stroke_count, 0)
; cl_assert_equal_p(s_stroke_points, NULL); cl_assert(prv_compare_points(points, s_fill_points, s_path_num_points)); prv_reset(); // restore stroke color and change both points gdraw_command_set_stroke_color(command, GColorPurple); GPoint points2[] = { { 23, 45 }, { 67, 13} }; gdraw_command_set_point(co...