prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
-------------- // Sample captured: 2015-10-09 10:36:50 local AccelRawData *activity_sample_walk_100_temp_95861_4(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_temp_95861_4 //> TEST_EXPECTED 100 //> TEST_EXPECTED_MIN 80 //> TEST_EXPECTED_MAX 120 //> TE...
{ -80, 288, -1256}, { -8, 344, -1144}, { 40, 280, -984}, { 80, 272, -944}, { 88, 184, -832}, { 8, 120, -744}, { -56, 64, -744}, // 5 seconds { -112, -24, -776}, { -80, -16, -944}, { -120, -24, -1080}, { -216, -48, -1256}, { -200, 72, -1312}, { -296, 104, -1336}, ...
{ -232, 560, -1288}, { -160, 408, -1032}, { -176, 456, -952}, { -128, 320, -776}, { -72, 136, -576}, { -96, 232, -624}, { -128, 352, -760}, { -152, 392, -840}, { -144, 496, -992}, { -208, 664, -1216}, { -96, 616, -1176}, { -104, 648, -1184}, { -16, 672, -1184}, {...
// 180: Local time: 2016-03-01 11:05:00 PM { 0, 0x18, 0, 149, 0}, { 0, 0x18, 0, 148, 0}, { 0, 0x18, 0, 149, 0}, { 0, 0x18, 0, 148, 0}, { 0, 0x18, 0, 148, 0}, { 0, 0x18, 0, 149, 0}, { 0, 0x18, 0, 148, 0}, { 0, 0x18, 0, 149, 0}, { 0, 0x18, 0, 148, 0}, { 0, 0x18, 0, 145, 0}, { ...
{ 0, 0x7d, 0, 149, 0}, { 0, 0x7d, 0, 133, 0}, { 0, 0x7d, 0, 149, 0}, { 0, 0x7d, 0, 149, 0}, { 0, 0x7d, 0, 149, 0}, { 0, 0x7d, 0, 150, 0}, { 0, 0x7d, 0, 146, 0}, { 0, 0x7d, 0, 149, 0}, { 0, 0x7d, 0, 149, 0}, { 0, 0x7d, 0, 149, 0}, { 0, 0x7d, 0, 149, 0}, { 0, 0x7c, 889, 147...
{ 0, 0x74, 0, 148, 0}, { 0, 0x74, 0, 148, 0}, { 0, 0x74, 0, 148, 0}, { 0, 0x74, 0, 144, 0}, // 345: Local time: 2016-03-02 01:50:00 AM { 0, 0x74, 0, 148, 0}, { 0, 0x74, 0, 148, 0}, { 0, 0x74, 0, 148, 0}, { 0, 0x74, 0, 148, 0}, { 0, 0x74, 0, 146, 0}, { 0, 0x7f, 604, 148, 0}, ...
; // Timer will go off at 00:00 on Monday. (46.5 hours) cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 167400 * MS_PER_SECOND); rtc_set_time(s_thursday_00_00); do_not_disturb_handle_clock_change(); active = do_not_disturb_is_active(); cl_assert(active == true); // Timer will go off at 07:0...
// Timer will go off at 01:00 on Sunday. (14 hours) cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 50400 * MS_PER_SECOND); rtc_set_time(s_sunday_23_30); do_not_disturb_handle_clock_change(); active = do_not_disturb_is_active(); cl_assert(active == false); // Timer will go off at 00:00 on M...
PBL_LOG(LOG_LEVEL_ERROR, "Put bytes failure")
; error = AppFetchResultPutBytesFailure; } prv_cleanup(error); goto finally; } if (pb_event->type == PebblePutBytesEventTypeInitTimeout) { PBL_LOG(LOG_LEVEL_WARNING, "Timed out waiting for putbytes request from phone"); prv_cleanup(AppFetchResultTimeoutError); } // If this is an obj...
///// void test_stringlist__initialize(void) { } void test_stringlist__cleanup(void) { } // Tests //////////////////////////////////////////////////////////////// void test_stringlist__test(void) { StringList *list = malloc(20); memset(list, 0, 20); // no data list->serialized_byte_length = 0; cl_assert_e...
string_list_add_string(list, 20, "foobar", 3)
; cl_assert_equal_i(15, list->serialized_byte_length); cl_assert_equal_i(3, string_list_count(list)); cl_assert_equal_s("foo", string_list_get_at(list, 2)); // truncated because of the max list size string_list_add_string(list, 20, "abc", 10); cl_assert_equal_i(17, list->serialized_byte_length); cl_asser...
We may decline // the change and therefore we don't want it to visually update yet. prv_worker_launch_handler // will update the choice if it fires. option_menu_set_choice(&data->option_menu, prv_get_chosen_row_index(data)); // Switching to a different worker, display confirmation dialog ...
app_menu_data_source_deinit(data->data_source)
; app_free(data->data_source); data->data_source = NULL; option_menu_deinit(&data->option_menu); i18n_free_all(data); app_free(data); } static Window *prv_init(void) { SettingsActivityTrackerData *data = app_zalloc_check(sizeof(SettingsActivityTrackerData)); const OptionMenuCallbacks option_menu_call...
/* * 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_sdk_version, old_style_heap_corruption_version)
< 0) { // They're using 3.2 SDK or older, just let them off with a log message. heap_set_corruption_handler(heap, prv_warn_on_heap_corruption); } else { heap_set_corruption_handler(heap, prv_croak_on_heap_corruption); } }
ristic, (const uint8_t *)s_client_reset_complete, s_client_reset_complete_size, BLEGATTErrorSuccess); } static const uint8_t s_short_data_fragment[] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, }; static void prv_receive_short_data_fragment(BLECharacteristic characterist...
(ppogatt_client_count(), 0)
; cl_assert_equal_i(regular_timer_seconds_count(), 0); regular_timer_deinit(); fake_gatt_client_op_deinit(); fake_gatt_client_subscriptions_deinit(); // Check for leaks: fake_pbl_malloc_check_net_allocs(); fake_pbl_malloc_clear_tracking(); fake_comm_session_cleanup(); free(s_client_reset_request); ...
specific language governing permissions and * limitations under the License. */ #include "kino_reel.h" #include "kino_reel_custom.h" #include "kino_reel_pdci.h" #include "kino_reel_pdcs.h" #include "kino_reel_gbitmap.h" #include "kino_reel_gbitmap_sequence.h" #include "applib/graphics/gdraw_command.h" #include "ap...
{ return reel->impl->get_gbitmap(reel); }
return NULL; } GBitmapSequence* kino_reel_get_gbitmap_sequence(KinoReel *reel) { if (reel && reel->impl->get_gbitmap_sequence) { return reel->impl->get_gbitmap_sequence(reel); } return NULL; } KinoReelType kino_reel_get_type(KinoReel *reel) { if (reel) { return reel->impl->reel_type; } retur...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ graphics_context_set_stroke_color(ctx, GColorWhite); graphics_context_set_stroke_width(ctx, 10); graphics_context_set_antialiased(ctx, false); graphics_draw_line(ctx, GPoint(5, 35), GPoint(45, 40)); }
void clear_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorClear); graphics_context_set_stroke_width(ctx, 10); graphics_context_set_antialiased(ctx, false); graphics_draw_line(ctx, GPoint(5, 35), GPoint(45, 40)); } void across_x_layer_update_callback(Layer* me, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(point, from, to)
1b whoami byte 0x%x, expecting 0x11", chip_id); } return found; } static void prv_set_sd1_voltage(void) { // STM32F4 running at 1.76V may trigger a Power Down Reset (PDR). The power supply has a // tolerance of 3%. Set the voltage rail to 1.825V so our theoretical minimum should be 1.77V uint8_t sd1_vsel; ...
if (!prv_read_register(PmicRegisters_CHARGE_STATUS_1, &status)) { #if defined (TARGET_QEMU) // NOTE: When running on QEMU, i2c reads return false. For now, just assume a failed // i2c read means we are charging return true; #else PBL_LOG(LOG_LEVEL_DEBUG, "Failed to read charging status 1 register."); ...
tingsFile file; cl_must_pass(settings_file_open(&file, "test_file_zero_length", 4096)); uint8_t key[4]; int key_len = sizeof(key) - 1; memcpy(key, "key", sizeof(key)); uint8_t val[4]; int val_len = sizeof(val) - 1; memcpy(val, "val", sizeof(val)); set_and_verify(&file, key, key_len, val, val_len); s...
(&file, key, key_len, val, val_len)
; // setting a byte to all 0s should work settings_file_set_byte(&file, key, key_len, 2, 0x00); val[2] &= 0x00; verify(&file, key, key_len, val, val_len); // setting all 1s should do nothing - only reset bytes are applied settings_file_set_byte(&file, key, key_len, 2, 0xff); val[2] &= 0xff; verify(&fi...
ard.delta_step_layer)); // "Tracking disabled" message data->steps_card.msg_layer = text_layer_create(root_bounds); text_layer_set_text_alignment(data->steps_card.msg_layer, GTextAlignmentCenter); text_layer_set_font(data->steps_card.msg_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOL...
(window_layer)
; data->results_card.text_layer = text_layer_create(root_bounds); text_layer_set_text_alignment(data->results_card.text_layer, GTextAlignmentCenter); text_layer_set_background_color(data->results_card.text_layer, GColorClear); text_layer_set_font(data->results_card.text_layer, fonts_get_s...
orBlack, false); graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4); #if PBL_COLOR ASSERT_CALLED(prv_draw_round_rect_aa_stroked(&context, &GRect(20, 80, 40, 10), 4, SW_EVEN)); #else ASSERT_CALLED(prv_draw_round_rect_stroked(&context, &GRect(20, 80, 40, 10), 4, SW_EVEN)); #endif } void test_graphics_co...
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_test(&context, false, 2, GColorBlack, GColorBlack, true); ASSERT_NO_CHANGE(graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10))); ASSERT_NO_CHA...
move_info->num_characteristics; service_remove_info = (PebbleBLEGATTClientServiceHandles *)&service_remove_info->char_and_desc_handles[num_hdls]; } } static void prv_handle_all_services_invalidated(void) { for (int c = 0; c < KernelLEClientNum; c++) { const KernelLEClient * const client = &s_client...
client->can_handle_characteristic(characteristic)
) { return client; } } return NULL; } typedef void (*ConsumeFuncPtr)(BLECharacteristic characteristic_ref, uint8_t *value_out, uint16_t value_length, GAPLEClient client); typedef void (*ReadNotifyHandler)(BLECharacteristic characteristic, const uint8_t *value, ...
prv_last_handler_entry(&s_started_handler_calls, b3)->fire_order); first_fire_b = MIN(first_fire_b, prv_last_handler_entry(&s_started_handler_calls, spawn_b)->fire_order); cl_assert(last_fire_a < first_fire_b); cl_assert_equal_i(prv_count_animations(), 0); } // --------------------...
prv_count_handler_entries(&s_stopped_handler_calls, b)
yInsightType type) { s_activity_activation_delay_insight_bitmask |= (1 << type); } static int s_health_app_opened_version = 0; uint8_t activity_prefs_get_health_app_opened_version(void) { return s_health_app_opened_version; } ActivityScalarStore activity_metrics_prv_steps_per_minute(void) { return s_data.steps...
(&s_data.metric_history[ActivityMetricStepCount], sparse_history, sizeof(sparse_history))
; prv_calculate_metric_history_stats(ActivityMetricStepCount, &stats); cl_assert_equal_i(stats.median, 4277); cl_assert_equal_i(stats.total_days, 16); cl_assert_equal_i(stats.consecutive_days, 3); } // --------------------------------------------------------------------------------------- // Test that the slee...
/* * 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...
(g_task_handles[task])
; } void analytics_external_collect_stack_free(void) { analytics_set(ANALYTICS_DEVICE_METRIC_STACK_FREE_KERNEL_MAIN, prv_task_get_stack_free(PebbleTask_KernelMain), AnalyticsClient_System); analytics_set(ANALYTICS_DEVICE_METRIC_STACK_FREE_KERNEL_BACKGROUND, prv_task_get_stack_free(PebbleTask_KernelBackgrou...
i18n_noop("SPEED (KM/H)")); #endif case WorkoutMetricType_Distance: #if PBL_RECT /// Distance Label return i18n_noop("DISTANCE"); #else /// Distance Label with units return active_window->workout_controller->get_distance_string(i18n_noop("DISTANCE (MI)"), ...
(buffer_size, number_font, TEXT_COLOR, container)
; active_window->workout_controller->metric_to_string(metric_type, (char *) number_text_node->text, buffer_size, i18n_owner, active_window->...
*/ #include "applib/graphics/gtypes.h" #include "clar.h" #include "pebble_asserts.h" #include <stdio.h> // stubs #include "stubs_process_manager.h" #include "stubs_passert.h" #include "stubs_app_state.h" #include "stubs_heap.h" ///////////////////////////// void test_gtypes__gpoint_scale_by_gsize(void) { GSiz...
(1, PBL_IF_RECT_ELSE(1,2))
; #elif defined(PLATFORM_SPALDING) cl_assert_equal_i(2, PBL_IF_RECT_ELSE(1,2)); #else #error "unknown platform" #endif } void test_gtypes__pbl_if_round_else(void) { #if defined(PLATFORM_TINTIN) cl_assert_equal_i(2, PBL_IF_ROUND_ELSE(1,2)); #elif defined(PLATFORM_SNOWY) cl_assert_equal_i(2, PBL_IF_ROUND_ELSE(1,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...
(structured_glance)
(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw3_clip_xy.${BIT_DEPTH_NAME}.pbi"))
; setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, false, 3); graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw3_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // TODO: Fix offset calculation and re...
s_fifo_is_enabled = use_fifo; } //////////////////////////////////////////////////////////////////////////////// // Shake Detection //////////////////////////////////////////////////////////////////////////////// static void prv_enable_shake_detection(void) { bma255_write_register(BMA255Register_INT_EN_0, BMA255_...
prv_soft_reset()
; bma255_set_scale(BMA255Scale_4G); // Negative axis bma255_write_register(BMA255Register_PMU_SELFTEST, axis_bits | SELFTEST_SIGN_NEGATIVE); psleep(50); uint8_t new_negative; int16_t negative = prv_read_axis(axis, &new_negative); negative = prv_raw_to_mgs(negative); prv_soft_reset(); int delta = po...
on->storage.num_bytes/2, min_delta_size); if (dls_storage_consume(session, consume_bytes) < 0) { // We failed to lop off the used bytes goto exit; } // Reallocate which removes the consumed bytes from the beginning of the file. if (!prv_realloc_storage(session, file_size)) { goto exit; } // Re-...
{ tmp_buf = kernel_malloc(max_chunk_size); if (tmp_buf) { break; } if (max_chunk_size < 256) { PBL_LOG(LOG_LEVEL_ERROR, "Not enough memory for reallocation"); goto exit; } max_chunk_size /= 2; }
int32_t bytes_to_copy = session->storage.num_bytes; while (bytes_to_copy) { uint32_t new_read_offset; int32_t bytes_read = dls_storage_read(session, tmp_buf, MIN(max_chunk_size, bytes_to_copy), &new_read_offset); if (bytes_read <= 0) { goto exit; } ...
ic const GRect page_frame_on_screen = { .origin = { 0, STATUS_BAR_LAYER_HEIGHT }, .size = { DISP_COLS, DISP_ROWS - STATUS_BAR_LAYER_HEIGHT - LAYOUT_ARROW_HEIGHT } }; static const GTextNodeDrawConfig config = { .page_frame = &page_frame_on_screen, .origin_on_screen = &page_frame_on_screen.origin, ...
(&notification_layout->icon_layer)
; task_free(notification_layout); } static void prv_layout_init(NotificationLayout *layout, const LayoutLayerConfig *config) { NotificationLayoutInfo *layout_info = config->context; static const LayoutLayerImpl s_layout_layer_impl = { .size_getter = prv_layout_get_content_size, .destructor = prv_layout_d...
{ 1040, 408, -216}, { 1160, 544, -272}, { 1192, 632, -280}, { 1056, 720, -400}, { 920, 832, -424}, { 872, 648, -344}, { 1152, 808, -304}, // 20 seconds { 1024, 728, -176}, { 1144, 528, -216}, { 1216, 544, -192}, { 1096, 360, -168}, { 944, 256, -128}, { 928, 280, -...
{ 1160, 176, -144}, { 1040, 128, -144}, { 1032, 176, -208}, { 896, 88, -184}, { 544, -96, -168}, { 864, -80, -104}, { 872, 16, -352}, { 1368, 200, -464}, { 1440, 256, -416}, { 1152, 264, -272}, { 1032, 384, -256}, { 1096, 392, -168}, { 1136, 504, -136}, { 1192, 6...
s_prepare_count, 1); } void test_session_receive_router__unhandled_endpoint(void) { // Expect "Unhandled" meta message to be replied to a message for an unknown endpoint. // The message should get eaten and not interfere with whatever comes next. // Length: 1, Endpoint ID: NON_EXISTENT_ENDPOINT_ID, Payload: 0x5...
cl_assert_equal_i(s_finish_count, 1)
USCMD_REG = 0x0; QSPIC->QSPIC_CHCKERASE_REG = 0x0; QSPIC->QSPIC_GP_REG = 0x0; QSPIC->QSPIC_UCODE_START = 0x0; GPREG->PLL_SYS_CTRL1_REG = 0x100; GPREG->PLL_SYS_CTRL2_REG = 0x2006; GPREG->PLL_SYS_CTRL3_REG = 0x3c09; GPREG->PLL_SYS_TEST_REG = 0x70; CACHE->CACHE_CTRL1_REG = 0x0; CACHE->CACHE_LNSIZECFG_REG...
REG_SETF(DCDC, DCDC_RET_1_REG, DCDC_V14_RET_CYCLES, 0x2)
; REG_SETF(DCDC, DCDC_RET_1_REG, DCDC_V14_CUR_LIM_RET, 0x6); REG_SETF(DCDC, DCDC_TRIM_REG, DCDC_P_COMP_MAN_TRIM, 0x0); REG_SETF(DCDC, DCDC_TRIM_REG, DCDC_P_COMP_TRIM, 0x0); REG_SETF(DCDC, DCDC_TRIM_REG, DCDC_N_COMP_MAN_TRIM, 0x0); REG_SETF(DCDC, DCDC_TRIM_REG, DCDC_N_COMP_TRIM, 0x0); REG_SETF(DCDC, DCDC_T...
e "util/attributes.h" #include "util/net.h" #include <stdint.h> // general constants for the controller #define INIT_TIMEOUT_S (1) // definition of active region on touch panel #define MIN_RAW_X (220) #define MAX_RAW_X (820) #define MIN_RAW_Y (120) #define MAX_RAW_Y (820) // packet ids #define PACKET_ID_STATUS_RESP...
PBL_ASSERTN(response.packet_id == PACKET_ID_STATUS_RESPONSE)
; // TODO: remove this assert and footer ones below once we're sure the controller FW is stable PBL_ASSERTN(response.padding == MESSAGE_PADDING); // What follows is some rather hacky code to get the data into a nice and neat integer. // More info: https://pebbletechnology.atlassian.net/wiki/display/PRODUCT/Ela...
ed_handler_calls, d), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, spawn), 1); #endif } void prv_update_unschedule_all_handler(Animation *animation, const AnimationProgress distance) { prv_add_handler_entry(&s_update_handler_calls, animation, false, (void *)(ui...
animation_schedule(c)
; prv_advance_to_ms_with_timers(start_ms + duration_a + 2 * MIN_FRAME_INTERVAL_MS); animation_destroy(a); animation_destroy(b); animation_destroy(c); } // -------------------------------------------------------------------------------------- // Test unscheduling animations arbitrarily in a stopped handler wi...
considered "valid" res_info->res_id = s_test_state.resource_is_valid ? 1337 : 0; } // Stubs //////////////////////////////////////////////////////////////// #include "stubs_app_cache.h" #include "stubs_app_install_manager.h" #include "stubs_app_state.h" #include "stubs_events.h" #include "stubs_event_service_clien...
(app_glance_add_slice(session, slice), APP_GLANCE_RESULT_SUCCESS)
; num_slices_added++; // Check that adding a slice with an invalid icon fails s_test_state.resource_is_valid = false; slice = (AppGlanceSlice) { .expiration_time = APP_GLANCE_SLICE_NO_EXPIRATION, .layout.icon = RESOURCE_ID_SETTINGS_ICON_AIRPLANE, .layout.subtitle_template_string = "Test subtitle", ...
Instead we write them to this //! circular buffer and flush them out when the ISR is completed. static CircularBuffer s_isr_log_buffer; //! Underlying storage for s_isr_log_buffer static uint8_t s_isr_log_buffer_storage[256]; static uint64_t prv_get_timestamp_ms(void) { time_t time_s; uint16_t time_ms; rtc_ge...
(&contents->message, message_length)
; pulse_push_send(contents, header_length + message_length); } } } static void prv_enqueue_log_message(uint8_t log_level, const char *message) { const bool buffer_was_empty = (circular_buffer_get_read_space_remaining(&s_isr_log_buffer) == 0); // Need to prevent other interrupts from corrupting the lo...
ervice discovery has finished in the mean time, disconnected, ...) fake_gatt_set_stop_return_value(BTGATT_ERROR_INVALID_PARAMETER); // Fire the watchdog timer: const TimerID watchdog_timer = bt_driver_gatt_get_watchdog_timer_id(); stub_new_timer_fire(watchdog_timer); // No event should be generated, because...
gap_le_connection_by_device(&device)
; ATTHandleRange range = { .start = 0x1, .end = 0x3000 }; ATTHandleRange range_alt = { .start = 0x3001, .end = 0x4000 }; cl_assert_equal_b(fake_gatt_is_service_discovery_running(), false); // start a discovery job, pretend nothing is found gatt_client_discovery_discover_range(connection...
_driver_gap_le_disconnect(const BTDeviceInternal *peer_address) { return 0; } uint16_t gap_le_connection_get_gatt_mtu(const BTDeviceInternal *device) { return s_mtu_size; } GAPLEConnection *gap_le_connection_get_gateway(void) { return NULL; } GAPLEConnection *gatt_client_characteristic_get_connection(BLECharac...
(s_client_reset_complete_size)
animation_h); } AnimationPrivate *animation = prv_find_animation_by_handle(NULL, animation_h, false /*quiet*/); if (!animation) { return NULL; } return (animation->curve == curve) ? animation->custom_function : NULL; } // ---------------------------------------------------------------------------------...
(!animation_private_using_legacy_2(state))
; AnimationPrivate *animation = prv_find_animation_by_handle(state, animation_h, false /*quiet*/); if (!animation) { return false; } if (animation->play_count == ANIMATION_PLAY_COUNT_INFINITE_STORED) { return ANIMATION_PLAY_COUNT_INFINITE; } else { return animation->play_count; } } // -------...
de "stubs_music.h" #include "stubs_mutex.h" #include "stubs_notification_storage.h" #include "stubs_passert.h" #include "stubs_pebble_process_info.h" #include "stubs_pebble_tasks.h" #include "stubs_pbl_malloc.h" #include "stubs_prompt.h" #include "stubs_serial.h" #include "stubs_session.h" #include "stubs_sleep.h" #inc...
(&s_ctx.dest_bitmap, TEST_PBI_FILE)
); } void test_launcher_menu_layer__no_icon(void) { prv_render_launcher_menu_layer(LauncherMenuLayerTestApp_NoIcon); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_launcher_menu_layer__interior_app(void) { prv_render_launcher_menu_layer(LauncherMenuLayerTestApp_InteriorApp); cl_check...
imestamp_update_count = 0; s_process_md.allow_js = false; PebbleProtocolHeader *header = (PebbleProtocolHeader *)TEST_EXPECTED_PP_MSG; header->length = htons(sizeof(TEST_PAYLOAD)); header->endpoint_id = htons(ALLOWED_ENDPOINT_ID); memcpy(TEST_EXPECTED_PP_MSG + sizeof(*header), TEST_PAYLOAD, sizeof(TEST_PAYL...
app_free(outbox_data)
; } // Tests that exercise interface towards the Send Queue //////////////////////////////////////////////////////////////////////////////////////////////////// void test_app_message_sender__freed_but_not_sent_entirely(void) { AppMessageAppOutboxData *outbox_data = prv_create_and_send_outbox_message(NULL /* a...
GTextAlignmentCenter, NULL); return; } else { // row highlighted and no days selected new_resource_id = RESOURCE_ID_CHECKMARK_ICON_DOTTED; } } } if (new_resource_id != data->current_checkmark_icon_resource_id) { data->current_checkmark_ico...
(bounds, 0, STATUS_BAR_LAYER_HEIGHT)
; #endif menu_layer_init(&data->custom_day_picker_menu_layer, &bounds); menu_layer_set_callbacks(&data->custom_day_picker_menu_layer, data, &(MenuLayerCallbacks) { .get_num_sections = prv_custom_day_picker_get_num_sections, .get_num_rows = prv_custom_day_picker_get_num_rows, .get_cell_height = prv_custo...
2; rv = pfs_write(fd, &buf[off], sizeof(buf) - off); cl_assert(rv == (sizeof(buf) - off)); rv = pfs_seek(fd, 0, FSeekSet); cl_assert(rv == 0); memset(buf, 0x00, sizeof(buf)); uint8_t bigbuf[11]; rv = pfs_write(fd, bigbuf, sizeof(bigbuf)); cl_assert(rv == E_RANGE); rv = pfs_read(fd, buf, sizeof(buf)...
(fname, OP_FLAG_WRITE, FILE_TYPE_STATIC, 10 * 1024)
console/prompt.h" #include "kernel/pbl_malloc.h" #include "os/mutex.h" #include "services/common/analytics/analytics.h" #include "services/common/bluetooth/pairability.h" #include "services/common/bluetooth/local_addr.h" #include "services/common/shared_prf_storage/shared_prf_storage.h" #include "services/common/system...
mutex_unlock(s_db_mutex)
; } static bool prv_bt_persistent_storage_get_ble_smpairinginfo_by_id( BTBondingID bonding, SMPairingInfo *info_out, char *name_out, bool *requires_address_pinning, uint8_t *flags); static void prv_update_bondings(BTBondingID id, BtPersistBondingType type) { if (id == BT_BONDING_ID_INVALID) { return; ...
{ // if not active, break and return known flash version break; } } // go back to the state we were in before the function prv_layout_version_add_all_regions(true); return flash_version; } void ftl_add_region(uint32_t region_start, uint32_t region_end, bool erase_new_region) { // check if ...
for (int i = 0; i < version_idx; i++) { s_ftl_size += prv_region_size(i); }
pfs_set_size(s_ftl_size, false); extern void test_force_recalc_of_gc_region(void); test_force_recalc_of_gc_region(); }
8, -104, -80}, { -1256, 168, -104}, // 10 seconds { -1432, 224, -48}, { -1528, 184, -32}, { -1352, 144, -120}, { -1216, 208, -64}, { -1184, 224, 176}, { -1304, 344, -24}, { -1496, 656, -104}, { -1192, 1592, -192}, { -1192, 576, -408}, { -1056, 688, -328}, { -1432, 976...
{ -232, -592, -632}, { -200, -632, -576}, { -96, -856, -296}, { -80, -816, -240}, { -16, -696, -256}, { 16, -664, -272}, { 168, -720, -416}, { 368, -672, -416}, { 480, -824, -368}, { 720, -920, -336}, { 728, -1200, -248}, { 944, -928, 128}, { 896, -1008, -72}, { 7...
{ -1600, 384, 80}, { -1480, 352, 40}, { -1248, 248, 96}, // 18 seconds { -1216, 232, 80}, { -1352, 112, 128}, { -1360, 56, 96}, { -1376, 120, 120}, { -1320, -88, 80}, { -976, -352, 184}, { -1000, -384, 176}, { -1176, 56, -120}, { -1328, 320, -280}, { -1648, 40, -...
de(void) { BMI160SampleRate interval_us = prv_get_min_sampling_interval_us(); uint8_t acc_odr = (uint8_t)prv_get_odr(interval_us); // should be able to write the sample range at any time prv_read_modify_write(BMI160_REG_ACC_CONF, acc_odr, BMI160_ACC_CONF_ACC_ODR_MASK << BMI160_ACC_CONF_ACC_ODR_SHIFT); #...
bmi160_read_reg(BMI160_REG_FIFO_CONFIG_1)
; uint8_t desired_cfg = BMI160_FIFO_CONFIG_1_ACC_EN; if (curr_frame_cfg != desired_cfg) { prv_run_command(BMI160_CMD_FIFO_FLUSH); // clear any lingering entries prv_write_reg(BMI160_REG_FIFO_CONFIG_1, desired_cfg); } } bool enable_int = num_samples != 0; bool use_fifo = num_samples > 1; ...
if (state->test_entry.version == 3) { sscanf(token + strlen(token) + 1, "%d, 0x%x, %d, %d, %d", &steps, &orientation, &vmc, &light, &plugged_in); } else { cl_assert(false); }
fflush(stdout); PBL_ASSERTN(state->test_entry.num_samples < SLEEP_SAMPLES_DISCOVERY_MAX_SAMPLES); state->samples[state->test_entry.num_samples++] = (AlgMinuteFileSample) { .v5_fields = { .steps = steps, .orientation = orientation, .vmc = vmc, .light = ...
/* * 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_session.active_mode_trigger != TIMER_INVALID_ID) { new_timer_delete(s_session.active_mode_trigger); s_session.active_mode_trigger = TIMER_INVALID_ID; CommSession *comm_session = comm_session_get_system_session(); comm_session_set_responsiveness( comm_session, BtConsumerPpAudioEndpoint, Res...
&g_gfx_test_##name, static GfxTest *s_tests[] = { #include "gfx_test_list.h" }; static void prv_pop_test_window(void *data) { AppData *app_data = data; app_window_stack_pop(false); app_window_stack_push(&app_data->results_window, false); } static void prv_test_update_proc(Layer *layer, GContext* ctx) { AppDa...
(menu, &window->layer.bounds)
; menu_layer_set_callbacks(menu, app_data, &(MenuLayerCallbacks){ .get_num_rows = prv_get_num_rows, .draw_row = prv_draw_row, .select_click = prv_click_handler, }); menu_layer_set_click_config_onto_window(menu, window); layer_add_child((Layer *) window, (Layer *) menu); app_window_stack_push(windo...
); } } static void prv_raw_click_handler(ClickRecognizerRef recognizer, void *context) { SwapLayer *swap_layer = (SwapLayer *)context; // Ignore any press that isn't the start of a new click pattern if (click_number_of_clicks_counted(recognizer) < 1) { prv_announce_interaction(swap_layer); const bool i...
{ return swap_layer->current; }
ed_text(Animation *animation, bool finished, void *context) { MusicAppData *data = context; data->pause_track_pos_updates = false; prv_update_track_progress(data); music_get_now_playing(data->title_buffer, data->artist_buffer, NULL); // Restore the layers to their original bounds for the next part of the anim...
prv_cassette_rect()
; Animation *disappear_animation = property_animation_get_animation( property_animation_create_bounds_origin(&data->cassette_layer.layer, &GPointZero, &GPoint(0, -cassette_rect.size.h))); animation_set_duration(disappear_animation, 3 * ANIMATION_FRAME_MS); anima...
static bool prv_result_callback(const char *value, uint32_t value_length, uint32_t index, void *context) { strcpy(s_results[s_results_count], value); s_results_lengths[s_results_count] = value_length; cl_assert_equal_i(index, s_results_count); ++s_results_count; return (s_max_...
("-2147483648", 1, true, -2147483648)
; assert_float_parse("2147483648", -1, true, -2147483648); } // ams_util_csv_parse() tests /////////////////////////////////////////////////////////// #define assert_result(idx, val, len); \ cl_assert_equal_i(len, s_results_lengths[idx]); \ cl_assert_equal_i(memcmp(val, s_results[idx], len), 0); void test_ams_...
s invalid length: %"PRIu32, length); return false; } Uuid *app_uuid = (Uuid *)data; AppInstallId app_id = app_install_get_id_for_uuid(app_uuid); if (app_id == INSTALL_ID_INVALID) { PBL_LOG(LOG_LEVEL_DEBUG, "Attempting to launch an invalid app"); return false; } app_manager_put...
{ type = GenericServiceTypeWriteRead; }
else if (request->write_mbuf) { type = GenericServiceTypeWrite; } else if (request->read_mbuf) { type = GenericServiceTypeRead; } else { type = GenericServiceTypeRead; // stop lint from complaining WTF; } return prv_do_send(type, request->service_id, request->attribute_id, request->write_mbuf, ...
int src_row_length_words = (src_bitmap->row_size_bytes / 4); const uint8_t src_line_start_idx = corrected_src_x % 32; const uint8_t src_line_wrap_idx = (src_bitmap->bounds.origin.x + dest_delta_begin_x) % 32; const uint8_t src_line_start_end_idx = MIN(32, src_bitmap->bounds.size.w + src_line_start_idx...
if (bitblt_compositing_mode_is_noop(compositing_mode, tint_color)) { return; }
subscribed"); goto unlock; } result = state->num_samples; *timestamp_ms = state->timestamp_ms; } unlock: mutex_unlock_recursive(s_mutex); return result; } // --------------------------------------------------------------------------------------------- DEFINE_SYSCALL(bool, sys_accel_manager_co...
(s_tap_subscribers_count > 0)
; if (--s_tap_subscribers_count == 0 && !s_data_subscribers) { PBL_LOG(LOG_LEVEL_DEBUG, "Stopping accel service"); if (accel_running()) { accel_stop(); } } } mutex_unlock_recursive(s_mutex); } // ------------------------------------------------------------------------------------...
izers and change the window that the // manager points to (when windows are pushed and popped) outside this module if (!recognizer_list_iterate(window_get_recognizer_list(manager->window), iter_cb, context)) { return false; } Layer *root = window_get_root_layer(manager->window); Layer *layer = manager->a...
{ manager->triggered = triggered; if (triggered) { manager->state = RecognizerManagerState_RecognizersTriggered; } }
static bool prv_cancel_or_fail_recognizer(Recognizer *recognizer, void *context) { RecognizerManager *manager = context; if (manager->triggered == recognizer) { prv_set_triggered(manager, NULL); } if (recognizer_get_state(recognizer) == RecognizerState_Possible) { recognizer_set_failed(recognizer); ...
_read(fd, &read_byte, sizeof(read_byte)), sizeof(read_byte)); cl_assert_equal_i(read_byte, 0xff - i); } } pfs_close(fd); } void test_pfs__write(void) { int rv = pfs_write(-1, NULL, 0); cl_assert(rv == E_INVALID_ARGUMENT); rv = pfs_write(1000000, NULL, 0); cl_assert(rv == E_INVALID_ARGUMENT); ...
(fd, buf, rd_len + 1)
; cl_assert(rv == E_RANGE); } void test_pfs__close(void) { // shouldn't be able to close fds that are not open int rv = pfs_close(-1); cl_assert(rv == E_INVALID_ARGUMENT); rv = pfs_close(0); cl_assert(rv == E_INVALID_ARGUMENT); rv = pfs_close(1000000); cl_assert(rv == E_INVALID_ARGUMENT); int fd = p...
nclude "os/mutex.h" #include "system/passert.h" #include "services/common/regular_timer.h" #include "system/logging.h" #include "util/math.h" //! Don't let users modify the list while callbacks are occurring. static PebbleMutex *s_list_mutex = NULL; static void prv_timer_callback(void* data); static RegularTimerInfo ...
(prv_is_scheduled(job))
; // copy schedule info from existing job CronJob temp_job = *job; list_init(&temp_job.list_node); temp_job.cb = new_job->cb; temp_job.cb_data = new_job->cb_data; *new_job = temp_job; // insert after in the list, which guarantees it gets executed after list_insert_after(&job->list_node, &new_job->list...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(ctx, false)
; graphics_draw_line(ctx, GPoint(5, 35), GPoint(45, 40)); } void white_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorWhite); graphics_context_set_stroke_width(ctx, 10); graphics_context_set_antialiased(ctx, false); graphics_draw_line(ctx, GPoint(5, 35), GPoint...
_roll_back(PPoGATTClient *client, uint32_t sn) { if (++client->out.timeouts_counter >= PPOGATT_TIMEOUT_COUNT_MAX) { PBL_LOG(LOG_LEVEL_ERROR, "Resetting because max timeouts reached..."); prv_start_reset(client); return; } PBL_LOG(LOG_LEVEL_WARNING, "Rolling back from (%u, %u) to %"PRIu32, c...
gatt_client_subscriptions_subscribe(client->characteristics.data, BLESubscriptionNone, GAPLEClientKernel)
displacement = stack->transition_context.window_to_displacement; gpoint_add_eq(&draw_state->drawing_box.origin, displacement); gpoint_add_eq(&draw_state->clip_box.origin, displacement); } // clip_box must respect screen boundaries grect_clip(&draw_state->clip_box, &saved_state->clip_box); } static void ...
(fullscreen)
; layer_init(&window->layer, &frame); window->is_fullscreen = fullscreen; window->layer.window = window; window->layer.update_proc = window_do_layer_update_proc; window->background_color = GColorWhite; window->in_click_config_provider = false; window->is_waiting_for_click_config = false; window->parent_...
/* * 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...
(LOG_LEVEL_DEBUG, "SELECT loooong clicked!")
; } #endif static void click_config_provider(struct AppState* data) { // The config that gets passed in, has already the UP and DOWN buttons configured // to scroll up and down. It's possible to override that here, if needed. // Configure how the SELECT button should behave: window_single_click_subscribe(BUTT...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
window_set_fullscreen(window, true)
; TextLayer *title = &data->title; text_layer_init(title, &window->layer.frame); text_layer_set_font(title, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD)); text_layer_set_text_alignment(title, GTextAlignmentCenter); text_layer_set_text(title, "Certification"); layer_add_child(&window->layer, &title->layer...
const GRect *rect, uint16_t radius, GCornerMask corner_mask, GColor fill_color, uint16_t alt_radius, FillCircleImplFunc circle_func) { // only draw if there is enough to cover the rounded edges - otherwise round down to largest // radius that can be drawn ra...
graphics_fill_round_rect(ctx, rect, 0, GCornerNone)
; } T_STATIC void prv_draw_rect(GContext *ctx, const GRect *rect) { GColor fill_color = ctx->draw_state.fill_color; ctx->draw_state.fill_color = ctx->draw_state.stroke_color; graphics_fill_rect(ctx, &GRect(rect->origin.x, rect->origin.y, rect->size.w, 1)); // top graphics_fill_rect(ctx, &GRect(rect->origin.x, ...
nlock; } has_notification = prv_get_next_notification_header(client, header_out); const uint16_t read_space = circular_buffer_get_read_space_remaining(s_circular_buffer[client]); if (has_notification && header_out) { // When tackling https://pebbletechnology.atlassian.net/browse/PBL-14151 this should probab...
(s_circular_buffer_retain_count[client])
; --s_circular_buffer_retain_count[client]; if (s_circular_buffer_retain_count[client] == 0) { // Last subscription for this client to require the circular buffer, go ahead and clean it up: kernel_free(s_circular_buffer[client]); s_circular_buffer[client] = NULL; // if the buffer is dest...
rt(num.integer == -1); cl_assert(num.fraction == 6); test_num = (int32_t)((float)-0.125 * (1 << FIXED_S16_3_PRECISION)); num = (Fixed_S16_3){ .raw_value = test_num }; cl_assert(num.integer == -1); cl_assert(num.fraction == 7); test_num = (int32_t)((float)-0 * (1 << FIXED_S16_3_PRECISION)); num = (Fi...
cl_assert_equal_i(-1, Fixed_S16_3_rounded_int(Fixed_S16_3(-8)))
; cl_assert_equal_i(-2, Fixed_S16_3_rounded_int(Fixed_S16_3(-12))); } void test_math_fixed__S16_3_rounding(void) { Fixed_S16_3 num; int16_t test_num; // This test shows how the in between fractional values evaluate to the fixed representation // Positive numbers round down to nearest fraction // Negative ...
/* * 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)
; } app_free(notifications_glance); } static bool prv_notification_iterator_cb(void *data, SerializedTimelineItemHeader *header_id) { Uuid *last_notification_received_id = data; // The iterator proceeds from the first notification received to the last notification received, // so copy the ID of the current ...
/* * 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_app_has_compatible_bytecode_res(app_num)
) { return RockyResourceValidation_Valid; } else { return RockyResourceValidation_Invalid; } }
/* * 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_subtitle_from_attributes(attribute_list_ref, buffer, buffer_size, dummy_i18n_owner)
; cl_assert_equal_s(buffer, PBL_IF_RECT_ELSE("WEEKDAYS", "Weekdays")); // An alarm pin that has both a subtitle attribute and an AlarmKind attribute should create the // subtitle using the AlarmKind (ignoring the subtitle attribute), respecting the desire to // all-caps the subtitle on rectangular displays a...
grect_is_empty(&text_box->box)
) { return; } const Utf8Bounds *utf8_bounds = text_box->utf8_bounds; bool is_string_empty = (utf8_bounds->start == utf8_bounds->end); if (is_string_empty) { return; } const GTextOverflowMode overflow_mode = text_box->overflow_mode; bool is_ellipsis_on_overflow = (overflow_mode == GTextOverflowM...
(false, prv_app_install_is_watchface(CRAZY_ID))
; } void test_app_install_manager__get_uuid_for_install_id(void) { Uuid uuid = {}; cl_assert_equal_b(false, app_install_get_uuid_for_install_id(INSTALL_ID_INVALID, &uuid)); cl_assert_equal_uuid(uuid, UUID_INVALID); cl_assert_equal_b(true, app_install_get_uuid_for_install_id(tictoc_id, &uuid)); cl_assert_equ...
/* * 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...
strnlen(region_name, TIMEZONE_NAME_LENGTH)
; for (size_t i = 0; i < string_length; i++) { if (region_name[i] == '_') { region_name[i] = ' '; } } } //! Initialize the continent and region names for the timezone windows static void prv_init_continent_and_region_names(SettingsTimeData *data) { const uint16_t region_count = data->region_count =...
/* * 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...
({ // jerry_eval() uses an indirect eval() call, // so the global execution context is used. // Also see ECMA 5.1 -- 10.4.2 Entering Eval Code. var indirectEval = eval; try { return __jerryRefs.ref(indirectEval(Module.Pointer_stringify($0, $1))); } catch (e) { var err...
; } jerry_value_t jerry_acquire_value(jerry_value_t value) { return (jerry_value_t)EM_ASM_INT({ return __jerryRefs.acquire($0); }, value); } void jerry_release_value(jerry_value_t value) { EM_ASM_INT({ __jerryRefs.release($0); }, value); } //////////////////////////////////////////////////////...
c; Layer *layers[] = {&parent, &child_a, &child_b, &child_c}; for (int i = 0; i < ARRAY_LENGTH(layers); ++i) { layer_init(layers[i], &GRectZero); } layer_add_child(&parent, &child_a); cl_assert(layer_is_descendant(&child_a, &parent)); cl_assert(!layer_is_descendant(&parent, &child_a)); cl_assert(!lay...
layer_find_layer_containing_point(&child_b, &GPoint(9, 9))
, &child_b); cl_assert_equal_p(layer_find_layer_containing_point(&parent, &GPoint(9, 9)), &child_b); cl_assert_equal_p(layer_find_layer_containing_point(&parent, &GPoint(0, 0)), &child_b); // outside the bounds of child a, so child b is not found cl_assert_equal_p(layer_find_layer_containing_point(&parent, &GP...
d) { const uint8_t *cursor = s_serialized_attribute_list; int32_t result = attribute_get_buffer_size_for_serialized_attributes(2, &cursor, s_serialized_attribute_list + sizeof(s_serialized_attribute_list)); cl_assert(result == 9); cursor = s_invalid_serialized_attribute_list; result = attribute_get_buf...
string_list_count(list)
); list->serialized_byte_length = 3; // 4 empty strings cl_assert_equal_i(4, string_list_count(list)); cl_assert_equal_s("", string_list_get_at(list, 0)); cl_assert_equal_s("", string_list_get_at(list, 1)); cl_assert_equal_s("", string_list_get_at(list, 2)); cl_assert_equal_s("", string_list_get_at(list,...
oftware * 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 "session_receive_router.h" #include "kernel/eve...
(LOG_LEVEL_WARNING, "Got fewer bytes than expected for handler %p", impl->endpoint->handler)
; } // Note: At the moment we unconditionally spawn a new callback upon // completion of each individual payload. If we are getting a flood of // events, this may generate too many CBs and overflow the queue. We could keep a list // of pending receiver events and only schedule the CB if there isn't one // ...
&bpm, &hr_zone)); cl_assert_equal_i(steps, 20); cl_assert_equal_i(duration_s, 20); cl_assert_equal_i(bpm, 80); prv_inc_time(10); prv_inc_steps_and_put_event(10); prv_put_bpm_event(117, HRMQuality_Good); cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_...
cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone))
; cl_assert_equal_i(steps, 1010); // Pretend we wrap around midnight. Midnight will reset the step count. s_total_step_count = 0; // Put some steps and make sure we don't delete or freak out, and append the new step count. prv_inc_steps_and_put_event(50); cl_assert(workout_service_get_current_workout_info...
pin, altfunc); GPIO_PinAFConfig(FLASH_CONFIG.spi_gpio, FLASH_CONFIG.miso_pin, altfunc); GPIO_PinAFConfig(FLASH_CONFIG.spi_gpio, FLASH_CONFIG.mosi_pin, altfunc); // Setup MISO/MOSI GPIO_InitTypeDef gpio_cfg; gpio_cfg.GPIO_OType = GPIO_OType_PP; gpio_cfg.GPIO_PuPd = GPIO_PuPd_NOPULL; gpio_cfg.GPIO_Mode = G...
prv_enable_flash_spi_clock()
; prv_flash_wait_for_write_bounded(64000000); prv_flash_start_cmd(); prv_flash_send_and_receive_byte(FLASH_CMD_READ_ID); uint32_t manufacturer = prv_flash_read_next_byte(); uint32_t type = prv_flash_read_next_byte(); uint32_t capacity = prv_flash_read_next_byte(); prv_flash_end_cmd(); prv_disable_fla...
visible by the erase unit size"); //! Given the current address and amount to increment it by, handles wrapping //! and computes the valid flash address static uint32_t prv_get_page_addr(uint32_t curr_page_addr, uint32_t incr_by) { uint32_t new_offset = ((curr_page_addr - FLASH_REGION_DEBUG_DB_BEGIN) + incr_by...
{ // this is the first page we've found log_start_addr = flash_addr; dist = 0; // nothing else to compare against yet }
if ((dist == 0) || (dist == 1)) { prev_chunk_id = hdr.log_chunk_id; continue; // keep looking } // we have found a gap in the number sequence which means we have found // the beginning and end of the log generation. We must continue looping // to make sure we count the total number of...
/* * 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 ibeacon->distance_cm; }
BLEiBeacon *ble_ibeacon_create_from_ad_data(const BLEAdData *ad, int8_t rssi) { // Note, not yet exported to 3rd party apps so no padding necessary BLEiBeacon *ibeacon = applib_malloc(sizeof(BLEiBeacon)); if (ibeacon && !ble_ibeacon_parse(ad, rssi, ibeacon)) { // ...
); // Variable length digits output snprintf(dstbuf, 256, "There are %.*x lights", 3, 16); cl_assert_equal_s(dstbuf, "There are 010 lights"); // Variable length digits output (negative digits, acts as zero) snprintf(dstbuf, 256, "%.*xzero%.*x", -3, 0, -3, 1); cl_assert_equal_s(dstbuf, "zero1"); // Leng...
(dstbuf, "Hurf")
; // Variable length character output snprintf(dstbuf, 256, "Hur%*c", 2, 'f'); cl_assert_equal_s(dstbuf, "Hur f"); } void test_sprintf__percent_s(void) { char dstbuf[256]; // Simple %s snprintf(dstbuf, 256, "You know Bagu? %s", "Then I can let you cross"); cl_assert_equal_s(dstbuf, "You know Bagu? Then...
OM_DESIRED_SIZE_BYTES) { prv_deallocate_headroom(ctx); prv_allocate_headroom_or_die(ctx); } } static void prv_collect_all_garbage(void) { ecma_free_unused_memory(JMEM_FREE_UNUSED_MEMORY_SEVERITY_HIGH, 0, true); jmem_pools_collect_empty(); } static void prv_memorypressure_app_log(const char *level, const...
(event_name, ROCKY_EVENT_MEMORYPRESSURE)
== 0) { RockyMemoryAPIContext *ctx = app_state_get_rocky_memory_api_context(); if (!prv_is_headroom_allocated(ctx)) { prv_allocate_headroom_or_die(ctx); } return true; } return false; } const RockyGlobalAPI MEMORY_APIS = { .init = prv_init, .deinit = prv_deinit, .add_handler = prv_add_...
_graphics_draw_text.call_count); cl_assert_equal_rect((GRect(-4900, 100, large_int, large_int)), s_graphics_draw_text.last_call.draw_text.box); EXECUTE_SCRIPT( "ctx.textAlign = 'right';\n" "ctx.fillText('some text', 100, 100);\n" ); cl_assert_equal_i(3, s_graphics_draw_text.call...
((jerry_char_t *)def->js_name)
; RockyAPISystemFontDefinition *cmp_def = NULL; bool actual = prv_font_definition_from_value(name_js, &cmp_def); cl_assert_equal_b(true, actual); cl_assert_equal_s(cmp_def->res_key, def->res_key); jerry_release_value(name_js); def++; } } void test_rocky_api_graphics__measure_text(void) { pr...
be the integer start/end of the line, so we need to adjust them so we see // the same blending on the first and last pixel y2--; const Fixed_S16_3 y1_fixed = (Fixed_S16_3) { .integer = y1, .fraction = 4, }; const Fixed_S16_3 y2_fixed = (Fixed_S16_3) { .integer = y2, .fraction = 4, }; prv_...
{ // FIXME PBL-34552: This test produces an incorrect image, see JIRA const Fixed_S16_3 x1_fixed = (Fixed_S16_3) { .integer = x1 }; Fixed_S16_3 x2_fixed = (Fixed_S16_3) { .integer = x2 }; const uint8_t gradient_width = (uint8_t)((x2 - x1) / 2); x2_fixed.integer -= gradient_width; const int16_t clip_box_min...
------------------------------------- // Sample captured: 2015-09-22 12:00:16 local AccelRawData *activity_sample_100_steps_heather_2(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_heather_2 //> TEST_EXPECTED 100 //> TEST_EXPECTED_MIN 95 //> TEST_EXPECTE...
{ 920, -472, -408}, { 1120, -104, -248}, { 1272, 200, -288}, { 1488, 200, -160}, { 1832, 384, -128}, { 1744, 536, -128}, { 1760, 544, -136}, { 1896, 656, -80}, { 1928, 768, 48}, { 1696, 784, -40}, { 1440, 768, -80}, { 1504, 1624, -96}, { 840, 1528, -136}, { 944, 1...
{ 920, 896, -152}, { 1312, 720, -104}, { 1920, 760, -32}, { -1992, 728, -32}, { 2000, 616, -24}, { 2016, 328, 56}, { 1904, 328, 32}, { 1760, 488, -152}, { 1496, 376, -288}, { 1304, 32, -296}, { 736, -616, -32}, { 432, -416, -568}, { 1008, -360, -256}, { 1136, 48,...
check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_r0_aa_swX_clear.${BIT_DEPTH_NAME}.pbi")); } void test_graphics_draw_circle_${BIT_DEPTH_NAME}__arc_stroked(void){ GContext ctx; test_graphics_context_init(&ctx, fb); // Letter C uint32_t angle_end = TRIG_MAX_ANGLE + (TRIG_MAX_ANGLE / 8); uint32_t angle_star...
for (int i = 0; i < ARRAY_LENGTH(test_angles); i++) { setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); GPoint pt = CENTER_OF_ORIGIN_RECT; uint16_t radius = 10; uint16_t stroke_width = 1; for (int r = 1; r <= 7; r++) { graphics_context_set_stroke_width(&ctx, strok...
atic const uint16_t MAX_DATA_SIZE = MAX_SIZE_OUTBOUND - sizeof(Dictionary) - sizeof(Tuple); static int s_context; static DictionaryIterator s_expected_iter; uint8_t s_expected_buffer[MAX_SIZE_OUTBOUND]; static int s_out_sent_call_count = 0; static int s_out_failed_call_count = 0; static AppMessageResult s_failure_re...
{ app_message_app_protocol_msg_callback(session, (const uint8_t*)&ack, sizeof(AppMessage), NULL); }
else { cl_fail("Unhandled endpoint"); } } static void prv_nack_sent_callback(uint16_t endpoint_id, const uint8_t* data, unsigned int length) { s_nack_sent_is_called = true; prv_send_ack_nack(endpoint_id, data, length, true); } static void prv_ack_sent_callback(uint16_t endpoint_id, const uint8_t* data, uns...
"); return; } prompt_send_response("OK"); } //! Some flash chips have an accelerated method of checking for erased sectors. This is a sanity //! check against that method. It reads the bytes in raw form and makes sure it is really erased. static bool prv_is_really_erased(uint32_t addr, bool is_subsector) { ...
new_timer_start(timer, 10, stuck_timer_cb, NULL, 0 /*flags*/)
; } #include "drivers/rtc.h" void command_assert_fail(void) { prompt_command_finish(); RtcTicks ticks = rtc_get_ticks(); PBL_ASSERT(false, "The world doesn't make sense anymore! Tick count: 0x%08" PRIx32 "%08" PRIx32, SPLIT_64_BIT_ARG(ticks)); } void command_croak(void) { prompt_command_finish(...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
for (int i = 0; i < NUM_ACTION_BAR_LEGACY2_ITEMS; i++) { action_bar_legacy2_set_highlighted(action_bar, i, false); }
/* * 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...
{ handle_init(); app_event_loop(); handle_deinit(); }
? GTextAlignmentRight : GTextAlignmentCenter)); uint16_t right_aligned_box_reduction = PBL_IF_RECT_ELSE(0, show_action_bar ? 10 : 0); if (has_header) { const uint16_t HEADER_OFFSET = 6; #if PBL_RECT x = left_margin_px; w = frame.size.w - right_margin_px - l...
if (expandable_dialog->select_icon) { action_bar_layer_set_icon_animated(action_bar, BUTTON_ID_SELECT, expandable_dialog->select_icon, expandable_dialog->show_action_icon_animated); }
action_bar_layer_set_context(action_bar, expandable_dialog); action_bar_layer_set_click_config_provider(action_bar, prv_config_provider); action_bar_layer_add_to_window(action_bar, window); } else { window_set_click_config_provider_with_context(window, prv_config_provider, expandable_dialog); } ...
.location = location, .color = color, }; if (type == CLOCK_TEXT_TYPE_DATE) { strftime(text.buffer, sizeof(text.buffer), "%a %d", tick_time); } else if (type == CLOCK_TEXT_TYPE_TIME) { strftime(text.buffer, sizeof(text.buffer), "$l:%M%P", tick_time); } for (uint32_t i = 0; i < sizeof(text.bu...
rtc_get_time()
; prv_handle_time_update(pbl_override_localtime(&t), (TimeUnits)0xff); tick_timer_service_subscribe(MINUTE_UNIT, prv_handle_time_update); } void watch_model_start_intro() { prv_intro_animation_finished(NULL); } void watch_model_init(void) { const time_t t = rtc_get_time(); struct tm *tick_time = pbl_overri...
ache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and ...
(e.type, PEBBLE_NULL_EVENT)
; } } static void prv_receive_and_assert_player_info(bool expect_is_handled) { uint8_t msg[] = { 0x13, 17, 'c', 'o', 'm', '.', 's', 'p', 'o', 't', 'i', 'f', 'y', '.', 'm', 'u', 's', 'i', 'c', 7, 'S', 'p', 'o', 't', 'i', 'f', 'y' }; prv_receive_pp_data(msg, sizeof(msg)); PebbleEvent e = fak...
.z = z, }; continue; } // End of a sample if (strcmp(token, "}") == 0) { PBL_ASSERTN(state->test_entry.name[0] != 0); break; } } // Did we get samples? if (state->test_entry.num_samples > 0) { return true; } else { return false; } } // ----------------...
strcmp(token, "TEST_CUR_STATE_ELAPSED_MAX")
== 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.cur_state_elapsed.max); } else if (strcmp(token, "TEST_IN_SLEEP") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.in_sleep.value); } else if (strcmp(token, "TEST_IN_SLEEP_MIN") == 0) { sscanf(tok...
, dst_x1, dst_x2); graphics_release_frame_buffer(ctx, fb); } void graphics_private_move_pixels_horizontally(GBitmap *bitmap, int16_t delta_x, bool patch_garbage) { if (!bitmap || delta_x == 0) { return; } const int bpp = gbitmap_get_bits_per_pixel(bitmap->in...
const uint8_t fill_byte = delta_neg ? left_pixel[num_pix_data_row - 1] : left_pixel[0]; memset(left_pixel, fill_byte, num_pix_data_row); } break; } uint8_t *const from = delta_neg ? right_pixel : left_pixel; ...
} void graphics_private_move_pixels_vertically(GBitmap *bitmap, int16_t delta_y) { if (!bitmap || (delta_y == 0)) { return; } const int bpp = gbitmap_get_bits_per_pixel(bitmap->info.format); const bool delta_neg = (delta_y < 0); const int16_t abs_delta = ABS(delta_y); const int16_t min_y = bitmap->b...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ while (storage->entries) { prv_delete(&storage->entries, storage->entries); } return S_SUCCESS; }
RamStorage ram_storage_create(void) { RamStorage storage; storage.entries = NULL; return storage; } static bool prv_find_dirty(ListNode *found_node, void *data) { RamStorageEntry *entry = (RamStorageEntry *)found_node; return !!(entry->flags & RamStorageFlagDirty); } status_t ram_storage_is_dirty(RamStora...
/* * 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...
{ uint32_t total = 0; GDrawCommandFrame *frame = sequence->frames; for (uint32_t i = 0; i < sequence->num_frames; i++) { total += gdraw_command_frame_get_duration(frame); frame = prv_next_frame(frame); } return total; }
GDrawCommandFrame *gdraw_command_sequence_get_frame_by_elapsed(GDrawCommandSequence *sequence, uint32_t elapsed) { if (!sequence) { return NULL; } if ((sequence->play_count != GDRAW_COMMAND_SEQUENCE_PLAY_COUNT_INFINITE_STORED) && (elapsed...
{ 0, 0x8c, 0, 0x0}, { 0, 0x8c, 0, 0x0}, { 0, 0x8c, 0, 0x0}, { 0, 0x8c, 0, 0x0}, { 0, 0x8c, 0, 0x0}, // 30: { 0, 0x8c, 0, 0x0}, { 0, 0x8c, 0, 0x0}, { 0, 0x8c, 0, 0x0}, { 0, 0x8c, 0, 0x0}, { 0, 0x8c, 0, 0x0}, { 0, 0x8c, 0, 0x0}, { 0, 0x8c, 0, 0x0}, { 0, 0x8c, 0, 0x...
{ 0, 0x8c, 0, 0x0}, { 0, 0x8c, 0, 0x0}, { 0, 0x8c, 0, 0x0}, { 0, 0x8c, 0, 0x0}, { 0, 0x8c, 0, 0x0}, { 0, 0x8c, 0, 0x0}, { 0, 0x8c, 0, 0x0}, { 0, 0x8c, 0, 0x0}, { 0, 0x8c, 0, 0x0}, { 0, 0x8c, 0, 0x0}, { 0, 0x8c, 0, 0x0}, { 0, 0x8c, 0, 0x0}, { 0, 0x8c, 0, 0x0}, // 1...
{ 0, 0x55, 1503, 0x0}, { 0, 0x25, 198, 0x0}, { 0, 0x25, 0, 0x0}, { 0, 0x25, 0, 0x0}, { 0, 0x36, 346, 0x0}, { 0, 0x26, 1830, 0x0}, { 0, 0x36, 563, 0x0}, { 0, 0x45, 14, 0x0}, { 0, 0x45, 344, 0x0}, { 0, 0x45, 17, 0x0}, { 0, 0x45, 105, 0x0}, // 225 { 0, 0x55, 1922, 0x0},...
bt_ctl_set_override_mode(BtCtlModeOverrideNone)
; event_service_client_unsubscribe(&bt_state_change_event_info); task_free(data); } static void s_main(void) { handle_init(); app_event_loop(); handle_deinit(); } static const PebbleProcessMdSystem s_mfg_bt_test_info = { .common.main_func = &s_main, .name = "BT Test" }; const PebbleProcessMd* mfg_app...
/* * 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...
(action_bar, button_id, icon, expandable_dialog->show_action_icon_animated)
{ 440, 712, 256}, { 472, 760, 240}, { 504, 760, 240}, { 496, 816, 256}, { 440, 1000, 336}, // 52 seconds { 440, 1224, 280}, { 528, 1112, 344}, { 192, 1624, 376}, { 232, 1224, 32}, { 264, 752, -56}, { 184, 640, -96}, { 248, 656, 8}, { 368, 688, 88}, { 384, 824,...
{ 376, 872, 232}, { 328, 792, 232}, { 240, 808, 328}, { 240, 776, 304}, { 272, 752, 336}, { 304, 800, 304}, { 320, 840, 288}, { 344, 840, 296}, { 400, 864, 232}, { 424, 856, 168}, // 58 seconds { 464, 816, 312}, { 464, 920, 16}, { 344, 1112, 200}, { 368, 1128,...
{ 176, 880, 344}, { 224, 904, 360}, { 264, 896, 368}, { 248, 968, 208}, { 184, 944, 128}, { 248, 808, 336}, { 224, 984, 256}, { 256, 912, 144}, { 288, 1016, 296}, { 48, 1112, 360}, { 136, 1144, 80}, { 104, 816, 104}, { 8, 968, 96}, { -88, 952, 128}, { -72, 97...
ULL, font, GColorBlack, window_bg_color, GTextAlignmentCenter, GTextOverflowModeTrailingEllipsis); layer_add_child(root_layer, (Layer *)text_layer); layer_set_hidden((Layer *)text_layer, true); static const int16_t LOADING_FRAME_OFFSET_Y = 27; ...
{ VoiceUiData *data = window_get_user_data(window); if (data->state != StateError) { // Do not indicate that an error occurred when a session is interrupted by a window transition if (data->state != StateFinished) { data->last_session_successful = false; } prv_cancel_dictation(data); } }
static void prv_mic_window_appear(Window *window) { VoiceUiData *data = window_get_user_data(window); if ((data->state == StateStart) || (data->state == StateFinished)) { sys_light_enable_respect_settings(true); prv_start_dictation(data); } } static void prv_voice_window_push(VoiceUiData *data) { Win...