prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
et_weight_dag(void) { return s_weight_dag; } static uint16_t s_height_mm; uint16_t activity_prefs_get_height_mm(void) { return s_height_mm; } typedef enum { Human_TallMale, Human_ShortMale, Human_TallFemale, Human_ShortFemale, Human_Count, } Human; typedef struct HumanPrefs { uint8_t age_years; Act...
cl_assert_within(long_run_distance_m, 40000, 44000)
; // Now make a shorter guy run for the same time. // He should be in the same ballpark but cover less distance prv_set_user(Human_ShortMale); int short_guy_distance = activity_private_compute_distance_mm(steps, time_ms) / MM_PER_METER; cl_assert_within(short_guy_distance, 36000, 44000); cl_assert_gt(long_...
hOp from_op; GStrokeWidthOp to_op; } stroke_width; struct { GPointIndexLookupCreator creator; void *userdata; bool owns_userdata; } lookup; } ScaleSegmentedData; typedef struct { GPoint target; } DistanceLookupData; static GPointIndexLookup *prv_create_lookup_by_distance(GDelayCreatorContext...
kino_reel_transform_set_from_frame(reel, screen_frame)
; kino_reel_transform_set_to_frame(reel, screen_frame); kino_reel_transform_set_global(reel, true); } else { prv_destructor(data); } return reel; } void kino_reel_scale_segmented_set_delay_lookup_creator( KinoReel *reel, GPointIndexLookupCreator creator, void *userdata, bool take_ownership) { 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...
cl_assert_equal_m(array, sorted, sizeof(array))
; } void test_sort__single_element_array(void) { int32_t array[] = {1}; sort_bubble(array, ARRAY_LENGTH(array), sizeof(int32_t), prv_int32_cmp); int32_t sorted[] = {1}; cl_assert_equal_m(array, sorted, sizeof(array)); } typedef struct MyStruct { uint8_t nothing; int32_t number; uint16_t nothing2; } My...
eertos_mutex; } PebbleMutexCommon; struct pebble_mutex_t { PebbleMutexCommon common; }; struct pebble_recursive_mutex_t { PebbleMutexCommon common; }; // macros should only be called while we hold the mutex we are logging so no // additional locking is needed #define LOG_LOCKED(logged_lr, new_lr) \ if (logg...
(!mcu_state_is_isr())
; TickType_t timeout_ticks = milliseconds_to_ticks(timeout_ms); LightMutexHandle_t mutex = handle->common.freertos_mutex; if (xLightMutexLockRecursive(mutex, timeout_ticks) == pdTRUE) { LOG_LOCKED(handle->common.lr, myLR); return (true); } return (false); } bool mutex_is_owned_recursive(PebbleRecu...
age = storage; new_node->buffer.size = storage_size; s_app_inbox_head = (AppInboxNode *)list_prepend((ListNode *)s_app_inbox_head, (ListNode *)new_node); } } prv_unlock(); return (new_node != NULL); } uint32_t app_inbox_service_unregister_by_...
{ bool success = false; prv_lock(); { AppInboxNode *inbox = prv_find_inbox_by_tag_and_log_if_not_found(tag); if (!inbox) { goto unlock; } prv_mark_failed_if_no_writer(inbox); if (inbox->write_failed) { goto unlock; } if (!prv_check_space_remaining(inbox, length)) { in...
static void prv_finish(AppInboxNode *inbox) { inbox->writer = NULL; inbox->buffer.current_offset = 0; } void app_inbox_service_init(void) { s_app_inbox_mutex = mutex_create_recursive(); } bool app_inbox_service_end(AppInboxServiceTag tag) { bool success = false; prv_lock(); { AppInboxNode *inbox = p...
/* * 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 ((steps == 0) || (ms == 0)) { return 0; } // For a rough ballpack figure, according to // http://livehealthy.chron.com/determine-stride-pedometer-height-weight-4518.html // The average stride length in mm is: // men: 0.415 * height(mm) // women: 0.413 * height(mm) // An average cadenc...
ent_timeline_item_action_source = TimelineItemActionSourceModalNotification; } NOINLINE void app_state_deinit(void) { animation_private_state_deinit(&s_app_state_ptr->animation_state); #if CAPABILITY_HAS_ACCESSORY_CONNECTOR app_smartstrap_cleanup(); #endif #if CAPABILITY_HAS_HEALTH_TRACKING health_service_state_...
{ s_app_state_ptr->wakeup_handler = handler; }
EventServiceInfo *app_state_get_wakeup_event_info(void) { return &s_app_state_ptr->wakeup_event_info; } GBitmap* app_state_legacy2_get_2bit_framebuffer(void) { #ifdef PLATFORM_TINTIN // Tintin platforms have a native framebuffer type of 2bit, they shouldn't be calling this. WTF; #endif PBL_ASSERTN(s_app_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...
kernel_ui_get_content_indicators_buffer()
; } } TimelineItemActionSource kernel_ui_get_current_timeline_item_action_source(void) { if (pebble_task_get_current() == PebbleTask_App) { return app_state_get_current_timeline_item_action_source(); } else { return s_kernel_current_timeline_item_action_source; } } void kernel_ui_set_current_timeline_...
ringServiceConnectivityStatus status = {}; prv_get_connectivity_status(conn_idx, &status); memcpy(response_buf, &status, sizeof(status)); return sizeof(status); } static uint8_t prv_handle_gatt_mtu_read(uint16_t conn_idx, uint8_t response_buffer[READ_RESPONSE_BUFFER_SIZE])...
if (value_handle == s_pps_ctx.att_hdl.conn_params) { *response_length_out = prv_handle_conn_params_read(conn_idx, response); } else { return false; }
return true; } static void prv_pps_handle_read_request(ble_service_t *svc, const ble_evt_gatts_read_req_t *evt) { uint8_t response[READ_RESPONSE_BUFFER_SIZE] = {}; size_t response_length = 0; att_error_t response_status = ATT_ERROR_OK; if (evt->handle == s_pps_ctx.att_hdl.trigger_pairing) { const Pairi...
device); if (!p) { return HrmSharingPermission_Unknown; } return p->permission; } void ble_hrm_handle_activity_prefs_heart_rate_is_enabled(bool is_enabled) { if (!prv_hw_and_sw_supports_hrm()) { return; } PBL_LOG(LOG_LEVEL_INFO, "BLE HRM sharing prefs updated: is_enabled=%u", is_enabled); if (!i...
{ PBL_LOG(LOG_LEVEL_INFO, "Requesting BLE HRM sharing permission"); BLEHRMSharingRequest *const sharing_request = kernel_zalloc_check(sizeof(*sharing_request)); sharing_request->connection = connection; launcher_task_add_callback(prv_push_sharing_request_window_kernel_main_cb, sharing_request); }
static void prv_put_sharing_state_updated_event(int subscription_count) { // 2 purposes of this event: // - refresh the Settings/Bluetooth UI whenever a device (un)subscribes. // - present a "Sharing HRM" icon in the Settings app glance. PebbleEvent e = { .type = PEBBLE_BLE_HRM_SHARING_STATE_UPDATED_EVENT...
8, -160}, { 1072, -120, -152}, { 1248, -184, -120}, { 1576, -120, -192}, { 1344, -112, -120}, { 1056, -96, -88}, { 888, -88, -120}, { 1016, -56, -88}, { 1176, -72, 8}, { 1136, -80, 64}, { 1072, -80, 0}, { 1040, -112, -8}, { 1024, -120, -24}, // 37 seconds { 1072, ...
{ 912, 32, -112}, { 1104, 56, -48}, { 1224, 16, 24}, { 1120, -16, 32}, { 968, -8, -8}, { 920, 24, -64}, { 976, 40, -96}, { 1008, 32, -128}, { 1056, -24, -160}, { 1064, -56, -200}, { 1088, -88, -176}, { 1088, -112, -136}, { 1136, -112, -104}, { 1152, -80, -64}, ...
{ 1304, -40, -96}, // 45 seconds { 896, -16, -208}, { 840, 32, -296}, { 1024, 48, -232}, { 1248, -80, -96}, { 1120, -80, -48}, { 1008, -56, -80}, { 952, -16, -88}, { 968, 0, -120}, { 984, -24, -72}, { 1008, -48, -88}, { 1032, -80, -64}, { 1024, -64, -80}, { 1...
se. */ #include "clar.h" #include "util/attributes.h" #include "util/pstring.h" #include "services/normal/blob_db/weather_db.h" #include "services/normal/filesystem/pfs.h" #include "services/normal/weather/weather_types.h" #include "weather_data_shared.h" // Fixture ////////////////////////////////////////////////...
(E_INVALID_ARGUMENT, weather_db_insert((uint8_t*)&key, sizeof(WeatherDBKey), (uint8_t*)new_entry, entry_size))
0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}; void test_session_send_queue__initialize(void) { s_valid_session = &s_session; s_free_count = 0; fake_kernel_malloc_init(); fake_kernel_malloc_enable_stats(true); fake_kernel_malloc_mark(); s_session = (const CommSession) {}; } void test_session_send_queue__cleanup(voi...
comm_session_send_queue_consume(s_valid_session, 1)
; } // Expect head to be free'd: cl_assert_equal_i(s_free_count, 1); // Next job can be read: cl_assert_equal_i(comm_session_send_queue_get_read_pointer(s_valid_session, &data_out), sizeof(TEST_DATA)); cl_assert_equal_m(data_out, TEST_DATA, sizeof(TEST_DATA)); } void test_session_send...
_i(mfg_info_get_rtc_freq(), 4); mfg_info_get_model(buffer); cl_assert_equal_s(buffer, ""); // Make sure we have space for the model. mfg_info_set_model("test_model"); cl_assert_equal_i(mfg_info_get_disp_offsets().x, -2); cl_assert_equal_i(mfg_info_get_disp_offsets().y, 1); cl_assert_equal_i(mf...
memcmp(fpga_buffer + HEADER_SIZE, s_boot_fpga, sizeof(s_boot_fpga))
!= 0); // Now update it and make sure we healed the corruption mfg_info_update_constant_data(); flash_read_bytes(fpga_buffer, BOOT_FPGA_FLASH_ADDR, sizeof(fpga_buffer)); cl_assert(memcmp(fpga_buffer + HEADER_SIZE, s_boot_fpga, sizeof(s_boot_fpga)) == 0); }
s GATT module does *NOT* emit a service discovery completion event for disconnections // Test that our API *does* emit an service discovery event with "disconnected" reason: prv_assert_event(&device, BTErrnoServiceDiscoveryDisconnected); } void test_gatt_client_discovery__complete_error(void) { BTDeviceInternal...
prv_assert_no_event()
; // take down the connection and a disconnection event should be emitted gap_le_connection_remove(&device); prv_assert_event(&device, BTErrnoServiceDiscoveryDisconnected); } void test_gatt_client_discovery__watchdog_race_with_restarting(void) { BTDeviceInternal device = prv_connected_dummy_device(1); // S...
is with the same minute as another wakeup event if ((entry.timestamp - WAKEUP_EVENT_WINDOW < check->wakeup_timestamp) && (check->wakeup_timestamp < (entry.timestamp + WAKEUP_EVENT_WINDOW))) { check->wakeup_count = E_RANGE; } return true; // continue iterating } static StatusCode prv_wakeup_settings_a...
{ // Legacy apps expect everything in local time. return_time = time_utc_to_local(return_time); }
return return_time; } void wakeup_enable(bool enable) { bool was_enabled = s_wakeup_enabled; s_wakeup_enabled = enable; if (enable && !was_enabled) { prv_wakeup_timer_next_pending(); } else if (!enable && s_current_timer_id && new_timer_scheduled(s_current_timer_id, NULL)) { new_timer_s...
tents->src_filename)); // Obtain the line number contents->line_number = src_line_number; return offsetof(MessageContents, message); } //! Serialize a message into contents, returning the number of bytes used. static size_t prv_serialize_log(MessageContents *contents, uint8_t l...
circular_buffer_write(&s_isr_log_buffer, &insufficient_space_length, sizeof(insufficient_space_length))
point exists as an edge between an equal number of //! clock cycles on either side. #define PWM_TIMER_UPDATE_PERIOD (100) // Operating frequency of DRV2603 is in the [10, 250] kHz range. #define PWM_OUTPUT_FREQUENCY_HZ (22 * 1000) // Count clock needs to run at least as fast as the (update period * output frequency)...
prv_vibe_raw_ctl(false)
; } int8_t vibe_get_braking_strength(void) { if (BOARD_CONFIG_VIBE.options & ActuatorOptions_HBridge) { // We support the full -100..100 range, send it all the way backwards return VIBE_STRENGTH_MIN; } else { // We only support the 0..100 range, just ask it to turn off return VIBE_STRENGTH_OFF; }...
= DEFINE_EVENT( .id = 0x01, .timestamp = 20 * SECONDS_PER_MINUTE, .duration = 70 ); TimelineItem UNUSED item2 = DEFINE_EVENT( .id = 0x02, .timestamp = -50 * SECONDS_PER_MINUTE, .duration = 30 ); unsigned int timeout_s = item.header.timestamp - TIMELINE_PEEK_DEFAULT_SHOW_BEFORE_TIME_S; CHECK_EVENT( ...
(timeout_s)
; timeout_s = item->header.duration * SECONDS_PER_MINUTE; CHECK_EVENT( .count = 4, .item_id = item->header.id, .num_concurrent = 0, .timeout_ms = timeout_s * MS_PER_SECOND, .time_type = TimelinePeekTimeType_ShowStarted, .is_first_event = true ); prv_invoke_timer(timeout_s); CHECK_N...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(HcEndpointID_Test, HcMessageID_Test_Core_Dump, &option, sizeof(option))
_color, GColorBlack); } if (active_window->layout == WorkoutLayout_StaticAndScrollable || (active_window->layout == WorkoutLayout_TwoStaticAndScrollable && layer == &active_window->middle_metric_layer)) { prv_render_separator(ctx, layer); } } static void prv_scrollable_layer_update_proc(struct ...
(active_window)
; } else { prv_handle_stop_button(active_window); } } static void prv_set_pause_button(WorkoutActiveWindow *active_window) { bool can_stop = active_window->workout_controller->stop != NULL; if (can_stop || active_window->num_scrollable_metrics > 1) { active_window->pause_button = BUTTON_ID_UP; } else...
sizeof(key), &new_data, sizeof(new_data)); if (status == GapBondingFileSetFail) { return BT_BONDING_ID_INVALID; } if (is_gateway && status == GapBondingFileSetUpdated) { prv_update_bondings(key, BtPersistBondingTypeBLE); } prv_call_ble_bonding_change_handlers(key, op); return key; } bool bt_pers...
PBL_LOG(LOG_LEVEL_ERROR, "Not getting BLE id %d. Type mismatch", bonding)
; return false; } if (info_out) { bt_persistent_storage_assign_sm_pairing_info(info_out, &data.ble_data.pairing_info); } *requires_address_pinning = data.ble_data.requires_address_pinning; *flags = data.ble_data.flags; prv_fill_ble_data( NULL, NULL, data.ble_data.name, NULL, NULL, name_out)...
cense"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * W...
PBL_ASSERTN(framebuffer->bounds.origin.x == 0 && framebuffer->bounds.origin.y == 0)
; // Clip the line to the bitmap data row's range const GBitmapDataRowInfo data_row_info = gbitmap_get_data_row_info(framebuffer, y); x1.raw_value = MAX(x1.raw_value, data_row_info.min_x << FIXED_S16_3_PRECISION); x2.raw_value = MIN(x2.raw_value, data_row_info.max_x << FIXED_S16_3_PRECISION); if (x1.integer ...
k); SmartstrapAttributeInternal *attr = s_attr_head; while (attr) { SmartstrapAttributeInternal *next = NEXT_ATTR(attr); if (attr->deferred_delete) { list_remove(&attr->list_node, (ListNode **)&s_attr_head, NULL); kernel_free(attr); } attr = next; } mutex_unlock(s_attr_list_lock); } ...
syscall_assert_userspace_buffer(length, sizeof(size_t))
; } } if (service_id) { *service_id = attr->service_id; } if (attribute_id) { *attribute_id = attr->attribute_id; } if (length) { *length = mbuf_get_length(&attr->mbuf); } } DEFINE_SYSCALL(SmartstrapResult, sys_smartstrap_attribute_do_request, SmartstrapAttribute *app_attr, ...
ARGB8, fun(GColorFromHEX(0xff5555)).argb); cl_assert_equal_i(GColorWhiteARGB8, fun(GColorFromHEX(0x0055aa)).argb); cl_assert_equal_i(GColorBlackARGB8, fun(GColorFromHEX(0xff5500)).argb); cl_assert_equal_i(GColorBlackARGB8, fun(GColorFromHEX(0xaaaaaa)).argb); // // expectation as derived from Appfaces_generic_co...
(gcolor_equal(lookup_table_out[0], GColorBlue))
; cl_assert(gcolor_equal(lookup_table_out[1], GColorLiberty)); cl_assert(gcolor_equal(lookup_table_out[2], GColorBrass)); cl_assert(gcolor_equal(lookup_table_out[3], GColorYellow)); // lookup_table_out's entries should all preserve the alpha of tint_color tint_color = GColorBlack; tint_color.a = 1; gcolo...
pe: %d", data->operation); break; } layer_mark_dirty(data->canvas_layer); PBL_LOG(LOG_LEVEL_DEBUG, "line(p1(%d, %d), p2(%d, %d), width=%d), angle=%d)", data->p1.x, data->p1.y, data->p2.x, data->p2.y, data->stroke_width, (int)(data->rotation_angle * 360 / TRIG_MAX_ANGLE)); } static voi...
GPoint(70, 100)
, GPoint(70, 101)); return; } if (data->operation == OP_ROTATE2) { int line_length = 60; time_t now; uint16_t now_ms = time_ms(&now, NULL); uint32_t seconds = pbl_override_localtime(&now)->tm_sec; uint32_t miliseconds = seconds * 1000 + now_ms; uint32_t rotation = miliseconds * TRIG_M...
arrow_base_center_y + (arrow_size.h / 2) } } }; if (timeline_layer->scroll_direction == TimelineScrollDirectionUp) { // arrow is in a different position for past & future, but only on rectangular displays gpath_move_to(&arrow_path, PBL_IF_RECT_ELSE(GPoint(0, (style->thin_pin_height + ...
prv_reset_layouts(layer)
; prv_destroy_nonvisible_items(layer); timeline_layer_set_layouts_hidden(layer, false); // PBL-18815: Reset the current day in case the pin was deleted. This should later be animated. const int index = TIMELINE_LAYER_FIRST_VISIBLE_LAYOUT; if (layer->layouts[index]) { layer->current_day = layer->layouts[i...
------- // Basic test for incoming calls over PP void test_phone_call__pp_incoming(void) { // We should only allow incoming calls when connected to the mobile app (this should never really // happen for PP) prv_put_incoming_call_event(PhoneCallSource_PP, false); ASSERT_LAST_EVENT(PhoneEventType_Invalid); prv...
ASSERT_LAST_EVENT(PhoneEventType_Hide)
; }
.h> #include <stddef.h> static GTextLayoutCacheRef prv_text_layer_legacy2_get_cache_handle(TextLayerLegacy2 *text_layer) { if (text_layer == NULL) { return NULL; } return text_layer->should_cache_layout ? text_layer->layout_cache : NULL; } void text_layer_legacy2_update_proc(TextLayerLegacy2 *text_layer, GC...
(&(text_layer->layer))
; } void text_layer_legacy2_set_text_alignment(TextLayerLegacy2 *text_layer, GTextAlignment text_alignment) { if (text_layer == NULL || text_alignment == text_layer->text_alignment) { return; } text_layer->text_alignment = text_alignment; layer_mark_dirty(&(text_l...
most-recent (looking at each session's start): 3, 2, 1, 0 // most-recent to oldest (looking at each session's end): 1, 0, 3, 2 const int num_sleep_sessions = 4; const int num_restfulsleep_sessions = 2; const int num_run_sessions = 1; const int num_walk_sessions = 1; const int num_open_sessions = 1; const...
(activities, HealthActivityNone)
; cl_assert_equal_i(s_sys_activity_get_metric_values.in.history_len, 1); cl_assert_equal_i(s_sys_activity_get_metric_values.in.metric, ActivityMetricSleepState); s_sys_activity_get_metric_values.out.history[0] = ActivitySleepStateLightSleep; activities = health_service_peek_current_activities(); cl_assert_eq...
---------------------------------------------------- // Log an app launch event static bool prv_send_uuid(AnalyticsEvent event_enum, const Uuid *uuid) { if (uuid_is_invalid(uuid) || uuid_is_system(uuid)) { // No need to log apps with invalid uuids. This is typically built-in test apps like "Light // config" t...
{ prv_simple_pin_event(timestamp, parent_id, AnalyticsEvent_PinCreated, "created"); }
// ------------------------------------------------------------------------------------------ // Log a pin updated event. void analytics_event_pin_updated(time_t timestamp, const Uuid *parent_id) { prv_simple_pin_event(timestamp, parent_id, AnalyticsEvent_PinUpdated, "updated"); } // ----------------------------...
tubs_hexdump.h" #include "stubs_language_ui.h" #include "stubs_logging.h" #include "stubs_mutex.h" #include "stubs_pbl_malloc.h" #include "stubs_pebble_tasks.h" #include "stubs_prompt.h" #include "stubs_serial.h" #include "stubs_sleep.h" #include "stubs_system_reset.h" #include "stubs_task_watchdog.h" #include "stubs_m...
i18n_ctx_get_length("Quiet Time", "Disabled")
); i18n_free_all(__FILE__); } void test_i18n__ctxt_notfound(void) { const char *first = i18n_ctx_get("badctxt", "Disabled", __FILE__); cl_assert(strcmp(first, "Disabled") == 0); const char *second = i18n_ctx_get("Quiet Time", "Disabled", __FILE__); cl_assert(strcmp(second, "Désactivé") == 0); i18n_ctx_fr...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
MIN(grect_get_max_x(&src_bitmap->bounds), src_row_info.max_x + 1)
&action->attr_list.attributes[1], AttributeIdTitle); // We want to rename the "Clear" action to "Dismiss" if (strcmp(action->attr_list.attributes[1].cstring, "Clear") == 0) { // TODO: PBL-23915 // We leak this i18n'd string because not leaking it is really hard. // We ...
(*buffer, sender, TITLE_MAX_LENGTH, message, MESSAGE_MAX_LENGTH, action_msg, &item->attr_list.attributes[attr_idx], AttributeIdBody)
; attr_idx++; } else if (message && message->length > 0) { *buffer = prv_add_pstring_to_attribute(*buffer, message, MESSAGE_MAX_LENGTH, &item->attr_list.attributes[attr_idx], AttributeIdBody); attr_idx++; } if (app_i...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_IF_RECT_ELSE(1, 4)
, .subtitle_lower_padding = PBL_IF_RECT_ELSE(2, 1), .location_offset = PBL_IF_RECT_ELSE(3, 7), .location_margin = PBL_IF_RECT_ELSE(5, 9), .body_icon_offset = 3, .body_icon_margin = -5, .body_padding = PBL_IF_RECT_ELSE(1, 1), #if PBL_ROUND .timestamp_upper_padding = 6, .timestamp_lower_pa...
status_bar_layer_deinit(&data->status_layer)
; menu_layer_deinit(&data->menu_layer); i18n_free_all(data); prv_clear_alarm_list(data); event_service_client_unsubscribe(&data->alarm_event_info); app_free(data); } static void s_main(void) { prv_handle_init(); app_event_loop(); prv_handle_deinit(); } const PebbleProcessMd* alarms_app_get_info() { ...
EN); prv_read_modify_write(BMI160_REG_INT_EN_0, int_en, int_en); // configure the anymotion interrupt to fire after 4 successcive // samples are over the threhold specified accel_set_shake_sensitivity_high(false /* sensitivity_high */); prv_write_reg(BMI160_REG_INT_MOTION_0, 0x3 << BMI160_INT_MOTION_1_...
{ static bool enable_low_power = false; prv_accel_enable_undersampling(enable_low_power); enable_low_power = !enable_low_power; }
ontentSizeSmall] = PBL_IF_RECT_ELSE(46, MENU_CELL_ROUND_UNFOCUSED_SHORT_CELL_HEIGHT), [PreferredContentSizeMedium] = PBL_IF_RECT_ELSE(46, MENU_CELL_ROUND_UNFOCUSED_SHORT_CELL_HEIGHT), [PreferredContentSizeLarge] = menu_cell_basic_cell_height(), //! @note t...
(s_data, id)
ontext_init(&ctx, fb); // Draw black circles with different alpha values in the stroke color with antialiasing enabled setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 0); graphics_context_set_stroke_color(&ctx, GColorBlack); prv_draw_circles(&ctx); cl_check(gbitmap_pbi_eq(&ctx.des...
(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_BIG, angle_end, angle_start)
; cl_check(framebuffer_is_empty(NULL, ctx.parent_framebuffer, GColorWhite)); // table with most popular angles to test typedef struct { char *filename_part; uint32_t angle; } TestAngles; TestAngles test_angles[] = { { .filename_part = "__1_degrees", .angle = TRIG_MAX_ANGLE / 360, ...
/* * 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_score_info_get_name(VibeScoreId_Reveille)
, "Reveille") == 0); } void test_vibe_score_info__get_name_returns_empty_string_for_invalid_score(void) { cl_assert(strcmp(vibe_score_info_get_name(VibeScoreId_Invalid), "") == 0); } static void prv_test_cycle_next(VibeClient client, const VibeScoreId scores[], size_t scores_size, Vi...
------------------------------- // Test creating a sequence where the first argument is already scheduled and started // // Here's a graph of what we are doing // // 0 60 310 360 380 880 // | | | | | | // ---------------------------------------------...
(&s_stopped_handler_calls, b)
, 1); cl_assert_equal_i(prv_last_update_distance(a), ANIMATION_NORMALIZED_MAX); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, seq), 1); #endif } // -------------------------------------------------------------------------------------- // Test creating a sequence where the first argument i...
+ strlen(token) + 1, "%d", &state->test_entry.in_sleep.max); } else if (strcmp(token, "TEST_IN_DEEP_SLEEP") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.in_deep_sleep.value); } else if (strcmp(token, "TEST_IN_DEEP_SLEEP_MIN") == 0) { sscanf(token + strlen(token) + 1,...
strlen(token)
+ 1, "%d", &state->test_entry.version); } else if (strcmp(token, "TEST_ACTIVITY_TYPE") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.activity_type.value); } else if (strcmp(token, "TEST_ACTIVITY_TYPE_MIN") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_en...
t timer that will periodically check for the erase to complete new_timer_start(s_erase_poll_timer, remaining_ms, prv_flash_erase_timer_cb, NULL, 0); } } static void prv_blocking_erase_complete(void *context, status_t status) { PBL_ASSERT(PASSED(status), "Flash erase failure: %" PRId32, status); } static void ...
(s_flash_lock)
; } #endif void flash_sleep_when_idle(bool enable) { // the S29VS flash automatically enters and exits standby } bool flash_get_sleep_when_idle(void) { return false; } bool flash_is_initialized(void) { return (s_flash_lock != NULL); } void flash_stop(void) { if (!flash_is_initialized()) { // Not yet ini...
rflowModeTrailingEllipsis, GTextAlignmentCenter, NULL); } void draw_text_single_line_ellipsis_clip_across_nx(Layer* me, GContext* ctx) { graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(-44, 4, 72, 32), GTextOverflowModeTrailingEllip...
{ graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(4, 40, 72, 32), GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL); }
void draw_text_single_line_wordwrap_clip_outside_nx(Layer* me, GContext* ctx) { graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(-80, 4, 72, 32), GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL); } void draw_text_single_line_...
lied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "applib/graphics/graphics.h" #include "applib/graphics/graphics_private.h" #include "applib/graphics/graphics_private_raw.h" #include "applib/graphics/gtypes.h" #include "applib/graphics/framebuf...
(prv_left_flip_first_frame_clipping, "left_flip_first_frame_clipping")
; }; // This test records a clipping mask of the 1/4 progress frame of the left "round flip" compositor // transition animation and then clips a full-screen red rectangle to the resulting mask static void prv_left_flip_first_quarter_frame_clipping(GContext *ctx) { compositor_round_flip_transitions_flip_animation_up...
if (!render && node->cached_size.h) { return false; }
if (render && node->cached_size.h) { GRect global_box = grect_to_global_coordinates((GRect) { box->origin, node->cached_size }, ctx); grect_clip(&global_box, &ctx->draw_state.clip_box); if (!global_box.size.h) { return false; } } return true; } static void prv_iter_will_draw(GTextNodeDrawC...
nterpolate_gsize(data->normalized, data->from.size, data->to.size); } static void prv_transform_list(KinoReelTransformData *data) { KinoReel *reel = prv_get_current_reel(data); GDrawCommandList *source_list = kino_reel_get_gdraw_command_list(reel); GDrawCommandList *list = prv_get_or_create_list_copy(data, sourc...
prv_draw_processed_in_global(data, ctx, offset, processor)
; } else { prv_draw_processed_in_local(data, ctx, offset, processor); } } static GDrawCommandList *prv_get_gdraw_command_list(KinoReel *reel) { KinoReelTransformData *data = kino_reel_custom_get_data(reel); if (data) { KinoReel *reel = prv_get_current_reel(data); return kino_reel_get_gdraw_command_...
ntext, true, 2, GColorBlack, GColorBlack, true); 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(&...
graphics_capture_frame_buffer_format(&ctx, GBitmapFormat8Bit)
; cl_assert(ctx.lock == false); cl_assert_equal_p(bmp, NULL); }; void test_graphics_context_${BIT_DEPTH_NAME}__lock_framebuffer_1Bit_on_8BitCircular_must_fail(void) { // Test for locking of 1Bit framebuffer when frambuffer is 8Bit Circular GContext ctx = {.dest_bitmap.info.format = GBitmapFormat8BitCircular}; ...
PBL_IF_COLOR_ELSE(GColorYellow, GColorWhite)
); dialog_set_text_color(dialog, GColorBlack); dialog_set_icon(dialog, RESOURCE_ID_WORKOUT_APP_DETECTED); dialog_set_icon_animate_direction(dialog, DialogIconAnimateNone); dialog_set_destroy_on_pop(dialog, false); const char *dialog_text = workout_utils_get_detection_text_for_activity(data->ongoing_ses...
/* * 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...
(&music_glance->music_event_info)
; kino_reel_destroy(music_glance->icon); } app_free(music_glance); } static void prv_set_glance_icon(LauncherAppGlanceMusic *music_glance, uint32_t new_icon_resource_id) { if (music_glance->icon_resource_id == new_icon_resource_id) { // Nothing to do, bail out return; ...
cl_assert(uuid_equal(&state.pin.header.id, &s_items[3].header.id))
; cl_assert(state.node); cl_assert(iter_prev(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[1].header.id)); } void test_timeline__forward_and_back(void) { Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; // Note: 1421178000 = Tue Jan 13 11:40:00 PST 20...
/* * 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...
(&reset_handler, &initial_stack_pointer)
; dbgserial_print("Booting firmware @ "); dbgserial_print_hex((uintptr_t)reset_handler); dbgserial_print("...\r\n\r\n"); // Disable all interrupts, just in case. for (int i = 0; i < 8; ++i) { // Interrupt Clear-Enable Register NVIC->ICER[i] = 0xFFFFFFFF; // Interrupt Clear-Pending Register N...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&s_connections->node, prv_list_filter_for_addr, (void *) addr)
D, false, 1); for (int16_t row = 0; row < MAX_NUM_ROWS; row++) { graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, row), MAX_NUM_COLS); } cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_odd_offset_even_clip"))); // Clipping on odd boundaries - no offset se...
(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_vert_dotted_line_origin_even_clip")))
; // Clipping on odd boundaries - no offset setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_ODD, ORIGIN_RECT_NO_CLIP, false, 1); for (int16_t col = 0; col < MAX_NUM_COLS; col++) { graphics_draw_vertical_line_dotted(&ctx, GPoint(col, 0), MAX_NUM_ROWS); } cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_...
ache 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 the License is dis...
cl_assert_equal_s(dstbuf, "There are 4 lights")
/* * 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 (new_state == AccessoryInputStateIdle) || (new_state == AccessoryInputStateImaging) || (new_state == AccessoryInputStateMic); }
else if (s_input_state == AccessoryInputStateImaging) { return new_state == AccessoryInputStateMfg; } else if (s_input_state == AccessoryInputStateMic) { return new_state == AccessoryInputStateMfg; } return false; } // The accessory state is used to differentiate between different consumers of the acces...
t); bt_unlock(); return ret_value; } // ------------------------------------------------------------------------------------------------- BTErrno gap_le_connect_cancel_by_bonding(BTBondingID bonding_id, GAPLEClient client) { if (bonding_id == BT_BONDING_ID_INVALID || client >= GAPLEClientNum) { return BTErr...
(bonding_id)
License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific l...
(sizeof(AppMessageReceiver))
; if (!rcv) { return NULL; } rcv->session = session; const size_t header_bytes_remaining = MIN(MAX_HEADER_SIZE, total_payload_size); rcv->header_bytes_remaining = header_bytes_remaining; // Always forward the header to default system receiver as well, we'll cancel it later on if the // message was w...
/* * 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...
hc_protocol_enqueue_with_payload( HcEndpointID_Discovery, HcMessageID_Discovery_Start, (uint8_t *)&payload, sizeof(payload))
; } bool hc_endpoint_discovery_stop(const BTDeviceInternal *address) { return hc_protocol_enqueue_with_payload( HcEndpointID_Discovery, HcMessageID_Discovery_Stop, (uint8_t *)address, sizeof(*address)); } static void prv_handle_new_service_found(const HcProtocolDiscoveryServiceFoundPayload *payload) { GAPLE...
/* * 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(!memory_layout_is_pointer_in_region(&region, (void*) 0))
; cl_assert(!memory_layout_is_pointer_in_region(&region, (void*) 999)); cl_assert(memory_layout_is_pointer_in_region(&region, (void*) 1000)); cl_assert(memory_layout_is_pointer_in_region(&region, (void*) 1500)); cl_assert(memory_layout_is_pointer_in_region(&region, (void*) 1999)); cl_assert(!memory_layout_is_...
include "portmacro.h" // timezone abbreviation static char s_timezone_abbr[TZ_LEN] = { 0 }; // longest timezone abbreviation is 5 char + null static int32_t s_timezone_gmtoffset = 0; static int32_t s_dst_adjust = SECONDS_PER_HOUR; static time_t s_dst_start = 0; static time_t s_dst_end = 0; static const uint8_t s_mon_...
{ break; }
y++; days -= s_year_lengths[yleap]; } } else { do { --y; yleap = YEAR_IS_LEAP(y); days += s_year_lengths[yleap]; } while (days < 0); } res->tm_year = y - TM_YEAR_ORIGIN; res->tm_yday = days; const uint8_t *ip = s_mon_lengths[yleap]; for (res->tm_mon = 0; days >= i...
------------------------------------------------------------------ // Test that we can reschedule an animation after it completes and have it run again void test_animation__reschedule(void) { #ifdef TEST_INCLUDE_BASIC PropertyAnimation *prop_h; Layer layer; GRect from_r; GRect to_r; const int duration = 100; ...
{ reached_end_elapsed = true; }
if (reached_end_elapsed && s_stopped_handler_calls.num_calls == 1 && layer.frame.origin.x < to_r.origin.x) { detected_reset_of_elapsed = true; } cl_assert(max_loops > 0); max_loops--; } // Make sure we detected a reset of the elapsed after rescheduling cl_assert(s_stopped_handler_...
= { .num_attributes = 0, .attributes = NULL, }, .action_group = { .num_actions = 0, .actions = NULL, }, .allocated_buffer = NULL, }, { .header = { // [4] .id = {0x6b, 0xf6, 0x21, 0x5b, 0xc9, 0x7f, 0x40, 0x9e, 0x8c, 0x31, 0x4f, 0x55, 0x65, 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); cl_assert_equal_i(timeline_model_get_num_items(), 2); cl_assert(uuid_equal(&s_items[s_correct_o...
prv_fetch_struct()
; data.rtc_freq = rtc_freq; prv_update_struct(&data); } void mfg_info_get_model(char* buffer) { MfgData data = prv_fetch_struct(); strncpy(buffer, data.model, sizeof(data.model)); data.model[MFG_INFO_MODEL_STRING_LENGTH - 1] = '\0'; // Just in case } void mfg_info_set_model(const char* model) { MfgData da...
p_layer, data->cur_temp_text); snprintf(data->temp_range_text, sizeof(data->temp_range_text), "%d - %d", data->min_temp, data->max_temp); text_layer_set_text(data->temp_range_layer, data->temp_range_text); layer_mark_dirty(window_get_root_layer(data->window)); } // ----------------------------------...
(window_layer, text_layer_get_layer(data->temp_range_layer))
; // Update UI cur_temp_update_text(data); // Subscribe to second tick for updates tick_timer_service_subscribe(SECOND_UNIT, handle_second_tick); } // ------------------------------------------------------------------------------- static void prv_window_unload(Window *window) { TemperatureDemoAppData *dat...
_value_t prv_event_listener_extract_args(const jerry_length_t argc, const jerry_value_t argv[], char *event_name, size_t event_name_size, jerry_value_t *func) { ...
rocky_delete_singleton()
; #endif } static bool prv_has_any(jerry_value_t event_listeners, uint32_t idx, jerry_value_t listener, void *data) { *(bool *)data = true; return false; } bool rocky_global_has_event_handlers(const char *event_name) { bool result = false; prv_iterate_event_listeners(event_name, prv_ha...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ const HcGapLeConnectionData *e = (HcGapLeConnectionData *)msg->payload; bt_driver_handle_le_connection_complete_event(&e->connection_complete_event); const GattDeviceConnectionEvent gatt_event = { .dev_address = e->connection_complete_event.peer_address.address, .connection_id = 0, /...
case HcMessageID_GapLEConnect_DisconnectionComplete: { const BleDisconnectionCompleteEvent *e = (BleDisconnectionCompleteEvent *)msg->payload; GattDeviceDisconnectionEvent gatt_event = { .dev_address = e->peer_address.address, }; bt_driver_cb_gatt_handle_disconnect(&gatt_event); ...
); // Connect PA6 to SPI1_MISO GPIO_PinAFConfig(FLASH_GPIO, GPIO_PinSource6, GPIO_AF_SPI1); // Connect PA7 to SPI1_MOSI GPIO_PinAFConfig(FLASH_GPIO, GPIO_PinSource7, GPIO_AF_SPI1); GPIO_InitTypeDef gpio_cfg; gpio_cfg.GPIO_OType = GPIO_OType_PP; gpio_cfg.GPIO_PuPd = GPIO_PuPd_NOPULL; gpio_cfg.GPIO_Mod...
{ return false; }
} } return true; } uint32_t flash_whoami(void) { assert_usable_state(); flash_lock(); if (!flash_is_enabled()) { flash_unlock(); return 0; } enable_flash_spi_clock(); handle_sleep_when_idle_begin(); flash_wait_for_write_bounded(64000000); flash_start_cmd(); flash_send_and_receiv...
} static void prv_select_click_handler(ClickRecognizerRef recognizer, void *context) { DisplayCalibrationData *data = context; if (data->state == DisplayCalibrationState_Confirm) { // set a new user offset shell_prefs_set_display_offset(data->offset); analytics_inc(ANALYTICS_DEVICE_METRIC_DISPLAY_OFFSE...
(&data->arrow_up, RESOURCE_ID_ARROW_UP)
; prv_init_arrow_bitmap(&data->arrow_right, RESOURCE_ID_ARROW_RIGHT); window_stack_push(window_stack, window, true /* animated */); } #endif
bt_persistent_storage_set_unfaithful(true)
; if (bt_driver_supports_bt_classic()) { bt_driver_classic_update_connectability(); } bt_persistent_storage_set_cached_system_capabilities(NULL); } } bool bt_persistent_storage_get_active_gateway(BTBondingID *bonding_out, BtPersistBondingType *type_out)...
yer = window_get_root_layer(&data->status_window); GRect bounds = window_layer->bounds; bounds.origin.y += 40; // Init text layer text_layer_init(&data->status_text, &bounds); text_layer_set_text(&data->status_text, data->status_string); text_layer_set_text_alignment(&data->status_text, GTextAlignmentCenter...
{ switch (index->row) { case RXMenuIdx_Channel: title = "Channel"; itoa_int(data->channel, subtitle_buffer, 10); subtitle = subtitle_buffer; break; #if CAPABILITY_HAS_BUILTIN_HRM case RXMenuIdx_HRM: title = "HRM"; subtitle = data->is_hrm_enabled ? "Enabled...
else { WTF; } menu_cell_basic_draw(ctx, cell, title, subtitle, NULL); } static void prv_menu_select_click(MenuLayer *menu_layer, MenuIndex *index, void *context) { AppData *data = context; if (data->current_test == BTLETestType_TX) { const uint16_t row = prv_compensated_tx_menu_row_idx(index, data); ...
(NULL, 0, &s_recognizers_reset); cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersActive); cl_assert_equal_p(manager.triggered, NULL); cl_assert_equal_i(recognizers[0]->state, RecognizerState_Possible); cl_assert_equal_i(recognizers[4]->state, RecognizerState_Possible); // A touchdown occur...
(!manager.active_layer)
; cl_assert_equal_i(manager.state, RecognizerManagerState_WaitForTouchdown); cl_assert_equal_i(r2->state, RecognizerState_Possible); cl_assert(!recognizer_get_manager(r1)); recognizer_set_manager(r1, &manager); r1->state = RecognizerState_Possible; r2->state = RecognizerState_Started; manager.active_laye...
/* * 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...
graphics_draw_pixel(ctx, GPoint(5, 5))
; } void white_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorWhite); graphics_draw_pixel(ctx, GPoint(5, 5)); } void clear_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorClear); graphics_draw_pixel(ctx, GPoint(5, 5...
/* * 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->units_font)
; GTextNodeHorizontal *horiz_container = graphics_text_node_create_horizontal(MAX_TEXT_NODES); GTextNodeContainer *container = &horiz_container->container; horiz_container->horizontal_alignment = GTextAlignmentCenter; if (data->now_bpm == 0) { health_util_create_text_node_with_text( EM_DASH, fonts...
/* * 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...
launcher_app_glance_structured_get_data(structured_glance)
; if (music_glance) { event_service_client_unsubscribe(&music_glance->music_event_info); kino_reel_destroy(music_glance->icon); } app_free(music_glance); } static void prv_set_glance_icon(LauncherAppGlanceMusic *music_glance, uint32_t new_icon_resource_id) { if (music_gl...
/* * 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, "Trying to use the activity algorithm but it hasn't been initialized")
; return false; #else WTF; #endif } mutex_lock_recursive(s_alg_state->mutex); return true; } static void prv_unlock(void) { mutex_unlock_recursive(s_alg_state->mutex); } // ---------------------------------------------------------------------------------------------- // Open the minute data settings f...
(); cl_assert_equal_b(app_message_is_accepting_outbound(), false); prv_call_outbox_sent(AppOutboxStatusSuccess); cl_assert_equal_b(s_nack_sent_is_called, true); cl_assert_equal_i(s_out_sent_call_count, 0); cl_assert_equal_i(s_out_failed_call_count, 1); cl_assert_equal_i(s_failure_result, APP_MSG_SEND_REJ...
app_message_is_accepting_inbound()
/* * 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_connected = true; // Flood bluetooth while (s_connected) { while (s_pending_count > 6 && s_connected) { psleep(100); } s_pending_count++; system_task_add_callback(send_bluetooth, NULL); } PBL_LOG(LOG_LEVEL_INFO, "Bluetooth disconnected"); }
else if (index == 1) { PBL_LOG(LOG_LEVEL_DEBUG, "Not implemented"); } } // ================================================================================= static void prv_window_load(Window *window) { TestBTAppData *data = s_app_data; int i = 0; data->menu_items[i++] = (SimpleMenuItem) { .ti...
the state machine. Delay the update to allow the battery voltage to // settle and to debounce reconnection events prv_schedule_update(RECONNECTION_DELAY_MS, true); } PreciseBatteryChargeState prv_get_precise_charge_state(const BatteryState *state) { PreciseBatteryChargeState event_state = { .charge_percent ...
if (!strcmp("enable", option)) { prv_set_forced_charge_state(true); }
}
!= ActivitySessionTypeCount); ActivitySession session = { .type = activity, .start_utc = start_utc, .length_min = len_sec / SECONDS_PER_MINUTE, .ongoing = ongoing, .step_data = { .steps = steps, .active_kcalories = ROUND(active_calories, ACTIVITY_CALORIES_PER_KCAL), .resting_kc...
{ goto exit; }
See the License for the specific language governing permissions and * limitations under the License. */ #include "weather_service.h" #include "weather_service_private.h" #include "applib/event_service_client.h" #include "kernel/events.h" #include "kernel/pbl_malloc.h" #include "os/mutex.h" #include "services/common...
uuid_to_string(key, key_string_buffer)
alculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 // SW = 1 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, false, 1); graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw1...
(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, false, 5)
; graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw5_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // SW = 11 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, false, 11); graphics_draw_round_rect(&ctx...
t) { uint32_t total_size = sizeof(Dictionary); if (tuplets_count == 0) { return total_size; } for (unsigned int i = 0; i < tuplets_count; ++i) { const Tuplet * const tuplet = &tuplets[i]; switch (tuplet->type) { case TUPLE_BYTE_ARRAY: total_size += tuplet->bytes.length; break; ...
if (result != DICT_OK) { return result; }
east 1 ms to prevent fake button events psleep(2); #endif for (int i = 0; i < NUM_BUTTONS; ++i) { const ExtiConfig config = BOARD_CONFIG_BUTTON.buttons[i].exti; exti_configure_pin(config, ExtiTrigger_RisingFalling, prv_button_interrupt_handler); exti_enable(config); } initialize_button_timer(); ...
(is_button_down_event)
ScrollLayer* scroll_layer_create(GRect frame) { ScrollLayer *layer = applib_type_malloc(ScrollLayer); if (layer) { scroll_layer_init(layer, &frame); } return layer; } bool scroll_layer_is_instance(const Layer *layer) { return layer && layer->property_changed_proc == scroll_layer_property_changed_proc; } ...
(scroll_layer->animation)
; if (scroll_layer_get_paging(scroll_layer)) { animation_set_custom_interpolation(animation, interpolate_moook); animation_set_duration(animation, interpolate_moook_duration()); } animation_set_auto_destroy(animation, false); } animation_schedule(animation); } else { prv_...
ee the License for the specific language governing permissions and * limitations under the License. */ #include "applib/graphics/framebuffer.h" #include "applib/graphics/graphics.h" #include "applib/ui/action_menu_hierarchy.h" #include "applib/ui/action_menu_layer.h" #include "applib/ui/action_menu_window.h" #includ...
load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false /* is_next */)
; resource_init(); } void test_action_menu_window__cleanup(void) { free(fb); gbitmap_destroy(s_dest_bitmap); s_dest_bitmap = NULL; } // Helpers ////////////////////// static void prv_action_menu_did_close_cb(ActionMenu *action_menu, const ActionMenuItem *item, ...
nvas_layer->bounds; const GRect *frame = &data->canvas_layer->frame; graphics_context_set_stroke_color(ctx, GColorGreen); graphics_draw_rect(ctx, &GRect(bounds->origin.x + frame->origin.x, bounds->origin.y + frame->origin.y, bounds->size.w, bounds...
GPoint(p0.x.integer, p0.y.integer)
, GPoint(p1.x.integer, p1.y.integer)); } return; } if (data->operation == OP_ROTATE3) { int line_length = 60; time_t now; uint16_t now_ms = time_ms(&now, NULL); uint32_t seconds = pbl_override_localtime(&now)->tm_sec; uint32_t miliseconds = seconds * 1000 + no...
etup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 1), MAX_NUM_COLS); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 3), 148); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 5), 0); graphics_draw_horizontal_line_dotted(...
TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_even_offset_even_rows_no_clip")
)); // Odd rows of different lengths setup_test_aa_sw(&ctx, fb, OFFSET_RECT_EVEN, OFFSET_RECT_EVEN, false, 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 1), MAX_NUM_COLS); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 3), MAX_NUM_COLS + 4); graphics_draw_horizontal_line_dotted(&ctx, GPoint(...
r_time, cur_millis); jerry_value_t now = rocky_util_create_date(NULL); jerry_value_t getSeconds = jerry_get_object_field(now, "getSeconds"); jerry_value_t getMinutes = jerry_get_object_field(now, "getMinutes"); jerry_value_t getHours = jerry_get_object_field(now, "getHours"); jerry_value_t getDate = jerry_ge...
(result_date)
, 30.0); cl_assert_equal_d(jerry_get_number_value(result_month), 9.0); cl_assert_equal_d(jerry_get_number_value(result_year), 116.0); jerry_release_value(result_year); jerry_release_value(result_month); jerry_release_value(result_date); jerry_release_value(result_hours); jerry_release_value(result_minute...
472, 448, -584}, { -1720, 256, -496}, { -1776, 360, -488}, { -1280, 208, -312}, { -1160, 416, -280}, { -1144, 520, -216}, { -1064, 456, -168}, { -920, 480, -224}, { -800, 504, -216}, { -912, 688, -176}, { -872, 584, -168}, { -1616, 696, -40}, { -1336, 608, -264}, { -1...
{ -616, 440, 224}, { -696, 360, 184}, { -728, 448, 232}, { -968, 544, 224}, { -1352, 776, 232}, { -1736, 872, 424}, { -1624, 744, 656}, // 49 seconds { -808, 800, -72}, { -1040, 848, -64}, { -1104, 520, 64}, { -1056, 360, -8}, { -888, 296, -8}, { -832, 232, 0}, ...
{ -1192, -152, -16}, { -1024, -32, 0}, { -984, 56, 16}, { -1048, 72, 32}, { -872, 64, -32}, { -1104, 64, -32}, { -1024, 144, -392}, { -928, 144, -368}, { -1192, -96, -392}, { -1248, -392, -168}, { -1296, -168, -176}, { -1248, 224, -184}, { -1168, 344, -88}, { -12...
icular region. // @param[in] new If true, then return a pointer to a region where a new image can be stored. // If false, then return the region containing the most recent stored image or // CORE_DUMP_FLASH_INVALID_ADDR if no image has been written. // @return flash base address to use s...
{ PBL_ASSERTN(false); }
// Create the packed chunk header strncpy ((char *)packed_info.name, task_info->pcName, CORE_DUMP_THREAD_NAME_SIZE); packed_info.id = (uint32_t)task_info->taskHandle; packed_info.running = (current_task_id == task_info->taskHandle); for (int i = 0; i < portCANONICAL_REG_COUNT; i++) { // registers [r0-r1...
e the transition can do render by its own WindowTransitioningContext *const transition_context = &stack->transition_context; transition_context->implementation->render(transition_context, ctx); } else { PROFILER_NODE_START(render_modal); window_render(window, ctx); PROFILER_NODE_STOP(render_modal)...
if (modal_manager_get_enabled()) { for (ModalPriority priority = 0; priority < NumModalPriorities; ++priority) { WindowStack *window_stack = modal_manager_get_window_stack(priority); info->counts[priority] = window_stack_dump(window_stack, ...
pePath, .hidden = false, .stroke_color = GColorGreen, .stroke_width = 1, .fill_color = GColorPurple, .path_open = false, .num_points = 3, }; GPoint points2[] = { { 6, 7 }, {5, 5}, { 0, 0 } }; memcpy(command->points, points2, sizeof(points2)); return command_list; } void test_gdraw_comm...
(image, size + 1)
); cl_assert_equal_i(size, gdraw_command_image_get_data_size(image)); image->version = 2; cl_assert(!gdraw_command_image_validate(image, size)); free(image); } void test_gdraw_command__clone_image(void) { cl_assert_equal_p(gdraw_command_image_clone(NULL), NULL); size_t size = sizeof(GDrawCommandImage) ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_get_point_between_points(segment->points[0], segment->points[3], end)
; } else if (segment->type == HealthProgressSegmentType_Horizontal) { p1 = prv_get_point_between_points(segment->points[0], segment->points[1], start); p2 = prv_get_point_between_points(segment->points[3], segment->points[2], start); p3 = prv_get_point_between_points(segment->points[3], segment->points[2]...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_ASSERTN(item)
; } if (item) { pin_db_insert_item(item); timeline_item_destroy(item); } } static void prv_create_list_view_and_render(ListViewConfig *config) { pin_db_init(); for (int i = 0; i < (int)ARRAY_LENGTH(config->pins); i++) { if (config->pins[i]) { prv_add_timeline_item(config->pins[i], config->...
Stubs #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_logging.h" #include "test_recognizer_impl.h" static bool s_manager_state_change = false; void recognizer_manager_handle_state_change(RecognizerManager *manager, Recognizer *changed) { s_manager_state_change = true; } static TestImplData ...
cl_assert_passert(recognizer_transition_state(r, RecognizerState_Completed))
; cl_assert_passert(recognizer_transition_state(r, RecognizerState_Started)); r->state = RecognizerState_Possible; cl_assert_passert(recognizer_transition_state(r, RecognizerState_Possible)); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Updated)); cl_assert_passert(recognizer_transition_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...
if (linear_distance < ANIMATION_NORMALIZED_MAX/2) { return linear_distance * 2; } else if (linear_distance < ANIMATION_NORMALIZED_MAX * 3/4) { return ANIMATION_NORMALIZED_MAX * 3/2 - linear_distance; } else { return linear_distance; }
} static void click_handler(ClickRecognizerRef recognizer, Window *window) { AnimatedDemoData *data = window_get_user_data(window); Layer *layer = &data->text_layer.layer; GRect to_rect; if (data->toggle) { to_rect = GRect(4, 4, 120, 60); } else { to_rect = GRect(84, 92, 60, 60); } data->toggle...
v_ac[2] - v_ab[2] * v_ac[1]; plane_eq[1] = -v_ab[0] * v_ac[2] + v_ab[2] * v_ac[0]; plane_eq[2] = v_ab[0] * v_ac[1] - v_ab[1] * v_ac[0]; // solve for d plane_eq[3] = -(plane_eq[0] * s_samples[0][0] + plane_eq[1] * s_samples[0][1] + plane_eq[2] * s_samples[0][2]); // Distance^2 = (a * xo + b * yo + c * ...
{ return (MagCalStatusNoSolution); }
} else if (s_sample_idx == 3) { if (!pt_to_plane_dist_under_thresh(0, 1, 2, 3, thresh)) { return (MagCalStatusNoSolution); } } // the sample has passed its distance threshold check so add it PBL_LOG(LOG_LEVEL_DEBUG, "---> [%d] Adding %d %d %d \n", s_sample_idx, (int)sample[0], (int)sample[...
esult in syscalls sometimes // failing when the app hasn't done anything wrong. portSTACK_TYPE *stack = memory_segment_split(&app_segment, NULL, stack_size); PBL_ASSERTN(stack); s_app_task_context.load_start = app_segment.start; g_app_load_address = app_segment.start; void *entry_point = process_loader_load...
(LOG_LEVEL_DEBUG, "Starting %s", task_name)
; // Store slot of launched app for reboot support (flash apps only) reboot_set_slot_of_last_launched_app( (app_md->process_storage == ProcessStorageFlash) ? process_metadata_get_code_bank_num(app_md) : SYSTEM_APP_BANK_ID); pebble_task_create(PebbleTask_App, &task_params, &s_app_task_context.tas...
/* * 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...
(&launcher_event)
; } void notifications_handle_notification_added(Uuid *notification_id) { PebbleEvent launcher_event = { .type = PEBBLE_SYS_NOTIFICATION_EVENT, .sys_notification = { .type = NotificationAdded, .notification_id = notification_id } }; event_put(&launcher_event); analytics_inc(ANALYTICS_DE...