prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
/* * 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...
fseek(resource_file, start_bytes, SEEK_SET)
; return fread(buffer, 1, num_bytes, resource_file); } return 0; } bool sys_resource_bytes_are_readonly(void *bytes) { return false; } const uint8_t *sys_resource_read_only_bytes(ResAppNum app_num, uint32_t resource_id, size_t *num_bytes_out) { return NULL; } ...
&& expire_ms <= 100); PBL_LOG(LOG_LEVEL_DEBUG, "STT firing in %d ms", (int)expire_ms); // Wait for it to fire psleep(300); PBL_ASSERTN(s_app_data->fired_time[timer_idx_0] != 0); scheduled = new_timer_scheduled(s_app_data->timer[timer_idx_0], &expire_ms); PBL_ASSERTN(!scheduled); } // ====================...
(s_app_data->timer[0], 1, timer_callback, cb_data, TIMER_START_FLAG_FAIL_IF_SCHEDULED)
; PBL_ASSERTN(!success); } // ================================================================================= void evented_timer_menu_cb(int index, void *ctx) { void *cb_data = 0; menu_callback_prefix(index, ctx); // Test evented_timer s_app_data->app_timer = app_timer_register(100 /*ms*/, timer_callb...
= play_count; } return true; } // ------------------------------------------------------------------------------------------- uint32_t animation_get_play_count(Animation *animation_h) { AnimationState *state = prv_animation_state_get(PebbleTask_Current); PBL_ASSERTN(!animation_private_using_legacy_2(state));...
prv_call_using_vargs(animation_sequence_create_from_array, animation_a, animation_b, animation_c, args)
; va_end(args); return animation; } // ------------------------------------------------------------------------------------------- Animation *animation_spawn_create_from_array(Animation **animation_array, uint32_t array_len) { PBL_ASSERTN(!animation_private_using_legacy_2(NULL)); Animation *spawn = prv_comple...
(GPoint) {.x = mid_pixel_minus_one + i, .y = pixel_min + TICK_LENGTH}); graphics_draw_line(ctx, (GPoint) {.x = mid_pixel_minus_one + i, .y = pixel_max - TICK_LENGTH}, (GPoint) {.x = mid_pixel_minus_one + i, .y = pixel_max}); graphics_draw_line(ctx, (GPoint) {.x = pixe...
app_malloc_check(sizeof(AppData))
dvance_to_ms_with_timers(start_ms + delay_a + MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); animation_set_elapsed(a, duration_a - leftover_a); cl_assert_equal_i(prv_count_handler...
(a, duration_a)
; animation_set_delay(a, delay_a); uint64_t start_ms = prv_now_ms(); animation_schedule(a); // ------------------------------------------------------------------------------------- // Got partway through the delayof a prv_advance_to_ms_with_timers(start_ms + 100); cl_assert_equal_i(prv_count_handler_en...
sic_pairing(&addr_1, &link_key_1, name_1, &platform_bits_1); prv_fire_writeback_timer(); cl_assert(id_1 != BT_BONDING_ID_INVALID); // Read it back ret = bt_persistent_storage_get_bt_classic_pairing_by_id(id_1, &addr_out, &link_key_out, ...
cl_assert_equal_i(platform_bits_in, platform_bits_out)
; } void test_bluetooth_persistent_storage_prf__delete_bt_classic_pairing_by_id(void) { bool ret; // Output variables BTDeviceAddress addr_out; SM128BitKey link_key_out; char name_out[BT_DEVICE_NAME_BUFFER_SIZE]; uint8_t platform_bits_out; // Store a new pairing BTDeviceAddress addr_in = {.octets = {...
(s_watch_app_prefs_db.mutex); return result; } void watch_app_prefs_destroy_weather(SerializedWeatherAppPrefs *prefs) { if (prefs) { task_free(prefs); } } // BlobDB APIs //////////////////////////////////////////////////////////////////////////////// void watch_app_prefs_db_init(void) { s_watch_app_prefs_...
{ status_t rv = prv_lock_mutex_and_open_file(); if (rv == S_SUCCESS) { rv = settings_file_delete(&s_watch_app_prefs_db.settings_file, key, key_len); prv_close_file_and_unlock_mutex(); } return rv; }
status_t watch_app_prefs_db_flush(void) { mutex_lock_recursive(s_watch_app_prefs_db.mutex); status_t rv = pfs_remove(SETTINGS_FILE_NAME); mutex_unlock_recursive(s_watch_app_prefs_db.mutex); return rv; }
/* * 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...
(second, 0)
; } { time_util_split_seconds_into_parts((3 * (24 * 60 * 60)) + (2 * (60 * 60)) + (4 * 60) + 5, &day, &hour, &minute, &second); cl_assert_equal_i(day, 3); cl_assert_equal_i(hour, 2); cl_assert_equal_i(minute, 4); cl_assert_equal_i(second, 5); } }
line_layer_get_current_layout(&data->timeline_layer); if (first_timeline_layout && use_pin) { GRect frame; timeline_layer_get_layout_frame(&data->timeline_layer, TIMELINE_LAYER_FIRST_VISIBLE_LAYOUT, &frame); timeline_layout_get_icon_frame(&frame, data->timeline_layer.sc...
prv_set_state(data, TimelineAppStateInactive)
; prv_exit(data); } static void prv_inactive_timer_refresh(TimelineAppData *data) { static const uint32_t INACTIVITY_TIMEOUT_MS = 30 * 1000; s_app_data->inactive_timer_id = evented_timer_register_or_reschedule( s_app_data->inactive_timer_id, INACTIVITY_TIMEOUT_MS, prv_inactive_timer_callack, data); } ////...
ry time //! the system boots up a different file is used. This leaves the file from the previous boot intact in case we previously //! crashed. //! //! Files are referred to in multiple ways. The "file generation" is how recent the file is. 0 is the generation of the current //! boot, 1 is the generation of the previou...
(file_id[i - 1], file_id[i], FILE_ID_BIT_WIDTH)
; if (distance < 0 || distance > 2) { *current_file_id = get_next_file_id(file_id[i - 1]); *current_file_index = i; return; } } } // Everything was increasing which means everything was in order from oldest to newest // and we need to wrap around. *current_file_index = 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...
(BUTTON_ID_SELECT, prv_button_click_handler)
; window_single_click_subscribe(BUTTON_ID_DOWN, prv_button_click_handler); } static void init_arrow_layer_for_button(AppData *data, ButtonId id) { static GPoint ARROW_PATH_POINTS[] = {{0, 7}, {14, 7}, {14, 0}, {26, 12}, {14, 24}, {14, 17}, {0, 17}}; static const GPathInfo ARROW_PATH_INFO = { .num_po...
/* * 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...
app_state_get_app_outbox_subscription_info()
; *info = (EventServiceInfo) { .type = PEBBLE_APP_OUTBOX_SENT_EVENT, .handler = prv_handle_event, }; event_service_client_subscribe(info); }
st_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 4); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw4_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RE...
(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw2_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, false, 2); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,...
urces.h" #include "resource/resource_storage_impl.h" #include <limits.h> #include <stdio.h> #include <stdlib.h> typedef struct { uint32_t offset; uint32_t length; } Resource; #define MANIFEST_SIZE (sizeof(ResourceManifest)) #define TABLE_ENTRY_SIZE (sizeof(ResTableEntry)) #define MAX_RESOURCES_FOR_SYSTEM_STORE ...
{ printf("%s: Failed to read table entry for %d\n", __FILE__, resource_id); return false; }
if ((entry.resource_id != resource_id) || (entry.length == 0)) { // empty resource printf("%s: Invalid resourcel for %d\n", __FILE__, resource_id); return false; } res->offset = SYSTEM_STORE_METADATA_BYTES + entry.offset; res->length = entry.length; return true; } //////////////////////...
*)active_window; window_set_on_screen(window, true, true); window_render(window, &s_ctx); } // Workout Tests ////////////////////// void test_workout_active__workout_render_no_data(void) { s_workout_data = (WorkoutData) {}; WorkoutActiveWindow *active_window = workout_active_create_for_activity_type( A...
(active_window, 0)
; cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_workout_active__workout_render_hr_zone_2(void) { s_workout_data = (WorkoutData) { .steps = 567, .duration_s = 789, .distance_m = 234, .avg_pace = health_util_get_pace(789, 234), .bpm = 167, .hr_zone = 2, }; Work...
(scroll_layer, true); scroll_layer_set_context(scroll_layer, menu_layer); menu_layer_set_normal_colors(menu_layer, GColorWhite, GColorBlack); menu_layer_set_highlight_colors(menu_layer, GColorBlack, GColorWhite); InverterLayer *inverter = &menu_layer->inverter; inverter_layer_init(inverter, &GRectZero); s...
menu_layer_set_selected_index(menu_layer, selected_index, MenuRowAlignNone, animated)
; } void menu_layer_set_callbacks(MenuLayer *menu_layer, void *callback_context, const MenuLayerCallbacks *callbacks) { if (callbacks) { menu_layer->callbacks = *callbacks; PBL_ASSERTN(menu_layer->callbacks.draw_row); PBL_ASSERTN(menu_layer->callbacks.get_num_rows); } men...
} // Word Wrap Tests void draw_text_single_line_wordwrap_clip_across_ny(Layer* me, GContext* ctx) { graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(4, -18, 72, 32), GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL); } void dra...
layer_render_tree(&canvas, &ctx)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_ellipsis_clip_across_ny_descender.${BIT_DEPTH_NAME}.pbi")); // Ellipsis tests test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_ellipsis_clip_across_ny); layer_render_tree(&canvas, &ctx); cl_check(g...
layer_convert_point_to_screen(layer, GPointZero)
, .size = layer->frame.size, }; } bool layer_contains_point(const Layer *layer, const GPoint *point) { if (!layer || !point) { return false; } #if CAPABILITY_HAS_TOUCHSCREEN if (layer->contains_point_override) { return layer->contains_point_override(layer, point); } #endif return grect_contains...
, s_stroke_points, s_path_num_points)); cl_assert_equal_p(s_fill_points, NULL); prv_reset(); // restore radius and set hidden - nothing should be drawn gdraw_command_set_radius(command, 300); gdraw_command_set_hidden(command, true); gdraw_command_draw(NULL, command); cl_assert_equal_i(s_stroke_color.argb...
cl_assert_equal_i(s_path_stroke_count, 0)
; cl_assert_equal_i(s_path_fill_count, 0); cl_assert_equal_i(s_circle_stroke_count, 0); cl_assert_equal_i(s_circle_fill_count, 0); free(command_list); } void test_gdraw_command__validate_list(void) { GDrawCommandList *command_list = prv_create_command_list_3(); size_t size = sizeof(GDrawCommandList) + (3 ...
VENT, .handler = prv_capabilities_changed_event_handler, }; event_service_client_subscribe(&s_capabilities_event_info); #endif } bool app_install_id_from_system(AppInstallId id) { return (id < INSTALL_ID_INVALID); } bool app_install_id_from_app_db(AppInstallId id) { return (id > INSTALL_ID_INVALID); } st...
(reg_entry->name, entry->name, APP_NAME_SIZE_BYTES)
; rv = true; done: kernel_free(app_header); return rv; } bool prv_app_install_entry_from_fw_registry_entry(const AppRegistryEntry *reg_entry, AppInstallEntry *entry) { const PebbleProcessMdSystem *md = (PebbleProcessMdSystem *) reg_entry->md_fn(); if (!md) { return false; } *entry = (AppInstal...
se"); * 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, * WITH...
(inset_amount - 1, MIN(outer_point.y, frame->size.h - inset_amount))
}; } #endif //////////////////////////////////////////////////////////////////////////////////////////////////// // UI Drawing static void prv_draw_outer_ring(GContext *ctx, int32_t current, int32_t total, int32_t fill_thickness, GRect frame, GColor color) { graphics_context_set_f...
_ble_client_write, BLECharacteristic characteristic, const uint8_t *value, size_t value_length) { return gatt_client_op_write(characteristic, value, value_length, GAPLEClientApp); } DEFINE_SYSCALL(BTErrno, sys_ble_client_writ...
{ return gatt_client_characteristic_get_service(characteristic); }
DEFINE_SYSCALL(void, sys_ble_characteristic_get_device, BTDevice *device, BLECharacteristic characteristic) { if (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(device, sizeof(*device)); } *device = gatt_client_characteristic_get_device(characteristic).opaque; } DEFINE_SYSCALL(uin...
t timeout_ms; //! Whether or not writes are being blocked bool write_blocked; //! Whether or not this attribute has a deferred delete pending bool deferred_delete; } SmartstrapAttributeInternal; typedef struct { uint16_t service_id; uint16_t attribute_id; } AttributeFilterContext; typedef enum { Attribu...
mutex_assert_held_by_curr_task(s_attr_list_lock, true)
; SmartstrapAttributeInternal *attr; FOREACH_VALID_ATTR(attr) { if ((attr->service_id == service_id) && (attr->attribute_id == attribute_id)) { return attr; } } return NULL; } //! NOTE: the caller must hold s_attr_list_lock static SmartstrapAttributeInternal *prv_find_by_buffer(uint8_t *buffer) {...
ill be //! moved into the shift register (with a new byte being loaded into the buffer) before we receive //! the byte we previously sent. So, when we receive a byte, we will have sent 2 more bytes by then. #define SEND_HISTORY_LENGTH (1) //! Within accessory_send_stream(), how long we wait for a byte to be sent before...
{ // The accessory connector didn't have any data since the last time this callback fired. ++s_stop_mode_monitor.intervals_without_data; if (s_stop_mode_monitor.intervals_without_data >= s_stop_mode_monitor.max_intervals_without_data) { // Enough intervals have passed and we should now turn s...
else { // Data was seen, reset the interval counter s_stop_mode_monitor.intervals_without_data = 0; } // Regardless of what happened, this interval is over and should be reset s_stop_mode_monitor.data_seen_this_interval = false; } static void prv_start_timer_cb(void *context) { new_timer_start(s_stop...
" // FW Includes /////////////// #include "services/normal/blob_db/api.h" #include "services/normal/blob_db/util.h" #include "services/normal/blob_db/sync.h" #include "util/size.h" // Writebacks counter //////////////////////// static int s_num_writebacks; static int s_num_until_timeout; void blob_db_endpoint_send...
(&dirty_list->node)
, ARRAY_LENGTH(keys)); for (int i = 0; i < ARRAY_LENGTH(keys); ++i) { cl_assert(list_find(&dirty_list->node, prv_list_key_comparator, keys[i]) != NULL); } blob_db_util_free_dirty_list(dirty_list); // mark one as synced and re-check for (int synced_idx = 1; synced_idx < ARRAY_LENGTH(keys); ++synced_idx)...
g, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "apps/system_apps/health/health_data.h" #inc...
(&health_data)
; cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_health_activity_summary_card__render_current_behind_typical2(void) { HealthData health_data = { .step_data = 320, .step_averages = {10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10...
do_not_disturb_is_active(); cl_assert(active == true); // !Manual && Scheduled && !Smart do_not_disturb_set_manually_enabled(false); cl_assert(do_not_disturb_is_active() == false); do_not_disturb_toggle_scheduled(WeekdaySchedule); // see PBL-22011 cl_assert(do_not_disturb_is_active() == false); do_not_...
{ bool active; // Time 00:00, Manual and Scheduled DND both OFF DoNotDisturbSchedule schedule = { .from_hour = 1, .from_minute = 0, .to_hour = 12, .to_minute = 30, }; do_not_disturb_set_schedule(WeekdaySchedule, &schedule); cl_assert(do_not_disturb_is_manually_enabled() == false); cl_asser...
cl_assert(do_not_disturb_is_schedule_enabled(WeekdaySchedule) == true); cl_assert(do_not_disturb_is_manually_enabled() == false); } void test_do_not_disturb__change_schedule_while_in_scheduled(void) { bool active; // Time 00:00, Manual and Scheduled DND both OFF DoNotDisturbSchedule schedule_1 = { .from...
//////////////////////////////// // Compass subscription state variables static uint8_t s_compass_subscribers_count = 0; static bool s_compass_subscribers[NumPebbleTask] = { 0 }; ////////////////////////////////////////////////////////////////////////////////// // Accel service state variables static AccelServiceSt...
PBL_LOG(LOG_LEVEL_DEBUG, "Calibration time expired, complete, or app exit, " "dropping back to low frequency")
; if (!mag_change_sample_rate(MagSampleRate5Hz)) { PBL_LOG(LOG_LEVEL_WARNING, "Forcing reset to enter low freq mode"); mag_release(); mag_start_sampling(); } s_high_freq_calib_active = false; regular_timer_remove_callback(&s_cb_info); } static void prv_accel_for_compass_handler(AccelRawData *d, u...
/* * 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...
(num_pixels, GDRAWMASK_BITS_PER_PIXEL)
; GDrawMask *result = applib_zalloc( sizeof(*result) + num_bytes_needed_for_mask_row_infos + num_bytes_needed_for_pixel_mask_data); if (result) { // We store the mask_row_infos first in the .data buffer, followed by the pixel_mask_data *result = (GDrawMask) { .mask_row_infos = (GDrawMaskRowInfo *...
/* * 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...
(SOME_DATA_KEY, SOME_DATA, sizeof(SOME_DATA))
, TupletCString(SOME_STRING_KEY, SOME_STRING), TupletInteger(SOME_UINT32_KEY, (uint32_t) 32), }; const uint32_t size = dict_calc_buffer_size_from_tuplets(tuplets, 3); cl_assert(size == sizeof(Dictionary) + (3 * sizeof(Tuple)) + sizeof(SOME_DATA) + strlen(SOME_STRING) + 1 + sizeof(uint32_t)); struct Ser...
e. When //! we see this, we just try and make sure the app is not stuck in privilege code. If it's not, we return true //! and allow the caller to kill the task. //! //! If however, the task is in privilege mode, we tell the syscall machinery to set the safe to kill boolean as //! soon as the current syscall returns an...
if (context->app_md->process_storage == ProcessStorageFlash) { const Heap *heap; if (task == PebbleTask_App) { heap = app_state_get_heap(); } else if (task == PebbleTask_Worker) { heap = worker_state_get_heap(); } else { WTF; } // FIXME: We cast heap_size's size_t result to in...
on, SLIDE_SETTLE_DURATION_MS); AnimationHandlers anim_handler = { .stopped = prv_slide_settle_stopped, }; animation_set_handlers(animation, anim_handler, selection_layer); selection_layer->slide_settle_anim_impl = (AnimationImplementation) { .update = prv_slide_settle_impl, }; animation_set_impleme...
{ selection_layer->cell_widths[i] = 0; }
layer_create_with_data(*frame, sizeof(selection_layer)); layer_set_frame(&selection_layer->layer, frame); layer_set_clips(&selection_layer->layer, false); layer_set_update_proc(&selection_layer->layer, (LayerUpdateProc) prv_draw_selection_layer); } SelectionLayer* selection_layer_create(GRect frame, unsigned...
EEX_BITSTREAM_VERSION (4) #define TIMEOUT_SESSION_SETUP (8000) #define TIMEOUT_SESSION_RESULT (15000) #define VOICE_LOG(fmt, args...) PBL_LOG_D(LOG_DOMAIN_VOICE, LOG_LEVEL_DEBUG, fmt, ## args) typedef enum { SessionState_Idle = 0, SessionState_StartSession, SessionState_VoiceEndpointSetupReceived, Session...
new_timer_stop(s_timeout)
; // Indicate to the UI that we have started recording PBL_LOG(LOG_LEVEL_INFO, "Session setup successfully"); prv_send_event(VoiceEventTypeSessionSetup, VoiceStatusSuccess, NULL); prv_start_recording(); } } static void prv_audio_transfer_setup_complete_handler(AudioEndpointSessionId session_id) { ...
0x00, 0x00, 0x00, 0x7f, 0x00, 0x18, 0x00, 0x7f, 0x00, 0x1f, 0x00, /* bytes 16 - 32 */ 0x7f, 0xf0, 0x1f, 0x00, 0x7f, 0xfc, 0x1f, 0x00, 0x7f, 0xfc, 0x1f, 0x00, 0x7f, 0xfc, 0x1f, 0x00, /* bytes 32 - 48 */ 0x7f, 0xfc, 0x1f, 0x00, 0x7f, 0xfc, 0x1f, 0x00, 0x7f, 0xfc, 0x1f, 0x00, 0x7f, 0xfc, 0x1f, 0x00, /* bytes 48 - 64 ...
{ AppData *data = window_get_user_data(window); MenuLayer *menu_layer = &data->menu_layer; menu_layer_init(menu_layer, &window->layer.bounds); menu_layer_set_callbacks(menu_layer, data, &(MenuLayerCallbacks) { .get_num_sections = (MenuLayerGetNumberOfSectionsCallback) get_num_sections_callback, .get_nu...
-216}, { 1144, 400, -192}, { 1192, 528, -208}, { 1256, 696, -488}, { 1168, 624, -432}, { 1408, 472, -344}, { 1672, 408, -248}, { 1528, 232, -56}, { 1224, 88, 24}, { 1024, 32, 16}, { 848, 504, -152}, { 928, 152, -56}, { 896, 136, 32}, { 1184, 176, -8}, { 1224, 192,...
{ 1456, 328, -544}, { 1704, 352, -336}, // 53 seconds { 1432, 224, -136}, { 1208, 144, -112}, { 1048, 128, 80}, { 896, 56, -16}, { 872, -16, 24}, { 856, 344, 144}, { 1168, 16, -56}, { 1168, 24, -56}, { 1104, 80, -96}, { 1224, 24, -152}, { 1336, 56, -184}, { 12...
{ -16, 184, -1024}, { 128, -112, -904}, { -24, 136, -1024}, { -224, 328, -952}, { -72, 72, -984}, { -56, 40, -1080}, { 16, 152, -1080}, { -8, 136, -1048}, { 40, 120, -1024}, { -24, 112, -1040}, }; *len = ARRAY_LENGTH(samples); return samples; } // ---------------------...
NSION_C99 tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%123F", &jan_2_10015__13_00_00); cl_assert_equal_s(tmbuf, "10015-01-02"); #endif #if EXTENSION_TZ tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%7G %01g", &jan_2_10015__13_00_00); cl_assert_equal_s(tmbuf, "0010015 15"); tmbuf[0] = '\0'; str...
(tmbuf, "Fri Jan 2 13:00:00 2015")
; s_i18n_translate = true; s_i18n_locale_other = true; tmbuf[0] = '\0'; localized_strftime(tmbuf, sizeof(tmbuf), "%a %A %b %B", &jan_2_2015__13_00_00, NULL); cl_assert_equal_s(tmbuf, "Hola Hola Hola Hola"); tmbuf[0] = '\0'; localized_strftime(tmbuf, sizeof(tmbuf), "%c", &jan_2_2015__13_00_00, NULL); cl...
t_get_last(); cl_assert_equal_i(event.type, PEBBLE_APP_WILL_CHANGE_FOCUS_EVENT); cl_assert_equal_i(event.app_focus.in_focus, false); cl_assert_equal_i(window_stack_count(app_stack), 1); // Pop the modal window off the stack window_stack_remove(window2, true); cl_assert_equal_i(window_stack_count(modal_st...
window_destroy(window2)
; } // Tests modal and app transitions with an unfocusable modal window void test_window_stack__unfocusable_modal_and_app(void) { Window *window1 = window_create(); Window *window2 = window_create(); cl_assert_equal_b(window_is_focusable(window2), true); window_set_focusable(window2, false); cl_assert_equal_...
ioning .paging.origin_on_screen = {0, 0}, }, }; render_steps(&layout, RenderMoveTextBox, DELTA, DISP_ROWS, NULL); cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); } void test_graphics_draw_text_flow__with_origin_non_zero(void) { TextLayoutExtended layout = { .flow_data = { .perimeter...
(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE))
; } GRangeHorizontal perimeter_for_circle(GRangeVertical vertical_range, GPoint center, int32_t radius); GRangeHorizontal perimeter_for_display_rect(const GPerimeter *perimeter, const GSize *ctx_size, GRangeVertical vertical_range,...
/* * 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 (target_bus_frequency > s_timing_data[bus_mode].clock_speed_max) { return I2C_TIMINGR_INVALID_VALUE; }
uint32_t min_scl_low_ps = s_timing_data[bus_mode].min_scl_low_ps; uint32_t min_scl_high_ps = s_timing_data[bus_mode].min_scl_high_ps; for (uint32_t prescaler = 1; prescaler <= TIMINGR_MAX_PRESC; ++prescaler) { const uint32_t base_frequency = i2c_clk_frequency / prescaler; const uint64_t base_period_ps ...
/* * 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 (!addr) { return true; } BTDeviceAddress invalid = {}; return bt_device_address_equal(addr, &invalid); }
bool bt_device_internal_equal(const BTDeviceInternal *device1_int, const BTDeviceInternal *device2_int) { if (device1_int == NULL || device2_int == NULL) { return false; } return (device1_int->is_classic == device2_int->is_classic && device1_int->is_random_address == ...
1032, 856, -344}, { 848, 1240, -560}, { 872, 1336, -392}, { 1096, 1032, -256}, // 18 seconds { 1184, 936, -136}, { 1304, 696, -104}, { 1552, 552, -120}, { 1440, 368, -96}, { 1416, 280, -136}, { 1440, 256, -112}, { 1384, 200, -80}, { 1272, 152, -88}, { 1288, 168, -112}...
{ 1472, 224, -32}, { 1504, 152, -72}, { 1400, 72, 24}, { 1264, 152, -16}, { 1312, 56, 16}, { 904, -464, 48}, { 864, -392, 120}, { 896, -136, -272}, { 1232, -160, -56}, { 1200, 224, -184}, { 1104, 24, -120}, { 1064, 184, -216}, { 1256, 344, -232}, { 1632, 432, -224...
{ 1160, 912, -104}, // 26 seconds { 1072, 1176, -88}, { 1064, 1224, -32}, { 824, 840, -56}, { 856, 736, -56}, { 1000, 560, -88}, { 1240, 400, -128}, { 1520, 352, -104}, { 1792, 360, -88}, { 1784, 280, -48}, { 1584, 224, -64}, { 1392, 224, -112}, { 1312, 192, -72}...
/* * 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...
layer_add_child(&window->layer, &title->layer)
; if (has_hrm) { sniprintf(data->status_string, STATUS_STRING_LEN, "Starting..."); } else { sniprintf(data->status_string, STATUS_STRING_LEN, "Not an HRM device"); } TextLayer *status = &data->status_text_layer; text_layer_init(status, &GRect(5, 40, window->layer.bounds.size.w - 5, ...
ctx, &GRect(0, y, menu_layer->scroll_layer.layer.bounds.size.w, cursor->sep)); } } static void prv_prepare_row(GContext *ctx, MenuLayer *menu_layer, Layer *cell_layer, bool highlight) { if (!process_manager_compiled_with_legacy2_sdk()) { GColor *colors = (highlight) ? menu_lay...
((GRect *const)&ctx->draw_state.clip_box, rect_clipper)
; prv_prepare_row(ctx, menu_layer, cell_layer, false); // Call the client, to ask to draw the section: menu_layer->callbacks.draw_header(ctx, cell_layer, cursor->index.section, menu_layer->callback_context); // Restore current drawing state: graphics_context_set_drawing_state(ctx, prev_state); } static vo...
common.h" #include "test_rocky_common.h" #include "applib/graphics/gpath.h" #include "applib/graphics/gtypes.h" #include "applib/rockyjs/api/rocky_api_global.h" #include "applib/rockyjs/api/rocky_api_graphics.h" #include "applib/rockyjs/api/rocky_api_graphics_color.h" #include "applib/rockyjs/pbl_jerry_port.h" #includ...
jerry_set_object_field(jerry_get_global_object(), "ctx", ctx)
; } void test_rocky_api_graphics_path2d__initialize(void) { fake_malloc_set_largest_free_block(~0); s_log_internal__expected = NULL; rocky_runtime_context_init(); fake_app_timer_init(); jerry_init(JERRY_INIT_EMPTY); s_app_window_stack_get_top_window = (Window){}; s_context = (GContext){}; s_app_state...
/* * 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_SELECT, prv_decline_click_handler)
/* * 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...
(animation, duration)
ions = s_basic_action_list; cl_assert_equal_p(timeline_item_find_action_with_id(&item, 0), &s_basic_action_list[0]); cl_assert_equal_p(timeline_item_find_action_with_id(&item, 1), &s_basic_action_list[1]); cl_assert_equal_p(timeline_item_find_action_with_id(&item, 2), &s_basic_action_list[2]); cl_assert_equal_p...
cl_assert_equal_p(timeline_item_find_reply_action(&item), NULL)
(s_current_cal_status != CompassStatusCalibrated)) { // if we haven't tried to calibrate yet, run at a higher sampling rate // for a short duration in order to finish calibration more quickly if (!s_calib_run) { ecomp_corr_reset(); mag_change_sample_rate(MagSampleRate20Hz); regular_timer_a...
(prv_ecompass_start_callback, NULL)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(strlen(testbuf), 2)
; }
{ .hour = 5, .minute = 14, .kind = ALARM_KIND_WEEKENDS }); prv_assert_alarm_config(id, 5, 14, false, ALARM_KIND_WEEKENDS, s_weekend_schedule); id = alarm_create(&(AlarmInfo) { .hour = 6, .minute = 14, .kind = ALARM_KIND_WEEKENDS }); prv_assert_alarm_config(id, 6, 14, false, ALARM_KIND_WEEKENDS, s_weekend_schedule...
(id2, 23, 46)
nnected_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_intent_used(const GAPLEConnectionIntent *intent) { return (intent->client[GAPLEClientKernel].is_used | ...
if (request->is_bonding_based) { const GAPLEConnection *connection = gap_le_connection_find_by_irk(&request->bonding.irk); if (!connection) { if (sm_is_pairing_info_irk_not_used(&request->bonding.irk)) { PBL_LOG(LOG_LEVEL_DEBUG, "register_intent: IRK not used, searching by addr"); connecti...
const bool is_existing_intent = (intent != NULL); if (is_existing_intent) { if (intent->client[c].is_used) { return BTErrnoInvalidState; } } else { // Create intent for device and add to list: const size_t alloc_size = sizeof(GAPLEConnectionIntent) + (request->...
layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_line_across_y_offset_layer"))); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_ny_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, ...
GPoint(0, 17)
, 21); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 19), 22); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 21), 143); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 23), 145); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_origin_odd_rows_no_c...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(ActionMenuItem)
context_set_fill_color(ctx, GColorBlack); graphics_fill_rect(ctx, &GRect(4, 2, 16, 8)); } void across_x_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_antialiased(ctx, false); graphics_context_set_fill_color(ctx, GColorBlack); graphics_fill_round_rect(ctx, &GRect(10, 2, 18, 4), 4, GCorn...
(&layer, &across_nx_layer_update_callback)
; layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_across_nx_offset_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_y_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_...
ATT is supported add a check for active gateway // https://pebbletechnology.atlassian.net/browse/PBL-15277 // // For now, we just assume that the Kernel LE client is _always_ bonded for // ANCS. Note that we cannot use bt_persistent_storage calls in this routine because // we could be getting this call as a r...
{ // Cleanup clients: their code must execute on KernelMain, so add callback: launcher_task_add_callback(prv_cleanup_clients_kernel_main_cb, NULL); gap_le_slave_reconnect_stop(); gap_le_connect_cancel_all(GAPLEClientKernel); ppogatt_destroy(); }
DialogAnalyticsMetric metric; uint32_t value; } AnalyticsNode; static ListNode *s_analytics_list = NULL; static ListNode *s_stopwatch_list = NULL; static PebbleRecursiveMutex *s_analytics_lock = NULL; // Locking Functions static void prv_lock(void) { mutex_lock_recursive(s_analytics_lock); } static void prv_...
prv_lock()
; AnalyticsStopwatchNode *stopwatch = prv_find_stopwatch_node(metric); if (stopwatch) { analytics_add(metric, prv_stopwatch_elapsed_ms(stopwatch, rtc_get())); list_remove(&stopwatch->node, &s_stopwatch_list, NULL); } prv_unlock(); } void analytics_stopwatches_update(uint32_t current_ticks) { prv_lock...
pplicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "applib/...
(kino_reel_get_data_size(kino_reel), 356)
; } void test_kino_reel__verify_pdci_get_list(void) { // Test loading PDCI Kino Reel uint32_t resource_id = sys_resource_load_file_as_resource( TEST_IMAGES_PATH, "test_kino_reel__resource_pdci.pdc"); cl_assert(resource_id != UINT32_MAX); KinoReel *kino_reel = kino_reel_create_with_resource(resource_id);...
/* * 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_ERROR, "Unexpected cmd ID: %d", msg->command_id)
; break; } } void hc_endpoint_pairing_send_pairing_response(const BTDeviceInternal *device, bool is_confirmed) { const HcProtocolMessagePairingResponsePayload payload = { .device = *device, .is_confirmed = is_confirmed, }; hc_protocol_enqueue_with_payload(HcEndpointID_Pairing, HcMessageID_Pairing...
royed cl_assert(animation_get_context(h) == NULL); // Make sure no animations exist cl_assert_equal_i(prv_count_animations(), 0); #endif } // -------------------------------------------------------------------------------------- // Test that we can reschedule an animation from the stopped handler that has auto...
prv_count_handler_entries(&s_teardown_handler_calls, h)
, 1); // Make sure the frame reached the "to" state cl_assert_equal_i(prv_last_update_distance(h), ANIMATION_NORMALIZED_MAX); // This should return NULL now if the animation got destroyed cl_assert(animation_private_animation_find(h) == NULL); // Make sure no animations exist cl_assert_equal_i(prv_count_...
have to do this on Tintin/Bianca as we // do not create an intermediary reel for animating. kino_reel_destroy(s_phone_ui_data->current_icon); animation_unschedule(s_phone_ui_data->bg_color_animation); animation_unschedule(s_phone_ui_data->action_bar_animation); animation_unschedule(s_phone_ui_data->call_stat...
(&s_phone_ui_data->status_bar)
; layer_set_frame(&s_phone_ui_data->status_bar.layer, &GRect(0, 0, window->layer.bounds.size.w - PBL_IF_RECT_ELSE(ACTION_BAR_WIDTH, 0), STATUS_BAR_LAYER_HEIGHT)); status_bar_layer_set_colors(&s_phone_ui_data->status_bar, PBL_IF_COLOR_ELSE(GCol...
/* * 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...
(num_points * sizeof(GPoint))
; cl_assert(copied_points != NULL); for (int i = 0; i < num_points; i++) { copied_points[i] = gpoint_add(points[i], offset); } return copied_points; } static bool prv_compare_points(GPoint *a, GPoint *b, uint16_t num_points) { return (memcmp(a, b, sizeof(GPoint) * num_points) == 0); } // Stubs void grap...
ta_size) { return false; } ResAppNum sys_get_current_resource_num(void) { return 0; } const uint8_t *sys_resource_read_only_bytes(ResAppNum app_num, uint32_t resource_id, size_t *num_bytes_out) { return NULL; } // Fakes /////////////////////// size_t s_resource_size;...
(gbitmap_init_with_resource_system(&bitmap, 0, 0))
; }
xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb...
for(i = 0; i < Nk; ++i) { RoundKey[(i * 4) + 0] = Key[(i * 4) + 0]; RoundKey[(i * 4) + 1] = Key[(i * 4) + 1]; RoundKey[(i * 4) + 2] = Key[(i * 4) + 2]; RoundKey[(i * 4) + 3] = Key[(i * 4) + 3]; }
, // Resting K Calories 3333, // Distance 4444, // Active Time }; static uint32_t s_old_movement_data[] = { 1, // Version NOW - (7 * SECONDS_PER_DAY), 1234, // Steps 1111, // Active K Calories 2222, // Resting K Calories 3333, // Distan...
health_db_get_typical_value(ActivityMetricSleepTotalSeconds, Monday, &val_out)
); } void test_health_db__movement_data(void) { const char *key = "monday_movementData"; cl_assert_equal_i(health_db_insert((uint8_t *)key, strlen(key), (uint8_t *)s_movement_data, sizeof(s_movement_data)), S_SUCCESS); cl_assert_equal_i(s_metric_updated_c...
IC void prv_play_animation_update(Animation *animation, const AnimationProgress normalized) { KinoPlayer *player = animation_get_context(animation); int32_t animation_elapsed_ms = 0; uint32_t elapsed_ms = 0; uint32_t kino_reel_duration = kino_reel_get_duration(player->reel); bool is_reel_infinite = (kino_reel...
animation_schedule(animation)
; } } void kino_player_play_section(KinoPlayer *player, uint32_t from_elapsed_ms, uint32_t to_elapsed_ms) { if (player && player->reel) { kino_reel_set_elapsed(player->reel, from_elapsed_ms); prv_create_play_animation(player, from_elapsed_ms, to_elapsed_ms); animation_sche...
nst NotificationLayout *layout) { return (layout->info.item->header.type == TimelineItemTypeReminder); } static void prv_reminder_timestamp_update(const LayoutLayer *layout_ref, const LayoutNodeTextDynamicConfig *config, char *buffer, ...
{ const NotificationStyle *style = &s_notification_styles[system_theme_get_content_size()]; const bool is_reminder = prv_is_reminder(layout); const LayoutNodeTextAttributeConfig header_config = { .attr_id = AttributeIdAppName, .text.style_font = TextStyleFont_Header, .text.extent.offset.y = style->he...
style->title_padding + (use_body_icon ? style->title_offset_if_body_icon : 0), .text.extent.margin.h = style->title_padding, }; const LayoutNodeTextAttributeConfig subtitle_config = { .attr_id = is_reminder ? AttributeIdTitle : AttributeIdSubtitle, .text.style_font = TextStyleFont_Title, .t...
g app_message_outbox_begin() again!"); return APP_MSG_INVALID_STATE; } else if (phase == OUT_CLOSED) { PBL_LOG(LOG_LEVEL_ERROR, "Must call app_message_open() before calling app_message_outbox_begin()!"); return APP_MSG_INVALID_STATE; } // Reset the send state (dictionary, counters, etc.) ...
prv_stop_timer(outbox)
; if (header->command == CMD_NACK) { prv_handle_nack_or_ack_timeout(outbox, APP_MSG_SEND_REJECTED); return; } if (outbox->phase == OUT_AWAITING_REPLY_AND_OUTBOX_CALLBACK) { outbox->phase = OUT_AWAITING_OUTBOX_CALLBACK; return; } // phase == OUT_AWAITING_REPLY, because of !prv_is_awaiting_ack...
ication_sent; void workout_utils_send_abandoned_workout_notification() { s_abandoned_workout_notification_sent = true; } // --------------------------------------------------------------------------------------- static void prv_inc_steps_and_put_event(int steps) { s_total_step_count += steps; PebbleEvent event ...
cl_assert_equal_i(hr_zone, 3)
send the address. Otherwise, we'd need to // send a repeated start, which we don't want to do. const bool reload = bus->state->transfer.direction == I2CTransferDirection_Write; bus->hal->i2c->CR2 = (bus->state->transfer.device_address & I2C_CR2_SADD) | (1 << CR2_NBYTES_OFFSET) | ...
prv_end_transfer_irq(bus, I2CTransferEvent_Error)
; } void i2c_hal_event_irq_handler(I2CBus *bus) { portEND_SWITCHING_ISR(prv_event_irq_handler(bus)); } void i2c_hal_error_irq_handler(I2CBus *bus) { portEND_SWITCHING_ISR(prv_error_irq_handler(bus)); }
x = graphics_context_get_current_context(); const GTextAlignment text_alignment = PBL_IF_RECT_ELSE(GTextAlignmentCenter, show_action_bar ? GTextAlignmentRight : GTextAlignmentCenter); { // do all this in a block so we enforce that nobody uses these variables outside of the block // when dealing with r...
(&workout_dialog->action_bar)
; gbitmap_deinit(&workout_dialog->confirm_icon); gbitmap_deinit(&workout_dialog->decline_icon); if (workout_dialog->subtext_buffer) { applib_free(workout_dialog->subtext_buffer); } if (workout_dialog->dialog.destroy_on_pop) { applib_free(workout_dialog); } } void workout_dialog_init(WorkoutDialo...
----------------------------------------------------------------- static bool prv_set_alarm_kind_op(AlarmId id, AlarmConfig *config, void *context) { AlarmKind type = (uintptr_t)context; switch (type) { case ALARM_KIND_EVERYDAY: config->kind = ALARM_KIND_EVERYDAY; const bool everyday[DAYS_PER_WEEK] ...
(&file, id, &config)
; if (!rv) { goto cleanup; } is_enabled = !config.is_disabled; cleanup: prv_file_close_and_unlock(&file); return is_enabled; } // ---------------------------------------------------------------------------------------------- bool alarm_get_hours_minutes(AlarmId id, int *hour_out, int *minute_out) { S...
fo->requests, &secs_til_max_latency, &responsible_consumer); #endif // actually request the mode if it has changed: if (hdl->conn_mgr_info->curr_requested_state != state) { PBL_LOG(LOG_LEVEL_INFO, "LE: Requesting state %d for %d secs, due to %u", state, secs_til_max_latency, responsible_consu...
{ regular_timer_remove_callback(watchdog_cb_info); }
ConnectionStateRequest *consumer_request = (ConnectionStateRequest *)list_find((ListNode *)conn_mgr_info->requests, prv_find_source, (void *)consumer); bool is_already_granted = (gap_le_connect_params_get_actual_state(hdl) >= state); if (consumer_request == NUL...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
rocky_global_has_event_handlers("minutechange")
); cl_assert_equal_b(true, rocky_global_has_event_handlers("hourchange")); cl_assert_equal_b(true, rocky_global_has_event_handlers("daychange")); cl_assert_equal_i(3, s_tick_timer_service_subscribe.call_count); cl_assert_equal_i(MINUTE_UNIT | HOUR_UNIT | DAY_UNIT | MONTH_UNIT | YEAR_UNIT, s_...
ntil 11:45pm rtc_set_time(rtc_get_time() + 15 * SECONDS_PER_MINUTE); s_data.metric_history[ActivityMetricSleepState][0] = ActivitySleepStateAwake; s_data.metric_history[ActivityMetricSleepStateSeconds][0] = 15 * SECONDS_PER_MINUTE; // Should generate a pin activity_insights_process_sleep_data(rtc_get_time())...
(rtc_get_time() + 2 * SECONDS_PER_HOUR)
; prv_add_sleep_session(0.5, 1.5); activity_insights_process_sleep_data(rtc_get_time()); cl_assert_equal_i(s_data.pins_added, 2); cl_assert(uuid_equal(&orig_id, &s_last_timeline_id)); // Nap sessions shouldn't be added rtc_set_time(rtc_get_time() + 3 * SECONDS_PER_HOUR); prv_add_nap_session(2, 1); acti...
boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_TWO); boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_THREE); break; case 5: boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE); break; case 6: boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE); boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_TWO); break; case 7: ...
{ // We just woke up from standby. For some reason this leaves the system in a funny state, // so clear the flag and reboot again to really clear things up. PWR_ClearFlag(PWR_FLAG_SB); dbgserial_putstr("exit standby"); system_hard_reset(); }
periph_config_disable(RCC_APB1PeriphClockCmd, RCC_APB1Periph_PWR); } void boot_main(void) { gpio_enable_all(); check_and_handle_resuming_from_standby(); dbgserial_init(); dbgserial_putstr(""); dbgserial_putstr(" ___ _ _ _ "); dbgserial_putstr("/ __><_>| || |__"); dbgserial_putstr("\\__ \\| || ...
ttribute) { cl_assert(s_pending_notified.active); cl_assert(s_pending_notified.attribute == attribute); s_pending_notified.active = false; } // Setup void test_app_smartstrap__initialize(void) { smartstrap_attribute_init(); app_smartstrap_subscribe((SmartstrapHandlers) { .did_read = prv_did_read_handle...
(PebbleTask_KernelBackground)
; prv_prepare_for_did_write(attr); cl_assert(smartstrap_attribute_send_pending()); cl_assert(!s_pending_did_write.active); // attempt to issue another read request (should report busy) assert_result_busy(app_smartstrap_attribute_read(attr)); // check that it was sent successfully SmartstrapRequest reque...
IN_DATA_LOGGING, LOG_LEVEL_DEBUG, "Message type 0x%x not recognized", message[0]); } } bool dls_endpoint_open_session(DataLoggingSession *session) { CommSession *comm_session = comm_session_get_system_session(); if (!session) { return false; } DataLoggingOpenSessionMessage msg = { .command = DataLog...
mutex_lock(s_endpoint_data.mutex)
; PBL_LOG_D(LOG_DOMAIN_DATA_LOGGING, LOG_LEVEL_DEBUG, "Received ACK for id: %"PRIu8" state: %u", session->comm.session_id, session->comm.state); switch (session->comm.state) { case DataLoggingSessionCommStateIdle: PBL_LOG(LOG_LEVEL_ERROR, "Unexpected ACK"); break; case DataLoggingSessionCommSt...
!= NULL) { return true; } #if !CAPABILITY_HAS_PUTBYTES_PREACKING put_jobs->enable_preack = false; #else put_jobs->enable_preack = true; #endif int i; for (i = 0; i < MAX_BATCHED_PB_PUT_OPS; i++) { // Note: If heap pressure becomes an issue, we could also consider only // using pre-acking if the...
(LOG_LEVEL_ERROR, "Cannot handle object type=<0x%x> when not in FW update mode", type)
; return false; } } return true; #else // safe mode FW return true; #endif } static bool prv_has_invalid_fw_update_state(const PutBytesCommand command) { if (command == PutBytesAbort || command == PutBytesInit) { return false; } // Check only for Put, Commit, Install return !prv_has_v...
/logging.h" #include "os/mutex.h" #include "system/passert.h" #include "FreeRTOS.h" #include "semphr.h" #include <stdlib.h> typedef enum { LIGHT_STATE_ON = 1, // backlight on, no timeouts LIGHT_STATE_ON_TIMED = 2, // backlight on, will start fading after a period LIGHT_STATE_ON_FADING = 3, // ...
(ANALYTICS_APP_METRIC_BACKLIGHT_ON_TIME)
; analytics_stopwatch_stop(ANALYTICS_DEVICE_METRIC_BACKLIGHT_ON_TIME); } backlight_set_brightness(new_brightness); s_current_brightness = new_brightness; } static void prv_change_state(BacklightState new_state) { s_light_state = new_state; // Calculate the new brightness and reset any timers based on o...
/* * 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...
(list_get_prev(&c) == &b)
kHandler) confirm_long_click_handler, NULL); window_single_click_subscribe(BUTTON_ID_DOWN, (ClickHandler) decline_click_handler); (void)window; } static void prv_window_load(Window *window) { ConfirmUIData *data = window_get_user_data(window); const GRect *root_layer_bounds = &window_get_root_layer(window)->bo...
app_window_stack_push(window, animated)
; } #undef MESSAGE_BUF_SIZE
){.raw_value = ABS(delta_x / delta_y) * FIXED_S16_3_ONE.raw_value}; if (delta.integer > 1) { // this is where we try to fix edges diving in and out of paths int16_t min_x = rot_end.x.raw_value < rot_start.x.raw_value ? ...
if (!prv_is_in_range(min_x, max_x, clip_min_x, clip_max_x)) { goto cleanup; }
// x-intersections of path segments whose direction is up intersections_up = applib_zalloc(path->num_points * sizeof(int16_t)); // x-intersections of path segments whose direction is down intersections_down = applib_zalloc(path->num_points * sizeof(int16_t)); // If either malloc failed, log message and cle...
P_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"U\": %s", buf); } r = strftime(buf, buf_size, "%V", &good_data); if (r == 0 || strncmp(buf, "19", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"V\": %s", buf); } r = strftime(buf, buf_size, "%w", &good_data); if (r == 0 || strncmp(buf, "2", buf_s...
(window, animated)
; } static void deinit(void) { window_destroy(window); } int main(void) { init(); app_event_loop(); deinit(); }
; ActionMenuLevel *emoji_level = prv_create_level(num_items, parent_level); emoji_level->display_mode = ActionMenuLevelDisplayModeThin; for (size_t i = 0; i < num_items; i++) { action_menu_level_add_action(emoji_level, short_strings[i], prv_action_menu_cb, action); } re...
prv_is_reply_option_supported(reply, action)
ight, i2.right); \ cl_assert_equal_i(i1.bottom, i2.bottom); \ cl_assert_equal_i(i1.left, i2.left); \ } while(0) void test_gtypes__gedge_insets(void) { GEdgeInsets g4 = (GEdgeInsets){.top = 1, .right = 2, .bottom = 3, .left = 4}; cl_assert_equal_insets(GEdgeInsets(1, 2, 3, 4), g4); GEdgeInsets g3 = (GEdg...
COLOR_FALLBACK(1,2)
); #elif defined(PLATFORM_SPALDING) cl_assert_equal_i(1, COLOR_FALLBACK(1,2)); #else #error "unknown platform" #endif }
e "applib/ui/ui.h" #include "kernel/pbl_malloc.h" typedef struct { Window window; MenuLayer menu_layer; StatusBarLayer status_layer; const char *title; TimelineItemActionGroup *action_group; ActionChainingMenuSelectCb select_cb; ActionChainingMenuClosedCb closed_cb; void *select_cb_context; void *cl...
menu_layer_get_layer(&data->menu_layer)
); #if PBL_RECT status_bar_layer_init(&data->status_layer); status_bar_layer_set_colors(&data->status_layer, PBL_IF_COLOR_ELSE(GColorWhite, GColorBlack), PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite)); status_bar_layer_set_title(&data->status_layer, data->title, ...
6, 8}, { 976, 64, 56}, { 816, 0, 8}, { 704, 16, 40}, { 696, 96, -8}, { 736, 72, 0}, { 936, -80, 24}, { 1248, -72, 48}, { 1752, 248, 8}, { 1896, 488, -168}, { 1840, 312, -152}, { 1536, 400, -384}, { 1136, 512, -256}, { 888, 600, -312}, { 808, 672, -344}, { 840,...
{ 1672, 344, 88}, { 1544, 384, 16}, { 1216, 456, -312}, { 968, 464, -408}, // 43 seconds { 832, 384, -320}, { 896, 384, -352}, { 936, 520, -448}, { 960, 616, -552}, { 944, 648, -536}, { 952, 736, -480}, { 1048, 720, -304}, { 1328, 744, -328}, { 1240, 760, -280}, ...
{ 1648, 480, -112}, { 1488, 392, -136}, { 1152, 304, -56}, { 1000, 232, -56}, { 816, 128, -40}, { 792, 104, -24}, { 656, 56, 16}, { 672, 56, -8}, { 728, 96, 16}, { 912, 192, -16}, { 1192, 224, 16}, // 46 seconds { 1632, 312, -56}, { 1688, 336, -168}, { 1552, ...
0) setup_test_aa_sw(&ctx, fb, RECT_TEXT_2_0, RECT_TEXT_2_0, false, 1); graphics_context_set_text_color(&ctx, GColorBlack); graphics_draw_text(&ctx, "jja", &s_font_info, RECT_TEXT_0_0, GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "d...
(&ctx, GColorBlack)
; graphics_draw_text(&ctx, "jja", &s_font_info, RECT_NEG_H, GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL); cl_check(framebuffer_is_empty("draw_text_neg_h", fb, GColorWhite)); // Test null context boxes - ensure nothing is rendered setup_test_aa_sw(&ctx, fb, RECT_NULL, RECT_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...
bt_driver_classic_disconnect(address)
; analytics_inc(ANALYTICS_DEVICE_METRIC_BT_PAIRING_FORGET_COUNT, AnalyticsClient_System); } static void prv_forget_ble_remote(int id) { bt_persistent_storage_delete_ble_pairing_by_id(id); analytics_inc(ANALYTICS_DEVICE_METRIC_BLE_PAIRING_FORGET_COUNT, AnalyticsClient_System); } static void prv_remote_menu_clea...
{ PBL_LOG(LOG_LEVEL_INFO, "BLE HRM sharing: revoked for conn %p", connection); bt_lock(); if (gap_le_connection_is_valid(connection)) { prv_update_permission(connection, HrmSharingPermission_Declined); prv_disconnect_to_kill_subscription(connection); } bt_unlock(); analytics_event_ble_hrm(BleHrmEve...
static void prv_revoke_gap_le_connection_for_each_cb(GAPLEConnection *connection, void *unused) { prv_update_permission(connection, HrmSharingPermission_Declined); prv_disconnect_to_kill_subscription(connection); } void ble_hrm_revoke_all(void) { bt_lock(); gap_le_connection_for_each(prv_revoke_gap_le_connec...
s_draw_horizontal_line_dotted(&ctx, GPoint(0, 12), 4); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 14), 20); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 16), 21); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 18), 22); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 20), MAX_NUM_CO...
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 16), 21)
RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false); load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, true); resource_init(); // simulate installing bg_counter on flash app_db_insert((uint8_t *)&bg_counter.uuid, sizeof(Uuid), (uint8_t *)&bg_counter...
app_install_is_watchface(menu_layer_id)
); cl_assert_equal_b(false, app_install_is_watchface(CRAZY_ID)); } void test_app_install_manager__is_watchface_via_entry(void) { cl_assert_equal_b(true, prv_app_install_is_watchface(tictoc_id)); cl_assert_equal_b(false, prv_app_install_is_watchface(music_id)); cl_assert_equal_b(false, prv_app_install_is_watc...
FIRMWARE_BASE, firmware_length, prv_display_erase_progress, 0); } 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 write_new_firmware( uint32_t firmware_start_address, uint32_t firmware_le...
(BOOT_BIT_NEW_FW_AVAILABLE)
; boot_bit_set(BOOT_BIT_NEW_FW_INSTALLED); } bool switch_to_recovery_fw() { dbgserial_putstr("Loading recovery firmware"); UpdateFirmwareResult result = update_fw(FLASH_REGION_SAFE_FIRMWARE_BEGIN); bool recovery_fw_ok = true; switch (result) { case UPDATE_FW_SUCCESS: boot_bit_clear(BOOT_BIT_RECOVERY_L...
B8FromHEX(0xffe4c4)}, {"blanchedalmond", GColorARGB8FromHEX(0xffebcd)}, {"blueviolet", GColorARGB8FromHEX(0x8a2be2)}, {"brown", GColorARGB8FromHEX(0xa52a2a)}, {"burlywood", GColorARGB8FromHEX(0xdeb887)}, // {"cadetblue", GColorARGBFromHEX(0x5f9ea0)}, inconsistent with Pebble color {"chartreuse", GColorARGB8F...
GColorARGB8FromHEX(0x48d1cc)
}, {"mediumvioletred", GColorARGB8FromHEX(0xc71585)}, {"midnightblue", GColorARGB8FromHEX(0x191970)}, {"mintcream", GColorARGB8FromHEX(0xf5fffa)}, {"mistyrose", GColorARGB8FromHEX(0xffe4e1)}, {"moccasin", GColorARGB8FromHEX(0xffe4b5)}, {"navajowhite", GColorARGB8FromHEX(0xffdead)}, {"oldlace", GColorARGB8...
7427 }, // priority rank 31 { .id = 17, .priority = 1, .size = 22644 }, // priority rank 2 { .id = 18, .priority = 30, .size = 33202 }, // priority rank 22 { .id = 19, .priority = 25, .size = 151434 }, // priority rank 18 { .id = 20, .priority = 33, .size = 102321 }, // priority rank 24 { .id = 21, .priori...
fake_system_task_callbacks_invoke_pending()
; after_size = app_cache_get_size(); cl_assert_equal_i(after_size, (before_size - 207357)); // test two lowest priority's size prv_cleanup(); to_free = (207357 + 22644); before_size = app_cache_get_size(); cl_assert(before_size >= to_free); cl_assert_equal_i(S_SUCCESS, app_cache_free_up_space(to_free))...
-40, 928, 232}, { -48, 920, 232}, { -48, 920, 232}, { -48, 920, 232}, { -48, 920, 232}, { -48, 928, 240}, { -40, 920, 232}, { -48, 920, 232}, { -48, 920, 248}, { -40, 920, 232}, { -40, 920, 232}, { -48, 928, 248}, { -48, 920, 232}, // 94 seconds { -40, 928, 248}, ...
{ -40, 912, 256}, { -40, 920, 256}, { -40, 912, 248}, { -40, 920, 248}, { -40, 912, 248}, { -48, 912, 248}, { -40, 920, 248}, { -40, 920, 248}, { -40, 920, 256}, { -40, 920, 248}, { -40, 920, 256}, { -40, 920, 248}, { -40, 912, 256}, { -40, 920, 248}, { -40, 9...
{ -40, 912, 256}, { -40, 920, 256}, { -40, 912, 256}, { -40, 912, 256}, { -40, 912, 264}, { -40, 920, 256}, { -40, 920, 256}, { -40, 912, 256}, { -40, 920, 256}, { -40, 912, 248}, { -40, 920, 256}, { -40, 912, 264}, { -40, 912, 256}, { -40, 912, 256}, { -40, ...
x; } // Stubs ///////////////////// #include "stubs_analytics.h" #include "stubs_app_install_manager.h" #include "stubs_app_state.h" #include "stubs_app_timer.h" #include "stubs_bootbits.h" #include "stubs_buffer.h" #include "stubs_click.h" #include "stubs_heap.h" #include "stubs_layer.h" #include "stubs_logging.h" #...
(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE))
; }
d", notif_config->state->last_triggered_utc); } // ------------------------------------------------------------------------------------------------ // Filter for calculating metric history stats (values <= 0 are considered invalid) static bool prv_stats_filter(int index, int32_t value, void *context) { return (value...
(&notif_attr_list, body, TIMELINE_RESOURCE_ACTIVITY, ActivityInsightType_Day1, ActivitySessionType_None)
; AttributeList dismiss_action_attr_list = {0}; attribute_list_add_cstring(&dismiss_action_attr_list, AttributeIdTitle, i18n_get("Dismiss", &notif_attr_list)); AttributeList open_app_action_attr_list = {0}; prv_set_open_app_action(&open_app_action_attr_list, HealthCardType_Activit...
nsfer.idx++; if (bus->transfer.idx + 1 == bus->transfer.size) { // Last byte, we want to NACK this one to tell the slave to stop sending us bytes. bus->i2c->CR1 &= ~I2C_CR1_ACK; } else if (bus->transfer.idx == bus->transfer.size) { // End transfer after all bytes have been rec...
{ bus_rail_power_down(1); }
}
false; } // check exact file size to contain all flexible-sized data for (unsigned int i = 0; i < score->attr_list.num_attributes; i++) { GenericAttribute * attribute = (GenericAttribute *)((uint8_t *)score + total_size); total_size += sizeof(GenericAttribute); if (data_size < total_size) { re...
if (!score) { return 0; }
GenericAttribute *repeat_delay_attribute = generic_attribute_find_attribute(&score->attr_list, VibeAttributeId_RepeatDelay, score->attr_list_size); if (repeat_delay_attribute) { uint16_t *repeat_delay = (uint16_t *) repeat_delay_attribute->data; return *repeat_d...