prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
delta_steps; // Calculate the distance delta const time_t delta_ms = (now_ts - wrkt_data->last_movement_event_time_ts) * MS_PER_SECOND; const int32_t delta_distance_mm = activity_private_compute_distance_mm(delta_steps, delta_ms); wrkt_data->distance_m += (delta_distance_mm / MM_PER_METER); // Cal...
if (!workout_service_is_workout_ongoing()) { return; }
if (event->type == PebbleActivityEvent_TrackingStopped) { workout_service_pause_workout(true); } } // --------------------------------------------------------------------------------------- void workout_service_workout_event_handler(PebbleWorkoutEvent *event) { if (!workout_service_is_workout_ongoing()) { ...
data->circle_origin.x += (data->circle_velocity_x * PIXEL_SPEED_PER_FRAME); if (data->circle_origin.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_colo...
(ctx, data->bucket)
; } } } static int64_t prv_time_64(void) { time_t s; uint16_t ms; rtc_get_time_ms(&s, &ms); return (int64_t)s * 1000 + ms; } static void layer_update_proc(Layer *layer, GContext* ctx) { AppData *data = app_state_get_user_data(); graphics_context_set_fill_color(ctx, GColorBlack); if (stroke_width_...
/* * 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...
(dialog, app_state_get_window_stack())
; } // Loads the core dialog. Should be called from each dialog window's load callback. void dialog_load(Dialog *dialog) { if (dialog->vibe_on_show) { vibes_short_pulse(); } if (dialog->timeout != DIALOG_TIMEOUT_INFINITE) { dialog->timer = app_timer_register(dialog->timeout, prv_app_timer_callback, dial...
nt_service_client_unsubscribe(&settings_glance->battery_state_event_info); event_service_client_unsubscribe(&settings_glance->pebble_app_event_info); event_service_client_unsubscribe(&settings_glance->airplane_mode_event_info); event_service_client_unsubscribe(&settings_glance->quiet_time_event_info); #if C...
{ const bool prev_is_sharing = settings_glance->glance_state.is_sharing_hrm; const bool is_sharing = (event->bluetooth.le.hrm_sharing_state.subscription_count > 0); if (prev_is_sharing == is_sharing) { return; } settings_glance->glance_state.is_sharing_hrm = is_sharing; break...
#endif default: WTF; } // Refresh the content in the glance prv_refresh_glance_content(settings_glance); // Broadcast to the service that we changed the glance launcher_app_glance_structured_notify_service_glance_changed(structured_glance); } static void prv_subscribe_to_event(EventServiceInfo *...
on 7777, // Typical fall asleep time 8888, // Typical wakeup time }; static uint32_t s_hr_zone_data[] = { 1, // Version NOW, // Timestamp 3, // Number of zones 60, // Minutes in zone 1 30, // Minutes in zone 2 15, // Minutes i...
((uint8_t *)key, strlen(key), (uint8_t *)s_hr_zone_data, sizeof(s_hr_zone_data))
, S_SUCCESS); cl_assert_equal_i(s_metric_updated_count, NUM_CURRENT_HR_ZONE_METRICS); // check typicals (not stored) int32_t val_out; cl_assert(!health_db_get_typical_value(ActivityMetricHeartRateZone1Minutes, Monday, &val_out)); cl_assert(!health_db_get_typical_value(ActivityMetricHear...
&first_all_day_event, &state.pin.header.id)); cl_assert(state.node->all_day); // correct end of line behaviour cl_assert(!iter_prev(&iterator)); } void test_timeline__all_day_future_with_others(void) { prv_insert_all_day_items(); Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *hea...
(iter_next(&iterator))
/* * 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...
malloc(sizeof(FrameBuffer))
; framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); } // Teardown void test_graphics_draw_stroke_precise_${BIT_DEPTH_NAME}__cleanup(void) { free(fb); } // Tests //////////////////////////////////// #define ORIGIN_RECT_NO_CLIP GRect(0, 0, 144, 168) #define ORIGIN_RECT_CLIP_XY GRect(0, 0, 30, 40...
.duration = 30, .type = TimelineItemTypePin, .flags = 0, .layout = LayoutIdTest, }, .attr_list = { .num_attributes = 0, .attributes = NULL, }, .action_group = { .num_actions = 0, .actions = NULL, }, .allocated_buffer = NULL, }, { ....
(uuid_equal(&s_items[s_correct_order[3]].header.id, &timeline_model_get_iter_state(1)->pin.header.id))
; cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(2)); cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(3)); cl_assert(timeline_model_iter_next(&new_idx, &has_next)); cl_assert(has_next); cl_assert_equal_i(new_idx, 4);...
/* * 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...
__profiler_stop()
/* * 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...
(38, 108, 70, 30)
; char text_buffer[11]; snprintf(text_buffer, sizeof(text_buffer), "0x%"PRIx32, launcher_panic_get_current_error()); graphics_draw_text(ctx, text_buffer, error_code_face, text_dest_rect, GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL); } static void prv_panic_reset_callback(void* data) { RebootR...
_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax1_aa_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")); // Should not draw anything setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) + 1); cl_check(g...
(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1)
; graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 3); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r3_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")); #endif setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_C...
RTC_WaitForSynchro()
; return true; } // Before entering standby we set the RTC to it's default time (Jan 1, 2000) // here we calculate the seconds elapsed since then static int32_t prv_seconds_since_standby(void) { // This function assumes the RTC is running in slow mode RTC_TimeTypeDef rtc_time; RTC_GetTime(RTC_Format_BIN, &rtc...
("TmplStringSing", " d")
, /// Plural suffix for days with abbreviated units i18n_ctx_noop("TmplStringPlur", " d")}, /// Singular suffix for days with full units { i18n_ctx_noop("TmplStringSing", " day"), /// Plural suffix for days with full units i18n_ctx_noop("TmplStringPlur", " days")}, }; #if SUPPORT_MONTH static const cha...
/* * 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 (layout->impl->color_getter) { return layout->impl->color_getter(layout); }
#endif return &s_default_colors; } const LayoutColors *layout_get_notification_colors(const LayoutLayer *layout) { return PBL_IF_COLOR_ELSE(layout_get_colors(layout), &s_default_notification_colors); } void layout_set_mode(LayoutLayer *layout, LayoutLayerMode final_mode) { layout->impl->mode_setter(layout, fin...
icon(data, animated); } } static void prv_set_action_bar_state(MusicAppData *data, enum ActionBarState state) { data->action_bar_state = state; prv_update_ui_state(data, true); } static void prv_action_bar_revert(void *context) { MusicAppData *data = context; data->action_bar_revert_timer = NULL; prv_set_...
(BUTTON_ID_UP, 0, prv_volume_long_click_start_handler, prv_volume_long_click_end_handler)
; window_long_click_subscribe(BUTTON_ID_DOWN, 0, prv_volume_long_click_start_handler, prv_volume_long_click_end_handler); window_long_click_subscribe(BUTTON_ID_SELECT, 0, prv_play_pause_long_click_start_handler, prv_play_pause_long_click_end_handler); } s...
ar_layer_get_layer(status_layer)); status_bar_layer_deinit(status_layer); } // Dialog callbacks for confirmation. //////////////////////////////////////////////////// static ConfirmationDialog *prv_settings_confirm(const char *title, const char *text, uint32_t resource...
app_expandable_dialog_push(s_dialog)
; confirmation_dialog_pop((ConfirmationDialog *)context); } static void prv_coredump_reset_decline_cb(ClickRecognizerRef recognizer, void *context) { ConfirmationDialog *confirmation_dialog = prv_settings_confirm("Core Dump", i18n_noop("Core dump and reboot?"), RESOURCE_ID_GENERIC_QUESTION_LARGE); confirma...
(list, id); if (attribute_found) { return attribute_found; } uint8_t attribute_idx = list->num_attributes; list->num_attributes++; list->attributes = kernel_realloc(list->attributes, list->num_attributes * sizeof(Attribute)); list->attributes[attribute_idx].id = id; return &list->attributes[attribute...
(attr->id)
) { case AttributeTypeString: return strlen(attr->cstring) + 1; // +1 for null char case AttributeTypeStringList: return sizeof(StringList) + attr->string_list->serialized_byte_length + 1; // +1 for null char case AttributeTypeUint32List: return Uint32ListSize(attr->uint32_list->num_values...
_assert_equal_i(activities, HealthActivityRun | HealthActivityWalk | HealthActivityOpenWorkout); } void test_health__session_compare(void) { const time_t now = rtc_get_time(); // both start at the same time cl_assert(0 == prv_session_compare( &(ActivitySession) {.start_utc = now, .length_min = 10}, &(Ac...
health_service_get_minute_history(data, ARRAY_LENGTH(data), &time_start, &time_end)
; cl_assert_equal_i(0, written); } void test_health__get_minute_history_respects_time_end(void) { s_sys_activity_get_minute_history_values.stage = 0; s_sys_activity_get_minute_history_values.out[0].asserts = false; HealthMinuteData data[5] = {}; // pass time that's not exactly on a boundary time_t time_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...
(new_simple_dialog)
; dialog_set_callbacks(new_dialog, &(DialogCallbacks) { .unload = prv_dialog_on_unload, }, NULL); update_fn(new_dialog, data); Dialog *old_dialog = s_dialog; s_dialog = new_dialog; simple_dialog_push(new_simple_dialog, stack); #if PBL_ROUND // For circular display, to fit some battery_ui messages re...
/* * 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 (boot_version_read() == s_bootloader_timestamp) { return; }
RTC_WriteBackupRegister(BOOTLOADER_VERSION_REGISTER, s_bootloader_timestamp); } uint32_t boot_version_read(void) { return RTC_ReadBackupRegister(BOOTLOADER_VERSION_REGISTER); }
le_irq(); const uint32_t button_counter_register = RTC_ReadBackupRegister(STUCK_BUTTON_REGISTER); if (button_counter_register != 0) { // Create bitmask with all 1s, except on the counter byte for this button_id in button_counter_register. AND to mask out: const uint32_t updated_button_counter_register = bu...
{ __disable_irq(); // If the UP button is held at the moment the timeout is hit, set the force-PRF bootbit: const bool force_prf = (s_debounced_button_state & (1 << BUTTON_ID_UP)); if (force_prf) { boot_bit_set(BOOT_BIT_FORCE_PRF); } RebootReason reason = { .code = ...
er_write() when a new PutBytesPut starts to roll in static void prv_pre_ack_if_space_in_put_job_queue(void) { PutBytesPendingJobs *put_jobs = &s_pb_state.pb_pending_jobs; PBL_ASSERTN(s_pb_state.receiver.buffer[0] == PutBytesPut); bool pre_ack = false; prv_lock_pb_job_state(); { if (put_jobs->enable_prea...
event_put(&event)
; // NOTE: Preserve the type field because that is checked by the install handler after we // cleanup (cleanup is called after a commit). PutBytesObjectType type = s_pb_state.type; s_pb_state = (PutBytesState) { .type = type }; } static void prv_cleanup_from_system_task(void* data) { xSemaphoreTake(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...
(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE_FMT(1bitpalette)))
; cl_assert_equal_i(gbitmap_get_format(bitmap), GBitmapFormat1BitPalette); } // Tests 2-bit palettized PNG loading into gbitmap // Result: // - gbitmap matches platform loaded PNG void test_png__color_2_bit(void) { GBitmap *bitmap = setup_png_test(TEST_PNG_FILE_FMT(2bitpalette)); cl_assert(gbitmap_pbi_eq(bitma...
zone make sure the user has an elevated heart rate. // This prevents erroneous HRM readings accumulating minutes in zone 1. // Then only go up/down 1 zone per minute. // This prevents erroneous HRM readings accumulating minutes in higher zones. if (!state->hr.metrics.is_hr_elevated && new_hr_elevated) { st...
activity_private_state()
; return state->hr.metrics.current_hr_zone; } // -------------------------------------------------------------------------------------------- void activity_metrics_prv_get_median_hr_bpm(int32_t *median_out, int32_t *heart_rate_total_weight_x100_out) { ActivityState *sta...
/* * 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...
(SCENE_SPLASH)
.hidden = false, .stroke_color = GColorRed, .stroke_width = 1, .fill_color = GColorBlue, .path_open = false, .num_points = 2, }; GPoint points1[] = { { 3, 97 }, {5, 5} }; memcpy(command_list->commands[0].points, points1, sizeof(points1)); GContext *ctx = (GContext *)123; // just a fake i...
(&image->command_list, command_list, sizeof(GDrawCommandList) + (3 * sizeof(GDrawCommand)) + (sizeof(GPoint) * 6))
; free(command_list); image->version = 1; image->size = GSize(20, 20); GDrawCommandImage *clone = gdraw_command_image_clone(image); cl_assert(clone != image); cl_assert_equal_i(gdraw_command_image_get_data_size(clone), size); cl_assert_equal_i(0, memcmp(clone, image, size)); free(clone); free(image...
ter requesting conn param change, Conn Idx: %d - (%d %d %d %d)", evt->conn_idx, (int)conn_params.interval_min, (int)conn_params.interval_max, (int)conn_params.slave_latency, (int)conn_params.sup_timeout); // accept the change ble_gap_conn_param_update_reply(evt->conn_idx, true); } static void ...
if (prv_is_auto_accept_repairing_mode(conn, conn_idx)) { PBL_LOG(LOG_LEVEL_DEBUG, "Auto-accepting pairing request"); extern void pair_reply(uint16_t conn_idx, bool is_confirmed); pair_reply(conn_idx, true); return; }
hc_endpoint_pairing_send_pairing_request(&device); } static void prv_handle_address_resolved(const ble_evt_gap_address_resolved_t *evt) { PBL_LOG(LOG_LEVEL_DEBUG, "IRK exchanged and address resolved/updated."); // Update the IRK + Address (Dialog SDK swaps the connection address for the identity address, // ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
window_get_root_layer(window)
; GRect bounds = layer_get_bounds(window_layer); s_text_layer = text_layer_create(GRect(0, 72, bounds.size.w, 20)); text_layer_set_text(s_text_layer, "Press a button"); text_layer_set_text_alignment(s_text_layer, GTextAlignmentCenter); layer_add_child(window_layer, text_layer_get_layer(s_text_layer)); } sta...
/* * 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...
(dialog, true)
; dialog_set_callbacks(dialog, &(DialogCallbacks) { .unload = prv_bt_dialog_unload }, bt_dialog); }
TEXT_COLOR, container); active_window->workout_controller->metric_to_string(metric_type, (char *) number_text_node->text, buffer_size, i18n_owner, ...
if (strlen(number_text_node->text) > 5) { // text is long so use smaller font number_text_node->font = prv_get_number_font(false); }
break; } case WorkoutMetricType_Pace: case WorkoutMetricType_AvgPace: { if (active_window->workout_controller->get_metric_value( metric_type, active_window->workout_data) >= SECONDS_PER_HOUR) { GTextNodeText *text_node = health_util_create_text_node_with_text(...
or_uuid = ble_descriptor_get_uuid(descriptor); uuid_to_string(&descriptor_uuid, uuid_buffer); APP_LOG(APP_LOG_LEVEL_INFO, "Write response for Descriptor %s (error=%u)", uuid_buffer, error); } static void descriptor_read_handler(BLEDescriptor descriptor, const uint8_t *value, ...
bt_uuid_expand_16bit(0x2A44)
; if (uuid_equal(&alert_control_point, &characteristic_uuid)) { const char value[] = "Hello World."; ble_client_write(characteristics[c], (const uint8_t *) value, strlen(value) + 1); } const Uuid hrm_uuid = bt_uuid_expand_16bit(0x2A37); if (uuid_equal(&hrm_uuid, &characteristic_...
gbitmap_create_blank(s10, GBitmapFormat2BitPalette); cl_assert(NULL != bmp); cl_assert(g_gbitmap_spalding_data_row_infos != bmp->data_row_infos); // union with .palette bmp = gbitmap_create_blank(s10, GBitmapFormat4BitPalette); cl_assert(NULL != bmp); cl_assert(g_gbitmap_spalding_data_row_infos != bmp->data...
prv_gbitmap_size_for_data(GSize(13, 10), GBitmapFormat8Bit)
); cl_assert_equal_i( 20, prv_gbitmap_size_for_data(GSize(13, 10), GBitmapFormat1BitPalette)); cl_assert_equal_i( 40, prv_gbitmap_size_for_data(GSize(13, 10), GBitmapFormat2BitPalette)); cl_assert_equal_i( 70, prv_gbitmap_size_for_data(GSize(13, 10), GBitmapFormat4BitPalette)); cl_assert_equal_i( 0, prv_gbitma...
/* * 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...
interpolate_moook_in_only(ANIMATION_NORMALIZED_MAX, -20000, 20000)
, 20000); } void test_animation_interpolate__moook_out(void) { const int expected[] = {20004, 20002, 20001, 20000}; const int num_frames = ARRAY_LENGTH(expected); for (int i = 0; i < num_frames; i++) { printf("frame: %d\n", i); cl_assert_equal_i(interpolate_moook_out((i * ANIMATION_NORMALIZED_MAX) / num_...
box, const GTextOverflowMode overflow_mode, const GTextAlignment alignment, const GTextLayoutCacheRef layout_ref) { GTextNodeText *text_node = (GTextNodeText *)s_data.text_node; cl_assert(text_node); cl_assert_equal_s(text_node->text, text); cl_assert_equal_p(tex...
cl_assert_equal_i(size.w, TEST_TEXT_SIZE.w)
; cl_assert_equal_i(size.h, TEST_TEXT_SIZE.h); cl_assert_equal_i(size.w, custom_node.node.cached_size.w); cl_assert_equal_i(size.h, custom_node.node.cached_size.h); cl_assert_equal_i(s_num_draw_custom_calls, 1); } void test_graphics_text_node__create_container_nodes_buffer(void) { GTextNodeHorizontal *h_empt...
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_vertically_centered = height / 2 - y_center_of_row_1; cl_assert_equal_i(row...
(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_focused_respects_row_height_for_selection(void) { MenuLayer l; const int height =...
----- // Defined in session_send_queue.c extern void comm_session_send_queue_cleanup(CommSession *session); // ------------------------------------------------------------------------------------------------- static void prv_put_comm_session_event(bool is_open, bool is_system) { PebbleEvent event = { .type = PE...
{ CommSessionTransportType transport_type = implementation->get_type(transport); return transport_type == expected_transport_type; }
//! bt_lock() is expected to be taken by the caller! CommSession * comm_session_open(Transport *transport, const TransportImplementation *implementation, TransportDestination destination) { const bool is_system = (destination != TransportDestinationApp); if (is_system) { CommSession *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...
cl_assert_equal_i(event.touch.type, PebbleTouchEvent_TouchesAvailable)
; TouchEvent *touch_event = touch_event_queue_get_event(0, 0); prv_test_touch_event(touch_event, 0, TouchEvent_Touchdown, &GPoint(15, 100), 3686400, 3, &GPointZero, 0, 0, true); touch_event = touch_event_queue_get_event(1, 0); cl_assert_equal_p(touch_event, NULL); // Test second touch...
/* * 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...
strncpy((char *)text_node->text, str, str_length)
; } return text_node; } static GTextNodeText *prv_create_text_node_attribute(const LayoutLayer *layout, AttributeId attr_id) { const char *attr_str = attribute_get_string(layout->attributes, attr_id, ""); if (IS_EMPTY_STRING(attr_str) && attr_id != Attribute...
ogsData { Window window; MenuLayer menu_layer; const char *lorem_ipsum; const char *long_message; uint32_t resource_id_80; uint32_t resource_id_25; } DialogsData; ///////////////////////////// // Simple Dialog with timeout static void prv_show_simple_dialog(DialogsData *data) { SimpleDialog *simple_dial...
{ ActionableDialog *actionable_dialog = actionable_dialog_create("Custom Actionable Dialog"); Dialog *dialog = actionable_dialog_get_dialog(actionable_dialog); dialog_set_text(dialog, "Custom Actionable Dialog"); dialog_set_background_color(dialog, GColorRed); dialog_set_icon(dialog, data->resource_id_80); ...
//////////////////// // Expandable Dialog // Has a custom icon/clickhandler for the select button static void prv_my_select_click_handler(ClickRecognizerRef recognizer, void *context) { ExpandableDialog *expandable_dialog = context; Dialog *dialog = expandable_dialog_get_dialog(expandable_dialog); dialog_set_b...
ertyNotify) { supported |= BLESubscriptionNotifications; } if (supported_properties & BLEAttributePropertyIndicate) { supported |= BLESubscriptionIndications; } // Mask out the unsupported type bits: *subscription_type &= supported; return (*subscription_type != BLESubscriptionNone); } // ---------...
if (next_prevailing_type != previous_prevailing_type) { // The subscription type changed for this characteristic: // Write to the Client Configuration Characteristic Descriptor on the // remote to change the subscription: const uint16_t value = subscription_type; ret_val = gatt_client_op_write_desc...
show_reset_alert = false; reason_string = "%s%sResetButtonsHeld"; break; case RebootReasonCode_ShutdownMenuItem: reason_string = "%s%sLowBattery"; break; case RebootReasonCode_FactoryResetReset: reason_string = "%s%sFactoryResetReset"; break; case RebootReasonCode_FactoryResetShutdown: ...
{ DEBUG_LOG(LOG_LEVEL_INFO, "PMIC reset reason mask: 0x%x", (int)pmic_reset_reason); }
#endif #ifdef SHOW_PEBBLE_JUST_RESET_ALERT // Trigger an alert display so that the user knows the watch rebooted due to a crash. This event // will be caught and handled by the launcher.c event loop. if (show_reset_alert) { crashed_ui_show_pebble_reset(); } #endif reboot_reason_clear(); }
/! The orientation of the accelerometer is checked every minute. If the orientation has //! changed by a significant amount, we consider the watch as in motion, and restart the //! stationary counter static void prv_watch_is_in_motion(void) { prv_handle_action(StationaryActionWakeUp); } static void prv_stationary_ch...
accel_session_create()
; accel_session_shake_subscribe(s_accel_session, prv_accel_tap_handler); event_service_client_subscribe(&s_button_event_info); #if DEBUG_STATIONARY regular_timer_add_seconds_callback(&s_accel_stationary_timer_info); #else regular_timer_add_minutes_callback(&s_accel_stationary_timer_info); #endif s_current_st...
ude "stubs_sleep.h" #include "stubs_system_reset.h" #include "stubs_task_watchdog.h" static PebbleProcessMd __pbl_app_info; const PebbleProcessMd* sys_process_manager_get_current_process_md(void) { return &__pbl_app_info; } // Tests //////////////////////////////////// #define TEST_UUID_A { 0x2F, 0xF7, 0xFA, 0x04,...
(key, true)
, sizeof(bool)); cl_assert_equal_i(persist_get_size(key), sizeof(bool)); cl_assert_equal_i(persist_read_bool(key), true); } void test_persist__data(void) { const uint32_t key = 0; const int size = sizeof(test_uuid_a); Uuid uuid_buffer; cl_assert_equal_i(persist_read_data(key, &uuid_buffer, sizeof(uuid_buff...
/* * 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...
(BUTTON_ID_DOWN, prv_down_click_handler)
; window_set_click_context(BUTTON_ID_UP, context); window_single_click_subscribe(BUTTON_ID_UP, prv_up_click_handler); } static void prv_window_load(Window *window) { AppData *app_data = window_get_user_data(window); Layer *window_layer = window_get_root_layer(app_data->window); GRect bounds = layer_get_bound...
reports_buffer); s_reports_buffer = NULL; s_is_scanning = false; if (s_dropped_reports) { PBL_LOG(LOG_LEVEL_INFO, "LE Scan -- Dropped reports: %" PRIu32, s_dropped_reports); } } } bt_unlock(); return success; } // --------------------------------------------------------------...
bt_unlock()
; } // For UNIT Tests uint32_t gap_le_scan_get_dropped_reports_count(void) { return s_dropped_reports; }
roperty_animation_create_layer_frame((Layer *)&timeline_layer->day_separator, NULL, &to); Animation *anim = property_animation_get_animation(prop_anim); animation_set_duration(anim, TIMELINE_UP_DOWN_ANIMATION_DURATION_MS); animation_set_custom_interpolation(anim, timeline_animation_interpolate_moook_soft); pee...
prv_create_layout_up_down_animation(layer->layouts[i], i, layer, duration, interpolate)
/* * 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...
(dest_bitmap_data, GColorWhite.argb, sizeof(dest_bitmap_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...
{ // If the incoming firmware is an old world firmware, we need to not only erase // enough room for the old world firmware but we also need to erase the area // between the new world and old world base addresses. If we don't erase this // area and just load in the old world firmware at FIRMWARE_OLDWORL...
return system_flash_erase(system_flash_base, erase_length, prv_display_erase_progress, 0); } // Fills in the last 50% of the progress bar static void prv_display_write_progress( uint32_t progress, uint32_t total, void *ctx) { display_firmware_update_progress(progress/2 + total/2, total); } static bool prv_w...
OCESS_INFO_CURRENT_SDK_VERSION_MAJOR && entry->sdk_version.minor <= PROCESS_INFO_CURRENT_SDK_VERSION_MINOR); } T_STATIC ListNode *s_head_callback_node_list = NULL; void app_install_register_callback(struct AppInstallCallbackNode *callback_node) { PBL_ASSERTN(callback_node->node.next == NULL); PBL_ASSERT...
app_cache_remove_entry(id)
; } } static void prv_delete_pending_id(AppInstallId *app_id) { if (*app_id != INSTALL_ID_INVALID) { // app cache will delete the app binaries even if the entry for the app_id does not exist app_cache_remove_entry(*app_id); *app_id = INSTALL_ID_INVALID; } } static void prv_process_pending_deletions(...
erty == PROPERTY_BG_COLOR) { data->bg_color_index = (data->bg_color_index + 1) & 0x3F; data->bg_color.argb = (s_color_table[data->bg_color_index] | ALPHA_100); } else if (data->property == PROPERTY_ALPHA) { data->alpha = (data->alpha + 0x40) & ALPHA_100; set_text_layers(data); } else if (data->prope...
window_get_root_layer(window)
08}, { -248, 472, 120}, { -232, 1616, 464}, { -400, 1168, 512}, { -344, 1176, 480}, { -304, 912, 464}, { -128, 712, 376}, { 40, 552, 232}, { 40, 584, 264}, { 8, 656, 432}, { -232, 680, 144}, { -120, 944, 488}, { -208, 1160, 352}, // 57 seconds { -168, 1112, 360}, ...
{ -736, 184, -120}, // 62 seconds { -544, 152, -32}, { -528, 200, 8}, { -592, 216, 56}, { -704, 256, 24}, { -784, 288, -64}, { -888, 600, -64}, { -1312, 672, -176}, { -1200, 296, -184}, { -1384, 304, -176}, { -1216, 168, -216}, { -944, 368, -360}, { -1264, 112, -1...
{ -1008, 192, -224}, { -768, 56, -112}, { -512, 216, -232}, { -456, 304, -248}, { -616, 408, -336}, { -792, 416, -360}, { -944, 264, -368}, { -464, -176, -688}, { -1112, 592, -760}, { -1088, 0, -416}, { -1848, 464, -592}, { -1320, -128, 0}, // 65 seconds { -1120,...
nnected); EXECUTE_SCRIPT("var c = 0; var d = 0;\n" "_rocky.on('postmessageconnected', function() { c++; });\n" "_rocky.on('postmessagedisconnected', function() { d++; });\n"); // Make sure this race is handled (see comment in prv_handle_connection()): prv_simulate_transport_con...
prv_json_parse( "var msg = { " "\"key\" : " "\"Bacon ipsum dolor amet kevin filet mignon id ut, aute sausage tri-tip " "frankfurter pork loin. Boudin ullamco landjaeger, kevin tongue minim tri-tip " "ground round dolore. Ham hock tongue swine, cillum jowl pancetta fugiat " ...
; } } //////////////////////////////////////////////////////////////////////////////// // .postMessage() Tests //////////////////////////////////////////////////////////////////////////////// #define SIMPLE_TEST_OBJECT "{ \"x\" : 1 }" static void prv_assert_simple_test_object_pending(void) { const char * const e...
ends up providing about // 12 steps every 10 minutes, so without the "no steps during sleep" logic in the activity // service, we would end up with about 180/10 * 12 = 216 steps during sleep. With the // "no steps during sleep" logic in place, we should get close to 0 steps int32_t steps_after; activity_get_m...
(LOG_LEVEL_DEBUG, "Looking for sessions...")
; for (uint32_t i = 0; i < session_entries; i++) { ActivitySession *session = &sessions[i]; PBL_LOG(LOG_LEVEL_DEBUG, " Found session type: %d, start_min: %d, length_min: %"PRIu16" ", (int)session->type, time_util_get_minute_of_day(session->start_utc), session->length_min); if (ses...
unk_size <= num_bytes); data_logging_log(logging_session, buf, chunk_size / item_size); fake_system_task_callbacks_invoke_pending(); buf += chunk_size; num_bytes -= chunk_size; } } // ---------------------------------------------------------------------------------------- static void prv_check_sessio...
{ prv_log_consume_random(logging_sessions[i], item_size, rand() % 16); }
} // ---------------------------------------------------------------------------------------- void test_data_logging__log_consume_large_items(void) { DataLoggingSessionRef logging_sessions[10]; int item_size[10]; // Create sessions for (int i = 0; i < 10; i++) { item_size[i] = 50 + (rand() % 250); l...
------------------------------------------------------------------------ Animation *animation_sequence_create_from_array(Animation **animation_array, uint32_t array_len) { PBL_ASSERTN(!animation_private_using_legacy_2(NULL)); Animation *seq = prv_complex_create(animation_array, array_len, AnimationTypeSequence); ...
list_get_next(&animation->list_node)
; } } // ------------------------------------------------------------------------------------------- static void prv_dump_scheduler(char* buffer, int buffer_size, AnimationState* state) { portENTER_CRITICAL(); if (animation_private_using_legacy_2(state)) { AnimationLegacy2Scheduler *legacy_state = (Animation...
p) { if (s_health_sessions_sleep_time == 0) { s_health_sessions_sleep_time = time_start; } if ((s_health_sessions_awake_time == 0) || (time_end > s_health_sessions_awake_time)) { s_health_sessions_awake_time = time_end; } } char time_start_text[64]; struct tm *local_tm = localtime(&ti...
activity_stop_tracking()
rec_count = 4; Recognizer **recognizers = prv_create_recognizers(k_rec_count); Window window = {}; layer_init(&window.layer, &GRectZero); Layer *root = &window.layer; RecognizerManager manager; recognizer_manager_init(&manager); manager.window = &window; Layer layer_a, layer_b, layer_c; 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)); recognizer_add_to_list(recognizers[1], &layer_a.recognizer_list); recognizer_add_to_list(...
const char *s_error_strings[] = { "Success.", "Can't resolve.", "Missing closing brace.", "Missing argument.", "No result generated.", "Unknown filter.", "format() was not last filter.", "Time unit in predicate is invalid.", "Escape character at end of string.", "Opening parenthesis for filter was ...
cl_assert_equal_b(cond.force_eval_on_time, true)
, }; if (type == CLOCK_TEXT_TYPE_DATE) { strftime(text.buffer, sizeof(text.buffer), "%a %d", tick_time); } else if (type == CLOCK_TEXT_TYPE_TIME) { strftime(text.buffer, sizeof(text.buffer), "$l:%M%P", tick_time); } for (uint32_t i = 0; i < sizeof(text.buffer); i++) { text.buffer[i] = toupper((u...
prv_handle_time_update(pbl_override_localtime(&t), (TimeUnits)0xff)
; tick_timer_service_subscribe(MINUTE_UNIT, prv_handle_time_update); } void watch_model_start_intro() { prv_intro_animation_finished(NULL); } void watch_model_init(void) { const time_t t = rtc_get_time(); struct tm *tick_time = pbl_override_localtime(&t); ClockModel model = prv_clock_model_default(tick_tim...
}, { 0, 0x6f, 0, 192}, { 0, 0x6f, 0, 194}, { 0, 0x6f, 0, 194}, // 690: Local time: 01:02:00 PM { 0, 0x6f, 0, 194}, { 0, 0x6f, 0, 193}, { 0, 0x6f, 0, 192}, { 0, 0x6f, 0, 192}, { 0, 0x6f, 0, 191}, { 0, 0x6f, 0, 191}, { 0, 0x6f, 0, 190}, { 0, 0x6f, 0, 190}, { 0, 0x6f, 0,...
{ 0, 0x6f, 0, 187}, { 0, 0x6f, 0, 187}, { 0, 0x6f, 0, 187}, { 0, 0x6f, 0, 187}, { 0, 0x6f, 0, 187}, { 0, 0x6f, 0, 187}, { 0, 0x6f, 0, 187}, { 0, 0x6f, 0, 187}, { 0, 0x6f, 0, 187}, { 0, 0x6f, 0, 187}, { 0, 0x6f, 0, 186}, { 0, 0x6f, 0, 186}, { 0, 0x6f, 0, 186}, { 0,...
{ 0, 0x6f, 0, 182}, { 0, 0x6f, 0, 182}, { 0, 0x6f, 0, 181}, { 0, 0x6f, 0, 181}, { 0, 0x6f, 0, 181}, { 0, 0x6f, 0, 181}, { 0, 0x6f, 0, 180}, { 0, 0x6f, 0, 180}, { 0, 0x6f, 0, 180}, { 0, 0x6f, 0, 180}, { 0, 0x6f, 0, 180}, { 0, 0x6f, 0, 180}, { 0, 0x6f, 0, 179}, { 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...
("\x01\x01", 2)
; } void test_cobs_encode__simple(void) { assert_encode("Hello", 5, 6); assert_out_equal("\x06Hello", 6); } void test_cobs_encode__multiple_blocks(void) { assert_encode("Hello\0w\0rld", 11, 12); assert_out_equal("\x06Hello\x02w\x04rld", 12); } void test_cobs_encode__max_block_1(void) { // vector[] = { 0x01...
/* * 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 (s_current_flush_line < DISP_ROWS) { if (bitset8_get(s_current_framebuffer->dirty_lines, s_current_flush_line)) { row->address = s_current_flush_line; row->data = framebuffer_get_line(s_current_framebuffer, s_current_flush_line); s_current_flush_line++; return true; } s_cu...
static void framebuffer_reset_dirty(FrameBuffer* f) { memset(f->dirty_lines, 0x00, DISP_ROWS / 8); f->is_dirty = false; f->is_cleared = false; }
<string.h> // TODO: // mic hot before showing screen - needs robust beginning-of-speech detection - https://pebbletechnology.atlassian.net/browse/PBL-16474 // animated microphone icon - https://pebbletechnology.atlassian.net/browse/PBL-16481 // handle line wrapping - https://pebbletechnology.atlassian.net/browse/PBL-1...
VOICE_LOG("Send result")
; PebbleEvent event = { .type = PEBBLE_DICTATION_EVENT, .dictation = { .result = result, .text = (result == DictationSessionStatusSuccess) ? data->message : NULL, .timestamp = (result == DictationSessionStatusSuccess) ? data->timestamp : 0, } }; sys_send_pebble_event_to_kernel(&even...
MPTY_STRING(subtitle)) { // we got a title & subtitle, we're done } else if (IS_EMPTY_STRING(title) && IS_EMPTY_STRING(subtitle)) { // we got neither, use the body if (IS_EMPTY_STRING(body)) { // we're screwed... empty message title = "[Empty]"; } else { // try to show as much conten...
menu_layer_set_click_config_onto_window(menu_layer, window)
ct_order[] = {0, 4, 5, 2, 1, 3}; void test_timeline_model__future(void) { TimelineModel model = {0}; model.direction = TimelineIterDirectionFuture; time_t first_time = 1421178000; // Note: 1421178000 = Tue Jan 13 11:40:00 PST 2015 timeline_model_init(first_time, &model); cl_assert_equal_i(timeline_model_g...
cl_assert(uuid_equal(&s_items[s_correct_order[5]].header.id, &timeline_model_get_iter_state(0)->pin.header.id))
; cl_assert(!timeline_model_iter_next(&new_idx, &has_next)); } void test_timeline_model__and_back(void) { TimelineModel model = {0}; model.direction = TimelineIterDirectionFuture; time_t first_time = 1421178000; // Note: 1421178000 = Tue Jan 13 11:40:00 PST 2015 timeline_model_init(first_time, &model); ...
left_margin.raw_value <= right_margin.raw_value) { graphics_private_draw_horizontal_line(ctx, y, left_margin, right_margin); } } // Blending of last line if (fraction_for_bottom != 0) { int16_t y = y_max + 1; // Starting and ending point of the line, initialized with extremes ...
{ // We're crossing far_bottom point, time to swap... bm_p0 = far_bottom; bm_p1 = far_right; }
// Starting and ending point of the line, initialized with extremes Fixed_S16_3 top_margin = {.raw_value = INT16_MAX}; Fixed_S16_3 bottom_margin = {.raw_value = INT16_MIN}; // Find edges of the line's straigth part if (x >= far_left.x.integer && x <= far_right.x.integer) { // Ma...
RECT_CLIP_XY, true, 1); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw1_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, 1); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NX...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw11_clip_xy.${BIT_DEPTH_NAME}.pbi"))
; setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, 11); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw11_clip_nxny.${BIT_DEPTH_NAME}.pbi")); #endif } void test_graphics_draw_rect_${BIT_DEPTH_NAME}__origin_s...
e.w, ALARM_DAY_LIST_CELL_HEIGHT); box.origin = GPoint(0, 4); graphics_draw_text(ctx, i18n_get("Check something first.", &data->custom_day_picker_window), fonts_get_system_font(FONT_KEY_GOTHIC_18), box, GTextOverflowModeFill, ...
(&data->custom_day_picker_window, WINDOW_NAME("Alarm Custom Day Picker"))
heck(!modal_stack->list_head); // Switch to the app state to push a window stub_pebble_tasks_set_current(PebbleTask_App); window_stack_push(app_stack, window1, true); cl_assert_equal_i(window_stack_count(app_stack), 1); cl_assert_equal_i(window1->on_screen, true); cl_assert_equal_p(s_last_click_configure...
window_stack_push(stack, window1, true)
; window_stack_push(stack, window2, true); window_stack_push(stack, window3, true); WindowStackDump *dump; size_t stack_depth = window_stack_dump(stack, &dump); cl_assert_equal_i(stack_depth, 3); cl_assert_equal_p(dump[0].addr, window3); cl_assert_equal_s(dump[0].name, "Window3"); cl_assert_equal_p(dum...
trol_delay_ms) { AnimationPrivate *animation = (AnimationPrivate *)state->scheduled_head; if (animation == NULL) { return; } const uint32_t now = prv_get_ms_since_system_start(); const int32_t delta_ms = serial_distance32(now, animation->abs_start_time_ms); const uint32_t interval_ms = MAX(delta_ms, 0) ...
("unscheduling %d (%p)", (int)animation->handle, animation)
; PBL_ASSERTN(animation->implementation != NULL); const bool was_old_head = (&animation->list_node == state->scheduled_head); // Remove from being iterated prv_iter_remove(state, animation); // Move from the scheduled to the unscheduled list PBL_ASSERTN(list_contains(state->scheduled_head, &animation->li...
data previously existed // ... such as a migration from legacy firmware or after the RTC backup // domain had completely powered down) if (tz_info) { prv_handle_timezone_set(tz_info); } if (t) { rtc_set_time(*t); } int new_gmt_offset = time_get_gmtoffset(); int new_utc_time = rtc_get_time(); ...
rtc_get_time()
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
( start_address, firmware_description->firmware_length)
; #else const uint32_t calculated_crc = flash_crc32(start_address, firmware_description->firmware_length); #endif PBL_LOG(LOG_LEVEL_DEBUG, "CRCing recovery... done"); return calculated_crc == firmware_description->checksum; }
/* * 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 app_install_get_md(watchface_app_id, false /* worker */); }
#endif return sdk_app_get_info(); } #if CAPABILITY_HAS_SDK_SHELL4 //! @return True if the currently running app is an installed watchface static bool prv_current_app_is_watchface(void) { return app_install_is_watchface(app_manager_get_current_app_id()); } AppInstallId system_app_state_machine_get_last_registere...
bble-tool/CloudPebble sends accel samples to be //! replayed is also braindead. It pays no attention to the //! QemuProtocolAccelResponse messages and just sends samples as soon as //! they're received. So for replaying samples from the command-line or //! a file, they're all batched up and sent in a single message. Sa...
new_timer_start(s_timer_id, s_sampling_interval_ms, prv_timer_cb, NULL, TIMER_START_FLAG_REPEATING)
; PBL_ASSERTN(success); s_timer_running = true; } // Called by the qemu_serial driver when we receive an accel packet from the // remote side. This copies the received data into our s_rcv_buffer buffer. It // will gradually be pulled out of that and replayed by the timer callback. void qemu_accel_msg_callack(cons...
128, -224, -888}, { 144, -216, -912}, { 136, -224, -904}, { 128, -240, -912}, { 128, -240, -904}, { 136, -248, -896}, { 120, -232, -912}, { 128, -232, -904}, { 136, -232, -896}, { 128, -232, -904}, { 120, -224, -896}, { 128, -216, -904}, { 128, -200, -920}, { 120, -22...
{ 32, 8, -936}, { 32, 8, -936}, { 32, 16, -944}, // 284 seconds { 32, 32, -944}, { 48, -24, -944}, { 32, 8, -920}, { 32, 0, -936}, { 40, 16, -936}, { 40, 8, -920}, { 40, 24, -944}, { 32, 16, -936}, { 40, 24, -928}, { 48, 40, -952}, { 48, 40, -920}, { 40, 4...
{ 40, -48, -936}, { 40, -56, -936}, { 56, -48, -936}, { 56, -48, -928}, { 56, -56, -928}, // 287 seconds { 56, -56, -936}, { 48, -64, -936}, { 56, -64, -936}, { 56, -80, -936}, { 56, -64, -936}, { 48, -72, -928}, { 56, -64, -928}, { 56, -72, -928}, { 64, -72,...
, 50), 10, SW_EVEN)); #endif setup_test(&context, true, SW_EVEN, GColorBlack, GColorBlack, false); graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4); #if PBL_COLOR ASSERT_CALLED(prv_draw_round_rect_aa_stroked(&context, &GRect(20, 80, 40, 10), 4, SW_EVEN)); #else ASSERT_CALLED(prv_draw_round_rect_st...
ASSERT_NO_CHANGE(graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10)))
; ASSERT_NO_CHANGE(graphics_draw_rect(&context, &GRect(10, 20, 40, 10))); ASSERT_NO_CHANGE(graphics_draw_circle(&context, GPoint(50, 50), 10)); ASSERT_NO_CHANGE(graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4)); setup_test(&context, false, 2, GColorBlack, GColorBlack, true); ASSERT_NO_CHANGE(gra...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(new_set_value, get_value)
; // Try and insert an unknown key. It should fail const char *bad_key = "bad_key"; int bad_key_len = strlen(bad_key); cl_assert(prefs_db_insert((uint8_t *)bad_key, bad_key_len, (uint8_t *)&set_value, sizeof(set_value)) < 0); cl_assert(prefs_db_get_len((uint8_t *)bad_key,...
SPI/DMA Tx will break. uint8_t build_id[BUILD_ID_TOTAL_EXPECTED_LEN]; #if !PLATFORM_ROBERT s_rx_buffer = kernel_malloc_check(CORE_DUMP_RX_BUFFER_SIZE); #endif const size_t region_buf_size = sizeof(MemoryRegion[MemoryRegionTagCount]); MemoryRegion *region_buf = (MemoryRegion *)kernel_malloc_check(region_buf_siz...
flash_write_bytes(s_rx_buffer, flash_addr, sizeof(CoreDumpThreadInfo))
; flash_addr += sizeof(CoreDumpThreadInfo); // Read the Extra Thread Info CoreDumpExtraRegInfo chunk_extra; chunk_hdr.key = CORE_DUMP_CHUNK_KEY_EXTRA_REG; chunk_hdr.size = sizeof(chunk_extra); if (flash_addr_max < (flash_addr + sizeof(chunk_hdr) + chunk_hdr.size)) { PBL_LOG(LOG_LEVEL_ERROR, "Insuffici...
#include "system/logging.h" #include "system/passert.h" #include "FreeRTOSConfig.h" #define NUM_MENU_ITEMS 13 static bool s_call_core_dump_from_isr = false; // ================================================================================= // Application Data typedef struct { Window *window; SimpleMenuLayer...
if (index == 5) { PBL_LOG(LOG_LEVEL_INFO, "Entering infinite loop in non-FreeRTOS ISR."); NVIC_InitTypeDef NVIC_InitStructure; NVIC_InitStructure.NVIC_IRQChannel = OTG_FS_WKUP_IRQn; // Lower values are higher priority - make this higher priority than a FreeRTOS ISR NVIC_InitStructure.NVIC_IRQChann...
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = (configMAX_SYSCALL_INTERRUPT_PRIORITY >> 4); NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); NVIC_EnableIRQ(OTG_FS_WKUP_IRQn); // Trigger it. This transfers...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(LOG_LEVEL_INFO, "Data at address %p. Rebooting...", contents)
; PBL_CROAK("Internal logic error."); } static int sfs_seek(SettingsRawIter *iter, int amount, int whence) { status_t status = pfs_seek(iter->fd, amount, whence); if (status >= 0) { return status; } int pos = pfs_seek(iter->fd, 0, FSeekCur); PBL_LOG(LOG_LEVEL_ERROR, "Could not seek by %d from whence %...
d_text_orphans = (init_mode == GContextInitializationMode_System), }; } GDrawState graphics_context_get_drawing_state(GContext* ctx) { PBL_ASSERTN(ctx); return ctx->draw_state; } void graphics_context_set_drawing_state(GContext* ctx, GDrawState draw_state) { PBL_ASSERTN(ctx); ctx->draw_state = draw_state; }...
{ result = app_state_legacy2_get_2bit_framebuffer(); }
else { result = gbitmap_create_blank(native_framebuffer->bounds.size, GBitmapFormat1Bit); } if (result) { prv_graphics_convert_8_bit_to_1_bit(native_framebuffer, result); } } if (!result) { ctx->lock = false; } return result; } GBitmap* graphics_capture_frame_buffer_2bit(GContex...
te list's attributes below in the cleanup section // Advance the cursor by the serialized slice's total size glance_buffer_cursor += serialized_slice_total_size; } // Check that we fully populated the serialized glance buffer rv = (glance_buffer_cursor == glance_buffer_end) ? S_SUCCESS : E_ERROR; if (...
if (serialized_glance_size < 0) { WTF; }
/* * 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(flash_locked)
s_data.metric_history[ActivityMetricSleepStateSeconds][0] = 5 * SECONDS_PER_MINUTE; activity_insights_process_sleep_data(rtc_get_time()); // Pin added should have been called again, but with the same UUID cl_assert_equal_i(s_data.pins_added, 2); cl_assert(uuid_equal(&orig_id, &s_last_timeline_id)); // Mak...
rtc_get_time()
); cl_assert_equal_i(s_data.pins_added, 1); // Re-init (simulates power cycle) and make sure we don't add a pin again activity_insights_init(rtc_get_time()); activity_insights_process_sleep_data(rtc_get_time()); cl_assert_equal_i(s_data.pins_added, 1); // Make sure we still merge properly after a power cy...
{ 1088, 264, 264}, { 1040, 152, 256}, { 816, 88, 200}, { 752, 152, 80}, { 760, 120, 96}, // 8 seconds { 736, 88, 72}, { 696, 56, 64}, { 728, 48, 56}, { 992, 64, 48}, { 1176, 96, -24}, { 1824, -8, 328}, { 1512, 360, 48}, { 904, 648, -232}, { 904, 240, 24}, ...
{ 600, 248, 32}, { 560, 216, 24}, { 728, 224, 32}, { 816, 304, 16}, { 744, 304, 32}, { 776, 416, -80}, { 920, 368, -56}, { 1248, 400, -120}, // 14 seconds { 1280, 256, 8}, { 1840, 312, 24}, { 1328, 424, -8}, { 816, 352, 0}, { 920, 248, 32}, { 1096, 152, 192}, ...
{ 752, 64, 24}, { 784, 80, 16}, { 896, -8, 16}, { 1144, 96, -64}, { 1480, -64, -32}, { 1648, 72, 80}, { 1048, 432, -104}, { 1064, 408, -216}, { 888, 344, 8}, { 672, 160, 96}, { 752, 240, 64}, { 824, 248, 104}, // 17 seconds { 792, 440, 0}, { 720, 376, 8}, ...
*) node; return !gap_le_connection_is_connected(&intent->device); } static bool prv_has_intents_for_disconnected_devices(void) { return list_find(&s_intents->node, prv_intent_filter_disconnected, NULL); } static uint32_t prv_intents_count(void) { return list_count(&s_intents->node); } static bool prv_is_inten...
{ PBL_LOG(LOG_LEVEL_DEBUG, "register_intent: IRK not used, searching by addr"); connection = gap_le_connection_by_device(&request->bonding.device); }
} if (connection) { is_already_connected = true; is_already_encrypted = connection->is_encrypted; local_is_master = connection->local_is_master; connected_device = &connection->device; } intent = prv_get_intent_by_bonding_id(request->bonding.id); } else { is_already_conne...
d of string.", "Opening parenthesis for filter was missing.", "Closing parenthesis for filter was missing.", "Invalid conversion specifier for format.", "Invalid parameter.", "Opening quote for filter was missing.", "Closing quote for filter was missing.", "Invalid argument separator.", }; //////////////...
strcpy(s_output, "hurf")
; bool ret = template_string_evaluate("test string {time_until(5)|format('%uS')}", s_output, 0, &cond, &vars, &err); cl_assert_equal_b(ret, true); cl_assert_equal_s(s_output, "hurf"); cl_assert_equal_i(cond.eval_time, 1); cl_assert_equal_b(cond.force_eval_on_t...
_distance_outside_clip_box; } // Clip x2 to clip_box_max_x x2.integer = MIN(clip_box_max_x, x2.integer); // Return early if there's nothing to draw if (x1.integer > x2.integer) { return; } // first pixel with blending if (left_aa_offset == 1) { // To prevent bleeding of left-hand AA below cli...
{ const uint8_t mask_pixel_value = raw_image_get_value_for_bitdepth(mask_row_data, current_x + x_adjustment, 0 /* y */, row_stride_bytes, ...
} ALWAYS_INLINE uint8_t graphics_private_raw_mask_get_value(const GContext *ctx, const GDrawMask *mask, GPoint p) { const GBitmap *framebuffer_bitmap = &ctx->dest_bitmap; const GBitmapDataRowInfo data_row_info = gbitmap_get_data_row_info(framebuffer_bitmap...
ize.h - title_text_frame_height - subtitle_text_frame_height - 1) / 2); if (subtitle_text_frame_height) { title_text_frame_origin_y -= icon_on_left_title_subtitle_vertical_spacing_offset; } } } // Draw the subtitle (if one was provided and we have room), taking into accoun...
gsize_equal(&rect.size, &icon_size)
) { // round has never worked with legacy2 apps static const bool is_legacy2 = false; if (config->icon_box_model) { rect.origin = gpoint_add(rect.origin, config->icon_box_model->offset); } prv_draw_icon(ctx, config->icon, &rect, is_legacy2); } } } static ALWAYS_INLINE void p...
interrupts.h" #include "services/common/regular_timer.h" #include "system/bootbits.h" #include "system/logging.h" #include "system/passert.h" #include "system/reset.h" #include "util/time/time.h" #define STM32F2_COMPATIBLE #include <mcu.h> #include <inttypes.h> #include <stdio.h> #include <string.h> typedef uint3...
time_t_to_string(buffer, s_time_base)
/* * 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...
(USART2, uart_irq_handler, QEMU_UART)
; #endif static UARTDeviceState s_dbg_uart_state; static UARTDevice DBG_UART_DEVICE = { .state = &s_dbg_uart_state, .tx_gpio = { .gpio = GPIOC, .gpio_pin = GPIO_Pin_10, .gpio_pin_source = GPIO_PinSource10, .gpio_af = GPIO_AF_USART3 }, .rx_gpio = { .gpio = GPIOC, .gpio_pin = GPIO_Pin_11,...
ion_button_layer); layer_set_hidden((Layer *)&data->action_button_layer, true); // Ideally this gets moved into the status layer in the future. See data struct comment gbitmap_init_with_resource(&data->dnd_icon, RESOURCE_ID_QUIET_TIME_STATUS_BAR); // actual frame of the icon layer is calculated in prv_set_dn...
(data, id, true /* close am */)
; } } static void prv_handle_notification_acted_upon(Uuid *id) { NotificationWindowData *data = &s_notification_window_data; if (data->is_modal) { prv_remove_notification(data, id, true /* close am */); } else { data->notifications_modified = true; } } static void prv_handle_notification_added_comm...
if (value_length != sizeof(ATTHandleRange)) { PBL_LOG(LOG_LEVEL_ERROR, "Service Changed Indication incorrect length: %u", value_length); // Pretend we ate the indication. There will be no GAPLECharacteristic in the system that will // match this ATT handle anyway. return true; } ATTHandleRang...
{ // Already sent indication once during the lifetime of this connection, don't send again. goto unlock; }
// PRF will always send a "Service Changed" indication: #if !RECOVERY_FW if (s_service_changed_indications_left <= 0) { goto unlock; } #endif PBL_LOG(LOG_LEVEL_INFO, "Indicating Service Changed to remote device"); // Work-around for iOS issue (see comment above), send the indic...
} } static void down_click_handler(ClickRecognizerRef recognizer, void *unusued) { struct FlashTestData *data = app_state_get_user_data(); // Only stop stress test if ((data->test_case == FLASH_TEST_CASE_RUN_STRESS_ADDR_TEST) && (data->test_case_status == FLASH_TEST_STATUS_RUNNING)) { data->test_case_st...
simple_menu_layer_get_layer(&data->simple_menu_layer)
tem)); if (!item_out) { return NULL; } memcpy(&item_out->header, &src->header, sizeof(CommonTimelineItemHeader)); if (!prv_deep_copy_attributes_actions(&src->attr_list, &src->action_group, item_out)) { timeline_item_destroy(item_out); return NULL; } return item_out; } size_t timeline_item_get...
{ timeline_item_free_allocated_buffer(item); task_free(item); }
{ 1048, 176, -368}, { 1032, 280, -384}, { 1008, 208, -352}, { 1096, 528, -360}, { 1384, 712, -256}, { 1448, 1104, -392}, { 1184, 1008, -232}, { 896, 1024, -392}, { 864, 1008, -288}, { 1080, 1168, -248}, { 896, 848, -176}, { 1072, 896, -176}, { 1320, 712, -160}, { 141...
{ 1344, 136, -88}, { 1232, 264, -192}, { 1184, 168, -256}, { 1320, 80, -208}, // 34 seconds { 1048, -96, -104}, { 656, -264, -192}, { 872, -96, -176}, { 768, -40, -344}, { 1184, 176, -304}, { 1536, 280, -480}, { 1488, 312, -288}, { 1360, 568, -336}, { 1272, 608, -...
{ 736, 832, -368}, { 1120, 864, -392}, { 936, 736, -288}, { 1120, 784, -208}, { 1336, 664, -272}, { 1200, 480, -200}, { 1088, 320, -192}, { 1184, 184, -216}, { 1224, 232, -104}, { 1336, 256, -208}, { 1464, 256, -192}, { 1288, 144, -152}, { 824, -120, -216}, { 920...
/* * 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...
va_end(args)
; } /** * Provide console message implementation for the engine. */ void jerry_port_console(const char *format, ...) { if (format[0] == '\n' && strlen(format) == 1) { return; } va_list args; va_start(args, format); app_log_vargs(LOG_LEVEL_DEBUG, "JERRY-CONSOLE", 0, format, args); va_end(args); } voi...
tx, &data->arrow_down, GAlignBottom); } break; case DisplayCalibrationState_Confirm: break; } } static void prv_layer_update_proc(Layer *layer, GContext *ctx) { DisplayCalibrationData *data = window_get_user_data(layer_get_window(layer)); ctx->draw_state.drawing_box.origin.x += data->offse...
(window, &(WindowHandlers) { .unload = prv_window_unload })
; window_set_background_color(window, GColorBlack); Layer *root_layer = window_get_root_layer(window); Layer *layer = &data->layer; layer_init(layer, &root_layer->bounds); layer_set_update_proc(layer, prv_layer_update_proc); layer_add_child(root_layer, layer); prv_init_arrow_bitmap(&data->arrow_down, RE...
EFINE_SYSCALL(void, sys_wakeup_cancel_all_for_app, void) { mutex_lock(s_mutex); { SettingsFile wakeup_settings; if (settings_file_open(&wakeup_settings, SETTINGS_FILE_NAME, SETTINGS_FILE_SIZE) == S_SUCCESS) { // Update settings file removing all events with UUID = uuid settings_file_rewrite(&wak...
{ system_task_add_callback(prv_wakeup_rewrite_kernel_bg_cb, NULL); }
}
rx = false; dialog_spi_set_pending_int(); } } static void prv_wtf_analytic_cb(void *context) { #ifndef RECOVERY_FW ANALYTICS_LOG_DEBUG("Bluetooth Host Transport WTF"); AnalyticsEventBlob event_blob = { .event = AnalyticsEvent_BtLockupError, }; analytics_logging_log_event(&event_blob); #endif } stati...
vTaskDelete(NULL)
; } HostTransportEnqueueStatus host_transport_tx_enqueue(const uint8_t *data, size_t length) { if (!s_is_host_transport_initialized) { return HostTransportEnqueueStatus_Failure; } if (s_spi_transport.state == SPITransportState_CoreDump) { PBL_LOG(LOG_LEVEL_INFO, "Skipping host transport enqueue .. waiti...