prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
maphoreTake(s_pb_semaphore, SEMAPHORE_TIMEOUT_TICKS) != pdTRUE) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to acquire the put-bytes semaphore, retry"); return false; } return true; } static bool prv_prepare(size_t total_payload_length) { if (total_payload_length > PUT_BYTES_PP_BUFFER_SIZE) { PBL_LOG(LOG_LEVE...
{ if (s_pb_state.receiver.should_nack) { PBL_LOG(LOG_LEVEL_WARNING, "NACK'ing from ..._finish"); prv_add_nack_no_token_system_callback(); prv_receiver_reset(); return; } // We are still processing PB data, keep the BT connection fast prv_set_responsiveness(ResponseTimeMin, MIN_LATENCY_MODE_TIME...
const ReceiverImplementation g_put_bytes_receiver_impl = { .prepare = prv_receiver_prepare, .write = prv_receiver_write, .finish = prv_receiver_finish, .cleanup = prv_receiver_cleanup, }; //////////////////////////////////////////////////////////////////////////////////////////////////// // For Unit Testing ...
the new record didn't finish by the time we rebooted. // There should only ever be one such record, and we shouldn't ever hit // this if writing the new record actually completed, since we check // for this case in bootup_check(). clear_flag(hdr, SETTINGS_FLAG_OVERWRITE_STARTED); } // G...
if (!found_another) { // No other file->iter.hdr found, we must have rebooted in the middle of // writing the new record. Compacting the file will copy over the // previous record while clearing the overwrite bits for us, so that we // can still find the previous record. We could be smarter here...
// The overwrite completed, we just rebooted before getting a chance // to flip the completion bit on the previous record. Flip it now so // that we don't have to keep checking on every boot. settings_raw_iter_set_current_record_pos(&file->iter, partially_overwr...
/* * 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...
(pcba_serial_number, mfg_get_pcba_serial_number(), pcba_serial_number_size)
; if (pcba_serial_number_size > MFG_PCBA_SERIAL_NUMBER_SIZE) { // same assumption as in mfg_info_get_pcba_serialnumber pcba_serial_number[MFG_PCBA_SERIAL_NUMBER_SIZE] = '\0'; } } void mfg_info_get_hw_version(char *hw_version, size_t hw_version_size) { strncpy(hw_version, mfg_get_hw_version(), hw_version_...
33937600; prv_clock_reset(0); rtc_set_time(jun10th_noon_2015); // Our test event is at June 9th 2015, 16:00:00 // Now - one day const int event_time = jun10th_noon_2015 - SECONDS_PER_DAY + (4 * SECONDS_PER_HOUR); // if the event is within 24 hours, then show the actual time instead of "X hours ago" con...
{ char time_buf[64]; const int jun10th_noon_2015 = 1433937600; prv_clock_reset(0); rtc_set_time(jun10th_noon_2015); // Our test event is at June 9th 2015, 16:00:00 // Now - one day const int event_time = jun10th_noon_2015 - SECONDS_PER_DAY + (4 * SECONDS_PER_HOUR); // if the event is within 24 hours...
// June 9th 2015, 14:00:00 (T-02:00:00) rtc_set_time(event_time - (2 * SECONDS_PER_HOUR)); clock_get_until_time(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("In 2 hours", time_buf); // June 9th 2015, 15:59:00 (T-00:01:00) rtc_set_time(event_time - (1 * SECONDS_PER_MINUTE));...
ITHOUT 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 "board/board.h" #include "drivers/flash/flash_impl.h" #include "drivers/flash/qspi_flash.h" #include "drivers/flash/qspi_flash_pa...
(QSPI_FLASH)
; } status_t flash_impl_erase_subsector_begin(FlashAddress subsector_addr) { return qspi_flash_erase_begin(QSPI_FLASH, subsector_addr, true /* is_subsector */); } status_t flash_impl_erase_sector_begin(FlashAddress sector_addr) { return qspi_flash_erase_begin(QSPI_FLASH, sector_addr, false /* !is_subsector */); } ...
lerts_get_mask() == AlertMaskAllOn); // Should not allow any notifications through while in low power s_low_power_active = true; cl_assert(!alerts_should_notify_for_type(AlertInvalid)); cl_assert(!alerts_should_notify_for_type(AlertMobile)); cl_assert(!alerts_should_notify_for_type(AlertReminder)); cl_ass...
(!alerts_should_enable_backlight_for_type(AlertPhoneCall))
; cl_assert(!alerts_should_notify_for_type(AlertMobile)); cl_assert(!alerts_should_vibrate_for_type(AlertMobile)); alerts_set_notification_vibe_timestamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS); cl_assert(!alerts_should_enable_backlight_for_type(AlertMobile)); cl_assert(!a...
!ctx.triggered); r->state = RecognizerState_Started; cl_assert(prv_dispatch_touch_event(r, &ctx)); cl_assert(handled); cl_assert_equal_p(ctx.triggered, r); ctx.triggered = NULL; handled = false; r->state = RecognizerState_Updated; cl_assert(prv_dispatch_touch_event(r, &ctx)); cl_assert(handled); c...
cl_assert_equal_i(recognizers[0]->state, RecognizerState_Started)
; cl_assert_equal_i(recognizers[1]->state, RecognizerState_Cancelled); cl_assert_equal_i(recognizers[2]->state, RecognizerState_Started); cl_assert_equal_i(recognizers[3]->state, RecognizerState_Cancelled); // Layer C's and layer A's recognizers get cancelled when there is no new active layer prv_set_all_sta...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(app_num, id, start_offset, data, num_bytes)
; } DEFINE_SYSCALL(bool, sys_resource_bytes_are_readonly, void *ptr) { return resource_bytes_are_readonly(ptr); } DEFINE_SYSCALL(const uint8_t *, sys_resource_read_only_bytes, ResAppNum app_num, uint32_t resource_id, size_t *num_bytes_out) { bool caller_is_privileged = true; if (PRIVILEGE_WAS_ELE...
/* * 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...
factory_reset(false /* should_shutdown */)
; break; default: PBL_LOG(LOG_LEVEL_ERROR, "Invalid reset msg, data[0] %u", data[0]); break; } } void fw_prepare_for_reset(bool unsafe_reset) { if (!unsafe_reset) { // Tear down Bluetooth, to avoid confusing the phone: services_set_runlevel(RunLevel_BareMinimum); #if PULSE_EVERYWHERE...
ll(swap_layer, dy, curve); } /////////////////////// // CLICK HANDLERS /////////////////////// ScrollDirection prv_direction_for_recognizer(ClickRecognizerRef recognizer) { ButtonId button_id = click_recognizer_get_button_id(recognizer); return (button_id == BUTTON_ID_UP) ? ScrollDirectionUp : ScrollDirectionDown...
prv_swap_layer_reset(swap_layer)
/* * 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...
sys_resource_size(sys_get_current_resource_num(), (uint32_t)h)
; } size_t applib_resource_load(ResHandle h, uint8_t *buffer, size_t max_length) { return sys_resource_load_range(sys_get_current_resource_num(), (uint32_t)h, 0, buffer, max_length); } size_t applib_resource_load_byte_range( ResHandle h, uint32_t start_offset, uint8_t *buffer, s...
s by name int prv_qsort_step_test_entry_cb(const void *a, const void *b) { StepFileTestEntry *entry_a = (StepFileTestEntry *)a; StepFileTestEntry *entry_b = (StepFileTestEntry *)b; // Put the non-walking samples at the end if (entry_a->exp_steps > 0 && entry_b->exp_steps == 0) { return -1; } else if (ent...
snprintf(time_str, sizeof(time_str), "%02d:%02d", hours, minutes)
; return time_str; } // ============================================================================================= // Start of unit tests void test_kraepelin_algorithm__initialize(void) { } // --------------------------------------------------------------------------------------- void test_kraepelin_algorithm_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_i(a.size.h, b.size.h)
; } // -------------------------------------------------------------------------------------- static void cl_assert_equal_gtransform(const GTransform a, const GTransform b) { cl_assert_equal_i(a.a.raw_value, b.a.raw_value); cl_assert_equal_i(a.b.raw_value, b.b.raw_value); cl_assert_equal_i(a.c.raw_value, b.c.ra...
/* * 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(out_buf, "BST", TZ_LEN)
; } else if (!strncmp(out_buf, "BST", TZ_LEN)) { strncpy(out_buf, "GMT", TZ_LEN); } } } // converts time_t to struct tm for localtime and gmtime struct tm *time_to_tm(const time_t * tim_p, struct tm *res, bool utc_mode) { time_t local_time; time_t utc_time = *tim_p; if (utc_mode) { res->tm_gm...
bitmap, TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_odd_offset_odd_rows_no_clip"))); // Test to make sure drawing on all rows creates checkerboard pattern setup_test_aa_sw(&ctx, fb, OFFSET_RECT_ODD, OFFSET_RECT_ODD, false, 1); for (int16_t row = 0; row < MAX_NUM_ROWS; row++) { graphics_draw_horizonta...
(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_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 offset setup_tes...
(src_x, src_begin_x, src_end_x - 1)) { // Check if content should wrap (under and over) for tiling if (!WITHIN(src_x, src_bitmap->bounds.origin.x, grect_get_max_x(&src_bitmap->bounds) - 1)) { // keep correct bounds alignment for circular when tiling src_x = src_bi...
(src_x, src_begin_x, src_end_x - 1)
) { // Check if content should wrap (under and over) for tiling if (!WITHIN(src_x, src_bitmap->bounds.origin.x, grect_get_max_x(&src_bitmap->bounds) - 1)) { // keep correct bounds alignment for circular when tiling src_x = src_bitmap->bounds.or...
(uint8_t *)&stress_data1, stress_addr1, sizeof(stress_data1)); PBL_LOG(LOG_LEVEL_DEBUG, ">> Writing Addr 0x%"PRIx32" to value 0x%"PRIx16, stress_addr2, stress_data2); flash_write_bytes((uint8_t *)&stress_data2, stress_addr2, sizeof(stress_data2)); return FLASH_TEST_SUCCESS; } // Run address read/writ...
COUNTER_PRINT(num_bytes)
igned case GBitmapFormat8BitCircular: return 0; // variable width } return 0; } static GBitmap* prv_allocate_gbitmap(void) { if (process_manager_compiled_with_legacy2_sdk()) { return (GBitmap *) applib_type_zalloc(GBitmapLegacy2); } return applib_type_zalloc(GBitmap); } static size_t prv_gbitm...
(base_bitmap)
== GBITMAP_VERSION_0) { GBitmapLegacy2 *legacy_bitmap = (GBitmapLegacy2 *) sub_bitmap; *legacy_bitmap = *(GBitmapLegacy2 *) base_bitmap; // it's the responsibility of the parent bitmap to free the underlying data legacy_bitmap->is_heap_allocated = false; } else { *sub_bitmap = *base_bitmap; /...
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 = contacts_db_flush, #else // Disabled on tintin for cod...
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_sy...
p arrow_left; GBitmap arrow_up; GBitmap arrow_right; } DisplayCalibrationData; static void prv_draw_text(Layer *layer, GContext *ctx) { DisplayCalibrationData *data = window_get_user_data(layer_get_window(layer)); graphics_context_set_text_color(ctx, GColorWhite); const char *titles[] = { [DisplayCalibr...
(layer_get_window(layer))
ed 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 License. */ #include "...
{ return; }
if (app_uuid) { PBL_LOG(LOG_LEVEL_WARNING, "Got an app UUID in a NLP result msg. Ignoring and continuing"); } // The timestamp attribute is optional time_t timestamp = 0; GenericAttribute *timestamp_attr = generic_attribute_find_attribute(&msg->attr_list, VEAttributeIdTimestamp, attr_list_size); ...
= prv_last_update_distance(a); cl_assert_equal_i(distance, ANIMATION_NORMALIZED_MAX); // B should start high distance = prv_last_update_distance(b); cl_assert_equal_i(distance, ANIMATION_NORMALIZED_MIN); #endif } // -------------------------------------------------------------------------------------- // Te...
{ const int duration_a = 150; const int duration_total = 2 * duration_a; const AnimationHandlers handlers = { .started = prv_started_handler, .stopped = prv_stopped_handler }; // Simulate some delay incurred on every call to rtc_get_ticks() fake_rtc_auto_increment_ticks(3); Animation *a0, *a1, ...
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a0), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a0), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a1), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a1),...
const char *src_filename, uint16_t src_line_number, const char *message) { prv_serialize_log_header(contents, log_level, timestamp_ms, task, src_filename, src_line_number); // Write the actual log message. strncpy(contents->message, message, sizeof(c...
circular_buffer_write(&s_isr_log_buffer, message, message_length)
nuItemsNumItems, } DayPickerMenuItems; // Forward Declarations static void prv_setup_custom_day_picker_window(AlarmEditorData *data); static bool prv_is_custom_day_scheduled(AlarmEditorData *data); /////////////////////////////////////////////////////////////////////////////////////////////////// //! Helper functions...
(&data->custom_day_picker_window)
; return; } menu_layer_deinit(&data->custom_day_picker_menu_layer); prv_remove_windows(data); i18n_free_all(&data->custom_day_picker_window); } static void prv_handle_custom_day_selection(int index, void *callback_context) { AlarmEditorData *data = (AlarmEditorData *)callback_context; prv_setup_custo...
/* * 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_IF_RECT_ELSE("WEEKDAYS", "Weekdays")
); // An alarm pin that has both a subtitle attribute and an AlarmKind attribute should create the // subtitle using the AlarmKind (ignoring the subtitle attribute), respecting the desire to // all-caps the subtitle on rectangular displays attribute_list = (AttributeList) {0}; attribute_list_add_cstring(attr...
ers_STARTUP_CNTL = 0x33, PmicRegisters_REFERENCE_CNTL = 0x35, PmicRegisters_RESET_CNTL = 0x36, PmicRegisters_OVERTEMP_CNTL = 0x37, PmicRegisters_REG_STANDBY_MOD1 = 0x39, PmicRegisters_PWM_CNTL_L = 0x41, PmicRegisters_PWM_CNTL_H = 0x42, PmicRegisters_CURR1_VAL = 0x43, PmicRegisters_CURR2_VAL = 0x44, ...
pmic_is_charging()
; const bool is_connected = pmic_is_usb_connected(); PBL_LOG(LOG_LEVEL_DEBUG, "AS3701b Interrupt: Charging? %s Plugged? %s", is_charging ? "YES" : "NO", is_connected ? "YES" : "NO"); PebbleEvent event = { .type = PEBBLE_BATTERY_CONNECTION_EVENT, .battery_connection = { .is_connected = battery...
update->entity_id, update->attribute_id); } // ------------------------------------------------------------------------------------------------- // Interface towards kernel_le_client.c void ams_create(void) { PBL_ASSERTN(!s_ams_client); s_ams_client = (AMSClient *) kernel_zalloc_check(sizeof(AMSClient))...
(LOG_LEVEL_DEBUG, "AMS Registered for entity_id=%u", entity_id)
; ++s_ams_client->next_entity_to_register; prv_register_next_entity(NULL); } void ams_handle_read_or_notification(BLECharacteristic characteristic, const uint8_t *value, size_t value_length, BLEGATTError error) { if (!s_ams_client || s_ams_client->characteristics[AMSCha...
d 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/graphics.h" #include "applib/graphics/graphics_private.h" #include "applib/graphics/g...
graphics_context_mask_record(ctx, mask)
); for (int16_t y = 0; y < num_src_colors; y++) { GColor src_color = (GColor) { .argb = (uint8_t)y }; for (int mask_value_index = 0; mask_value_index < num_mask_values; mask_value_index++) { int16_t x1 = (int16_t)(mask_value_index * num_pixels_per_mask_value); int16_t x2 = (int16_t)(x1 + num_pixe...
(*expandable_dialog->header) { text_layer_deinit(&expandable_dialog->header_layer); } scroll_layer_deinit(&expandable_dialog->scroll_layer); if (expandable_dialog->dialog.destroy_on_pop) { applib_free(expandable_dialog); } } Dialog *expandable_dialog_get_dialog(ExpandableDialog *expandable_dialog) { ...
gbitmap_create_with_resource_system(SYSTEM_APP, resource_id)
; } expandable_dialog->select_click_handler = select_click_handler; } void expandable_dialog_push(ExpandableDialog *expandable_dialog, WindowStack *window_stack) { dialog_push(&expandable_dialog->dialog, window_stack); } void app_expandable_dialog_push(ExpandableDialog *expandable_dialog) { app_dialog_push(&e...
byte swap it marker.length = ntohl(marker.length); marker.chunk_type = ntohl(marker.chunk_type); if (marker.chunk_type == CHUNK_ACTL) { actl_chunk_found = true; } if (seek_framedata) { if (marker.chunk_type == CHUNK_FDAT || marker.chunk_type == CHUNK_IDAT) { if (found_actl) { ...
memset(palette, 0, palette_entries * sizeof(GColor8))
(&success, "\x02\x11\x41\nB\x01 \x02")
; cl_assert(success); const TextBoxParams text_box_params = (TextBoxParams) { .utf8_bounds = &utf8_bounds, }; char_iter_init(&char_iter, &char_iter_state, &text_box_params, utf8_bounds.start); cl_assert(utf8_iter_state->codepoint == 0x02); cl_assert(iter_next(&char_iter)); cl_assert(utf8_iter_state...
onNode *) list_find(head, prv_find_subscription_cb, (void *) characteristic_ref); } // ------------------------------------------------------------------------------------------------- static bool prv_has_pending_cccd_write(GATTClientSubscriptionNode *subscription) { ...
(sizeof(GATTClientSubscriptionNode))
; if (!subscription) { // OOM return BTErrnoNotEnoughResources; } // Initialize it: *subscription = (const GATTClientSubscriptionNode) { .characteristic = characteristic_ref, .att_handle = att_handle, }; // Prepend to the list of subscriptions of the connection: ListN...
de_monitor.active) { // First time seeing data, let's go active s_stop_mode_monitor.active = true; s_stop_mode_monitor.intervals_without_data = 0; s_stop_mode_monitor.max_intervals_without_data = ACCESSORY_INITIAL_STOP_INTERVALS; stop_mode_disable(InhibitorAccessory); // Need to flip tasks be...
prv_unlock()
; } void accessory_send_data(const uint8_t *data, size_t length) { // NOTE: this may be run within an ISR prv_lock(); // When sending data, we need to temporarily disable input, as there's only one data line for // both directions and any data we send on that line will also be interpreted as data we can // r...
ge_get(&i1, &r)); compare_notifications(&e1, &r); free(r.allocated_buffer); cl_assert_equal_b(notification_storage_get(&i2, &r), false); cl_assert(notification_storage_get(&i3, &r)); compare_notifications(&e3, &r); free(r.allocated_buffer); e2.header.timestamp = e3.header.timestamp + 1; notification_...
notification_storage_get(&uuids[j], &r)
); compare_notifications(&e, &r); free(r.allocated_buffer); //Add another notification. Compression should free up another 4k block e.header.id = uuids[i]; e.header.timestamp = timestamp + i; notification_storage_store(&e); cl_assert(notification_storage_get(&uuids[i], &r)); compare_notifications(&e, &...
/* * 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...
process_metadata_get_app_sdk_platform(&md.common)
; cl_assert_equal_i(type, LEGACY_PLATFORM_AFTER_4); } void test_pebble_process_md__SDK4_2(void) { PebbleProcessMdFlash md = { .common.process_storage = ProcessStorageFlash, .common.is_unprivileged = true, .common.stored_sdk_platform = PROCESS_INFO_PLATFORM_BASALT, .sdk_version.major = PROCESS_INFO_...
96, -8}, { 168, 1000, -40}, { 144, 936, -96}, { 104, 888, -112}, { 72, 888, -136}, { 24, 912, -176}, { 0, 880, -168}, { -24, 1024, -184}, { -32, 1184, -280}, { -80, 1080, -392}, { -160, 1048, -528}, { -96, 1016, -608}, // 65 seconds { -104, 640, -752}, { 16, 440, ...
{ -232, 872, 296}, { -256, 816, 432}, { -144, 936, 376}, { -184, 1008, 512}, { -160, 920, 592}, { -88, 1008, 600}, { -56, 904, 656}, { -8, 800, 520}, { -80, 712, 424}, { -56, 776, 496}, { -16, 728, 568}, { -48, 712, 520}, { -104, 688, 448}, { -120, 680, 376}, ...
{ -96, 464, 456}, { -192, 544, 432}, { -184, 656, 440}, { -192, 624, 424}, // 5 seconds { -232, 712, 344}, { -256, 792, 360}, { -304, 816, 464}, { -360, 944, 592}, { -376, 992, 784}, { -296, 1000, 1040}, { -176, 928, 784}, { -104, 712, 512}, { -184, 528, 392}, ...
/* * 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...
{ const int16_t flip_boundary_from_x = display_center.x + (flip_overlap_region_width / 2); const int16_t flip_boundary_to_x = 0; const int16_t current_flip_boundary_x = interpolate_int16(distance_normalized, flip_boundary_from_x, ...
} static void prv_round_flip_transition_animation_update(GContext *ctx, Animation *animation, uint32_t distance_normalized) { // Unwrap our animation configuration from the context RoundFlipTransitionAnimationConfiguration config = { .data = animation_get...
w_info = gbitmap_get_data_row_info(framebuffer, y1.integer); output = (GColor8 *)(data_row_info.data + x); } // middle pixels while (y1.integer <= y2.integer) { // Only draw the pixel if its within the bitmap data row range if (WITHIN(x, data_row_info.min_x, data_row_info.max_x)) { prv_set_colo...
MIN(clip_box_max_x, data_row_info.max_x)
; // If x1 is further outside the clip box than the left gradient width, we need to move x1 up // to clip_box_min_x and proceed such that we don't draw the left gradient int16_t x1_distance_outside_clip_box = clip_box_min_x - x1.integer; if (x1_distance_outside_clip_box > left_aa_offset) { left_aa_offset = ...
/* * 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...
{ fake_comm_session_init(); s_setup_complete_call_count = 0; s_transport = fake_transport_create(TransportDestinationSystem, NULL, NULL); s_session = fake_transport_set_connected(s_transport, true); s_session_id = audio_endpoint_setup_transfer(prv_test_setup_complete_callback, ...
void test_audio_endpoint__setup_complete_callback_call_once(void) { ResponsivenessGrantedHandler granted_handler = fake_comm_session_get_last_responsiveness_granted_handler(); cl_assert_equal_i(s_setup_complete_call_count, 0); granted_handler(); cl_assert_equal_i(s_setup_complete_call_count, 1); gra...
ble_tasks.h" #include "stubs_pbl_malloc.h" #include "stubs_prompt.h" #include "stubs_serial.h" #include "stubs_session.h" #include "stubs_sleep.h" #include "stubs_status_bar_layer.h" #include "stubs_system_theme.h" #include "stubs_syscalls.h" #include "stubs_task_watchdog.h" #include "stubs_tick.h" #include "stubs_time...
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE))
; } void test_launcher_menu_layer__interior_app(void) { prv_render_launcher_menu_layer(LauncherMenuLayerTestApp_InteriorApp); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_launcher_menu_layer__no_icon_app_with_glance(void) { // Insert a glance with a slice for the app that doesn't hav...
le_dialog = simple_dialog_create("AlarmSnooze"); Dialog *dialog = simple_dialog_get_dialog(simple_dialog); const char *snooze_text = i18n_noop("Snooze for %d minutes"); char snooze_buf[32]; snprintf(snooze_buf, sizeof(snooze_buf), i18n_get(snooze_text, dialog), alarm_get_snooze_delay()); i18n_free(snooze_text...
{ s_alarm_popup_data->vibe_score = vibe_client_get_score(VibeClient_Alarms); }
if (!s_alarm_popup_data->vibe_score) { return; } vibe_repeat_interval_ms = vibe_score_get_duration_ms(s_alarm_popup_data->vibe_score) + vibe_score_get_repeat_delay_ms(s_alarm_popup_data->vibe_score); s_alarm_popup_data->max_vibes = DIVIDE_CEIL(VIBE_DURATION, vibe_repeat_interval_ms); #else s_alarm_...
et_table_entry_size(&font_res->md)) + (sizeof(uint32_t) * offset); } else { address = s_font_md_size[version] + (sizeof(FontHashTableEntry) * font_res->md.hash_table_size) + (prv_offset_table_entry_size(&font_res->md) * font_res->md.number_of_glyphs) + offse...
HAS_FEATURE(font_res->md.version, VERSION_FIELD_FEATURE_RLE4)
static void prv_click_config_provider(void *context) { return; } static void prv_window_appear(Window *window) { cl_check(window); cl_assert_equal_i(window->on_screen, true); s_appear_count++; cl_check(s_appear_count >= 1); } static void prv_window_disappear(Window *window) { cl_check(window); cl_assert...
(window2, true)
; cl_assert_equal_i(app_window_stack_count(), 2); cl_assert_equal_i(window1->on_screen, false); cl_assert_equal_i(window2->on_screen, true); app_window_stack_pop(true); cl_assert_equal_i(window1->on_screen, true); cl_assert_equal_i(window2->on_screen, false); app_window_stack_pop(true); cl_assert_e...
/* * 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 (rv != S_SUCCESS) { mutex_unlock(s_contacts_db.mutex); }
/* * 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...
(dstbuf, 256, "There are %.2d lights, %.2d", 4, -4)
; cl_assert_equal_s(dstbuf, "There are 04 lights, -04"); // Minimum digits output (zero digits) snprintf(dstbuf, 256, "%.0dzero%.0d", 0, 1); cl_assert_equal_s(dstbuf, "zero1"); // Minimum digits output (unspecified digits, acts as zero) snprintf(dstbuf, 256, "%.dzero%.d", 0, 1); cl_assert_equal_s(dstbuf...
.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * l...
graphics_line_draw_precise_stroked_non_aa(&ctx, START_ON_ORIGIN_RECT_NXNY, END_ON_ORIGIN_RECT_NXNY, 10)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_across_nxny_origin_layer_non_aa.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 10); graphics_line_draw_precise_stroked_non_aa(&ctx, END_ON_ORIGIN_RECT, END_ON_ORIGIN_RECT, 10); cl_check(gbitm...
ude "util/math.h" #include "util/net.h" #include "util/struct.h" typedef struct { GRect layer_frame; GRect from; GRect to; const TransformImpl *impl; void *context; int32_t normalized; uint32_t elapsed; uint32_t duration; KinoReel *from_reel; KinoReel *to_reel; GDrawCommandList *list_copy; ...
(elapsed, data->duration, ANIMATION_NORMALIZED_MAX)
); if (data->normalized == normalized) { return changed; } data->normalized = normalized; // No position setter is shorthand for always triggering a transform on any position setting bool transform_changed = true; if (data->impl->position_setter && !data->impl->position_setter(normalized, 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...
(true, rocky_global_has_event_handlers("hourchange"))
; cl_assert_equal_b(true, rocky_global_has_event_handlers("daychange")); cl_assert_equal_i(3, s_tick_timer_service_subscribe.call_count); cl_assert_equal_i(MINUTE_UNIT | HOUR_UNIT | DAY_UNIT | MONTH_UNIT | YEAR_UNIT, s_tick_timer_service_subscribe.last_call.tick_units); // register for minu...
); cl_assert_equal_i(s_sys_activity_get_metric_values.in.history_len, ACTIVITY_HISTORY_DAYS); } #define cl_assert_equal_range(a, b) \ do { \ HealthServiceTimeRange r_a = (a); \ HealthServiceTimeRange r_b = (b); \ bool success = memcmp(&r_a, &r_b, sizeof(r_a)) == 0; \ if (!success) { \ char er...
prv_calculate_time_range(now - 100, now - 200, NULL)
; cl_assert_equal_b(result, false); } void test_health__range_to_day_id_clamps_values(void) { const time_t now = rtc_get_time(); bool result; HealthServiceTimeRange range; // clamps value that goes into the future result = prv_calculate_time_range(now - 10, now + 11, &range); cl_assert_equal_b(result, t...
x34, 0x35, 0x44}}; SM128BitKey link_key_4 = {{0x40, 0x40, 0x30, 0x30, 0x30, 0x30, 0x30, 0x40, 0x40, 0x40, 0x30, 0x30, 0x30, 0x30, 0x30, 0x40}}; char name_4[BT_DEVICE_NAME_BUFFER_SIZE] = "Device 4"; uint8_t platform_bits_4 = 0x44; // Don't add the platform bits BTBondingID id_4 = ...
bt_persistent_storage_get_bt_classic_pairing_by_id(id, &addr_out, &link_key_out, name_out, &platform_bits_out)
; cl_assert(ret); // And delete is again bt_persistent_storage_delete_bt_classic_pairing_by_id(id); cl_assert_equal_i(fake_shared_prf_storage_get_bt_classic_delete_count(), 4); // Try to read it back ret = bt_persistent_storage_get_bt_classic_pairing_by_id(id, &addr_out, &link_key_out, ...
he License. */ #include "fw_copy.h" #include "drivers/crc.h" #include "drivers/dbgserial.h" #include "drivers/display.h" #include "drivers/flash/s29vs.h" #include "drivers/system_flash.h" #include "firmware.h" #include "flash_region.h" #include "system/bootbits.h" #include "system/firmware_storage.h" #include "syste...
boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_TWO)
; boot_bit_clear(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_ONE); boot_bit_clear(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_TWO); UpdateFirmwareResult result = update_fw(FLASH_REGION_FIRMWARE_SCRATCH_BEGIN); switch (result) { case UPDATE_FW_SUCCESS: break; case UPDATE_FW_ERROR_MICRO_FLASH_UNTOUCHED: // Our firmwar...
l_point_request. // If this function is called we have requested a ds_notification BTErrno gatt_client_op_write(BLECharacteristic characteristic, const uint8_t *buffer, size_t length, GAPLEClient client) { cl_assert_equal_i(charac...
(memory_with_attribute_id_at_end_p2)
, (uint8_t*) memory_with_attribute_id_at_end_p2); s_num_ds_notifications_received += 2; } else if (uid == invalid_dict_uid) { prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_invalid_attribute_length), (uint8_t*) s_invalid_attribute_length); s_num_ds_notifications_received++; } else if (uid == load...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(prv_byte_reverse(0b11110000) == 0b00001111)
; cl_assert(prv_byte_reverse(0b10100101) == 0b10100101); } // Each of the following tests depend on a PNG being converted into 1-bit PBI, // as well as loading in a b&w PNG, which internally will be converted to a // 1-bit palettized image. // The palettized PNG loaded in is to be used as the expected value #define...
/* * 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->layer, &title->layer)
; app_window_stack_push(window, true /* Animated */); // Enter the bluetooth test mode if (!bt_test_bt_sig_rf_test_mode()) { PBL_LOG(LOG_LEVEL_WARNING, "Failed to enter bt_sig_rf!"); } } static void s_main(void) { prv_handle_init(); app_event_loop(); // Bring us out of test mode. Do this on the k...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return 0; }
const uint16_t current_worker_app_index = app_menu_data_source_get_index_of_app_with_install_id(data->data_source, worker_id); if (current_worker_app_index == MENU_INDEX_NOT_FOUND) { return 0; } else { return current_worker_app_index + 1; } } // Gets the current chosen row index; i.e., the row...
alyticsClient_App); analytics_inc(ANALYTICS_DEVICE_METRIC_BACKLIGHT_ON_COUNT, AnalyticsClient_System); } if (new_brightness <= HALF_BRIGHTNESS && s_current_brightness > HALF_BRIGHTNESS) { // getting dimmer and have now transitioned past half brightness analytics_stopwatch_stop(ANALYTICS_APP_METRIC_BACK...
mutex_unlock(s_mutex)
nd_active = true; alerts_set_dnd_mask(AlertMaskPhoneCalls); alerts_set_mask(AlertMaskAllOn); cl_assert(alerts_should_notify_for_type(AlertPhoneCall)); cl_assert(alerts_should_vibrate_for_type(AlertPhoneCall)); alerts_set_notification_vibe_timestamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_...
cl_assert(alerts_should_notify_for_type(AlertPhoneCall))
; cl_assert(alerts_should_vibrate_for_type(AlertPhoneCall)); alerts_set_notification_vibe_timestamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS); cl_assert(alerts_should_enable_backlight_for_type(AlertPhoneCall)); cl_assert(alerts_should_notify_for_type(AlertMobile)); cl_assert(...
savings, update modifier with current dst char // ie. P*T is PDT for daylight savings, PST for non-daylight savings char *tz_zone_dst_char = memchr(out_buf, '*', TZ_LEN); if (tz_zone_dst_char) { *tz_zone_dst_char = (time_get_isdst(utc_time)) ? 'D' : 'S'; // Workaround for UK Winter, Greenwich Mean Time; U...
localtime_r(&ts, &tm)
; tm.tm_hour = 0; tm.tm_min = 0; tm.tm_sec = 0; return mktime(&tm); } bool time_util_range_spans_day(time_t start, time_t end, time_t start_of_day) { return (start <= start_of_day && end >= (start_of_day + SECONDS_PER_DAY)); } time_t time_utc_to_local_using_offset(time_t utc_time, int16_t utc_offset_min) { ...
tted(&ctx, GPoint(10, 10), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(5, 15), 10); // cross - odd vert, even horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(41, 11), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(36, 16), 10); // T facing up graphics_draw_vertical_line_dotted(&ct...
graphics_draw_line(ctx, GPoint(70,70), GPoint(70,70))
; graphics_context_set_antialiased(ctx, true); graphics_context_set_stroke_width(ctx, 4); graphics_draw_line(ctx, GPoint(80,80), GPoint(80,80)); graphics_context_set_antialiased(ctx, false); graphics_context_set_stroke_width(ctx, 5); graphics_draw_line(ctx, GPoint(90,90), GPoint(90,90)); graphics_conte...
, &radius); cl_assert_gpoint_precise(center, 5, 5); cl_assert_fixedS16_3(radius, 4); r = GRect(2, 2, 8, 8); grect_polar_calc_values(&r, mode, &center, &radius); cl_assert_gpoint_precise(center, 5.5, 5.5); cl_assert_fixedS16_3(radius, 3.5); } void test_graphics_circle__grect_polar_calc_values_mode(void) { ...
(-TRIG_MAX_ANGLE * 2)
, -720); cl_assert_equal_i(TRIGANGLE_TO_DEG(TRIG_MAX_ANGLE), 360); cl_assert_equal_i(TRIGANGLE_TO_DEG(-TRIG_MAX_ANGLE), -360); cl_assert_equal_i(TRIGANGLE_TO_DEG(TRIG_PI / 2), 90); cl_assert_equal_i(TRIGANGLE_TO_DEG(-TRIG_PI / 2), -90); cl_assert_equal_i(TRIGANGLE_TO_DEG(TRIG_MAX_ANGLE / 2), 180); cl_ass...
/* * 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...
graphics_fill_rect( ctx, &(GRect) { { x_range_begin.integer + 1, y }, { x_range_end.integer - x_range_begin.integer - 1, 1 } })
aller_messages(void) { s_valid_session = &s_session; // This length excludes the sizeof(PebbleProtocolHeader). size_t bytes_free = comm_session_send_buffer_get_max_payload_length(&s_session); bytes_free += sizeof(PebbleProtocolHeader); const int num_sbs = 1 + (bytes_free / (sizeof(PebbleProtocolHeader) + 1 ...
(write_sb)
; // Set a yield callback that gives the semph in time but closes the session: SemaphoreHandle_t write_semph = comm_session_send_buffer_write_semaphore(); fake_queue_set_yield_callback(write_semph, prv_session_closed_yield_cb); // Try to begin writing again, requesting only one byte: write_sb = comm_session...
yer *menu_layer, AppData *data) { (void)data; (void)menu_layer; return 1; } static uint16_t get_num_rows_callback(struct MenuLayer *menu_layer, uint16_t section_index, AppData *data) { (void)data; (void)menu_layer; switch (section_index) { default: case 0: return 3; } } static int16_t get_header...
PBL_LOG(LOG_LEVEL_DEBUG, "- writing...")
; persist_write_int(COUNT_PKEY, 10); } } static void handle_deinit() { AppData *data = app_state_get_user_data(); menu_layer_deinit(&data->menu_layer); app_free(data); } static void s_main() { handle_init(); app_event_loop(); handle_deinit(); } const PebbleProcessMd* persist_app_get_info() { st...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_ASSERTN(BOARD_CONFIG_MCO1.output_enabled)
; if (on) { gpio_af_init( &BOARD_CONFIG_MCO1.af_cfg, GPIO_OType_PP, GPIO_Speed_2MHz, GPIO_PuPd_NOPULL); // LSE is 32kHz, we want 32kHz for our external clock and is used by: // - The cc2564 bluetooth module // - Snowy / Spalding display VCOM RCC_MCO1Config(RCC_MCO1Source_LSE, RCC_MCO1Div...
#if CAPABILITY_HAS_MICROPHONE RXMenuIdx_Microphone, #endif RXMenuIdx_RunStop, RXMenuIdx_Count, }; static void prv_txrx_menu_update(AppData *data) { layer_mark_dirty(menu_layer_get_layer(&data->txrx_menu_layer)); } static uint16_t prv_menu_get_num_rows(MenuLayer *menu_layer, uint16_t section, void *context) { ...
{ const uint16_t row = prv_compensated_tx_menu_row_idx(index, data); if (prv_test_is_running(data) && row != TXMenuIdx_RunStop) { // Can't change params while running return; } switch (row) { case TXMenuIdx_Channel: prv_txrx_number_window(39, &data->channel, "Channel", data);...
else if (data->current_test == BTLETestType_RX) { if (prv_test_is_running(data) && index->row != RXMenuIdx_RunStop) { // Can't change params while running return; } switch (index->row) { case RXMenuIdx_Channel: prv_txrx_number_window(39, &data->channel, "Channel", data); ...
_container_frame, &max_text_container_frame, GAlignCenter, clips); grect_align(&title_frame, &text_container_frame, GAlignTop, clips); grect_align(&instruction_frame, &text_container_frame, GAlignBottom, clips); const int16_t title_vertical_adjust_px = -fonts_get_font_cap_offset(title_font); title_frame.origin...
(&data->window, true /* animated */)
; return; } data->state++; layer_mark_dirty(&data->window.layer); } static void prv_back_click_handler(ClickRecognizerRef recognizer, void *context) { DisplayCalibrationData *data = context; if (data->state == INITIAL_STATE) { // exit the calibration window without changing the prefs window_stac...
ap_create_blank(s180, GBitmapFormat8BitCircular); cl_assert(NULL != bmp); cl_assert(g_gbitmap_spalding_data_row_infos == bmp->data_row_infos); #endif } void test_gbitmap_formats__create_blank_with_palette(void) { const GSize s10 = GSize(10, 10); const GSize s180 = GSize(180, 180); GBitmap *bmp; GColor8 *p ...
PBL_IF_RECT_ELSE(0, DISPLAY_FRAMEBUFFER_BYTES)
; cl_assert_equal_i(expected, prv_gbitmap_size_for_data(GSize(180, 180), GBitmapFormat8BitCircular)); cl_assert_equal_i(expected, prv_gbitmap_size_for_data(GSize(DISP_COLS, DISP_ROWS), GBitmapFormat8BitCircular)); }
/* * 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_scrollable_metrics; i++) { active_window->scrollable_metrics[active_window->num_scrollable_metrics++] = metrics[i]; }
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("IN 12 H", time_buf); // June 12th 2015, 00:30:00 (T-11:30:00) rtc_set_time(event_time - (12 * SECONDS_PER_HOUR) + (30 * SECONDS_PER_MINUTE)); clock_get_until_time_capitalized(time_buf, sizeof(time_bu...
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS)
; cl_assert_equal_s("59 MIN AGO", time_buf); // June 9th 2015, 12:59:30 (T+00:59:30) rtc_set_time(event_time + (59 * SECONDS_PER_MINUTE) + 30); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("59 MIN AGO", time_buf); // June 9th 2015, 12:59:58 ...
install_date); } //! Comparator for EvictListNode static int evict_node_comparator(void *a, void *b) { EvictListNode *a_node = (EvictListNode *)a; EvictListNode *b_node = (EvictListNode *)b; if (b_node->priority > a_node->priority) { return 1; } else if (b_node->priority < a_node->priority) { return -...
settings_file_open(&file, APP_CACHE_FILE_NAME, APP_CACHE_MAX_SIZE)
; if (rv != S_SUCCESS) { goto unlock; } AppCacheEntry entry = { 0 }; rv = settings_file_get(&file, (uint8_t *)&app_id, sizeof(AppInstallId), (uint8_t *)&entry, sizeof(AppCacheEntry)); if (rv == S_SUCCESS) { entry.last_launch = rtc_get_time(); entry.launch_count += 1; ...
em/passert.h" #include "util/math.h" #include "util/trig.h" #include <inttypes.h> #include <stdio.h> #include <string.h> #if CAPABILITY_HAS_VIBE_SCORES #include "services/normal/vibes/vibe_client.h" #include "services/normal/vibes/vibe_score.h" #endif #define NOTIFICATION_PRIORITY (ModalPriorityNotification) #defin...
window_stack_remove(&data->window, true /* animated */)
; } static int prv_reminders_on_top_comparator(void *a, void *b) { NotifList *notif_a = (NotifList*) a; NotifList *notif_b = (NotifList*) b; NotificationType type_a = notif_a->notif.type; NotificationType type_b = notif_b->notif.type; // Reminders come first, then everything else. More recent reminders shou...
if (upng == NULL) { goto cleanup; } bitmap_sequence->png_decoder_data.upng = upng; upng_load_bytes(upng, frame_data_buffer, frame_bytes); upng_error upng_state = upng_decode_metadata(upng); if (upng_state != UPNG_EOK) { APP_LOG(APP_LOG_LEVEL_ERROR, (upng_state == UPNG_ENOMEM) ? APNG_MEMO...
if (!bitmap_sequence->header_loaded || bitmap == NULL || bitmap->addr == NULL || bitmap_sequence->bitmap_size.w > (bitmap->bounds.size.w) || bitmap_sequence->bitmap_size.h > (bitmap->bounds.size.h)) { goto cleanup; }
if (!((bitmap_format == GBitmapFormat1Bit) || (bitmap_format == GBitmapFormat8Bit) || (bitmap_format == GBitmapFormat8BitCircular))) { APP_LOG(APP_LOG_LEVEL_ERROR, "Invalid destination bitmap format for APNG"); goto cleanup; } // Update current time elapsed using the previous frames cu...
start_third_party(); // Simulate a crash app_manager_get_task_context()->safe_to_kill = true; app_manager_close_current_app(false /* gracefully */); cl_assert(app_manager_get_current_app_md() == (PebbleProcessMd*) &s_root_app); } void test_app_manager__start_borked_app(void) { test_app_manager__start_first...
cl_assert_equal_i(app_exit_reason_get(), default_exit_reason)
; }
est_utf8__decode_malformed_test_string(void) { bool success = false; utf8_get_bounds(&success, s_malformed_test_string); cl_assert(!success); utf8_t* malformed_test_string_utf8 = (utf8_t*)s_malformed_test_string; for (int i = 0; i < (UTF8_TEST_MALFORMED_CODEPOINT_INDEX - 1); i++) { uint32_t decoded_code...
(13, utf8_get_size_truncate("Hello World! \xF0\x9F\x98\x84", 16))
; cl_assert_passert(utf8_get_size_truncate("Hi", 0)); } void test_utf8__truncate_with_ellipsis(void) { // basic smoke test char *output_buffer = malloc(6); size_t trunc_size = utf8_truncate_with_ellipsis("WWWWWWWWWWWWWWW", output_buffer, 6); cl_assert_equal_s(output_buffer, "WW\xe2\x80\xa6"); cl_assert_eq...
ORIGIN_DRAW_RECT_NO_CLIP, 3); // 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_r3_aa_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); #endif setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, ...
(&ctx.dest_bitmap, "draw_round_rect_origin_r1_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, 2); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r2_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_R...
if (buf_ptr && *buf_ptr) { esb = (EventServiceBuffer *)list_find((ListNode *)s_event_service_buffers, prv_buffer_find, *buf_ptr); }
return esb; } void* event_service_claim_buffer(PebbleEvent *e) { EventServiceBuffer *esb = prv_get_esb_for_event(e); if (esb) { if (esb->intents_pending & CLAIMED_BIT) { // For now only 1 claim at a time is needed, so lets keep things simple and just support that PBL_LOG(LOG_LEVEL_WARNING, "Buff...
--------------------------------------------------------- // This is designed to be called from the task itself, in privilege mode, after it exits. It is called from // app_task_exit for app tasks and worker_task_exit from worker tasks NORETURN process_manager_task_exit(void) { PebbleTask task = pebble_task_get_curre...
(context->app_md)
; // Clear the old app metadata context->app_md = 0; context->install_id = INSTALL_ID_INVALID; if (context->to_process_event_queue && pdFAIL == event_queue_cleanup_and_reset(context->to_process_event_queue)) { PBL_LOG(LOG_LEVEL_ERROR, "The to processs queue could not be reset!"); } context->to_p...
if (item_layer->animation) { property_animation_init(item_layer->animation, &implementation, item_layer, NULL, &new_offset); } else { item_layer->animation = property_animation_create(&implementation, item_layer, NULL, &new_offset); PBL_ASSERTN(item_layer->animation); animation_set_auto_destr...
timeline_animate_back_from_card()
; } static void timeline_item_layer_click_config_provider(void *context) { window_single_repeating_click_subscribe(BUTTON_ID_UP, 100, prv_handle_up_click); window_single_repeating_click_subscribe(BUTTON_ID_DOWN, 100, prv_handle_down_click); window_single_click_subscribe(BUTTON_ID_SELECT, prv_handle_select_click)...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
recognizer_create_with_data(&s_test_impl, &s_test_impl_data, sizeof(s_test_impl_data), NULL, NULL)
); s_test_impl.handle_touch_event = NULL; cl_assert_passert(recognizer_create_with_data(&s_test_impl, &s_test_impl_data, sizeof(s_test_impl_data), dummy, NULL)); s_test_impl.handle_touch_event = dummy; s_test_impl.re...
s prv_interrupts_enable(dev, true); // We are now fully enabled dev->state->enabled_state = HRMEnabledState_Enabled; // Enable the watchdog prv_enable_watchdog(dev); goto done; failed: prv_disable(dev); done: mutex_unlock(dev->state->lock); } static void prv_enable_timer_cb(void *context) { syste...
(LOG_LEVEL_DEBUG, "AS7000 firmware is up to date.")
/* * 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...
mfg_info_get_disp_offsets()
.x, mfg_info_get_disp_offsets().y); } void command_disp_offset_write(const char* offset_x_str, const char* offset_y_str) { char *nonnumeric_x, *nonnumeric_y; int8_t offset_x = strtol(offset_x_str, &nonnumeric_x, 10); if (*nonnumeric_x) { prompt_send_response("Invalid x offset"); ...
t64_t)values[oldest_day_idx] * range->seconds_first_day) / SECONDS_PER_DAY); } } // ---------------------------------------------------------------------------------------------- static HealthValue prv_compute_aggregate_using_daily_totals( HealthServiceState *state, HealthMetric metric, time_t time_start, time_t ...
case HealthAggregationMax: result = which_stats->max; break; } // Scale result by the actual amount of requested time if asked for a sum if (aggregation == HealthAggregationSum) { result = result * (time_end - time_start) / SECONDS_PER_DAY; } return result; }
// ---------------------------------------------------------------------------------------------- // Compute the aggregated value of the given metric using values from minute history static HealthValue prv_compute_aggregate_using_minute_history( HealthServiceState *state, HealthMetric metric, time_t time_start, tim...
utLayout_StaticAndScrollable, WorkoutLayout_TwoStaticAndScrollable, } WorkoutLayout; typedef struct WorkoutActiveWindow { Window window; ActionBarLayer action_bar; StatusBarLayer status_layer; Layer base_layer; Layer top_metric_layer; Layer middle_metric_layer; Layer scrollable_metric_layer; WorkoutD...
("SPEED (MPH)")
, i18n_noop("SPEED (KM/H)")); #endif case WorkoutMetricType_Distance: #if PBL_RECT /// Distance Label return i18n_noop("DISTANCE"); #else /// Distance Label with units return active_window->workout_controller->get_distance_s...
ss so we'll try again later return false; } else if ((result == SmartstrapResultOk) && (smartstrap_fsm_state_get() != SmartstrapStateReadReady)) { prv_set_attribute_state(attr, SmartstrapAttributeStateRequestInProgress); if (attr->request_type == SmartstrapRequestTypeWrite) { // This is...
PBL_LOG(LOG_LEVEL_ERROR, "Failed to allocate attribute")
; return false; } *new_attr = (SmartstrapAttributeInternal) { .service_id = service_id, .attribute_id = attribute_id, .mbuf = MBUF_EMPTY }; list_init(&new_attr->list_node); mbuf_set_data(&new_attr->mbuf, buffer, buffer_length); // add the node to our list mutex_lock(s_attr_list_lock); ...
ess_management/app_storage.h" #include "system/logging.h" #include "system/passert.h" #include "util/legacy_checksum.h" #include <string.h> //! This comes from the generated pebble.auto.c with all the exported functions in it. extern const void* const g_pbl_system_tbl[]; // ------------------------------------------...
PBL_LOG(LOG_LEVEL_ERROR, "Process open failed for process %s, fd = %d", process_name, fd)
; return (false); } if (pfs_read(fd, destination->start, load_size) != (int)load_size) { PBL_LOG(LOG_LEVEL_ERROR, "Process read failed for process %s, fd = %d", process_name, fd); pfs_close(fd); return (false); } pfs_close(fd); return prv_intialize_sdk_process(task, &info, destination); } /...
h__erase_sector_0(void) { cl_assert(system_flash_erase(FLASH_BASE, 16 KiB, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(0, 0), erased_sector); cl_assert(flash_locked); } void test_system_flash__erase_16KB_sectors(void) { cl_assert(system_flash_erase(FLASH_BASE, 48 KiB, NULL, NULL)); cl_assert_equal_i(BITS_BE...
fprintf(stderr, "%s", str)
; } extern void dbgserial_print_hex(uint32_t num) { fprintf(stderr, "0x%.08x", num); } extern void dbgserial_putstr(char *str) { fprintf(stderr, "%s\n", str); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return NULL; }
const uint8_t *mapped_data = (app_num == SYSTEM_APP) ? sys_resource_read_only_bytes(SYSTEM_APP, resource_id, NULL) : NULL; uint8_t *result = NULL; if (mapped_data) { applib_resource_track_mmapped(mapped_data); result = (uint8_t *)(mapped_data + offset); } else { //...
/* * 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...
GColorARGB8FromHEX(0xffebcd)
}, {"blueviolet", GColorARGB8FromHEX(0x8a2be2)}, {"brown", GColorARGB8FromHEX(0xa52a2a)}, {"burlywood", GColorARGB8FromHEX(0xdeb887)}, // {"cadetblue", GColorARGBFromHEX(0x5f9ea0)}, inconsistent with Pebble color {"chartreuse", GColorARGB8FromHEX(0x7fff00)}, {"chocolate", GColorARGB8FromHEX(0xd2691e)}, {"c...
_id, void *context) { prv_check_is_in_click_config_provider(window_manager_get_top_window(), "context"); ClickManager *mgr = prv_get_current_click_manager(); ClickConfig *cfg = &mgr->recognizers[button_id].config; cfg->context = context; } void window_single_click_subscribe(ButtonId button_id, ClickHandler ha...
(window, &handlers)
; } void window_set_user_data(Window *window, void *data) { window->user_data = data; } void* window_get_user_data(const Window *window) { return window->user_data; } struct Layer* window_get_root_layer(const Window *window) { return &((Window *)window)->layer; } static void prv_window_load(Window *window) { ...
ns_ancs_notifications_count(), 1); } void test_ancs__attribute_at_end(void) { prv_send_notification((uint8_t *)&memory_with_attribute_id_at_end.attribute_data); cl_assert_equal_i(s_num_requested_notif_attributes, 1 ); cl_assert_equal_i(s_num_ds_notifications_received, 2); } void test_ancs__app_name_cache(void)...
(sizeof(ns_notification), (uint8_t*) &ns_notification)
; cl_assert_equal_i(fake_kernel_services_notifications_acted_upon_count(), 1); } void test_ancs__notification_parsing(void) { // Test a recognized app with a duplicated title // Run multiple times to make sure we're not corrupting the app name cache for (int i = 0; i < 4; ++i) { prv_send_notification((uint...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_ASSERTN(prv_is_session_task())
GPoint(45, 10), SW_ODD)); setup_test(&context, false, SW_ODD, GColorBlack, GColorBlack, false); graphics_draw_rect(&context, &GRect(10, 20, 40, 10)); ASSERT_CALLED(prv_draw_rect_stroked(&context, &GRect(10, 20, 40, 10), SW_ODD)); setup_test(&context, false, SW_ODD, GColorBlack, GColorBlack, false); graphic...
GRect(10, 20, 40, 10)
); #if PBL_COLOR ASSERT_CALLED(prv_draw_rect_aa_stroked(&context, &GRect(10, 20, 40, 10), SW_ODD)); #else ASSERT_CALLED(prv_draw_rect_stroked(&context, &GRect(10, 20, 40, 10), SW_ODD)); #endif setup_test(&context, true, SW_ODD, GColorBlack, GColorBlack, false); graphics_draw_circle(&context, GPoint(50, 50), 10...
cl_assert_equal_p(dummy_config.layer->update_proc, direction_data->original_update_proc)
; cl_assert_equal_p(direction_data->original_update_proc, s_content_indicator_dummy_layer_update_proc); } void test_content_indicator__creating_for_scroll_layer(void) { ScrollLayer scroll_layer; ContentIndicator *content_indicator = content_indicator_get_or_create_for_scroll_layer( &scrol...
d_sender_version: major: %"PRIu32", minor: %"PRIu32", patch: %s", s_parsed_msg.payload_sender_v_major, s_parsed_msg.payload_sender_v_minor, s_parsed_msg.payload_sender_version_patch); LOG("payload_send_time: %"PRIu32"", s_parsed_msg.payload_send_time); LOG("MeasurementSet:"); char uuid_str[UUID_STRI...
(" Activity Type: %d, Start Reason: %d", session->type.type.internal_type, session->start_reason)
; // TODO: Add more detailed logging } } } return &s_parsed_msg; } // --------------------------------------------------------------------------------------------- static void prv_assert_msg_equal(TestPLParsedMsg *a, TestPLParsedMsg *b) { // Payload Specific cl_assert_equal_s(a->payload_send...
32_t key, const uint16_t value) { return dict_write_data_internal(iter, key, (const uint8_t * const) &value, sizeof(value), TUPLE_UINT); } DictionaryResult dict_write_uint32(DictionaryIterator *iter, const uint32_t key, const uint32_t value) { return dict_write_data_internal(iter, key, (const uint8_t * const) &val...
dict_calc_buffer_size_from_tuplets(tuplets, tuplets_count)
; } static DictionaryResult dict_write_tuple(DictionaryIterator* iter, Tuple* tuple) { return dict_write_data_internal(iter, tuple->key, (uint8_t*)tuple->value, tuple->length, tuple->type); } DictionaryResult dict_write_tuplet(DictionaryIterator *iter, const Tuplet * const tuple...
/* * 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->layer.bounds.size.w, max_size.h + vert_scroll_padding)
); scroll_layer_add_child(scroll_layer, &text->layer); InverterLayer *inverter = &data->inverter; inverter_layer_init(inverter, &GRect(15, 15, 30, 30)); scroll_layer_add_child(scroll_layer, &inverter->layer); layer_add_child(&window->layer, &scroll_layer->layer); } static void push_window(ScrollAppData *d...
erase if (read_buffer != 0xFFFF) { PBL_LOG(LOG_LEVEL_DEBUG, "ERROR: Did not successfully erase the sector"); return FLASH_TEST_ERR_ERASE; } // Read and compare data that was written status = prv_write_read_verify_halfword(addr_region, data_buffer, data_buffer, true); if (status != 0) { ...
{ // Write default data pattern to address status = prv_write_read_verify_byte(test_addr, data_pattern, data_pattern, display_logs); VERIFY_TEST_STATUS(status); }
} if (!skip_base_addr) { test_addr = base_addr; // Read initial value read_buffer = 0; flash_read_bytes((uint8_t*) &read_buffer, test_addr, sizeof(read_buffer)); if (display_logs) { PBL_LOG(LOG_LEVEL_DEBUG, ">> Reading Addr 0x%"PRIx32" value is 0x%"PRIx8, test_addr, read_b...
pplib/app.h" #include "applib/graphics/gdraw_command_image.h" #include "applib/graphics/gdraw_command_transforms.h" #include "applib/ui/app_window_stack.h" #include "applib/ui/dialogs/dialog.h" #include "applib/ui/dialogs/simple_dialog.h" #include "applib/ui/dialogs/actionable_dialog.h" #include "applib/ui/dialogs/expa...
(dialog, "The text has changed!")
; layer_mark_dirty(&dialog->text_layer.layer); } static void prv_custom_action_bar_config_provider(void *context) { window_single_click_subscribe(BUTTON_ID_UP, prv_custom_action_bar_click_up); } static void prv_show_custom_actionable_dialog(DialogsData *data) { ActionableDialog *actionable_dialog = actionable_d...
/* * 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...
{ TimerID timer_id = battery_monitor_get_standby_timer_id(); return timer_id != TIMER_INVALID_ID && stub_new_timer_is_scheduled(timer_id); }
static uint32_t standby_timer_get_timeout() { TimerID timer_id = battery_monitor_get_standby_timer_id(); cl_assert(timer_id != TIMER_INVALID_ID); cl_assert(stub_new_timer_is_scheduled(timer_id)); return stub_new_timer_timeout(timer_id); } void enter_standby(RebootReasonCode reason) { s_entered_standby = t...
/ Open the app and close the app. Make sure the HR monitor turns off instantly void test_workout_service__app_open_close_no_workout(void) { // Put some time into the clock prv_inc_time(1 * SECONDS_PER_MINUTE); // Open the app, confirm that we are now subscribed with no end in sight workout_service_frontend_ope...
(workout_service_stop_workout())
; // Wait 20 minutes. By this time, as soon as we leave the app, we should turn off the HR device. prv_inc_time(20 * SECONDS_PER_MINUTE); workout_service_frontend_closed(); cl_assert_equal_b(s_hrm_subscribed, false); cl_assert_equal_i(s_hrm_expiration, 0); } // ---------------------------------------------...