prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
{ // Left and right most point helpers for main loop GPointPrecise lm_p0 = far_top; GPointPrecise lm_p1 = far_left; GPointPrecise rm_p0 = far_top; GPointPrecise rm_p1 = far_right; const int16_t top_point = MIN(p0.y.raw_value, p1.y.raw_value) - radius.raw_value; const int16_t bottom_point = ...
Fixed_S16_3 left_margin = {.raw_value = INT16_MAX}; Fixed_S16_3 right_margin = {.raw_value = INT16_MIN}; // Find edges for upper cap GPointPrecise top_point_tmp = (p0.y.raw_value < p1.y.raw_value) ? p0 : p1; Fixed_S16_3 progress_line = (Fixed_S16_3){.raw_value = (y * FIXED_S16_3_ONE.raw_...
/* * 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...
{ bool filter = false; for (unsigned int i = 0; i < TimelineEventServiceCount; i++) { TimelineEventState *state = &s_states[i]; // Pass all items through the filter to allow clients to process all item headers if (state->impl && state->impl->filter(header, &state->context)) { if (prv_should_use_it...
static void prv_update_status(void) { PBL_ASSERT_TASK(PebbleTask_KernelBackground); if (!s_mutex) { return; } mutex_lock(s_mutex); new_timer_stop(s_timer); SerializedTimelineItemHeader *filter_headers = kernel_zalloc_check(TimelineEventServiceCount * sizeof(SerializedTimelineItemHeader)); // ...
/* * 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...
buffer_add(b, (uint8_t *) test_data, sizeof(test_data))
; cl_assert_equal_i(bytes_written, (i + 1) * sizeof(test_data)); cl_assert_equal_i(buffer_get_bytes_remaining(b), buffer_size - ((i+1) * sizeof(test_data))); } cl_assert(buffer_get_bytes_remaining(b) > 0); bytes_written = buffer_add(b, (uint8_t *) test_data, sizeof(test_data)); cl_assert_equal_i(bytes_...
EM; static const int test_uuid_a_id = 1; static const Uuid test_uuid_a = TEST_UUID_A; static const int test_uuid_b_id = 2; static const Uuid test_uuid_b = { 0xC3, 0x0D, 0xBA, 0xF1, 0x5F, 0x6F, 0x4F, 0x22, 0xBA, 0xAA, 0x8C, 0x2A, 0x96, 0x8C, 0xFC, 0x28 }; static const int test_uuid_c_id = 3; static const Uuid test_uu...
(persist_get_size(key), size)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (s_state != SessionState_Recording) { PBL_LOG(LOG_LEVEL_WARNING, "Received stop message from phone after audio session " "stopped/cancelled"); return; }
// TODO: Handle this better: there is no feedback to the UI that we've stopped recording s_state = SessionState_WaitForSessionResult; prv_stop_recording(); prv_start_result_timeout(); } static void prv_start_recording(void) { #if !defined(TARGET_QEMU) // TODO: reenable // PBL_ASSERTN(mic_start(MIC, &prv_...
de_time(time_t *tloc) { time_t t = sys_get_time(); if (tloc) { *tloc = t; } return (t); } // Manually construct double to avoid requiring soft-fp static double prv_time_to_double(time_t time) { // time_t is 32bit signed int, convert it manually #ifndef UNITTEST _Static_assert(sizeof(time_t) == 4, "Conv...
(format, strlen(format))
; syscall_assert_userspace_buffer(tim_p, sizeof(struct tm)); } return localized_strftime(s, maxsize, format, tim_p, locale); } void *pbl_memcpy(void *destination, const void *source, size_t num) { // In releases prior to FW 2.5 we used GCC 4.7 and newlib as our libc implementation. However, // in 2.5 we ...
; PBL_ASSERTN(!scheduled); } // ================================================================================= void deferred_delete_menu_cb(int index, void *ctx) { void *cb_data = 0; uint32_t zero_flags = 0; menu_callback_prefix(index, ctx); // Deferred delete s_app_data->timer[0] = new_timer_create...
{ menu_callback_prefix(index, ctx); s_app_data->reg_timers[0].cb = reg_timer_2_callback; regular_timer_add_seconds_callback(&s_app_data->reg_timers[0]); }
// ================================================================================= void reg_timer_delete_then_add_from_cb_menu_cb(int index, void *ctx) { menu_callback_prefix(index, ctx); s_reg_timer_3_callback_count = 0; s_app_data->reg_timers[0].cb = reg_timer_3_callback; regular_timer_add_seconds_callba...
s = &data->window.layer.bounds; graphics_context_set_text_color(ctx, GColorWhite); graphics_draw_text(ctx, data->device_serial, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD), GRect(bounds->origin.x, (bounds->origin.x + bounds->size.w) / 2, bounds->size.w, bounds->siz...
{ AppData *app_data = app_state_get_user_data(); --(app_data->axis_offsets[app_data->app_state]); layer_mark_dirty(&app_data->window.layer); }
static void prv_down_click_handler(ClickRecognizerRef recognizer, void *data) { AppData *app_data = app_state_get_user_data(); ++(app_data->axis_offsets[app_data->app_state]); layer_mark_dirty(&app_data->window.layer); } static void prv_save_offsets_callback(void *data) { AppData *app_data = app_state_get_...
reminder_id); static void prv_put_reminder_event(ReminderId *reminder_id, ReminderEventType type) { Uuid *removed_id = kernel_malloc(sizeof(Uuid)); if (!removed_id) { return; } *removed_id = *reminder_id; PebbleEvent event = { .type = PEBBLE_REMINDER_EVENT, .reminder = { .type = type, ...
{ // Stop snoozing snooze_delay = INVALID_SNOOZE_DELAY; }
id)cell_index; // Variable row heights demo: switch (cell_index->row % 3) { default: case 0: return 44; case 1: return 64; case 2: return 84; } } static int16_t get_header_height_callback(struct MenuLayer *menu_layer, uint16_t section_index, AppData *data) { (void)data; (...
{ AppData *data = app_malloc_check(sizeof(AppData)); app_state_set_user_data(data); push_window(data); }
static void handle_deinit(void) { AppData *data = app_state_get_user_data(); menu_layer_deinit(&data->menu_layer); app_free(data); } static void s_main(void) { handle_init(); app_event_loop(); handle_deinit(); } const PebbleProcessMd* menu_app_get_info() { static const PebbleProcessMdSystem s_app_in...
tmap_get_bits_per_pixel(bitmap->info.format); const int16_t abs_delta = ABS(delta_x); const bool delta_neg = (delta_x < 0); const int16_t min_y = bitmap->bounds.origin.y; const int16_t max_y = grect_get_max_y(&bitmap->bounds) - 1; for (int16_t y = min_y; y <= max_y; y++) { const GBitmapDataRowInfo row_in...
if (patch_garbage) { memset(garbage_start, fill_byte, abs_delta); }
break; } default: WTF; } } } void graphics_private_move_pixels_vertically(GBitmap *bitmap, int16_t delta_y) { if (!bitmap || (delta_y == 0)) { return; } const int bpp = gbitmap_get_bits_per_pixel(bitmap->info.format); const bool delta_neg = (delta_y < 0); const int16_...
graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10))); ASSERT_NO_CHANGE(graphics_draw_rect(&context, &GRect(10, 20, 40, 10))); ASSERT_NO_CHANGE(graphics_draw_circle(&context, GPoint(50, 50), 10)); ASSERT_NO_CHANGE(graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4)); setup_test(&context, false,...
graphics_context_get_drawing_state(&context)
; graphics_context_set_antialiased(&context, true); cl_assert(memcmp(&draw_state, &context.draw_state, sizeof(GDrawState)) == 0); // Stroke Width draw_state = graphics_context_get_drawing_state(&context); graphics_context_set_stroke_width(&context, 11); cl_assert(memcmp(&draw_state, &context.draw_state, si...
data[3] = 'd'; list->data[4] = '\0'; cl_assert_equal_i(1, string_list_count(list)); cl_assert_equal_s("abcd", string_list_get_at(list, 0)); // 1 string (null terminated) => 2 strings, last is empty list->serialized_byte_length = 3; list->data[0] = 'a'; list->data[1] = 'b'; list->data[2] = '\0'; // end ...
ARRAY_LENGTH(s_basic_action_list)
/* * 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...
GPIO_WriteBit(DISP_GPIO, DISP_PIN_SCS, Bit_SET)
; // wait a bit. delay_ms(1); GPIO_WriteBit(DISP_GPIO, DISP_PIN_CRESET, Bit_RESET); // CRESET LOW GPIO_WriteBit(DISP_GPIO, DISP_PIN_SCS, Bit_RESET); // SCS LOW delay_ms(1); GPIO_WriteBit(DISP_GPIO, DISP_PIN_CRESET, Bit_SET); // CRESET -> HIGH delay_ms(1); PBL_ASSERT(!GPIO_ReadInputDataBit(DISP_GPI...
window->layer, &data->info_text_mask_layer); TextLayer *info_text_layer = &data->info_text_layer; text_layer_init_with_parameters(info_text_layer, &pair_text_area, data->info_text_layer_buffer, #if PLATFORM_ROBERT || PLATFORM_CALCULUS ...
{ window_stack_remove(&s_data_ptr->window, true /* animated */); }
} static void prv_pop_window_kernel_main_cb(void* unused) { prv_pop_window(); } static void prv_pop_window_timer_callback(void *unused) { launcher_task_add_callback(prv_pop_window_kernel_main_cb, NULL); } static void prv_push_pairing_window(void) { BTPairingUIData *data = s_data_ptr; Window *window = &data-...
r.id)); cl_assert(state.node->all_day); cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[0].header.id)); // check second cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[4].header.id)); // check third cl_assert(iter_next(&iterator)...
(&iterator, &state, &head, TimelineIterDirectionFuture, s_feb_5_midnight + 5 * 60 * 60)
_current_steps(data); prv_update_typical_steps(data); prv_update_daily_steps_avg(data); prv_update_hrm_bpm(data); prv_normalize_data(data); layer_mark_dirty(&data->base_layer); } #if UNITTEST T_STATIC void prv_set_data(KickstartData *data, int32_t current_steps, int32_t typical_ste...
window_set_user_data(&data->window, data)
; window_set_window_handlers(&data->window, &(WindowHandlers) { .load = prv_window_load_handler, .unload = prv_window_unload_handler, }); app_window_stack_push(&data->window, true); app_event_loop(); window_deinit(&data->window); i18n_free_all(data); app_free(data); } const PebbleProcessMd* kic...
zalloc(bytes); if (!ptr) { wtf(); } return ptr; } void *task_realloc(void *ptr, size_t bytes) { return realloc(ptr, bytes); } void task_free(void *ptr) { free(ptr); } void app_log(uint8_t log_level, const char* src_filename, int src_line_number, const char* fmt, ...) { printf("%s:%d", sr...
EM_ASM_INT_V({ abort(); })
; while (1) ; } PebbleTask pebble_task_get_current(void) { return PebbleTask_App; } void app_event_loop(void) { // FIXME: PBL-43469 will need to remove this init from here when multiple // platform support is implemented. rocky_api_watchface_init(); emx_app_event_loop(); }
/* * 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_DEBUG, "Advert SetAdvData: %"PRIu8, msg->payload[0])
; break; case HcMessageID_Advert_Disable: // NYI break; default: PBL_LOG(LOG_LEVEL_DEBUG, "HcAdvert Response: unhandled message id: %d", msg->command_id); } }
e__gc_past(void) { Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; // Tue Jan 13 11:40:00 PST 2015 rtc_set_time(1421178000); fake_pbl_malloc_clear_tracking(); cl_assert_equal_i(fake_pbl_malloc_num_net_allocs(), 0); timeline_init(&head); cl_assert_equal_i(timeline_it...
(&state.pin.header.id, &s_items[4].header.id)
ame_point_origin_layer_aa.${BIT_DEPTH_NAME}.pbi")); #endif } void test_graphics_draw_stroke_precise_${BIT_DEPTH_NAME}__origin_layer_non_aa(void) { GContext ctx; test_graphics_context_init(&ctx, fb); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 10); graphics_line_draw_precise_str...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_across_nxny_offset_layer_non_aa.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, false, 10); graphics_line_draw_precise_stroked_non_aa(&ctx, END_ON_ORIGIN_RECT, END_ON_ORIGIN_RECT, 10); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_same_point_offset_layer_non_aa.${BIT_DEPTH_NAME}.pbi")); } #define COLOR...
/* * 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...
delay_us(1)
; } uint8_t flash_send_and_receive_byte(uint8_t byte) { // Ensure that there are no other write operations in progress while (SPI_I2S_GetFlagStatus(FLASH_SPI, SPI_I2S_FLAG_TXE) == RESET); // Send the byte on the SPI bus SPI_I2S_SendData(FLASH_SPI, byte); // Wait for the response byte to be received while ...
"services/services.h" #include "services/common/clock.h" #include "services/common/compositor/compositor.h" #include "services/common/regular_timer.h" #include "services/common/system_task.h" #include "services/common/new_timer/new_timer_service.h" #include "services/common/new_timer/new_timer.h" #include "services/com...
BLTEST_LOG("STAGE 2 -- Boot bits incorrect!")
; BLTEST_LOG("BOOTLOADER TEST FAILED"); } boot_bit_clear(BOOT_BIT_BOOTLOADER_TEST_A | BOOT_BIT_BOOTLOADER_TEST_B); psleep(10000); system_hard_reset(); for (;;) {} // won't get here, rest gets optimized out #endif #ifdef RECOVERY_FW boot_bit_clear(BOOT_BIT_RECOVERY_START_IN_PROGRESS); #endif extern...
if the connection ends up being unused. PBL_LOG(LOG_LEVEL_INFO, "No intent for connection"); bluetooth_analytics_handle_no_intent_for_connection(); } #if RECOVERY_FW // In PRF, stick to shortest connection interval indefinitely: conn_mgr_set_ble_conn_response_time(connection, BtConsu...
if (prv_intent_matches_connection(intent, connection)) { fp(intent, data); }
intent = next; } } // ------------------------------------------------------------------------------------------------- //! Helper for prv_handle_encryption_change static void prv_send_clients_encrypted_event(GAPLEConnectionIntent *intent, void *unused_data) { prv_update_clients(intent, HciStatusCode_Success...
is the standard case list->serialized_byte_length = 4; list->data[0] = 'a'; list->data[1] = 'b'; list->data[2] = '\0'; list->data[3] = 'c'; // end of data list->data[4] = '\0'; cl_assert_equal_i(2, string_list_count(list)); cl_assert_equal_s("ab", string_list_get_at(list, 0)); cl_assert_equal_s("c", ...
(&item, TimelineItemActionTypeRemove)
, NULL); item.header.id = UUID_INVALID; cl_assert_equal_p(timeline_item_find_action_by_type(&item, 0), NULL); } void test_timeline_item__find_dismiss_action(void) { // Make sure we're resilient to NULL items cl_assert_equal_p(timeline_item_find_dismiss_action(NULL), NULL); // Make sure we can handle timeli...
sh_sector_is_erased(sector_addr)) { PBL_LOG(LOG_LEVEL_DEBUG, "Sector %#"PRIx32" already erased", sector_addr); return; } flash_lock(); if (!flash_is_enabled()) { flash_unlock(); return; } power_tracking_start(PowerSystemFlashErase); enable_flash_spi_clock(); handle_sleep_when_idle_begi...
flash_send_and_receive_byte(FLASH_CMD_WRITE_LOCK_REGISTER)
; flash_send_24b_address(addr); flash_send_and_receive_byte(lock_bits); flash_end_cmd(); } disable_flash_spi_clock(); flash_unlock(); } void flash_erase_sector(uint32_t sector_addr, FlashOperationCompleteCb on_complete_cb, void *context) { // TODO: ...
, command, s_pb_state.current_command); return true; } return false; } static uint32_t prv_parse_token(const PutBytesCommand command, const SharedHeader *header) { if (command == PutBytesInit) { return 0; } return ntohl(header->token); } static bool prv_check_for_state_error(PutBytesComm...
prv_send_response(ResponseNack, s_pb_state.token)
en. Make sure to keep the HR sensor on for at // least a little bit after the workout is finished const time_t now_ts = time_get_uptime_seconds(); const time_t time_since_workout = (now_ts - s_workout_data.last_workout_end_ts); // After a workout has finished, keep the HR sensor on for a bit to...
{ // We are unpaused and want to pause. Set the last_paused_utc timestamp wrkt_data->last_paused_utc = rtc_get_time(); }
s_workout_data.current_workout->paused = should_be_paused; // Update the global duration since we have changed the pause state prv_update_duration(); PBL_LOG(LOG_LEVEL_INFO, "Paused a workout with type: %d", wrkt_data->type); prv_put_event(PebbleWorkoutEvent_Paused); } prv_unlock(); return ...
/* * 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...
{ framebuffer_init(&s_fb, &(GSize) {DISP_COLS, DISP_ROWS}); framebuffer_clear(&s_fb); graphics_context_init(&s_ctx, &s_fb, GContextInitializationMode_App); s_app_state_get_graphics_context = &s_ctx; }
if (is_valid_weather_key && !prv_validate_received_pref(val_len, sizeof(SerializedWeatherAppPrefs), ((SerializedWeatherAppPrefs *)val)->num_locations, sizeof(Uuid))) { PBL_LOG(LOG_LEVEL_ERROR, "Error inserting app_prefs: invalid weather list"...
status_t rv = prv_lock_mutex_and_open_file(); if (rv == S_SUCCESS) { rv = settings_file_set(&s_watch_app_prefs_db.settings_file, key, key_len, val, val_len); // Cache the data we just set if it was for the Reminders app const int expected_reminder_app_prefs_size = sizeof(SerializedReminderAppPrefs); ...
/* * 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_convert_content_size_between_platforms(PreferredContentSizeMedium, PlatformTypeBasalt, PlatformTypeBasalt), PreferredContentSizeMedium)
comm/bt_conn_mgr.h" #include "kernel/core_dump.h" #include "kernel/events.h" #include "kernel/pbl_malloc.h" #include "gatt_client_accessors.h" #include "system/logging.h" #include <bluetooth/gatt.h> #include <bluetooth/gatt_discovery.h> #include <btutil/bt_device.h> // TODO: virtualize the gatt_client_discovery_disc...
{ if (!gap_le_connection_is_valid(connection)) { goto unlock; } if (bt_driver_gatt_stop_discovery(connection) != BTErrnoOK) { // Handle the race: Bluetopia service discovery has stopped in the mean time, for example // because of a disconnection, internal error or it completed right when ...
ctor_addr = flash_impl_get_sector_base_address(start_addr); flash_impl_use(); prv_issue_command(sector_addr, S29VSCommand_ClearStatusRegister); // Some sanity checks { status_t error = S_SUCCESS; const uint8_t sr = prv_read_status_register(sector_addr); if ((sr & S29VSStatusBit_DeviceReady) ==...
flash_impl_release()
; if ((status & S29VSStatusBit_DeviceReady) == 0) return E_BUSY; if ((status & S29VSStatusBit_ProgramSuspended) != 0) return E_AGAIN; if ((status & S29VSStatusBit_ProgramStatus) != 0) return E_ERROR; return S_SUCCESS; } uint8_t pbl_28517_flash_impl_get_status_register(uint32_t sector_addr) { flash_impl_use(...
} ctx->state = touch_state; bool send_event = false; if (update && !ctx->update_pending) { ctx->update_pending = true; send_event = true; } mutex_unlock(s_touch_mutex); if (send_event) { PebbleEvent e = { .type = PEBBLE_TOUCH_EVENT, .touch = { .type = PebbleTouchEvent_To...
(s_touch_ctx)
) { return; } s_touch_ctx[touch_idx].start_pos = touch_down_pos; s_touch_ctx[touch_idx].start_time_ms = touch_down_time_ms; s_touch_ctx[touch_idx].start_pressure = touch_down_pressure; s_touch_ctx[touch_idx].state = touch_state; } #endif
s, size_t num_points, bool open) {} typedef uint16_t ResourceId; const uint8_t *resource_get_builtin_bytes(ResAppNum app_num, uint32_t resource_id, uint32_t *num_bytes_out) { return NULL; } // setup and teardown void test_gdraw_command_sequence__initialize(void) { } v...
(frame, gdraw_command_sequence_get_frame_by_elapsed(sequence, 14))
; frame = gdraw_command_sequence_get_frame_by_elapsed(sequence, 15); cl_assert_equal_p(frame, gdraw_command_sequence_get_frame_by_index(sequence, 1));; cl_assert_equal_p(frame, gdraw_command_sequence_get_frame_by_elapsed(sequence, 44)); cl_assert_equal_p(frame, gdraw_command_sequence_get_frame_by_elapsed(seque...
/* * 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_INFO, "Writing boot FPGA bitstream to flash...")
; // Read the mfg data and write it back again. The prv_update_struct function write in a fresh // copy of the FPGA image as a side effect. MfgData data = prv_fetch_struct(); prv_update_struct(&data); } }
rnel: e = gatt_client_subscriptions_subscribe(characteristic, BLESubscriptionIndications, GAPLEClientKernel); cl_assert_equal_i(e, BTErrnoOK); // Simulate getting confirmation from remote: prv_confirm_cccd_write(BLEGATTErrorSuccess); fake_event_clear_last(); fake_e...
(gatt_client_subscription_get_semaphore(), prv_taking_too_long_to_consume_yield_cb)
; fake_event_clear_last(); gatt_client_subscriptions_handle_server_notification(s_connection, s_handle, value, 1 /* one byte */); // Data will be dropped, no event :( prv_assert_no_event(); // Receive another GATT notification. Won't fit until consumed. ...
); } static void prv_object_queue_handle_chunk_sent(void) { DBG("Sent Chunk Successfully."); size_t bytes_remaining_before_sent_chunk; size_t sent_chunk_payload_size; prv_calc_current_chunk_size(&bytes_remaining_before_sent_chunk, &sent_chunk_payload_size); const bool is_object_complete = (sent_chunk_paylo...
if (!buffer) { APP_LOG(APP_LOG_LEVEL_ERROR, "Not enough mem to recv postMessage() of %"PRIu32" bytes", (uint32_t) chunk->total_size_bytes); // https://pebbletechnology.atlassian.net/browse/PBL-42466 // TODO: AppMessage NACK the message so the other side can retry later. Not doing this wi...
s_state.in.reassembly_buffer = buffer; s_state.in.total_size_bytes = chunk->total_size_bytes; s_state.in.received_size_bytes = 0; } else { // If this is not the first message, sanity check the chunk: if (s_state.in.received_size_bytes != chunk->offset_bytes) { PBL_LOG(LOG_LEVEL_ERROR, ...
_dnd_enabled); RESTORE_PREF(PREF_KEY_DND_INTERRUPTIONS_MASK, s_dnd_interruptions_mask); RESTORE_PREF(PREF_KEY_LEGACY_DND_SCHEDULE, s_legacy_dnd_schedule); RESTORE_PREF(PREF_KEY_LEGACY_DND_SCHEDULE_ENABLED, s_legacy_dnd_schedule_enabled); RESTORE_PREF(s_dnd_schedule_keys[WeekdaySchedule].schedule_pref_key, ...
SET_PREF(key, id)
; } #endif /////////////////////////////////////////////////////////////////////////////////////////////////// //! DND void alerts_preferences_dnd_set_mask(AlertMask mask) { s_dnd_interruptions_mask = mask; SET_PREF(PREF_KEY_DND_INTERRUPTIONS_MASK, s_dnd_interruptions_mask); } AlertMask alerts_preferences_dnd_ge...
ue( WorkoutMetricType_Hr, active_window->workout_data); if (bpm == 0 && !active_window->hr_measuring_timer) { active_window->cur_hr_measuring_width_idx = 0; prv_hr_measuring_timer_callback(active_window); } } ////////////////////////////////////////////////////////////////////////////////////////////...
(zone_rect, GEdgeInsets(1))
; graphics_draw_rect(ctx, &zone_rect); graphics_draw_rect(ctx, &inner_rect); } // increment x to draw more zones zone_rect.origin.x += zone_rect.size.w + zone_padding; } } static void prv_render_metric(GContext *ctx, WorkoutMetricType metric_type, Layer *layer, G...
end_data(session, protocol_time_endpoint_id, response_buffer, response_buffer_length, COMM_SESSION_DEFAULT_TIMEOUT); PBL_LOG_VERBOSE("protocol_time_callback called, responding with current time: %"PRIu32, (uint32_t)t); break; } // Set time: case...
if (clock_is_24h_style()) { buffer[0] = '\0'; return 0; } else { return prv_format_time(buffer, buffer_size, i18n_noop("%p"), timestamp); }
} static void prv_copy_time_string_timestamp(char *number_buffer, uint8_t number_buffer_size, char *word_buffer, uint8_t word_buffer_size, time_t timestamp) { clock_get_time_number(number_buffer, number_buffer_size, timestamp); clock_get_time_word(word_buffer, word_buffer_size, timestamp); } static void prv_...
// elapsed: 4 minutes { -40, 920, 272}, { -32, 928, 256}, { -40, 920, 280}, { -40, 912, 272}, { -40, 912, 264}, { -40, 912, 280}, { -32, 912, 272}, { -32, 912, 264}, { -32, 912, 272}, { -40, 912, 264}, { -40, 904, 272}, { -32, 912, 272}, { -40, 912, 248}, { -...
{ -32, 912, 256}, { -32, 912, 256}, { -32, 920, 256}, { -32, 912, 256}, { -32, 912, 256}, { -32, 912, 256}, { -32, 912, 256}, { -32, 912, 256}, { -32, 920, 256}, { -40, 920, 264}, { -32, 920, 256}, { -40, 920, 248}, { -32, 912, 256}, { -32, 912, 256}, { -32, 9...
{ -24, 920, 256}, { -32, 928, 248}, { -24, 912, 256}, { -24, 912, 256}, { -32, 912, 256}, { -24, 912, 256}, { -24, 912, 248}, { -24, 920, 240}, // 249 seconds { -32, 920, 256}, { -32, 920, 248}, { -24, 920, 256}, { -24, 912, 248}, { -32, 920, 248}, { -32, 912...
ting, 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 "pebble_tasks.h" #include "kernel/memory...
app_manager_get_task_context()
->to_process_event_queue; break; case PebbleTask_KernelBackground: queue = NULL; break; default: WTF; } return queue; } void pebble_task_create(PebbleTask pebble_task, TaskParameters_t *task_params, TaskHandle_t *handle) { MpuRegion app_region; MpuRegion ...
ero is ignored draw_state = graphics_context_get_drawing_state(&context); graphics_context_set_stroke_width(&context, 0); cl_assert(memcmp(&draw_state, &context.draw_state, sizeof(GDrawState)) == 0); // Check draw state memset(&draw_state, 0x5A, sizeof(GDrawState)); graphics_context_set_drawing_state(&cont...
(&context, &GRect(10, 20, 40, 10), SW_EVEN)
); setup_test(&context, false, SW_EVEN, GColorBlack, GColorBlack, false); graphics_draw_circle(&context, GPoint(50, 50), 10); ASSERT_CALLED(graphics_circle_draw_stroked_non_aa(&context, GPoint(50, 50), 10, SW_EVEN)); setup_test(&context, false, SW_EVEN, GColorBlack, GColorBlack, false); graphics_draw_round_...
ew != show_old) { return (show_old ? 1 : 0) - (show_new ? 1 : 0); } else { return prv_time_comparator(old_node, new_node); } } static void prv_set_node_from_header(CommonTimelineItemHeader *header, TimelineNode *node_out) { prv_set_nodes(&(TimelineNode *) { node_out }, header, 1 /* num_nodes */); } int ...
(&timeline_iter_state->pin)
Memory Region %d: %p - 0x%lx", index, region_buf[index].start, region_buf[index].length); } // Get a core dump flash memory slot uint32_t flash_addr, max_size; if (!core_dump_reserve_ble_slot(&flash_addr, &max_size, (ElfExternalNote *)build_id)) { PBL_LOG(LOG_LEVEL_ERROR, "Can't reserve slot fo...
prv_spi_transaction(&cmd, NULL, 0)
) { PBL_LOG(LOG_LEVEL_ERROR, "Unable to power down"); goto spi_failed; } spi_failed: #if !PLATFORM_ROBERT kernel_free(s_rx_buffer); #endif kernel_free(region_buf); PBL_LOG(LOG_LEVEL_INFO, "BLE Core Dump complete"); } // NB: this function runs on the host_transport thread (BTTrans). static void prv_co...
eaderBasic; typedef struct PACKED { char version_tag[FW_METADATA_VERSION_TAG_BYTES]; uint8_t is_recovery; } FileHeaderDetails; typedef struct PACKED { FileHeaderBasic basic; FileHeaderDetails details; } FileHeader; //! This value is chosen because older style (pre In-N-Out) filesystems set the first bit to z...
if (file_header.version_id != CURRENT_VERSION_ID) { return false; }
if (file_header.file_id != (s_current_file_id - file_generation)) { PBL_LOG(LOG_LEVEL_DEBUG, "Id: %"PRIu8" Expected: %u", file_header.file_id, (s_current_file_id - file_generation)); return false; } return true; } uint32_t debug_db_get_stats_base_address(int file_generation) { PBL_ASSERTN(file_gener...
idx); \ } void test_alt_message_handler(const uint8_t *data, size_t length, AppInboxConsumerInfo *consumer_info) { cl_assert(false); } void test_alt_dropped_handler(uint32_t num_dropped_messages) { cl_assert(false); } /////////////////////////////////////////////////////////////////...
(true, app_inbox_service_has_inbox_for_storage(storage))
; cl_assert_equal_b(true, app_inbox_service_has_inbox_for_tag(AppInboxServiceTagUnitTest)); fake_kernel_malloc_mark(); success = app_inbox_service_register(storage, sizeof(storage), test_alt_message_handler, test_alt_dropped_handler, A...
il/bt_device.h> #include <btutil/bt_uuid.h> #include "FreeRTOS.h" #include "semphr.h" // Fakes /////////////////////////////////////////////////////////// #include "fake_events.h" #include "fake_pbl_malloc.h" #include "fake_GATTAPI.h" #include "fake_GATTAPI_test_vectors.h" #include "fake_new_timer.h" #include "fake_...
(event.bluetooth.le.gatt_client.gatt_error, error)
; PebbleTaskBitset task_mask = ~0; if (kernel) { task_mask &= ~gap_le_pebble_task_bit_for_client(GAPLEClientKernel); } if (app) { task_mask &= ~gap_le_pebble_task_bit_for_client(GAPLEClientApp); } cl_assert_equal_i(event.task_mask, task_mask); } static void prv_assert_notification_event_ext(BLEChar...
ength_ptr = data + offsetof(TimezoneCBData, region_name_len); if (length != (sizeof(uint8_t) + header_size + *timezone_length_ptr)) { PBL_LOG(LOG_LEVEL_WARNING, "Set timezone message invalid length"); return; } TimezoneCBData *timezone_data = (TimezoneCBData *)data; prv_handle_s...
("Today", buffer, buffer_size)
r_callback(watchface_order, num_entries, watchface_filter_callback); } } void test_app_menu_data_source__last_app_not_in_order_file(void) { // settings has to be at the beginning. The app_menu_data_source module enforces it AppInstallId app_order[] = {APP_ID_SETTINGS, ...
(node->install_id, desired_order[i])
; } app_menu_data_source_deinit(&data_source); } void test_app_menu_data_source__complete_sorted_order(void) { // Apps are sorted in the order of Quick Launch only, Override apps, Storage (smallest first), // Record (smallest first), and finally Install ID (smallest first). Verify that this is true. // This...
"util/attributes.h" #include "util/net.h" #include "util/string.h" #include <inttypes.h> #include <limits.h> #include <stdarg.h> #include <stdint.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #define NEW_LOG_HEADER "NL" NEW_LOG_VERSION _Static_assert((CORE_ID_MAIN_MCU & PACKED_CORE_MASK) == CORE_ID_MA...
va_end(args)
; return (len); } // Return a pointer to the LogState to use. The LogState contains the buffers for formatting the log message. // There are two possible LogState instances: one for the app task and one for all other (privileged) tasks (which // is guarded by a mutex). // Returns NULL if a logging operation is alre...
_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(0, 5), 0); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 7), 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(...
GPoint(5, 0)
0, 0x0}, { 0, 0x64, 0, 0x0}, { 0, 0x54, 315, 0x0}, { 0, 0x24, 0, 0x0}, { 0, 0x24, 0, 0x0}, { 0, 0x24, 0, 0x0}, // 540: Local time: 05:11:00 AM { 0, 0x24, 0, 0x0}, { 0, 0x24, 0, 0x0}, { 0, 0x23, 1749, 0x0}, { 0, 0x82, 34, 0x0}, { 0, 0x82, 0, 0x0}, { 0, 0x82, 0,...
{ 0, 0x65, 0, 0x0}, { 0, 0x65, 0, 0x0}, { 0, 0x65, 0, 0x0}, { 0, 0x65, 0, 0x0}, { 0, 0x67, 753, 0x0}, { 0, 0x68, 0, 0x0}, { 0, 0x68, 0, 0x0}, // 660: Local time: 07:11:00 AM { 0, 0x68, 0, 0x0}, { 0, 0x68, 0, 0x0}, { 0, 0x68, 563, 0x0}, { 0, 0x35, 0, 0x0}, {...
{ 0, 0x61, 0, 0x0}, { 0, 0x61, 356, 0x0}, { 14, 0x42, 4000, 0x0}, { 0, 0x43, 76, 0x0}, { 0, 0x42, 4938, 0x0}, { 0, 0x42, 3420, 0x0}, { 0, 0x42, 3520, 0x0}, { 12, 0x42, 5809, 0x0}, { 0, 0x51, 4623, 0x0}, { 12, 0x62, 4080, 0x0}, // 720: Local time: 08:11:00 AM { ...
_WATCHINFO_FW "firmware" #define ROCKY_WATCHINFO_FW_MAJOR "major" #define ROCKY_WATCHINFO_FW_MINOR "minor" #define ROCKY_WATCHINFO_FW_PATCH "patch" #define ROCKY_WATCHINFO_FW_SUFFIX "suffix" static const char *prv_get_platform_name_string(void) { const PlatformType platform = sys_get_current_app_sdk_platform(); re...
("pebble_2_hr_flame")
on = { .event_id = EventIDNotificationAdded, .event_flags = 0, .category_id = CategoryIDSocial, .category_count = 1, .uid = 0, }; const uint32_t comple_dict_uid = ((GetNotificationAttributesMsg*)s_complete_dict)->notification_uid; ns_notification.uid = s_invalid_param_uid; // This will ret...
cl_assert_equal_i(s_num_requested_app_attributes, 2)
; // Test a recognized app with a unique title prv_send_notification((uint8_t *)&s_message_dict); prv_cmp_last_received_notification(&s_message_parsed_item); // Test an unrecognized app with a unique title prv_send_notification((uint8_t *)&s_unknown_app_unique_title_dict); prv_cmp_last_received_notificati...
> VIBE_SCORE_VERSION) { return false; } // check if attr_list_size is correct if (score->attr_list_size != (data_size - (sizeof(VibeScore) - sizeof(GenericAttributeList)))) { return false; } // check exact file size to contain all flexible-sized data for (unsigned int i = 0; i < score->attr_list.n...
for (unsigned int i = 0; i < pattern_length; i++) { VibeNote *note = &note_list[pattern_list[i]]; duration_ms += (note->vibe_duration_ms + note->brake_duration_ms); }
return duration_ms; } unsigned int vibe_score_get_repeat_delay_ms(VibeScore *score) { if (!score) { return 0; } GenericAttribute *repeat_delay_attribute = generic_attribute_find_attribute(&score->attr_list, VibeAttributeId_RepeatDelay, score->attr_list_size); ...
mutex); unsigned int data_buffer_length = sizeof(DataLoggingSendDataMessage) + num_bytes; if (!uuid_is_system(&logging_session->app_uuid)) { analytics_inc_for_uuid(ANALYTICS_APP_METRIC_LOG_OUT_COUNT, &logging_session->app_uuid); analytics_add_for_uuid(ANALYTICS_APP_METRIC_LOG_BYTE_OUT_COUNT, data_buffer_le...
{ DataLoggingReopenEntry *entry = (DataLoggingReopenEntry *)data; if (!entry) { s_endpoint_data.report_in_progress = false; return; } DataLoggingReopenEntry *new_head = (DataLoggingReopenEntry *)list_pop_head((ListNode *)entry); // Try and reopen this session bool success = false; if (dls_list_is...
new_head = (DataLoggingReopenEntry *)list_pop_head((ListNode *)new_head); kernel_free(entry); } } } //! For use with dls_list_for_each_session. Appends this session to our list of sesions we need to open. //! On entry, 'data' points to the variable holding the head of the list. static bool dls_endpo...
if (0 == memcmp(&nil_key, &data.keys[key_type], sizeof(nil_key))) { rv = false; goto unlock; } if (key_out) { memcpy(key_out, &data.keys[key_type], sizeof(*key_out)); } rv = true; } unlock: prv_unlock(); return rv; } void shared_prf_storage_set_root_keys(SM128BitKey *keys...
(pairing_info->is_remote_identity_info_valid, SprfValidFields_RemoteIdentityInfoValid)
| SPRF_FLAG_GET_BIT(pairing_info->is_remote_signing_info_valid, SprfValidFields_RemoteSigningInfoValid), }; SPRF_PERSIST_FIELD(data, ble_pairing_data); if (name) { // only persist name if one is actually included SprfBlePairingName name_data =...
e__gc_past(void) { Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; // Tue Jan 13 11:40:00 PST 2015 rtc_set_time(1421178000); fake_pbl_malloc_clear_tracking(); cl_assert_equal_i(fake_pbl_malloc_num_net_allocs(), 0); timeline_init(&head); cl_assert_equal_i(timeline_it...
(&state.pin.header.id, &s_items[4].header.id)
); // check third cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[5].header.id)); // check second again cl_assert(iter_prev(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[4].header.id)); // check fourth cl_assert(iter_next(&iterator)); cl_assert(i...
PECT_OUTBOX_MESSAGE_PENDING(TupletBytes(PostMessageKeyChunk, (const uint8_t *) chunk, expected_size)); // Compare with hard-coded byte array, to catch accidental changes to the ABI: const uint8_t raw_bytes_v1[] = { 0x08, 0x00, 0x00, 0x00, '}', '\0', }; ...
("var didError = false;" "var x = { \"x\" : 1 };" "var dataJSON = undefined;" "_rocky.on('postmessageerror', " " function(e) { didError = true; dataJSON = JSON.stringify(e.data); });" "_rocky.postMessage(x);" ...
; ASSERT_JS_GLOBAL_EQUALS_B("didError", false); for (int i = 0; i < 3; ++i) { cl_assert_equal_b(s_is_outbox_message_pending, true); // NACK prv_rcv_app_message_ack(APP_MSG_BUSY); AppTimer *t = rocky_api_app_message_get_app_msg_retry_timer(); cl_assert(t != EVENTED_TIMER_INVALID_ID); cl_a...
}, &menu_layer); uint16_t num_apps = app_menu_data_source_get_count(&data_source); // cl_assert_equal_i(num_apps, num_entries); for (uint16_t i = 0; i < num_apps; i++) { AppMenuNode *node = app_menu_data_source_get_node_at_index(&data_source, i); cl_assert_equal_i(node->install_id, order[i]); } app...
(&data_source)
; } void test_app_menu_data_source__all_floating_apps(void) { // settings has to be at the beginning. The app_menu_data_source module enforces it // This test will move the music app to the second position AppInstallId written_order[] = {APP_ID_SETTINGS, APP_ID_NOTIFICATIONS, APP_ID_ALARMS, ...
.id = { 0x29, 0xac, 0xd8, 0xb5, 0x09, 0xc7, 0x4c, 0x31, 0xbf, 0x6f, 0x03, 0x64, 0xd0, 0x5b, 0x9b, 0xc2 }, .timestamp = midnight_march_3_utc, .duration = MINUTES_PER_DAY, .type = TimelineItemTypePin, .layout = LayoutIdTest, .all_day = 0, // this is a non-all-day event spannin...
timeline_add(&multiday_item)
); Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; cl_assert_equal_i(timeline_init(&head), S_SUCCESS); // 1425272400 is 21:00 March 1 2015 PST cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, 1425272400), S_SUCCESS); time_...
----------------------- // Test that our periodic minute callback correctly detects the midnight rollover void test_activity__day_rollover(void) { // Start activity tracking. This method assumes it can be called from any task, so we must // invoke system callbacks to handle its KernelBG callback. activity_start_t...
{ exp_resting_kcalories[i] = ROUND(s_exp_full_day_resting_kcalories * (MINUTES_PER_DAY - 1), MINUTES_PER_DAY); }
else { exp_resting_kcalories[i] = s_exp_full_day_resting_kcalories; } } ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricRestingKCalories, exp_resting_kcalories); // Verify that the expired and invalid activity session have been removed ASSERT_NUM_ACTIVITY_SESSIONS(0); // Verify that we have the right h...
p_outbox_mutex); } static AppOutboxConsumer *prv_consumer_for_tag(AppOutboxServiceTag tag) { if (tag == AppOutboxServiceTagInvalid) { return NULL; } AppOutboxConsumer *consumer = &s_app_outbox_consumer[tag]; if (consumer->message_handler == NULL) { return NULL; } return consumer; } static void prv...
{ status = AppOutboxStatusOutOfResources; goto finally; }
const size_t consumer_data_length = consumer->consumer_data_length; AppOutboxMessage *message = (AppOutboxMessage *)kernel_zalloc(sizeof(AppOutboxMessage) + consumer_data_length); if (!message) { status = AppOutboxStatusOutOfMemory; goto finally; } *message = (AppOutboxMessage...
d(ctx, false); graphics_context_set_fill_color(ctx, GColorBlack); graphics_fill_round_rect(ctx, &GRect(2, 2, 28, 20), 4, GCornersAll); } void white_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_antialiased(ctx, false); graphics_context_set_fill_color(ctx, GColorWhite); graphics_fill_...
test_graphics_context_init(&ctx, fb)
; layer_init(&layer, &GRect(0, 0, 32, 24)); layer_set_update_proc(&layer, &corners_all_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_corners_all.${BIT_DEPTH_NAME}.pbi")); layer_set_update_proc(&layer, &white_layer_update_callback); layer_render_tree(...
DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_circle_quadrant_draw_1px_non_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, GCornerBottomLeft); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_offset_r8_quad_bottom_left.${BIT_DEPTH_NAME}.pbi")); ...
(0, 0, 60, 60)
); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_inside_origin_layer.${BIT_DEPTH_NAME}.pbi")); layer_set_update_proc(&layer, &white_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(frameb...
/* * 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...
(sizeof(FrameBuffer))
; framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); test_graphics_context_init(&s_ctx, fb); framebuffer_clear(fb); } void test_emoji_fonts__cleanup(void) { free(fb); fb = NULL; gbitmap_destroy(s_dest_bitmap); s_dest_bitmap = NULL; } // Helpers ////////////////////// static char s_emoji_string[] ...
Context *transition_ctx = &stack->transition_context; return prv_window_is_render_scheduled(transition_ctx->window_from) || prv_window_is_render_scheduled(transition_ctx->window_to); } void app_request_render(void) { Window *window = app_window_stack_get_top_window(); if (window) { window_schedule_r...
event_service_client_subscribe( &events_info->legacy2_status_bar_change_event)
; } // NOTE: We could be super fancy and register and unregister when the fullscreen // status changes, but it's probably not worth it as we'll be waking up once a // minute anyway to update the face itself and it will happen as part of the same interval } static void prv_legacy2_status_bar_timer_unsubscribe(v...
gin_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, TEST_NAMED_PBI_FILE("draw_line_across_ny_origin_layer"))); } void test_graphics_draw_line__offset_layer(void...
GPoint(0, 8)
/* * 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...
(InhibitorVibes)
; } else { stop_mode_enable(InhibitorVibes); } stop_mode_disabled = on; } } static uint16_t prv_get_vsys_mv(void) { if (battery_get_charge_state().is_plugged) { // Plugged in, use Vsys rather than Vbat return pmic_get_vsys(); } // Not plugged in, use latest battery reading return ba...
[key_type])); } return true; } void bt_persistent_storage_set_root_keys(SM128BitKey *keys_in) { if (!keys_in) { return; } shared_prf_storage_set_root_keys(keys_in); prv_file_set(&ROOT_KEYS_KEY, sizeof(ROOT_KEYS_KEY), keys_in, SMRootKeyTypeNum * sizeof(SM128BitKey)); } bool bt_persiste...
kernel_free(key)
; kernel_free(data); } void bt_persistent_storage_delete_all_pairings(void) { prv_lock(); { SettingsFile fd; status_t rv = settings_file_open(&fd, BT_PERSISTENT_STORAGE_FILE_NAME, BT_PERSISTENT_STORAGE_FILE_SIZE); if (rv) { return; } settings_file_r...
rom PRF storage:"); PBL_HEXDUMP(LOG_LEVEL_INFO, (const uint8_t *) keys, sizeof(keys)); #endif bt_persistent_storage_set_root_keys(keys); return; } // if we get here there are no root keys in prf storage, let's load the root // keys normal fw has been using. This shouldn't ever really happen unless we...
{ if (!prv_file_get(&bonding, sizeof(bonding), data_out, sizeof(*data_out))) { return false; } if (data_out->type != type) { PBL_LOG(LOG_LEVEL_ERROR, "Type mismatch: not deleting pairing. Is the bonding db corrupted?"); return false; } if (prv_file_set(&bonding, sizeof(bonding), NULL, 0) == GapB...
bool prv_has_active_gateway_by_type(BtPersistBondingType desired_type) { BTBondingID bonding; BtPersistBondingType type; if (!bt_persistent_storage_get_active_gateway(&bonding, &type)) { return false; } if (bonding == BT_BONDING_ID_INVALID || type != desired_type) { return false; } return tru...
/* * 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...
(status_bar, status_bar_color, gcolor_legible_over(status_bar_color))
; layer_add_child(&window->window.layer, &status_bar->layer); } window_set_click_config_provider(result, prv_click_config_proivider); window_set_window_handlers(&window->window, &(WindowHandlers){ .unload = prv_window_unload, }); return result; } static void prv_handle_init(void) { Window *wind...
TOPPED = 2, FLASH_TEST_STATUS_PASSED = 3, FLASH_TEST_STATUS_FAILED = 4, }; #define STATUS_TEXT_SIZE 18 struct FlashTestData { Window window; SimpleMenuLayer simple_menu_layer; SimpleMenuSection menu_sections[1]; SimpleMenuItem menu_items[FLASH_TEST_CASE_NUM_MENU_ITEMS]; Window test_window; TextLayer ms...
(0, 64, window->layer.bounds.size.w, 40)
) != NULL) { ++count; } return count; } uint32_t list_count_to_head_from(ListNode *node) { if (node == NULL) { return 0; } uint32_t count = 1; while ((node = node->prev) != NULL) { ++count; } return count; } uint32_t list_count(ListNode* node) { return list_count_to_tail_from(list_get_he...
{ snprintf(buffer, sizeof(buffer), "node %p (%p, %p)", iter, iter->prev, iter->next); UTIL_LOG(buffer); iter = iter->next; }
}
e "stubs_persist.h" #include "stubs_print.h" #include "stubs_prompt.h" #include "stubs_rand_ptr.h" #include "stubs_resources.h" #include "stubs_serial.h" #include "stubs_simple_dialog.h" #include "stubs_syscall_internal.h" #include "stubs_task.h" #include "stubs_tick.h" #include "stubs_timeline_peek.h" #include "stubs_...
{ return NULL; }
>show_status_layer ? 6 : 0; uint16_t text_top_margin_px = icon ? icon_size.h + 22 : 6; uint16_t icon_top_margin_px = 18; uint16_t x = 0; uint16_t y = 0; uint16_t w = PBL_IF_RECT_ELSE(bounds->size.w - ACTION_BAR_WIDTH, bounds->size.w); uint16_t h = STATUS_BAR_LAYER_HEIGHT; if (dialog->show_status_layer) {...
{ #if !defined(RECOVERY_FW) actionable_dialog->select_icon = gbitmap_create_with_resource(RESOURCE_ID_ACTION_BAR_ICON_X); #endif action_bar_layer_set_context(action_bar, window); action_bar_layer_set_icon(action_bar, BUTTON_ID_SELECT, actionable_dialog->select_icon); }
else if (actionable_dialog->action_bar_type == DialogActionBarConfirmDecline) { #if !defined(RECOVERY_FW) actionable_dialog->up_icon = gbitmap_create_with_resource(RESOURCE_ID_ACTION_BAR_ICON_CHECK); actionable_dialog->down_icon = gbitmap_create_with_resource(RESOURCE_ID_ACTION_BAR_ICON_X); #endif action_b...
stributed 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 "board/board.h" #include "drivers/flash/flash_impl.h" #includ...
qspi_flash_unlock_all(QSPI_FLASH)
; } status_t flash_impl_init(bool coredump_mode) { qspi_flash_init(QSPI_FLASH, &QSPI_FLASH_PART, coredump_mode); qspi_flash_unlock_all(QSPI_FLASH); return S_SUCCESS; } status_t flash_impl_get_erase_status(void) { return qspi_flash_is_erase_complete(QSPI_FLASH); } status_t flash_impl_erase_subsector_begin(Fla...
/* * 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...
{ GPIO_InitTypeDef init = { .GPIO_Pin = pin_config.gpio_pin, .GPIO_Mode = GPIO_Mode_OUT, .GPIO_Speed = speed, .GPIO_OType = otype, .GPIO_PuPd = GPIO_PuPd_NOPULL }; gpio_use(pin_config.gpio); GPIO_Init(pin_config.gpio, &init); gpio_release(pin_config.gpio); }
er); #endif } static NORETURN prv_reset(void) { dbgserial_flush(); system_hard_reset(); } // ----------------------------------------------------------------------------------------- void coredump_assert(int line) { prv_debug_str_int("CD: assert - line ", line); boot_bit_set(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED...
prv_flash_write_bytes(&region_hdr, base_address, sizeof(region_hdr))
/* * 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_check(gcolor_equal(get_bitmap_color(test_image_color, 30, 10), GColorRed))
; cl_check(gcolor_equal(get_bitmap_color(test_image_color, 30, 30), GColorScreaminGreen)); #endif } void test_graphics_draw_rotated_bitmap__origin_bw_assign(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // No Clip, Angle 0 setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO...
/* * 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...
section(".log_buffer")
)); static LogBuffer s_log_buffer = { .level = LOG_LEVEL_ALWAYS, .transmitting = false, }; /* * Duplicate _VERBOSE -- let's have a reasonable entry for every value should something go * wrong on the packing end. */ static const uint8_t LEVEL_MAP[8] = { LOG_LEVEL_ALWAYS, LOG_LEVEL_ERROR, LOG_LEVEL_WARNING, ...
, { 488, 344, -832}, { 448, 120, -824}, { 448, 72, -896}, { 416, -32, -824}, { 432, 0, -816}, { 376, 0, -896}, { 440, 176, -944}, { 352, 24, -888}, { 464, 80, -912}, { 440, -96, -760}, { 448, -48, -744}, { 456, -384, -696}, { 448, -408, -896}, // 21 seconds { ...
{ -600, 952, -256}, { -784, 616, -160}, { -864, 664, -320}, { -728, 640, -376}, { -688, 712, -424}, { -624, 640, -456}, { -648, 800, -400}, { -592, 792, -408}, { -512, 752, -400}, { -488, 784, -368}, { -416, 840, -360}, { -360, 864, -336}, { -336, 896, -264}, { -2...
alse, false, false, false, false}; id1 = alarm_create(&(AlarmInfo) { .hour = 3, .minute = 14, .kind = ALARM_KIND_CUSTOM, .scheduled_days = &schedule_1 }); prv_assert_alarm_config(id1, 3, 14, false, ALARM_KIND_CUSTOM, schedule_1); alarm_get_custom_days(id1, verify_schedule_1); prv_assert_alarm_config(id1, 3, 14,...
cl_assert_equal_i(s_num_timeline_adds, 12)
; cl_assert_equal_i(s_num_timeline_removes, 9); } void test_alarm__alarm_delete(void) { AlarmId id1, id2, id3, id4, id5, id6, id7; id1 = alarm_create(&(AlarmInfo) { .hour = 3, .minute = 14, .kind = ALARM_KIND_EVERYDAY }); id2 = alarm_create(&(AlarmInfo) { .hour = 4, .minute = 14, .kind = ALARM_KIND_EVERYDAY })...
attery_curve_lookup_voltage_by_percent(0, true); int charge_terminate_mv = battery_curve_lookup_voltage_by_percent(80, false); fake_battery_init(charge_mv, true, true); battery_monitor_init(); periodic_timer_trigger(1); fake_battery_set_millivolts(charge_terminate_mv); fake_battery_set_charging(false); ...
fake_battery_set_connected(true)
r_animation, ACTION_BAR_DISAPPEAR_ANIMATION_FRAMES * ANIMATION_FRAME_MS); animation_set_curve(action_bar_animation, AnimationCurveEaseIn); GPoint overshoot = GPoint(PBL_IF_RECT_ELSE(ACTION_BAR_WIDTH / 2, 0) + BOUNCEBACK_DISTANCE, 0); Animation *ui_movement = property...
{ const char *app_id = prv_get_app_id(number, source); if (!app_id) { return false; } // Load actions from prefs db and determine if we have an SMS reply option iOSNotifPrefs *notif_prefs = ios_notif_pref_db_get_prefs((uint8_t *)app_id, strlen(app_id)); if (!notif_prefs) { return false; } // ...
/* * 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...
MenuIndex(0, 2)
, MenuRowAlignCenter, false); #endif window_render(&card->window, &s_ctx); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); }
ate_step_derived_metrics(time_t utc_sec) { ActivityState *state = activity_private_state(); mutex_lock_recursive(state->mutex); { int minute_of_day = time_util_get_minute_of_day(utc_sec); // The "no-steps-during-sleep" logic can introduce negative steps, so make sure we clip // negative steps to 0 whe...
{ metric = ActivityMetricHeartRateZone2Minutes; }
else if (zone == HRZone_Zone3) { metric = ActivityMetricHeartRateZone3Minutes; } else { // Don't store data for Zone 0 return; } SettingsFile *file = activity_private_settings_open(); if (!file) { return; } ActivityMetricInfo m_info; activity_metrics_prv_get_metric_info(metric, &m_info)...
//! Evaluates to 1 iff execution will use the process stack when returning from //! the exception. #define RETURNS_TO_PSP(exc_return) ((exc_return & 0x4) == 0x4) //! This symbol and its contents are provided by the linker script, see the //! .note.gnu.build-id section in src/fw/stm32f2xx_flash_fw.ld extern const El...
flash_read_bytes(buffer_ptr, start_addr, buffer_size)
; } } // ------------------------------------------------------------------------------------------------- // NOTE: We are explicitly avoiding use of vsniprintf and cohorts to reduce our stack // requirements static void prv_debug_str(const char* msg) { kernel_pbl_log_from_fault_handler(__FILE_NAME__, 0, msg); } ...
lloc(size_t count, size_t size) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; return heap_calloc(task_heap_get_for_current_task(), count, size, saved_lr); } void *task_calloc_check(size_t count, size_t size) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; Heap *heap = task_h...
kernel_heap_get()
, size, saved_lr); } void *kernel_zalloc_check(size_t bytes) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; Heap *heap = kernel_heap_get(); void *mem = heap_zalloc(heap, bytes, saved_lr); if (!mem && bytes != 0) { PBL_CROAK_OOM(bytes, saved_lr, heap); } return mem; } void kernel_fre...
/* * 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_truncation_tests)
ityWalk; } if (sys_activity_sessions_is_session_type_ongoing(ActivitySessionType_Run)) { result |= HealthActivityRun; } if (sys_activity_sessions_is_session_type_ongoing(ActivitySessionType_Open)) { result |= HealthActivityOpenWorkout; } return result; #endif } // -------------------------------...
if (!prv_calculate_time_range(start_time, end_time, &range)) { return HealthServiceAccessibilityMaskNotAvailable; }
if (range.last_day_idx > 2) { return HealthServiceAccessibilityMaskNotAvailable; } return HealthServiceAccessibilityMaskAvailable; #endif } // ---------------------------------------------------------------------------------------------- MeasurementSystem health_service_get_measurement_system_for_display(...
st PPoGATTClient *client, PPoGATTPacket **heap_packet_in_out) { PPoGATTPacket *packet = *heap_packet_in_out; // Lazily allocate a buffer on the heap: if (!packet) { const uint16_t max_payload_size = prv_get_max_payload_size(client); if (max_paylo...
new_timer_start(client->rx_ack_timer, PPOGATT_MAX_DATA_ACK_LATENCY_MS, rx_ack_timer_cb, client, 0)
; } // We will defer sending the Ack for now, fallthrough and send data instead } // Data packets: if (client->state != StateConnectedOpen) { return NULL; }; if (prv_num_packets_in_flight(client) >= client->out.tx_window_size) { // Max number of data packets in flight, try again when we got s...
jerry_value_t listener, void *data); static void prv_iterate_event_listeners(const char *event_name, EventListenerIteratorCb callback, void *data) { PBL_ASSERTN(callback); JS_VAR rocky = rocky_get_rocky_singleton(); JS_VAR all...
jerry_string_to_utf8_char_buffer(argv[0], (jerry_char_t *)event_name, event_name_size)
; if (len == 0 || len == event_name_size) { return rocky_error_argument_invalid("Not a valid event"); } if (!jerry_value_is_function(argv[1])) { return rocky_error_argument_invalid("Not a valid handler"); } *func = argv[1]; return jerry_create_undefined(); } JERRY_FUNCTION(prv_add_event_listener)...
{1186012800,"31","07"},{1186099200,"31","07"}, {1186185600,"31","07"},{1186272000,"31","07"},{1186358400,"32","07"},{1186444800,"32","07"},{1186531200,"32","07"},{1186617600,"32","07"},{1186704000,"32","07"}, {1186790400,"32","07"},{1186876800,"32","07"},{1186963200,"33","07"},{1187049600,"33","07"},{1187136000,"33...
cl_assert_equal_s(tmbuf, s_iso8601_data[i].str_g)
; printf("%s\n", tmbuf); } } #endif #if EXTENSION_SU void test_strftime__full_percent_z(void) { char tmbuf[512]; struct tm jan_2_2015__13_00_00 = { .tm_hour = 13, .tm_min = 0, .tm_sec = 0, // 13:00:00 .tm_year = 2015 - 1900, .tm_mon = 0, .tm_mday = 2, // 2015/01/02 .tm_wday = 5, .tm_yday = 1, //...
-1088, 448, -224}, // 67 seconds { -928, -152, -88}, { -960, 184, -168}, { -1104, 232, -200}, { -928, -200, -104}, { -1584, 440, -368}, { -1152, 488, -312}, { -1032, 576, -576}, { -1008, 536, -424}, { -528, 136, -104}, { -312, 256, -200}, { -376, 248, -120}, { -496, 2...
{ -872, -136, -16}, { -568, 72, -112}, { -488, 80, -160}, { -592, 88, -128}, { -824, 96, -336}, { -992, 64, -64}, { -800, 344, -440}, { -1096, 208, -360}, { -1168, -40, -96}, { -1712, 440, -424}, { -1744, 200, -96}, { -1136, -8, 8}, { -936, 272, -232}, { -712, -48...
s now fully focused. const ModalProperty properties = modal_manager_get_properties(); s_state = ((properties & ModalProperty_Exists) && (properties & ModalProperty_Transparent)) ? CompositorState_AppAndModal : CompositorState_App; prv_send_did_focus_event(true); } } // Draw the app ...
{ const ModalProperty properties = modal_manager_get_properties(); if (properties & ModalProperty_Exists) { s_state = (properties & ModalProperty_Transparent) ? CompositorState_AppAndModal : CompositorState_Modal; compositor_modal_render_ready(); ...
static void prv_animation_teardown(Animation *animation) { if (s_animation_state.impl->teardown) { s_animation_state.impl->teardown(animation); } s_animation_state = (CompositorTransitionState) { 0 }; s_deferred_render.animation.pending = false; if (!prv_should_render()) { s_deferred_render.transit...
->spi_clock_periph = RCC_APB2Periph_SPI6; bus->state->spi_clock_periph_speed = clocks.PCLK2_Frequency; bus->state->spi_apb = SpiAPB_2; #endif } } static uint16_t prv_spi_find_prescaler(const SPIBus *bus) { int lg; if (bus->state->spi_clock_speed_hz > (bus->state->spi_clock_periph_speed / 2)) { lg = 1...
RCC_APB2PeriphResetCmd(bus->state->spi_clock_periph, ENABLE)
; // Release SPIx from reset state RCC_APB2PeriphResetCmd(bus->state->spi_clock_periph, DISABLE); } spi_ll_slave_release(slave); } // //! High level slave port interface //! This part of the API can be used for fairly straightforward SPI interactions //! The assertion and deassertion of the SCS line is aut...
find_by_irk(&irk); if (!connection) { connection = gap_le_connection_by_device(&device); } ble_rem->connection = connection; #if CAPABILITY_HAS_BUILTIN_HRM ble_rem->is_sharing_heart_rate = ble_hrm_is_sharing_to_connection(connection); #endif bt_unlock(); } } ...
GEdgeInsets(0, horizontal_margin)
); box.origin.y += 38; box.size.h = 24; graphics_draw_text(ctx, is_sharing_heart_rate_string, font, box, GTextOverflowModeFill, GTextAlignmentLeft, NULL); // Gross hack to avoid centering the title / subtitle labels in the entire cell: ((Layer *)cell_layer)->bounds.size.h -=...