prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
d clar_run_single(const struct clar_func *test, const struct clar_suite *suite) { _clar.suite_errors = 0; _clar.active_suite = suite->name; _clar.active_test = test->name; clar_run_test(test, &suite->initialize, &suite->cleanup); } #endif static void clar_usage(const char *arg) { printf("Usage: %s [option...
for (j = 0; j < _clar_suite_count; ++j) { const struct clar_suite *suite = &_clar_suites[j]; for (int i = 0; i < suite->test_count; i++) { printf(" %s\n", suite->tests[i].name); } } printf("\n"); exit(0); } default: clar_usage(argv[0]); } ...
} static int clar_test(int argc, char **argv) { clar_print_init( (int)_clar_callback_count, (int)_clar_suite_count, "" ); if (clar_sandbox() < 0) { clar_print_onabort("Failed to sandbox the test runner.\n"); exit(-1); } clar_mock_reset(); clar_on_init(); if (argc > 1) clar_pa...
rt(num.fraction == 3); test_num = (int32_t)((float)-0.500 * (1 << FIXED_S16_3_PRECISION)); num = (Fixed_S16_3){ .raw_value = test_num }; cl_assert(num.integer == -1); cl_assert(num.fraction == 4); test_num = (int32_t)((float)-0.375 * (1 << FIXED_S16_3_PRECISION)); num = (Fixed_S16_3){ .raw_value = test_nu...
Fixed_S16_3_rounded_int(Fixed_S16_3(0))
); cl_assert_equal_i(0, Fixed_S16_3_rounded_int(Fixed_S16_3(3))); cl_assert_equal_i(1, Fixed_S16_3_rounded_int(Fixed_S16_3(4))); cl_assert_equal_i(1, Fixed_S16_3_rounded_int(Fixed_S16_3(8))); cl_assert_equal_i(2, Fixed_S16_3_rounded_int(Fixed_S16_3(12))); cl_assert_equal_i(0, Fixed_S16_3_rounded_int(Fixed_S16...
equal_p(s_fill_points, NULL); prv_reset(); // restore radius and set hidden - nothing should be drawn gdraw_command_set_radius(command, 300); gdraw_command_set_hidden(command, true); gdraw_command_draw(NULL, command); cl_assert_equal_i(s_stroke_color.argb, GColorClearARGB8); cl_assert_equal_i(s_fill_colo...
(s_path_fill_count, 0)
; cl_assert_equal_i(s_circle_stroke_count, 0); cl_assert_equal_i(s_circle_fill_count, 0); free(command_list); } void test_gdraw_command__validate_list(void) { GDrawCommandList *command_list = prv_create_command_list_3(); size_t size = sizeof(GDrawCommandList) + (3 * sizeof(GDrawCommand)) + (sizeof(GPo...
/* * 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...
{ check_atan2(10, 14); check_atan2(3, 5); check_atan2(5, 3); check_atan2(10, 10); check_atan2(-153, 217); check_atan2(-28, -133); check_atan2(323, -229); check_atan2(245, 196); check_atan2(65, -3); check_atan2(331, -320); check_atan2(-151, 284); check_atan2(111, -98); check_atan2(-44, -17); ...
void test_math__ceil_log_two(void) { check_ceil_log_two(4); check_ceil_log_two(5); check_ceil_log_two(100); check_ceil_log_two(256); check_ceil_log_two(123456); } void test_math__sign_extend(void) { cl_assert_equal_i(sign_extend(0, 32), 0); cl_assert_equal_i(sign_extend(0, 3), 0); 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...
{ return true; }
// If we don't have a current slice or the current slice we have is a never-expiring slice, we can // go ahead and use this slice now but continue iterating to try to find an earlier expiring slice // in the list if (!data->current_slice || (data->current_slice->expiration_time == APP_GLANCE_SLICE_NO_EX...
_expected_cb_ctx, cb_ctx); s_last_sent_status = status; ++s_num_sent_handler_called; } #define assert_sent_cb_last_status(expected_status) \ cl_assert_equal_i(s_last_sent_status, expected_status) //////////////////////////////////////////////////////////////////////////////////////////////////// // Tests sta...
(NULL, 0, NULL, s_expected_cb_ctx)
); cl_assert_equal_i(s_num_app_outbox_events_sent, 0); } void test_app_outbox__send(void) { fake_kernel_malloc_mark(); prv_register(); uint32_t max_pending_messages = app_outbox_service_max_pending_messages(AppOutboxServiceTagUnitTest); AppOutboxMessage *message[max_pending_messages]; for (uint32_...
_remove_and_free(GAPLEConnectionIntent *intent) { list_remove(&intent->node, (ListNode **) &s_intents, NULL); kernel_free(intent); } static bool prv_intent_filter_by_device(ListNode *node, void *data) { const BTDeviceInternal *target_device = (const BTDeviceInternal *) data; const GAPLEConnectionIntent *intent...
prv_mutate_whitelist(device, is_adding)
; // Start/continue connecting: prv_start_connecting_if_needed(); } // ------------------------------------------------------------------------------------------------- // Helper data structure for prv_register_intent struct RegisterIntentRequest { bool is_bonding_based; union { const BTDeviceInternal *d...
DCDC, DCDC_V18P_1_REG, DCDC_V18P_ENABLE_LV, 0x0); REG_SETF(DCDC, DCDC_V18P_1_REG, DCDC_V18P_CUR_LIM_MAX_LV, 0xF); REG_SETF(DCDC, DCDC_V18P_1_REG, DCDC_V18P_IDLE_HYST, 0x4); REG_SETF(DCDC, DCDC_V18P_1_REG, DCDC_V18P_IDLE_MIN, 0x10); REG_SETF(DCDC, DCDC_RET_0_REG, DCDC_V18P_RET_CYCLES, 0x5); REG_SETF(DCDC, DCD...
(QSPIC, QSPIC_CTRLMODE_REG, QSPIC_RXD_NEG, 0x0)
; REG_SETF(QSPIC, QSPIC_CTRLMODE_REG, QSPIC_HRDY_MD, 0x0); REG_SETF(QSPIC, QSPIC_CTRLMODE_REG, QSPIC_IO3_DAT, 0x0); REG_SETF(QSPIC, QSPIC_CTRLMODE_REG, QSPIC_IO2_DAT, 0x0); REG_SETF(QSPIC, QSPIC_CTRLMODE_REG, QSPIC_IO3_OEN, 0x0); REG_SETF(QSPIC, QSPIC_CTRLMODE_REG, QSPIC_IO2_OEN, 0x0); REG_SETF(QSPIC, QSPIC...
); gbitmap_destroy(src_bitmap); } // Test vertical wrapping when dest_rect taller than src_bitmap. // Setup: // - Source is 25 x 10 // - 4 rows red, 2 rows blue, 4 rows black. // - Dest is Green, 50 x 50 // - Dest Rect is 10 x 24 at (0, 0) // Result: // - Pattern repeated vertically x2, plus 4 rows of red...
(dest_data, GColorBlue.argb, sizeof(dest_data))
; bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, GPointZero, GCompOpClear, GColorWhite); cl_check(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_8bit_clear-expect.8bit.pbi")); memset(dest_data, GColorBlue.argb, sizeof(dest_data)); bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, GPointZero, GCompOp...
; } static void prv_finished_failure_callback(void *data) { const bool success = false; prv_finished(data, success); } static void prv_show_peek_layer(ProgressWindow *data) { if (data->is_peek_layer_used) { Layer *root_layer = window_get_root_layer(&data->window); PeekLayer *peek_layer = &data->peek_lay...
((Layer *)&data->progress_layer, start, &stop)
; Animation *animation = property_animation_get_animation(prop_anim); // If we failed, pause on the screen for a little. animation_set_delay(animation, delay); animation_set_duration(animation, SCROLL_OUT_MS); animation_set_curve(animation, AnimationCurveEaseOut); animation_set_handlers(animation, (Animati...
the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ...
( "var data = [];\n" "var level = undefined;" "_rocky.on('memorypressure', function(e){\n" " level = e.level;\n" " data = [];\n" "});\n" "for (var i = 0; i < 100000; i++) {data.push(i);}\n" )
; assert_no_oom_app_fault(); ASSERT_JS_GLOBAL_EQUALS_S("level", "high"); cl_assert_equal_i(s_sys_analytics_inc_call_count, 0); } void test_rocky_api_memory__no_oom_app_fault_if_handler_frees_up_enough_memory_empty_object(void) { EXECUTE_SCRIPT( "var data = {};\n" "_rocky.on('memorypressure', function(e...
/* * 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 (frequency == 0) { PBL_LOG(LOG_LEVEL_DEBUG, "RTC frequency invalid - Skipping calibration"); return (RTCCalibConfig) { .sign = RTC_CalibSign_Positive, .units = 0 }; }
// Difference in frequency in mHz (ex. 224 = .224 Hz off from target frequency) const int32_t rtc_freq_diff = target - frequency; // RTC_CoarseCalibConfig uses units of +4.069ppm or -2.035ppm. // Formula: // ppm = 1e6(target - frequency)/(target) // positive units = ppm / 4.069 // negative units = ppm ...
w_rect_origin_aa_sw2_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, 2); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw2_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // AA = true, ...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw1_clip_xy.${BIT_DEPTH_NAME}.pbi"))
; setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, false, 1); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw1_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // SW = 2 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RE...
eOut); } animation_schedule(animation); } //! Maybe make this part of the style and smaller for smaller text sizes? static const int SCROLL_AMOUNT = PBL_IF_RECT_ELSE(48, DISP_ROWS - STATUS_BAR_LAYER_HEIGHT); static const int SCROLL_FUDGE_AMOUNT = PBL_IF_RECT_ELSE(10, 0); ///////////////////////////////////////// ...
window_single_click_subscribe(BUTTON_ID_BACK, prv_handle_back_click)
; } } void timeline_item_layer_set_click_config_onto_window(TimelineItemLayer *item_layer, struct Window *window) { window_set_click_config_provider_with_context(window, timeline_item_layer_click_config_provider, it...
ffer + state->num_samples, &data, sizeof(AccelRawData)); state->num_samples++; samples_drained++; } // If buffer is full, notify subscriber to process it if (!state->event_posted && state->num_samples >= state->samples_per_update) { // Notify the subscriber that data is a...
analytics_inc(ANALYTICS_APP_METRIC_ACCEL_PEEK_COUNT, AnalyticsClient_CurrentTask)
st_player->animation, 0); // intentionally bad value cl_assert_equal_i(kino_reel_get_elapsed(test_reel), 20); } void test_kino_player__create_infinite_animation_infinite_reel_forward(void) { // Choose duration and elapsed to have clean division for // ANIMATION_NORMALIZED_MAX * elapsed / duration = whole_numbe...
(kino_reel_get_elapsed(test_reel), ANIMATION_DURATION_INFINITE)
; } void test_kino_player__create_infinite_animation_infinite_reel_reverse(void) { // Choose duration and elapsed to have clean division for // ANIMATION_NORMALIZED_MAX * elapsed / duration = whole_number test_reel_data->duration_ms = ANIMATION_DURATION_INFINITE; Animation *animation = (Animation *)kino_player...
/* * 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, GPoint(15, -5))
; } void outside_nx_ny_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_pixel(ctx, GPoint(-5, -5)); } void test_graphics_draw_pixel_${BIT_DEPTH_NAME}__origin_layer(void) { GContext ctx; Layer layer; test_graphics_context_init(&ctx, fb); l...
/* * 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...
(filename, O_RDWR)
; uint8_t *spi_image_file = mmap(NULL, st.st_size, PROT_WRITE, MAP_SHARED, fd, 0); flash_read_bytes(spi_image_file, 0, st.st_size); munmap(spi_image_file, st.st_size); close(fd); fake_spi_flash_cleanup(); return 0; } int main(int argc, const char* argv[]) { // SPI image file path always passed in as f...
iter, &value); dict_write_end(iter); app_message_outbox_send(); } static void up_click_handler(ClickRecognizerRef recognizer, AppData *data) { send_golf_cmd(CMD_PREV); } static void down_click_handler(ClickRecognizerRef recognizer, AppData *data) { send_golf_cmd(CMD_NEXT); } static void select_click_handler...
(data->action_bar, data)
; action_bar_layer_set_icon(data->action_bar, BUTTON_ID_UP, data->up_bitmap); action_bar_layer_set_icon(data->action_bar, BUTTON_ID_SELECT, data->click_bitmap); action_bar_layer_set_icon(data->action_bar, BUTTON_ID_DOWN, data->down_bitmap); action_bar_layer_set_click_config_provider(data->action_bar, ...
0, -32}, { 1216, 256, 16}, { 1384, 184, 32}, { 976, 24, 72}, { 1008, -80, 128}, { 968, 0, 168}, { 1200, 136, -56}, { 1216, 96, -24}, { 1288, 112, -120}, { 1048, 128, -224}, { 904, 152, -224}, { 1088, 232, -208}, { 1352, 264, -248}, { 1456, 312, -240}, { 1680, 896,...
{ 1416, 888, -408}, { 1248, 544, -312}, { 1408, 520, -384}, { 1192, 352, -288}, { 1080, 400, -280}, { 1280, 424, -216}, { 1384, 272, -120}, { 1184, 232, -64}, // 32 seconds { 1192, 136, -16}, { 1336, 224, -32}, { 1384, 216, -32}, { 1112, 216, 16}, { 1264, 128, -24...
ubs_logging.h" #include "stubs_passert.h" #include "stubs_prompt.h" #include "stubs_serial.h" #include "fake_new_timer.h" #include "fake_battery.h" #include "fake_system_task.h" #include "fake_rtc.h" #include "kernel/events.h" #include "system/logging.h" #include "system/reboot_reason.h" static bool s_entered_standby...
cl_assert(delta_percent > (INT32_MAX - 100))
/* * 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_open(file, name, flags, max_used_space)
; } // There's a chance that the caller increased the desired size of the settings file since // the file was originally created (i.e. the file was created in an earlier version of the // firmware). If we detect that situation, let's re-write the file to the new larger requested // size. int actual_size = ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(packet, ntoh16(triggering_packet->length))
; } static void prv_send_configure_reject(PPPControlProtocol *this, struct LCPPacket *bad_packet) { if (ntoh16(bad_packet->length) > pulse_link_max_send_size()) { // Too big to send and truncation will corrupt the packet. // There isn't really anything we can do. PBL...
_phone_ui_data->call_status_text_layer.layer, false); layer_add_child(&s_phone_ui_data->core_ui_container, &s_phone_ui_data->call_status_text_layer.layer); // Shrink the bounds but not the frame size to allow for centering when action bar removed s_phone_ui_data->call_status_text_layer.layer.bou...
prv_set_status_text(DISCONNECTED)
; } else { prv_set_status_text(DECLINED); } } prv_window_pop_with_delay(CALL_END_DELAY_MS); } void phone_ui_handle_call_hide(void) { // Just pop the window - it'll handle all the cleanup prv_window_pop(); } void phone_ui_handle_caller_id(PebblePhoneCaller *caller) { if (!s_phone_ui_data) { ...
timestamp = 1421183642, // Tue Jan 13 13:14:02 2015 PST .duration = 10, .type = TimelineItemTypePin, .flags = 0, .layout = LayoutIdTest, }, .attr_list = { .num_attributes = 0, .attributes = NULL, }, .action_group = { .num_actions = 0, .act...
cl_assert(timeline_model_iter_next(&new_idx, &has_next))
; cl_assert(has_next); cl_assert_equal_i(new_idx, 2); cl_assert_equal_i(timeline_model_get_num_items(), 2); cl_assert(uuid_equal(&s_items[s_correct_order[0]].header.id, &timeline_model_get_iter_state(-1)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[1]].header.id, &timeline_model...
.y += (data->rectr_velocity_y * PIXEL_SPEED_PER_FRAME * 4); if (data->rectr.origin.y < 0 || data->rectr.origin.y + data->rectr.size.h > data->window.layer.bounds.size.h) { data->rectr_velocity_y = data->rectr_velocity_y * -1; } } else if (shape == CIRCLE) { // Move the line X per...
(ctx, data->circle_color)
eCtxOutbox *outbox) { if (outbox->ack_nack_timer) { app_timer_cancel(outbox->ack_nack_timer); outbox->ack_nack_timer = NULL; } } void app_message_outbox_close(AppMessageCtxOutbox *outbox) { // Verify outbox phase. if (outbox->phase == OUT_CLOSED) { return; } // Cancel any outstanding timer. ...
{ prv_transition_to_accepting(outbox); return; }
} } AppMessageResult app_message_outbox_send(void) { AppMessageCtxOutbox *outbox = &app_state_get_app_message_ctx()->outbox; if (prv_is_message_pending(outbox->phase)) { PBL_LOG(LOG_LEVEL_ERROR, "Can't call app_message_outbox_send() now, wait for sent_callback!"); return APP_MSG_BUSY; } if (outbox->...
licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limita...
MAX((int32_t)(corner_insets_left & 0xf) - left_cropped_columns_count, 0)
; int32_t right_side = MAX((int32_t)(corner_insets_right & 0xf) - right_cropped_columns_count, 0); int32_t corner_insets = left_side + right_side; int32_t width = corner_insets < clipped_rect.size.w ? (clipped_rect.size.w - corner_insets) : 0; uint32_t x = clipped_rect.origin.x + left_side; corner_...
tex); if (reset_settings) { pfs_remove(ACTIVITY_SETTINGS_FILE_NAME); } if (sleep_history) { prv_write_metric_history(ActivitySettingsKeySleepTotalMinutesHistory, sleep_history); } if (step_history) { prv_write_metric_history(ActivitySettingsKeyStepCountHistory, step_history); } activity_init(...
{ // Enqueue it for KernelBG to process return system_task_add_callback(prv_send_fake_dls_records_system_cb, NULL); }
// ------------------------------------------------------------------------------------------------ void activity_test_set_steps_and_avg(int32_t new_steps, int32_t current_avg, int32_t daily_avg) { mutex_lock_recursive(s_activity_state.mutex); { // set the current steps to new_steps s_activity_state.step...
nimationEachCallback callback, uintptr_t context) { if (animation->first_child) { prv_each(animation->first_child, callback, context); } if (animation->sibling) { prv_each(animation->sibling, callback, context); } callback(animation, context); } static void prv_free(AnimationPriv...
if (animation->scheduled) { prv_each(animation, prv_call_scheduled, false); prv_each(animation, prv_call_update, ANIMATION_NORMALIZED_MAX); prv_each(animation, prv_call_stopped, animation->is_completed); }
return true; } // Interface for unit tests to query the fake animation state ///////////////////////////////////////////////////////////// Animation *fake_animation_get_first_animation(void) { return (Animation *)s_animations; } Animation *fake_animation_get_next_animation(Animation *animation) { return (Anim...
return true; } static bool prv_legacy_handle_progress(PebblePutBytesEvent *event) { if (!s_current_completion_status.use_legacy_mode) { return false; } LegacyFwUpdateCompletionStatus *status = &s_current_completion_status.legacy_status; switch (event->object_type) { case ObjectFirmware: status-...
xSemaphoreGive(s_firmware_update_semaphore)
; } unsigned int firmware_update_get_percent_progress(void) { if (!firmware_update_is_in_progress()) { return 0; } uint32_t progress = 0; if (prv_legacy_firmware_update_get_percent_progress(&progress)) { return progress; } FwUpdateCompletionStatus *status = &s_current_completion_status.status; ...
ert_equal_i(3, s_tick_timer_service_subscribe.call_count); cl_assert_equal_i(MINUTE_UNIT | HOUR_UNIT | DAY_UNIT | MONTH_UNIT | YEAR_UNIT, s_tick_timer_service_subscribe.last_call.tick_units); // register for minute again EXECUTE_SCRIPT("_rocky.on('minutechange', function() {});"); cl_assert...
( "_rocky.on('secondchange', function(e) { throw e.type; });" )
; cl_assert(*s_log_internal__expected == NULL); } void test_rocky_api_tickservice__provides_event_date(void) { rocky_global_init(s_api); s_log_internal__expected = (const char *[]){ NULL }; const time_t cur_time = 1458250851; // Thu Mar 17 21:40:51 2016 UTC // Thu Mar ...
ove_bitmap); action_bar_layer_set_icon(action_bar_layer, BUTTON_ID_DOWN, data->decline_bitmap); action_bar_layer_set_context(action_bar_layer, data); prv_add_prf_layers(pair_text_area, data); const int16_t y_offset = PBL_IF_RECT_ELSE(0, 2); // Device name: if (prv_has_device_name(data)) { TextLayer *d...
{ prv_pop_window(); }
static void prv_success_or_failure_click_config_provider(void *unused) { window_single_click_subscribe(BUTTON_ID_BACK, prv_pop_click_handler); window_single_click_subscribe(BUTTON_ID_UP, prv_pop_click_handler); window_single_click_subscribe(BUTTON_ID_SELECT, prv_pop_click_handler); window_single_click_subscri...
allback_context) { return 0; } static void prv_window_update_proc(struct Layer *layer, GContext *ctx) { AppData *data = app_state_get_user_data(); if (data->rendered_frames == 0) { data->time_started = prv_time_64(); PROFILER_INIT; PROFILER_START; } data->rendered_frames++; } static void prv_win...
(window, data)
/* * 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...
(&session->app_focus_sub)
; } } #endif DictationSession *dictation_session_create(uint32_t buffer_size, DictationSessionStatusCallback callback, void *context) { #if CAPABILITY_HAS_MICROPHONE if (!callback) { return NULL; } // Old versions of the Android app (<3.5) will allow voice repli...
te) { 0 }; // Allocate immutable types bool success = false; const Utf8Bounds utf8_bounds = utf8_get_bounds(&success, (char[]) { 0x10, 0x0 }); cl_assert(success); const TextBoxParams text_box_params = (TextBoxParams) { .utf8_bounds = &utf8_bounds, }; // Init mutable types word_iter_init(&word_ite...
iter_next(&word_iter)
7645 render container layer instead of the two windows WindowTransitioningContext *transition_context = &stack->transition_context; if (transition_context->implementation->render) { transition_context->implementation->render(transition_context, ctx); } } *app_state_get_framebuffer_render_pending...
if (!window->is_fullscreen) { // a little logic to only force update when the minute changes ApplibInternalEventsInfo *events_info = app_state_get_applib_internal_events_info(); struct tm currtime; sys_localtime_r(&e->clock_tick.tick_time, &currtime); const int minute_of_day = (currtime.tm_h...
} static void prv_legacy2_status_bar_timer_subscribe(void) { // we only need this tick event if we are a legacy2 app if (process_manager_compiled_with_legacy2_sdk()) { ApplibInternalEventsInfo *events_info = app_state_get_applib_internal_events_info(); // Initialize the state for the status bar ha...
efine TIMER0_RELOAD_VALUE (65535) #define TIMER0_1_S (TIMER0_CLK_RATE / 1) #define TIMER0_1_MS (TIMER0_CLK_RATE / 1000) #define TIMER0_10_MS (TIMER0_CLK_RATE / 100) // Modified from ad_spi.c. We don't want to use DMA here! #define CORE_DUMP_SPI_SLAVE_TO_EXT_MASTER(bus, name, _word_mode, pol_mode, _phase_mode, \ _d...
{ // The timer is configured to repeatedly count down from 65535, resetting at 0 back to 65535. // The delta calculated here takes advantage of the underflow to produce the correct result. return start_ticks - end_ticks; }
static bool prv_timer_check_delta(uint16_t start_ticks, uint16_t delta_ticks) { uint16_t curr_ticks = prv_timer_get_ticks(); bool s = (prv_timer_delta(start_ticks, curr_ticks) < delta_ticks); return s; } static void prv_timer_delay_1ms(void) { uint16_t start_ticks = prv_timer_get_ticks(); while (prv_timer...
ase WATCH_INFO_COLOR_TIME_ROUND_BLACK_14: model_name = SPALDING_MODEL("pebble_time_round_black_14mm"); break; case WATCH_INFO_COLOR_TIME_ROUND_SILVER_20: model_name = SPALDING_MODEL("pebble_time_round_silver_20mm"); break; case WATCH_INFO_COLOR_TIME_ROUND_BLACK_20: mo...
(watchinfo, ROCKY_WATCHINFO_FW, fw_version)
; } static void prv_init_apis(void) { bool was_created = false; JS_VAR rocky = rocky_get_rocky_singleton(); JS_VAR watchinfo = rocky_get_or_create_object(rocky, ROCKY_WATCHINFO, rocky_creator_object, NULL, &was_created); PBL_ASSERTN(was_created); prv_fill_watchinfo(watchinfo); } const RockyGlobalAPI W...
bytes left to write for the current log uint8_t log_chunk_id; // the id of the current page being logged to uint8_t log_file_id; // the id of the current log generation } CurrentLoggingState; static CurrentLoggingState s_curr_state; #define CHUNK_ID_BITWIDTH (sizeof(((FlashLoggingHeader *)0)->log_chunk_id) * ...
{ uint32_t sector_addr; for (sector_addr = FLASH_REGION_DEBUG_DB_BEGIN; sector_addr < FLASH_REGION_DEBUG_DB_END; sector_addr += ERASE_UNIT_SIZE) { prv_erase_unit(sector_addr); } }
, "layer stack exceeded (%d). Will skip rendering.", stack_size); } } // no children, try next sibling if (top_of_stack->next_sibling) { return stack[*current_depth] = top_of_stack->next_sibling; } // there are no more siblings // continue with siblings of parents/grandparents while (*current_de...
gsize_equal(&layer->bounds.size, &layer->frame.size)
; layer->frame = *frame; if (bounds_in_sync && !process_manager_compiled_with_legacy2_sdk()) { layer->bounds = (GRect){.size = layer->frame.size}; } else { // Legacy 2.x behavior needed for ScrollLayer // Grow the bounds if it doesn't cover the area that the frame is showing. // This is not a n...
round_color(msg_text_layer, GColorBlack); text_layer_set_text_color(msg_text_layer, GColorWhite); text_layer_set_font(msg_text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_14_BOLD)); layer_add_child(&window->layer, &msg_text_layer->layer); msg_text_layer = &data->msg_text_layer[2]; text_layer_init(msg_text_l...
{ struct FlashTestData *data = (struct FlashTestData *) context; data->test_case = index; data->test_case_status = FLASH_TEST_STATUS_INIT; // Display window for running test case // Init the window Window *test_window = &data->test_window; window_init(test_window, WINDOW_NAME("Test Case")); window_set...
static void flash_test_window_load(Window *window) { struct FlashTestData *data = (struct FlashTestData*) window_get_user_data(window); // Configure menu items: uint8_t num_items = 0; data->menu_items[num_items++] = (SimpleMenuItem) { .title = "Run Data Test", ...
/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 governing permissio...
cl_assert_equal_i(end.month, 10)
; cl_assert_equal_i(end.mday, 1); cl_assert_equal_i(end.hour, 2); } void test_timezone_database__kazakhstan(void) { { const int almaty_region = FIND_REGION("Asia/Almaty"); TimezoneInfo tz_info; bool result = timezone_database_load_region_info(almaty_region, &tz_info); cl_assert(result); cl_...
mber(number)) { return ANDROID_PHONE_KEY; } break; case PhoneCallSource_ANCS: case PhoneCallSource_ANCS_Legacy: return IOS_PHONE_KEY; break; } return NULL; } // Checks for the existance of a call reply action in the notif pref db and loads it into // a timeline item static ...
if (s_phone_ui_data == NULL) { return; }
kino_layer_pause(&s_phone_ui_data->icon_layer); kino_layer_deinit(&s_phone_ui_data->icon_layer); #if !PLATFORM_TINTIN // The reels will destroy intermediate images, but not the one currently on screen // clean it up here. Note that we don't have to do this on Tintin/Bianca as we // do not create an interme...
e_for_object_type(s_pb_state.type); } static unsigned int prv_get_progress_percent(void) { return ((s_pb_state.total_size - s_pb_state.remaining_bytes) * 100) / (s_pb_state.total_size); } static void prv_send_response(ResponseCode code, uint32_t token) { struct { uint8_t response_code; uint32_t token; }...
(ResponseAck)
; } static bool prv_has_invalid_token(const PutBytesCommand command, uint32_t request_token) { if (command == PutBytesInit || command == PutBytesInstall) { return false; } if (s_pb_state.token != request_token) { PBL_LOG(LOG_LEVEL_ERROR, "%d: Token does not match; got 0x%" PRIx32 ", expected 0x%" P...
.value = value, .icon_info = &icon_res_info, .icon_layer = i == 0 ? &layout->icon_layer : layout->metric_icon_layers[i - 1], }, }; GTextNodeText *metric_node = (GTextNodeText *)layout_create_text_node_from_config( layout_ref, &metric_...
{ KinoLayer *kino_layer = user_data; GRect frame = kino_layer->layer.frame; if (!render) { grect_align(&frame, box, kino_layer_get_alignment(kino_layer), false); frame.origin.y = box->origin.y; layer_set_frame(&kino_layer->layer, &frame); } if (size_out) { *size_out = frame.size; } }
GTextNodeCustom *layout_node_create_kino_layer_wrapper(KinoLayer *kino_layer) { return graphics_text_node_create_custom(prv_kino_layer_wrapper_callback, (void *)kino_layer); }
center), path); case CLOCK_HAND_STYLE_ROUNDED: case CLOCK_HAND_STYLE_ROUNDED_WITH_HIGHLIGHT: default: prv_draw_watch_hand_rounded(ctx, hand, center); break; } } static GPointPrecise prv_get_clock_center_point(ClockLocation location, const GRect *bounds) { GPoint imprecise_center_point = {0}...
(&MINUTE_PATH_INFO)
; data->bg_bitmap = gbitmap_create_with_resource(data->clock_model.bg_bitmap_id); } static void prv_window_unload(Window *window) { MultiWatchData *data = app_state_get_user_data(); gpath_destroy(data->hour_path); gpath_destroy(data->minute_path); gbitmap_destroy(data->bg_bitmap); } static void prv_app_did_...
/* * 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...
(&out_metadata)
; if (success) { strncpy(dest, out_metadata.version_tag, dest_len_bytes); } return success; } bool version_is_prf_installed(void) { FirmwareDescription firmware_description = firmware_storage_read_firmware_description(FLASH_REGION_SAFE_FIRMWARE_BEGIN); if (!firmware_storage_check_valid_firmware_des...
xtNodeCustom *)ctx->node; custom_node->callback(ctx->gcontext, &ctx->box, ctx->config, ctx->render, ctx->size_out, custom_node->user_data); } static void prv_draw_noop(GTextNodeDrawContext *ctx) { } static const GTextNodeBaseImpl s_text_impl = { .destructor = prv_destroy_text_node_base, ...
{ GTextNode *node = ctx->node; if (parent_ctx) { prv_container(parent_ctx->node)->will_draw_child(parent_ctx, node); prv_init_draw_context(ctx, node, parent_ctx->gcontext, &parent_ctx->box, parent_ctx->config, parent_ctx->render); } gsize_sub_eq(&ctx->box.size, node->margin); ...
static void prv_iter_did_draw(GTextNodeDrawContext *ctx, GTextNodeDrawContext *parent_ctx) { GTextNode *node = ctx->node; prv_base(node)->did_draw(ctx); if (!ctx->cached) { if (node->clip) { ctx->gcontext->draw_state.clip_box = ctx->cached_clip_box; } gsize_add_eq(ctx->size_out, node->margin)...
."); // Update the IRK + Address (Dialog SDK swaps the connection address for the identity address, // even if the pairing process failed mid-way): BleAddressAndIRKChange e = {}; if (!prv_get_device_and_irk_by_conn_idx(evt->conn_idx, &e.is_resolved, &e.irk)) { // Disconnected in the mean time return; ...
PBL_LOG(LOG_LEVEL_ERROR, "ble_gap_per_pref_conn_params_set: %u", e)
; } } void ble_task_assert_is_executing_on_ble_task(void) { PBL_ASSERTN(xTaskGetCurrentTaskHandle() == DialogTaskList[DialogTask_Ble]); } static void prv_configure_irk(const BTDriverConfig *config) { // Use the Identity Root directly as the local Identity Resolving Key: PBL_LOG(LOG_LEVEL_DEBUG, "Setting local...
-------------------------------------------------------------------------------- // Test unscheduling animations arbitrarily in a stopped handler with/without auto destroy. void prv_test_unschedule_all_in_stopped_handler(bool auto_destroy) { const int duration_a = 300; // This one will complete const int delay_a ...
animation_private_current_interpolate_override()
, NULL); animation_destroy(a); }
OAD_SIZE UINT16_MAX // Empirically, it seems to take 24ms for the revAD silicon to come out of // reset and send the start message. This is way longer than its going to // take to get a response to other bootROM messages so let's assume that's // the max worst case wait time. To account for some variance, let's wait /...
MIN(bytes_left, sizeof(data_buf))
; if (!resource_load_byte_range_system(SYSTEM_APP, RESOURCE_ID_BT_BOOT_IMAGE, curr_offset, data_buf, read_len)) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to load patch from system resources"); return false; } for (uint32_t i = 0; i < read_len; i++) { run...
l with data cl_assert(shared_circular_buffer_write(&buffer, (uint8_t*) "123456", 6, false)); // Read different amounts from each client cl_assert(shared_circular_buffer_read(&buffer, &client1, 4, &out_buffer, &out_length)); cl_assert(shared_circular_buffer_consume(&buffer, &client1, 4)); cl_assert(memcmp(out...
cl_assert_equal_i(shared_circular_buffer_get_read_space_remaining(&buffer, &client), 2)
; // Consume it prv_read_and_consume(&buffer, &client, storage, 2); cl_assert_equal_i(shared_circular_buffer_get_read_space_remaining(&buffer, &client), 0); } void test_shared_circular_buffer__subsampling_2of5(void) { SharedCircularBuffer buffer; uint16_t item_size = 2; uint8_t storage[12*item_size]; u...
(BOOT_BIT_RESET_LOOP_DETECT_THREE)
; break; case 5: boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE); break; case 6: boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE); boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_TWO); break; case 7: boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE); break; default: boot_bit_clear(BOOT_BIT_RES...
if (!ctx->cached) { // Containers do not inherently have their own drawing procedure beyond managing its own size // and the shrinking draw box size that it hands over to its children. Therefore if it it is a // container, we "draw" it by ascending into its children continuing to the start of this loo...
// Descend levels if they are complete with this descent loop // We will continue to descend until we've either found a sibling or descended beyond level 0 for (; level >= 0; level--) { GTextNodeDrawContext *ctx = &contexts[level]; GTextNodeDrawContext *parent_ctx = (level > 0) ? &contexts[lev...
igin_aa_sw2_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 2); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw2_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIG...
(&ctx.dest_bitmap, "draw_rect_origin_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 1); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw1_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, fal...
1]; c = (*state)[i][2]; d = (*state)[i][3]; (*state)[i][0] = Multiply(a, 0x0e) ^ Multiply(b, 0x0b) ^ Multiply(c, 0x0d) ^ Multiply(d, 0x09); (*state)[i][1] = Multiply(a, 0x09) ^ Multiply(b, 0x0e) ^ Multiply(c, 0x0b) ^ Multiply(d, 0x0d); (*state)[i][2] = Multiply(a, 0x0d) ^ Multiply(b, 0x09) ^ Multip...
KeyExpansion()
/* * 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...
strlen(key)
)); blob_db_get_dirty_dbs(ids, &num_ids); cl_assert_equal_i(num_ids, 0); cl_assert(blob_db_get_dirty_list(BlobDBIdTest) == NULL); } static bool prv_list_key_comparator(ListNode *cur_node, void *data) { BlobDBDirtyItem *dirty_item = (BlobDBDirtyItem *)cur_node; char *key = data; return (memcmp(dirty_item->k...
state() static void prv_release_log_state(LogState *state) { PebbleTask task = pebble_task_get_current(); if (task == PebbleTask_App || task == PebbleTask_Worker) { state->in_progress = false; } else { kernel_applib_release_log_state(state); } } static void prv_log_internal(bool async, uint8_t log_lev...
if (!prv_use_default_log_msg(msg, max_message_length)) { // add the hashed value for the 'New Log' message sprintf(msg->message, "NL:%x", hash); msg->message_length += strlen(msg->message); if (num_fmt_conversions != 0) { char expanded_fmt_buffer[64]; // Fix the fmt string to include space...
sys_pbl_log((LogBinaryMessage*) state->buffer, async); prv_release_log_state(state); } #endif /* PBL_LOGS_HASHED */ void pbl_log_vargs(uint8_t log_level, const char *src_filename, int src_line_number, const char *fmt, va_list args) { const bool async = true; prv_log_internal(async, log_le...
TickType_t ticks = milliseconds_to_ticks(4000); // DMA should be fast if (xSemaphoreTake(s_dma_update_in_progress_semaphore, ticks) != pdTRUE) { // something went wrong, gather some debug info & reset int dma_status = DMA_GetITStatus(DISPLAY_DMA_STREAM, DMA_IT_TCIF4); uint32_t spi_clock_status = (RCC->AP...
((uint8_t*)s_dma_line_buffer, r.data, DISP_LINE_BYTES)
; s_dma_line_buffer[0] &= ~(0xffff); s_dma_line_buffer[0] |= (DISP_MODE_WRITE | reverse_byte(r.address + 1) << 8); #else prv_memcpy_backwards(s_dma_line_buffer, (uint32_t*)r.data, DISP_LINE_WORDS); s_dma_line_buffer[0] &= ~(0xffff); s_dma_line_buffer[0] |= reverse_byte(167 - r.address + 1) << 8; #en...
- This, because the user does not expect to see more text drawn below, after the '...'. // - The first-line exception means that text, and therefore the telltale // ellipsis, will always be visisble. if ((text_box_params->overflow_mode == GTextOverflowModeTrailingEllipsis || text_box_params->ov...
(codepoint)
) { continue; }; return true; } } //////////////////////////////////////////////////////////// // Helper functions //! Trim given codepoint from the start of the word //! Used to remove whitespace and newlines //! @return is_trimmed bool word_trim_preceeding_codepoint(GContext* ctx, Word* word, const...
ding it cl_assert(circular_buffer_consume(&buffer, 1)); // Read the last little bit cl_assert(circular_buffer_read(&buffer, 1, &out_buffer, &out_length)); cl_assert_equal_i(out_length, 1); cl_assert(memcmp(out_buffer, (uint8_t*) "c", 1) == 0); cl_assert(circular_buffer_consume(&buffer, 1)); // And we sh...
(&buffer, &data_out)
; cl_assert_equal_i(contiguous_num_bytes_left, 0); cl_assert_equal_p(data_out, NULL); const uint16_t copy_out_size = 8; uint8_t copy_out[copy_out_size]; cl_assert_equal_i(circular_buffer_copy(&buffer, copy_out, copy_out_size), 8); cl_assert_equal_i(memcmp(copy_out, "01234567", 8), 0); circular_buffer_co...
return from_reel; } GContext *graphics_context_get_current_context(void) { return &s_ctx; } void test_weather_app_layout__initialize(void) { fb = malloc(sizeof(FrameBuffer)); framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); const GContextInitializationMode context_init_mode = GContextInitializationMo...
(&s_ctx.dest_bitmap, TEST_PBI_FILE)
); } void test_weather_app_layout__render_cloudy_light_snow(void) { const WeatherLocationForecast forecast = { .location_name = "PALO ALTO", .current_temp = -88, .today_high = -88, .today_low = -88, .current_weather_type = WeatherType_CloudyDay, .current_weather_phrase = "Cloudy", .tomorr...
-224, -968}, { -160, -224, -992}, { -152, -160, -992}, // 68 seconds { -160, -216, -984}, { -152, -208, -992}, { -144, -200, -992}, { -152, -208, -984}, { -160, -176, -992}, { -168, -200, -976}, { -168, -192, -976}, { -160, -208, -984}, { -152, -200, -968}, { -144, -2...
{ -152, -136, -992}, // 73 seconds { -152, -152, -992}, { -168, -136, -992}, { -168, -120, -984}, { -160, -128, -1000}, { -152, -144, -992}, { -144, -144, -1000}, { -152, -136, -992}, { -152, -136, -984}, { -160, -136, -1008}, { -152, -136, -992}, { -160, -152, -976},...
{ -160, -136, -1000}, { -160, -152, -992}, { -160, -152, -992}, { -160, -152, -976}, { -160, -128, -992}, { -160, -144, -1008}, { -160, -152, -1000}, { -160, -160, -984}, { -168, -144, -992}, { -168, -136, -984}, { -160, -136, -992}, { -160, -152, -984}, { -160, -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...
(is_future, timeline_is_destination)
; #else const bool jump = (!uuid_is_invalid(&s_timeline_args.pin_id) && !timeline_peek_is_first_event()); animation = jump ? compositor_peek_transition_timeline_get() : compositor_slide_transition_timeline_get(is_future, timeline_is_destination, ...
ffset, this won't work when we try to roll over to the other 25% of the sectors if (s_valid_page_idx == SPRF_PAGE_IDX_INVALID) { prv_erase_region_and_save(NULL); } else if (s_valid_page_idx > (SPRF_MAX_NUM_PAGES_MULT(SPRF_NUM_PAGES))) { prv_erase_region_and_save(&data); } } prv_unlock(); } ...
// Should we return a failure on a failed name get? if (name_rv) { strncpy(name_out, name_data.name, BT_DEVICE_NAME_BUFFER_SIZE); } else { name_out[0] = '\0'; } } rv = true; } unlock: prv_unlock(); return rv; }
void shared_prf_storage_store_ble_pairing_data( const SMPairingInfo *pairing_info, const char *name, bool requires_address_pinning, uint8_t flags) { if (!pairing_info || sm_is_pairing_info_empty(pairing_info)) { PBL_LOG(LOG_LEVEL_WARNING, "PRF Storage: Attempting to store an NULL or empty pairing info")...
new should happen except the stop handler for a (which we started) prv_advance_to_ms_with_timers(start_ms + 5 * (duration_total + 3 * MIN_FRAME_INTERVAL_MS)); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 3); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 3)...
cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, a), 1)
; cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 2); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 2); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, b), 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 i...
{ OS_LEAVE_CRITICAL_SECTION(); }
static void prv_core_dump(void) { // TODO Implement core dump PBL_ASSERTN(0); } void host_transport_set_mcu_int(bool is_ready_to_transact) { if (is_ready_to_transact) { hw_gpio_set_active(HOST_SPI->mcu_int.port, HOST_SPI->mcu_int.pin); } else { hw_gpio_set_inactive(HOST_SPI->mcu_int.port, HOST_SPI->m...
rd_start_time = *utc_start; for (num_records_returned = 0; num_records_returned < num_records_requested; num_records_returned++, record_start_time += SECONDS_PER_MINUTE) { if (record_start_time + SECONDS_PER_MINUTE > last_second_available) { // This record not available yet. break; } m...
fake_rtc_increment_ticks(configTICK_RATE_HZ * SECONDS_PER_DAY)
; fake_cron_job_fire(); fake_system_task_callbacks_invoke_pending(); } } // --------------------------------------------------------------------------------------- // Uncompress data stored in the raw accel DLS records static void prv_uncompress_captured_data(AccelRawData *data, uint32_t num_samples) { f...
s are outstanding. If an enqueue is about to start but the stack is // no longer up, it does NOT bump the job count as we expect prv_enqueue() to // bail immediately static bool prv_update_enqueue_count(bool start) { bool initialized; prv_lock(); { initialized = prv_check_initialized(); if (initialized ||...
list_prepend((ListNode *)s_expectations_head, &expectation->node)
; prv_unlock(); return expectation; } static void prv_cleanup_expectation(HcExpectation *expectation) { prv_lock(); list_remove((ListNode *)expectation, (ListNode **)&s_expectations_head, NULL); prv_unlock(); vSemaphoreDelete(expectation->semaphore); kernel_free(expectation); } static HcProtocolMessage ...
et_locale_info()->app_locale_time; return sys_strftime(s, maxsize, format, tim_p, locale); } DEFINE_SYSCALL(int, sys_strftime, char* s, size_t maxsize, const char* format, const struct tm* tim_p, char *locale) { if (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(s,...
va_start(args, format)
; ret = vsnprintf(str, n, format, args); va_end(args); return ret; }
/* * 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...
scroll_layer_create(GRect(0,0,180,180))
; // Validate that paging_disabled is same position as shadow clips scroll_layer->shadow_sublayer.clips = true; cl_assert_equal_b(true, scroll_layer->paging.paging_disabled); cl_assert_equal_b(false, scroll_layer->paging.shadow_hidden); scroll_layer->shadow_sublayer.clips = false; cl_assert_equal_b(false,...
aphics_draw_circle(&ctx, CENTER_OF_OFFSET_RECT_NXNY, RADIUS_BIG); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_aa_r16_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // Medium circles setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, STROKE_SMALL); graphics_draw_circle(&ctx, CEN...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_r8_quads_bottom.${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,GCornersRight); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_r8_quads_right.${BIT_DEPTH_NAME}.pbi")...
olor_equal(lookup_table_out[0], GColorBlack)); cl_assert(gcolor_equal(lookup_table_out[1], GColorDarkGray)); cl_assert(gcolor_equal(lookup_table_out[2], GColorLightGray)); cl_assert(gcolor_equal(lookup_table_out[3], GColorWhite)); // Setting the tint color to blue should result in a gradient from blue to yello...
gcolor_component_multiply(i, j)
/* * 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...
(notif_db_delete((uint8_t *)&hdr, UUID_SIZE), 0)
; cl_assert_equal_i(notif_db_get_len((uint8_t *)&hdr, UUID_SIZE), 0); } void test_notif_db__flush(void) { SerializedTimelineItemHeader hdr1 = { .common = { .ancs_uid = 1, .layout = 0, .flags = 0, .timestamp = 0, }, }; uuid_generate(&hdr1.common.id); SerializedTimelineItemHeade...
/* * 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_last_args_for_mock = (ArgsForMock){ .ctx = *ctx, .p0 = p0, .p1 = p1 }; strncpy(s_last_args_for_mock.func, __func__, sizeof(s_last_args_for_mock.func)); }
void graphics_line_draw_stroked_non_aa(GContext* ctx, GPoint p0, GPoint p1, uint8_t stroke_width) { s_last_args_for_mock = (ArgsForMock){ .ctx = *ctx, .p0 = p0, .p1 = p1 }; strncpy(s_last_args_for_mock.func, __func__, sizeof(s_last_args_for_mock.func)); } void prv_fill_rect_non_aa(GContext* ctx, co...
_on*/, NULL, NULL); int32_t before; activity_get_metric(ActivityMetricStepCount, 1, &before); // Walk for about 30 minutes const int k_num_minutes = 30; // The sample we feed in feeds about 90 steps/min const int k_steps_per_minute = 90; // Feed in the data prv_feed_steps_min(k_num_minutes); // C...
PBL_LOG(LOG_LEVEL_DEBUG, "sleep state minutes: %d", (int)(value / SECONDS_PER_MINUTE))
; prv_test_end(context, passed); } // ------------------------------------------------------------------------------- // Test that we don't crash or get a weird sleep session if the UTC time changes while // sleeping static void prv_test_sleep_time_change(void *context) { bool passed = true; // Reset all stor...
"); jerry_value_t getDate = jerry_get_object_field(now, "getDate"); jerry_value_t result_seconds = jerry_call_function(getSeconds, now, NULL, 0); jerry_value_t result_minutes = jerry_call_function(getMinutes, now, NULL, 0); jerry_value_t result_hours = jerry_call_function(getHours, now, NULL, 0); jerry_value...
(result_hours)
; jerry_release_value(result_minutes); jerry_release_value(result_seconds); jerry_release_value(getYear); jerry_release_value(getMonth); jerry_release_value(getDate); jerry_release_value(getHours); jerry_release_value(getMinutes); jerry_release_value(getSeconds); jerry_release_value(now); }
->debug_card.dialog_text, sizeof(data->debug_card.dialog_text), "Sleep sessions\n"); // Print info on each one ActivitySession *session = sessions; for (uint32_t i = 0; i < num_sessions; i++, session++) { char *prefix = ""; bool deep_sleep = false; switch (session->type) { case Activ...
app_free(sessions)
; prv_display_alert(data->debug_card.dialog_text); } // ----------------------------------------------------------------------------------------- static void prv_debug_cmd_weekday_averages(int index, void *context) { ActivityDemoAppData *data = context; prv_display_averages_alert(data, Monday); } // ---------...
/* * 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...
(font_key)
; // maybe they wanted a renamed font if (NULL == res && 0 == strncmp(font_key, bitham_alias, bitham_alias_len)) { char new_font_key[bitham_prefix_len - bitham_alias_len + strlen(font_key) + 1]; strncpy(new_font_key, bitham_prefix, bitham_prefix_len); strcpy(new_font_key+bitham_prefix_len, font_key+bit...
----------------------------------------------------------------- // Pushes an HR Median/Filtered/LastStable event. static void prv_push_median_hr_event(uint8_t median_hr) { if (median_hr > 0) { PebbleEvent event = { .type = PEBBLE_HEALTH_SERVICE_EVENT, .health_event = { .type = HealthEventHea...
if (new_hr_zone > state->hr.metrics.current_hr_zone) { state->hr.metrics.current_hr_zone++; } else if (new_hr_zone < state->hr.metrics.current_hr_zone) { state->hr.metrics.current_hr_zone--; } else if (!new_hr_elevated) { state->hr.metrics.is_hr_elevated = new_hr_elevated; }
state->hr.metrics.minutes_in_zone[state->hr.metrics.current_hr_zone]++; prv_write_hr_zone_info_to_flash(state->hr.metrics.current_hr_zone); } // ------------------------------------------------------------------------------------------ // Called periodically from the minute handler to update the median HR and t...
/* * 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(val8 == (uint8_t)0xff)
; analytics_heartbeat_set(heartbeat, ANALYTICS_APP_METRIC_LAUNCH_COUNT, 80); val8 = analytics_heartbeat_get(heartbeat, ANALYTICS_APP_METRIC_LAUNCH_COUNT); cl_assert(val8 == 80); // uint16_t overflow analytics_heartbeat_set(heartbeat, ANALYTICS_APP_METRIC_MSG_DROP_COUNT, 70000); analytics_heartb...
/* * 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...
gpath_builder_line_to_point(builder, p3)
; gpath_builder_line_to_point(builder, p4); GPath *path = gpath_builder_create_path(builder); gpath_builder_destroy(builder); graphics_context_set_fill_color(ctx, color); gpath_draw_filled(ctx, path); gpath_destroy(path); } void health_progress_bar_fill(GContext *ctx, HealthProgressBar *progress_bar, GCol...
pplicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "clar.h"...
touch_handle_update(1, TouchState_FingerUp, &GPoint(1, 13), 0, 3686401)
; event = fake_event_get_last(); cl_assert_equal_i(event.type, PEBBLE_TOUCH_EVENT); cl_assert_equal_i(event.touch.type, PebbleTouchEvent_TouchesAvailable); touch_event = touch_event_queue_get_event(1, 0); prv_test_touch_event(touch_event, 1, TouchEvent_Liftoff, &GPointZero, 0, 0, &GPoint(1, 13), ...
IM_RET, 0x6); REG_SETF(DCDC, DCDC_RET_1_REG, DCDC_V18_RET_CYCLES, 0x5); REG_SETF(DCDC, DCDC_RET_1_REG, DCDC_V18_CUR_LIM_RET, 0xA); REG_SETF(DCDC, DCDC_RET_1_REG, DCDC_V14_RET_CYCLES, 0x2); REG_SETF(DCDC, DCDC_RET_1_REG, DCDC_V14_CUR_LIM_RET, 0x6); REG_SETF(DCDC, DCDC_TRIM_REG, DCDC_P_COMP_MAN_TRIM, 0x0); ...
REG_SETF(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_DMY_TX_MD, 0x0)
; REG_SETF(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_EXT_TX_MD, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_ADR_TX_MD, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_INST_TX_MD, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_EXT_BYTE, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_INST_WB, 0x0); REG_SETF...
/* * 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...
memset(font_cache->cache_data, 0, sizeof(font_cache->cache_data))
; keyed_circular_cache_init(&font_cache->line_cache, font_cache->cache_keys, font_cache->cache_data, sizeof(LineCacheData), LINE_CACHE_SIZE); resource_init(); } void test_text_resources__cleanup(void) { } void test_text_resources__init_font(void) { uint32_t gothic_18_handle = RESOU...
/* * 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_CROAK("Invalid task %s", pebble_task_get_name(pebble_task_get_current()))
; } } // ------------------------------------------------------------------------------------------ DEFINE_SYSCALL(void, animation_service_timer_event_received, void) { PebbleTask task = pebble_task_get_current(); if (task == PebbleTask_KernelMain) { s_kernel_main_event_pending = false; } else if (task...
return gdraw_command_sequence_create_with_resource_system(app_num, resource_id); } GDrawCommandSequence *gdraw_command_sequence_create_with_resource_system(ResAppNum app_num, uint32_t resource_id) { uint32_t data_size; if (!gdraw_command_reso...
gdraw_command_frame_get_data_size(frame)
; frame = prv_next_frame(frame); } return size; } GSize gdraw_command_sequence_get_bounds_size(GDrawCommandSequence *sequence) { if (!sequence) { return GSizeZero; } return sequence->size; } void gdraw_command_sequence_set_bounds_size(GDrawCommandSequence *sequence, GSize size) { if (!sequence) ...
_window_private.h" #include "applib/ui/dialogs/dialog.h" #include "applib/ui/dialogs/dialog_private.h" #include "applib/ui/dialogs/expandable_dialog.h" #include "applib/ui/dialogs/simple_dialog.h" #include "applib/ui/progress_window.h" #include "applib/ui/window.h" #include "applib/ui/window_manager.h" #include "applib...
(data->response.timer)
) { evented_timer_cancel(data->response.timer); } } static void prv_cleanup_action_result(ActionResultData *data, bool succeeded) { if (!data) { return; } // report to analytics the result of the action if (data->response.attribute.id == AttributeIdTitle && data->response.attribute.cstring) { ...
for (int i = 0; i < GAP_LE_CONNECT_MASTER_MAX_CONNECTION_INTENTS + 1; ++i) { BTDeviceInternal device = prv_dummy_device(i); BTErrno e = gap_le_connect_connect(&device, true /* auto_reconnect */, false /* is_pairing_required */, ...
prv_add_bonding_for_fake_resolvable_device()
(event_time - (1 * SECONDS_PER_MINUTE)); clock_get_until_time(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("In 1 minute", time_buf); // June 9th 2015, 15:58:00 (T-00:02:00) rtc_set_time(event_time - (2 * SECONDS_PER_MINUTE)); clock_get_until_time(time_buf, sizeof(time_buf), ev...
("16:00", time_buf)
; // June 8th 2015, 16:00:00 (T-48:00:00) rtc_set_time(event_time - SECONDS_PER_DAY - (24 * SECONDS_PER_HOUR)); clock_get_until_time(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("Tue, 16:00", time_buf); // June 16th 2015, 17:00:00 (T+7DAY+01:00:00) rtc_set_time(event_time +...
der 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 "crumbs_layer.h" #include "applib/applib_malloc.auto.h" #include "shell/...
((Layer *)crumbs_layer)
/* * 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_ASSERTN(s_tx_buffer_mutex != INVALID_MUTEX_HANDLE)
; } void pulse_start(void) { for (unsigned int i = 0; i < ARRAY_LENGTH(s_receive_buffers); ++i) { s_receive_buffers[i] = kernel_malloc_check(sizeof(IncomingPulseFrame)); prv_return_receive_buffer(s_receive_buffers[i]); } s_current_receive_buffer = prv_take_receive_buffer(); s_drop_rest_of_frame = false...
e; } cursor += sizeof(segment_header); // Write all the data bytes in the segment to the HRM. uint16_t write_address = segment_header.address; uint32_t bytes_remaining = segment_header.len_minus_1 + 1; while (bytes_remaining) { uint8_t chunk[MAX_HEX_DATA_BYTES]; const size_t load_len...
if (!prv_set_accel_sample_frequency(dev, HRM_MANAGER_ACCEL_RATE_MILLIHZ)) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to set accel frequency"); goto failed; }
f(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_delete(&file, key, key_len); } } printf("Making sure we handle running out of storage gracefully...\n"); ...
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); cl_assert_equal_m(new_value, val_out, val_len_out); free(val_out); return RecordResultNew; ...
1, CRON_MONTH_ANY, prv_cron_callback) CRON_JOB(25, CRON_HOUR_ANY, CRON_MDAY_ANY, CRON_MONTH_ANY, prv_cron_callback) CRON_JOB(55, 1, CRON_MDAY_ANY, CRON_MONTH_ANY, prv_cron_callback) CRON_JOB(CRON_MINUTE_ANY, CRON_HOUR_ANY, 1, CRON_MONTH_ANY, prv_cron_callback) }; CronJob new_job = { .cb = prv_coun...
{ CronJob test_cron = { .cb = prv_cron_callback, .cb_data = (void*)0, .minute = 30, .hour = 1, .mday = CRON_MDAY_ANY, .month = CRON_MONTH_ANY, .offset_seconds = -30 * SECONDS_PER_MINUTE, .may_be_instant = false, }; const time_t advance = SECONDS_PER_DAY; prv_basic_test(&s_time...
ssion starting at 1am. This will leave us at 3am. prv_feed_cannned_accel_data(120 * SECONDS_PER_MINUTE, 0, ActivitySleepStateLightSleep); // Awake for 1 hour which puts us at 4am prv_feed_cannned_accel_data(60 * SECONDS_PER_MINUTE, 20, ActivitySleepStateAwake); ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricSleepT...
(false /*test_mode*/)
; fake_system_task_callbacks_invoke_pending(); // Light walking, 50 steps/minute, until 10pm prv_feed_cannned_accel_data(5 * SECONDS_PER_HOUR, 50, ActivitySleepStateAwake); // Falling asleep for 30 minutes prv_feed_cannned_accel_data(30 * SECONDS_PER_MINUTE, 5, ActivitySleepStateAwake); // Starting at 10...
free(r.allocated_buffer)
; const size_t block_size = file_size / 4; int erase_count = block_size / notif_size + (((block_size % notif_size) > 0) ? 1 : 0); int j; for (j = 0; j < erase_count; j++) { e.header.id = uuids[j]; e.header.timestamp = timestamp + j; cl_assert_equal_b(notification_storage_get(&uuids[j], &r), false);...
Id install_id; RtcTicks crash_ticks; } AppCrashInfo; static NextApp s_next_app; static void prv_handle_app_start_analytics(const PebbleProcessMd *app_md, const AppLaunchReason launch_reason); // -----------------------------------------------------------------------------...
{ // on Spalding, we didn't have enough applib padding to guarantee both, // 4.x native app heap + JerryScript statis + increased stack for Rocky. // For now, we just decrease the amount of available heap as we don't use it. // In the future, we will move the JS stack to the heap PBL-357...
#endif return APP_RAM_4X_SIZE; case ProcessAppSDKType_System: return APP_RAM_SYSTEM_SIZE; default: WTF; } } static size_t prv_get_app_stack_size(const PebbleProcessMd *app_md) { #if CAPABILITY_HAS_JAVASCRIPT if (app_md->is_rocky_app) { return APP_STACK_ROCKY_SIZE; } #endif return...
528, -104, -584}, { -1776, -168, -392}, { -1832, 40, -352}, { -1600, 240, -232}, { -1296, 392, -88}, { -1184, 336, -72}, { -1224, 352, -40}, { -1120, 328, -48}, { -1008, 320, 8}, { -1184, 368, -112}, { -1160, 536, -16}, { -1352, 736, -184}, // 5 seconds { -904, 752, -...
{ -1040, -88, 320}, { -640, -936, 136}, { -1032, -208, 56}, { -1296, -168, -152}, // 10 seconds { -1576, 56, -40}, { -1448, 8, -256}, { -1568, -64, -32}, { -1680, 56, 72}, { -1728, 400, 32}, { -1712, 560, 160}, { -1640, 768, 56}, { -1488, 624, 96}, { -1320, 360, 1...
{ -1504, 368, -120}, { -1392, 416, -32}, { -1272, 440, -64}, { -1120, 184, -192}, { -1280, 672, 184}, { -1520, 728, 248}, { -1016, 872, 96}, { -992, 888, -32}, { -976, 664, 0}, { -1168, 696, -200}, { -1424, 704, -136}, { -1784, 640, -16}, { -1992, 616, 168}, { -1...