prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
le 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 WARRANTIES OR CONDITIONS OF ...
if (layer) { action_bar_layer_legacy2_init(layer); }
return layer; } void action_bar_layer_legacy2_deinit(ActionBarLayerLegacy2 *action_bar_layer) { layer_deinit(&action_bar_layer->layer); } void action_bar_layer_legacy2_destroy(ActionBarLayerLegacy2 *action_bar_layer) { if (action_bar_layer == NULL) { return; } action_bar_layer_legacy2_deinit(action_bar...
id graphics_draw_rect_precise(GContext* ctx, const GRectPrecise *rect) { const Fixed_S16_3 right = grect_precise_get_max_x(rect); const Fixed_S16_3 bottom = grect_precise_get_max_y(rect); const GPointPrecise top_left = rect->origin; const GPointPrecise top_right = {right, rect->origin.y}; const GPointPrecise...
for (int x = x_start; x < x_end; ++x) { bitset8_clear(line, x); }
} } void graphics_draw_round_rect(GContext* ctx, const GRect *rect, uint16_t radius) { PBL_ASSERTN(ctx); if (!rect || ctx->lock) { return; } // only draw if there is enough to cover the rounded edges - otherwise round down to largest // radius that can be drawn radius = prv_clamp_corner_radius(rect...
+1 is to make up for the fact that app banks start at 0, res banks start at 1. Fixing // in D641 resource_storage_get_file_name(filename, sizeof(filename), index); storage_info = kernel_malloc_check(sizeof(PutBytesStorageInfo) + strlen(filename) + 1); strcpy(storage_info->filename, filename); ...
(request->length)
; xSemaphoreTake(s_pb_semaphore, portMAX_DELAY); uint32_t remaining_bytes = s_pb_state.remaining_bytes; xSemaphoreGive(s_pb_semaphore); if (prv_check_putrequest_for_errors(request, request_size) || (data_length > remaining_bytes)) { prv_fail(token); return false; } PBL_LOG(LOG_LEVEL_DEBUG, ...
lip_height(GSize *size, const GSize *max_size) { if (max_size->h && size->h > max_size->h) { size->h = max_size->h; } } static void prv_clip_size(GSize *size, const GSize *max_size) { prv_clip_width(size, max_size); prv_clip_height(size, max_size); } static void prv_draw_text_node_text(GTextNodeDrawContex...
(&ctx->box.size, &child_node->cached_size)
; } return true; } static bool prv_did_draw_container_child(GTextNodeDrawContext *ctx, GTextNode *child_node) { const GValue *size = ToGValue(&child_node->cached_size); const GAxis axis = prv_container(ctx->node)->axis; const GAxis max_axis = prv_get_opposite_axis(axis); ToGValue(&ctx->size)[axis] += size[...
andle_meta_read(PPoGATTClient *client, const uint8_t *value, size_t value_length, BLEGATTError error) { PBL_ASSERTN(client->state == StateDisconnectedReadingMeta); if (error != BLEGATTErrorSuccess) { goto handle_error; } if (value_length < sizeof(PPoGATTMetaV0)) { goto h...
{ PPoGATTClient *next = (PPoGATTClient *) client->node.next; for (int i = 0; i < num_characteristics; i++) { if (client->characteristics.meta == characteristics[i] || client->characteristics.data == characteristics[i]) { client_removed = true; prv_delete_client(client...
// PBL-42768 - In the logs in this ticket it looks to me like we missed that the service // was removed. Add some diagnostic logging to hopefully reveal more info on a failure if (!client_removed) { BLECharacteristic meta = 0; BLECharacteristic data = 0; // assume one client PPoGA...
timeline_adds, 1); } void test_alarm__recurring_weekday_alarm_timeout_behind(void) { AlarmId id; s_current_hour = 11; s_current_minute = 30; id = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALARM_KIND_WEEKDAYS }); prv_assert_alarm_config(id, 10, 30, false, ALARM_KIND_WEEKDAYS, s_weekday_sch...
(&(AlarmInfo) { .hour = 11, .minute = 30, .kind = ALARM_KIND_JUST_ONCE })
; prv_assert_alarm_config(id2, 11, 30, false, ALARM_KIND_JUST_ONCE, just_once_schedule_thursday); // Only 1 pin should be added cl_assert_equal_i(s_num_timeline_adds, 2); // First alarm goes off. Second one should be up s_current_hour = 10; s_current_minute = 30; cron_service_wakeup(); cl_assert_equal_...
cl_assert(uuid_equal(&s_items[s_correct_order[3]].header.id, &timeline_model_get_iter_state(1)->pin.header.id)); cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(2)); cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(3...
timeline_model_get_iter_state_with_timeline_idx(5)
16, 368, -56}, { 1040, 416, -64}, { 1168, 392, -64}, { 1320, 208, 112}, { 1856, 224, 168}, { 1232, 360, 64}, { 928, 256, 40}, { 1032, 136, 120}, { 984, 48, 232}, { 904, 48, 184}, { 800, 40, 128}, { 736, 16, 88}, { 720, -16, 96}, { 752, -32, 88}, { 864, -56, 80}, ...
{ 888, -88, 48}, { 1008, -40, -24}, { 1416, -184, 96}, { 1648, -48, 160}, { 1392, 272, -120}, { 1280, 376, -224}, { 976, 360, 16}, { 744, 104, 40}, { 792, 80, 168}, { 824, 192, 96}, { 792, 224, 96}, { 832, 304, -8}, { 960, 336, -112}, { 1120, 304, -128}, { 125...
{ 928, 264, 40}, { 1136, 144, 160}, { 1104, 40, 256}, { 928, 96, 192}, { 808, 104, 120}, { 792, 64, 104}, { 776, 24, 88}, { 784, 8, 48}, { 832, -40, 64}, { 1032, -48, -8}, { 1072, 0, -80}, { 1584, -144, 176}, { 1368, 200, 40}, { 1184, 488, -216}, { 1224, 384,...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ const bool airplane_mode = bt_ctl_is_airplane_mode_on(); bt_ctl_set_airplane_mode_async(!airplane_mode); data->toggle_state = airplane_mode ? ToggleStateEnablingBluetooth : ToggleStateDisablingBluetooth; settings_menu_mark_dirty(SettingsMenuItemBluetooth); }
bool is_remote_connected(StoredRemote* remote) { switch (remote->type) { case StoredRemoteTypeBTClassic: return remote->classic.connected; case StoredRemoteTypeBLE: return (remote->ble.connection != NULL); case StoredRemoteTypeBTDual: return remote->dual.classic.connected || (remote->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...
{ *compositing_mode = GCompOpAnd; }
else if (gcolor_equal(tint_color, GColorWhite)) { *compositing_mode = GCompOpSet; } } } void bitblt_bitmap_into_bitmap_tiled_1bit_to_1bit(GBitmap* dest_bitmap, const GBitmap* src_bitmap, GRect dest_rect, GP...
int8_t*)system_flash_base, firmware_description->firmware_length); dbgserial_print("Checksum - wanted "); dbgserial_print_hex(firmware_description->checksum); dbgserial_print(" got "); dbgserial_print_hex(calculated_crc); dbgserial_newline(); return calculat...
boot_bit_clear(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_ONE)
EE); graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT_NXNY, RADIUS_NONE); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_origin_aa_r0_no_clip.${BIT_DEPTH_NAME}.pbi")); #endif // SCREEN_COLOR_DEPTH_BITS == 8 } #define OFFSET_RECT_NO_CLIP GRect(10, 10, 40, 50) #define OFFSET_RECT_CLIP_XY GR...
gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_r8_quad_top_right.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, STROKE_SMALL); graphics_circle_quadrant_draw_stroked_non_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, STROKE_SMALL,GCornerBottomLeft); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_r8_quad_bottom_left.${BIT_DEPTH_N...
/* * 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...
gdraw_command_image_draw_processed( ctx, dci_reel->image, offset, NULL_SAFE_FIELD_ACCESS(processor, draw_command_processor, NULL))
; } static GSize prv_get_size(KinoReel *reel) { KinoReelImplPDCI *dci_reel = (KinoReelImplPDCI *)reel; return gdraw_command_image_get_bounds_size(dci_reel->image); } static size_t prv_get_data_size(const KinoReel *reel) { KinoReelImplPDCI *dci_reel = (KinoReelImplPDCI *)reel; return gdraw_command_image_get_da...
* * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language go...
{ graphics_draw_bitmap_in_rect(ctx, icon, &image_bounds); }
#else graphics_draw_bitmap_in_rect(ctx, icon, &image_bounds); #endif GRect title_bounds = cell_layer->bounds; title_bounds.origin.x = title_origin_x; title_bounds.origin.y = title_top_padding; title_bounds.size.w -= title_origin_x; title_bounds.size.h = title_height; graphics_draw_text(ctx, i18n_get(ti...
settings_option_menu_get_context(context)
; data->alarm_type = selection; #if CAPABILITY_HAS_HEALTH_TRACKING if (selection == AlarmType_Smart && !activity_prefs_tracking_is_enabled()) { // Notify about Health and keep the menu open health_tracking_ui_feature_show_disabled(); return; } #endif if (data->creating_alarm) { app_window_stac...
UTE_SCRIPT_AND_ASSERT_RV_EQUALS_S("pileOfPooUTF8.charCodeAt(0).toString(16)", "d83d"); EXECUTE_SCRIPT_AND_ASSERT_RV_EQUALS_S("pileOfPooUTF8.charCodeAt(1).toString(16)", "dca9"); } void test_rocky_text_encoding__jerry_asserts_utf8_non_bmp_codepoint_in_identifier(void) { // It's forbidden to have an identifier conta...
cl_assert_equal_m(utf8_buffer, cases[i].expected_utf_data, cases[i].expected_utf_size)
sert_ack_count(1); assert_nack_count(0); cl_assert_equal_i(EXPECTED_COOKIE, put_bytes_get_index()); } void test_put_bytes__init_file_okay_while_not_in_fw_update_mode(void) { s_firmware_update_is_in_progress = false; const char fn[] = "test.txt"; prv_receive_init_file(VALID_OBJECT_SIZE, fn, strlen(fn) + 1); ...
{ assert_ack_count(0); }
assert_nack_count(1); } void test_put_bytes__chunk_written_to_storage_and_progress_event_put(void) { prv_receive_init_fw_object(); prv_process_and_reset_test_counters(); const uint8_t chunk[] = { 0xaa, 0xbb, 0xcc }; prv_receive_put(s_last_response_cookie, chunk, sizeof(chunk)); assert_ack_count(1); as...
ude "stubs_unobstructed_area.h" /////////////////////////////////////////////////////////// // Fakes #include "fake_gbitmap_get_data_row.h" static FrameBuffer *fb = NULL; // Setup void test_graphics_draw_text_${BIT_DEPTH_NAME}__initialize(void) { s_fake_data_row_handling = false; fb = malloc(sizeof(FrameBuffer))...
(ctx, GColorBlack)
; graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(4, -18, 72, 32), GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL); } void draw_text_single_line_wordwrap_clip_across_ny_second_line(Layer* me, GContext* ctx) { graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_...
); rtc_enable_backup_regs(); periph_config_release_lock(); restore_rtc_time_state(); initialize_fast_mode_state(); #ifdef PBL_LOG_ENABLED char buffer[TIME_STRING_BUFFER_SIZE]; PBL_LOG(LOG_LEVEL_DEBUG, "Current time is <%s>", rtc_get_time_string(buffer)); #endif } void rtc_init_timers(void) { static Reg...
(RTC_IT_ALRA)
; } RtcTicks rtc_alarm_get_elapsed_ticks(void) { return rtc_get_ticks() - s_alarm_set_time; } bool rtc_alarm_is_initialized(void) { return s_tick_alarm_initialized; } //! Handler for the RTC alarm interrupt. We don't actually have to do anything in this handler, //! just the interrupt firing is enough to bring ...
================================================== // Activity algorithm stub // For each accel sample that is fed in, it updates the metrics as follows: // x: increment step count by this much // y: sleep state // #define ALGORITHM_SAMPLING_RATE ACCEL_SAMPLING_25HZ #define TEST_ACTIVITY_MAX_SESSIONS 24 typedef stru...
activity_sessions_prv_add_activity_session(&s_test_alg_state.minute_data.sessions[i])
; } s_test_alg_state.minute_data.num_sessions_created = 0; break; // We are entering light sleep ------------------ case ActivitySleepStateLightSleep: // Start a light sleep session if we were awake before. If we were in restful sleep, // we should already have one ...
return false; } return true; } void test_settings_file__each_quit_early(void) { printf("\nTesting if we can use each and stop early at %d iterations...\n", STOPPING_NUM); SettingsFile file; cl_must_pass(settings_file_open(&file, "test_file_each", 4096)); uint8_t key[5]; int key_len = 4; uint8_t val[...
settings_raw_iter_prv_get_num_record_searches()
c_level_changed(const ble_evt_gap_sec_level_changed_t *evt) { PBL_LOG(LOG_LEVEL_INFO, "Security level changed to: %u", evt->level); Connection *conn = connection_by_idx(evt->conn_idx); if (conn == NULL) { PBL_LOG(LOG_LEVEL_ERROR, "No connection for idx=%d", evt->conn_idx); return; } pebble_pairing_se...
(conn, conn_idx)
; } BTDeviceInternal device = {}; connection_get_address(conn, &device); hc_endpoint_pairing_send_pairing_complete(&device, evt->status); } // Convert to BT Spec error codes and update Pebble Pairing Service's Conn Status characteristic: const uint8_t smp_status = SMP_GET_PAIR_FAIL_REASON(evt->st...
ol connection_is_gateway(Connection *connection) { bool val; prv_lock(); { val = connection->is_gateway; } prv_unlock(); return val; } static bool prv_get_flag(const Connection *connection, ConnectionFlag flag) { bool val; prv_lock(); { uint32_t bit = (1 << flag); val = ((connection->flag...
{ prv_lock(); { Connection *connection = connection_by_idx(conn_idx); if (connection) { connection->last_pairing_result = result; } } prv_unlock(); }
void connection_set_ppogatt_wa_state(Connection *connection, PPoGATTWorkAroundState *state) { prv_lock(); { connection->ppogatt_wa_state = state; } prv_unlock(); } void connection_set_conn_params(Connection *connection, const BleConnectionParams *params) { prv_lock(); { if (connection_is_valid(co...
/* * 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 sys_resource_load_range(sys_get_current_resource_num(), (uint32_t)h, start_offset, buffer, num_bytes); }
void *applib_resource_mmap_or_load(ResAppNum app_num, uint32_t resource_id, size_t offset, size_t num_bytes, bool used_aligned) { if (num_bytes == 0) { return NULL; } const uint8_t *mapped_data = (app_num == SYSTEM_APP) ? sys_resource_read_o...
ap_number_of_data_packets_in_flight(void) { test_ppogatt__open_session_when_found_pebble_app(); uint8_t sn = 0; Transport *transport = ppogatt_client_for_uuid(&s_meta_v0_system.app_uuid); // Get s_rx_window_size packets in flight: for (sn = 0; sn < s_tx_window_size; ++sn) { const bool success = fake_com...
(transport, s_short_data_fragment, sizeof(s_short_data_fragment))
, true); ppogatt_send_next(transport); fake_gatt_client_op_assert_no_write(); fake_gatt_client_op_set_write_return_value(BTErrnoOK); ppogatt_handle_buffer_empty(); prv_assert_sent_data(s_characteristics[0][PPoGATTCharacteristicData], 0 /* sn */, s_short_data_fragment, sizeof(s_short_da...
OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "util/keyed_circular_cache.h" #include "util/size.h" #include "clar.h" #include <string.h> #define TEST_BUFFER_SIZE (3) typedef struct { uint32_t data[4];...
prv_push(1)
; prv_test_get_hit(0, 2); prv_test_get_hit(1, 0); prv_test_get_hit(2, 1); prv_test_get_miss(3); prv_push(3); prv_test_get_hit(0, 2); prv_test_get_hit(1, 0); prv_test_get_miss(2); prv_test_get_hit(3, 1); }
* * 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 in...
(strength)
; // Scale the duty cycle given the current battery voltage if (BOARD_CONFIG_VIBE.vsys_scale > 0) { const uint16_t vsys_mv = prv_get_vsys_mv(); PBL_ASSERTN(vsys_mv > 0); duty_cycle = (BOARD_CONFIG_VIBE.vsys_scale * duty_cycle) / vsys_mv; } return duty_cycle; } } static void prv_vib...
/* * 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...
vibes_enqueue_custom_pattern(pat)
; } void vibes_long_pulse(void) { VibePattern pat; PATTERN_FROM_DURATIONS(pat, LONG_PULSE_DURATIONS); vibes_enqueue_custom_pattern(pat); } void vibes_double_pulse(void) { VibePattern pat; PATTERN_FROM_DURATIONS(pat, DOUBLE_PULSE_DURATIONS); vibes_enqueue_custom_pattern(pat); } void vibes_cancel(void) { ...
_reel); } // Tests //////////////////////////////////// extern void prv_play_animation_update(Animation *animation, const AnimationProgress normalized); void test_kino_player__finite_animation_finite_reel_foward(void) { // Choose duration and elapsed to have clean division for // ANIMATION_NORMALIZED_MAX * elaps...
kino_player_play(test_player)
; animation_set_elapsed(test_player->animation, 20); animation_set_duration(test_player->animation, ANIMATION_DURATION_INFINITE); prv_play_animation_update(test_player->animation, 0); // intentionally bad value cl_assert_equal_i(kino_reel_get_elapsed(test_reel), 20); } void test_kino_player__create_infinite...
lePacket){0}.i) == sizeof(ReliablePacket), "Something is really wrong here"); static bool s_layer_up = false; static ReliableInfoBuffer *s_tx_buffer; static SemaphoreHandle_t s_tx_lock; //! The sequence number of the next in-sequence I-packet to be transmitted. //! V(S) in the LAPB spec. static uint8_t...
{ // Information transfer packet if (length < sizeof(ReliablePacket)) { PBL_LOG(LOG_LEVEL_DEBUG, "Received malformed Information packet"); prv_bounce_ncp_state(); return; } if (packet->i.sequence_number == s_receive_variable) { s_receive_variable = (s_receive_variable + 1) % MODULUS...
(void *)bad_port); break; } } } else { PBL_LOG(LOG_LEVEL_DEBUG, "Received truncated or corrupt info packet " "field (expeced %" PRIu16 ", got %" PRIu16 " data bytes). " "Discarding.", ntoh16(packet->i.lengt...
((bitmap_format == GBitmapFormat1Bit) || (bitmap_format == GBitmapFormat8Bit) || (bitmap_format == GBitmapFormat8BitCircular))) { APP_LOG(APP_LOG_LEVEL_ERROR, "Invalid destination bitmap format for APNG"); goto cleanup; } // Update current time elapsed using the previous frames current_fra...
upng_get_format(upng)
----------------------- // Sample captured: 2015-10-05 16:00:09 local AccelRawData *activity_sample_walk_100_pbl_25663_5(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_pbl_25663_5 //> TEST_EXPECTED 100 //> TEST_EXPECTED_MIN 80 //> TEST_EXPECTED_MAX 120 ...
{ -184, -200, -1024}, { -192, -192, -1016}, { -192, -224, -1016}, { -192, -192, -1008}, { -184, -224, -1008}, { -184, -192, -1008}, { -176, -240, -1008}, { -192, -232, -1000}, { -200, -240, -1000}, { -200, -232, -1008}, { -200, -192, -1032}, { -176, -216, -1032}, { -1...
{ -192, -160, -1032}, { -200, -200, -1016}, // 7 seconds { -176, -184, -1016}, { -136, -184, -1024}, { -120, -168, -1024}, { -128, -176, -1016}, { -160, -192, -1000}, { -184, -168, -1000}, { -216, -176, -1000}, { -248, -176, -1000}, { -224, -144, -1032}, { -208, -144...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_IF_RECT_ELSE(0, (rl_margin / 2))
+ (drawing_rect.size.w / 2) - (icon_size.w / 2); const int icon_y = PBL_IF_RECT_ELSE(45, 49); kino_reel_draw(icon, ctx, GPoint(icon_x, icon_y)); const int name_x = drawing_rect.origin.x + PBL_IF_RECT_ELSE(0, (rl_margin / 2)); const int name_y = PBL_IF_RECT_ELSE(107, 109); GRect name_rect ...
ircle__gpoint_from_polar_normalizes_input_angles(void) { const uint16_t radius = 5; const GPoint center = GPointZero; GPoint result; // -180 degrees should be (0, 5) result = gpoint_from_polar_internal(&center, radius, -(TRIG_MAX_ANGLE / 2)); cl_assert_equal_gpoint(result, GPoint(0, 5)); // -90 degrees...
(5, 5, 2, 2)
ue before it's activated so likely, the activated queue was // s_kernel_event_queue. if (!result) { return false; } } s_current_event = prv_get_fancy_type_from_event(event); return true; } void **event_get_buffer(PebbleEvent *event) { switch (event->type) { case PEBBLE_SYS_NOTIFICATION_...
xQueueSend(s_system_event_queue_set, &preserve_queue, 0)
; } } QueueHandle_t event_kernel_to_kernel_event_queue(void) { return s_from_kernel_event_queue; } BaseType_t event_queue_cleanup_and_reset(QueueHandle_t queue) { int num_events_in_queue = uxQueueMessagesWaiting(queue); PebbleEvent event; for (int i = 0; i < num_events_in_queue; ++i) { PBL_ASSERTN(xQue...
dler(bool auto_destroy) { const int duration_a = 300; // This one will complete const int delay_a = 10; prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); static const AnimationImplementation implementation = { .setup = prv_setup_handler, .update = prv_update_unschedule_all_handler,...
{ prv_test_unschedule_all_in_stopped_handler(false); }
void test_animation__custom_functions(void) { // just some pointer to compare against AnimationCurveFunction curve = (void*)1; InterpolateInt64Function interpolation = (void*)2; Animation *a = prv_create_test_animation(); cl_assert_equal_p(animation_get_custom_curve(a), NULL); cl_assert_equal_p(animation...
/* * 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...
(written_hw_version5)
gle_start = step->arc.angle_start; int32_t angle_end = step->arc.angle_end; if (step->arc.anti_clockwise) { const int32_t t = angle_start; angle_start = angle_end; angle_end = t; } while (angle_end < angle_start) { angle_end += TRIG_MAX_ANGLE; ...
GVectorPrecise(delta_r, delta_t)
; const GVectorPrecise delta_br = GVectorPrecise(delta_r, delta_b); const GVectorPrecise delta_bl = GVectorPrecise(delta_l, delta_b); const Fixed_S16_3 right = grect_precise_get_max_x(&rect); const Fixed_S16_3 bottom = grect_precise_get_max_y(&rect); // top left s_rocky_path_steps[s_rocky_path...
d) { GContext ctx; Layer layer; test_graphics_context_init(&ctx, fb); layer_init(&layer, &GRect(0, 0, 100, 100)); layer_set_update_proc(&layer, &corners_clipped_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_clipped.${BIT_DEPTH_NAME}.pbi")); } void...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r4_no_clip.${BIT_DEPTH_NAME}.pbi"))
; setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 5, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r5_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_R...
(int j = 0; j < BMA255_FIFO_FRAME_SIZE_BYTES; ++j) { buf[j] = bma255_send_and_receive_byte(0); } prv_convert_accel_raw_data_to_mgs(buf, &data[i]); } bma255_end_txn(); // Timestamp & Dispatch data for (int i = 0; i < num_samples_available; ++i) { // Make a timestamp approximation based on the ...
(odr_max, s_operating_states[i].odr)
; } } uint32_t sample_interval = 0; switch (odr_max) { case BMA255ODR_1HZ: sample_interval = BMA255SampleInterval_1HZ; break; case BMA255ODR_10HZ: sample_interval = BMA255SampleInterval_10HZ; break; case BMA255ODR_19HZ: sample_interval = BMA255SampleInterval_19HZ; ...
/* * 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(contact)
; cl_assert_equal_m(&contact->id, &uuid, UUID_SIZE); cl_assert_equal_i(contact->flags, 0); cl_assert_equal_i(contact->attr_list.num_attributes, 1); cl_assert_equal_i(contact->addr_list.num_addresses, 1); contacts_free_contact(contact); }
ip_box = GRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); prv_filled_update_proc(NULL, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled.${BIT_DEPTH_NAME}.pbi")); printf("-- right\n"); prv_reset(); test_graphics_context_init(&ctx, fb); s_current_path = s_house_path; gpath_move_to(s_house_path, GPoi...
(&ctx, true)
; prv_filled_update_proc(NULL, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled_duplicates_aa.8bit.pbi")); // Crossing path - makes sure algorithm works for path that crosses itself prv_reset(); s_current_path = s_crossing_path; test_graphics_context_init(&ctx, fb); ...
w_indicator_round(GContext *ctx, const ActionMenuLayer *aml, const GRect *label_text_container) { const int indicator_height = fonts_get_font_height(aml->layout_cache.font); const int text_height = aml->layout_cache.item_heights[aml->selected_index]; const int content_height =...
if (draw_bottom_shading) { GRect bottom_bounds = label_text_container; bottom_bounds.size.h = fade_height; bottom_bounds.origin.y = grect_get_max_y(&label_text_container) - (fade_height + VERTICAL_PADDING); graphics_draw_bitmap_in_rect(ctx, &aml->item_animation.fade_bottom, ...
#endif } static void prv_draw_row(GContext* ctx, const Layer *cell_layer, MenuIndex *cell_index, void *callback_context) { ActionMenuLayer *aml = callback_context; if (cell_index->row < aml->num_items) { const ActionMenuItem *item = prv_get_item_for_index(aml, cell_index->row); c...
/* * 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...
(VibeScoreId_Pulse)
); } void test_vibe_score_info__is_valid_false_for_invalid_source_id(void) { cl_assert(!vibe_score_info_is_valid(VibeScoreId_Invalid)); }
[1]); cl_assert_equal_p(aaa, stack[2]); // go to child if possible actual = __layer_tree_traverse_next__test_accessor(stack, ARRAY_LENGTH(stack), &current_stack, true); cl_assert_equal_p(aaaa, actual); cl_assert_equal_i(3, current_stack); cl_assert_equal_p(a, stack[0]); cl_assert_equal_p(aa, stack[1]); ...
(layer_find_layer_containing_point(&parent, &GPoint(9, 9)), &child_a)
; cl_assert_equal_p(layer_find_layer_containing_point(&parent, &GPoint(10, 10)), &parent); layer_add_child(&child_a, &child_f); cl_assert_equal_p(layer_find_layer_containing_point(&parent, &GPoint(9, 9)), &child_f); cl_assert_equal_p(layer_find_layer_containing_point(&parent, &GPoint(1, 1)), &child_f); // c...
/* * 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...
grect_shortest_side(frame)
/ 2 - inset; return perimeter_for_circle(vertical_range, center, radius); } T_STATIC GRangeHorizontal perimeter_for_display_rect(const GPerimeter *perimeter, const GSize *ctx_size, GRangeVertical vertical_range...
trol to the firmware. // // No attempt is made to set CONTROL to zero as it should already be set to // the reset value when this code executes. __asm volatile ( "cpsie if\n" // Clear PRIMASK and FAULTMASK "mov lr, 0xFFFFFFFF\n" "mov sp, %[initial_sp]\n" "bx %[reset_handler]\n" ...
prv_get_fw_reset_vector(&reset_vector, &initial_sp)
; if ((uintptr_t)reset_vector == 0xffffffff || (uintptr_t)initial_sp == 0xffffffff) { dbgserial_putstr("Firmware is erased"); return true; } return false; } static void sad_watch(uint32_t error_code) { dbgserial_putstr("SAD WATCH"); char error_code_buffer[12]; itoa(error_code, error_code_buf...
e, value_font, rect, config->overflow_mode, GTextAlignmentRight, NULL); } else { // Only draw the icon if it fits within the cell after aligning it center right grect_clip(&rect, cell_layer_bounds); grect_align(&rect, cell_layer_bounds, GAlignRight, true); if (gsize_equal(&rect....
(ctx, cell_layer, NULL, title, NULL, NULL, NULL, subtitle, icon, true, GTextOverflowModeFill)
; } void menu_cell_basic_draw(GContext* ctx, const Layer *cell_layer, const char *title, const char *subtitle, GBitmap *icon) { prv_draw_basic(ctx, cell_layer, NULL, title, NULL, NULL, NULL, subtitle, icon, false, GTextOverflowModeFill); } ////////////////////// // Title m...
hone_ui_data->call_start_time == 0) { s_phone_ui_data->call_start_time = rtc_get_time(); } s_phone_ui_data->call_duration_timer = evented_timer_register( 1000, true /* repeating */, prv_update_call_time, NULL); // Update call time immediately prv_update_call_time(NULL); } static void prv_stop_call_...
{ prv_set_status_text(ACCEPTED); prv_window_pop_with_delay(ACCEPT_DELAY_MS); }
prv_set_answer_window(); } static void prv_decline_call(void) { prv_stop_ringing(); phone_call_decline(); prv_stop_call_duration_timer(); prv_set_icon_resource(TIMELINE_RESOURCE_DISMISSED_PHONE_CALL); prv_set_window_color(DECLINE_COLOR, true); // This must be called before prv_set_status_text, otherw...
); peek_layer_set_duration(&data->peek_layer, duration + ((num_frames_skip + num_frames_extend) * ANIMATION_TARGET_FRAME_INTERVAL_MS)); Animation *animation = (Animation *)peek_layer_create_play_animation(&data->peek_layer); animation_schedule(animation); ...
{ PeekLayer *peek_layer = &data->peek_layer; #if ANIMATION_DOT peek_layer_set_icon(peek_layer, timeline_res); #elif ANIMATION_SLIDE GRect icon_from; GRect icon_to; const bool shift_offscreen_from = true; const bool shift_offscreen_to = false; prv_get_icon_animation_frame(data, &icon_from, use_pin, shift_o...
ppMenuNode) { .install_id = entry->install_id, .app_num = app_install_get_app_icon_bank(entry), .icon_resource_id = app_install_entry_get_icon_resource_id(entry), .uuid = entry->uuid, .color = entry->color, .visibility = entry->visibility, .sdk_version = entry->sdk_version, .record_order...
prv_load_list_if_needed(source)
; return list_count((ListNode*)source->list); } uint16_t app_menu_data_source_get_index_of_app_with_install_id(AppMenuDataSource *source, AppInstallId install_id) { prv_load_list_if_needed(source); AppMenuNode *node = source->list; uint16_t index =...
, 100 * SECONDS_PER_MINUTE); cl_assert_equal_i(health_service_sum_today(HealthMetricSleepRestfulSeconds), 100 * SECONDS_PER_MINUTE); activity_get_metric(ActivityMetricSleepExitAtSeconds, 1, &value); cl_assert_equal_i(value, 2 * SECONDS_PER_HOUR + 20 * SECONDS_PER_MINUTE /*...
(!enabled)
; cl_assert_equal_i(num_samples, k_raw_samples); cl_assert_equal_i(seconds, (k_raw_samples + ALGORITHM_SAMPLING_RATE - 1) / ALGORITHM_SAMPLING_RATE); // Verify the collected data AccelRawData captured_data[k_raw_samples]; prv_uncompress_captured_data(captured_data, k_raw_sampl...
BTBondingID bonding_id) { PebbleEvent pebble_event = { .type = PEBBLE_BLE_CONNECTION_EVENT, .task_mask = task_mask, .bluetooth = { .le = { .connection = { .bt_device_bits = device->opaque.opaque_64, .hci_reason = hci_reason, .connected = connected, ...
if (task_mask != task_mask_none) { // Send event to the client(s) that need to be notified: const BTBondingID bonding_id = prv_get_bonding_id_for_intent(intent); prv_put_connection_event(task_mask, device, hci_reason, connected, bonding_id); }
// Clean up unused intent: if (!prv_is_intent_used(intent)) { prv_intent_remove_and_free(intent); return false; } return true; } void bt_driver_handle_le_connection_handle_update_address_and_irk(const BleAddressAndIRKChange *e) { bt_lock(); { GAPLEConnection *connection = gap_le_connection_b...
_24_BOLD), GRect(bounds->origin.x, (bounds->origin.y + bounds->size.h) / 2 + LINE_HEIGHT, bounds->size.w, bounds->size.h), GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL); } static void prv_draw_crosshair(Layer *layer, GContext *ctx) { AppDa...
app_state_get_user_data()
; if (app_data->axis_offsets[X_AdjustState] == mfg_info_get_disp_offsets().x && app_data->axis_offsets[Y_AdjustState] == mfg_info_get_disp_offsets().y) { app_window_stack_pop_all(true); return; } app_data->is_saving = true; layer_mark_dirty(&app_data->window.layer); app_data->exit_timer = app...
replace key_color with this GColor app_fb_key_color; // replace with app framebuffer, use GColorClear to skip GPoint framebuffer_offset; // displacement for the app framebuffer when drawing } CompositorColorReplacementProcessor; static void prv_compositor_replace_colors_processor(GDrawCommandProcessor *processor, ...
MIN(x2.raw_value, destination_data_row_info.max_x << FIXED_S16_3_PRECISION)
; if (x1.integer > x2.integer) { return; } GBitmap app_framebuffer = compositor_get_app_framebuffer_as_bitmap(); // We only check the destination data rows above (and not also the source data rows) because we // assume that both source and destination are framebuffers using the native bitmap format PBL...
e_rtc.h" #include "fake_session.h" #include "fake_spi_flash.h" #include "fake_system_task.h" #include "stubs_bt_lock.h" #include "stubs_freertos.h" #include "stubs_hexdump.h" #include "stubs_logging.h" #include "stubs_mutex.h" #include "stubs_passert.h" #include "stubs_pfs.h" #include "stubs_prompt.h" #include "stubs_...
htonl(cookie)
, }; prv_receive_data(s_session, (const uint8_t *) &init_msg, sizeof(init_msg)); } static void prv_receive_init_file(uint32_t total_size, const char *fn, size_t fn_len) { uint8_t buffer[sizeof(InitRequest) + fn_len]; InitRequest *init_msg = (InitRequest *)buffer; *init_msg = (InitRequest) { .cmd = CmdIn...
se, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed o...
analytics_init_private(DialogAnalyticMetric_Count)
; } void analytics_reset_nodes(void) { prv_lock(); // Zero out all values ListNode *iter = s_analytics_list; while (iter) { AnalyticsNode *node = (AnalyticsNode *)iter; node->value = 0; iter = iter->next; } prv_unlock(); } void analytics_set(DialogAnalyticsMetric metric, uint32_t value) { ...
period_ms / MS_PER_SECOND); } static void prv_music_request_reduced_latency(bool reduced_latency) { prv_perform_on_kernel_main_task(prv_request_reduced_latency_cb, (void *)(uintptr_t)reduced_latency); } static void prv_music_request_low_latency_for_period(uint32...
{ return; }
// Make the Bluetopia heap consumption of this module as minimal and predictable as possible, // by having only one outstanding GATT operation queued up at any moment in time (instead of // queueing up all the writes in one go): const AMSEntityID entity_id = s_ams_client->next_entity_to_register; const BLEC...
tiple; case RoundTypeAlwaysUp: return ((round_me + multiple - 1) / multiple) * multiple; case RoundTypeAlwaysDown: return (round_me / multiple) * multiple; case RoundTypeHalfUp: default: return ((round_me + multiple / 2) / multiple) * multiple; } } enum { FullStyleLower12h, Full...
(difference, SECONDS_PER_HOUR, RoundTypeHalfUp)
/ SECONDS_PER_HOUR; const char *str_fmt; if (capitalized) { str_fmt = i18n_noop("%lu H AGO"); } else if (num_hrs == 1) { str_fmt = i18n_noop("An hour ago"); } else { str_fmt = i18n_noop("%lu hours ago"); } snprintf(buffer, buf_size, i18n_get(str_fmt, buffer), num_hrs); } e...
e, STROKE_SMALL); graphics_circle_quadrant_draw_stroked_non_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, STROKE_SMALL,GCornerBottomRight); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_r8_quad_bottom_right.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_N...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_aa_r8_quads_right.${BIT_DEPTH_NAME}.pbi"))
; setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, STROKE_SMALL); graphics_circle_quadrant_draw_stroked_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, STROKE_SMALL,GCornersLeft); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_aa_r8_quads_left.${BIT_DEPTH_NAME}.pbi")); ...
/* * 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...
(addr->addr_type)
; memcpy(&device_out->address, &addr->addr, sizeof(device_out->address)); } void dialog_utils_bt_device_to_bd_address(const BTDeviceInternal *device, bd_address_t *addr_out) { addr_out->addr_type = dialog_utils_local_addr_type_to_dialog(device); memcpy(addr_out->addr, &device->address, sizeof(addr_out->addr)); }...
item_layer, NULL, &new_offset); PBL_ASSERTN(item_layer->animation); animation_set_auto_destroy(property_animation_get_animation(item_layer->animation), false); } Animation *animation = property_animation_get_animation(item_layer->animation); if (is_first_scroll) { animation_set_duration(animation, in...
window_single_repeating_click_subscribe(BUTTON_ID_DOWN, 100, prv_handle_down_click)
; window_single_click_subscribe(BUTTON_ID_SELECT, prv_handle_select_click); window_set_click_context(BUTTON_ID_UP, context); window_set_click_context(BUTTON_ID_DOWN, context); window_set_click_context(BUTTON_ID_SELECT, context); window_set_click_context(BUTTON_ID_BACK, context); if (pebble_task_get_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...
prv_spi_send_and_receive_dma(NULL, buffer, length)
|| !prv_spi_send_and_receive_dma(NULL, (uint8_t *)&s_rx_crc, sizeof(uint32_t))) { return false; } uint32_t crc = crc32(CRC32_INIT, buffer, length); if (crc != s_rx_crc) { return false; // TODO: At least one memory region will crc fail because of changing counter // variables in t...
nder 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 "clar.h" #include "flash_region/flash_region.h" #include "debug/flash_l...
strlen(msg)
); cl_assert(rv); } ExpectedMessage newmsg = { .msg_arr = msg_arr, .curr_msg_idx = 0, .num_items = (num_items + 1), // + 1 for build id line .num_processed = 0, }; s_msg = newmsg; s_completed = false; bool success = flash_dump_log_file(log_gen, prv_flash_log_line_dump, ...
/* * 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...
(sdk_version, SW_REVISION_LEN, "%2u.%02u", PROCESS_INFO_CURRENT_SDK_VERSION_MAJOR, PROCESS_INFO_CURRENT_SDK_VERSION_MINOR)
; strncpy(info->sw_revision, sdk_version, SW_REVISION_LEN); } void dis_get_info(DisInfo *info) { prv_set_model_number(info); prv_set_manufacturer_name(info); prv_set_serial_number(info); prv_set_firmware_revision(info); prv_set_software_revision(info); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ if (pebble_task_get_current() == PebbleTask_App) { return app_state_get_graphics_context(); } else { return kernel_ui_get_graphics_context(); } }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
test_graphics_context_init(&ctx, fb)
; // TODO: Fix offset calculation and reenable this: - PBL-16509 #if PBL_COLOR setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 10); graphics_line_draw_precise_stroked_aa(&ctx, START_ON_ORIGIN_RECT, END_ON_ORIGIN_RECT, 10); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precis...
{ .cb = prv_cron_callback, .cb_data = (void*)0, .minute = 30, .hour = 2, .mday = 19, .month = 10, .may_be_instant = true, }; // 2015 Nov 20, 02:00:00 GMT (DST start) const time_t advance = 1447984800 - s_2015_nov12_123456_gmt; prv_basic_test(&s_timezone_gmt, &test_cron, s_2015_nov...
{ CronJob test_cron = { .cb = prv_cron_callback, .cb_data = (void*)0, .minute = 30, .hour = 0, .mday = CRON_MDAY_ANY, .month = CRON_MONTH_ANY, .offset_seconds = SECONDS_PER_DAY, .wday = WDAY_THURSDAY, .may_be_instant = false, }; const time_t advance = 30 * SECONDS_PER_MINUTE...
void test_cron__offset_positive_seconds_any_day(void) { CronJob test_cron = { .cb = prv_cron_callback, .cb_data = (void*)0, .minute = 30, .hour = 0, .mday = CRON_MDAY_ANY, .month = CRON_MONTH_ANY, .offset_seconds = SECONDS_PER_DAY, .may_be_instant = false, }; const time_t adva...
= animation; animation_schedule(animation); #if PBL_ROUND // Skip the animation on round, because it looks bad if (full_swap) { animation_set_elapsed(animation, animation_get_duration(animation, true, true)); } #endif return true; } //! Computes the amount the current layer frame can scroll until a swap...
click_recognizer_get_button_id(recognizer)
/* * 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...
(min_start, max_start, min_end, max_end)
; } void flash_region_erase_optimal_range_no_watchdog(uint32_t min_start, uint32_t max_start, uint32_t min_end, uint32_t max_end) { prv_erase_optimal_range(min_start, max_start, min_end, max_end); }
(layout, ctx, render)
; } ////////////////////////////////////////// // LayoutLayer API ////////////////////////////////////////// static void prv_layout_update_proc(Layer *layer, GContext *ctx) { NotificationLayout *layout = (NotificationLayout *)layer; switch (layout->layout.mode) { case LayoutLayerModeCard: prv_card_rende...
be called on any animation being // unscheduled. static void prv_iter_remove(AnimationState *state, AnimationPrivate *animation) { // If this animation is the iterator's next, bump the iterator if (state->aux->iter_next == (ListNode *)animation) { state->aux->iter_next = list_get_next((ListNode *)animation); ...
{ return false; }
if (animation->parent == parent) { // Direct descendent return true; } // Get parent's parent animation = animation->parent; } return false; } // ------------------------------------------------------------------------------------------- static int32_t prv_get_elapsed(AnimationPriva...
c bool prv_write_data(DataLoggingSessionStorage *storage, const void *data, uint32_t remaining_bytes) { const uint8_t *data_ptr = data; // Write out in chunks while (remaining_bytes > 0) { uint8_t data_chunk_length = MIN(DLS_MAX_CHUNK_SIZE_BYTES, remaining_bytes); // Write the...
(session->storage.fd)
; // Close the new file now. That will finish up the swap for us pfs_close(new_storage.fd); new_storage.fd = DLS_INVALID_FILE; // Plug in the new storage info into the session session->storage = new_storage; PBL_LOG_D(LOG_DOMAIN_DATA_LOGGING, LOG_LEVEL_DEBUG, "After compaction: size: %d, num_...
oy_list(&postpone_attr_list); attribute_list_destroy_list(&remove_attr_list); timeline_item_destroy(item); } static void prv_push_success_dialog(void) { SimpleDialog *simple_dialog = simple_dialog_create("Reminder Added"); Dialog *dialog = simple_dialog_get_dialog(simple_dialog); dialog_set_text(dialog, i18n...
localtime_r(&utc_sec, &local_tm)
; local_tm.tm_min -= (local_tm.tm_min % 15); local_tm.tm_sec = 0; data->timestamp = mktime(&local_tm); } // If the user doesn't accept the transcription, try again. data->ui_state = ReminderAppUIState_Start; prv_build_transcription_dialog_text(data); prv_push_transcription_dialo...
GPointPrecise((int16_t)(((x)) * FIXED_S16_3_FACTOR), \ (int16_t)(((y)) * FIXED_S16_3_FACTOR)) void test_rocky_api_graphics_path2d__invalid_coords(void) { rocky_global_init(s_graphics_api); prv_create_global_ctx(); EXECUTE_SCRIPT("ctx.moveTo(4095.375, -4095.5);"); EXECUTE_SCRIPT_EXPECT_ERROR("...
cl_assert_equal_point(GPoint(11, 12), lc->path.points[2])
; EXECUTE_SCRIPT_EXPECT_ERROR( "ctx.arc(1, 2, 3, 4, 5);\n" "ctx.fill();\n" , "TypeError: fill() does not support arc()"); } void test_rocky_api_graphics_path2d__fill_oom(void) { rocky_global_init(s_graphics_api); prv_create_global_ctx(); EXECUTE_SCRIPT( "ctx.moveTo(1, 2);\n" "ctx.lineTo(3,...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&ctx, fb)
; layer_set_update_proc(&layer, &across_nx_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_across_nx_origin_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_y_layer_update_callback); ...
BTDeviceInternal device = prv_dummy_device(1); // Register connection intent: e = gap_le_connect_connect(&device, true /* auto_reconnect */, false /* is_pairing_required */, GAPLEClientApp); cl_assert_equal_i(e, BTErrnoOK); r...
(&device, true /* auto_reconnect */, false /* is_pairing_required */, GAPLEClientKernel)
; cl_assert_equal_i(e, BTErrnoOK); // Unregister connection intent owned by app: e = gap_le_connect_cancel(&device, GAPLEClientApp); cl_assert_equal_i(e, BTErrnoInvalidParameter); } // ----------------------------------------------------------------------------- // Virtual (dis)connection events void __disab...
performed. Reads greater // than 34 was empirically determined to be the point at which using the DMA // engine is advantageous #if !defined(TARGET_QEMU) const uint32_t num_reads_dma_cutoff = 34; #else // We are disabling DMA reads when running under QEMU for now because they are not reliable. const uint32_t...
(PowerSystemFlashErase)
; enable_flash_spi_clock(); handle_sleep_when_idle_begin(); flash_write_enable(); flash_start_cmd(); flash_send_and_receive_byte(FLASH_CMD_ERASE_BULK); flash_end_cmd(); flash_wait_for_write(); flash_prf_set_protection(true); disable_flash_spi_clock(); power_tracking_stop(PowerSystemFlashErase...
ze.h; cl_assert(line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params)); cl_assert(line.height_px == 10); cl_assert(line.width_px == 3 * HORIZ_ADVANCE_PX); cl_assert(iter_next(&word_iter)); cl_assert(!line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params)); cl_assert(l...
(line_add_words(&line, &word_iter, NULL))
; cl_assert(line.height_px == 10); cl_assert(line.width_px == HORIZ_ADVANCE_PX * 3); cl_assert(line.origin.x == 0); cl_assert(line.suffix_codepoint == 0); cl_assert(*line.start == 'a'); // ani- cl_assert(*word_iter_state.current.start == 'a'); cl_assert(*word_iter_state.current.end == '\0'); cl_asser...
um_intervals = interval_timer_get(&timer, &average_ms); cl_assert_equal_i(num_intervals, 0); cl_assert_equal_i(average_ms, 0); fake_rtc_increment_time_ms(1000); interval_timer_take_sample(&timer); num_intervals = interval_timer_get(&timer, &average_ms); cl_assert_equal_i(num_intervals, 1); cl_assert_equ...
interval_timer_get(&timer, &average_ms)
; cl_assert_equal_i(num_intervals, 3); cl_assert_equal_i(average_ms, 1006); fake_rtc_increment_time_ms(1010); interval_timer_take_sample(&timer); num_intervals = interval_timer_get(&timer, &average_ms); cl_assert_equal_i(num_intervals, 4); cl_assert_equal_i(average_ms, 1007); fake_rtc_increment_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...
(segment->points[0], segment->points[3], start)
; p2 = prv_get_point_between_points(segment->points[1], segment->points[2], start); p3 = prv_get_point_between_points(segment->points[1], segment->points[2], end); p4 = prv_get_point_between_points(segment->points[0], segment->points[3], end); } else if (segment->type == HealthProgressSegmentType_Horizont...
s wrong if it takes more than twice that time. int timeout = 100 * 10; // * 100 microseconds while (!gpio_input_read(&ICE40LP->cdone)) { if (timeout-- == 0) { PBL_LOG(LOG_LEVEL_ERROR, "FPGA CDONE timeout expired!"); return false; } delay_us(100); } return true; } static bool prv_try_pr...
set_6V6_power_state(false)
; psleep(2); } } //! //! Starts a frame. //! void display_start_frame(void) { // The iCE40UL framebuffer FPGA (S4) configuration requires a short delay // after asserting SCS before it is ready for a command. delay_us(5); spi_ll_slave_write(ICE40LP->spi_port, CMD_FRAME_BEGIN); // Make sure command h...
tialiased rounded rect #if SCREEN_COLOR_DEPTH_BITS == 8 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 9, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r9_aa_no_clip.${BIT_DEPTH_NAME}.pbi")); s...
gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r1_aa_clip_nxny.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY , ORIGIN_RECT_CLIP_NXNY , true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY , 2, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r2_aa_clip_nxny.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLI...
rn false; } // Search jobs (can't use list_contains(), because circular): ListNode *node = &s_jobs->node; while (node) { if (node == (const ListNode *) job) { return true; } node = node->next; if (node == &s_jobs->node) { // wrapped around break; } } return false; } s...
(&s_cycle_regular_timer)
; } regular_timer_add_seconds_callback(&s_cycle_regular_timer); } static void prv_timer_stop(void) { regular_timer_remove_callback(&s_cycle_regular_timer); } // ----------------------------------------------------------------------------- //! Airs the next advertisement job. //! It sends the ad & scan response...
er the License. */ #include "applib/app.h" #include "applib/app_comm.h" #include "applib/app_sync/app_sync.h" #include "kernel/event_loop.h" #include "kernel/pbl_malloc.h" #include "process_state/app_state/app_state.h" #include "services/normal/activity/activity_algorithm.h" #include "services/normal/activity/activit...
prv_update_scrollable_metrics(data)
{ const time_t now = rtc_get_time(); bool result; // check that we *can* return success result = prv_calculate_time_range(now - 10, now, NULL); cl_assert_equal_b(result, true); // in the future result = prv_calculate_time_range(now + 10, now + 20, NULL); cl_assert_equal_b(result, false); // too far...
void test_health__range_to_day_id_clamps_values(void) { const time_t now = rtc_get_time(); bool result; HealthServiceTimeRange range; // clamps value that goes into the future result = prv_calculate_time_range(now - 10, now + 11, &range); cl_assert_equal_b(result, true); cl_assert_equal_range(range, ((...
ue; } static bool layer_process_tree_level(Layer *node, void *ctx, LayerIteratorFunc iterator_func) { while (node) { if (!iterator_func(node, ctx)) { return false; }; if (!layer_process_tree_level(node->first_child, ctx, iterator_func)) { return false; }; node = node->next_sibling; ...
{ // call the current node's render procedure if (node->update_proc) { node->update_proc(node, ctx); } // if client has forgotten to release frame buffer if (ctx->lock) { graphics_release_frame_buffer(ctx, &ctx->dest_bitmap); APP_LOG(APP_LOG_LEVEL_WARNING, ...
node_hidden_do_not_descend: node = prv_layer_tree_traverse_next(stack, LAYER_TREE_STACK_SIZE, &current_depth, descend); ctx->draw_state = root_draw_state; } } void layer_property_changed_tree(Layer *node) { layer_process_tree(node, NULL, layer_property_changed_tree_node); } void layer_set_update_proc(L...
cl_assert_equal_b(false, app_install_is_watchface(music_id))
; cl_assert_equal_b(false, app_install_is_watchface(sports_id)); cl_assert_equal_b(false, app_install_is_watchface(bg_counter_id)); cl_assert_equal_b(false, app_install_is_watchface(menu_layer_id)); cl_assert_equal_b(false, app_install_is_watchface(CRAZY_ID)); } void test_app_install_manager__is_watchface_via...
uuid_expand_16bit(0x2a35), .properties = 0x20, // Indicatable .handle = 0x3, .num_descriptors = 1, .descriptors = { [0] = { .uuid = bt_uuid_expand_16bit(0x2902), .handle = 0x05, }, }, }, [1] = { .uuid = bt_uuid_expan...
{ s_random_128bit_service = (const Service) { .uuid = UuidMake(0xF7, 0x68, 0x09, 0x5B, 0x1B, 0xFA, 0x4F, 0x63, 0x97, 0xEE, 0xFD, 0xED, 0xAC, 0x66, 0xF9, 0xB0), .handle = 0x01, .num_characteristics = 2, .characteristics = { [0] = { .uuid = UuidMake(0xF7, 0x68, 0x09, 0x5B, 0x1B, 0xFA, 0x4F...
void fake_gatt_put_discovery_indication_gatt_profile_service(unsigned int connection_id, bool has_service_changed_characteristic) { GATT_Characteristic_Descriptor_Information_t cccd1 = { .Characteristic_Descriptor_Handle = 0x05, .Characteristic_Desc...
SAttribute *message = notif_attributes[FetchedNotifAttributeIndexMessage]; iOSNotifPrefs *app_notif_prefs = ios_notif_pref_db_get_prefs(app_id->value, app_id->length); ancs_filtering_record_app(&app_notif_prefs, app_id, display_name, title); if (nexmo_is_reauth_sms(app_id, message)) { nexmo_handle_reauth_sm...
kernel_malloc_check(sizeof(Uuid))
; if (notification_storage_find_ancs_notification_id(ancs_uid, notification_id)) { PBL_LOG(LOG_LEVEL_DEBUG, "Notification removed from notification centre: (UID: %"PRIu32")", ancs_uid); notification_storage_set_status(notification_id, TimelineItemStatusDismissed); notifications_handle_notifi...
y->visibility == ProcessVisibilityQuickLaunch); } bool app_install_entry_is_SDK_compatible(const AppInstallEntry *entry) { return (entry->sdk_version.major == PROCESS_INFO_CURRENT_SDK_VERSION_MAJOR && entry->sdk_version.minor <= PROCESS_INFO_CURRENT_SDK_VERSION_MINOR); } T_STATIC ListNode *s_head_callback...
{ if (!app_upgrade) { // remove settings associated with the app pin_db_delete_with_parent(uuid); } if (delete_cache) { // only log when we actually delete the cache entry. This is so we don't print out 100 logs // during an app cache clear PBL_LOG(LOG_LEVEL_INFO, "Deleting app with id %"PRId...
static void prv_delete_pending_id(AppInstallId *app_id) { if (*app_id != INSTALL_ID_INVALID) { // app cache will delete the app binaries even if the entry for the app_id does not exist app_cache_remove_entry(*app_id); *app_id = INSTALL_ID_INVALID; } } static void prv_process_pending_deletions(void) {...
uration_a + MAX(duration_b, duration_c); // Create 3 animations Animation *a = prv_create_test_animation(); animation_set_duration(a, duration_a); Animation *b = prv_create_test_animation(); animation_set_duration(b, duration_b); Animation *c = prv_create_test_animation(); animation_set_duration(c, dur...
prv_clear_handler_histories()
; uint64_t start_ms = prv_now_ms(); animation_schedule(seq); fake_rtc_auto_increment_ticks(0); // Let the first spawn finish prv_advance_to_ms_with_timers(start_ms + duration_a + 2 * MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a0), 1); cl_assert_equal_i...
/* * 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 (s1[len] == *p) { break; }
p++; } if (!*p) { return len; } len++; } return len; }
************************************************ Stop our timer and display results. A frame update consists of the following operations: op_1) App renders to its own frame buffer op_2) System copies the app frame buffer to the system frame buffer op_3) System sends the system frame buffer to the display har...
prv_time_64()
; PROFILER_INIT; PROFILER_START; } data->rendered_frames++; } static void prv_window_disapper(Window *window) { } void prv_syncing_content_offset_changed(struct ScrollLayer *scroll_layer, void *context) { AppData *data = app_state_get_user_data(); data->prv_orig_content_offset_changed(scroll_layer, co...
, const TimelineItem *pin, const char *label) { switch (action->type) { case TimelineItemActionTypeOpenPin: case TimelineItemActionTypeOpenWatchApp: prv_invoke_local_action(action, pin); return NULL; case...
if (timeline_item_action_is_dismiss(action)) { prv_push_dismiss_first_use_dialog(action_menu); }
prv_invoke_action(action_menu, action, pin, item->label); } static void prv_invoke_voice_response(VoiceResponseData *voice_data, char *transcription) { // This is a bit of a hack, but we need all the behaviour of timeline_actions_invoke_action and // this allows voice responses to be used for other types of re...
}, { // PercentTier_BelowAverage .body = i18n_noop("A good night's sleep goes a long way! Try to get more hours tonight."), }, { // PercentTier_Fail .body = i18n_noop("A good night's sleep goes a long way! Try to get more hours tonight."), }, } }; static void prv_create_and_push_notific...
attribute_list_add_cstring(&neutral_attr_list, AttributeIdBody, i18n_get(notif_config->text_neutral_response, &notif_attr_list))
onseTimeState state, uint16_t max_period_secs, ResponsivenessGrantedHandler granted_handler) { if (granted_handler) { launcher_task_add_callback(prv_granted_kernel_main_cb, granted_handler); } } static CommSessionTransportType prv_get_type(struct Transport *transport) { return CommSessionTransportType_PU...
(&cb_data->packet.data[0], data, data_length)
; } launcher_task_add_callback(prv_pulse_pp_send_cb, cb_data); } void pulse_pp_transport_open_handler(void) { return; } void pulse_pp_transport_closed_handler(void) { prv_pulse_pp_transport_set_connected(false); } void pulse_pp_transport_handle_received_data(void *data, size_t length) { PulsePPPacket *pac...
const Fixed_S16_3 y2_fixed = (Fixed_S16_3) { .integer = y2, .fraction = 4, }; prv_mask_recording_assign_vertical_line(ctx, x, y1_fixed, y2_fixed, color); } void test_graphics_context_mask__record_assign_vertical_line_raw(void) { prv_mask_record_vline_test_pattern(prv_vline_pattern_record_assign_vertical...
prv_assign_horizontal_line_delta_raw(ctx, y, x1_fixed, x2_fixed, gradient_width, gradient_width, clip_box_min_x, clip_box_max_x, color)
; } void test_graphics_context_mask__apply_assign_horizontal_line_delta_raw(void) { prv_mask_apply_hline_test_pattern(prv_hline_pattern_apply_assign_horizontal_line_delta_raw); CHECK_EXPECTED_TEST_IMAGE(s_ctx); }; ////////////////////////////////// // APPLYING VERTICAL LINE TESTS // //////////////////////////////...
e != region->size) { PBL_ASSERT(size < region->size || size == 0x400000, "Invalid region size: %"PRIu32, region->size); size *= 2; ++result; } return result; } void mpu_enable(void) { MPU->CTRL |= (MPU_CTRL_ENABLE_Msk | MPU_CTRL_PRIVDEFENA_Msk); } void mpu_disable(void) { MPU->CTR...
{ const MpuRegion *mpu_region = region_ptrs[region_idx]; MpuRegion unused_region = {}; // If not region defined, use unused if (mpu_region == NULL) { mpu_region = &unused_region; attr_reg = 0; // Has a 0 in the enable bit, so this region won't be enabled. } else { // Make sure tha...
} bool mpu_memory_is_cachable(const void *addr) { if (!dcache_is_enabled()) { return false; } // TODO PBL-37601: We're assuming only SRAM is cachable for now for simplicity sake. We should // account for MPU configuration and also the fact that memory-mapped QSPI access goes through the // cache. ret...
const uint8_t *timezone_length_ptr = data + offsetof(TimezoneCBData, region_name_len); if (length != (sizeof(uint8_t) + header_size + *timezone_length_ptr)) { PBL_LOG(LOG_LEVEL_WARNING, "Set timezone message invalid length"); return; } TimezoneCBData *timezone_data = (TimezoneC...
{ time_t today = time_util_get_midnight_of(rtc_get_time()); if (time_util_get_midnight_of(timestamp) == today) { i18n_get_with_buffer("Today", buffer, buffer_size); } else { i18n_get_with_buffer("All day", buffer, buffer_size); } }
static void prv_copy_relative_time_string(char *number_buffer, uint8_t number_buffer_size, char *word_buffer, uint8_t word_buffer_size, time_t timestamp, time_t end_time) { time_t now = rtc_get_time(); // average without overflows since time_t might be signed and now ~1.4 billion, so 2*now > INT_MAX time_t ...