prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
------------------------------------- // Fakes // ----------------------------------------------------------------------------- bool mfg_info_is_hrm_present(void) { return true; } static bool s_activity_prefs_heart_rate_is_enabled = true; bool activity_prefs_heart_rate_is_enabled(void) { return s_activity_prefs_he...
stub_pebble_tasks_set_current(PebbleTask_App)
; AppInstallId app_id = 1; const uint32_t update_interval_s = 1; uint16_t expire_s = 0; HRMFeature features = HRMFeature_BPM; // If we subscribe with no expiration, we should get 0 back HRMSessionRef session_ref = sys_hrm_manager_app_subscribe(app_id, update_interval_s, expire_s, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&data->from)
, grect_center_point(&data->to)); return gpoint_sub(offset, GPoint(size.w / 2, size.h / 2)); } static bool prv_image_size_eq_rect_size(KinoReelTransformData *data, GRect rect) { GSize size = kino_reel_get_size(prv_get_current_reel(data)); return gsize_equal(&size, &rect...
tionPrivate *)a; AnimationPrivate *animation_b = (AnimationPrivate *)b; return serial_distance32(animation_a->abs_start_time_ms, animation_b->abs_start_time_ms); } // ------------------------------------------------------------------------------------------- inline static uint32_t prv_get_ms_since_system_start(vo...
{ return; }
AnimationPrivate *animation = (AnimationPrivate *) state->scheduled_head; while (animation) { // Since we are reducing the start times, each of the animations we operate on will be // moved earlier in the list. Get the next pointer now before we possibly move it. next = (AnimationPrivate*) list_get_ne...
int pages_in_use = 0; prompt_send_response("Page:\tFilename\tFile Size\tFile Info\tErase Count\n"); for (uint16_t pg = 0; pg < s_pfs_page_count; pg++) { PageHeader pg_hdr; FileHeader file_hdr; pg_hdr.page_flags = prv_get_page_flags(pg); if (!IS_PAGE_TYPE(pg_hdr.page_flags, PAGE_FLAG_START_PAGE)...
prv_handle_sector_erase(s_gc_block.gc_start_page, false)
; } void test_override_last_written_page(uint16_t start_page) { s_test_last_page_written_override = s_last_page_written; } #endif
Layer *layer, GRect *bounds_out) { *bounds_out = GRect(5, 6, 7, 8); } void test_rocky_api_graphics__canvas_offers_size(void) { rocky_global_init(s_graphics_api); Layer l = {.bounds = GRect(1, 2, 3, 4)}; const jerry_value_t ctx = prv_create_canvas_context_2d_for_layer(&l); jerry_set_object_field(jerry_get_g...
(10*8, lc->fill_radial_precise.radius_inner.raw_value)
; cl_assert_equal_i(30*8, lc->fill_radial_precise.radius_outer.raw_value); } void test_rocky_api_graphics__fill_radial_not_enough_args(void) { prv_global_init_and_set_ctx(); EXECUTE_SCRIPT_EXPECT_ERROR( "ctx.rockyFillRadial(30, 40, 10, 20, 0);\n", "TypeError: Not enough arguments" ); } void test_ro...
t_reason_get(&reason); reason.code = RebootReasonCode_CoreDumpReentered; reboot_reason_set(&reason); // Go into low-power mode. Hard reset isn't useful. prv_low_power_mode(); } s_core_dump_initiated = true; if (user_requested) { printf("CD: user requested\n"); RebootReason reason = { .c...
xTaskGetCurrentTaskHandle()
; char *task_name = pcTaskGetTaskName(current_task_id); s_thread_info.ti.running = true; s_thread_info.ti.id = (uint32_t)current_task_id; if (task_name) { strncpy((char *)s_thread_info.ti.name, task_name, sizeof(s_thread_info.ti.name)); } } // Make sure that our stack pointer is somewhere...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
rocky_util_eval_and_log_uncaught_error((const jerry_char_t *)source_buf, strlen(source_buf))
; task_free(source_buf); } if (!timer_data->is_repeating) { prv_timer_cleanup(timer_data); } } static jerry_value_t prv_create_timer(const jerry_value_t *argv, const jerry_length_t argc, bool is_repeating) { if (argc < 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...
{ // we can go to SmartstrapStateUnsubscribed from any state PBL_ASSERTN(!mcu_state_is_isr()); }
else if ((prev_state == SmartstrapStateUnsubscribed) && (new_state == SmartstrapStateReadReady)) { PBL_ASSERT_TASK(PebbleTask_KernelBackground); } else if ((prev_state == SmartstrapStateReadReady) && (new_state == SmartstrapStateNotifyInProgress)) { PBL_ASSERTN(mcu_state_is_isr()); ...
RRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "applib/graphics/graphics.h" #include "applib/graphics/framebuffer.h" #include "applib/ui/window_private.h" #include "applib/ui/layer.h" ...
(&layer, &ctx)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_across_x_offset_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&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_rect_across_nx_offset...
itmap_layer_get_layer(&data->bmp_layer)); GRect title_text_frame = (GRect) { .size = title_text_size }; const int16_t title_text_internal_padding = 5; title_text_frame.origin.y = bmp_frame.origin.y + bmp_size.h + vertical_spacing - title_text_internal_padding; text_layer_init_wi...
{ case SystemMenuItemStationaryToggle: subtitle = stationary_get_enabled() ? i18n_get("On", data) : i18n_get("Off", data); break; case SystemMenuItemShutDown: if (!prv_shutdown_enabled()) { // XXX: For now, gray out the Shut Down item if unusable. graphics_context_set_text_colo...
menu_cell_basic_draw(ctx, cell_layer, i18n_get(s_item_titles[row], data), subtitle, NULL); } void factory_reset_select_callback(int index, void *context) { settings_factory_reset_window_push(); } static void prv_select_click_cb(SettingsCallbacks *context, uint16_t row) { SettingsSystemData *data = (SettingsSys...
_assert(active == false); do_not_disturb_set_manually_enabled(true); active = do_not_disturb_is_active(); cl_assert(active == true); do_not_disturb_set_manually_enabled(false); active = do_not_disturb_is_active(); cl_assert(active == false); } void test_do_not_disturb__is_active(void) { // Time 00:00, ...
(s_thursday_01_00)
ead_iter = prv_read_ptr_and_length_from_buffer(read_iter, msg + length, &album_ptr, &album_length); if (!read_iter) { return; } const char* title_ptr; size_t title_length; read_iter = prv_read_ptr_and_length_from_buffer(read_iter, msg + length, ...
prv_update_play_state_info(session, msg, length)
; break; case MusicEndpointCmdIDVolumeInfoResponse: prv_update_volume_info(session, msg, length); break; case MusicEndpointCmdIDPlayerInfoResponse: prv_update_player_info(session, msg, length); break; default: PBL_LOG(LOG_LEVEL_DEBUG, "Invalid command 0x%"PRIx8, msg[0]); ...
io_set_pin_function(HOST_SPI->spi.mosi_di.port, HOST_SPI->spi.mosi_di.pin, HW_GPIO_MODE_INPUT, HOST_SPI->spi.mosi_di.function); hw_gpio_set_pin_function(HOST_SPI->spi.miso_do.port, HOST_SPI->spi.miso_do.pin, HW_GPIO_MODE_OUTPUT, HOST_SPI->spi.miso_do.function); ...
("Expecting to read %u bytes:", rx_len)
This update is for a day in the past. Modify the copy stored in the settings file SettingsFile *file = activity_private_settings_open(); if (!file) { goto unlock; } ActivitySettingsValueHistory history; settings_file_get(file, &m_info.settings_key, sizeof(m_info.settings_key), ...
mutex_unlock_recursive(state->mutex)
; } // -------------------------------------------------------------------------------------------- // Called periodically from the minute handler to update step derived metrics that do not have to // be updated in real time. // We use NOINLINE to reduce the stack requirements during the minute handler (see PBL-38130...
{ 48, 24, -1000}, { 48, 32, -1000}, { 48, 24, -1000}, { 48, 32, -1000}, { 56, 24, -1000}, { 48, 24, -1000}, { 56, 24, -1000}, { 48, 24, -1008}, { 56, 24, -1000}, { 48, 16, -1000}, { 56, 32, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 32, -1000}, { 48, 24, -1...
{ 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 56, 24, -992}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 56, 24, -992}, { 48, 24, ...
{ 56, 24, -1000}, { 48, 24, -1000}, { 56, 32, -1000}, { 48, 24, -992}, { 48, 24, -992}, { 48, 24, -1000}, { 56, 24, -1000}, { 48, 24, -992}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1008}, { 56, 16, -992}, { 48, 32, -1000}, { 56, 24, -1000}, { 48, 24, -...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
while (LPTIM_GetFlagStatus(pwm->timer.lp_peripheral, LPTIM_FLAG_ARROK) == RESET) continue;
#endif LPTIM_Cmd(pwm->timer.lp_peripheral, DISABLE); } else { // Initialize regular timer TIM_TimeBaseInitTypeDef tim_config; TIM_TimeBaseStructInit(&tim_config); tim_config.TIM_Period = resolution - 1; tim_config.TIM_Prescaler = timer_find_prescaler(&pwm->timer, frequency); tim_config.TI...
a *s_app_data; static const uint32_t TIMELINE_SLIDE_ANIMATION_MS = 150; static const uint32_t PEEK_SLIDE_ANIMATION_MS = 300; static const uint32_t PEEK_SHOW_TIME_MS = 660; static const TimelineAppStyle *prv_get_style(void) { return s_styles[PreferredContentSizeDefault]; } ///////////////////////////////////// // ...
{ TimelineAppData *data = context; data->timeline_layer.animating_intro_or_exit = false; launcher_task_add_callback(prv_launch_watchface, data); }
static void prv_intro_or_exit_anim_started(Animation *anim, void *context) { TimelineAppData *data = context; data->timeline_layer.animating_intro_or_exit = true; } static void prv_exit_anim_stopped(Animation *animation, bool finished, void *context) { // we must use a timer to allow the last frame to render ...
h) { return ((const PebbleProcessMdFlash*) md)->process_version; } return (Version) { 0, 0 }; } Version process_metadata_get_sdk_version(const PebbleProcessMd *md) { if (md->process_storage == ProcessStorageFlash) { return ((const PebbleProcessMdFlash*) md)->sdk_version; } return (Version) { PROCESS_...
strncpy(md->name, info->name, sizeof(md->name))
; md->name[sizeof(md->name) - 1] = 0; md->size_bytes = info->virtual_size; md->bin_resource_id = bin_resource_id; } ////////////////////////////////// // PebbleProcessInfoFlags Helpers ////////////////////////////////// ProcessVisibility process_metadata_flags_visibility(PebbleProcessInfoFlags flags) { if (f...
/* * 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...
vibe_intensity_get_string_for_intensity(VibeIntensityLow)
, "Standard - Low"); cl_assert_equal_s(vibe_intensity_get_string_for_intensity(VibeIntensityMedium), "Standard - Medium"); cl_assert_equal_s(vibe_intensity_get_string_for_intensity(VibeIntensityHigh), "Standard - High"); } void test_vibe_intensity__cycle_next(void) { // Low -> Medium cl_ass...
} break; case GCompOpOr: for (int i = src_start_idx; i < src_end_idx; ++i, ++dest_x) { const uint32_t bit = (1 << i); const bool set = src & bit; if (set) { dest[dest_x] = GColorWhite.argb; } } break; ...
{ if (dest_fmt == GBitmapFormat8Bit || dest_fmt == GBitmapFormat8BitCircular) { switch (src_fmt) { case GBitmapFormat1Bit: bitblt_bitmap_into_bitmap_tiled_1bit_to_8bit(dest_bitmap, src_bitmap, dest_rect, src_origin_offset, compositing_mo...
}
ify // any currently registered EventListener on the EventTarget has no effect. EXECUTE_SCRIPT( "_rocky.off('foo', f2);\n" "_rocky.off('unknownevent', f1);\n" ); cl_assert_equal_i(0, s_prv_api_remove__callcount); cl_assert_equal_b(true, rocky_global_has_event_handlers("foo")); EXECUTE_SCRIPT("_rock...
(s_process_manager_callback_data)
; ASSERT_JS_GLOBAL_EQUALS_B("is_called", true); }
ey were added recognizer_add_to_list(recognizers[1], &layer_c.recognizer_list); cl_assert(prv_process_all_recognizers(&manager, prv_handle_dummy_touch_event, NULL)); prv_compare_recognizers_processed((int[]) {0, 1}, 2, &s_recognizers_handled); // Recognizers that attached to layers other than the active layer ...
NEW_RECOGNIZER(r2)
= test_recognizer_create(&s_test_impl_data, NULL); r2->state = RecognizerState_Started; // copied from recognizer_manager.c struct FailRecognizerCtx { Recognizer *triggered; bool recognizers_active; } ctx = { .triggered = r2, .recognizers_active = false }; cl_assert(prv_fail_recognizer(r2, &ctx)); ...
nder the License. */ #include "clar.h" #include "applib/graphics/gdraw_command.h" #include "applib/graphics/gdraw_command_list.h" #include "applib/graphics/gdraw_command_image.h" #include "applib/graphics/gdraw_command_private.h" #include "applib/graphics/gtypes.h" #include "applib/graphics/graphics.h" #include "ap...
if (s_fill_points) { free(s_fill_points); s_fill_points = NULL; }
s_path_open = false; s_radius = 0; s_path_stroke_count = 0; s_path_stroke_precise_count = 0; s_path_fill_count = 0; s_path_fill_precise_count = 0; s_circle_stroke_count = 0; s_circle_fill_count = 0; s_offset = (GPoint){ 0 }; if (s_precise_lines) { free(s_precise_lines); s_precise_lines = ...
/* * 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->voice_window)
; } } static void prv_stop_session(DictationSession *session) { session->in_progress = false; event_service_client_unsubscribe(&session->dictation_result_sub); if (pebble_task_get_current() == PebbleTask_App) { event_service_client_unsubscribe(&session->app_focus_sub); } } #endif DictationSession *dict...
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), 3686401, 0, true); } voi...
(0, TouchState_FingerDown, &GPoint(13, 13), 6, 3686420)
; touch_event = touch_event_queue_get_event(0, 1); prv_test_touch_event(touch_event, 0, TouchEvent_PositionUpdate, &GPointZero, 3686380, 0, &GPoint(13, 13), 40, 6, true); touch_handle_update(0, TouchState_FingerUp, &GPoint(18, 5), 0, 3686440); // Test the same event (event at index 1): i...
bool animated = true; prv_push_pin_window(data, state, animated); } } static void prv_set_day_sep_timer(TimelineAppData *data) { const int DAY_SEP_TIMEOUT_MS = 1000; data->day_separator_timer_id = evented_timer_register(DAY_SEP_TIMEOUT_MS, false, ...
(BUTTON_ID_SELECT, prv_select_click_handler)
; } static void prv_blobdb_event_handler(PebbleEvent *event, void *context) { TimelineAppData *data = context; PebbleBlobDBEvent *blobdb_event = &event->blob_db; if (blobdb_event->db_id != BlobDBIdPins) { // we only care about pins return; } BlobDBEventType type = blobdb_event->type; Uuid *id = (U...
ntext; if (finished) { prv_set_cell_offset(aml, aml->item_animation.bottom_offset_y); } } static const PropertyAnimationImplementation s_item_animation_implementation = { .base = { .update = (AnimationUpdateImplementation)property_animation_update_int16 }, .accessors = { .setter = { .int16 = prv_...
(void *)aml, &item_animation->top_offset_y, &item_animation->bottom_offset_y); animation_set_duration((Animation *)r_animation, (DELAY_PER_LINE / 4) * (item_height / line_height)); animation_set_curve((Animation *)r_animation, AnimationCurveEaseInOut); animation_set_handlers((Anim...
*draw_top_shading = (item_animation->current_offset_y != item_animation->bottom_offset_y); *draw_bottom_shading = (item_animation->current_offset_y != item_animation->top_offset_y); // update the rect height and offset based on the current animation state label_text_frame->origin.y += item_animation->...
_BLE_PAIRING_COUNT, AnalyticsClient_System); } void bluetooth_analytics_handle_bt_classic_pairing_request(void) { analytics_inc(ANALYTICS_DEVICE_METRIC_BT_PAIRING_COUNT, AnalyticsClient_System); } void bluetooth_analytics_handle_ble_pairing_error(uint32_t error) { analytics_event_bt_error(AnalyticsEvent_BtLePairi...
(ANALYTICS_DEVICE_METRIC_BLE_CHAN_USE_COUNT, count_bits_set((uint8_t *)&le_channel_map, NUM_LE_CHANNELS), AnalyticsClient_System)
; } } unlock: bt_unlock(); } void analytics_external_collect_chip_specific_parameters(void) { bt_lock(); bt_driver_analytics_external_collect_chip_specific_parameters(); bt_unlock(); } void analytics_external_collect_bt_chip_heartbeat(void) { // TODO: PBL-38365: Re-enable this once it is fixed :( #if 0 ...
/* * 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...
rot_bitmap_layer_deinit(rot_bitmap_layer)
; applib_free(rot_bitmap_layer); } void rot_bitmap_layer_set_corner_clip_color(RotBitmapLayer *image, GColor color) { if (gcolor_equal(color, image->corner_clip_color)) { return; } image->corner_clip_color = color; layer_mark_dirty(&(image->layer)); } void rot_bitmap_layer_set_corner_clip_color_2bit(Rot...
_custom_curve); animation_set_auto_destroy(h, false); prv_clear_handler_histories(); s_custom_curve_call_count = 0; animation_schedule(h); int max_loops = 20; int num_loops = 0; uint64_t start_ms = prv_now_ms(); uint64_t time_ms; while (s_stopped_handler_calls.num_calls == 0) { num_loops++; ...
property_animation_get_from_gpoint(prop_h, &test_value)
prv_determine_latency_for_connection(hdl->conn_mgr_info->requests, &secs_til_max_latency, &responsible_consumer); #endif // actually request the mode if it has changed: if (hdl->conn_mgr_info->curr_requested_state != state) { PBL_LOG(LOG_LEVEL_INFO, "LE: Requesting state %d for %d secs, due to %u", ...
regular_timer_is_scheduled(watchdog_cb_info)
) { regular_timer_remove_callback(watchdog_cb_info); } ConnectionStateRequest *consumer_request = (ConnectionStateRequest *)list_find((ListNode *)conn_mgr_info->requests, prv_find_source, (void *)consumer); bool is_already_granted = (gap_le_connect_params_get...
ev->i2c_slave); bool rv = i2c_read_register(dev->i2c_slave, register_address, value); i2c_release(dev->i2c_slave); return rv; } static bool prv_read_register_block(HRMDevice *dev, uint8_t register_address, void *buffer, uint32_t length) { i2c_use(dev->i2c_slave); bool rv =...
if (hrm_data_regs.sqi <= AS7000SQIThreshold_Acceptable) { data->hrm_quality = HRMQuality_Acceptable; } else if (hrm_data_regs.sqi <= AS7000SQIThreshold_Poor) { data->hrm_quality = HRMQuality_Poor; } else if (hrm_data_regs.sqi <= AS7000SQIThreshold_Worst) { data->hrm_quality = HRMQuality_Worst; } else ...
} // Sequence of events for handshake pulse (when in one-second burst mode): // - [optional] Host writes the one-second time (registers 10,11) measured for the last 20 // samples (about one second). // - Host reads any data/HRV-result/LED-current, as needed (see registers [14...53]) // - Host reads the ...
vailing_subscription_type(subscription) == BLESubscriptionNone) { prv_remove_subscription(connection, subscription); } } // ------------------------------------------------------------------------------------------------- static bool prv_check_buffer(GAPLEClient client) { if (s_circular_buffer[client] == NULL...
(LOG_LEVEL_WARNING, "Consume called while no notifications in buffer")
; *characteristic_ref_out = BLE_CHARACTERISTIC_INVALID; *value_length_in_out = 0; } has_more = has_notification && prv_get_next_notification_header(client, &next_header); } unlock: if (!has_more) { s_is_notification_event_pending[client] = false; } if (...
uint32_t buffer_size) { mutex_lock(s_flash_lock); s_analytics_read_count++; s_analytics_read_bytes_count += buffer_size; s_system_analytics_read_bytes_count += buffer_size; // TODO: use DMA when possible // TODO: be smarter about pausing erases. Some flash chips allow concurrent // reads while ...
(PASSED(status), "Blank check error: %" PRId32, status)
; if (status != S_FALSE) { stop_mode_enable(InhibitorFlash); s_erase.in_progress = false; mutex_unlock(s_flash_lock); xSemaphoreGive(s_erase_semphr); // Only run the callback with no locks held so that the callback won't // deadlock if it kicks off another sector erase. on_complete_cb(cont...
/* * 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...
gpoint_from_polar_precise(center, distance << GPOINT_PRECISE_PRECISION, angle)
; } static void prv_graphics_draw_centered_text(GContext *ctx, const GSize *max_size, const GPoint *center, const GFont font, const GColor color, const char *text) { GSize text_size = app_graphics_text_layout_get_content_size( ...
G_RESP_REGION_GEOMETRY (131) #define IMAGING_RESP_FINALIZE_REGION (132) #define IMAGING_RESP_MALFORMED_CMD (192) #define IMAGING_RESP_INTERNAL_ERROR (193) #define FLASH_REGION_PRF (1) #define FLASH_REGION_SYSTEM_RESOURCES (2) typedef union Command { uint8_t opcode; struct PACKED EraseCommand { uint8_t opcode...
{ pulse_best_effort_send(message, sizeof(EraseAndWriteAck)); }
s_erase_in_progress = false; } static void prv_handle_write(Command *cmd, size_t command_length) { if (command_length <= sizeof(cmd->write)) { prv_respond_malformed_command(cmd, command_length, NULL); return; } size_t write_length = command_length - sizeof(cmd->write); flash_write_bytes(&cmd->writ...
{ 752, 1272, -360}, { 888, 1080, -328}, { 1048, 696, -304}, { 1368, 768, -320}, { 1592, 720, -264}, { 1440, 504, -104}, { 1432, 376, -104}, { 1504, 336, -160}, { 1536, 304, -72}, { 1440, 304, 16}, { 1288, 272, 16}, { 976, 224, -24}, { 696, -352, 88}, { 856, -184, 2...
{ 768, -304, -432}, { 1072, 24, -320}, // 58 seconds { 1304, 216, -128}, { 1520, 104, -16}, { 1584, 248, -24}, { 1744, 544, -160}, { 1664, 888, -368}, { 1608, 728, -352}, { 1544, 624, -288}, { 1248, 952, -224}, { 1064, 1216, -176}, { 792, 1320, -232}, { 808, 1304,...
{ 1344, 992, -96}, { 1712, 720, -112}, { 1608, 408, -96}, { 1440, 336, -104}, { 1480, 400, -88}, { 1664, 448, -88}, { 1672, 336, 56}, { 1448, 272, 48}, { 1192, 128, -80}, { 744, -864, 40}, { 552, -464, -184}, { 808, -480, 24}, // 61 seconds { 1144, 128, -136}, ...
/* * 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...
DIV_X(frame.size.w * (500 + (MULT_X(cur, limit_b) / 2)))
{ // Line dimensions not yet set; use all available line space available_horiz_px = line->max_width_px; } else { available_horiz_px = line->width_px; } PBL_ASSERT(line->width_px <= text_box_params->box.size.w, "Line <%p>: max extent=<%u> exceeds text_box_params width=<%u>", line, line->wi...
prv_get_line_height(text_box_params)
)) > (text_box_params->box.origin.y + text_box_params->box.size.h)); // Check if this is the last line if (!is_last_line) { return; } line->suffix_codepoint = ELLIPSIS_CODEPOINT; // update the line dimensions walk_line(ctx, line, text_box_params, update_dimensions_char_visitor_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...
fake_gatt_put_discovery_complete_event(GATT_SERVICE_DISCOVERY_STATUS_SUCCESS, TEST_GATT_CONNECTION_ID)
; prv_assert_event(device, BTErrnoOK); } // Tests /////////////////////////////////////////////////////////// void test_gatt_client_discovery__initialize(void) { fake_gatt_init(); fake_event_init(); gap_le_connection_init(); } void test_gatt_client_discovery__cleanup(void) { gap_le_connection_deinit(); ...
sk_callbacks_invoke_pending(); cl_assert_equal_b(hrm_is_enabled(HRM), true); // 4. Disabling with a Subscriber should disable the HRM hrm_manager_enable(false); fake_system_task_callbacks_invoke_pending(); cl_assert_equal_b(hrm_is_enabled(HRM), false); sys_hrm_manager_unsubscribe(session_ref); } // Adva...
sys_hrm_manager_app_subscribe(1, 1, 60, HRMFeature_BPM)
; fake_system_task_callbacks_invoke_pending(); // Test run level changes hrm_manager_enable(false); cl_assert(!prv_can_turn_sensor_on()); fake_system_task_callbacks_invoke_pending(); cl_assert(!hrm_is_enabled(HRM)); hrm_manager_enable(true); cl_assert(prv_can_turn_sensor_on()); fake_system_task_call...
es); if (!buffer) { APP_LOG(APP_LOG_LEVEL_ERROR, "Not enough mem to recv postMessage() of %"PRIu32" bytes", (uint32_t) chunk->total_size_bytes); // https://pebbletechnology.atlassian.net/browse/PBL-42466 // TODO: AppMessage NACK the message so the other side can retry later. Not doin...
list_append((ListNode *)s_state.out.control_msg_queue, (ListNode *)node)
; } else { s_state.out.control_msg_queue = node; } prv_outbox_try_send_next(); } //////////////////////////////////////////////////////////////////////////////// // Generic outbox handlers //////////////////////////////////////////////////////////////////////////////// static bool prv_is_outbox_busy(void) ...
L; regular_timer_add_seconds_callback(&s_regular); } // ------------------------------------------------------------------------------------------- time_t cron_job_schedule(CronJob *job) { PBL_ASSERTN(s_list_mutex); mutex_lock(s_list_mutex); const time_t now = rtc_get_time(); // Always update the executio...
for (int i = 0; i < CRON_INDEX_COUNT; i++) { if (*(dest_arr[i]) > curr_arr[i]) { // In future return 1; } else if (*(dest_arr[i]) < curr_arr[i]) { // In past return -1; } }
return 0; } // Increase the day in `cron_tm` to fit into the wday set in `cron`. // This doesn't take mday into account because that's way too hard and we won't need it. static bool prv_adjust_for_wday_spec(const CronJob *cron, struct tm *cron_tm) { // If we're allowing any wday, we're not adjusting. if (cron->...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (!BOARD_CONFIG_BUTTON.button_com.gpio) { // This board doesn't use a button common pin. return; }
// Configure BUTTON_COM to drive low. When the button // is pressed this pin will be connected to the pin for the // button. gpio_use(BOARD_CONFIG_BUTTON.button_com.gpio); GPIO_InitTypeDef GPIO_InitStructure; GPIO_StructInit(&GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = BOARD_CONFIG_BUTTON.butto...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return NULL; }
#if defined(MALLOC_INSTRUMENTATION) void *result = task_malloc_with_pc(size, client_pc); #else void *result = task_malloc(size); #endif if (!result && mcu_state_is_thread_privileged()) { // We want to trip an assert if our malloc failed and we're not running a 3rd party app. PBL_CROAK_OOM(size, client_...
_data, sizeof(*out_cb_data)); } mutex_lock(s_mutex); EventedTimer *timer = prv_find_timer(timer_id); // It's possible that the client made a call to delete the timer just // after the timer executed (from the timer task) and posted the PEBBLE_CALLBACK_EVENT // to the client's event queue. In this case, ...
(timeout_ms, false, callback, data)
seTimeMin); cl_assert_equal_i(secs_to_wait, 100); cl_assert_equal_i(fake_gap_le_connect_params_get_last_requested(), ResponseTimeMin); // another consumer at lower rate should not have any effect fake_gap_le_connect_params_reset_last_requested(); conn_mgr_set_ble_conn_response_time( &s_hdl, BtConsumerU...
(&s_hdl, BtConsumerLeServiceDiscovery, ResponseTimeMin, 1, prv_granted_handler)
; cl_assert_equal_i(s_granted_count, 0); // Simulate that the requested state takes effect: fake_gap_le_connect_params_set_actual_state(ResponseTimeMin); conn_mgr_handle_desired_state_granted(&s_hdl, ResponseTimeMin); cl_assert_equal_i(s_granted_count, 1); conn_mgr_set_ble_conn_response_time_ext(&s_hdl, B...
nsed 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 writing, software * distributed under t...
comm_session_send_buffer_write(sb, data, length)
; comm_session_send_buffer_end_write(sb); return true; } CommSession * comm_session_open(Transport *transport, const TransportImplementation *implementation, TransportDestination destination) { ++s_session_open_call_count; CommSession *session = kernel_malloc(sizeof(CommSession...
nect.h" #include "drivers/backlight.h" #include "process_management/app_install_manager.h" #include "process_management/app_manager.h" #include "kernel/event_loop.h" #include "kernel/pbl_malloc.h" #include "resource/resource_ids.auto.h" #include "system/logging.h" #include "system/passert.h" #include "applib/app.h" ...
{ RecoveryFUAppData *data = app_state_get_user_data(); getting_started_button_combo_button_released(&data->button_combo_state, click_recognizer_get_button_id(recognizer)); }
static void prv_click_configure(void* context) { window_raw_click_subscribe(BUTTON_ID_UP, prv_raw_down_handler, prv_raw_up_handler, NULL); window_raw_click_subscribe(BUTTON_ID_SELECT, prv_raw_down_handler, prv_raw_up_handler, NULL); window_raw_click_subscribe(BUTTON_ID_DOWN, prv_raw_down_handler, prv_raw_up_han...
r_get_cell_height, .draw_row = prv_custom_day_picker_draw_row, .select_click = prv_custom_day_picker_handle_selection, .selection_changed = prv_custom_day_picker_selection_changed }); menu_layer_set_highlight_colors(&data->custom_day_picker_menu_layer, ALARMS_APP_HIGHLI...
{ time_selection_window_set_to_current_time(&data->time_picker_window); }
else { int hour, minute; alarm_get_hours_minutes(data->alarm_id, &hour, &minute); data->time_picker_window.time_data.hour = hour; data->time_picker_window.time_data.minute = minute; } } /////////////////////////////////////////////////////////////////////////////////////////////////// //! Type Picke...
/* * 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, read_space)
; } static bool s_is_current_task_send_next_task = false; bool comm_session_is_current_task_send_next_task(CommSession *session) { return s_is_current_task_send_next_task; } // Tests /////////////////////////////////////////////////////////// static const uint16_t ENDPOINT_ID = 1234; static const uint32_t TIMEOUT_...
model_name = TINTIN_MODEL("pebble_blue"); break; case WATCH_INFO_COLOR_GREEN: model_name = TINTIN_MODEL("pebble_green"); break; case WATCH_INFO_COLOR_PINK: model_name = TINTIN_MODEL("pebble_pink"); break; case WATCH_INFO_COLOR_TIME_WHITE: model_name...
{ suffix_str = ""; }
JS_VAR version_suffix = jerry_create_string((const jerry_char_t *)suffix_str); JS_VAR version_object = jerry_create_object(); jerry_set_object_field(version_object, ROCKY_WATCHINFO_FW_MAJOR, version_major); jerry_set_object_field(version_object, ROCKY_WATCHINFO_FW_MINOR, version_minor); jerry_set_object_fie...
nfiguration separate from // bookkeeping data. typedef enum AlarmDataType { ALARM_DATA_CONFIG = 0, ALARM_DATA_PINS = 1, } AlarmDataType; // Stored alarm data is keyed off a binary (AlarmId, AlarmDataType) tuple // so that programmatic construction of a key is straightforward. typedef struct PACKED AlarmStorageKey ...
(ActivityMetricSleepStateSeconds, 1, &sleep_seconds)
.tm_zone = "UTC", .tm_gmtoff = 0, }; time_util_update_timezone(&tz_info); s_health_service = (HealthServiceState){}; time_t utc_sec = 1451293942; // some constant time for this test // Mon, 28 Dec 2015 09:12:22 GMT // => 22+12*60+9*60*60 = 33142 seconds into this day // => 24*60*60-33142 = 5...
rtc_get_time()
Int16Getter) prv_int16_getter }, }, }; prop_h = property_animation_create(&implementation, &value, &start_value, &end_value); Animation *h = property_animation_get_animation(prop_h); void *context = &value; animation_set_handlers(h, handlers, context); animation_set_duration(h, duration); animation_...
DPRINTF("%"PRIu64": value at: (%d, %d)\n", time_ms - start_ms, value.x, value.y)
/* * 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_scheduled_jobs)
; // Re-calculate the execute time. // See the notes in the API header on how this works. if (must_recalc || change_diff >= job->clock_change_tolerance) { job->cached_execute_time = cron_job_get_execute_time(job); } PBL_LOG(LOG_LEVEL_INFO, "Cron job rescheduled for %ld", job->cached_execute_ti...
r_a, layer_b, layer_c; layer_init(&layer_a, &GRectZero); layer_init(&layer_b, &GRectZero); layer_init(&layer_c, &GRectZero); layer_add_child(root, &layer_a); layer_add_child(root, &layer_b); layer_add_child(&layer_a, &layer_c); recognizer_add_to_list(recognizers[0], window_get_recognizer_list(&window)); ...
(recognizers[1], &layer_a.recognizer_list)
; recognizer_add_to_list(recognizers[2], &layer_b.recognizer_list); recognizer_add_to_list(recognizers[3], &layer_c.recognizer_list); recognizer_add_to_list(recognizers[4], s_app_list); s_active_layer = &layer_c; TouchEvent e = { .type = TouchEvent_PositionUpdate }; // No active recognizers because manage...
b/graphics/graphics.h" #include "applib/graphics/framebuffer.h" #include "applib/ui/window_private.h" #include "applib/ui/layer.h" #include "clar.h" #include "util.h" #include <stdio.h> // Helper Functions //////////////////////////////////// #include "test_graphics.h" #include "${BIT_DEPTH_NAME}/test_framebuffer....
layer_set_update_proc(&layer, &across_nx_layer_update_callback)
; layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_across_nx_offset_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_y_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_...
= 49, .size = 217548 }, // priority rank 37 { .id = 50, .priority = 1, .size = 207357 }, // priority rank 1 }; extern uint32_t app_cache_get_size(void); void prv_load_lotta_apps(void) { for (int i = 0; i < 50; i++) { // time is the basis of the priority. Set the time so we know what priority. rtc_set_tim...
prv_file_for_id_exists(17)
); } void test_app_cache__free_up_space_save_defaults(void) { uint32_t to_free; uint32_t before_size; uint32_t after_size; // lets save ids 17, 25, 42, and 47 because they are my favorite numbers uint32_t after_free = t_data[16].size + t_data[24].size + t_data[41].size + t_data[46].size; s_test_id_ql_up ...
t8_t *message, int num_bytes) { PBL_ASSERTN(message != NULL); switch (message[0]) { case DataLoggingEndpointCmdClose: { DataLoggingCloseSessionMessage *msg = (DataLoggingCloseSessionMessage *)message; PBL_LOG_D(LOG_DOMAIN_DATA_LOGGING, LOG_LEVEL_DEBUG, "Closing session %d", msg->session_id); ...
(sb, (const uint8_t *) &header, sizeof(header))
; comm_session_send_buffer_write(sb, data, num_bytes); comm_session_send_buffer_end_write(sb); dls_endpoint_print_message((uint8_t *) &header, num_bytes); DLS_HEXDUMP(data, MIN(num_bytes, 64)); logging_session->comm.num_bytes_pending = num_bytes; update_session_state(logging_session, DataLoggingSessionCo...
each_modal_stack(prv_update_modal_stack_callback, context); } ModalProperty modal_manager_get_properties(void) { return modal_manager_get_enabled() ? s_current_modal_properties : ModalPropertyDefault; } void modal_manager_render(GContext *ctx) { PBL_ASSERTN(ctx); prv_each_modal_stack(prv_render_modal_stack_cal...
launcher_task_add_callback(prv_modal_window_stack_info_cb, &info)
; xSemaphoreTake(info.interlock, portMAX_DELAY); vSemaphoreDelete(info.interlock); prompt_send_response("Modal Stack, top to bottom:"); char buffer[128]; for (ModalPriority priority = NumModalPriorities - 1; priority > ModalPriorityInvalid; --priority) { prompt_send_response_fmt(buffer, si...
session->node.next; comm_session_send_next(session); session = next; } fake_system_task_callbacks_invoke_pending(); } uint32_t fake_comm_session_get_responsiveness_max_period(void) { return s_responsiveness_max_period_s; } uint32_t fake_comm_session_is_latency_reduced(void) { return s_responsiveness_l...
{ cl_assert_equal_p(fake_transport->session, NULL); fake_transport->session = comm_session_open(transport, &s_fake_transport_implementation, fake_transport->destination); return fake_transport->session; }
else { cl_assert(fake_transport->session); comm_session_close(fake_transport->session, 0); fake_transport->session = NULL; return NULL; } } void fake_transport_set_sent_cb(Transport *transport, FakeTransportSentCallback sent_cb) { cl_assert(transport); FakeTransport *fake_transport = (FakeTransp...
/* * 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(attr2)
; cl_assert_equal_i(attr2->id, VEAttributeIdAppUuid); cl_assert_equal_i(attr2->length, 16); offset = sizeof(GenericAttributeList) + sizeof(GenericAttribute) + attr1->length + sizeof(GenericAttribute); cl_assert_equal_p(attr2->data, &data1[offset]); attr1 = generic_attribute_find_attribute(attr_list2, V...
R_HOUR), rtc_get_time()); cl_assert_equal_i(steps, 2500); // If we ask for the sum from latter half of yesterday till half of today, we should get 1500 time_t elapsed_today = rtc_get_time() - time_start_of_today(); steps = health_service_sum( HealthMetricStepCount, time_start_of_today() - (12 * SECONDS_PER...
(value, health_service_sum_today(HealthMetricWalkedDistanceMeters))
; activity_stop_tracking(); fake_system_task_callbacks_invoke_pending(); } // Print summary of results printf("\ntest height steps seconds cadence exp_dist exp_dist_2min act_dist_2min %%err"); printf("\n------------------------------------------------------------------------------------"); ...
OLS - 1; } else if (*prev_x < new_x) { src_x = new_x; dst_x1 = 0; dst_x2 = src_x - 1; } *prev_x = new_x; if (dst_x1 > dst_x2) { return; } GBitmap *fb = graphics_capture_frame_buffer(ctx); if (!fb) { return; } prv_replicate_column_row_raw(fb, src_x, dst_x1, dst_x2); graphics_...
if (patch_garbage) { const uint8_t fill_byte = delta_neg ? left_pixel[num_pix_data_row - 1] : left_pixel[0]; memset(left_pixel, fill_byte, num_pix_data_row); }
break; } uint8_t *const from = delta_neg ? right_pixel : left_pixel; uint8_t *const to = delta_neg ? left_pixel : right_pixel; uint8_t *const garbage_start = delta_neg ? left_pixel + pixels_to_move : left_pixel; const uint8_t fill_byte = delta_neg ? right_pixel[pixels...
gin.x - data->circle_radius < 0 || data->circle_origin.x + data->circle_radius > data->window.layer.bounds.size.w) { data->circle_velocity_x = data->circle_velocity_x * -1; data->circle_color.argb = (((data->circle_color.argb + 1) & 0x3F) | 0xC0); } data->circle_origin.y += (data...
{ time_t s; uint16_t ms; rtc_get_time_ms(&s, &ms); return (int64_t)s * 1000 + ms; }
ght 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 writing, s...
uart_read_byte(BT_RX_BOOTROM_UART)
; // The Dialog bootROM attempts to talk several serial protocols. While doing this it will // reconfigure gpios as inputs and outputs and change what data it is pushing on the lines. // For some architectures, this can result in framing errors getting detected. Therefore, if // it's a frame er...
const uint8_t* data, size_t length); // Fakes //////////////////////////////////// #include "fake_app_manager.h" #include "fake_pbl_malloc.h" #include "fake_session.h" #include "fake_system_task.h" // Stu...
(RUN_STATE_KEY, NOT_RUNNING)
; assert_ack(true); cl_assert_equal_i(APP_RUN_STATE_STOP_COMMAND, s_last_cmd); } void test_launcher_app_message__receive_push_fetch_request(void) { prv_receive(STATE_FETCH_KEY, RUNNING); assert_ack(true); cl_assert_equal_i(APP_RUN_STATE_STATUS_COMMAND, s_last_cmd); } void test_launcher_app_message__ignore_a...
:00 PM", time_buf); // June 11th 2015, 23:59:29 (T-12:00:31) rtc_set_time(event_time - (12 * SECONDS_PER_HOUR) - 31); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("Fri, 12:00 PM", time_buf); // June 11th 2015, 23:59:30 (T-12:00:30) rtc_set_t...
(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS)
Point(0, 14), 20); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 16), 21); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 18), 22); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 20), MAX_NUM_COLS - 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 22), MAX_NUM_COLS + 1); cl_check(gb...
graphics_draw_vertical_line_dotted(&ctx, GPoint(20, 0), MAX_NUM_ROWS - 1)
; graphics_draw_vertical_line_dotted(&ctx, GPoint(22, 0), MAX_NUM_ROWS + 1 ); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_vert_dotted_line_origin_even_cols_no_clip"))); // Odd cols of different lengths setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, ...
sleep.h" #include "services/common/new_timer/new_timer.h" #include "system/logging.h" #include "system/passert.h" #include <util/attributes.h> #include <util/math.h> #include <util/net.h> #include <stdbool.h> #include <stdint.h> #include <string.h> #define MAX_CONFIGURE (10) #define MAX_TERMINATE (2) #define RESTART_...
{ // Update the next-terminate-id so that the next ack sent not in response to // a Terminate-Request does not look like a retransmission. this->state->next_terminate_id = identifier + 1; }
struct LCPPacket *packet = pulse_link_send_begin(this->protocol_number); *packet = (struct LCPPacket) { .code = ControlCode_TerminateAck, .identifier = identifier, .length = hton16(LCP_HEADER_LEN), }; pulse_link_send(packet, LCP_HEADER_LEN); } static void prv_send_code_reject(PPPControlProtocol *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...
GRect(frame.origin.x, frame.origin.y, frame.size.w, frame.size.h)
ffffff", }, { 2147483646LL, 17, "53G7F547", }, { 2147483646LL, 17, "53g7f547", }, { -2147483647LL, 17, "-53G7F548", }, { -2147483647LL, 17, "-53g7f548", }, { 2147483646LL, 18, "3928G3H0", }, { 2147483646LL, 18, "3928g3h0", }, { -2147483647LL, 18, "-3928G3H1", }, { -2147483647LL, 18, "-3928g3h1", }, { ...
strtol(" -+123", NULL, 10)
, 0); cl_assert_equal_i(strtol("+-123", NULL, 10), 0); } void test_strtol__end(void) { char *end; char *s; s = ""; strtol(s, &end, 10); cl_assert_equal_p(s, end); cl_assert_equal_i('\0', *end); s = "123"; strtol(s, &end, 10); cl_assert_equal_p(s+3, end); cl_assert_equal_i('\0', *end); s = "1...
v_is_hr_elevated(), false); activity_get_metric(ActivityMetricHeartRateZone1Minutes, 1, &zone1_minutes); cl_assert_equal_i(zone1_minutes, 2); activity_get_metric(ActivityMetricHeartRateZone2Minutes, 1, &zone2_minutes); cl_assert_equal_i(zone2_minutes, 2); activity_get_metric(ActivityMetricHeartRateZone3Minute...
cl_assert_equal_m(&activity_private_state()->activity_sessions[i], &activity, sizeof(ActivitySession))
; } for (int i = ACTIVITY_MAX_ACTIVITY_SESSIONS_COUNT - 1; i >= 0; i--) { ActivitySession activity = walk_activity; activity.start_utc = i; ActivitySession next_activity = activity; next_activity.start_utc = i - 1; activity_sessions_prv_delete_activity_session(&activity); cl_assert_equal_...
rue); } void test_recognizer__cancel(void) { bool cancelled = false; s_test_impl_data.cancelled = &cancelled; RecognizerEvent rec_event = -1; NEW_RECOGNIZER(r) = test_recognizer_create(&s_test_impl_data, &rec_event); recognizer_cancel(r); cl_assert_equal_i(r->state, RecognizerState_Possible); cl_assert_...
test_recognizer_create(&s_test_impl_data, NULL)
; recognizer_set_fail_after(r, fail); new_state = RecognizerState_Completed; recognizer_handle_touch_event(r, &(TouchEvent) { .type = TouchEvent_Touchdown }); cl_assert_equal_i(last_touch_event.type, TouchEvent_Liftoff); cl_assert_equal_b(updated, false); fail->state = RecognizerState_Failed; recognizer...
oint separator_start_point = gpoint_add(cell_layer_bounds->origin, GPoint(offset_x, offset_y)); graphics_context_set_stroke_color(ctx, PBL_IF_COLOR_ELSE(GColorDarkGray, GColorWhite)); separator_start_point.y += config->separator.h; for (int i = 0; i < config->s...
{ grect_align(&arrow_rect, aml_bounds, GAlignTop, true /* clip */); content_indicator_draw_arrow(ctx, &arrow_rect, ContentIndicatorDirectionUp, fg_color, bg_color, GAlignTop); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ PBL_LOG(LOG_LEVEL_ERROR, "No connection found for pairing confirm"); return; }
hc_endpoint_pairing_send_pairing_response(&connection->device, is_confirmed); } void pairing_confirm_handle_request(const BTDeviceInternal *device) { GAPLEConnection *connection = gap_le_connection_by_device(device); if (!connection) { PBL_LOG(LOG_LEVEL_ERROR, "No connection found for pairing request"); ...
/* * 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...
(iter->fd, data, data_len)
; if (status >= 0) { return status; } int pos = pfs_seek(iter->fd, 0, FSeekCur); PBL_LOG(LOG_LEVEL_ERROR, "Could not read data to %p of length %d at pos %d: %"PRId32, data, data_len, pos, status); fatal_logic_error(iter); } static int sfs_write(SettingsRawIter *iter, const uint8_t *data, int d...
ion(); animation_set_duration(a, duration_a); Animation *b = prv_create_test_animation(); animation_set_duration(b, duration_b); animation_set_play_count(b, 0); // Create a spawn that repeats Animation *spawn = animation_spawn_create(a, b, NULL); cl_assert(spawn != NULL); animation_set_play_count(spaw...
(&s_update_handler_calls, b)
ther we have downgraded or there is no data on the flash PBL_LOG(LOG_LEVEL_INFO, "PFS not active ... formatting"); pfs_format(true /* write erase headers */); } } // we need to run this before reserving a new GC region so that we don't // think a region is free when in reality we just rebooted in...
(s_pfs_mutex)
; return (crc); } void analytics_external_collect_pfs_stats(void) { uint16_t avail_kilobytes = (uint16_t)(get_available_pfs_space() / 1024); analytics_set(ANALYTICS_DEVICE_METRIC_PFS_SPACE_FREE_KB, avail_kilobytes, AnalyticsClient_System); } /* * Debug Utilities */ // TODO: Remove once we fi...
/* * 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 __jerryRefs.ref(indirectEval(Module.Pointer_stringify($0, $1))); }
catch (e) { var error_ref = __jerryRefs.ref(e); __jerryRefs.setError(error_ref, true); return error_ref; } }, source_p, source_size); } jerry_value_t jerry_acquire_value(jerry_value_t value) { return (jerry_value_t)EM_ASM_INT({ return __jerryRefs.acquire($0); }, value); }...
---------------------------- // Callback used to free a storage buffer from unprivileged mode. static void prv_free_storage_buffer_cb(void *p) { PBL_LOG_D(LOG_DOMAIN_DATA_LOGGING, LOG_LEVEL_DEBUG, "Freeing buffer storage ptr: %p", p); task_free(p); } // ------------------------------------------------------------...
{ if (*iter == logging_session) { *iter = (*iter)->next; mutex_unlock_recursive(s_list_mutex); if (logging_session->data) { mutex_destroy(logging_session->data->mutex); kernel_free(logging_session->data); } kernel_free(logging_session); return; } iter = &(...
22222)}, {"floralwhite", GColorARGB8FromHEX(0xfffaf0)}, {"forestgreen", GColorARGB8FromHEX(0x228b22)}, {"gainsboro", GColorARGB8FromHEX(0xdcdcdc)}, {"ghostwhite", GColorARGB8FromHEX(0xf8f8ff)}, {"gold", GColorARGB8FromHEX(0xffd700)}, {"goldenrod", GColorARGB8FromHEX(0xdaa520)}, {"greenyellow", GColorARGB8...
GColorARGB8FromHEX(0xee82ee)
}, {"wheat", GColorARGB8FromHEX(0xf5deb3)}, {"whitesmoke", GColorARGB8FromHEX(0xf5f5f5)}, {"yellowgreen", GColorARGB8FromHEX(0x9acd32)}, // CSS compatibility {"darkgrey", GColorDarkGrayARGB8}, {"lightgrey", GColorLightGrayARGB8}, // special cases {"transparent", GColorClearARGB8}, {"clear", GColorCl...
0); REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_CS_HIGH_MIN, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_WRAP_SIZE, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_WRAP_LEN, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_WRAP_MD, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_INST_MD, 0x0); REG_SET...
REG_SETF(CACHE, CACHE_CTRL3_REG, CACHE_CONTROLLER_RESET, 0x0)
; REG_SETF(CACHE, CACHE_CTRL3_REG, CACHE_RAM_SIZE_RESET_VALUE, 0x2); REG_SETF(CACHE, CACHE_CTRL3_REG, CACHE_LINE_SIZE_RESET_VALUE, 0x0); REG_SETF(CACHE, CACHE_CTRL3_REG, CACHE_ASSOCIATIVITY_RESET_VALUE, 0x2); REG_SETF(CACHE, CACHE_MRM_HITS_REG, MRM_HITS, 0x0); REG_SETF(CACHE, CACHE_MRM_MISSES_REG, MRM_MISSE...
8); } void test_rocky_api_graphics__canvas_offers_size(void) { rocky_global_init(s_graphics_api); Layer l = {.bounds = GRect(1, 2, 3, 4)}; const jerry_value_t ctx = prv_create_canvas_context_2d_for_layer(&l); jerry_set_object_field(jerry_get_global_object(), "ctx", ctx); EXECUTE_SCRIPT( "var w = ctx.ca...
cl_assert_equal_i(30*8, lc->fill_radial_precise.radius_outer.raw_value); }
"run"; break; case KAlgActivityTypeCount: WTF; break; } int start_idx = (session->start_utc - test_start_utc) / SECONDS_PER_MINUTE; printf("\nfound %s len: %d, start: %d, ", desc, (int) session->len_minutes, start_idx); // Only compare the fi...
prv_test_minute_data(samples, num_samples, exp_minutes, ARRAY_LENGTH(exp_minutes))
/* * 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 = ctx, .rect = *rect, }
; } static MockCallRecordings s_graphics_draw_rect_precise; void graphics_draw_rect_precise(GContext *ctx, const GRectPrecise *rect) { record_mock_call(s_graphics_draw_rect_precise) { .ctx = ctx, .prect = *rect, }; } static MockCallRecordings s_graphics_fill_radial_precise_internal; void graphics_fill_radial_...
e first part (before the .moveTo()) as the second only has two points cl_assert_equal_i(2, s_gpath_draw_filled.call_count); cl_assert_equal_i(3, lc->path.num_points); cl_assert_equal_point(GPoint(6, 7), lc->path.points[0]); cl_assert_equal_point(GPoint(8, 9), lc->path.points[1]); cl_assert_equal_point(GPoint(...
cl_assert_equal_point_precise((GPointPrecise(20, 28)), s_rocky_path_steps[1].pt.xy)
; cl_assert_equal_point_precise((GPointPrecise(60, 76)), s_rocky_path_steps[3].pt.xy); cl_assert_equal_point_precise((GPointPrecise(20, 28)), s_rocky_path_steps[5].pt.xy); // actual correctness of these values is test in test_rocky_api_graphics_rendering.c cl_assert_equal_vector_precise((GVectorPrecise(0, 8)),...
COMPOSITE_TEST_OFFSET_Y)); prv_composite_test_draw_bitmap(&s_ctx, bitmap, offset_point, compositing_mode); // Check the result char unit_test_result_image_file_base_name[PATH_STRING_LENGTH] = {0}; snprintf(unit_test_result_image_file_base_name, PATH_STRING_LENGTH, ...
gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)
); } void test_graphics_draw_bitmap__composite_assign(void) { prv_composite_test(__func__, GCompOpAssign); } void test_graphics_draw_bitmap__composite_assign_inverted(void) { prv_composite_test(__func__, GCompOpAssignInverted); } void test_graphics_draw_bitmap__composite_or(void) { prv_composite_test(__func__,...
eRecursiveMutex *s_analytics_lock = NULL; // Locking Functions static void prv_lock(void) { mutex_lock_recursive(s_analytics_lock); } static void prv_unlock(void) { mutex_unlock_recursive(s_analytics_lock); } // Analytic Node Functions static bool prv_compare_analytic(ListNode *found_node, void *data) { Anal...
{ analytics_add(metric, prv_stopwatch_elapsed_ms(stopwatch, rtc_get())); list_remove(&stopwatch->node, &s_stopwatch_list, NULL); }
prv_unlock(); } void analytics_stopwatches_update(uint32_t current_ticks) { prv_lock(); ListNode *cur = s_stopwatch_list; while (cur != NULL) { AnalyticsStopwatchNode *node = (AnalyticsStopwatchNode *)cur; analytics_add(node->metric, prv_stopwatch_elapsed_ms(node, current_ticks)); node->starting_...
leRate_1600_HZ; } return sample_rate; } static void prv_configure_operating_mode(void) { BMI160SampleRate interval_us = prv_get_min_sampling_interval_us(); uint8_t acc_odr = (uint8_t)prv_get_odr(interval_us); // should be able to write the sample range at any time prv_read_modify_write(BMI160_REG_ACC_CONF...
("FWM = 0x%"PRIx8, bmi160_read_reg(BMI160_REG_FIFO_CONFIG_0))
; uint8_t curr_frame_cfg = bmi160_read_reg(BMI160_REG_FIFO_CONFIG_1); uint8_t desired_cfg = BMI160_FIFO_CONFIG_1_ACC_EN; if (curr_frame_cfg != desired_cfg) { prv_run_command(BMI160_CMD_FIFO_FLUSH); // clear any lingering entries prv_write_reg(BMI160_REG_FIFO_CONFIG_1, desired_cfg); } } ...
uld be scheduled compositor_app_render_ready(); cl_assert_equal_i(s_count_animation_schedule, 2); // Push a modal window mid transition, the resulting animation should be scheduled immediately. s_modal_window_present = true; compositor_transition(&s_transition_b); cl_assert_equal_i(s_count_animation_create...
(s_count_animation_destroy, 1)
; // Throughout pushing this modal the app never reported it was ready, so we still shouldn't have // rendered from the app frame buffer. cl_assert_equal_i(s_app_window_render_count, 0); // Now the app has rendered something and we should actually update the display. compositor_app_render_ready(); cl_asse...
again later, turn on a timer to re-enable the HRM in enough time // to get a good reading for the next subscriber that needs one if (remaining_ms < INT32_MAX) { new_timer_start(s_manager_state.update_enable_timer_id, remaining_ms, prv_update_enable_timer_cb, NULL /*context*/...
kernel_zalloc_check(sizeof(HRMDiagnosticsData))
; debug->ppg_data = data->ppg_data; debug->accel_data = data->accel_data; *event = (PebbleHRMEvent) { .event_type = HRMEvent_Diagnostics, .debug = debug, }; break; } default: WTF; } } static bool prv_event_put(HRMSubscriberState *state, PebbleHRMEvent *even...
/* * 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...
{ crc = crc32(crc, "arbitrary pointer", 0); assert_equal_hex(crc, 0); }
void test_crc32__one_byte(void) { crc = crc32(crc, "abcdefg", 1); assert_equal_hex(crc, 0xe8b7be43); } void test_crc32__standard_check(void) { // "Check" value from "A Painless Guide to CRC Error Detection Algorithms" crc = crc32(crc, "123456789", 9); assert_equal_hex(crc, 0xCBF43926); } void test_crc32__...
0, -1000}, { 48, 8, -1000}, { 48, 8, -1000}, { 48, 8, -1000}, { 40, 8, -1000}, { 48, 8, -1008}, { 48, 8, -1000}, { 48, 0, -1000}, { 48, 8, -1000}, { 48, 8, -1000}, { 48, 8, -1000}, { 48, 0, -1000}, { 48, 0, -1000}, { 48, 0, -1000}, { 48, 8, -1000}, { 40, 0, -...
{ 48, 8, -1000}, { 48, 8, -1000}, { 48, 0, -1008}, { 48, 8, -1000}, { 48, 0, -1000}, { 48, 8, -992}, { 48, 0, -1000}, { 48, 0, -1000}, { 40, 8, -992}, { 48, 8, -1000}, { 48, 8, -1008}, { 48, 8, -1008}, { 48, 0, -1000}, { 48, 0, -1000}, { 48, 0, -1000}, { 4...
{ 48, 8, -1000}, { 48, 8, -1008}, { 48, 8, -1000}, { 48, 0, -1000}, { 48, 8, -1000}, { 48, 0, -1000}, { 40, 0, -1000}, { 48, 8, -1000}, { 48, 0, -1000}, { 48, 0, -1008}, { 48, 8, -1000}, { 48, 8, -1000}, { 48, 0, -1008}, { 48, 8, -1000}, { 48, 0, -1000}, ...
fset(&l.scroll_layer).y); menu_layer_set_selected_index(&l, MenuIndex(0, 1), MenuRowAlignTop, false); cl_assert_equal_i(1, menu_layer_get_selected_index(&l).row); cl_assert_equal_i(basic_cell_height, l.selection.y); const int y_center_of_row_1 = basic_cell_height + basic_cell_height / 2; const int row1_vert...
MenuIndex(0, 1)
, MenuRowAlignNone, false); cl_assert_equal_i(2 * FOCUSED - NORMAL, l.selection.y); cl_assert_equal_i(NORMAL, l.selection.h); cl_assert_equal_b(false, s_content_available[ContentIndicatorDirectionUp]); cl_assert_equal_b(true, s_content_available[ContentIndicatorDirectionDown]); } void test_menu_layer__center_f...
_notif_queue_pop(void) { NotificationQueueNode *temp = s_ancs_client->queue; if (temp) { list_remove((ListNode *)s_ancs_client->queue, (ListNode **)&s_ancs_client->queue, NULL); kernel_free(temp); } } static void prv_notif_queue_next(void) { if (s_ancs_client->alive_chec...
if (s_ancs_client) { s_ancs_client->alive_check_pending = false; prv_set_state(ANCSClientStateAliveCheck); //! Sends an ANCS attribute fetch (to the Control Point). The notification UID is invalid, ANCS //! will reply with 0xA2 (invalid param) const GetNotificationAttributesMsg dummy_cmd = { ....
} static void prv_is_ancs_alive_launcher_task_cb(void *data) { if (!s_ancs_client) { return; } if (s_ancs_client->state == ANCSClientStateIdle) { prv_check_ancs_alive(); } else { s_ancs_client->alive_check_pending = true; } } static void prv_is_ancs_alive_cb(void *data) { launcher_task_add_ca...
heap, const char* s, uintptr_t lr) { char *dup = heap_zalloc(heap, strlen(s) + 1, lr); if (dup) { strcpy(dup, s); } return dup; } // task_* functions that map to other heaps depending on the current task /////////////////////////////////////////////////////////// #if defined(MALLOC_INSTRUMENTATION) void *t...
app_state_get_heap()
, count, size, saved_lr)); } void *app_calloc_check(size_t count, size_t size) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; Heap *heap = app_state_get_heap(); void *mem = heap_calloc(heap, count, size, saved_lr); const size_t bytes = count * size; if (!mem && bytes != 0) { PBL_CROAK_...
2_t [ACTIVITY_HISTORY_DAYS]){100, 0, 0, 0, 0, 0, 0})); ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricDistanceMeters, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){exp_distance, 0, 0, 0, 0, 0, 0})); ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricActiveKCalories, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){exp_active_kc...
(height_mm)
; activity_prefs_set_weight_dag(weight_dag); activity_prefs_set_gender(gender); activity_prefs_set_age_years(age_years); // Re-init prv_activity_init_and_set_enabled(true); // Check settings uint32_t value; value = activity_prefs_get_height_mm(); cl_assert_equal_i(height_mm, value); value = activi...
3 = { .name = "Application 3", .uuid = {0x7c, 0x65, 0x2e, 0xb9, 0x26, 0xd6, 0x44, 0x2c, 0x98, 0x68, 0xa4, 0x36, 0x79, 0x7d, 0xe2, 0x05}, .app_version = { .major = 1, .minor = 1, }, .sdk_version = { .major = 1, .minor = 1, }, .info_flags = 0, .icon_resource_id = 0, }; // Setu...
(S_SUCCESS, app_db_get_app_entry_for_uuid(&app1.uuid, &temp))