prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
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 "flash_region/flash_region.h" #include "syscall/syscall.h" ...
(wakeup_entry_v1.repeat_hours_missed, 0)
; cl_assert(!wakeup_entry_v1.repeating); cl_assert(wakeup_entry_v1.notify_if_missed); uuid_equal(&wakeup_entry_v1.uuid, &app_uuid); close_settings_file(&file); // Migrate the timezone and check that the new entry is correct and the second version // of a Wakeup Entry wakeup_init(); WakeupEntryV2 wake...
size_t size) { const size_t attr_list_size = size - sizeof(VoiceSessionResultMsg) + sizeof(GenericAttributeList); const bool app_initiated = (msg->flags.app_initiated == 1); Uuid *app_uuid = NULL; if (!prv_handle_result_common(msg->result, app_initiated, msg->session_id, &msg->...
(msg, size)
; } else { PBL_LOG(LOG_LEVEL_WARNING, "Invalid size for dictation result message %zu", size); } break; } default: // Ignore invalid message ID PBL_LOG(LOG_LEVEL_WARNING, "Invalid message ID"); break; } } #else void voice_endpoint_protocol_msg_callback(CommSession *...
test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornersBottom); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_aa_bottom.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx,...
prv_clamp_corner_radius(GSize(10, 10), GCornersAll, 4)
, 4); } #define BOX_SIZE 10 #define CLIP_RECT_DRAW_BOX GRect(10, 10, 140, 30) #define CLIP_RECT_CLIP_BOX GRect(10, 10, 120, 2*BOX_SIZE + 4) #define CLIP_RECT_RECT_BOX GRect(0, 0, BOX_SIZE, BOX_SIZE) #define CLIP_OFFSET 40 // yoffset if used to allow for multiple test cases to be drawn and tested on the same test image...
ration_timer = evented_timer_register( 1000, true /* repeating */, prv_update_call_time, NULL); // Update call time immediately prv_update_call_time(NULL); } static void prv_stop_call_duration_timer(void) { evented_timer_cancel(s_phone_ui_data->call_duration_timer); s_phone_ui_data->call_duration_timer ...
prv_stop_ringing()
; phone_call_decline(); prv_stop_call_duration_timer(); prv_set_icon_resource(TIMELINE_RESOURCE_DISMISSED_PHONE_CALL); prv_set_window_color(DECLINE_COLOR, true); // This must be called before prv_set_status_text, otherwise the text will not be centered prv_action_bar_setup(PhoneCallActions_None); prv_se...
clips(Layer *layer, bool clips) { if (clips == layer->clips) { return; } layer->clips = clips; layer_mark_dirty(layer); } bool layer_get_clips(const Layer *layer) { return layer->clips; } void* layer_get_data(const Layer *layer) { if (!layer->has_data) { PBL_LOG(LOG_LEVEL_ERROR, "Layer was not all...
(recognizer, &layer->recognizer_list)
; recognizer_manager_deregister_recognizer(window_get_recognizer_manager(layer_get_window(layer)), recognizer); #endif } RecognizerList *layer_get_recognizer_list(const Layer *layer) { #if CAPABILITY_HAS_TOUCHSCREEN if (!layer) { return NULL; } return (RecognizerL...
/* * 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 (!cond(font_key)) { do_stuff(font_key, 5); }
i18n_free_all(data)
; task_free((void *)root_level->items[DetailMenuItemIndexSnooze].next_level); task_free((void *)root_level); task_free(data); data = NULL; } void alarm_detail_window_push(AlarmId alarm_id, AlarmInfo *alarm_info, AlarmEditorCompleteCallback alarm_editor_callback, ...
andler) { // Shouldn't ever happen, but better not PBL_ASSERTN on app task PBL_LOG(LOG_LEVEL_ERROR, "No AppInbox message handler!"); return; } if (!info.num_success && !info.num_failed) { // Shouldn't ever happen, but better not PBL_ASSERTN on app task PBL_LOG(LOG_LEVEL_ERROR, "Got callback, but...
prv_get_space_remaining(inbox)
; if (required_free_length > space_remaining) { PBL_LOG(LOG_LEVEL_ERROR, "Dropping data, not enough space %"PRIu32" vs %"PRIu32, (uint32_t)required_free_length, (uint32_t)space_remaining); return false; } return true; } static void prv_send_event_if_needed(AppInboxNode *inbox) { if (!inbox ...
atorCallback)&prv_iter_next, NULL, &iter_state); while (iter_next(&iter)) { uint8_t status = iter_state.header.common.status; if (!(status & TimelineItemStatusDeleted)) { // Mark for deletion prv_set_header_status(&iter_state.header, TimelineItemStatusDeleted, fd); size_available += sizeof(S...
prv_compress(size_needed, &fd)
) { // Notification storage compression failed. Clear notifications storage goto reset_storage; } } pfs_seek(fd, s_write_offset, FSeekSet); int result = prv_write_notification(notification, &header, fd); if (result < 0) { // [AS] TODO: Write failure: reset storage, compression or reset wat...
.argb = (s_color_table[color_index] | ALPHA_100)}; if (compare && gcolor_equal(color, compare_color)) { color_index_match = color_index - (row * ROW_LENGTH); height_offset = row * (COLOR_BAR_HEIGHT + 4); } GRect box = GRect(origin.x + (4 * (color_index - (row * ROW_LENGTH))), ...
GRect(92, 90 - 16, 62, 16)
/* * 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...
{ 0, 0, -896}, { 8, -40, -864}, { 8, 56, -888}, { 16, 40, -792}, { -120, 408, -1016}, { 16, 424, -784}, { -352, 648, -640}, { -368, 968, -352}, { -368, 448, 40}, { -472, 1256, -80}, { -520, 896, -160}, { -520, 448, 168}, { -640, 680, 72}, { -648, 824, -72}, { ...
{ -520, 384, -280}, { -848, 248, 128}, // 5 seconds { -1024, 408, -104}, { -1000, 320, -144}, { -1696, 576, -120}, { -1280, 296, -112}, { -1008, 496, -352}, { -1072, 352, -192}, { -696, 96, -144}, { -312, 392, -480}, { -520, 216, -344}, { -576, 280, -408}, { -784...
kew our results __disable_irq(); char buf[80]; // test short delays because we should really be using psleep() for longer stalls! for (uint32_t i = 1; i <= 1000; i += 2) { profiler_start(); delay_us(i); profiler_stop(); uint32_t duration_us = profiler_get_total_duration(true); // make sure...
{ bt_driver_send_sleep_test_cmd(true); psleep(9); }
if (count >= s_num_sleep_iters) { bt_driver_send_sleep_test_cmd(false); prompt_send_response("100 % - PASS"); new_timer_delete(s_sleep_test_timer); prompt_command_finish(); } else { char buf[80]; prompt_send_response_fmt(buf, sizeof(buf), "%d %%", (int)((count * 100) / s_num_sleep_iters));...
een_presses_ms is NULL then default to 0 milliseconds // Otherwise convert the char string to an integer; error if the converted value is negative uint32_t delay_between_presses_timeout_ms; if (!prv_convert_and_validate_timeout_value(delay_between_presses_ms, 0, &dela...
(buffer, sizeof(buffer), "%c %s %s:%d> %s", pbl_log_get_level_char(message->log_level), time_t_to_string(time_buffer, htonl(message->timestamp)), message->filename, (int)htons(message->line_number), ...
; return true; } static void prv_serial_dump_completed_callback(bool success) { prompt_command_finish(); } void command_log_dump_current(void) { flash_dump_log_file(0, prv_serial_dump_chunk_callback, prv_serial_dump_completed_callback); prompt_command_continues_after_returning(); } void command_log_dump_last...
(s_composite_tests); i++) { const CompositeTest *test_data = &s_composite_tests[i]; // Skip invalid GBitmapFormat and GCompOp combinations if (!prv_gbitmap_format_and_compositing_mode_combo_is_valid( test_data->expected_test_image_bitmap_format, compositing_mode)) { break; } framebuffe...
{ prv_offset_layer_test(GPoint(25, 0)); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); }
void test_graphics_draw_bitmap__offset_layer_across_nx(void) { prv_offset_layer_test(GPoint(-25, 0)); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_graphics_draw_bitmap__offset_layer_across_y(void) { prv_offset_layer_test(GPoint(0, 40)); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, ...
n); prv_unlock(); // Send the footer spi_transfer_data tx_footer_transfer = { .wbuf = &tx_footer, .length = sizeof(tx_footer), }; prv_do_blocking_spi_transfer(dev, &tx_footer_transfer); HOST_TRANSPORT_DEBUG_LOG("Sent %u bytes.", tx_len); } else { HOST_TRANSPORT_DEBUG_LOG("No...
{ PBL_ASSERTN(length < HOST_TRANSPORT_CTLR_TX_BUFFER_SIZE && length < HOST_TRANSPORT_HOST_RX_BUFFER_SIZE); prv_lock(); bool success = circular_buffer_write(&s_tx_buffer, buffer, length); prv_unlock(); if (success) { prv_disable_spi_cs_wakeup_interrupt_handling_and_unblock_transaction_loop(...
size_t host_transport_rx_get_length(void) { prv_lock(); size_t rx_length = circular_buffer_get_read_space_remaining(&s_rx_buffer); prv_unlock(); return rx_length; } bool host_transport_rx_read(uint8_t **data_ptr_out, size_t length) { prv_lock(); bool caller_should_free = false; PBL_ASSERTN(circular_buf...
gh while SCS is high. GPIO_WriteBit(DISP_GPIO, DISP_PIN_SCS, Bit_SET); // CRESET needs to be low for at least 200 ns GPIO_WriteBit(DISP_GPIO, DISP_PIN_CRESET, Bit_RESET); delay_ms(1); GPIO_WriteBit(DISP_GPIO, DISP_PIN_CRESET, Bit_SET); return prv_wait_programmed(); } static bool prv_reset_fpga(void) { #ifd...
(SCENE_BLACK)
= VoiceEndpointResultSuccess) { VoiceStatus status = prv_get_status_from_result(result); PBL_LOG(LOG_LEVEL_WARNING, "Error occurred processing result: %d", result); prv_send_event(VoiceEventTypeSessionResult, status, NULL); return false; } // Make sure that if this is an app initiated session, we'r...
{ voice_cancel_dictation(session_id); }
n, &s_workout_data, &s_workout_controller); prv_create_window_and_render(active_window, 0); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_workout_active__workout_render_open_workout(void) { s_workout_data = (WorkoutData) { .steps = 0, .duration_s = 84, .distance_m = 0, ...
(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE))
; } void test_workout_active__sports_pace_long_values(void) { s_sports_data = (SportsData) { .current_bpm = 71, .duration_string = "04:20:39", .distance_string = "115.12", .pace_string = "12:34", }; WorkoutMetricType top_metric = WorkoutMetricType_Duration; WorkoutMetricType middle_metric = Wo...
/* * 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...
{ static const PebbleProcessMdSystem s_app_info = { .common.main_func = &s_main, .name = "Profile Mutexes" }; return (const PebbleProcessMd*) &s_app_info; }
/* * 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_LOG(LOG_LEVEL_WARNING, "Memory pressure level: %s", level); APP_LOG(LOG_LEVEL_WARNING, "heap size: %zu, alloc'd: %zu, waste: %zu, largest free block: %zu,", stats->size, stats->allocated_bytes, stats->waste_bytes, stats->largest_free_block_bytes); APP_LOG(LOG_LEVEL_WARNING, "used blocks:...
static void prv_call_memorypressure_handler(RockyMemoryAPIContext *ctx, const char *level, jmem_heap_stats_t *stats, bool fatal_if_not_freed) { if (ctx->is_calling_memory_callback && fatal_if_not_freed) { // If this happens,...
_pbi_eq(native_framebuffer, TEST_PBI_FILE)); } // Tests 4-bit bitblt palettized to circular display buffer // Result: // - gbitmap matches platform loaded PBI void test_bitblt_circular__color_4_bit(void) { GBitmap *bitmap = setup_png_test(TEST_PNG_FILE); GBitmap *native_framebuffer = graphics_context_get_bitmap(...
(native_framebuffer)
; cl_assert(native_framebuffer->info.format == GBitmapFormat8BitCircular); cl_assert(DISPLAY_FRAMEBUFFER_BYTES == 25944); // Set screen to black to match empty region with test image graphics_context_set_fill_color(ctx, GColorBlack); graphics_fill_rect(ctx, &framebuffer_bounds); // Shift the output by non...
/* * 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 (task == PebbleTask_Worker) { config = worker_state_get_compass_config(); } else if (task == PebbleTask_KernelMain) { config = kernel_applib_get_compass_config(); } else { WTF; }
if (*config == NULL) { // Note that config will never be NULL after grabbing it from an app, // worker, or kernel state. However, the value pointed to it may be // NULL. *config = task_zalloc_check(sizeof(CompassServiceConfig)); } return config; } static void prv_do_data_handle(PebbleEvent *e...
origin_center = GPointZero; // 90 degrees should be (5, 0) result = gpoint_from_polar_internal(&origin_center, radius, (TRIG_MAX_ANGLE / 4)); cl_assert_equal_gpoint(result, GPoint(5, 0)); // 270 (90 * 3) degrees should be (-5, 0) result = gpoint_from_polar_internal(&origin_center, radius, (TRIG_MAX_ANGLE * 3...
GRect(5, 4, 1, 2)
, grect_centered_internal(&p2, GSize(-1, -2))); // handles fixed point cl_assert_equal_grect(GRect(4, 4, 2, 2), grect_centered_internal(&p2, GSize(2, 2))); p2.x.raw_value += FIXED_S16_3_HALF.raw_value; cl_assert_equal_grect(GRect(5, 4, 2, 2), grect_centered_internal(&p2, GSize(2, 2))); // Repeat for a posit...
/* * 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...
(event.type, PEBBLE_TOUCH_EVENT)
red = r2; manager.state = RecognizerManagerState_RecognizersTriggered; recognizer_manager_deregister_recognizer(&manager, r1); cl_assert_equal_p(manager.triggered, r2); cl_assert_equal_p(manager.active_layer, &layer_a); cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersTriggered); cl_assert...
recognizer_manager_handle_state_change(&manager, r[0])
; cl_assert_equal_i(manager.state, RecognizerManagerState_WaitForTouchdown); cl_assert_equal_p(manager.triggered, NULL); cl_assert_equal_p(manager.active_layer, NULL); prv_compare_recognizers_processed((int []) { 0, 1 }, 2, &s_recognizers_reset); cl_assert_equal_i(r[0]->state, RecognizerState_Possible); cl_...
SION_REF(x) ((HRMSessionRef)(long)(x)) static const HRMData s_hrm_event_data = { .led_current_ua = 243, .hrm_bpm = 82, .hrm_quality = HRMQuality_Excellent, }; static void prv_fake_send_new_data(void) { hrm_manager_new_data_cb(&s_hrm_event_data); } static PebbleHRMEvent s_cb_events_1[16]; static int s_num_cb...
cl_assert_equal_i(ret_expire_s, 0)
; // Now, call the process cleanup. This should place an expiration time on the subscription hrm_manager_process_cleanup(PebbleTask_App, app_id); cl_assert(sys_hrm_manager_get_app_subscription(app_id) == session_ref); sys_hrm_manager_get_subscription_info(session_ref, NULL, NULL, &ret_expire_s, NULL); cl_as...
/* * 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 custom_reel->impl->get_gdraw_command_sequence(reel); }
/* * 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...
calculate_distance_cm(tx_power, rssi)
, .rssi = rssi, .calibrated_tx_power = tx_power, }; return true; } return false; } // ----------------------------------------------------------------------------- //! iBeacon Advertisement Data composer bool ble_ibeacon_compose(const BLEiBeacon *ibeacon_in, BLEAdData *ad_out) { AdDataManufac...
opped handlers got called before any of the spawn b // started handlers uint32_t last_fire_a = 0; last_fire_a = MAX(last_fire_a, prv_last_handler_entry(&s_stopped_handler_calls, a0)->fire_order); last_fire_a = MAX(last_fire_a, prv_last_handler_entry(&s_stopped_handler_cal...
(prv_count_handler_entries(&s_stopped_handler_calls, b), 0)
; cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, b), 0); // Just before A completes prv_advance_to_ms_with_timers(start_ms + delay_seq + delay_a + duration_a - 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&...
i18n_noop("MI"), i18n_noop("KM")); GTextNodeText *units_text_node = health_util_create_text_node_with_text( i18n_get(units_string, i18n_owner), units_font, TEXT_COLOR, container); units_text_node->node.offset.y = units_offset_y; #endif break; } case WorkoutMetricType_Custom: {...
i18n_get(units_string, i18n_owner)
, units_font, TEXT_COLOR, container); units_text_node->node.offset.y = units_offset_y; #endif break; } // don't have default here so when we have a new type, we don't forget to add it here case WorkoutMetricType_None: case WorkoutMetricTypeCount: break; } return &container->node; ...
esses_remaining = num_presses, .hold_down_time_ms = hold_down_timeout_ms, .delay_between_presses_ms = delay_between_presses_timeout_ms, }; // In order to avoid race conditions between button events and timers being registered, drive the // entire multi click sequence in new_timers. The callback will re-r...
sys_get_time()
; for (int i = 0; i < 16; ++i) { LogBinaryMessage* msg = (LogBinaryMessage*) buffer; msg->timestamp = htonl(base + iteration * 16 + i); msg->log_level = LOG_LEVEL_ERROR; msg->message_length = sizeof(buffer) - sizeof(LogBinaryMessage); msg->line_number = 0; strncpy(msg->filename, "spam.exe", si...
"os/mutex.h" #include "system/passert.h" #include "kernel/util/delay.h" #include "util/size.h" #include "kernel/util/sleep.h" #include "kernel/events.h" #include "services/common/system_task.h" #include "services/common/new_timer/new_timer.h" #define STM32F2_COMPATIBLE #define STM32F4_COMPATIBLE #define STM32F7_COMP...
{ i2c_use(I2C_MAX14690); bool rv = i2c_write_register(I2C_MAX14690, register_address, value); i2c_release(I2C_MAX14690); return (rv); }
// Configure PMIC's charger settings (different from defaults - // see https://pebbletechnology.atlassian.net/browse/PBL-15134) static bool prv_config_charger(void) { const uint8_t CHARGE_VOLTAGE_4300 = 0b101; const uint8_t CHARGE_VOLTAGE_4200 = 0b011; // [AS] HACK alert! (see PBL-19186) // The MAX14690 stat...
cl_assert(false); } } static void prv_no_reply_callback(uint16_t endpoint_id, const uint8_t* data, unsigned int length) { } // Overrides /////////////////////////////////// bool sys_app_pp_has_capability(CommSessionCapability capability) { return true; } static int s_sys_psleep_last_millis; void sys_p...
app_message_set_context(&s_context)
; cl_assert_equal_i(app_message_open(MAX_SIZE_INBOUND, MAX_SIZE_OUTBOUND), APP_MSG_OK); cl_assert_equal_p(app_message_register_outbox_sent(prv_out_sent_callback), NULL); cl_assert_equal_p(app_message_register_outbox_failed(prv_out_failed_callback), NULL); cl_assert_equal_p(app_message_register_inbox_dropped(prv...
int64_t)m[r0][0]; temp = (m[r1][0] * m[r2][2]) - (m[r1][2] * m[r2][0]); det -= temp * (int64_t)m[r0][1]; temp = (m[r1][0] * m[r2][1]) - (m[r1][1] * m[r2][0]); det += temp * (int64_t)m[r0][2]; if ((skip_row % 2) == 0) { res += det; } else { res -=det; } } return (res / dow...
{ int32_t v_ab[3] = { s_samples[idx_b][0] - s_samples[idx_a][0], s_samples[idx_b][1] - s_samples[idx_a][1], s_samples[idx_b][2] - s_samples[idx_a][2] }; int32_t dist_sq = v_ab[0] * v_ab[0] + v_ab[1] * v_ab[1] + v_ab[2] * v_ab[2]; return (dist_sq > (thresh * thresh)); }
static bool pt_to_line_dist_under_thresh(int idx_line_a, int idx_line_b, int idx_pt, int32_t thresh) { int32_t s[3] = { s_samples[idx_line_b][0] - s_samples[idx_line_a][0], s_samples[idx_line_b][1] - s_samples[idx_line_a][1], s_samples[idx_line_b][2] - s_samples[idx_line_a][2] }; int32_t m1[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...
{ return resource_load_byte_range_system(SYSTEM_APP, RESOURCE_ID_TIMEZONE_DATABASE, offset, data, num_bytes) == num_bytes; }
//! Note! This count includes rule 0 which isn't actually stored in the database. static int prv_get_dst_rule_count(void) { uint16_t dst_rule_count; prv_database_read(offsetof(TimezoneDatabaseFlashHeader, dst_rule_count), &dst_rule_count, sizeof(dst_rule_count)); return dst_rule_count; } st...
nimation_set_from_gpoint(prop_h, &set_value); property_animation_get_from_gpoint(prop_h, &test_value); cl_assert_equal_point(test_value, set_value); set_value = GPoint(44, 45); property_animation_set_to_gpoint(prop_h, &set_value); property_animation_get_to_gpoint(prop_h, &test_value); cl_assert_equal_point...
property_animation_create(&implementation, &value, &start_value, NULL)
; Animation *h = property_animation_get_animation(prop_h); void *context = &value; animation_set_handlers(h, handlers, context); animation_set_duration(h, duration); prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); animation_schedule(h); // Test the accessor functions Fixed_S32_16 ...
ityMaskAll, now - (1 * SECONDS_PER_MINUTE), now + (10 * SECONDS_PER_MINUTE))); } void test_health__any_activity_accessible(void) { const time_t now = rtc_get_time(); HealthServiceAccessibilityMask accessible; // empty mask => not available accessible = health_service_any_activity...
health_service_activities_iterate(HealthActivityMaskAll, now - (100 * SECONDS_PER_MINUTE), now, HealthIterationDirectionPast, prv_activity_cb, NULL)
; cl_assert_equal_i(0, s_prv_activity_cb__call_count); // respect mask for RestfulSleep s_prv_activity_cb__call_count = 0; s_sys_activity_get_sessions_values.out.num_sessions = 7; health_service_activities_iterate(HealthActivityRestfulSleep, now - (100 * SECONDS_PER_MINUTE), ...
do { // We manually remove each item to ensure that we do not call prv_remove_unloaded_windows // until we have cleaned up the list. This prevents us from running into the issue where // an unload handler pushes a window onto the stack, but that window is subsequently // popped from the stack on anot...
(window_to)
; if (window_manager_is_window_focused(window_to)) { // TODO: PBL-37477 Window Stack directly calls click config // Either this or app_click_config_setup_with_window should be calling // window_setup_click_config_provider instead app_click_config_setup_with_window(click_manager, window_to); } } // ...
is_future ? style->future_fin_offset_y : style->past_fin_offset_y)); frame->size.w -= PBL_IF_RECT_ELSE(style->sidebar_width, 0); } static void prv_get_day_sep_frame(TimelineLayer *layer, int index, GRect *frame) { prv_get_frame(layer, index, frame); const bool is_future = (layer->scroll_direction...
{ prv_create_layout(layer, state, s_visible_items[i]); }
} } static void prv_update_pins_mode(TimelineLayer *layer) { for (int i = 0; i < (int)ARRAY_LENGTH(s_visible_items); i++) { TimelineLayout *timeline_layout = layer->layouts[s_visible_items[i]]; if (timeline_layout) { LayoutLayerMode mode = prv_get_mode(i + 1); layout_set_mode((LayoutLayer *)ti...
ion(data); } else { prv_voice_window_push(data); } } else { VOICE_LOG("Bluetooth not restored! Exiting..."); prv_exit_and_send_result_event(data, DictationSessionStatusFailureConnectivityError); } } static void prv_push_bt_dialog(VoiceUiData *data) { BtConnDialog *bt_dialog = &data->bt_dial...
prv_get_time_ms()
- data->start_ms; const bool speech_detected = (data->speech_detected) || (elapsed < MIN_ELAPSED_DURATION); data->error_count++; if (data->show_error_dialog) { if (error_status == VoiceStatusRecognizerResponseError) { prv_show_error_dialog(data, i18n_noop("Missed that. Try again.")); } 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...
(FLASH_GPIO)
; GPIO_SetBits(FLASH_GPIO, FLASH_PIN_SCS); gpio_release(FLASH_GPIO); // 50ns required between SCS going high and low again, so just delay here to be safe delay_us(1); } uint8_t flash_send_and_receive_byte(uint8_t byte) { // Ensure that there are no other write operations in progress while (SPI_I2S_GetFlag...
_resource(RESOURCE_ID_ACTION_BAR_ICON_STOP); active_window->action_bar_more = gbitmap_create_with_resource(RESOURCE_ID_ACTION_BAR_ICON_MORE); active_window->action_bar_next = gbitmap_create_with_resource(RESOURCE_ID_ACTION_BAR_ICON_TOGGLE); prv_set_pause_button(active_window); prv_set_action_bar_ic...
if (hrm_is_available) { WorkoutMetricType scrollable_metrics[] = {WorkoutMetricType_Duration}; return workout_active_create_double_layout(WorkoutMetricType_Hr, ARRAY_LENGTH(scrollable_metrics), scrollab...
} case ActivitySessionType_Walk: { if (hrm_is_available) { WorkoutMetricType top_metric = WorkoutMetricType_Hr; WorkoutMetricType scrollable_metrics[] = {WorkoutMetricType_Duration, WorkoutMetricType_Distance, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(ORDER_FILE, OP_FLAG_READ, 0, 0)
1000, -120}, { -728, 656, 408}, { -1648, 584, 656}, { -1400, 672, 312}, { -1048, 472, 232}, { -840, 1680, -752}, { -152, 4000, -2944}, { 2016, 3608, -2712}, { 1512, 1840, -960}, { 1320, 592, -552}, { 1304, -288, -128}, { 1424, -760, -216}, { 1512, -888, -128}, { 1208,...
{ 1232, 3576, -3152}, { -168, 1920, -1976}, { -720, 984, -856}, { -856, 208, -312}, { -1248, -120, -32}, { -1648, -152, -144}, { -1184, -16, 0}, { -920, 704, -216}, { -1216, 3752, -2448}, { 184, 4000, -3224}, { 1136, 2536, -1224}, { 744, 1064, -16}, { 960, 488, -40}, ...
{ -1176, 232, 16}, { -1104, 2400, -1096}, { -536, 3864, -2312}, // 38 seconds { 600, 3280, -1776}, { 792, 1648, -336}, { 832, 768, -168}, { 1224, 32, 56}, { 1360, -568, 192}, { 1352, -544, 240}, { 1088, -152, 72}, { 1056, 8, -176}, { 2544, 3088, -1904}, { 1968, 3...
L_IF_COLOR_ELSE(GColorLightGray, GColorWhite); } // Create the icon KinoReel *icon_reel = kino_reel_create_with_resource(icon_res_id); if (!icon_reel) { PBL_CROAK("Couldn't create kino reel"); } // Position the icon kino_area = GRect(icon_x_offset, icon_y_offset, data->launch_app_window.layer.bounds...
(&data->name_text_layer.layer, &frame)
; } static void prv_window_load(Window* window) { struct RecoveryFUAppData *data = (struct RecoveryFUAppData*) window_get_user_data(window); KinoLayer *kino_layer = &data->kino_layer; kino_layer_init(kino_layer, &window->layer.bounds); layer_add_child(&window->layer, &kino_layer->layer); #if PLATFORM_ROBERT ...
t s; uint16_t ms; rtc_get_time_ms(&s, &ms); mutex_lock(s_vibe_history_mutex); VibeHistory *vibe = (VibeHistory*)list_get_tail((ListNode*)s_vibe_history); if (vibe->time_end == END_NOT_SET) { vibe->time_end = ((uint64_t)s) * 1000 + ms; } mutex_unlock(s_vibe_history_mutex); } typedef struct { ListNo...
mutex_unlock(s_vibe_pattern_mutex)
; return false; } list_init((ListNode*)step); step->duration_ms = MIN(duration_ms, MAX_VIBE_DURATION_MS); step->strength = strength; if (s_vibe_queue_head == NULL) { s_vibe_queue_head = step; } else { list_append((ListNode*)s_vibe_queue_head, (ListNode*)step); } mutex_unlock(s_vibe_patter...
/* * 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 (this->state->link_state == LinkState_Opened) { struct LCPPacket *reply = pulse_link_send_begin(this->protocol_number); memcpy(reply, packet, ntoh16(packet->length)); reply->code = ControlCode_EchoReply; pulse_link_send(reply, ntoh16(packet->length)); } }
static void prv_on_echo_reply(PPPControlProtocol *this, struct LCPPacket *packet) { // TODO } static bool prv_handle_extended_lcp_codes(PPPControlProtocol *this, LCPPacket *packet) { switch (packet->code) { case ControlCode_ProtocolRejec...
gdraw_command_image_attract_to_square(l, t += dt); gdraw_command_image_draw(&ctx, l, GPoint(48, 96)); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "test_gdraw_command_transforms__to_square.8bit.pbi")); } // re-enable this "test" to debug per-frame transitions void _test_gdraw_command_transforms__to_square_sequence(v...
(&ctx, l, GPoint(0, 144))
; l = weather_app_resource_create_sun(); gdraw_command_image_scale_segmented_to(l, from, to, t += dt, interp, index_lookup, f, false); gdraw_command_image_draw(&ctx, l, GPoint(0, 192)); free(index_lookup); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "test_gdraw_command_transforms__segmented_scale.8bit.pbi"))...
if (m_info.has_history) { PBL_ASSERTN(m_info.value_p); settings_file_get(file, &m_info.settings_key, sizeof(m_info.settings_key), &history, sizeof(history)); for (int i = ACTIVITY_HISTORY_DAYS - 1; i >= 1; i--) { history.values[i] = history.values[i - 1]; ...
} activity_private_settings_close(file); } unlock: mutex_unlock_recursive(state->mutex); } // -------------------------------------------------------------------------------------------- // Called from activity_get_metric() every time a client asks for a metric. Also called // periodically from the minut...
entation->teardown(animation->handle); } animation->did_setup = false; } if (force_destroy || (allow_auto_destroy && animation->auto_destroy)) { prv_unlink_and_free(state, animation); } } return; } // Unschedule the passed in animation ANIMATION_LOG_DEBUG("unsche...
if (old_head_is_animating == false) { prv_reschedule_timer(state, 0); }
} ANIMATION_LOG_DEBUG("scheduled %d (%p) to run at (%d). delay:%d, duration:%d", (int)animation->handle, animation, (int)animation->abs_start_time_ms, (int)(animation->delay_ms), (int)(animation->duration_ms)); } // --------------------------------------------------------------------------------...
{ 1416, 248, -224}, { 1056, 176, -240}, { 760, 144, -192}, { 688, 96, -216}, { 720, 136, -248}, { 792, 80, -256}, { 968, 72, -280}, { 1088, -40, -232}, { 776, -216, -200}, { 1064, -56, -144}, { 1080, -88, -280}, { 1328, 32, -344}, { 1696, 96, -528}, { 1552, 56, -480...
{ 1280, 168, -240}, { 2064, 304, -224}, { 2712, 600, -360}, { 2744, 616, -464}, { 2344, 624, -448}, { 1616, 504, -80}, { 1544, 104, 16}, { 1488, 376, -160}, { 1248, 456, -168}, { 1080, 592, 48}, { 1136, 672, 296}, { 928, 968, 720}, { 464, 1160, 144}, // 21 seconds...
enerate_event(&tz_data->utc_time, &tz_info); } } static void prv_handle_set_time_msg(time_t new_time) { PBL_LOG(LOG_LEVEL_WARNING, "Mobile app calling deprecated API, time = %d", (int)new_time); if (clock_is_timezone_set()) { new_time = prv_migrate_local_time_to_UTC(new_time); } prv_update_tim...
localtime_r(&timestamp, &time_tm)
; const size_t ret_val = strftime(buffer, buf_size, i18n_get(format, buffer), &time_tm); i18n_free(format, buffer); return ret_val; } size_t clock_get_time_number(char *number_buffer, size_t number_buffer_size, time_t timestamp) { const size_t written = prv_format_time(number_buffer, number_buffer_size, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ s_conn_mgr_states[consumer].state = state; s_conn_mgr_states[consumer].max_period_secs = max_period_secs; }
GAPLEConnection *gap_le_connection_by_device(const BTDeviceInternal *device) { return NULL; } BTDeviceInternal gatt_client_characteristic_get_device(BLECharacteristic characteristic_ref) { return (BTDeviceInternal) { .address.octets = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, }, }; } static void (*s...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert(success == s_read_success)
; cl_assert(profile == s_read_profile); cl_assert(length == s_read_length); s_did_read = false; } void smartstrap_profiles_handle_notification(bool success, SmartstrapProfile profile) { s_notify_success = success; s_notify_profile = profile; s_did_notify = true; } void fake_smartstrap_profiles_check_notif...
------------------------------------------------------------ void test_kraepelin_algorithm__sleep_tests(void) { bool success = prv_sample_discovery_init(&s_sleep_sample_discovery_state.common, SampleFileType_MinuteSamples, "activity...
printf("| ---------------------- ")
; } float weighted_sum = 0.0; int pass_count = 0; int fail_count = 0; SleepFileTestEntry *entry = &test_entry[0]; SleepTestResults *results; for (int i = 0; i < num_tests; i++, entry++, results++) { results = &test_results[entry->test_idx]; // Generate the status string const char *status = ...
x7f, 0x00, 0x18, 0x00, 0x7f, 0x00, 0x1f, 0x00, /* bytes 16 - 32 */ 0x7f, 0xf0, 0x1f, 0x00, 0x7f, 0xfc, 0x1f, 0x00, 0x7f, 0xfc, 0x1f, 0x00, 0x7f, 0xfc, 0x1f, 0x00, /* bytes 32 - 48 */ 0x7f, 0xfc, 0x1f, 0x00, 0x7f, 0xfc, 0x1f, 0x00, 0x7f, 0xfc, 0x1f, 0x00, 0x7f, 0xfc, 0x1f, 0x00, /* bytes 48 - 64 */ 0x7f, 0xfc, 0x1...
(menu_layer, data, &(MenuLayerCallbacks) { .get_num_sections = (MenuLayerGetNumberOfSectionsCallback) get_num_sections_callback, .get_num_rows = (MenuLayerGetNumberOfRowsInSectionsCallback) get_num_rows_callback, .get_header_height = (MenuLayerGetHeaderHeightCallback) get_header_height_callback, .draw_r...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(s_data.order_mutex)
; return storage; } //! Should be called on system task. static void prv_app_order_write_order(AppMenuOrderStorage *storage) { mutex_lock(s_data.order_mutex); int storage_size = sizeof(AppMenuOrderStorage) + (storage->list_length * sizeof(AppInstallId)); int fd = pfs_open(ORDER_FILE, OP_FLAG_OVERWRITE, FILE_...
leepSession *container_session = NULL; for (uint32_t i = 0; i < s_num_captured_sleep_sessions; i++, session++) { // Get info on this session time_t session_exit_utc = session->start_utc + session->len_m * SECONDS_PER_MINUTE; // Skip if not a sleep session bool is_restful = false; switch (session...
prv_sample_discovery_init(&s_sleep_sample_discovery_state.common, SampleFileType_MinuteSamples, "activity/sleep_samples")
le = arg1; const char *subtitle = arg2; menu_cell_basic_draw(ctx, cell_layer, title, subtitle, NULL); } static void prv_draw_korea_regulatory_cell( GContext *ctx, const Layer *cell_layer, SystemCertificationData *cd, bool is_selected, const void *arg1, const void *arg2) { const char *title = arg1; cons...
(cd, &(SystemCertificationMenuItem) { .draw_cell_fn = prv_draw_regulatory_id_cell, .arg1 = "IFETEL", .arg2 = prv_get_mexico_ifetel_id(), })
; } if (flags->has_korea_kcc) { prv_append_regulatory_compliance_mark(cd, &cd->kcc_mark); } if (flags->has_eu_ce) { prv_append_regulatory_compliance_mark(cd, &cd->ce_mark); } if (flags->has_eu_weee) { prv_append_regulatory_compliance_mark(cd, &cd->weee_mark); } if (flags->has_australia_rcm)...
/* * 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...
(false /* run filesystem check */)
; pfs_format(true /* write erase headers */); load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false /* is_next */); resource_init(); // Setup content indicator ContentIndicatorsBuffer *buffer = content_indicator_get_current_buffer(); co...
KinoReelProcessor *processor) { KinoReel *reel = prv_get_current_reel(data); GDrawCommandList *source_list = kino_reel_get_gdraw_command_list(reel); GDrawCommandList *list = prv_get_or_create_list_copy(data, source_list); offset = gpoint_to_local_coordinates(GPointZero, ctx);...
{ KinoReelTransformData *data = kino_reel_custom_get_data(reel); if (!data) { return; } if (data->owns_to_reel) { kino_reel_destroy(data->to_reel); } data->to_reel = to_reel; data->owns_to_reel = take_ownership; prv_free_list_copy(data); }
KinoReel *kino_reel_transform_get_to_reel(KinoReel *reel) { KinoReelTransformData *data = kino_reel_custom_get_data(reel); if (data) { return data->to_reel; } return NULL; } void kino_reel_transform_set_layer_frame(KinoReel *reel, GRect layer_frame) { KinoReelTransformData *data = kino_reel_custom_get_...
/* * 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...
periph_config_release_lock()
aphics_text_layout_cache_deinit(&text_layer->layout_cache); text_layer->layout_cache = NULL; } Layer* text_layer_legacy2_get_layer(TextLayerLegacy2 *text_layer) { if (text_layer == NULL) { return NULL; } return &text_layer->layer; } void text_layer_legacy2_set_size(TextLayerLegacy2 *text_layer, const GSiz...
(ctx, text_layer)
; }
_text_prefs[SEND_TEXT_DATA_LEN]; #define WEATHER_KEY ((uint8_t *)PREF_KEY_WEATHER_APP) #define WEATHER_KEY_LEN (strlen(PREF_KEY_WEATHER_APP)) #define NUM_WEATHER_LOCATIONS (4) #define WEATHER_DATA_SIZE (sizeof(SerializedWeatherAppPrefs) + \ (sizeof(Uuid) * NUM_WEATHER_LOCATIONS)) static uint8...
watch_app_prefs_db_get_len(SEND_TEXT_KEY, SEND_TEXT_KEY_LEN)
, 0); cl_assert_equal_i(watch_app_prefs_db_insert(WEATHER_KEY, WEATHER_KEY_LEN, s_weather_prefs, sizeof(s_weather_prefs)), S_SUCCESS); cl_assert_equal_i(watch_app_prefs_db_delete(WEATHER_KEY, WEATHER_KEY_LEN), S_SUCCESS); cl_assert_equal_i(watch_app_prefs_db_get_len(...
} case VibeSettingsRow_Alarms: { title = i18n_noop("Alarms"); client = VibeClient_Alarms; break; } case VibeSettingsRow_System: { /// Refers to the class of all non-score vibes, e.g. 3rd party app vibes title = i18n_noop("System"); const VibeIntensity current_system_def...
settings_menu_get_selected_row(SettingsMenuItemVibrations)
; prv_selection_changed_cb(&data->callbacks, current_row, 0); settings_menu_mark_dirty(SettingsMenuItemVibrations); } static void prv_hide_cb(SettingsCallbacks *context) { vibes_cancel(); } static Window *prv_init(void) { SettingsVibePatternsData *data = app_zalloc_check(sizeof(SettingsVibePatternsData)); ...
tx->app_uuid)) { // Match on UUID found! return true; } // If there is no valid UUID, it means we don't know what app UUID is associated with the // transport, consider it as a fallback option: const bool is_unknown_app_session = (session->destination == TransportDestinationApp && ...
app_manager_get_current_app_md()
/* * 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...
periph_config_release_lock()
/* * 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...
{ delay_us(1000); }
__disable_irq(); s_int_fired--; __enable_irq(); } // NB: this function is used only by the bootloader. static void prv_exti_cb(bool *should_context_switch) { s_int_fired++; if (s_int_fired > 1) { dbgserial_putstr("BLE Chip multiple INTS ?"); } } static void prv_init_exti(ExtiHandlerCallback int_exti...
/* * 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...
{ snprintf(buffer + pos, buffer_size - pos, " "EN_DASH); }
} Window *health_activity_detail_card_create(HealthData *health_data) { HealthActivityDetailCardData *card_data = app_zalloc_check(sizeof(HealthActivityDetailCardData)); card_data->daily_avg = health_data_steps_get_monthly_average(health_data); const GColor fill_color = PBL_IF_COLOR_ELSE(GColorIslamicGreen, G...
4}, { 176, 776, 72}, { 312, 904, 56}, { 240, 704, 440}, { 240, 1328, 168}, { -8, 1352, 72}, { 120, 1472, 360}, { -112, 1504, 304}, { 112, 1352, 336}, { -16, 1048, 384}, { 32, 672, 240}, { 128, 496, 128}, { 192, 504, 80}, { 288, 592, 168}, { 272, 800, 168}, { 2...
// 54 seconds { -72, 1168, 296}, { -136, 1000, 432}, { -128, 1280, 216}, { -112, 952, 344}, { -32, 888, 136}, { 64, 648, 80}, { 152, 552, 88}, { 176, 608, 224}, { 216, 944, 152}, { -24, 984, 80}, { 128, 912, 224}, { 296, 1248, 208}, { 200, 1344, 168}, { 48, 14...
{ 152, 744, 248}, { 80, 920, 208}, { -40, 1040, 328}, { -128, 1200, 296}, { -160, 1136, 248}, { -216, 1264, 408}, // 57 seconds { -176, 1192, 296}, { -104, 1040, 216}, { -72, 888, 280}, { 88, 752, 64}, { 152, 656, 176}, { 160, 456, -96}, { 264, 768, 232}, { 9...
history[0] = ActivitySleepStateRestfulSleep; activities = health_service_peek_current_activities(); cl_assert_equal_i(activities, HealthActivitySleep | HealthActivityRestfulSleep); s_sys_activity_get_metric_values.out.history[0] = ActivitySleepStateAwake; s_activity_sessions_ongoing[ActivitySessionType_Run] = ...
cl_assert_equal_i(3, written)
; cl_assert_equal_i(now - 10 * SECONDS_PER_MINUTE, time_start); cl_assert_equal_i(time_start + written * SECONDS_PER_MINUTE, time_end); cl_assert_equal_i(1, data[0].steps); cl_assert_equal_i(2, data[1].steps); cl_assert_equal_i(3, data[2].steps); // if internal sys_activity returns false, no records were w...
t linked in this unit-test // what we want to test though is that the text color is taken from fill color EXECUTE_SCRIPT( "ctx.textAlign = 'left';\n" "ctx.fillText('some text', 100, 100);\n" ); cl_assert_equal_i(1, s_graphics_draw_text.call_count); cl_assert_equal_rect((GRect(100, 100, large_int, la...
{ TEST_COLOR_STRING(GColorClear, "transparent"); TEST_COLOR_STRING((GColor){ .a = 1 }, "transparent"); TEST_COLOR_STRING(GColorRed, "#FF0000"); TEST_COLOR_STRING(GColorMalachite, "#00FF55"); }
extern T_STATIC const RockyAPISystemFontDefinition s_font_definitions[]; bool prv_font_definition_from_value(jerry_value_t value, RockyAPISystemFontDefinition **result); void test_rocky_api_graphics__text_font_names_unique(void) { rocky_global_init(s_graphics_api); const RockyAPISystemFontDefinition *def = s_fo...
interpolate, GPointIndexLookup *lookup, Fixed_S32_16 duration_fraction, bool is_offset) { GPoint offset = GPointZero; if (is_offset) { offset = from.origin; to.origin = gpoint_sub(to.origin, from.origin); from.origin = GPointZero; } ScaleToCBContext ctx = { .values = { .integer = { ...
{ if (gcolor_equal(from, command->fill_color)) { command->fill_color = to; } if (gcolor_equal(from, command->stroke_color)) { command->stroke_color = to; } }
y_metrics_prv_set_metric(ActivityMetricStepCount, Thursday, 1); activity_get_metric(ActivityMetricStepCount, 1, metric_values); cl_assert_equal_i(metric_values[0], 4444); // Verify some other metrics work activity_metrics_prv_set_metric(ActivityMetricActiveSeconds, Thursday, 60); activity_get_metric(Activity...
(HealthActivityRun, health_service_peek_current_activities())
; // Finish the run session utc_sec += (10 * SECONDS_PER_MINUTE); rtc_set_time(utc_sec); run_activity.ongoing = false; // Update session activity_sessions_prv_add_activity_session(&run_activity); // Run session ended, ensure that asking if a run is ongoing returns false cl_assert_equal_b(false, activ...
aluated //! A zero value indicates that there is no need to re-evaluate the subtitle template string time_t next_slice_subtitle_template_string_reeval_time; //! Whether to use the legacy 28x28 icon size limit bool use_legacy_28x28_icon_size_limit; } LauncherAppGlanceGeneric; static KinoReel *prv_get_icon(Launc...
if (!generic_glance->displayed_icon) { // Try again with the app's default icon if we didn't just try it if (!prv_app_resource_info_equal(&res_info_to_load, &generic_glance->default_icon_resource_info)) { res_info_to_load = generic_glance->default_icon_resource_info; ...
// We require that we have some sort of icon at this point PBL_ASSERTN(generic_glance->displayed_icon); // Update our recording of the resource info of the displayed icon generic_glance->displayed_icon_resource_info = res_info_to_load; } static void prv_cancel_subtitle_reeval_timer(LauncherAppGlanceGeneric ...
); int bytes_written = pfs_write(fd, buf, st.st_size); cl_assert(st.st_size == bytes_written); pfs_close(fd); } // --------------------------------------------------------------------------------------- // Test that we correctly migrate older versions of activity settings files void test_activity__migrate_setti...
prv_feed_cannned_accel_data(SECONDS_PER_MINUTE * ACTIVITY_SESSION_UPDATE_MIN, 60, ActivitySleepStateAwake)
; // See if we got the expected sleep events cl_assert(s_num_captured_sleep_events > 0); event = s_captured_sleep_event; cl_assert_equal_i(event.type, PEBBLE_HEALTH_SERVICE_EVENT); cl_assert_equal_i(event.health_event.type, HealthEventSleepUpdate); // ----------------------------------- // Test that we...
pulse_reliable_send(resp, response_len); } static int prv_get_fresh_fd(PulseBulkIODomainHandler *domain_handler, PulseTransferFD **fd) { for (int i=0; i < MAX_PULSE_FDS; ++i) { if (s_transfer_fds[i].impl == NULL) { s_transfer_fds[i] = (PulseTransferFD) { .impl = domain_handler, .domain_s...
(cmd, length, E_INVALID_ARGUMENT)
G_READ, DLS_FILE_INIT_SIZE_BYTES, session)) { return false; } if (space_needed == 0) { // If no extra space needed, we are done because we successfully opened the file. return true; } // Get the file size size_t file_size = prv_pfs_get_file_size(session->storage.fd); if (f...
if (!prv_pfs_write(storage->fd, (void *)data_ptr, data_chunk_length)) { return false; }
// Write data chunk header now if (!prv_pfs_seek(storage->fd, storage->write_offset, FSeekSet)) { return false; } DLSChunkHeader data_hdr = { .num_bytes = data_chunk_length, .valid = true }; if (!prv_pfs_write(storage->fd, &data_hdr, sizeof(DLSChunkHeader))) { return false; } ...
, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x22, 0x33, }, }, .is_local_encryption_info_valid = true, .is_remote_encryption_info_valid = true, .is_remote_identity_info_valid = true, .is_remote_signing_info_valid = true, .is_mitm_protection_enabled = true, }; // Helpers ////////...
cl_assert_equal_b(shared_prf_storage_get_getting_started_complete(), true)
; shared_prf_storage_wipe_all(); cl_assert_equal_b(shared_prf_storage_get_getting_started_complete(), false); } void test_shared_prf_storage_v3__ble_pairing(void) { shared_prf_storage_wipe_all(); cl_assert_equal_b(shared_prf_storage_get_ble_pairing_data(NULL, NULL, NULL, NULL), false); shared_prf_storage_st...
MessageResult result = app_message_outbox_begin(&app_data->out_iter); if (result != APP_MSG_OK) { PBL_LOG(LOG_LEVEL_DEBUG, "Failed to begin outbox - reason %i %s", result, prv_translate_error(result)); return; } dict_write_uint8(app_data->out_iter, AppMessageKey_Status, AppStatus_Enabled_1HZ)...
dict_write_data(app_data->out_iter, AppMessageKey_AccelData, (uint8_t *)d->data, d->num_samples * sizeof(d->data[0]))
; } PBL_LOG(LOG_LEVEL_DEBUG, "Sending message - bpm:%u quality:%u current:%u " "ppg_readings:%u accel_readings %"PRIu32, bpm, bpm_quality, led_current, hrm->debug->ppg_data.num_samples, hrm->debug->accel_data....
et_of_elapsed = false; bool reached_end_elapsed = false; uint64_t time_ms; while (s_stopped_handler_calls.num_calls < 2) { prv_fire_animation_timer(); time_ms = prv_now_ms(); DPRINTF("rescheduled count: %d\n", s_stopped_handler_calls.num_calls); DPRINTF("%"PRIu64": frame at: %d, %d, %d %d\n", tim...
DPRINTF("%"PRIu64": frame at: %d, %d, %d %d\n", time_ms - start_ms, layer.frame.origin.x, layer.frame.origin.y, layer.frame.size.w, layer.frame.size.h)
; if (layer.frame.origin.x == to_r.origin.x && layer.frame.origin.y == to_r.origin.y) { reached_end_elapsed = true; } if (reached_end_elapsed && s_stopped_handler_calls.num_calls == 1 && layer.frame.origin.x < to_r.origin.x) { detected_reset_of_elapsed = true; } cl_assert(max_l...
s_dest_bitmap); s_dest_bitmap = NULL; } // Helpers ////////////////////// static void prv_action_menu_did_close_cb(ActionMenu *action_menu, const ActionMenuItem *item, void *context) { ActionMenuLevel *root_level = action_menu_get_r...
(s_dest_bitmap)
; const unsigned int num_columns = SettingsContentSizeCount; const int16_t bitmap_width = (DISP_COLS * num_columns) + (GRID_CELL_PADDING * (num_columns + 1)); const int16_t bitmap_height = (num_rows == 1) ? DISP_ROWS : ((DISP_ROWS * num_rows) + (GRID_CELL_PADDING * (num_rows + 1))); const GSize bitmap_s...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (connection && connection->gatt_service_changed_indication_timer) { stub_new_timer_fire(connection->gatt_service_changed_indication_timer); }
fake_system_task_callbacks_invoke_pending(); } #define prv_expect_service_changed_indication_api_call_count(expected_count) \ { \ prv_process_pending_callbacks(s_connection); \ cl_assert_equal_i(fake_gatt_get_service_changed_indication_count(), expected_count); \ } // Tests ////////////////////////////////////...
ired 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...
new_timer_create()
; s_dropped_frames = 0; // restart active mode before it expires, this way it will never be off during the transfer new_timer_start(s_session.active_mode_trigger, ACTIVE_MODE_TIMEOUT - ACTIVE_MODE_START_BUFFER, prv_start_active_mode, NULL, TIMER_START_FLAG_REPEATING); bt_unlock(); prv_start_active_mo...
= 0; activity_insights_process_sleep_data(rtc_get_time()); cl_assert_equal_i(s_data.pins_added, 0); // Make sure pin is pushed once we have slept some prv_add_sleep_session(0, 7); activity_insights_process_sleep_data(rtc_get_time()); cl_assert_equal_i(s_data.pins_added, 1); } // --------------------------...
cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 0)
; now += 8 * SECONDS_PER_HOUR; // Jan 2 @ 6:00pm rtc_set_time(now); activity_insights_process_minute_data(now); cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 1); now += (3 * SECONDS_PER_DAY) + (2 * SECONDS_PER_HOUR); // Jan 5 @ 8:00pm rtc_set_time(now); activity_insigh...
BL_ASSERTN(mcu_state_is_isr() || (pebble_task_get_current() == PebbleTask_NewTimers)); } else if ((prev_state == SmartstrapStateReadDisabled) && (new_state == SmartstrapStateReadInProgress)) { PBL_ASSERTN(mcu_state_is_isr() || (pebble_task_get_current() == PebbleTask_KernelBackground)); } else if (...
while (s_num_connected_services) { const uint16_t service_id = s_connected_services[s_num_connected_services - 1]; prv_set_service_connected(service_id, false); }
s_num_connected_services = 0; mutex_unlock(s_services_lock); } s_is_connected = connected; smartstrap_profiles_handle_connection_event(connected); } DEFINE_SYSCALL(bool, sys_smartstrap_is_service_connected, uint16_t service_id) { if (!smartstrap_is_connected()) { return false; } mutex_lock(s_s...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_get_serialized_prefs(&file, app_id, key_len, &serialized_prefs)
; prv_file_close_and_unlock(&file); size_t string_alloc_size; uint8_t attributes_per_action[serialized_prefs->num_actions]; bool r = attributes_actions_parse_serial_data(serialized_prefs->num_attributes, serialized_prefs->num_actions, ...
lendar.is_event_ongoing; } return s_in_calendar_event; } // Fake pins //////////////////////////////////////////////////////////////// static Attribute title_attr = { .id = AttributeIdTitle, .cstring = "title", }; static TimelineItem item1 = { .header = { .id = {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00...
timeline_event_handle_blobdb_event()
; cl_assert_equal_i(fake_event_get_count(), 2); cl_assert(!prv_get_calendar_ongoing()); cl_assert(stub_new_timer_is_scheduled(timer_id)); cl_assert_equal_i(10*60, stub_new_timer_timeout(timer_id) / 1000); cl_assert(timeline_remove(&item1.header.id)); timeline_event_handle_blobdb_event(); cl_assert_equal_...
allow all notifications to go through cl_assert(alerts_should_notify_for_type(AlertMobile)); cl_assert(alerts_should_notify_for_type(AlertReminder)); cl_assert(alerts_should_notify_for_type(AlertPhoneCall)); // Should not allow invalid Notifications though cl_assert(!alerts_should_notify_for_type(AlertInval...
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(alerts_should_notify_for_type(AlertReminder)); cl_assert(!...
sitionUpdate; s_next_state = RecognizerState_Completed; s_idx_to_change = 3; recognizer_manager_handle_touch_event(&e, &manager); prv_compare_recognizers_processed(NULL, 0, &s_recognizers_handled); prv_compare_recognizers_processed(NULL, 0, &s_recognizers_reset); cl_assert_equal_i(manager.state, RecognizerM...
prv_compare_recognizers_processed(NULL, 0, &s_recognizers_reset)
; cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersTriggered); cl_assert_equal_i(recognizers[0]->state, RecognizerState_Started); cl_assert_equal_i(recognizers[1]->state, RecognizerState_Cancelled); // was already cancelled cl_assert_equal_i(recognizers[4]->state, RecognizerState_Failed); /...
LIP_NXNY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw4_clip_nxny.${BIT_DEPTH_NAME}.pbi")); #endif // SW = 5 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 5); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT); c...
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 0)
; // 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_r0_aa_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); #endif setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 11); graphics_draw_r...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
bt_driver_stop()
x, y, x1_fixed, x2_fixed, gradient_width, gradient_width, clip_box_min_x, clip_box_max_x, color); } void test_graphics_context_mask__record_assign_horizontal_line_delta_raw(void) { prv_mask_record_hline_test_p...
{ prv_mask_apply_hline_test_pattern(prv_hline_pattern_apply_assign_horizontal_line_raw); CHECK_EXPECTED_TEST_IMAGE(s_ctx); }
; void prv_blend_horizontal_line_raw(GContext *ctx, int16_t y, int16_t x1, int16_t x2, GColor color); void test_graphics_context_mask__apply_blend_horizontal_line_raw(void) { prv_mask_apply_hline_test_pattern(prv_blend_horizontal_line_raw); CHECK_EXPECTED_TEST_IMAGE(s_ctx); }; ...
d 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 under the ...
(menu_layer)
; } Layer* simple_menu_layer_get_layer(const SimpleMenuLayer *simple_menu) { return menu_layer_get_layer(&simple_menu->menu); } int simple_menu_layer_get_selected_index(const SimpleMenuLayer *simple_menu) { return menu_layer_get_selected_index(&simple_menu->menu).row; } void simple_menu_layer_set_selected_index(...
D { uint32_t magic; uint8_t version; uint8_t build_id[BUILD_ID_EXPECTED_LEN]; uint8_t log_file_id; uint8_t log_chunk_id; // For a given log file, the id of the page uint8_t log_flags; // this should be the last header field written } FlashLoggingHeader; // indicates the region is erased and no l...
{ return (hdr->magic == LOG_MAGIC && hdr->version == LOG_VERSION); }
static uint8_t prv_get_next_log_file_id(uint8_t file_id) { return (file_id + 1) % MAX_LOG_FILE_ID; } static uint32_t prv_get_unit_base_address(uint32_t addr) { #if PLATFORM_SNOWY || PLATFORM_SPALDING return flash_get_sector_base_address(addr); #elif PLATFORM_SILK || PLATFORM_CALCULUS || PLATFORM_ROBERT return ...
ise_internal(GContext *ctx, GPointPrecise center, Fixed_S16_3 radius_inner, Fixed_S16_3 radius_outer, int32_t angle_start, int32_t angle_end) { // This function i...
{ PBL_ASSERTN(ctx); if (ctx->lock) { return; } if (radius == 0) { // Filling a circle of radius zero should just draw a single pixel. // Backup the stroke color and set that to the current fill color since the stroke color // is what is used for draw pixel. Restore the stroke color afterwards. ...
GPointPrecise gpoint_from_polar_precise(const GPointPrecise *precise_center, uint16_t precise_radius, int32_t angle) { const uint32_t normalized_angle = normalize_angle(angle); const GPointPrecise precise_perimeter_point = prv_get_rotated_precise_point(*precise_center, ...
ength)); cl_assert_equal_i(out_length, 2); cl_assert(memcmp(out_buffer, (uint8_t*) "9a", 2) == 0); cl_assert(circular_buffer_consume(&buffer, 2)); // Consume one without reading it cl_assert(circular_buffer_consume(&buffer, 1)); // Read the last little bit cl_assert(circular_buffer_read(&buffer, 1, &out...
{ CircularBuffer buffer; uint8_t storage[8]; circular_buffer_init(&buffer, storage, sizeof(storage)); circular_buffer_write(&buffer, (uint8_t *)"0123", 4); uint8_t *data_out; uint16_t contiguous_num_bytes_left = circular_buffer_write_prepare(&buffer, &data_out); cl_assert_equal_i(contiguous_num_bytes_le...
memcpy(data_out, "AB", 2); circular_buffer_write_finish(&buffer, 2); cl_assert_equal_i(circular_buffer_copy(&buffer, copy_out, copy_out_size), 8); cl_assert_equal_i(memcmp(copy_out, "234567AB", 8), 0); contiguous_num_bytes_left = circular_buffer_write_prepare(&buffer, &data_out); cl_assert_equal_i(contig...
t_data, GColorBlue.argb, sizeof(dest_data)); bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, GPointZero, GCompOpAnd, GColorWhite); cl_check(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_8bit_and-expect.8bit.pbi")); memset(dest_data, GColorBlue.argb, sizeof(dest_data)); bitblt_bitmap_into_bitmap(&dest_...
memset(dest_data, GColorBlack.argb, sizeof(dest_data))
; bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, (GPoint){0}, GCompOpTint, GColorLightGray); cl_check(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_8bit_comptint_black_cross_lightgray_corners-expect.8bit.pbi")); gbitmap_destroy(src_bitmap); } // Setup: // - Source is 25x25. // - Source has alterna...
dst_start_stamps[i] = prv_clock_dstrule_to_timestamp(false, tz_info, &dst_rule_begin, year); dst_end_stamps[i] = prv_clock_dstrule_to_timestamp(true, tz_info, &dst_rule_end, year); } // Figure out which timestamps are relevant to us int start_idx = DST_YEARS_OFFSET; int end_idx = DST_YEAR...
(tz_data->utc_offset_min)
; const char *region_name = tz_data->region_name; if (tz_data->region_name_len == 0) { region_name = "[N/A]"; } PBL_LOG(LOG_LEVEL_DEBUG, "set_timezone utc_time: %u offset: %d region_name: %s", (int) tz_data->utc_time, (int) tz_data->utc_offset_min, region_name); TimezoneInfo tz_info = prv_get_...
/* * 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...
{ // The desired prescaler is not an integer, so we'll round up so that the clock is never // faster than the desired frequency. prescaler++; }