prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
hEventType event, void *context) { ActivityTestAppData *data = (ActivityTestAppData *)context; // Test the sum function if (event == HealthEventMovementUpdate) { int32_t steps_today = health_service_sum_today(HealthMetricStepCount); APP_LOG(APP_LOG_LEVEL_DEBUG, "Got...
{ ActivityTestAppData *data = app_state_get_user_data(); window_destroy(data->window); app_free(data); }
// ------------------------------------------------------------------------------- static void init(void) { ActivityTestAppData *data = app_malloc_check(sizeof(ActivityTestAppData)); memset(data, 0, sizeof(ActivityTestAppData)); app_state_set_user_data(data); // Init window data->window = window_create();...
/* * 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...
regular_timer_is_scheduled(&s_missed_call_timer_id)
le // before passing control to the firmware. // // No attempt is made to set CONTROL to zero as it should already be set to // the reset value when this code executes. __asm volatile ( "cpsie if\n" // Clear PRIMASK and FAULTMASK "mov lr, 0xFFFFFFFF\n" "mov sp, %[initial_sp]\n" "bx ...
prv_prf_button_combination_is_pressed()
) { // stop waiting if not held down any longer return false; } delay_ms(1); } return true; } void *reset_vector, *initial_sp; prv_get_fw_reset_vector(&reset_vector, &initial_sp); if ((uintptr_t)reset_vector == 0xffffffff || (uintptr_t)initial_sp == 0xffffffff) { ...
/* * 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_unlock()
; return done; } // Only to be called by prv_enqueue(). This function keeps track of how many // enqueues are outstanding. If an enqueue is about to start but the stack is // no longer up, it does NOT bump the job count as we expect prv_enqueue() to // bail immediately static bool prv_update_enqueue_count(bool start...
history update events fake_event_reset_count(); fake_event_set_callback(prv_fake_history_event_cb); s_captured_history_event = (PebbleEvent) { }; s_num_captured_history_events = 0; // Get the current day_id int32_t actual; activity_get_metric(ActivityMetricStepCount, 1, &actual); // Wait long enough f...
(value, 330 * SECONDS_PER_MINUTE)
; activity_get_metric(ActivityMetricSleepExitAtSeconds, 1, &value); cl_assert_equal_i(value, 7 * SECONDS_PER_HOUR + 45 * SECONDS_PER_MINUTE /* 7:45am */); // Assert that we got the same sleep sessions using the activity service as we do using // the health API prv_assert_equal_activity_and_health_sleep_sess...
{ if (!s_initialized) { return; } for (; *str && s_message_length < MAX_MESSAGE; ++str) { if (*str == '\n') { prv_flush(); } else if (*str != '\r') { s_message_buffer[s_message_length++] = *str; } } }
void dbgserial_print_hex(uint32_t value) { char buf[12]; itoa(value, buf, sizeof(buf)); dbgserial_print(buf); }
, { 1960, 408, 8}, { 1824, 360, -24}, { 1704, 408, -96}, { 1408, 208, -208}, { 944, -304, 32}, { 616, -432, -88}, { 728, -280, -512}, { 1080, -440, -120}, { 1440, 32, -240}, { 1592, 160, -184}, { 1976, 256, -152}, { -1864, 432, -320}, { -2040, 560, -264}, { 1904, ...
{ -64, -320, -936}, }; *len = ARRAY_LENGTH(samples); return samples; }
// ---------------------------------------------------------------- // Sample captured: 2015-09-22 12:02:46 local AccelRawData *activity_sample_100_steps_heather_4(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_heather_4 //> TEST_EXPECTED 100 //> TEST...
/* * 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_copy_points(path->points, path->num_points, s_offset)
; s_path_open = open; s_path_stroke_count++; } void gpath_fill_precise_internal(GContext *ctx, GPointPrecise *points, size_t num_points) { s_fill_points = prv_copy_points((GPoint*)points, num_points, s_offset); s_path_fill_precise_count++; } void gpath_draw_filled(GContext* ctx, GPath *path) { s_fill_points...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(notifications_glance->icon)
/* * 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...
(DEFAULT_SERIAL_BAUD_RATE)
; } void dbgserial_putstr(const char* str) { while (*str) { dbgserial_putchar(*str); ++str; } dbgserial_putchar('\r'); dbgserial_putchar('\n'); } void dbgserial_putchar(uint8_t c) { dbgserial_putchar_lazy(c); dbgserial_flush(); } void dbgserial_putchar_lazy(uint8_t c) { uart_write_byte(DBG_UART...
ic_values[0], 4444); // Set the current value to something smaller (will be ignored) activity_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_...
cl_assert_equal_b(true, activity_sessions_is_session_type_ongoing(ActivitySessionType_Run))
; cl_assert_equal_i(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, ens...
/* * 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...
(title, "Certification")
; layer_add_child(&window->layer, &title->layer); InverterLayer *inverter = &data->inverter; inverter_layer_init(inverter, &window->layer.frame); layer_add_child(&window->layer, &inverter->layer); app_window_stack_push(window, true /* Animated */); prv_vibe_timer_callback(NULL); app_light_enable(true);...
symmetric). // The chosen number should be large enough for the previous line, the orphan line plus some // buffer. const int num_safe_lines = 3; const bool page_contains_enough_lines = (flow_data->paging.page_on_screen.size_h >= num_safe_lines * line->height_px); bool avoiding_orphans = uses_...
if (should_hyphenate) { // Set suffix character // [CJK] - when breaking a Katakana word, you probably don't want to add a hyphen. And to // a Japanese user, a hyphen with Katakana looks like a long (chou-on) sound mark. line->suffix_codepoint = HYPHEN_CODEPOINT; utf8_t* last_visited = walk_line(ctx...
if (!is_overflow) { // Add entire word PBL_ASSERTN(line->suffix_codepoint == 0); line->width_px += word->width_px; return true; } // Word-wrap word_trim_preceeding_whitespace(ctx, word, text_box_params); return false; } static void prv_line_justify(Line* line, const TextBoxParams* const te...
/* * 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...
{ // add the same sample twice to make sure close values are thrown away rv = ecomp_corr_add_raw_mag_sample(s_sample_data[i].raw_samples[j], NULL, solution); cl_assert_equal_i(rv, MagCalStatusNoSolution); }
} cl_assert_equal_i(rv, ((num_entries - 1) == i) ? MagCalStatusNewLockedSolutionAvail : MagCalStatusNewSolutionAvail); if (rv == MagCalStatusNewSolutionAvail) { solution_and_estimate_match(solution, s_sample_data[i].sphere_fit_corr); // should be avg of last 3 solutions } else if (rv...
on_ptr) { prv_process_send_queue(s_system_session_ptr); } if (s_app_session_ptr) { prv_process_send_queue(s_app_session_ptr); } } // Tests that exercise the sanity checking of the input from the app //////////////////////////////////////////////////////////////////////////////////////////////////// void...
{ AppMessageAppOutboxData *outbox_data = prv_create_and_send_outbox_message(NULL /* auto-select */, ALLOWED_ENDPOINT_ID, TEST_PAYLOAD, sizeof(TEST_PAYLOAD)); size_t length = comm_session_send_queue_get_length(s_app_session_ptr); comm_session_send_queue_consume(s_app_...
void test_app_message_sender__byte_by_byte_consume(void) { AppMessageAppOutboxData *outbox_data = prv_create_and_send_outbox_message(NULL /* auto-select */, ALLOWED_ENDPOINT_ID, TEST_PAYLOAD, sizeof(TEST_PAYLOAD)); size_t length = comm_session_send_queue_get_length(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...
(msg->result, msg->session_id, transcription, app_initiated, app_uuid)
; } static void prv_handle_nlp_result(VoiceSessionResultMsg *msg, 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_...
de "stubs_app_cache.h" #include "stubs_app_install_manager.h" #include "stubs_app_manager.h" #include "stubs_blob_db_sync.h" #include "stubs_blob_db_sync_util.h" #include "stubs_event_service_client.h" #include "stubs_events.h" #include "stubs_hexdump.h" #include "stubs_i18n.h" #include "stubs_layout_layer.h" #include ...
(timeline_add(item))
ty = 49, .size = 217548 }, // priority rank 37 { .id = 50, .priority = 1, .size = 207357 }, // priority rank 1 }; extern uint32_t app_cache_get_size(void); void prv_load_lotta_apps(void) { for (int i = 0; i < 50; i++) { // time is the basis of the priority. Set the time so we know what priority. rtc_set_...
(false, prv_file_for_id_exists(17))
; } void test_app_cache__free_up_space_save_defaults(void) { uint32_t to_free; uint32_t before_size; uint32_t after_size; // lets save ids 17, 25, 42, and 47 because they are my favorite numbers uint32_t after_free = t_data[16].size + t_data[24].size + t_data[41].size + t_data[46].size; s_test_id_ql_up =...
/* * 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...
CREATE_DMA_STREAM(2, 5)
; // DMA2_STREAM1_DEVICE - Dialog SPI TX CREATE_DMA_STREAM(2, 6); // DMA2_STREAM4_DEVICE - DFSDM CREATE_DMA_STREAM(2, 7); // DMA2_STREAM7_DEVICE - QSPI // DMA Requests // - On DMA1 we just have have "Sharp SPI TX" so just set its priority to "High" since it doesn't // matter. // - On DMA2 we have "Accessory UART RX"...
e void app_menu_data_source_init(AppMenuDataSource *source, const AppMenuDataSourceCallbacks *callbacks, void *callback_context) { PBL_ASSERTN(source != NULL); *source = (AppMenuDataSource) { .callback_context = callback_context, }; if (callback...
menu_cell_basic_draw(ctx, cell_layer, node->name, NULL, bitmap)
; }
e *prv_metric_constructor( const LayoutLayer *layout, const LayoutNodeConstructorConfig *config) { MetricContext *context = config->context; const int icon_offset_x = PBL_IF_RECT_ELSE(-2, 0); const int icon_offset_y = PBL_IF_RECT_ELSE(4, 0); const int icon_margin_w = PBL_IF_RECT_ELSE(3, 0); const int icon...
(&vertical_node->container, page_break)
; } #endif } GTextNodeVertical *layout_create_metrics_node(const LayoutLayer *layout_ref) { // TODO: Remove TimelineLayout requirement TimelineLayout *layout = (TimelineLayout *)layout_ref; if (layout->metric_icon_layers) { return NULL; } const AttributeList *attributes = layout_ref->attributes; 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...
(fixture_path(_clar_path, fixture_name))
; } #endif
/* * 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...
ntoh16(packet->protocol)
) { case PULSE_CONTROL_MESSAGE_PROTOCOL: pulse_control_message_protocol_on_packet( &s_best_effort_pcmp, packet->information, info_length); break; #define REGISTER_PROTOCOL(N, HANDLER, LAYER_STATE_HANDLER) \ case N: \ HANDLER(packet->information, info_length); \ break; #include ...
360, -104}, { -1480, 272, 136}, { -1424, 216, 32}, { -1048, 224, 80}, { -944, 136, 168}, { -1024, 24, 256}, { -984, -32, 264}, { -944, -16, 160}, { -1104, 32, 240}, { -1120, -104, 176}, // 44 seconds { -808, -136, 24}, { -1240, -16, -160}, { -1296, 112, -224}, { ...
{ -1296, 200, 56}, { -1184, 104, 168}, { -1120, -40, 232}, { -1080, 64, 144}, { -1024, 80, 112}, { -1032, 72, 200}, { -1136, -8, 328}, { -1072, -272, 448}, { -1368, 160, 16}, { -1160, 344, -352}, { -1144, 224, -264}, { -1304, -48, -8}, { -1320, -184, 176}, { -1208...
{ 8, 680, 560}, { 160, 408, 432}, { 200, 504, 288}, { 216, 400, 312}, { 384, 456, 456}, { 288, 592, 376}, { 216, 800, 576}, { 232, 1048, 520}, // 52 seconds { 320, 1072, 632}, { 328, 1376, 560}, { 336, 960, 416}, { 344, 752, 272}, { 272, 728, 312}, { 192, 560...
) / 2)) { return guess; } else { return min_gt_guess; } } // ------------------------------------------------------------------------------------------------ void stats_calculate_basic(StatsBasicOp op, const int32_t *data, size_t num_data, StatsBasicFilter filter, void *context, ...
(values, num_data, sizeof(*values), prv_cmp_weighted_value)
; // Find the sum of all of the weights int32_t S_x100; stats_calculate_basic(StatsBasicOp_Sum, weights_x100, num_data, NULL, NULL, &S_x100); if (S_x100 == 0) { // All weights are zero return 0; } int32_t tmp_sum = S_x100; int k = 0; int32_t rv = 0; for (;;) { tmp_sum -= values[k].weigh...
*animation_array, uint32_t array_len) { return prv_create_from_array(animation_array, array_len); } typedef void (*AnimationEachCallback)(AnimationPrivate *animation, uintptr_t context); static void prv_each(AnimationPrivate *animation, AnimationEachCallback callbac...
((Animation *)animation)
; } } bool animation_unschedule(Animation *animation_h) { AnimationPrivate *animation = (AnimationPrivate *)animation_h; if (!animation) { return false; } if (animation->scheduled) { prv_each(animation, prv_call_scheduled, false); prv_each(animation, prv_call_update, ANIMATION_NORMALIZED_MAX); ...
que window 0 cl_assert(NumModalPriorities > 1); window_stack_push(window_stacks[1], windows[1][0], false); // An opaque top window is now below two transparent top windows // Test: An opaque top window below a transparent top window removes Transparent // i.e. A transparent top window above an opaque t...
(windows[2][1]->on_screen, false)
; cl_assert_equal_i(windows[2][1]->is_click_configured, false); cl_assert_equal_p(s_last_click_configured_window, windows[3][0]); // Add priority 3 unfocusable window 1 window_set_focusable(windows[3][1], false); window_stack_push(window_stacks[3], windows[3][1], false); // A unfocusable window is now the...
as checking for changes in // sleep state. Returns true if the sleep metrics were updated // We use NOINLINE to reduce the stack requirements during the minute handler (see PBL-38130) static void NOINLINE prv_process_minute_data(time_t utc_sec) { // Update the metrics activity_metrics_prv_minute_handler(utc_sec); ...
{ data->record.flags |= ACTIVITY_RAW_SAMPLE_FLAG_FIRST_RECORD; data->first_record = false; }
} if (finish) { // Finishing up an existing record? if (data->run_size > 0) { // We started a run, finish it up now. ACTIVITY_RAW_SAMPLE_SET_RUN_SIZE(data->prev_sample, data->run_size); data->record.entries[data->record.num_entries++] = data->prev_sample; data->run_...
ferent_directions_with_same_layer_should_fail(void) { ContentIndicator content_indicator; content_indicator_init(&content_indicator); // Setting a dummy configuration for a direction should return true const ContentIndicatorConfig dummy_config = helper_get_dummy_config(); dummy_config.layer->update_proc = s_...
cl_assert_equal_p(content_indicator_get_for_scroll_layer(&scroll_layer), NULL)
; // And the buffer should still be empty cl_assert(buffer_is_empty(buffer)); // Now we try to access it as the client, which should actually create the ContentIndicator ContentIndicator *content_indicator = content_indicator_get_or_create_for_scroll_layer( &scroll_layer); cl_assert(content_indicator); ...
s); break; } } static void prv_handle_ds_notification(uint32_t length, const uint8_t *data) { PBL_ASSERTN(data != NULL); analytics_inc(ANALYTICS_DEVICE_METRIC_NOTIFICATION_ANCS_DS_COUNT, AnalyticsClient_System); if (length < 1) { PBL_LOG(LOG_LEVEL_ERROR, "Received ANCS DS notification of length 0")...
{ const PerformNotificationActionMsg *action_msg = (PerformNotificationActionMsg *) data; prv_serialize_action(action_msg); kernel_free(data); }
void ancs_perform_action(uint32_t notification_uid, uint8_t action_id) { bool is_kernel_main = (pebble_task_get_current() == PebbleTask_KernelMain); // Avoid heap allocation when directly calling prv_serialize_action: PerformNotificationActionMsg action_msg; PerformNotificationActionMsg *action_msg_ptr = is_k...
_get_ble_pairing_by_id(id_2, &irk_out, &device_out, NULL /* name */); cl_assert(ret); cl_assert_equal_m(&irk_out, &pairing_2.irk, sizeof(irk_out)); cl_assert_equal_m(&device_out, &pairing_2.identity, sizeof(device_out)); // Store another pairing, this time it isn't a gateway SMPairingInfo pairing_3 = (SMPair...
(&ble_bonding)
; BTBondingID id = bt_persistent_storage_store_ble_pairing(&pairing, true /* is_gateway */, NULL, false /* requires_address_pinning */, false /* auto_accept_re_pairing */); prv_fire_writeback_timer(...
dow.progress_bar; loading_layer_init(loading_layer, &loading_frame); progress_layer_set_foreground_color((ProgressLayer *)loading_layer, GColorBlack); const GColor progress_bg_color = PBL_IF_COLOR_ELSE(GColorDarkGray, GColorWhite); progress_layer_set_background_color((ProgressLayer *)loading_layer, progress_bg...
WINDOW_NAME("Voice Window")
); window_set_window_handlers(window, &(WindowHandlers) { .load = prv_mic_window_load, .unload = prv_mic_window_unload, .appear = prv_mic_window_appear, .disappear = prv_mic_window_disappear }); window_set_user_data(window, data); prv_window_push(window); } // External interface //////////////...
state->shake_handler(e->accel_tap.axis, e->accel_tap.direction); } } // ---------------------------------------------------------------------------------------------- // Event service handler for double tap events static void prv_session_do_double_tap_handle(PebbleEvent *e, void *context) { AccelServiceState *st...
(state->manager_state)
) { // There is a pending event posted. Only session tasks allocate memory for their state in the // first place so only free the memory if this is true state->deferred_free = prv_is_session_task(); } applib_free(state->raw_data); state->manager_state = NULL; state->raw_data = NULL; state->data_h...
llipsis and angles around 90Β° and 270Β° if (radius_x == radius_y) { // We're dealing with circle here - theres an easier way... return prv_get_rotated_precise_point(center, radius_x, angle); } // This is an edge case due to fixedpoint math if (angle % QUADRANT_ANGLE == 0) { radius_x <<= FIXED_S16_3_...
{ if (quadrant_mask_mul[i].mask & quadrant) { int16_t x = center.x + (offset.x * quadrant_mask_mul[i].x_mul); int16_t y = center.y + (offset.y * quadrant_mask_mul[i].y_mul); graphics_private_plot_pixel(fb, clip_box, x, y, brightness, stroke_color); } }
} static void prv_plot8(GBitmap *fb, GRect *clip_box, GPoint center, GPoint offset, int8_t brightness, GColor stroke_color, GCornerMask quadrant) { /* * This will mirror given offset point over all eighths of the circle at given center * \ x8| x / * \ | / * \ | / ...
/* * 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...
rocky_runtime_context_init()
; jerry_init(JERRY_INIT_EMPTY); s_tick_timer_service_subscribe = (MockCallRecordings){0}; s_log_internal__expected = NULL; } void test_rocky_api_tickservice__cleanup(void) { jerry_cleanup(); rocky_runtime_context_deinit(); } static const RockyGlobalAPI *s_api[] = { &TICKSERVICE_APIS, NULL, }; void test...
Recordings){}; s_app_event_loop_callback = NULL; s_log_internal__expected = NULL; s_app_heap_analytics_log_stats_to_app_heartbeat_call_count = 0; s_app_heap_analytics_log_rocky_heap_oom_fault_call_count = 0; } void test_js__cleanup(void) { fake_app_timer_deinit(); s_log_internal__expected = NULL; // so...
cl_assert(result)
; } void test_js__rocky_tictoc_bw(void) { GContext ctx = {}; s_app_state_get_graphics_context = &ctx; prv_deinit(); // engine will be re-initialized in rocky_event_loop~ char *script = prv_load_js("bw"); s_tictoc_callback_is_color = false; s_app_event_loop_callback = prv_rocky_tictoc_callback; bool resu...
_create_window_and_render(active_window, 0); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_workout_active__sports_hr_z0(void) { s_sports_data = (SportsData) { .current_bpm = 71, .duration_string = "30:00", .distance_string = "5.0", .pace_string = "6:00", }; WorkoutMe...
(&s_ctx.dest_bitmap, TEST_PBI_FILE)
); } void test_workout_active__sports_custom_long_values(void) { s_sports_data = (SportsData) { .current_bpm = 71, .duration_string = "30:00", .distance_string = "5.0", .pace_string = "6:00", .custom_label_string = "CUSTOM FIELD LABEL", .custom_value_string = "0000000000000000000", }; Wo...
"white", GColorARGB8FromHEX(0xffffff)}, {"maroon", GColorARGB8FromHEX(0x800000)}, {"red", GColorARGB8FromHEX(0xff0000)}, // {"purple", GColorARGBFromHEX(0x800080)}, inconsistent with Pebble color {"fuchsia", GColorARGB8FromHEX(0xff00ff)}, // {"green", GColorARGBFromHEX(0x008000)}, inconsistent with Pebble color...
GColorARGB8FromHEX(0x20b2aa)
}, {"lightskyblue", GColorARGB8FromHEX(0x87cefa)}, {"lightslategray", GColorARGB8FromHEX(0x778899)}, {"lightslategrey", GColorARGB8FromHEX(0x778899)}, {"lightsteelblue", GColorARGB8FromHEX(0xb0c4de)}, {"lightyellow", GColorARGB8FromHEX(0xffffe0)}, {"limegreen", GColorARGB8FromHEX(0x32cd32)}, {"linen", GCo...
(num_stats, s_stats_num_columns)
; // Create a new row of stats StatsRow *stats = malloc(sizeof(StatsRow)); memset(stats, 0, sizeof(*stats)); // Collect the stats and also print them out for (int i = 0; i < num_stats; i++) { printf("%s: %d, ", names[i], values[i]); stats->values[i] = values[i]; } printf("\n"); // Append to t...
time_ms += elapsed_ms; return true; } bool WEAK animation_get_progress(Animation *animation, AnimationProgress *progress) { if (!animation) { return false; } // For use in this stub, start time is 0, so anything past 0 is elapsed *progress = ((AnimationPrivate*)animation)->duration_ms * ANIMATION_NORMALI...
animation_create()
; } Animation *WEAK animation_spawn_create_from_array(Animation **animation_array, uint32_t array_len) { return animation_create(); } bool WEAK animation_set_auto_destroy(Animation *animation, bool auto_destroy) { return false; } PropertyAnimation *WEAK property_...
_unload, .appear = prv_window_appear, .disappear = prv_window_disappear }); window_set_click_config_provider(window, prv_click_config_provider); cl_check(window->is_waiting_for_click_config); WindowStack *stack = app_state_get_window_stack(); cl_check(stack); cl_check(!stack->list_head); // S...
(prv_get_load_unload_count(), 1)
; } // Description: // In this test, we push a window during the unload handler of a window. void test_window_stack__push_during_window_unload(void) { Window *window = window_create(); window_set_window_handlers(window, &(WindowHandlers){ .load = prv_window_load, .unload = prv_push_window_unload }); ...
e with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either expre...
circular_cache_get(&s_recent_apps.cache, &install_id)
; if (app) { const int32_t time_since_activity = time_get_uptime_seconds() - app->last_activity; if (app->can_expire && (time_since_activity < VISIBILITY_ON_ACTIVITY_TIMEOUT_SECONDS)) { // The recent app should eventually expire and we are still below the threshold rv = true; } els...
rgb = GColorRedARGB8 }, }; static const ResourceId s_warning_icon[] = { RESOURCE_ID_BATTERY_ICON_LOW_LARGE, RESOURCE_ID_BATTERY_ICON_VERY_LOW_LARGE }; static void prv_update_ui_fully_charged(Dialog *dialog, void *ignored) { dialog_set_text(dialog, i18n_get("Fully Charged", dialog)); dialog_set_background_colo...
{ // If we're plugged in (charged), we want to alert the user of this, // but we don't want to overlay ourselves over anything they may have // on the screen at the moment. WindowStack *stack = modal_manager_get_window_stack(ModalPriorityGeneric); prv_display_modal(stack, prv_update_ui_fully_charged, NULL); }
void battery_ui_display_warning(uint32_t percent, BatteryUIWarningLevel warning_level) { // If we're not plugged in, that means we hit a critical power notification, // so we want to alert the user, subverting any non-critical windows they // have on the screen. WindowStack *stack = modal_manager_get_window_s...
est_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, 1); graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT_NXNY, RADIUS_BIG); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_origin_aa_r16_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // Medium circles setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CL...
(&layer, &ctx)
"OP: %d NYI", (int)compositing_mode); return; } } } } void bitblt_bitmap_into_bitmap_tiled_8bit_to_8bit(GBitmap *dest_bitmap, const GBitmap *src_bitmap, GRect dest_rect, ...
grect_get_max_x(&dest_rect)
, dest_row_info.max_x + 1); if (dest_end_x < dest_begin_x) { continue; } const GBitmapDataRowInfo src_row_info = gbitmap_get_data_row_info(src_bitmap, src_y); const uint8_t *src = src_row_info.data; // This is the initial position that takes into account destination de...
animation_unschedule(clone); // Keep going, nothing new should happen except stop handlers for each component prv_advance_to_ms_with_timers(start_ms + 5 * (duration_total + 3 * MIN_FRAME_INTERVAL_MS)); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, NULL), 7); cl_assert_equal_i(prv_cou...
(&s_stopped_handler_calls, a1)
->fire_order); last_fire_a = MAX(last_fire_a, prv_last_handler_entry(&s_stopped_handler_calls, a2)->fire_order); last_fire_a = MAX(last_fire_a, prv_last_handler_entry(&s_stopped_handler_calls, a3)->fire_order); last_fire_a = MAX(last_fire_a, prv_last_han...
S" 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 "ams.h" #include "ams_analytics.h" #include "ams_util.h" #include "comm/ble/ble_log.h" #include "comm/ble/gap_le_c...
{ GAPLEConnection *connection = gap_le_connection_by_device(&device); conn_mgr_set_ble_conn_response_time(connection, consumer, state, max_period_secs); }
} bt_unlock(); } static void prv_request_reduced_latency_cb(void *data) { const bool reduced_latency = (uintptr_t)data; const ResponseTimeState state = reduced_latency ? ResponseTimeMiddle : ResponseTimeMax; prv_request_response_time(BtConsumerMusicServiceIndefinite, state, MAX_PERIOD_RUN_FOREVER); } stati...
rn_value(BTErrnoNotEnoughResources); // Simulate successful subscription: BLECharacteristic entity_update = s_characteristics[0][AMSCharacteristicEntityUpdate]; ams_handle_subscribe(entity_update, BLESubscriptionNotifications, BLEGATTErrorSuccess); // Nothing should have been written because out of resources:...
for (MusicCommand music_cmd = 0; music_cmd < NumMusicCommand; ++music_cmd) { music_command_send(music_cmd); BLECharacteristic remote_command = s_characteristics[0][AMSCharacteristicRemoteCommand]; const uint8_t ams_cmd = prv_ams_command_for_music_command(music_cmd); fake_gatt_client_op_assert_write(rem...
// Invalid/Unsupported command: music_command_send(NumMusicCommand); fake_gatt_client_op_assert_no_write(); } void test_ams__send_remote_command_non_kernel_main_task(void) { prv_connect_ams(); // Simulate Music app calling music_command_send(): stub_pebble_tasks_set_current(PebbleTask_App); music_comm...
't get LR or PC, so just set to 0's. } static void attempt_handle_generic_fault(unsigned int* stacked_args) { uintptr_t stacked_lr = (uintptr_t) stacked_args[5];; uintptr_t stacked_pc = (uintptr_t) stacked_args[6];;; if (mcu_state_is_thread_privileged()) { // We're hosed! We can't recover so just reboot ev...
(stacked_args)
; } void BusFault_Handler(void) { __asm("tst lr, #4\n" "ite eq\n" "mrseq r0, msp\n" "mrsne r0, psp\n" "b %0\n" :: "i" (busfault_handler_c)); } static void usagefault_handler_c(unsigned int* stacked_args) { PBL_LOG_FROM_FAULT_HANDLER("\r\n\r\n[UsageFault_Handler!]"); prv_save_debu...
prv_get_fd has already sent an error response return; } uint32_t bytes_read = 0; const unsigned int chunk_size = 128; uint8_t buffer[chunk_size]; uint32_t crc = crc32(0, NULL, 0); while (bytes_read < cmd->crc.length) { uint32_t read_len = MIN(cmd->crc.length - bytes_read, chunk_size); int ret ...
(prv_handle_packet, data)
; } void pulse2_bulkio_link_open_handler(void) { } void pulse2_bulkio_link_closed_handler(void) { for (int i = 0; i < MAX_PULSE_FDS; i++) { if (s_transfer_fds[i].impl) { PulseTransferFD *pulse_fd = &s_transfer_fds[i]; pulse_fd->impl->close_proc(pulse_fd->domain_state); prv_free_fd(i); } ...
dded_pin_uuid); cl_assert(uuid_equal(&added_pin_uuid, &s_last_timeline_item_added->header.id)); AttributeList *pin_attr_list = &s_last_timeline_item_added->attr_list; const uint32_t pin_icon_tiny = attribute_get_uint32(pin_attr_list, AttributeIdIconTiny, 0); cl_assert_equal_i((int)pin_icon_tiny, TIMELINE_RESO...
(s_num_timeline_removes, 6)
; cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); // Second alarm goes off. First one should be up again s_current_hour = 11; s_current_minute = 30; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 2); cl_assert_equal_i(s_num_alarm_events_put, 2); cl_assert_...
bytes(); if (stack_space < LOGGING_MIN_STACK_FOR_SPRINTF) { serial_console_write_log_message(LOGGING_STACK_FULL_MSG); serial_console_write_log_message(" "); return; } char buffer[TIMESTAMP_BUFFER_SIZE]; time_t time_seconds; uint16_t time_ms; rtc_get_time_ms(&time_seconds, &time_ms); struct t...
prompt_send_response_fmt(buffer, 32, "Log level set to: %i", g_pbl_log_level)
; } void command_log_level_get(void) { char buffer[32]; prompt_send_response_fmt(buffer, 32, "Log level: %i", g_pbl_log_level); }
+= TRIG_MAX_ANGLE / 4; } char filename[100]; snprintf(filename, sizeof(filename), "draw_arc_origin_aa_precise_%s_%s_.${BIT_DEPTH_NAME}.pbi", precision_modes[precision_mode], mode_names[mode]); cl_check_(gbitmap_pbi_eq(&ctx.dest_bitmap, filename), filename); center.y.integ...
TO_TRIG(0)
{ .x.raw_value = 8, .y.raw_value = 17 }, { .x.raw_value = 4, .y.raw_value = 16 }, { .x.raw_value = 2,.y.raw_value = 7 } }; memcpy(command->precise_points, points, sizeof(points)); gdraw_command_draw(NULL, command); cl_assert_equal_i(1, s_path_fill_precise_count); cl_assert(prv_compare_points((GP...
(NULL, command)
fer); } //Check that no notifications have been deleted e.header.id = uuids[j]; e.header.timestamp = timestamp + j; cl_assert(notification_storage_get(&uuids[j], &r)); compare_notifications(&e, &r); free(r.allocated_buffer); //Free up enough space for one notification by removing one notification_st...
(attributes)
oid prv_blend_vertical_line_raw(GContext *ctx, int16_t x, int16_t y1, int16_t y2, GColor color) { PBL_ASSERTN(ctx); GBitmap *framebuffer = &ctx->dest_bitmap; #if SCREEN_COLOR_DEPTH_BITS == 8 for (int i = y1; i < y2; i++) { // Skip over pixels outside the bitmap data r...
if (x1.integer <= clip_box_max_x) { graphics_private_raw_blend_color_factor(ctx, output, data_row_offset, color, x1.integer, (uint8_t)x2.fraction); }
// or last AA gradient with blending } else { for (int i = 0; i < right_aa_offset; i++) { if (x1.integer > clip_box_max_x) { break; } graphics_private_raw_blend_color_factor(ctx, output, data_row_offset, color, x1.integer, (uint8_t)(FIXE...
nd_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw4_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, 4); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY, RA...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw2_clip_nxny.${BIT_DEPTH_NAME}.pbi"))
; // SW = 3 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 3); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw3_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_...
&s_sleep_reward_settings)) { s_sleep_reward_settings.enabled = false; // worst-case, we disable the insight } if (!activity_insights_settings_read(ACTIVITY_INSIGHTS_SETTINGS_SLEEP_SUMMARY, &s_sleep_summary_settings)) { s_sleep_summary_settings.enabled = f...
time_util_get_midnight_of(activity_pin_last_state.last_triggered_utc)
== midnight_today) { s_activity_pin_state.uuid = activity_pin_last_state.uuid; // Check if this pin has already been removed if (!timeline_exists(&s_activity_pin_state.uuid)) { s_sleep_pin_state.removed = true; } } } // -------------------------------------------------------------------------...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (s_timer != TIMER_INVALID_ID && !s_app_paused && s_app_started) { bool success = new_timer_start(s_timer, WATCHFACE_TIMEOUT_MS, prv_timeout_expired, NULL, 0 /* flags */); PBL_ASSERTN(success); }
ags_set; static FLASH_Status return_status; uint8_t *flash_written_data; bool *flash_written_flag; void *source_buffer; uint32_t flash_data_start, flash_data_length; bool callback_called; void test_system_flash__initialize(void) { erased_sector = 0; flash_locked = true; flash_flags_set = false; return_status =...
cl_assert(system_flash_write( FLASH_BASE + 10, testdata, sizeof(testdata), callback_is_called_cb, (void *)8675309))
; cl_assert(flash_locked); cl_assert_equal_s(testdata, (const char *)&flash_written_data[10]); assert_flash_unwritten(0, 10); assert_flash_unwritten(10 + sizeof(testdata), 90 - sizeof(testdata)); cl_assert(callback_called); } void test_system_flash__write_error(void) { return_status = FLASH_ERROR_OPERATION...
DITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "board/display.h" #include "drivers/periph_config.h" #include "drivers/gpio.h" #include "drivers/dbgserial.h" #include "util/attributes.h" #include "util...
(DISP_GPIO, DISP_PINSOURCE_SI, GPIO_AF_SPI2)
; // Init display GPIOs GPIO_Init(DISP_GPIO, &s_disp_gpio_init); // Init CS s_disp_gpio_init.GPIO_Mode = GPIO_Mode_OUT; s_disp_gpio_init.GPIO_OType = GPIO_OType_PP; s_disp_gpio_init.GPIO_Pin = DISP_PIN_SCS; GPIO_Init(DISP_GPIO, &s_disp_gpio_init); // Init LCD Control s_disp_gpio_init.GPIO_Mode = GP...
ctly void test_hrm_manager__app_expiration(void) { AppInstallId app_id = 1; const uint16_t expire_s = SECONDS_PER_MINUTE; HRMSessionRef session_ref = sys_hrm_manager_app_subscribe(app_id, 1, expire_s, HRMFeature_BPM); cl_assert(sys_hrm_manager_get_app_subscription(app_id) == session_ref); prv_fake_send_new...
sys_hrm_manager_unsubscribe(session_refs[i])
; cl_assert(prv_get_subscriber_state_from_ref(session_refs[i]) == NULL); cl_assert(prv_get_subscriber_state_from_app_id(PebbleTask_App, app_ids[i]) == NULL); } cl_assert_equal_b(hrm_is_enabled(HRM), false); } void test_hrm_manager__feature_callbacks(void) { const int num_refs = 2; HRMSessionRef session...
-------------------------------- DEFINE_SYSCALL(bool, sys_activity_prefs_heart_rate_is_enabled, void) { return activity_prefs_heart_rate_is_enabled(); } // ------------------------------------------------------------------------------------------------ typedef struct { HealthMinuteData *minute_data; uint32_t *n...
if (enable && !s_activity_state.sample_collection_enabled) { ActivitySampleCollectionData *data = kernel_zalloc_check( sizeof(ActivitySampleCollectionData)); s_activity_state.sample_collection_data = data; data->first_record = true; s_activity_stat...
if (disable && s_activity_state.sample_collection_enabled) { // Finish up the current record s_activity_state.sample_collection_enabled = false; prv_collect_raw_samples(NULL, 0, true /*finish*/); ActivitySampleCollectionData *data = s_activity_state.sample_collection_data; if (data->d...
In order to make them look correct in the way we are using them, we want to // invert the icons so that they are black icon on a white background. // // To do this, load each resource temporarily and then create two new bitmaps. // Then bitblt the original resource into the new bitmap using GCompOpAssignInvert...
(bounds, data->window, &data->menu_section, 1, NULL)
; layer_add_child(window_layer, simple_menu_layer_get_layer(data->menu_layer)); // Set the menu layer back to it's previous highlight position simple_menu_layer_set_selected_index(data->menu_layer, s_menu_position, false); } static void s_main(void) { bt_pairability_use(); MfgMenuAppData *data = app_malloc...
/* * 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; }
*out_length = *iter; *out_str = (const char*) iter + 1; iter += 1 + *out_length; if (iter > iter_end) { PBL_LOG(LOG_LEVEL_WARNING, "Invalid music message"); return NULL; } return iter; } static void prv_update_now_playing_info(CommSession *session, const uint8_t* msg, size_t length) { // Read ...
&s_extra_case_items[1].header.id)); cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_extra_case_items[0].header.id)); cl_assert(!iter_next(&iterator)); } // 11 am void test_timeline__extra_case_none_forwards(void) { prv_insert_extra_case_items(); Iterator iterator = {0}; Ti...
(&iterator)
har *PREF_KEY_SEND_TEXT_APP; #define SEND_TEXT_KEY ((uint8_t *)PREF_KEY_SEND_TEXT_APP) #define SEND_TEXT_KEY_LEN (strlen(PREF_KEY_SEND_TEXT_APP)) #define INVALID_KEY ((uint8_t *)"thisIsNotAnApp") #define INVALID_KEY_LEN strlen((char *)INVALID_KEY) #define NUM_SEND_TEXT_CONTACTS (5) #define SEND_TEXT_DATA_LEN (sizeof(...
(watch_app_prefs_db_insert(WEATHER_KEY, WEATHER_KEY_LEN, s_weather_prefs, (data_len - sizeof(SerializedWeatherAppPrefs))), E_INVALID_ARGUMENT)
; } void test_watch_app_prefs_db__insert_remove(void) { cl_assert_equal_i(watch_app_prefs_db_insert(SEND_TEXT_KEY, SEND_TEXT_KEY_LEN, s_send_text_prefs, sizeof(s_send_text_prefs)), S_SUCCESS); cl_assert_equal_i(watch_app_prefs_db_delete(SEND_TEXT_KEY, SEND_TEXT_KEY_LEN...
cs. to force-boot PRF"); for (int i = 0; i < 5000; ++i) { if (!(button_is_pressed(BUTTON_ID_UP) && button_is_pressed(BUTTON_ID_BACK))) { // stop waiting if not held down any longer return false; } delay_ms(1); } return true; } void *reset_vector, *initial_sp; prv_ge...
(0xbeefcace)
; delay_us(200000); display_error_code(0x0defaced); delay_us(200000); display_error_code(0xd15ea5e5); delay_us(200000); display_error_code(0xdeadbeef); delay_us(200000); display_boot_splash(); delay_us(1000000); } #endif if (is_button_stuck()) { sad_watch(ERROR_STUCK_BUTTON)...
ECONDS_PER_MINUTE); id2 = alarm_create(&(AlarmInfo) { .hour = 11, .minute = 30, .kind = ALARM_KIND_EVERYDAY }); prv_assert_alarm_config(id2, 11, 30, false, ALARM_KIND_EVERYDAY, s_every_day_schedule); cl_assert_equal_i(s_num_timeline_adds, 6); cl_assert_equal_i(s_num_timeline_removes, 0); alarm_get_next_enab...
(s_num_timeline_adds, 3)
; } void test_alarm__recurring_weekends_alarm_timeout_behind(void) { AlarmId id; s_current_hour = 11; s_current_minute = 30; s_current_day = s_saturday; id = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALARM_KIND_WEEKENDS }); prv_assert_alarm_config(id, 10, 30, false, ALARM_KIND_WEEKENDS,...
3 opaque window 0 cl_assert(NumModalPriorities > 3); window_stack_push(window_stacks[3], windows[3][0], false); // An opaque top window of a different stack is now obstructing the transparent top window // Top here throughout means that it is the top window of the window stack it is in // Test: An opaque to...
{ const int num_windows_per_stack = 2; Window *windows[NumModalPriorities][num_windows_per_stack]; WindowStack *window_stacks[NumModalPriorities]; for (ModalPriority idx = ModalPriorityMin; idx < NumModalPriorities; idx++) { window_stacks[idx] = modal_manager_get_window_stack(idx); for (int i = 0; i < ...
// Checks are listed from top to bottom cl_assert_equal_i(windows[2][1]->on_screen, true); cl_assert_equal_i(windows[2][1]->is_click_configured, false); cl_assert_equal_i(windows[2][0]->on_screen, false); cl_assert_equal_i(windows[2][0]->is_click_configured, false); cl_assert_equal_p(s_last_click_configure...
/* * 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...
layer_add_child(&data->window.layer, &data->count_layer.layer)
; text_layer_init(&data->connected_layer, &GRect(0, 20, width, 20)); layer_add_child(&data->window.layer, &data->connected_layer.layer); text_layer_set_text(&data->count_layer, "No Presses"); text_layer_set_text(&data->connected_layer, "No connection event"); // subscribe to the accelerometer event stream ...
d_address) { s_last_driver_allow_cycling = allow_cycling; if (pinned_address) { s_last_driver_addr_is_null = false; s_last_driver_addr = *pinned_address; } else { s_last_driver_addr_is_null = true; memset(&s_last_driver_addr, 0x00, sizeof(s_last_driver_addr)); } return cl_mock_type(void); } B...
bt_local_addr_pause_cycling()
lTransformData *data, GContext *ctx, GPoint offset, 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); ...
{ KinoReelTransformData *data = kino_reel_custom_get_data(reel); if (!data) { return; } if (data->owns_from_reel) { kino_reel_destroy(data->from_reel); } data->from_reel = from_reel; data->owns_from_reel = take_ownership; prv_free_list_copy(data); }
KinoReel *kino_reel_transform_get_from_reel(KinoReel *reel) { KinoReelTransformData *data = kino_reel_custom_get_data(reel); if (data) { return data->from_reel; } return NULL; } void kino_reel_transform_set_to_reel(KinoReel *reel, KinoReel *to_reel, bool take_own...
uuid_equal(&state.pin.header.id, &s_items[4].header.id)
); cl_assert(!iter_prev(&iterator)); timeline_iter_deinit(&iterator, &state, &head); } void test_timeline__skip_deleted_item(void) { Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; timeline_init(&head); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, Ti...
rval = conn->conn_params.conn_interval_1_25ms; } } bt_unlock(); if (is_ppogatt) { *is_ppogatt = tmp_is_ppogatt; } if (conn_interval) { *conn_interval = tmp_conn_interval; } return true; } void analytics_event_put_byte_stats( CommSession *session, bool crc_good, uint8_t type, uint32_...
prv_get_connection_details(session, &is_ppogatt, &conn_interval)
) { return; } AnalyticsEventBlob event_blob = { .event = AnalyticsEvent_GetBytesStats, .get_bytes_stats = { .ppogatt = is_ppogatt, .conn_intvl_1_25ms = MIN(conn_interval, UINT8_MAX), .type = type, .bytes_transferred = bytes_transferred, .elapsed_time_ms = elapsed_time_ms, ...
//! This method returns true if the process is safe to kill (it has exited out of it's main function). If the //! the process is not already safe to kill, it will "prod" it to exit, set a timer, and return false. //! //! The app manager and worker manager MUST call this before they call the code to kill the task and cl...
(LOG_LEVEL_DEBUG, "task is privileged, setting the syscall exit trap")
; bool success = new_timer_start(s_deinit_timer_id, 3 * 1000, prv_force_close_timer_callback, (void*)task, 0 /*flags*/); PBL_ASSERTN(success); } } return false; } // ----------------------------------------------------------------------------------------------------------- // This is...
} // Teardown void test_graphics_context_${BIT_DEPTH_NAME}__cleanup(void) { free(fb); } ///////////////////////////////////// /// TESTS ///////////////////////////////////// void test_graphics_context_${BIT_DEPTH_NAME}__set(void) { GDrawState draw_state; GColor color; // Stroke Color graphics_context_set_s...
graphics_context_get_drawing_state(&context)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ PBL_LOG(LOG_LEVEL_ERROR, "Received error response."); return false; }
*level = response->payload[0]; kernel_free(response); return true; } static void prv_log_string_v1(BinLogMessage_String_v1 *msg) { PBL_LOG(LOG_LEVEL_ALWAYS, "%s", msg->string); } #if PBL_LOGS_HASHED static void prv_log_param_v1(BinLogMessage_Param_v1 *msg) { // HACK ALERT: we want to call a var-args funct...
/* * 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...
{ PromptContext *prompt_context = (PromptContext *)data; // Copy the command and append a NULL so we can print it for debugging purposes char buffer[40]; size_t cropped_length = MIN(sizeof(buffer) - 1, prompt_context->write_index); memcpy(buffer, prompt_context->buffer, cropped_length); buffer[cropped_leng...
void accessory_mfg_mode_start(void) { #ifdef DISABLE_PROMPT return; #else prv_display_prompt(); #endif } bool accessory_mfg_mode_handle_char(char c) { // Note: You're in an interrupt here, be careful #if DISABLE_PROMPT return false; #else if (UNLIKELY(prompt_command_is_executing())) { return ...
{ 776, 48, -536}, { 768, 48, -536}, { 768, 32, -552}, { 760, 32, -560}, { 760, 48, -552}, { 760, 40, -552}, { 768, 32, -552}, { 760, 32, -552}, { 760, 40, -552}, { 760, 24, -552}, { 760, 32, -552}, { 760, 32, -560}, { 760, 32, -552}, { 760, 32, -552}, { 760, 40...
// 83 seconds { 736, 8, -592}, { 736, 8, -592}, { 744, 8, -592}, { 736, 8, -592}, { 736, -8, -576}, { 736, 16, -592}, { 728, 16, -608}, { 728, 16, -608}, { 736, 24, -600}, { 728, 16, -600}, { 728, 24, -608}, { 728, 8, -600}, { 728, 8, -616}, { 728, 8, -608}, ...
{ 720, 8, -624}, { 720, -8, -624}, { 720, 8, -632}, { 720, 0, -624}, // 86 seconds { 712, -8, -608}, { 720, 8, -616}, { 728, 8, -616}, { 728, 0, -608}, { 720, 8, -608}, { 728, -8, -608}, { 736, 16, -608}, { 720, -16, -616}, { 720, 8, -608}, { 736, -24, -616},...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ PBL_LOG(LOG_LEVEL_DEBUG, "deinit timeout expired, killing app forcefully"); PebbleTask task = (PebbleTask)data; process_manager_put_kill_process_event(task, false /*gracefully*/); }
// --------------------------------------------------------------------------------------------- static bool prv_force_stop_task_if_unprivileged(ProcessContext *context) { vTaskSuspend((TaskHandle_t) context->task_handle); uint32_t control_reg = ulTaskDebugGetStackedControl((TaskHandle_t) context->task_handle);...
/* * 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_lock() is still held for us by gap_le_advert s_reconnect_advert_job = NULL; }
static bool prv_is_advertising_for_reconnection(void) { return (s_reconnect_advert_job != NULL); } static ReconnectType prv_current_reconnect_type(void) { if (s_is_hrm_reconnection_enabled) { return ReconnectType_BleHrm; } if (s_is_basic_reconnection_enabled) { return ReconnectType_Plain; } retur...
vent.put_bytes.failed, false); } void test_put_bytes__init_while_already_busy(void) { prv_receive_init(VALID_OBJECT_SIZE, ObjectFirmware); prv_receive_init(VALID_OBJECT_SIZE, ObjectFirmware); assert_nack_count(1); } void test_put_bytes__init_too_large(void) { prv_receive_init(UINT_MAX, ObjectFirmware); // ...
(&put_msg->payload[0], chunk, payload_size)
; prv_receive_data(s_session, buffer, sizeof(buffer)); assert_ack_count(0); assert_nack_count(1); } void test_put_bytes__invalid_session_cookie(void) { prv_receive_init_fw_object(); prv_process_and_reset_test_counters(); const uint8_t chunk[] = { 0xaa, 0xbb, 0xcc }; prv_receive_put(~s_last_response_coo...
{ 48, 32, -992}, { 48, 16, -992}, { 48, 24, -1000}, { 48, 24, -992}, { 56, 24, -1000}, { 56, 24, -992}, { 48, 24, -1000}, { 48, 24, -992}, { 48, 16, -1000}, { 48, 24, -992}, { 48, 24, -992}, { 56, 24, -1000}, { 48, 24, -1000}, { 56, 24, -1000}, { 56, 32, -1000}, ...
{ 48, 24, -1000}, { 56, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 56, 24, -1000}, { 48, 32, -1000}, { 56, 32, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 56, 24, -1000}, { 56, 24, -1000}, { 56, 32, -1000}, { 48, 24...
{ 48, 24, -1000}, { 48, 24, -1008}, { 48, 24, -1000}, { 56, 24, -1000}, { 56, 24, -1000}, { 48, 24, -1000}, { 56, 16, -1000}, { 48, 40, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 56, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 56, 2...
/* * 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...
dbgserial_enable_rx_exti()
; } void dbgserial_enable_rx_exti(void) { exti_enable(BOARD_CONFIG.dbgserial_int); } void dbgserial_register_character_callback(DbgSerialCharacterCallback callback) { s_character_callback = callback; } // This callback gets installed by dbgserial_interrupt_handler() // using system_task_add_callback_from_isr(). ...
prv_file_each(bt_persistent_storage_bt_classic_pairing_for_each_itr, &itr_data)
; } void analytics_external_collect_bt_pairing_info(void) { unsigned int ble_pairings_count = prv_get_num_pairings_by_type(BtPersistBondingTypeBTClassic); analytics_set(ANALYTICS_DEVICE_METRIC_BT_PAIRING_RECORDS_COUNT, ble_pairings_count, AnalyticsClient_System); } //////////////////////////////...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_LOG(LOG_LEVEL_ERROR, "Load Data Crc. Expected: 0x%x Received CRC: 0x%x", (int)expected_crc, (int)received_crc)
; } return (received_crc == expected_crc); } static bool prv_send_vt(const uint8_t *vt, uint32_t vt_size_bytes) { uint8_t vt_write[] = {'V', 'T'}; dialog_spi_transmit_data(vt_write, sizeof(vt_write)); uint8_t entries = vt_size_bytes / 4; dialog_spi_transmit_data((uint8_t *)&entries, sizeof(entries)); d...
distance should always be at 0 cl_assert_equal_i(prv_last_update_distance(a), 0); // Destroy it animation_destroy(a); #endif } // -------------------------------------------------------------------------------------- // Test a simple sequence animation void test_animation__simple_sequence(void) { #ifdef TEST_...
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1)
r, 80, "R2 = 0x%x", stacked_r2); PBL_LOG_FROM_FAULT_HANDLER_FMT(buffer, 80, "R3 = 0x%x", stacked_r3); PBL_LOG_FROM_FAULT_HANDLER_FMT(buffer, 80, "R12 = 0x%x", stacked_r12); PBL_LOG_FROM_FAULT_HANDLER_FMT(buffer, 80, "SP = %p", &stacked_args[8]); PBL_LOG_FROM_FAULT_HANDLER_FMT( buffer, 80, "LR [R14] = 0x%x...
PBL_LOG_FROM_FAULT_HANDLER("\r\n\r\n[Hard fault handler - You dun goofed]")
; PBL_LOG_FROM_FAULT_HANDLER_FMT( buffer, 80, "SHCSR (System Handler) = 0x%"PRIx32, SCB->SHCSR); PBL_LOG_FROM_FAULT_HANDLER_FMT( buffer, 80, "HFSR (Hard Fault) = 0x%"PRIx32, SCB->HFSR); PBL_LOG_FROM_FAULT_HANDLER_FMT( buffer, 80, " Forced = %s", bool_to_str(SCB->HFSR & SCB_HFSR_FO...
_send_event_to_process(PebbleTask task, PebbleEvent *e) { cl_assert(task == PebbleTask_App); cl_assert(e->type == PEBBLE_SMARTSTRAP_EVENT); cl_assert(s_event_handler); s_event_handler(e, NULL); return true; } void smartstrap_cancel_send(void) { } // Helper functions static void prv_prepare_for_did_read(Sma...
assert_result_invalid(app_smartstrap_attribute_read(NULL))
; // destroy test attribute app_smartstrap_attribute_destroy(attr); } void test_app_smartstrap__check_ids(void) { // craete an attribute SmartstrapAttribute *attr = app_smartstrap_attribute_create(0x1111, 0x2222, 100); cl_assert(attr != NULL); // verify the ids cl_assert(app_smartstrap_attribute_get_se...
PutBytesObjectType type; uint32_t index; } s_ready_to_install[NumObjects]; static SemaphoreHandle_t s_pb_semaphore; //! Marks that the receiver state is now free to use static void prv_receiver_reset(void); static void prv_send_response(ResponseCode code, uint32_t token); static void prv_lock_pb_job_state(void) ...
{ PBL_LOG(LOG_LEVEL_ERROR, "Not enough memory to service PB request, abort!"); prv_deinit_put_job_queue(); return false; }
if (i == 1) { PBL_LOG(LOG_LEVEL_INFO, "Not enough memory for PB pre-ack, falling back to legacy mode"); put_jobs->enable_preack = false; break; } else { break; } } put_jobs->job[i].buffer = buffer; } put_jobs->num_allocated_pb_jobs = i; return true; } static v...
atic char *prv_translate_error(AppMessageResult result) { switch (result) { case APP_MSG_OK: return "APP_MSG_OK"; case APP_MSG_SEND_TIMEOUT: return "APP_MSG_SEND_TIMEOUT"; case APP_MSG_SEND_REJECTED: return "APP_MSG_SEND_REJECTED"; case APP_MSG_NOT_CONNECTED: return "APP_MSG_NOT_CONNECTED"; case A...
{ led_current = hrm->led.current_ua; }
t\tOnly report tests that had an error\n"); printf(" -Q \t\tQuit as soon as a test fails\n"); printf(" -l \t\tPrint suite, category, and test names\n"); printf(" -tXX\t\tRun a specifc test by name\n"); exit(-1); } static void clar_parse_args(int argc, char **argv) { int i; for (i = 1; i < argc; ++i) ...
(argc, argv)
ker); load_fixture_on_pfs(APP1_WORKER_FIXTURE_NAME, filename_buf); resource_storage_get_file_name(filename_buf, sizeof(filename_buf), 1); load_fixture_on_pfs(APP1_RESOURCES_FIXTURE_NAME, filename_buf); // simulate installing app2 on flash app_db_insert((uint8_t *)&menu_layer.uuid, sizeof(Uuid), (uint8_t *)&m...
(true, app_install_get_uuid_for_install_id(tictoc_id, &uuid))
onst int16_t icon_text_horizontal_spacing = 4; const int16_t window_bounds_width = window_get_root_layer(&data->window)->bounds.size.w; const int16_t title_width = status_layer_get_title_text_width(&data->status_layer); const int16_t status_offset = (icon_rect.size.w + icon_text_horizontal_spacing) / 2; new_s...
layer_set_hidden((Layer *)&data->action_button_layer, true)
; // Ideally this gets moved into the status layer in the future. See data struct comment gbitmap_init_with_resource(&data->dnd_icon, RESOURCE_ID_QUIET_TIME_STATUS_BAR); // actual frame of the icon layer is calculated in prv_set_dnd_icon_visible() layer_init(&data->dnd_icon_layer, &GRectZero); layer_set_upd...
graphics_fill_rect(&context, &GRect(10, 20, 40, 10)); ASSERT_CALLED(prv_fill_rect_non_aa(&context, &GRect(10, 20, 40, 10), 0, GCornerNone, GColorBlack)); setup_test(&context, false, 5, GColorBlack, GColorBlack, false); graphics_fill_circle(&context, GPoint(50, 50), 10); ASSERT_CALLED(graphics_circle_fill_non_...
setup_test(&context, true, 2, GColorBlack, GColorBlack, true)
; ASSERT_NO_CHANGE(graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10))); ASSERT_NO_CHANGE(graphics_draw_rect(&context, &GRect(10, 20, 40, 10))); ASSERT_NO_CHANGE(graphics_draw_circle(&context, GPoint(50, 50), 10)); ASSERT_NO_CHANGE(graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4)); setup_...
; uint8_t bg_color_index; } AppData; static void set_text_element(TextLayer *text_layer, char *text_buffer, bool highlight) { GFont font = fonts_get_system_font(FONT_KEY_GOTHIC_14_BOLD); text_layer_set_font(text_layer, font); if (highlight) { text_layer_set_background_color(text_layer, GColorWhite); te...
graphics_draw_pixel(ctx, GPoint(point.x + 1, point.y + 1))
; } else if (alpha == ALPHA_0) { graphics_context_set_stroke_color(ctx, bg_color); graphics_draw_pixel(ctx, point); graphics_draw_pixel(ctx, GPoint(point.x + 1, point.y)); graphics_draw_pixel(ctx, GPoint(point.x, point.y + 1)); graphics_draw_pixel(ctx, GPoint(point.x + 1, point.y + 1)); } } sta...
seTimeState granted_state); // Stubs ///// bool gap_le_connection_is_valid(const GAPLEConnection *conn) { return (conn != NULL); } GAPLEConnection *gap_le_connection_any(void) { return NULL; } void prv_regular_timer_spend_seconds(uint32_t seconds) { for (uint32_t i = 0; i < seconds; ++i) { fake_rtc_increme...
cl_assert_equal_i(state, ResponseTimeMin)
/* * 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%s\n", prefix, _clar_categorize_enabled.names[i])
; } static int clar_category_is_suite_enabled(const struct clar_suite *suite) { const char **scan; if (!_clar_categorize_enabled.count) clar_category_enable(CLAR_CATEGORY_DEFAULT); if (!suite->categories) return clar_category_in_list( &_clar_categorize_enabled, CLAR_CATEGORY_DEFAULT); for (scan = suite->...
keys[2] = { {{0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16}}, {{0x21, 0x22, 0x23, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x11, 0x12, 0x13, 0x24, 0x25, 0x26}}, }; SM128BitKey keys_out[2]; bt_persistent_storage_set_root_keys(keys); bt_persistent_storage_get_root...
bt_persistent_storage_get_ble_pairing_by_id(id_4, NULL, NULL, NULL)
; cl_assert(!ret); } // Test to make sure we don't accidentally change the serialized data formats. void test_bluetooth_persistent_storage__ble_serialized_data(void) { #if UNITTEST_BT_PERSISTENT_STORAGE_VERSION == 1 //0000 01 00 69 50 68 6f 6e 65 20 4d 61 72 74 79 00 00 ..iPhone Marty.. //0010 00 00 00 00...