prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
structed area is derived from the origin of the obstruction. //! This is equivalent to the height of the unobstructed area. static void prv_origin_y_to_area(int16_t origin_y, GRect *area_out) { PBL_ASSERTN(area_out); *area_out = (GRect) { .size = { DISP_COLS, origin_y }, }; prv_clip_area(area_out); } void ...
unobstructed_area_service_unsubscribe(app_state_get_unobstructed_area_state())
0 || data->rect.origin.x + data->rect.size.w > data->window.layer.bounds.size.w) { data->rect_velocity_x = data->rect_velocity_x * -1; } data->rect.origin.y += (data->rect_velocity_y * PIXEL_SPEED_PER_FRAME * 2); if (data->rect.origin.y < 0 || data->rect.origin.y + data->...
{ graphics_context_set_fill_color(ctx, data->circle_color); graphics_context_set_stroke_color(ctx, data->circle_color); graphics_fill_circle(ctx, data->circle_origin, data->circle_radius); }
else if (shape == GPATH_TRIANGLE) { gpath_draw_filled(ctx, data->triangle); } else if (shape == GPATH_OPEN_BUCKET) { gpath_draw_filled(ctx, data->bucket); } } else { if (shape == POINT) { graphics_draw_pixel(ctx, data->point_p0); } else if (shape == LINE) { graphics_draw_line(...
/* * 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_get_root_layer(window)->bounds)
; menu_layer_set_callbacks(menu_layer, NULL, &(MenuLayerCallbacks) { .get_num_sections = prv_menu_get_num_sections_callback, .get_num_rows = prv_menu_get_num_rows_callback, .get_header_height = prv_menu_get_header_height_callback, .get_cell_height = prv_menu_get_cell_height_callback, .get_separato...
0, 20), 4, GCornersAll); } #define COLOR_BAR_WIDTH 4 #define COLOR_BAR_HEIGHT 24 #define ROW_LENGTH 32 static void draw_color_wheel_box(GContext* ctx, AppData *data) { GPoint origin = GPoint(8, 114); GColor compare_color = GColorClear; uint8_t color_index_match = 0; uint16_t height_offset = 0; bool compare =...
(ctx, data)
; set_text_layers(data); GFont font = fonts_get_system_font(FONT_KEY_GOTHIC_14_BOLD); graphics_context_set_stroke_color(ctx, GColorWhite); graphics_draw_rect(ctx, &GRect(71, 0, 73, 111)); // Border around BG graphics_context_set_fill_color(ctx, data->bg_color); graphics_fill_rect(ctx, &GRect(72, 0, 72...
onJob *job_a = (CronJob*)a; CronJob *job_b = (CronJob*)b; return job_b->cached_execute_time - job_a->cached_execute_time; } // ------------------------------------------------------------------------------------------- static void prv_timer_callback(void* data) { mutex_lock(s_list_mutex); while (s_scheduled_jo...
mutex_unlock(s_list_mutex)
; return (rv); } // ------------------------------------------------------------------------------------------ bool cron_job_unschedule(CronJob *job) { PBL_ASSERTN(s_list_mutex); bool removed = false; mutex_lock(s_list_mutex); if (prv_is_scheduled(job)) { list_remove(&job->list_node, &s_scheduled_jobs,...
RateZone3Minutes: PBL_LOG(LOG_LEVEL_WARNING, "Health DB doesn't know about typical metric %d", metric); return false; } return true; } bool health_db_get_monthly_average_value(ActivityMetric metric, int32_t *value_out) { if (metric != ActivityMetricStepCount ...
(&file, key, key_len)
; prv_file_close_and_unlock(&file); return length; } status_t health_db_read(const uint8_t *key, int key_len, uint8_t *value_out, int value_out_len) { if (!prv_key_is_valid(key, key_len)) { return E_INVALID_ARGUMENT; } SettingsFile file; status_t rv = prv_file_open_and_lock(&file); if (rv != S_SUC...
_create(); animation_set_curve(animation, AnimationCurveEaseOut); animation_set_duration(animation, BUMP_SETTLE_DURATION_MS); AnimationHandlers anim_handler = { .stopped = prv_bump_settle_stopped, }; animation_set_handlers(animation, anim_handler, selection_layer); selection_layer->bump_settle_anim_imp...
{ Animation *animation = animation_create(); animation_set_curve(animation, AnimationCurveEaseOut); animation_set_duration(animation, SLIDE_SETTLE_DURATION_MS); AnimationHandlers anim_handler = { .stopped = prv_slide_settle_stopped, }; animation_set_handlers(animation, anim_handler, selection_layer); ...
static void prv_run_slide_animation(SelectionLayer *selection_layer) { #if !PLATFORM_TINTIN Animation *over_animation = prv_create_slide_animation(selection_layer); Animation *settle_animation = prv_create_slide_settle_animation(selection_layer); selection_layer->next_cell_animation = animation_sequence_c...
c uint8_t s_malloc_count = 0; static void *s_ptr = NULL; static uint8_t s_app_state; static uint64_t s_flags = 0; static const Uuid s_app_uuid = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 }; // Helpers /////////////////////////////////////// static void prv_set_remote_active(void) { static const int dead...
stub_app_set_install_id(1337)
; CommSession session; AppStateMessage msg; msg.command = APP_RUN_STATE_INVALID_COMMAND; memcpy(&msg.uuid, &s_app_uuid, sizeof(s_app_uuid)); app_run_state_protocol_msg_callback(&session, (uint8_t*)&msg, sizeof(msg)); // This should be a noop since the key is invalid cl_assert_equal_i(s_launcher_deprec...
/* * 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...
(peek_layer)
; layer_add_child(root_layer, (Layer *)peek_layer); const int standing_ms = 1 * MS_PER_SECOND; data->peek_layer_timer = evented_timer_register(PEEK_LAYER_UNFOLD_DURATION + standing_ms, false, prv_finished_failure_callback, data); } else { prv_finish...
a *data = context; char subtitle_buffer[TXRX_SUBTITLE_LENGTH]; const char *title = NULL; const char *subtitle = NULL; if (data->current_test == BTLETestType_TX) { switch (prv_compensated_tx_menu_row_idx(index, data)) { case TXMenuIdx_Channel: title = "Channel"; itoa_int(data->channel,...
(menu_layer)
oid test_window_stack__pop_all(void) { WindowStack *stack = modal_manager_get_window_stack(ModalPriorityGeneric); Window *windows[3]; for (uint8_t idx = 0; idx < 3; idx++) { windows[idx] = window_create(); } window_stack_push(stack, windows[0], true); cl_assert_equal_i(window_stack_count(stack), 1); ...
cl_assert_equal_i(window_stack_count(window_stacks[idx]), 1)
; cl_assert_equal_i(windows[idx]->on_screen, true); // All windows below the current priority should now not be on the screen // as the modal has subverted them. ModalPriority sub_idx = idx; do { sub_idx--; if (sub_idx == ModalPriorityInvalid) { break; } cl_assert_eq...
enses/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 * limitatio...
prv_display_alert(data->debug_card.dialog_text)
; app_free(averages); } // ----------------------------------------------------------------------------------------- static void prv_display_seconds_history_alert(ActivityDemoAppData *data, const char *title, ActivityMetric metric) { strcpy(data->debug_card.dialog_tex...
itmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw4_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 4); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw4_clip_xy.${BIT_DEPTH_NAME...
(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 3)
; graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw3_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, false, 3); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_...
/* * 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_print("...\r\n\r\n")
; // Disable all interrupts, just in case. for (int i = 0; i < 8; ++i) { // Interrupt Clear-Enable Register NVIC->ICER[i] = 0xFFFFFFFF; // Interrupt Clear-Pending Register NVIC->ICPR[i] = 0xFFFFFFFF; } // Disable all of the peripheral clocks we may have on, but don't touch any of // the rese...
xt_color = GColorWhite, .tint_color = GColorWhite, .compositing_mode = GCompOpAssign, .clip_box = bitmap->bounds, .drawing_box = bitmap->bounds, #if PBL_COLOR .antialiased = !process_manager_compiled_with_legacy2_sdk(), #endif .stroke_width = 1, .draw_implementation = &g_default_draw_impleme...
{ return native; }
GBitmap *result = NULL; if (format == GBitmapFormat1Bit && native->info.format == GBitmapFormat8Bit) { // Create a new blank gbitmap in the correct format. const GBitmap *native_framebuffer = graphics_context_get_bitmap(ctx); if (process_manager_compiled_with_legacy2_sdk()) { result = app_state...
uint16_t inset); static uint8_t *prv_bitmap_offset_for_steps(GBitmap *bmp, int sx, int sy, int steps_x, int steps_y) { sx += (steps_x - 1) / 2; sy += (steps_y - 1) / 2; int16_t step_w = bmp->bounds.size.w / steps_x; int16_t...
(GSize(DISP_COLS, 2 * DISP_ROWS))
; TextLayoutExtended layout = { .flow_data = { .perimeter.impl = &(GPerimeter){.callback=perimeter_for_display_round}, .perimeter.inset = 8, .paging.page_on_screen = { .origin_y = 25, .size_h = 100 }, // setting a page height != enables positioning }, }; render_step...
codepoints(void) { cl_assert(utf8_is_valid_string("\xF0\x9F\x98\x84")); cl_assert(utf8_is_valid_string("😃")); } void test_utf8__copy_single_byte_char(void) { utf8_t dest[5]; memset(dest, 0, 5); size_t copied = utf8_copy_character(dest, (utf8_t *)"hello", 5); cl_assert_equal_i(copied, 1); cl_assert_equa...
cl_assert_equal_s(output_buffer, "Hello World! \xe2\x80\xa6")
; cl_assert_equal_i(trunc_size, 17); // test that we access unallocated memory if the output buffer is too small output_buffer = realloc(output_buffer, 5); cl_assert_passert(utf8_truncate_with_ellipsis("Hello", output_buffer, 6)); free(output_buffer); }
/* * 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...
applib_free(rot_bitmap_layer)
; } void rot_bitmap_layer_set_corner_clip_color(RotBitmapLayer *image, GColor color) { if (gcolor_equal(color, image->corner_clip_color)) { return; } image->corner_clip_color = color; layer_mark_dirty(&(image->layer)); } void rot_bitmap_layer_set_corner_clip_color_2bit(RotBitmapLayer *bitmap, GColor2 colo...
); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT...
(TINTIN_BUILD_ID.data_length == BUILD_ID_EXPECTED_LEN)
; return &TINTIN_BUILD_ID.data[TINTIN_BUILD_ID.name_length]; } void version_copy_build_id_hex_string(char *buffer, size_t buffer_bytes_left, const ElfExternalNote *elf_build_id) { size_t build_id_bytes_left = elf_build_id->data_length; const uint8_t *build_id = &elf_build_i...
evice_name_with_fallback(remote, name); if (is_connected && (0 == memcmp(addr, &active_addr, sizeof(*addr)))) { remote->classic.connected = true; } else { remote->classic.connected = false; } add_remote(data, remote); } static void prv_add_bt_classic_remotes(SettingsBluetoothData *data) { bt_persi...
(data->header_buffer, HEADER_BUFFER_SIZE, (num_remotes != 1) ? i18n_get("%u Paired Phones", data) : i18n_get("%u Paired Phone", data), num_remotes)
; } } void settings_bluetooth_update_remotes(SettingsBluetoothData *data) { settings_bluetooth_update_remotes_private(data); settings_menu_reload_data(SettingsMenuItemBluetooth); } ////////// static void prv_settings_bluetooth_event_handler(PebbleEvent *event, void *context) { SettingsBluetoothData* settings...
timeline_item_find_action_by_type(NULL, TimelineItemActionTypeGeneric)
, NULL); // Make sure we can handle timeline items with no actions TimelineItem item = {}; cl_assert_equal_p(timeline_item_find_action_by_type(&item, TimelineItemActionTypeGeneric), NULL); // Make sure we actually find the items we're looking for item.action_group.num_actions = ARRAY_LENGTH(s_basic_action_l...
coordinates // and shift by this factor to prevent overflow. int32_t shift_factor[N_AXIS] = { 0 }; for (int j = 0; j < N_AXIS; j++) { for (int i = 0; i < N_SAMPS; i++) { shift_factor[j] += s_samples[i][j]; } shift_factor[j] /= N_SAMPS; } int16_t raw_data[N_SAMPS][N_AXIS]; for (int i = 0; ...
{ int32_t s[3] = { s_samples[idx_line_b][0] - s_samples[idx_line_a][0], s_samples[idx_line_b][1] - s_samples[idx_line_a][1], s_samples[idx_line_b][2] - s_samples[idx_line_a][2] }; int32_t m1[3] = { s_samples[idx_line_a][0] - s_samples[idx_pt][0], s_samples[idx_line_a][1] - s_samples[idx_pt][...
static bool pt_to_plane_dist_under_thresh(int idx_pln_a, int idx_pln_b, int idx_pln_c, int idx_pt, int32_t thresh) { int32_t v_ab[3]; int32_t v_ac[3]; for (int i = 0; i < 3; i++) { v_ab[i] = s_samples[idx_pln_b][i] - s_samples[idx_pln_a][i]; v_ac[i] = s_samples[idx_pln_c][i] - s_samples[idx_pln...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
kernel_free(send_job)
(window_layer, text_layer_get_layer(data->sleep_card.text_layer))
; // Update UI sleep_update_text(data); } // ------------------------------------------------------------------------------- static void sleep_window_unload(Window *window) { HealthAPITestAppData *data = window_get_user_data(window); text_layer_destroy(data->sleep_card.text_layer); data->sleep_card.text_la...
ouchEvent *touch_event) { int *idx = recognizer_get_impl_data(recognizer, &s_dummy_impl); prv_store_recognizer_idx(recognizer, &s_recognizers_handled); if ((s_idx_to_change >= 0) && (*idx == s_idx_to_change)) { recognizer_transition_state(recognizer, s_next_state); s_idx_to_change = -1; s_next_state =...
(&e, &manager)
; prv_compare_recognizers_processed((int[]) {4, 0, 3}, 3, &s_recognizers_handled); cl_assert_equal_p(manager.active_layer, &layer_c); cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersTriggered); cl_assert_equal_i(recognizers[0]->state, RecognizerState_Failed); cl_assert_equal_i(recognizers[1...
cl_assert_equal_i(0, s_rocky_path_steps_num)
; EXECUTE_SCRIPT( "ctx.moveTo(1, 2);\n" "ctx.rect(3, 4, 5, 6);\n" ); cl_assert_equal_i(6, s_rocky_path_steps_num); EXECUTE_SCRIPT( "ctx.rect(7, 8, 9, 10);\n" ); cl_assert_equal_i(11, s_rocky_path_steps_num); cl_assert_equal_i(RockyAPIPathStepType_MoveTo, s_rocky_path_steps[0].type); cl_asse...
sector_addr); // Is an operation in progress? if ((sr & S29VSStatusBit_DeviceReady) != 0) { // No erase in progress to suspend. Maybe the erase completed before this // call. status = S_NO_ACTION_REQUIRED; } else if ((sr & S29VSStatusBit_BankStatus) != 0) { // Operation is in a different bank than...
if (buffer_size - bytes_read == 1) { uint16_t temp_buffer = *(__IO uint16_t *)(flash_data_addr + bytes_read); buffer[bytes_read++] = (uint8_t)(temp_buffer & 0xFF); } else if (buffer_size - bytes_read != 0) { // Should not reach here PBL_LOG(LOG_LEVEL_DEBUG, "Invalid data length read"); }
flash_impl_release(); return S_SUCCESS; } int flash_impl_write_page_begin(const void *vp_buffer, const FlashAddress start_addr, size_t len) { if (!len) { return E_INVALID_ARGUMENT; } const uint8_t *buffer = vp_buffer; // Flash write transactions can only write one pag...
fmt_args); } // Core Number must be shifted to the correct position. void pbl_log_hashed_core(const uint32_t core_number, const uint32_t packed_loghash, ...) { va_list fmt_args; va_start(fmt_args, packed_loghash); pbl_log_hashed_vargs(true, core_number, packed_loghash, fmt_args); va_end(fmt_args); } // Core...
va_start(args, fmt)
efine ROCKY_CANVAS_CONSTRUCTOR "CanvasElement" #define ROCKY_CANVAS_CLIENTWIDTH "clientWidth" #define ROCKY_CANVAS_CLIENTHEIGHT "clientHeight" #define ROCKY_CANVAS_UNOBSTRUCTEDLEFT "unobstructedLeft" #define ROCKY_CANVAS_UNOBSTRUCTEDTOP "unobstructedTop" #define ROCKY_CANVAS_UNOBSTRUCTEDWIDTH "unobstructedWidth" #defin...
prv_rect_call(argc, argv, graphics_fill_rect)
GColorChromeYellow; } else { text = "Press select to launch your app or press up / down to browse the timeline"; color = GColorPictonBlue; } window_set_background_color(&data->window, PBL_IF_COLOR_ELSE(color, GColorWhite)); #endif text_layer_set_text(&data->info_text_layer, text); } static void prv_up...
app_window_stack_push(window, true /* is_animated */)
; } static void s_main(void) { prv_init(); app_event_loop(); } const PebbleProcessMd* sdk_app_get_info(void) { static const PebbleProcessMdSystem s_app_md = { .common = { .main_func = s_main, // UUID: 1197fc39-47e7-439b-82be-f56d9ba1dbd8 .uuid = { 0x11, 0x97, 0xfc, 0x39, 0x47, 0xe7, 0x43,...
ate(GRectZero); layer_add_child(a, aa); layer_add_child(aa, aaa); layer_add_child(aaa, aaaa); layer_add_child(a, ab); a->next_sibling = b; stack[0] = a; // go to child if possible Layer *actual = __layer_tree_traverse_next__test_accessor(stack, ARRAY_LENGTH(stack), &current_stack, true); cl_a...
GRect(0, 0, 10, 10)
); layer_set_frame(&child_b, &GRect(2, 2, 6, 6)); layer_set_frame(&child_c, &GRect(10, 10, 10, 10)); layer_set_frame(&child_d, &GRect(2, 2, 6, 6)); layer_set_frame(&child_e, &GRect(10, 10, 10, 10)); layer_set_frame(&child_f, &GRect(-10, -10, 40, 40)); layer_add_child(&parent, &child_a); cl_assert_equal_p...
playback rate (Apple's Podcast app can vary the playback rate) //! -100 = backwards at normal rate int32_t playback_rate_percent; //! The current playback state MusicPlayState playback_state; } s_music_ctx; void music_init(void) { s_music_ctx.mutex = mutex_create_recursive(); } static void copy_and_trunca...
{ // TODO: actually do something with this off_t o = offsetof(__typeof__(s_music_ctx), player_name); prv_update_string_and_put_event(player_name, player_name_length, o); }
void music_update_track_title(const char *title, size_t title_length) { off_t o = offsetof(__typeof__(s_music_ctx), title); prv_update_string_and_put_event(title, title_length, o); } void music_update_track_artist(const char *artist, size_t artist_length) { off_t o = offsetof(__typeof__(s_music_ctx), artist); ...
ave, register_address, value); i2c_release(dev->i2c_slave); return rv; } static bool prv_read_register_block(HRMDevice *dev, uint8_t register_address, void *buffer, uint32_t length) { i2c_use(dev->i2c_slave); bool rv = i2c_read_register_block(dev->i2c_slave, register_address...
if (hrm_data_regs.sqi <= AS7000SQIThreshold_Poor) { data->hrm_quality = HRMQuality_Poor; } else if (hrm_data_regs.sqi <= AS7000SQIThreshold_Worst) { data->hrm_quality = HRMQuality_Worst; } else if (hrm_data_regs.sqi == AS7000SQIThreshold_OffWrist) { data->hrm_quality = HRMQuality_OffWrist; } else { ...
} // Sequence of events for handshake pulse (when in one-second burst mode): // - [optional] Host writes the one-second time (registers 10,11) measured for the last 20 // samples (about one second). // - Host reads any data/HRV-result/LED-current, as needed (see registers [14...53]) // - Host reads the ...
yback_state(void) { cl_assert_equal_i(music_get_playback_state(), MusicPlayStateUnknown); uint32_t track_pos_ms; uint32_t track_duration_ms; music_get_pos(&track_pos_ms, &track_duration_ms); cl_assert_equal_i(track_pos_ms, 0); cl_assert_equal_i(track_duration_ms, 0); cl_assert_equal_i(music_get_playback...
music_is_progress_reporting_supported()
, true); cl_assert_equal_b(music_is_volume_reporting_supported(), true); cl_assert_equal_b(music_needs_user_to_start_playback_on_phone(), true); for (MusicCommand cmd = 0; cmd < NumMusicCommand; ++cmd) { cl_assert_equal_b(music_is_command_supported(cmd), true); } cl_assert_equal_b(music_is_command_suppor...
battery_curve_lookup_voltage_by_percent(20, false)
; fake_battery_init(low_mv, false, false); fake_rtc_auto_increment_ticks(50000); battery_monitor_init(); periodic_timer_trigger(5); cl_assert_equal_i(battery_get_charge_state().charge_percent, 50); // Should be stable by now // Shouldn't update percent (actually, shouldn't even send events.) PBL_LOG(...
ubs_notification_storage.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_pebble_tasks.h" #include "stubs_prompt.h" #include "stubs_sleep.h" #include "stubs_task_watchdog.h" #include "stubs_vibes.h" #include "stubs_vibe_score_info.h" #include "fake_rtc.h" // Overrides //////////////////////...
alerts_should_enable_backlight_for_type(AlertReminder)
); cl_assert(alerts_should_notify_for_type(AlertOther)); cl_assert(!alerts_should_vibrate_for_type(AlertOther)); alerts_set_notification_vibe_timestamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS); cl_assert(!alerts_should_enable_backlight_for_type(AlertOther)); cl_assert(alert...
/* * 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...
GET_FILE_NAME(src_filename)
/* * 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...
strchr(testbuf, 0xF00 + 'l')
, testbuf+2); } void test_strchr__end_of_string(void) { char testbuf[8] = "Hello!B"; cl_assert_equal_p(strchr(testbuf, '\0'), testbuf+7); } void test_strchr__r_basic(void) { char testbuf[8] = "Hello!B"; cl_assert_equal_p(strrchr(testbuf, 'B'), testbuf+6); } void test_strchr__r_unfound(void) { char testbuf[...
/* * 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...
timeline_item_create_with_attributes(rtc_get_time(), 0, TimelineItemTypeNotification, LayoutIdNotification, &attr_list, &action_group)
; i18n_free_all(&attr_list); attribute_list_destroy_list(&attr_list); attribute_list_destroy_list(&dismiss_action_attr_list); attribute_list_destroy_list(&stop_action_attr_list); notifications_add_notification(item); timeline_item_destroy(item); }
/* * 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 (!BOARD_CONFIG_BUTTON.button_com.gpio) { // This board doesn't use a button common pin. return; } // Configure BUTTON_COM to drive low. When the button // is pressed this pin will be connected to the pin for the // button. gpio_use(BOARD_CONFIG_BUTTON.button_com.gpio); GPIO_InitTypeDef GPIO...
static void initialize_button(const ButtonConfig* config) { // Configure the pin itself gpio_use(config->gpio); GPIO_InitTypeDef GPIO_InitStructure; GPIO_StructInit(&GPIO_InitStructure); GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.G...
UID_INVALID, &glance), E_DOES_NOT_EXIST); } void test_app_glance_db__reading_glance_with_invalid_arguments_fails(void) { // NULL UUID fails AppGlance glance_out = {}; cl_assert_equal_i(app_glance_db_read_glance(NULL, &glance_out), E_INVALID_ARGUMENT); // NULL glance_out fails cl_assert_equal_i(app_glance_db...
fake_event_get_last()
; cl_assert_equal_i(e.type, PEBBLE_APP_FETCH_REQUEST_EVENT); cl_assert(!e.app_fetch_request.with_ui); cl_assert_equal_i(e.app_fetch_request.id, 10); } void test_app_glance_db__insert_app_in_cache(void) { cl_assert_equal_i(app_glance_db_insert((uint8_t *)&APP_GLANCE_TEST_UUID, UUID_SIZE, s_app_glance_basi...
ontext; window_stack_pop(true); window_stack_push(data->steps_window, true); } // ------------------------------------------------------------------------------- static void sleep_down_long_click_handler(ClickRecognizerRef recognizer, void *context) { HealthAPITestAppData *data = (HealthAPITestAppData *)context;...
{ HealthAPITestAppData *data = (HealthAPITestAppData *)context; #if TEST_MODE data->steps_offset += 5; data->cur_steps += 5; layer_mark_dirty(window_get_root_layer(data->steps_window)); steps_update_text(data); return; #endif window_stack_pop(true); window_stack_push(data->sleep_window, true /* Animated...
// ------------------------------------------------------------------------------- static void steps_down_click_handler(ClickRecognizerRef recognizer, void *context) { HealthAPITestAppData *data = (HealthAPITestAppData *)context; window_stack_pop(true); window_stack_push(data->hr_window, true /* Animated */); ...
software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "util/heap.h" #include "util/assert.h" #inclu...
(heap->corrupt_block)
; heap->corrupt_block = NULL; } } static void prv_handle_corruption(Heap * const heap, void *ptr) { if (heap->corruption_handler) { heap->corrupt_block = ptr; return; } UTIL_ASSERT(0); // Error: Heap corrupt around <ptr> } static HeapInfo_t *find_segment(Heap* const heap, unsigned long n_units); s...
d) { return s_test_alg_state.last_sleep_utc; } bool activity_algorithm_test_send_fake_minute_data_dls_record(void) { return true; } // ========================================================================================= // Tests // ---------------------------------------------------------------------------...
cl_assert_equal_i(record->version, ACTIVITY_RAW_SAMPLES_VERSION)
_get_top_window = (Window){}; s_app_event_loop_callback = NULL; s_log_internal__expected = NULL; s_prv_api_init__callcount = 0; s_prv_api_add__callcount = 0; s_prv_api_add__result = false; s_prv_api_remove__callcount = 0; s_prv_listener_a1__callcount = 0; s_prv_listener_a2__callcount = 0; s_prv_lis...
cl_assert_equal_i(2, jerry_obj_refcount(o))
; jerry_release_value(o); cl_assert_equal_i(1, jerry_obj_refcount(o)); jerry_release_value(o); cl_assert_equal_i(0, jerry_obj_refcount(o)); } void test_rocky_api_global__calls_listeners(void) { static const RockyGlobalAPI *apis[] = {NULL}; rocky_global_init(apis); prv_add_event_listener_to_list("a", jer...
_size); buffer[buffer_size - 1] = '\0'; } } static GTextNode *prv_wrap_text_node_in_vertically_centered_container(GTextNode *node) { const size_t max_vertical_container_nodes = 1; GTextNodeVertical *vertical_container_node = graphics_text_node_create_vertical(max_vertical_container_nodes); vertical_c...
(settings_glance->charging_indicator_icon)
; } app_free(settings_glance); } static void prv_set_glance_icon(LauncherAppGlanceSettings *settings_glance, uint32_t new_icon_resource_id) { if (settings_glance->icon_resource_id == new_icon_resource_id) { // Nothing to do, bail out return; } // Destroy the existing ...
memcpy(buffer, attr_list->attributes[i].uint32_list, attribute->length); break; default: attribute->length = 0; break; } buffer += attribute->length; PBL_ASSERTN(buffer <= buf_end); } return buffer - buf_start; } bool attribute_deserialize_list(char **buffer,...
if (prv_attribute_type(id) != AttributeTypeString) { PBL_LOG(LOG_LEVEL_WARNING, "Adding attribute with type cstring for non-cstring attribute"); }
utc = time_start_of_today() - SECONDS_PER_DAY; return (update_time_utc < oldest_valid_time_utc); } static bool prv_fill_forecast_from_entry(WeatherDBEntry *entry, WeatherLocationForecast *forecast_out) { PascalString16List pstring16_list; pstring_project_list_on_serialize...
watch_app_prefs_get_weather()
; if (!prefs) { PBL_LOG(LOG_LEVEL_ERROR, "No SerializedWeatherAppPrefs available!"); return false; } // Can occur if the user removes all weather locations from their mobile app if (prefs->num_locations == 0) { watch_app_prefs_destroy_weather(prefs); return false; } const size_t default_lo...
one1], 20); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone2], 10); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone3], 10); // Pause the workout. Don't accumulate time in zones cl_assert(workout_service_pause_workout(true)); prv_inc_time(10); prv_put_bpm_event(ZONE_3_HR, HRMQuality_Good); cl_assert(workout_se...
prv_inc_time(25 * SECONDS_PER_MINUTE)
olor.argb + 1) & 0x3F) | 0xC0); } data->circle_origin.y += (data->circle_velocity_y * PIXEL_SPEED_PER_FRAME); if (data->circle_origin.y - data->circle_radius < 0 || data->circle_origin.y + data->circle_radius > data->window.layer.bounds.size.h) { data->circle_velocity_y = data->cir...
(data->state_index)
) { graphics_context_set_stroke_width(ctx, data->stroke_width); } else { graphics_context_set_stroke_width(ctx, 1); } graphics_context_set_antialiased(ctx, data->antialiased); graphics_fill_rect(ctx, &layer->bounds); uint8_t color_index = 0; for (uint8_t shape_index = POINT; shape_index < MAX_SHAP...
ibuted 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 <stdint.h> #include <string.h> #include <limits.h> #include <math.h> #include "clar.h" // "Defi...
(dstbuf, "zero1")
; // Length modifiers int64_t hurf = 0x123456789ABCDEF0ULL; snprintf(dstbuf, 256, "%hhd,%hd,%d,%ld", hurf, hurf, hurf, hurf); cl_assert_equal_s(dstbuf, "-16,-8464,-1698898192,-1698898192"); snprintf(dstbuf, 256, "%lld,%jd", hurf, hurf); cl_assert_equal_s(dstbuf, "1311768467463790320,1311768467463790320"); ...
cted) { prv_put_comm_session_event(app_connected); prv_put_phone_event(PhoneEventType_Incoming, source, ANCS_CALL_UID); } static void prv_call_end(void) { // Note: the source doesn't matter here, phone_call.c ignores it prv_put_phone_event(PhoneEventType_End, PhoneCallSource_PP, ANCS_CALL_UID); } static void ...
{ // We should allow incoming calls with or without a mobile app on iOS 9 prv_put_incoming_call_event(PhoneCallSource_ANCS, false); ASSERT_LAST_EVENT(PhoneEventType_Incoming); prv_call_end(); ASSERT_LAST_EVENT(PhoneEventType_End); prv_put_incoming_call_event(PhoneCallSource_ANCS, true); ASSERT_LAST_EVEN...
// --------------------------------------------------------------------------------------- // Basic test for call start events void test_phone_call__call_start(void) { // A call start event with ANCS should act as a call end in order to hide the phone ui prv_put_incoming_call_event(PhoneCallSource_ANCS_Legacy, t...
{ fw_status_resp.resource_bytes_written = status.num_bytes_written; fw_status_resp.resource_crc = status.crc_of_bytes; }
PBL_LOG(LOG_LEVEL_INFO, "FW Status Resp: res %"PRIu32" : 0x%x fw %"PRIu32" : 0x%x", fw_status_resp.resource_bytes_written, (int)fw_status_resp.resource_crc, fw_status_resp.firmware_bytes_written, (int)fw_status_resp.firmware_crc); comm_session_send_data(session, ENDPOINT_ID, (uint8_t *)&fw_st...
); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw11_clip_nxny.${BIT_DEPTH_NAME}.pbi")); } void test_graphics_draw_round_rect_${BIT_DEPTH_NAME}__origin_radius_aa_sw(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // AA = true, SW = 1 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax_aa_sw11_no_clip.${BIT_DEPTH_NAME}.pbi"))
; #endif // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 11); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2)); cl_check(gbitmap_pbi_eq(&ctx....
/* * 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...
(SEND_TEXT_NOTIF_PREF_KEY)
)) { return; } s_has_send_text_reply_action = prv_has_send_text_reply_action(); } void send_text_service_init(void) { // Save the initial state s_has_send_text_reply_action = prv_has_send_text_reply_action();; // Register for updates static EventServiceInfo s_blobdb_event_info = { .type = PEBBLE_...
// number s_log_internal__expected = (const char *[]){ "Exception while e3", "ReferenceError", NULL, }; rocky_log_exception("e3", e3); cl_assert(*s_log_internal__expected == NULL); } /* * FIXME: JS Tests should be built in a 32-bit env void test_js__size(void) { cl_assert_equal_i(4, sizeof(size_t));...
jerry_release_value(global_object)
; jerry_release_value(date_builtin); } void test_js__get_global_builtin_changed(void) { jerry_value_t date_builtin = jerry_get_global_builtin((const jerry_char_t *)"Date"); jerry_value_t global_object = jerry_get_global_object(); const char *source = "Date = 'some string';"; jerry_eval((const jerry_char_t *...
l).row); cl_assert_equal_i(0, l.selection.y); menu_layer_set_selected_next(&l, false, MenuRowAlignNone, false); cl_assert_equal_i(0, menu_layer_get_selected_index(&l).section); cl_assert_equal_i(2, menu_layer_get_selected_index(&l).row); const int16_t basic_cell_height = menu_cell_basic_cell_height(); cl_a...
(cell_layer->window, s_menu_layer_hierarchy.scroll_layer.layer.window)
r = graphics_capture_frame_buffer(ctx); if (!framebuffer) { // Couldn't capture framebuffer return; } ctx->draw_state.draw_implementation->blend_horizontal_line(ctx, y, x1, x2, ctx->draw_state.stroke_color); graphics_release_frame_buffer(ct...
if (y2.integer >= max_valid_y) { y2.fraction = 0; }
ctx->draw_state.draw_implementation->assign_vertical_line(ctx, x, y1, y2, color); } void graphics_private_draw_horizontal_line(GContext *ctx, int16_t y, Fixed_S16_3 x1, Fixed_S16_3 x2) { #if PBL_COLOR if (ctx->draw_state.antialiased) { // apply draw box and clippin...
{ 920, -64, 288}, { 1112, -160, 440}, { 936, -8, 296}, { 1016, 16, 264}, { 976, 64, 224}, { 912, 184, 200}, { 976, 240, 192}, { 992, 336, 168}, { 1048, 360, 96}, { 1040, 224, 40}, { 1056, 16, 96}, { 1024, 88, 304}, { 968, 144, 304}, { 944, 112, 264}, { 1104, 136...
{ 992, -152, -24}, { 944, -104, 24}, // 140 seconds { 960, -32, -32}, { 992, 0, -32}, { 1072, 40, 0}, { 1128, -8, 24}, { 1128, -8, -16}, { 1096, -80, 80}, { 1128, -112, 80}, { 1120, -128, 80}, { 1056, -16, 40}, { 1048, -64, 64}, { 1096, -112, 32}, { 1072, -72,...
{ 752, 200, 80}, { 872, -104, 280}, { 1304, -296, 472}, { 1032, -112, 416}, { 1088, -48, 304}, { 928, -80, 168}, { 992, -16, 24}, { 992, 40, 32}, // 143 seconds { 1120, 24, 88}, { 1056, 136, 72}, { 1064, 272, 48}, { 1024, 312, 120}, { 1032, 240, 184}, { 1072,...
t_for_sequence_unschedule_from_child); } // -------------------------------------------------------------------------------------- // Test calling unschedule on the sequence from the stopped handler of one of its children void test_animation__sequence_unschedule_from_child(void) { #ifdef TEST_INCLUDE_COMPLEX const i...
prv_advance_to_ms_with_timers(start_ms + duration_a/2)
; cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0)...
} else { // Data was seen, reset the interval counter s_stop_mode_monitor.intervals_without_data = 0; } // Regardless of what happened, this interval is over and should be reset s_stop_mode_monitor.data_seen_this_interval = false; } static void prv_start_timer_cb(void *context) { new_timer_start(s_st...
while (!(uart_is_tx_ready(ACCESSORY_UART))) continue;
/* * 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...
{ syscall_internal_elevate_privilege(); buf[0] = 'a'; char * new = buf; do_stuff(new, size); }
on 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS ...
(GAP_CONN_MODE_UNDIRECTED)
; if (rv != BLE_STATUS_OK) { PBL_LOG(LOG_LEVEL_ERROR, "ble_gap_adv_start: status = 0x%x", rv); } else { PBL_LOG(LOG_LEVEL_DEBUG, "Adverts (re)started"); } return rv; } static ble_error_t prv_advert_disable(void) { ble_error_t rv = ble_gap_adv_stop(); if (rv != BLE_STATUS_OK) { PBL_LOG(LOG_LEVEL...
break; } // If the current value is within the time range, incorporate it into the stats time_t now_utc = sys_get_time(); if (time_end > now_utc - SECONDS_PER_MINUTE) { HealthValue current_value; bool success = sys_activity_get_metric(ActivityMetricHeartRateRawBPM, 1, &current_value); if (success &...
if (e->health_event.type == HealthEventSignificantUpdate) { if (state->cache) { state->cache->valid_flags = 0; } } // If this is a step update, update the cached value for today else if (e->health_event.type == HealthEventMovementUpdate) { if (state->cache) { state->cache->steps_daily.tot...
state->event_handler(e->health_event.type, state->context); // If we crossed an alert threshold, generate a metric alert event if (state->cache) { prv_check_and_generate_metric_alert(state, HealthMetricHeartRateBPM, &state->cache->alert_threshold_heart_rate); } #en...
rst run we detect that some // parents want to unschedule but couldn't because they still have children running, then we // run again so that the parents can check again if their children finished on the first run. AnimationPrivate *animation = (AnimationPrivate *) state->scheduled_head; while (animatio...
prv_animation_state_get(PebbleTask_Current)
he Md, but only if it isn't a system application app_install_release_md(context->app_md); // Clear the old app metadata context->app_md = 0; context->install_id = INSTALL_ID_INVALID; if (context->to_process_event_queue && pdFAIL == event_queue_cleanup_and_reset(context->to_process_event_queue)) { ...
{ if (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(event, sizeof(*event)); } xQueueReceive(prv_get_context()->to_process_event_queue, event, portMAX_DELAY); }
// ------------------------------------------------------------------------------------------- DEFINE_SYSCALL(AppLaunchReason, sys_process_get_launch_reason, void) { return prv_get_context()->launch_reason; } // ------------------------------------------------------------------------------------------- DEFINE_SYSC...
bounds->size.w, bounds->size.h)); graphics_context_set_stroke_color(ctx, GColorRed); graphics_draw_rect(ctx, frame); } static void canvas_update_proc(Layer *layer, GContext* ctx) { AppData *data = window_get_user_data(s_window); GColor main_color = (GColor)GColorRoseVale; gra...
pbl_override_localtime(&now)
); } static void prv_bt_le_gateway_response_latency_watchdog_cb(void *data) { // offload handling onto KernelBG so we don't stall the timer thread // trying to get the bt lock system_task_add_callback(prv_bt_le_gateway_response_latency_watchdog_handler, data); } static bool prv_find_source(ListNode *found_node,...
(curr_request)
; curr_request = temp; } kernel_free(*info); *info = NULL; } void command_change_le_mode(char *mode) { // assume we only have one connection for debug GAPLEConnection *conn_hdl = gap_le_connection_any(); ResponseTimeState state = atoi(mode); conn_mgr_set_ble_conn_response_time( conn_hdl, BtCo...
set_state(data, TimelineAppStateDaySeparator)) { return; } // Pins will reappear after the day separator completes hiding in `prv_hide_day_sep_stopped` timeline_layer_set_layouts_hidden(&data->timeline_layer, true); prv_set_day_sep_timer(data); } static void prv_up_down_click_handler(ClickRecognizerRef r...
(data, TimelineAppStateStationary)
; } timeline_model_remove(id); prv_update_timeline_layer(data); } else if (type == BlobDBEventTypeInsert) { for (int i = 0; i < TIMELINE_NUM_VISIBLE_ITEMS; i++) { if (timeline_model_get_iter_state(i)->node && uuid_equal(&timeline_model_get_iter_state(i)->pin.header.id, id)) { p...
t info on this activity uint32_t session_len_sec = session->length_min * SECONDS_PER_MINUTE; time_t session_exit_utc = session->start_utc + session_len_sec; ActivityClassParams *params = NULL; switch (session->type) { case ActivitySessionType_Sleep: case ActivitySessionType_Nap: par...
PBL_LOG(LOG_LEVEL_ERROR, "Invalid activity session detected - could be flash corrruption")
; // Zero out flash so that we don't get into a reboot loop memset(state->activity_sessions, 0, sizeof(state->activity_sessions)); settings_file_set(file, &key, sizeof(key), state->activity_sessions, sizeof(state->activity_sessions)); WTF; } sta...
ne_width, GRect frame, GColor color) { const GPoint line_outer_point = prv_steps_to_point(current_progress, total_progress, frame); #if PBL_RECT const GPoint line_inner_point = prv_inset_point(&frame, line_outer_point, line_length); #elif PBL_ROUND const GRect inner_bounds = grect_inset(frame, GEdgeInsets(line_l...
health_util_create_text_node_with_text( am_pm_buffer, am_pm_font, GColorWhite, container)
; } #if PBL_BW bounds.origin.y = screen_is_obstructed ? (has_bpm ? 13 : 23) : (has_bpm ? 36 : 53); #elif ROBERT_SCREEN_RES bounds.origin.y = screen_is_obstructed ? -12 : 6; #elif SNOWY_SCREEN_RES bounds.origin.y = screen_is_obstructed ? 4 : 47; #elif SPALDING_SCREEN_RES bounds.origin.y = 50; #endif graphi...
dge cases * * Example case: * * . far_top * \ * /\ * / ' far_right * far_left . / * \/ * \ * ' far_bottom */ if (dx_fixed > 0) { if (dy_fixed > 0) { // Line heading d...
MAX(p0.y.raw_value, p1.y.raw_value)
+ radius.raw_value; const int8_t fraction_for_top = top_point & fraction_mask; const int8_t fraction_for_bottom = bottom_point & fraction_mask; // Drawing loop: Iterates over horizontal lines // As part of optimisation, this algorithm is moving between drawing boundaries, // so drawing box has to...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ // the RTC is not yet initialized to the point where it can wake us from sleep or sleep/stop // is disabled. Just returning will cause a busy loop where the caller thought we slept for // 0 ticks and will reevaluate what to do next (probably just try again). return; }
// Note: all tasks are suspended at this point, but we can still be interrupted // so the critical section is necessary. taskENTER_CRITICAL() is not used here // as that method would mask interrupts that should exit the low-power mode. // The __disable_irq() function sets the PRIMASK bit which globally preven...
/* * 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_fb, &(GSize) {DISP_COLS, DISP_ROWS})
; graphics_context_init(&s_ctx, &s_fb, GContextInitializationMode_App); } void test_char_iterator__test_string_empty(void) { bool success = false; const Utf8Bounds utf8_bounds = utf8_get_bounds(&success, ""); cl_assert(success); const TextBoxParams text_box_params = (TextBoxParams) { .utf8_bounds = &utf...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_IF_ROUND_ELSE(6, 3)
; const uint16_t msg_text_y_offset_px = PBL_IF_ROUND_ELSE(15, 0); const uint16_t msg_text_max_height_px = root_layer_bounds->size.h - msg_text_y_offset_px; const GTextAlignment alignment = PBL_IF_ROUND_ELSE(GTextAlignmentRight, GTextAlignmentLeft); const GTextOverflowMode overflow_mode = GTextOverflowModeTrail...
/* * 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_set_text_node_text_parameters_from_config(text_node, layout, &config->text); }
return text_node; } static GTextNodeText *prv_create_text_buffer_node_from_config( const LayoutLayer *layout, const LayoutNodeTextBufferConfig *config) { GTextNodeText *text_node = NULL; const char *str = config->use_i18n ? i18n_get(config->str, layout) : config->str; if (!IS_EMPTY_STRING(str)) { text...
ert(info->type == PEBBLE_SMARTSTRAP_EVENT); s_event_handler = NULL; } bool process_manager_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 sm...
(app_smartstrap_attribute_end_write(attr, 100, true))
; // smartstrap_attribute_read() 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, 1...
expire_s, HRMFeature_BPM, prv_fake_hrm_2_cb, NULL); fake_system_task_callbacks_invoke_pending(); prv_fake_send_new_data(); // Make sure only 1 callback (and hence one circular buffer entry) got queued up cl_assert_equal_i(p...
circular_buffer_write(&cb, (const uint8_t *)&event[i], sizeof(PebbleHRMEvent))
; } PebbleHRMEvent out_event[NUM_TEST_EVENTS]; for (int i = 0; i < NUM_TEST_EVENTS; ++i) { prv_read_event_from_buffer_and_consume(&cb, &out_event[i]); cl_assert_equal_b(memcmp(&event[i], &out_event[i], sizeof(PebbleHRMEvent)), false); } } } #undef NUM_TEST_EVENTS // Test the enable and di...
sert_equal_i(s_num_alarms_fired, 5); cl_assert_equal_i(s_num_alarm_events_put, 5); cl_assert_equal_i(s_num_timeline_adds, 41); cl_assert_equal_i(s_num_timeline_removes, 30); cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); // Second alarm goes off. First one should be up again...
rtc_get_time()
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert(custom_only_define())
; }
nding_did_read.attribute == attribute); cl_assert(s_pending_did_read.length == length); s_pending_did_read.active = false; } static void prv_prepare_for_did_write(SmartstrapAttribute *attribute) { cl_assert(!s_pending_did_write.active); s_pending_did_write = (PendingInfo) { .active = true, .attribute =...
app_smartstrap_attribute_create(0x1111, 0x2222, 100)
; cl_assert(attr != NULL); // try to create it again SmartstrapAttribute *attr_dup = app_smartstrap_attribute_create(0x1111, 0x2222, 100); cl_assert(attr_dup == NULL); // destroy the attribute app_smartstrap_attribute_destroy(attr); // destroy again (shouldn't do anything bad) app_smartstrap_attribut...
he //! Bluetooth base UUID. @see bt_uuid_expand_16bit @see bt_uuid_expand_32bit static uint8_t prv_smallest_bt_uuid_width_in_bytes(const Uuid *uuid) { const Uuid bt_uuid_base = bt_uuid_expand_16bit(0); // The bytes after the first 4 contain the Bluetooth base. // Check if the uuid is based off of the Bluetooth b...
prv_write_element_to_ad_data(ad, (const BLEAdElement *) element)
; } // ----------------------------------------------------------------------------- bool ble_ad_set_local_name(BLEAdData *ad, const char *local_name) { if (!local_name) { return false; } const size_t length = strlen(local_name); uint8_t element_buffer[sizeof(BLEAdElement) + leng...
true}; char alarm_day_text_1[32] = {0}; alarm_get_string_for_custom(schedule_1, alarm_day_text_1); cl_assert_equal_s(alarm_day_text_1, "Sat,Sun"); bool schedule_2[7] = {true, true, true, true, true, true, true}; char alarm_day_text_2[32] = {0}; alarm_get_string_for_custom(schedule_2, alarm_day_text_2); c...
assert_alarm_pins_absent(id4)
; id7 = alarm_create(&(AlarmInfo) { .hour = 17, .minute = 17, .kind = ALARM_KIND_WEEKENDS }); for (int i = 0; i < MAX_CONFIGURED_ALARMS; ++i) { alarm_delete(i); prv_assert_alarm_config_absent(i); assert_alarm_pins_absent(i); } alarm_delete(1); } void test_alarm__snooze_delay(void) { int delay; ...
/* * 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...
system_theme_get_font_for_default_size(TextStyleFont_MenuCellTitle)
; } static ALWAYS_INLINE GFont prv_get_cell_subtitle_font(const MenuCellLayerConfig *config) { return config->subtitle_font ?: system_theme_get_font_for_default_size(TextStyleFont_MenuCellSubtitle); } static ALWAYS_INLINE GFont prv_get_cell_value_font(const MenuCellLayerConfig *config) { return config->valu...
key), val, sizeof(val)); uint32_t flags = ios_notif_pref_db_get_flags(key, sizeof(key)); cl_assert_equal_i(flags, 0); } void test_ios_notif_pref_db__store_prefs(void) { // Create an attribute list and action group AttributeList attr_list; attribute_list_init_list(0, &attr_list); attribute_list_add_cstring...
cl_assert(is_dirty)
in.received_size_bytes + payload_size > s_state.in.total_size_bytes) { PBL_LOG(LOG_LEVEL_ERROR, "Chunk reassembly out of sync! recv_size=%"PRIu32", payload_size=%"PRIu32 ", total_size=%"PRIu32, (uint32_t) s_state.in.received_size_bytes, (uint32_t) payload_size, ...
{ s_state.out.app_msg_retry_timer = EVENTED_TIMER_INVALID_ID; prv_outbox_try_send_next(); }
static void prv_handle_outbox_result(AppMessageResult reason) { // https://pebbletechnology.atlassian.net/browse/PBL-42467 // TODO: check reason and act upon it const OutboxMsgType sent_msg_type = s_state.out.msg_type; s_state.out.msg_type = OutboxMsgTypeNone; const bool is_sent_successfully = (reason == ...
s(&file); int i = j % 255; snprintf((char *)key, sizeof(key), "k%03d", i); snprintf((char *)val, sizeof(val), "v%03d", i); printf("Iteration %d key %s val %s\n", i, key, val); set_and_verify(&file, key, key_len, val, val_len); // delete the first iteration if (j < 255) { settings_file_...
settings_file_get(&file_new, key, key_len, val_out, val_len_out)
); if (val_len_out == original_value_length) { printf("original! %d\n", original_value_length); cl_assert_equal_m(original_value, val_out, val_len_out); free(val_out); return RecordResultOld; } else if (val_len_out == new_value_length) { printf("new! %d\n", new_value_length); ...
/* * 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...
ARRAY_LENGTH(s_events)
; i++) { if (strcmp(s_events[i].event_name, event_name) == 0) { added_units |= s_events[i].time_units; break; } } if (added_units == 0) { return false; } s_units |= added_units; tick_timer_service_subscribe(s_units, prv_tick_handler); // contract is: we call handler immediately aft...
}, { -656, -200, -448}, { -488, 240, -1072}, { -504, 984, -1488}, { -496, 128, -1120}, { -520, 48, -1128}, { -480, -48, -1040}, { -504, -536, -752}, { -560, -632, -648}, { -672, -464, -560}, { -744, -264, -464}, { -816, -160, -400}, { -840, -160, -312}, { -856, -184, ...
{ -752, 344, -576}, { -800, 264, -360}, { -872, 144, -216}, { -864, 64, -32}, { -936, 48, 144}, { -904, 184, 200}, { -936, 296, 248}, { -896, 448, 248}, { -960, 384, 464}, // 49 seconds { -776, 184, 416}, { -864, 440, 424}, { -848, 368, 336}, { -904, 328, 24}, ...
{ -704, 40, -840}, { -656, -136, -744}, { -624, -176, -728}, { -672, -168, -736}, { -608, -144, -752}, { -624, -80, -768}, { -600, -40, -760}, { -632, -8, -784}, { -600, 8, -760}, { -648, 0, -712}, { -688, 8, -704}, { -664, -16, -712}, { -704, -40, -712}, { -696,...
/* * 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...
(sizeof(ReadCompleteContext) == sizeof(void *), "ReadCompleteContext too big")
; typedef struct { MBufIterator mbuf_iter; bool is_read; bool sent_escape; uint8_t escaped_byte; } SendInfo; //! Info on the current frame being read static ReadInfo s_read_info; //! The consumer of the next frame which is read static ReadConsumer s_read_consumer; //! MBuf for storing the header when receivin...
ddr, 0x00, sizeof(s_last_driver_addr)); } return cl_mock_type(void); } BTDeviceAddress s_last_bt_persist_pinned_addr; bool s_last_bt_persist_pinned_addr_is_null; bool bt_persistent_storage_get_ble_pinned_address(BTDeviceAddress *address_out) { if (s_last_bt_persist_pinned_addr_is_null) { return false; } ...
{ prv_init_no_pinnings_no_pinned_address(); // flip to make sure that bt_local_addr_pause_cycling() will set these again: s_last_driver_allow_cycling = true; s_last_driver_addr_is_null = false; cl_will_return(bt_driver_set_local_address, 0); bt_local_addr_pause_cycling(); cl_assert_equal_b(false, s_last...
NFO, "Valid system resources found!"); s_valid_resources_found = true; return; } } // Welp, we found nothing. Leave s_valid_resources_found as false and when resource_storage_check // is called as part of system_resource_init we'll complain and handle missing resources. } // TODO PBL-21009: Move...
(buffer, BANK.begin, MANIFEST_SIZE)
; } bool resource_storage_system_bank_check(ResAppNum app_num, uint32_t resource_id, ResourceStoreEntry *entry, const ResourceVersion *expected_version) { if (!s_valid_resources_found) { // We determined that we had no valid banks d...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(PhoneEventType_Incoming, true /* check_cookie */, true /* check_name_number */, "Bobby", "")
; } void test_phone_pp__incoming(void) { uint8_t pp_msg[] = {0x04, 0x1a, 0xd4, 0x77, 0x08, 0x0d, 0x35, 0x35, 0x35, 0x2D, 0x35, 0x35, 0x35, 0x2D, 0x35, 0x35, 0x35, 0x35, 0x00, // "555-555-5555" 0x06, 0x42, 0x6F, 0x62, 0x62, 0x79, 0x00}; // "...
clude "system/passert.h" #include "util/graphics.h" #include "util/hash.h" #include "util/math.h" #include "util/size.h" #include "clar.h" #include <stdio.h> static GContext s_ctx; // Fakes ///////////////////// #include "fake_content_indicator.h" #include "fake_spi_flash.h" #include "fixtures/load_test_resources....
(bitmap_size, CANVAS_GBITMAP_FORMAT)
; s_ctx.dest_bitmap = *s_dest_bitmap; s_ctx.draw_state.clip_box.size = bitmap_size; s_ctx.draw_state.drawing_box.size = bitmap_size; // Fill the bitmap with pink (on color) or white (on b&w) so it's easier to see errors memset(s_dest_bitmap->addr, PBL_IF_COLOR_ELSE(GColorShockingPinkARGB8, GColorWhiteARGB8)...
es prv_advance_to_ms_with_timers(start_ms + 1); cl_assert_equal_gtransform(value, start_value); // Halfway through prv_advance_to_ms_with_timers(start_ms + duration/2); cl_assert_close_gtransform(value, mid_value); // End prv_advance_to_ms_with_timers(start_ms + duration + MIN_FRAME_INTERVAL_MS*2); cl...
(h, handlers, context)
; animation_set_duration(h, duration); prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); animation_schedule(h); // Test the accessor functions uint32_t test_value; property_animation_get_from_uint32(prop_h, &test_value); cl_assert_equal_i(test_value, start_value); property_animatio...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
periph_config_acquire_lock()
; pwm_init(&BOARD_CONFIG_BACKLIGHT.pwm, TIMER_PERIOD_RESOLUTION, TIMER_PERIOD_RESOLUTION * PWM_OUTPUT_FREQUENCY_HZ); periph_config_release_lock(); s_initialized = true; } if (BOARD_CONFIG_BACKLIGHT.options & ActuatorOptions_IssiI2C) { led_controller_init(); s_initializ...
ecursive(s_recent_apps.mutex); { const time_t cur_time = time_get_uptime_seconds(); RecentApp *app = circular_cache_get(&s_recent_apps.cache, &install_id); if (app) { app->last_activity = cur_time; app->can_expire = can_expire; } else { RecentApp app = { .id = install_id, ...
kernel_malloc_check(sizeof(AppInstallEntry))
; // Iterate over the registry for (uint32_t i = 0; i < ARRAY_LENGTH(APP_RECORDS); i++) { if (app_install_get_entry_for_install_id(APP_RECORDS[i].id, entry)) { // if a false is returned from the function, then stop iterating. if (cb(entry, data) == false) { kernel_free(entry); 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...
new_timer_create()
; } 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); } } #endif void app_idle_timeout_start(void) { PBL_ASSERTN(s_timer == TIMER_INVALID_ID); s_...
set_antialiased(ctx, false); graphics_draw_line(ctx, GPoint(40, 50), GPoint(35, 70)); } void across_ny_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_context_set_antialiased(ctx, false); graphics_draw_line(ctx, GPoint(5, -30), GPoint(45, 30)); } ...
(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_line_clear"))
); #else cl_check(framebuffer_is_empty("clear_over_black", ctx.parent_framebuffer, GColorWhite)); #endif } #define MAX_NUM_ROWS 168 #define MAX_NUM_COLS 144 #define ORIGIN_RECT_NO_CLIP GRect(0, 0, MAX_NUM_COLS, MAX_NUM_ROWS) #define ORIGIN_RECT_CLIP_EVEN GRect(10, 10, 60, 60) #define ORIGIN_RECT_CLIP_OD...
ses/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 * limitations...
(s_num_flash_uses >= num_locks)
; s_num_flash_uses -= num_locks; if (s_num_flash_uses == 0) { periph_config_disable(FMC_Bank1, RCC_AHB3Periph_FMC); // FIXME } } void flash_impl_release(void) { flash_impl_release_many(1); } static uint16_t flash_s29vs_read_short(FlashAddress addr) { return *((__IO uint16_t*)(FMC_BANK_1_BASE_ADDRESS + a...