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...
{ return; }
RTC_WriteBackupRegister(BOOTLOADER_VERSION_REGISTER, s_bootloader_timestamp); } uint32_t boot_version_read(void) { return RTC_ReadBackupRegister(BOOTLOADER_VERSION_REGISTER); }
el(RunLevel_BareMinimum); system_reset(); } static void erase_fw(const uint32_t start_address) { // Erase flash flash_erase_sector_blocking(start_address); // Set everything high // Set up the firmware description FirmwareDescription desc; desc.description_length = sizeof(FirmwareDescription); desc.firm...
{ AppData *data = app_state_get_user_data(); app_free(data); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ SMPairingInfo sm_pairing_info; memset(&sm_pairing_info, 0xaa, sizeof(sm_pairing_info)); sm_pairing_info.is_local_encryption_info_valid = true; sm_pairing_info.is_remote_signing_info_valid = true; sm_pairing_info.is_remote_identity_info_valid = true; shared_prf_storage_store_ble_pairing_data(&sm_pairing_in...
/* * 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...
dbgserial_putstr("is stuck!")
; result = true; } } if (button_counter_register != 0) { dbgserial_print("Button was pushed on boot. Button counter: "); dbgserial_print_hex(button_counter_register); dbgserial_newline(); } RTC_WriteBackupRegister(STUCK_BUTTON_REGISTER, button_counter_register); return result; } bool ...
ics_color_to_char_buffer(color, buf); return jerry_create_string((const jerry_char_t *)buf); } JERRY_FUNCTION(prv_set_stroke_style) { return prv_graphics_set_color(argc, argv, graphics_context_set_stroke_color); } JERRY_FUNCTION(prv_get_stroke_style) { return prv_graphics_get_color_string(rocky_api_graphics_get...
rocky_define_property(ctx_prototype, ROCKY_CONTEXT2D_STROKESTYLE, prv_get_stroke_style, prv_set_stroke_style)
; rocky_define_property(ctx_prototype, ROCKY_CONTEXT2D_FILLSTYLE, prv_get_fill_style, prv_set_fill_style); rocky_api_graphics_path2d_add_canvas_methods(ctx_prototype); rocky_api_graphics_text_add_canvas_methods(ctx_prototype); // Create the CanvasElement constructor: JS_UNUSED_VAL = ...
/* * 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_resume_normal_operation()
; } } static void prv_exit_lpm(void) { // Checking the state here is a bit of a hack because the state machine does not have proper // transition actions, only entry/exit actions if (s_power_state == PowerStateGood) { prv_resume_normal_operation(); } } static void prv_standby_timer_callback(void* data) ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
itoa_int(365, buf, 10)
; cl_assert(0 == strcmp(buf, "365")); itoa_int(-365, buf, 10); cl_assert(0 == strcmp(buf, "-365")); // max int32 itoa_int(2147483647, buf, 10); cl_assert(0 == strcmp(buf, "2147483647")); // min int32 itoa_int(-2147483647, buf, 10); cl_assert(0 == strcmp(buf, "-2147483647")); } void test_string__te...
h" #include "rocky_api_errors.h" #include "rocky_api_util.h" #include "services/common/clock.h" #include "system/passert.h" #include "util/size.h" #include <string.h> #define ROCKY_DATE_TOLOCALETIMESTRING "toLocaleTimeString" #define ROCKY_DATE_TOLOCALEDATESTRING "toLocaleDateString" #define ROCKY_DATE_TOLOCALESTRING...
jerry_get_object_field(options, "day")
; JS_VAR month = jerry_get_object_field(options, "month"); JS_VAR year = jerry_get_object_field(options, "year"); JS_VAR hour12 = jerry_get_object_field(options, "hour12"); if (!jerry_value_is_undefined(hour12)) { *is_24h_style = !jerry_get_boolean_value(hour12); } struct { const jerry_value_t fie...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ GPoint t = *a; *a = *b; *b = t; }
void gpoint_sort(GPoint *points, size_t num_points, GPointComparator comparator, void *context, bool reverse) { for (size_t i = 0; i < num_points; i++) { for (size_t j = i + 1; j < num_points; j++) { int cmp = comparator(&points[i], &points[j], context); if (reverse ? cmp < 0 : cmp > 0) { ...
rc_line_number, const char* fmt, ...) { printf("%s:%d", src_filename, src_line_number); va_list args; va_start(args, fmt); vprintf(fmt, args); va_end(args); printf("\n"); } GContext* app_state_get_graphics_context() { return emx_graphics_get_gcontext(); } bool app_state_get_text_perimeter_debugging_enab...
rocky_api_watchface_init()
; emx_app_event_loop(); }
GATT_SERVICE_HDL) { goto unhandled; } uint8_t offset = att_hdl - EMULATED_PPOGATT_SERVICE_HDL; switch (offset) { case EMULATED_META_CHAR_OFFSET: return prv_handle_emulated_meta_read(msg); case EMULATED_DATA_CHAR_OFFSET: return prv_handle_emulated_write(conn_idx, msg); case EMULATED_DA...
prv_convert_uuid_to_little_endian((const uint8_t[]){PEBBLE_BT_UUID_EXPAND( PEBBLE_BT_PPOGATT_WATCH_SERVER_DATA_WR_CHARACTERISTIC_UUID_32BIT)}, &uuid)
; PBL_ASSERTN(ble_gatts_add_characteristic(&uuid, GATT_PROP_WRITE_NO_RESP, ATT_PERM_WRITE, data_wr_size, enable_read_cb_flag, NULL, &ctx->att_hdl.data_wr) == BLE_STATUS_OK); PBL_ASSERTN...
/* * 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...
(mfg_info_get_rtc_freq(), 0)
; mfg_info_set_rtc_freq(0xfefefefe); cl_assert_equal_i(mfg_info_get_rtc_freq(), 0xfefefefe); mfg_info_set_rtc_freq(1337); cl_assert_equal_i(mfg_info_get_rtc_freq(), 1337); } void test_snowy_mfg_info__model(void) { // Intentionally make the buffer too long so we can check for truncation. char buffer[MFG_I...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (!task_info) { return; }
num_tasks = uxTaskGetSystemState( task_info, num_tasks, NULL ); // Print info on each task char status; for (int i=0; i<num_tasks; i++) { switch(task_info[i].eCurrentState) { case eReady: status = 'R'; break; case eBlocked: status = 'B'; break; case eSuspe...
el/pbl_malloc.h" #include "services/common/bluetooth/bluetooth_persistent_storage.h" #include "system/passert.h" #include "system/logging.h" #include "util/list.h" #include <btutil/bt_device.h> #include <btutil/sm_util.h> //! About this module //! ----------------- //! - Book-keeping of connection-related state for...
if (connection->irk) { kernel_free(connection->irk); }
SMIdentityResolvingKey *irk_copy = NULL; if (irk) { irk_copy = kernel_zalloc_check(sizeof(*irk_copy)); memcpy(irk_copy, irk, sizeof(*irk_copy)); } connection->irk = irk_copy; } // ------------------------------------------------------------------------------------------------- GAPLEConnection *gap_le...
/* * 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_handle_init(); app_event_loop(); prv_handle_deinit(); }
const PebbleProcessMd* mfg_hrm_app_get_info(void) { static const PebbleProcessMdSystem s_app_info = { .common.main_func = &prv_main, .name = "MfgHRM", }; return (const PebbleProcessMd*) &s_app_info; } #endif // CAPABILITY_HAS_BUILTIN_HRM
accel_service_private_get_session(PebbleTask_Unknown)
; accel_session_shake_unsubscribe(session); } // ---------------------------------------------------------------------------------------------- void accel_double_tap_service_subscribe(AccelTapHandler handler) { AccelServiceState * session = accel_service_private_get_session(PebbleTask_Unknown); accel_session_do...
LayerStyle *style = prv_get_style(); gpoint_add_eq(&frame->origin, GPoint(style->fin_offset_x, is_future ? style->future_fin_offset_y : style->past_fin_offset_y)); frame->size.w -= PBL_IF_RECT_ELSE(style->sidebar_width, 0); } static void prv_get_day_sep_frame(TimelineLayer *l...
if (!state) { continue; }
// Test gatt_client_characteristic_get_descriptors(): const uint8_t num_descriptors = expected_characteristic->num_descriptors; BLEDescriptor descriptor_refs[num_descriptors]; const uint8_t num_found_descriptors = gatt_client_characteristic_get_descriptors(characteristic_...
cl_assert(uuid_equal(&matching_uuids[2], &bp_service->characteristics[0].uuid))
; // Expect the 0xffff UUID to return "no match": cl_assert_equal_i(characteristics[1], BLE_CHARACTERISTIC_INVALID); } extern uint8_t gatt_client_copy_service_refs_by_discovery_generation( const BTDeviceInternal *device, BLEService services_out[], uint8_t num_services, uint8_t discovery_gen); extern void ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
malloc(sizeof(FrameBuffer))
; framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); } // Teardown void test_graphics_draw_line__cleanup(void) { free(fb); } // Tests //////////////////////////////////// void inside_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_context_se...
}; animation_set_handlers(animation, anim_handler, selection_layer); selection_layer->bump_settle_anim_impl = (AnimationImplementation) { .update = prv_bump_settle_impl, }; animation_set_implementation(animation, &selection_layer->bump_settle_anim_impl); return animation; } static void prv_run_value...
animation_set_implementation(animation, &selection_layer->slide_settle_anim_impl)
num_net_allocs); } void test_timeline__cleanup(void) { fake_settings_file_reset(); fake_pbl_malloc_clear_tracking(); } // Tests /////////////////////////// void test_timeline__all_forwards(void) { Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; // Note: 1421178000 = Tue ...
(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionPast, 1421178000), 2)
le *old_file, SettingsFile *new_file, SettingsRecordInfo *info, void *context) { if (info->key_len == sizeof(BTBondingID)) { // Skip pairing entries return; } // Re-write non-pairing entries void *key = kernel_zalloc_check(info->key_len); info->get_key(old_file...
kernel_malloc_check(DISPLAY_BUF_LEN)
; // get the key uint8_t key[info->key_len]; memset(key, 0x0, info->key_len); info->get_key(file, &key[0], info->key_len); // prompt_send_response("Raw dump Key"); // PBL_HEXDUMP_D_PROMPT(LOG_LEVEL_DEBUG, (uint8_t *)&key, info->key_len); uint8_t val[info->val_len]; memset(val, 0x0, info->val_len); i...
this is a no-op: app_launch_trigger(); // TODO: PBL-1771: find a more graceful way to handle this #ifndef RECOVERY_FW system_task_add_callback(dls_private_handle_disconnect, NULL); #endif } prv_put_comm_session_event(false, is_system); if (is_system && (session->destination == TransportDestinationH...
(session, endpoint_id, length, timeout_ms)
// Make sure we discovered at least 1 test cl_assert(num_tests > 0); // Let's sort the tests by name qsort(&test_entry[0], num_tests, sizeof(test_entry[0]), prv_qsort_step_test_entry_cb); // ------------------------------------------------------------------------------------------ // Print summery of re...
{ return; }
// Look for an existing session KAlgTestSleepSession *session = s_captured_sleep_sessions; for (int i = 0; i < s_num_captured_sleep_sessions; i++, session++) { if (session->start_utc == start_utc && session->activity == activity_type) { entry_idx = i; break; } } cl_assert(entry_idx < MAX...
_on*/, NULL, NULL); int32_t before; activity_get_metric(ActivityMetricStepCount, 1, &before); // Walk for about 30 minutes const int k_num_minutes = 30; // The sample we feed in feeds about 90 steps/min const int k_steps_per_minute = 90; // Feed in the data prv_feed_steps_min(k_num_minutes); // C...
PBL_LOG(LOG_LEVEL_DEBUG, "sleep state minutes: %d", (int)(value / SECONDS_PER_MINUTE))
ic int s_num_cb_events_1 = 0; static void prv_fake_hrm_1_cb(PebbleHRMEvent *event, void *context) { if (s_num_cb_events_1 >= ARRAY_LENGTH(s_cb_events_1)) { return; } s_cb_events_1[s_num_cb_events_1++] = *event; } static PebbleHRMEvent s_cb_events_2[16]; static int s_num_cb_events_2 = 0; static void prv_fake_...
(session_ref, NULL, NULL, &ret_expire_s, 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...
{ bool has_pinned_ble_pairings = bt_persistent_storage_has_pinned_ble_pairings(); if (has_pinned_ble_pairings != s_cycling_paused_due_to_dependent_bondings) { if (has_pinned_ble_pairings) { bt_local_addr_pause_cycling(); } else { bt_local_addr_resume_cycling(); } s_cycling_paused_due_to_...
/* * 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...
worker_manager_get_current_worker_md()
; if (md == NULL) { return APP_WORKER_RESULT_NOT_RUNNING; } if (!uuid_equal(&md->uuid, &app_manager_get_current_app_md()->uuid)) { return APP_WORKER_RESULT_DIFFERENT_APP; } process_manager_put_kill_process_event(PebbleTask_Worker, true /*graceful*/); return APP_WORKER_RESULT_SUCCESS; } // -------...
d prv_stopped_handler_destroy(Animation *animation, bool finished, void *context) { prv_add_handler_entry(&s_stopped_handler_calls, animation, finished, context); animation_destroy(animation); } // -------------------------------------------------------------------------------------- // Test that animation_destro...
animation_set_play_count(a, 0)
; animation_set_duration(a, duration_a); prv_clear_handler_histories(); animation_schedule(a); uint64_t start_ms = prv_now_ms(); prv_advance_to_ms_with_timers(start_ms + duration_a + 2 * MIN_FRAME_INTERVAL_MS); // Should not have run at all cl_assert_equal_i(prv_count_handler_entries(&s_setup_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...
{ return s_is_paused; }
{ ((CommandFuncFourParams) cmd->func)(args.args[0], args.args[1], args.args[2], args.args[3]); }
else if (cmd->num_params == 3) { ((CommandFuncThreeParams) cmd->func)(args.args[0], args.args[1], args.args[2]); } else if (cmd->num_params == 2) { ((CommandFuncTwoParams) cmd->func)(args.args[0], args.args[1]); } else if (cmd->num_params == 1) { ((CommandFuncOneParam) cmd->func)(args.args[0]); } els...
/* * 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...
{ task = pebble_task_get_current(); }
if (task == PebbleTask_App) { return app_state_get_battery_state_service_state(); } else if (task == PebbleTask_Worker) { return worker_state_get_battery_state_service_state(); } else { WTF; } } static void do_handle(PebbleEvent *e, void *context) { BatteryStateServiceState *state = prv_get_st...
Y_ALPHA) { data->alpha = (data->alpha - 0x40) & ALPHA_100; set_text_layers(data); } else if (data->property == PROPERTY_COLOR_TABLE) { if (s_color_table == color_table_hsv) { s_color_table = color_table_hvs; } else if (s_color_table == color_table_hvs) { s_color_table = color_table_hsv; ...
{ AppData *data = task_malloc(sizeof(AppData)); if (!data) { return; } memset(data, 0x00, sizeof(AppData)); s_window = window_create(); window_set_user_data(s_window, data); window_set_fullscreen(s_window, true); window_set_window_handlers(s_window, &(WindowHandlers) { .load = main_window_load,...
static void deinit(void) { AppData *data = window_get_user_data(s_window); task_free(data); window_destroy(s_window); } static void s_main(void) { init(); app_event_loop(); deinit(); } const PebbleProcessMd* pebble_colors_get_app_info(void) { static const PebbleProcessMdSystem s_app_info = { .co...
/* * 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...
{ sys_resource_mapped_release(); return true; }
nfigurations typedef struct SummaryPinPercentageConfig { const char *body; const char *detail_text; // Overrides common value (automatically localized) } SummaryPinPercentageConfig; typedef struct SummaryPinConfig { ActivityInsightSettings *insight_settings; const char *short_title; char *short_subtitle; ...
if (file) { rv = settings_file_set(file, &key, sizeof(key), val, val_len); activity_private_settings_close(file); }
return rv; } // ------------------------------------------------------------------------------------------------ // Builds the base attribute list for insight notifications static void prv_build_notification_attr_list(AttributeList *attr_list, const char *body, uint32_t ...
, char *buffer, bool render) { AttributeList *attributes = layout->attributes; const time_t last_updated_time = attribute_get_uint32(attributes, AttributeIdLastUpdated, 0); clock_get_since_time(buffer, config->buffer_size, last_updated_time); } GTextNode *timeline_layout_creat...
{ layout->page_break_height = height; layout->has_page_break = true; }
if (size_out) { *size_out = (GSize) { bounds->size.w, height }; } } GTextNodeCustom *timeline_layout_create_page_break_node(const TimelineLayout *layout) { GTextNodeCustom *page_break_node = graphics_text_node_create_custom(prv_page_break_node_callback, (void *)layout); return page_break_node; } vo...
cess before enabling it static void prv_bus_enable(I2CBus *bus) { // Don't power up rail if the bus is already in use (enable can be called to reset bus) if (bus->state->user_count == 0) { prv_bus_rail_power_up(bus); } prv_bus_pins_cfg_i2c(bus); i2c_hal_enable(bus); } //! De-initialize and gate the cl...
gpio_input_read(&in_sda)
) { recovered = true; break; } } if (recovered) { PBL_LOG(LOG_LEVEL_DEBUG, "I2C Bus %s recovered", slave->bus->name); } else { PBL_LOG(LOG_LEVEL_ERROR, "I2C Bus %s still hung after bitbang reset", slave->bus->name); } prv_bus_pins_cfg_i2c(slave->bus); prv_bus_reset(slave->bus); m...
/* * 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...
(peek_layer, &window->layer.bounds)
; peek_layer_set_title_font(peek_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD)); TimelineResourceInfo timeline_res = { .res_id = TIMELINE_RESOURCE_GENERIC_WARNING, }; peek_layer_set_icon(peek_layer, &timeline_res); peek_layer_set_title(peek_layer, i18n_get("Resetting...", data)); peek_layer_set_...
/* * 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...
(option_menu, &config)
; SettingsOptionMenuData *data = task_malloc_check(sizeof(SettingsOptionMenuData)); OptionMenuCallbacks callbacks = *callbacks_ref; *data = (SettingsOptionMenuData) { .callbacks = callbacks, .context = context, .num_rows = num_rows, .rows = rows, }; callbacks.draw_row = prv_menu_draw_row; ca...
slave->slave_state->dma_complete_context = context; prv_spi_dma_cmd(slave->spi_bus, SpiI2sDma_ReqRx, true); dma_request_start_direct(slave->rx_dma, in, (void *)&slave->spi_bus->spi->DR, len, prv_dma_irq_handler, (void *)slave); } void spi_ll_slave_read_dma_stop(const SPISlavePort *slave...
(slave->slave_state->initialized)
; PBL_ASSERTN(slave->slave_state->acquired); return (slave->rx_dma && dma_request_in_progress(slave->rx_dma)) || (slave->tx_dma && dma_request_in_progress(slave->tx_dma)); } void spi_ll_slave_set_tx_dma(const SPISlavePort *slave, bool enable) { PBL_ASSERTN(slave->slave_state->initialized); spi_ll_slav...
for (int dest_y = clipped_glyph_target.origin.y; dest_y != clipped_glyph_target.origin.y + clipped_glyph_target.size.h; ++dest_y) { dest_shift = dest_shift_at_line_begin; // Number of bits to render on this line. uint8_t glyph_line_bits_left = clipped_glyph_target.size.w; uint32_t *dest_block = (u...
(src, dest_shift)
; src_rotated = dest_shift; // Continue with this dest_block if there is still space left: if (dest_shift) { continue; } } ++dest_block; } dest_shift += right_clip % 32; // emulate having drawn the right clip if (glyph_block_bits_left <= right_cli...
/* * 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...
(PROMPT_RESP_MESSAGE, response)
/* * 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...
snprintf(data->status_text, STATUS_TEXT_SIZE, "Test Passed")
; break; case FLASH_TEST_STATUS_FAILED: snprintf(data->status_text, STATUS_TEXT_SIZE, "Test Failed"); break; default: snprintf(data->status_text, STATUS_TEXT_SIZE, "Unknown Status"); PBL_LOG(LOG_LEVEL_DEBUG, "ERROR: Unknown Test Case Selected"); break; } text_layer_set_t...
--------------------------------------------------------------------------------------- //! Extern'd interface for protocol.c // ------------------------------------------------------------------------------------------------- bool comm_session_has_capability(CommSession *session, CommSessionCapability capability) { ...
(transport, implementation, CommSessionTransportType_PULSE)
) { if (!existing_system_session->transport_imp->close) { // iAP sessions cannot be closed from the watch' side :( PBL_LOG(LOG_LEVEL_ERROR, "System session already exists and cannot be closed"); return NULL; } // Last system session to connect wins: // This ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(dialog, RESOURCE_ID_BATTERY_ICON_FULL_LARGE_INVERTED)
; break; case DialogState_Charging: default: dialog_set_text(dialog, i18n_get("Charging", data)); dialog_set_icon(dialog, RESOURCE_ID_BATTERY_ICON_CHARGING_LARGE_INVERTED); break; } } if (charge.is_plugged) { if (charge.is_charging) { status_led_set(StatusL...
, -1000}, { 48, 24, -1008}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 16, -992}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 16, -1000}, { 48, 32, -1000}, { 40, 8, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 16, -1008}, ...
{ 48, 24, -1000}, { 48, 16, -1008}, { 48, 16, -1000}, { 48, 16, -992}, { 48, 16, -992}, { 48, 16, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 16, -1008}, { 48, 24, -1000}, { 48, 16, ...
{ 48, 16, -1000}, { 40, 24, -1000}, { 48, 16, -1000}, { 40, 16, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 8, -1000}, { 48, 16...
{ health_progress_bar_fill(ctx, &data->progress_bar, PROGRESS_TYPICAL_COLOR, 0, typical_fill); } #endif if (data->current_steps) { health_progress_bar_fill(ctx, &data->progress_bar, PROGRESS_CURRENT_COLOR, 0, current_fill); } #if PBL_COLOR if (!behind_typical) { health_progress_bar_mark(ctx, &dat...
(health_data)
; window_set_window_handlers(window, &(WindowHandlers) { .unload = prv_activity_detail_card_unload_callback, }); app_window_stack_push(window, true); } void health_activity_summary_card_destroy(Layer *base_layer) { HealthActivitySummaryCardData *data = layer_get_data(base_layer); i18n_free_all(base_layer...
/* * 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...
boot_main()
; // Main shouldn't return while (true) {} } EXTERNALLY_VISIBLE SECTION(".isr_vector") void *vector_table[] = { _estack, Reset_Handler, HardFault_Handler, HardFault_Handler, HardFault_Handler, HardFault_Handler, HardFault_Handler, 0, 0, 0, 0, HardFault_Handler, HardFault_Handler, 0, ...
#define RECT_HEIGHT 40 #define ORIGIN_RECT_NO_CLIP GRect(0, 0, 144, 168) #define ORIGIN_RECT_CLIP_XY GRect(0, 0, 20, 20) #define ORIGIN_RECT_CLIP_NXNY GRect(0, 0, 144, 168) #define ORIGIN_DRAW_RECT_NO_CLIP GRect(6, 6, RECT_WIDTH, RECT_HEIGHT) #define ORIGIN_DRAW_RECT_CLIP_XY GRect(...
(&ctx.dest_bitmap, "fill_rect_origin_r9_no_clip.${BIT_DEPTH_NAME}.pbi")
); } void test_graphics_fill_rect_${BIT_DEPTH_NAME}__origin_radius_aa(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // AA = true, SW has no effect, all corners setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLI...
ctx; static FrameBuffer s_fb; size_t framebuffer_get_size_bytes(FrameBuffer *f) { return FRAMEBUFFER_SIZE_BYTES; } /////////////////////////////////////////////////////////// // Tests void test_line_layout__initialize(void) { framebuffer_init(&s_fb, &(GSize) {DISP_COLS, DISP_ROWS}); graphics_context_init(&s_ct...
iter_next(&word_iter)
); cl_assert(!line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params)); cl_assert(line.height_px == 10); cl_assert(line.width_px == 3 * HORIZ_ADVANCE_PX); cl_assert(!line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params)); cl_assert(!line_add_word(&s_ctx, &line, &word_iter...
/* * 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...
{ // Insert as head of the list: result->next = s_head; s_head = result; }
else { // Insert as tail: prev->next = result; result->next = NULL; } } static ScanResult *list_get_by_index(uint8_t index) { ScanResult *result = s_head; while (index && result) { result = result->next; --index; } return result; } static void list_free_all(void) { ScanResult *result ...
nt32_t distance_normalized, bool inner) { const GColor replace_color = GColorGreen; const GColor stroke_color = TIMELINE_DOT_COLOR; compositor_transition_pdcs_animation_update( ctx, s_data.animation_sequence, distance_normalized, replace_color, stroke_color, ...
graphics_context_set_fill_color(ctx, TIMELINE_DOT_COLOR)
if (!prv_read_register(PmicRegisters_STATUSB, &val)) { #if defined (TARGET_QEMU) // NOTE: When running on QEMU, i2c reads return false. For now, just assume a failed // i2c read means we are connected to a USB cable return true; #else PBL_LOG(LOG_LEVEL_DEBUG, "Failed to read charging status B register"...
prv_read_register(reg, &val)
; prompt_send_response_fmt(buffer, sizeof(buffer), "Reg 0x%02X: 0x%02X", reg, val); } } void command_pmic_read_registers(void) { register_dump(0x00, 0x1F); } #ifdef RECOVERY_FW void command_pmic_rails(void) { prv_mon_config_lock(); // Make sure the LDO3 rail is on before measuring it. set_ldo3_power_st...
map_pbi_eq(&dest_bitmap, "test_bitblt__8bit_comptint_blend-expect.8bit.pbi")); } // Tests assign, clipping, makes sure in bottom right corner. // Setup: // - Source is 10x15, black box ((0, 0), (5, 10)), rest is red. // - Dest is White, 50x50. // - Dest offset is set to 5x10 pixels in bottom right corner. // Res...
memset(dest_data, GColorBlue.argb, sizeof(dest_data))
; GRect dest_rect = GRect(0, 0, src_bitmap->bounds.size.w*2, src_bitmap->bounds.size.h*2); GPoint src_origin_offset = { 2, 2 }; // Offset past the 2 red rows bitblt_bitmap_into_bitmap_tiled_8bit_to_8bit( &dest_bitmap, src_bitmap, dest_rect, src_origin_offset, GCompOpAssign, GColorWhite); cl_assert(gbitm...
/* * 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...
(ORDER_FILE)
to start reading data from size_t bytes_read = 0; while (bytes_read < size) { size_t bytes_to_read = MIN(free_bytes_in_page(file->curr_page) - pg_offset, size - bytes_read); prv_flash_read(buf + bytes_read, bytes_to_read, prv_page_to_flash_offset(file->curr_page) + AVAIL_BYTES_OFFSET + pg_o...
if ((hdr.version >> 8) != PFS_MAGIC) { continue; }
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 "util/keyed_circular_...
prv_test_get_hit(3, 0)
nfigured_window; static bool s_app_idle = false; // Overrides //////////////////////////////////// void battery_state_service_state_init(BatteryStateServiceState *state) { return; } void connection_service_state_init(ConnectionServiceState *state) { } void tick_timer_service_state_init(TickTimerServiceState *sta...
{ cl_check(window); cl_assert_equal_i(window->on_screen, true); s_appear_count++; cl_check(s_appear_count >= 1); }
static void prv_window_disappear(Window *window) { cl_check(window); cl_assert_equal_i(window->on_screen, false); s_disappear_count++; cl_check(s_appear_count >= 0); } static void prv_window_load(Window *window) { cl_check(window); cl_assert_equal_i(window->on_screen, true); s_load_count++; } static v...
}, { 1096, 224, -16}, { 936, 208, -64}, { 768, 184, -16}, { 664, 192, -8}, { 664, 208, -40}, { 792, 192, -48}, { 880, 128, -32}, { 1120, 112, -24}, { 1032, 48, -88}, { 1128, 56, -120}, // 13 seconds { 1232, 136, -144}, { 1224, 128, -120}, { 1168, 176, -168}, {...
{ 784, 224, -200}, { 952, 264, -200}, { 1048, 296, -320}, { 1016, 264, -320}, { 1120, 288, -296}, { 1232, 352, -296}, { 1048, 352, -288}, { 1024, 376, -232}, { 1104, 376, -200}, { 1192, 296, -152}, { 1064, 248, -104}, { 832, 232, -104}, { 736, 208, -104}, { 720, 2...
on each character in the line //! Used to update line dimensions and render characters //! Traverse until end of line->width_px if rendering chars, else text_box_params width //! if updating line dimensions //! @return utf8_t* pointer to last visited character utf8_t* walk_line(GContext* ctx, Line* line, const TextBox...
char_visitor_cb(ctx, text_box_params, line, cursor, line->suffix_codepoint)
ints, s_path_num_points)); prv_reset(); // set command to be hidden - nothing should be drawn gdraw_command_set_hidden(command, true); cl_assert_equal_i(s_stroke_color.argb, GColorClearARGB8); cl_assert_equal_i(s_fill_color.argb, GColorClearARGB8); cl_assert_equal_i(s_stroke_width, 0); cl_assert_equal_i(...
(s_fill_points, NULL)
; prv_reset(); // set stroke width to non-zero value. stroke should be drawn, but no fill gdraw_command_set_stroke_width(command, 2); gdraw_command_draw(NULL, command); cl_assert_equal_i(s_stroke_color.argb, GColorGreenARGB8); cl_assert_equal_i(s_fill_color.argb, GColorClearARGB8); cl_assert_equal_i(s_st...
/* * 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_session.active_mode_trigger != TIMER_INVALID_ID) { new_timer_delete(s_session.active_mode_trigger); s_session.active_mode_trigger = TIMER_INVALID_ID; CommSession *comm_session = comm_session_get_system_session(); comm_session_set_responsiveness( comm_session, BtConsumerPpAudioEndpoint, Res...
s_session.id = AUDIO_ENDPOINT_SESSION_INVALID_ID; s_session.setup_completed = NULL; s_session.stop_transfer = NULL; bt_unlock(); if (s_dropped_frames > 0) { PBL_LOG(LOG_LEVEL_INFO, "Dropped %"PRIu32" frames during audio transfer", s_dropped_frames); } } #ifndef PLATFORM_TINTIN void audio_endpoint_pr...
ager_handle_touch_event(&e, &manager); prv_compare_recognizers_processed((int[]) {4, 0, 1}, 3, &s_recognizers_handled); prv_compare_recognizers_processed(NULL, 0, &s_recognizers_reset); cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersActive); cl_assert_equal_i(recognizers[0]->state, Recognize...
(r[1], &layer_a.recognizer_list)
; recognizer_set_manager(r[0], &manager); recognizer_set_manager(r[1], &manager); r[0]->state = RecognizerState_Failed; recognizer_manager_handle_state_change(&manager, r[0]); cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersActive); cl_assert_equal_p(manager.active_layer, &layer_a); p...
te_id = attr->attribute_id, .write_mbuf = (attr->request_type == SmartstrapRequestTypeRead) ? NULL : &write_mbuf, .read_mbuf = (attr->request_type == SmartstrapRequestTypeWrite) ? NULL : &attr->mbuf, .timeout_ms = attr->timeout_ms }; // send the request SmartstrapResult result = smartstrap_profiles_h...
mutex_lock(s_attr_list_lock)
; const bool exists = (prv_find_by_ids(service_id, attribute_id) || prv_find_by_buffer(buffer)); mutex_unlock(s_attr_list_lock); if (exists) { PBL_LOG(LOG_LEVEL_ERROR, "Attribute already exists (0x%x,0x%x)", service_id, attribute_id); return false; } SmartstrapAttributeInternal *new_attr = kernel_zal...
_start(void) { } void gatt_service_changed_server_cleanup_by_connection(GAPLEConnection *connection) { } int HCI_LE_Set_Advertise_Enable(unsigned int BluetoothStackID, ...) { return (0); } void launcher_task_add_callback(void (*callback)(void *data), void *data) { callback(data); } static uint32_t s_unscheduled...
cl_assert(memcmp(&scan_resp_data_out, scan_resp_data, sizeof(scan_resp_data)) == 0)
; // Expect one regular timer to be running for advertisements: cl_assert_equal_i(regular_timer_seconds_count(), 1); // Unschedule callback should not have been called: cl_assert_equal_i(s_unscheduled_cb_count, 0); // Unschedule and expect not to be advertising any more: gap_le_advert_unschedule(job); c...
pdate_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_inside_offset_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_x_layer_update_callback); layer_render_tree(&laye...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw2_clip_nxny.${BIT_DEPTH_NAME}.pbi")
); // AA = true, SW = 3 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 3); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw3_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORI...
#include "flash_region/flash_region.h" #include "kernel/pbl_malloc.h" #include "kernel/pebble_tasks.h" #include "process_state/app_state/app_state.h" #include "resource/resource_ids.auto.h" #include "resource/resource_storage_flash.h" #include "system/logging.h" #include "system/passert.h" #include "kernel/util/sleep.h...
flash_erase_subsector_blocking(erase)
; } if (!check_region_write(write_region, false, false)) { success = false; break; } psleep(5); } return (success); #else PBL_LOG_SYNC(LOG_LEVEL_INFO, "Test not supported for parallel flash"); return (false); #endif } static void menu_select_callback(int index, void *data) { str...
/* * 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...
for (int i = 0; i < (UTF8_TEST_MALFORMED_CODEPOINT_INDEX - 1); i++) { uint32_t decoded_codepoint = utf8_peek_codepoint(malformed_test_string_utf8, NULL); uint32_t actual_codepoint = s_valid_test_codepoints[i]; cl_assert_equal_i(decoded_codepoint, actual_codepoint); malformed_test_string_utf8 = utf8_get_...
// When we decode the invalid codepoint, it should return an invalid stream // error and set the pointer to the stream to be null cl_assert_equal_i(utf8_peek_codepoint(malformed_test_string_utf8, NULL), 0); cl_assert_(*malformed_test_string_utf8 == 0xcd, "Failed to invalidate an invalid UTF-8 test string"); }...
ual_b(false, app_cache_entry_exists(app3.id)); } static const uint32_t SIZE_SUM = 7210515; static const AppData t_data[] = { // higher rank = should keep around { .id = 1, .priority = 40, .size = 131798 }, // priority rank 28 { .id = 2, .priority = 60, .size = 194327 }, // priority rank 48 { .id ...
{ cl_assert_equal_b(true, app_cache_entry_exists(t_data[i].id)); }
cl_assert_equal_i(SIZE_SUM, app_cache_get_size()); } void prv_cleanup(void) { app_cache_flush(); prv_load_lotta_apps(); } void test_app_cache__free_up_space_lots_apps(void) { uint32_t to_free; uint32_t before_size; uint32_t after_size; // test random number prv_cleanup(); to_free = 150000; befo...
erFromNumber((float)cosine / TRIG_MAX_RATIO); GTransformNumber num2 = (GTransformNumber) { .raw_value = (int32_t)(((int64_t)cosine * GTransformNumberOne.raw_value) / TRIG_MAX_RATIO) }; cl_assert(num.raw_value == num2.raw_value); } void test_graphics_gtransfor...
gtransform_concat(&t2, &t1, &t2)
; cl_assert(gtransform_is_equal(&t2, &t_c)); // Test non-identity concatenation with identity t1 = GTransformIdentity(); t2 = GTransformFromNumbers(1, 2, 3, 4, 5, 6); t_c = GTransformFromNumbers(1, 2, 3, 4, 5, 6); gtransform_concat(&t_new, &t1, &t2); cl_assert(gtransform_is_equal(&t_new, &t_c)); // Te...
current_day + 10 * SECONDS_PER_HOUR + 30 * SECONDS_PER_MINUTE); id2 = alarm_create(&(AlarmInfo) { .hour = 11, .minute = 30, .kind = ALARM_KIND_EVERYDAY }); prv_assert_alarm_config(id2, 11, 30, false, ALARM_KIND_EVERYDAY, s_every_day_schedule); cl_assert_equal_i(s_num_timeline_adds, 6); cl_assert_equal_i(s_num_...
(s_num_alarms_fired, 1)
; cl_assert_equal_i(s_num_timeline_adds, 3); } void test_alarm__recurring_weekends_alarm_timeout_behind(void) { AlarmId id; s_current_hour = 11; s_current_minute = 30; s_current_day = s_saturday; id = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALARM_KIND_WEEKENDS }); prv_assert_alarm_c...
_len + 1); uint8_t *val = malloc(info->val_len + 1); info->get_key(file, key, info->key_len); info->get_val(file, val, info->val_len); key[info->key_len] = '\0'; val[info->val_len] = '\0'; printf("Read key of %s %d and val of %s %d\n", key, info->key_len, val, info->val_len); int key_i = atoi((char*)key ...
for (int i = 0; i < NUM_RECORDS; i++) { snprintf((char *)key, sizeof(key), "k%03d", i); snprintf((char *)val, sizeof(val), "v%03d", i); set_and_verify(&file, key, key_len, val, val_len); }
const int search_for_idx = 57; snprintf((char *)key, sizeof(key), "k%03d", search_for_idx); // Move iter to the beginning to bring to a known state settings_raw_iter_begin(&file.iter); // Get the iter to the record we want cl_assert_equal_b(true, settings_file_exists(&file, key, key_len)); // Check t...
action(action_menu, action, pin, (void *)(uintptr_t)new_time); } static ActionMenuLevel *prv_create_postpone_level(TimelineItemAction *action, ActionMenuLevel *root_level) { time_t utc_sec = rtc_get_time(); struct tm local_tm; localtime_r(&utc_sec, &local_tm); ...
if (gcolor_equal(config.colors.foreground, GColorClear)) { config.colors.foreground = gcolor_legible_over(base_config->colors.background); }
config.did_close = prv_timeline_action_menu_did_close; timeline_action_menu->item = base_config->context; timeline_action_menu->action_menu = action_menu_open(window_stack, &config); timeline_action_menu->did_close = base_config->did_close; return timeline_action_menu->action_menu; } ActionMenu *timeline_...
4, 152, -464}, { -992, 160, -480}, { -1128, -80, -288}, { -1024, -232, -120}, { -976, 96, -136}, { -928, 264, -112}, { -1000, 272, -72}, { -1096, 344, -32}, // 31 seconds { -1144, 464, -184}, { -1016, 456, -272}, { -1296, 632, -336}, { -1120, 536, -352}, { -1672, 544,...
{ -1368, 72, -296}, { -1488, 0, -176}, { -1440, 216, -184}, { -1208, 464, 56}, { -1024, 488, 8}, { -1064, 328, -120}, { -1160, 336, -40}, { -1128, 408, -72}, { -1232, 480, -64}, { -1104, 576, -64}, { -1400, 672, -104}, { -1376, 416, -72}, { -1048, 448, -192}, { -1...
{ -1224, 584, -72}, { -1512, 512, 8}, { -1440, 376, 0}, { -1216, 288, -24}, { -1152, 200, 8}, { -1256, 176, 24}, { -1328, 120, 112}, { -1256, 128, -16}, { -1160, 80, 16}, // 39 seconds { -1048, -56, 48}, { -808, -128, -56}, { -1128, 8, -128}, { -1248, 64, -232}, ...
1144, 24, -552}, { 1128, 56, -424}, { 1080, 192, -360}, { 1160, 424, -352}, { 1256, 592, -432}, { 1208, 688, -424}, { 1056, 720, -488}, { 984, 768, -536}, { 848, 608, -424}, { 1320, 808, -640}, { 1240, 624, -352}, { 1208, 600, -392}, { 1296, 472, -384}, { 1176, 408, -...
{ 1272, 720, -400}, { 1464, 616, -320}, { 1440, 456, -336}, { 1104, 224, -272}, { 952, 232, -288}, { 1000, 120, -296}, // 168 seconds { 1144, 112, -256}, { 1248, 72, -208}, { 1256, 112, -200}, { 1168, 112, -200}, { 856, 16, -256}, { 656, -200, -56}, { 680, -200, -...
{ 928, -64, -304}, { 1208, 160, -424}, { 1024, 120, -344}, { 1040, 240, -328}, { 1152, 368, -280}, { 1280, 472, -360}, { 1296, 576, -400}, { 1048, 672, -392}, { 928, 832, -408}, { 952, 736, -328}, { 1160, 784, -336}, { 1008, 704, -304}, { 1160, 664, -272}, { 1328...
ager__cleanup(void) { prv_clear_recognizers_processed(&s_recognizers_handled); prv_clear_recognizers_processed(&s_recognizers_reset); } static void prv_store_recognizer_idx(Recognizer *recognizer, ListNode **list) { int *idx = recognizer_get_impl_data(recognizer, &s_dummy_impl); if (idx) { RecognizerHandle...
((int[]) {4, 2, 3}, 3, &s_recognizers_handled)
; // Recognizers attached to window processed before layer recognizers recognizer_add_to_list(recognizers[5], window_get_recognizer_list(&window)); cl_assert(prv_process_all_recognizers(&manager, prv_handle_dummy_touch_event, NULL)); prv_compare_recognizers_processed((int[]) {5, 4, 2, 3}, 4, &s_recognizers_han...
est_settings_file_compaction(manual_compaction); } void test_settings_file__automatic_compaction_increment(void) { printf("\nTesting automatic file compaction...\n"); const bool manual_compaction = false; prv_test_settings_file_compaction(manual_compaction); } static void prv_print_stats(SettingsFile *file) { ...
(val_len_out)
; cl_assert_equal_i(settings_file_get(&file, key, key_len, val_out, val_len_out), E_DOES_NOT_EXIST); free(val_out); } void test_settings_file__used_space_tracking(void) { printf("\nTesting used space tracking...\n"); SettingsFile file; cl_must_pass(settings_file_open(&file, "test_file_used_space_tracking", 4...
const uint8_t* data, size_t length); // Fakes //////////////////////////////////// #include "fake_app_manager.h" #include "fake_pbl_malloc.h" #include "fake_session.h" #include "fake_system_task.h" // Stubs ////////////////////////////////...
{ prv_receive(RUN_STATE_KEY, NOT_RUNNING); assert_ack(true); cl_assert_equal_i(APP_RUN_STATE_STOP_COMMAND, s_last_cmd); }
void test_launcher_app_message__receive_push_fetch_request(void) { prv_receive(STATE_FETCH_KEY, RUNNING); assert_ack(true); cl_assert_equal_i(APP_RUN_STATE_STATUS_COMMAND, s_last_cmd); } void test_launcher_app_message__ignore_acks(void) { const AppMessageAck ack_message = { .header = { .command = C...
inner_seq = animation_sequence_create(a, b, NULL); animation_set_play_count(inner_seq, 0); animation_set_handlers(inner_seq, handlers, inner_seq); // Create the outer sequence Animation *c = prv_create_test_animation(); animation_set_duration(c, duration_c); Animation *d = prv_create_test_animation(); a...
(prv_count_handler_entries(&s_stopped_handler_calls, b), 0)
; cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, b), 0); // Complete sequence prv_advance_to_ms_with_timers(start_ms + duration_a + duration_b + 5 * MIN_FRAME_INTERVAL_MS + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 0); cl_assert_equal_i(prv_count_hand...
t ? text_layer->layout_cache : NULL; } void text_layer_legacy2_update_proc(TextLayerLegacy2 *text_layer, GContext* ctx) { if (text_layer == NULL) { return; } const GColor bg_color = get_native_color(text_layer->background_color); if (!(gcolor_equal(bg_color, GColorClear))) { graphics_context_set_fill_c...
if (text_layer == NULL || text_alignment == text_layer->text_alignment) { return; }
text_layer->text_alignment = text_alignment; layer_mark_dirty(&(text_layer->layer)); } void text_layer_legacy2_set_overflow_mode(TextLayerLegacy2 *text_layer, GTextOverflowMode overflow_mode) { if (text_layer == NULL || overflow_mode == text_layer->overflow_mode) { ...
; while (cursor < image_length) { // Make sure we can load enough data for a valid segment. There is // always at least one data byte in each segment, so there must be // strictly more data to read past the end of the header. PBL_ASSERTN((image_length - cursor) > sizeof(AS7000FWSegmentHeader)); //...
if (info.protocol_version_major != EXPECTED_PROTOCOL_VERSION_MAJOR) { // we don't know how to talk with this chip, so bail PBL_LOG(LOG_LEVEL_ERROR, "Unexpected protocol version!"); goto failed; }
if (info.application_id != AS7000AppId_Idle) { PBL_LOG(LOG_LEVEL_ERROR, "Unexpected application running: 0x%" PRIx8, info.application_id); goto failed; } // the INT line should be low if (gpio_input_read(&dev->int_gpio)) { PBL_LOG(LOG_LEVEL_ERROR, "INT line is not low!"); goto fai...
leMutexCommon *mutex = os_malloc_check(sizeof(PebbleMutex)); *mutex = (PebbleMutexCommon) { .freertos_mutex = freertos_mutex, .lr = 0 }; return mutex; } PebbleMutex * mutex_create(void) { LightMutexHandle_t freertos_mutex = xLightMutexCreate(); OS_ASSERT(freertos_mutex != NULL); PebbleMutex *mutex...
OS_ASSERT(!mcu_state_is_isr())
; LightMutexHandle_t mutex = handle->common.freertos_mutex; LOG_UNLOCKED(handle->common.lr, uxLightMutexGetRecursiveCallCount(mutex)); xLightMutexUnlockRecursive(mutex); }
dif cl_assert(!iter_prev(&iterator)); } static int prv_num_items(Iterator iterator) { int n = 1; while (iter_next(&iterator)) { n++; } return n; } void test_timeline__gc_past(void) { Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; // Tue Jan 13 11:40:00 PST 2...
(iter_next(&iterator))
SelectIndexDirection) { data->up_down_direction = !(data->up_down_direction); } else if (data->select_index == SelectIndexOverflow) { data->word_wrap = !(data->word_wrap); } } else if (button == BUTTON_ID_SELECT) { data->select_index = (data->select_index + 1) % SelectIndexMax; } else if (bu...
(&data->word_wrap_layer, GColorBlack)
; text_layer_set_text(&data->word_wrap_layer, "Overflow: Ellipsis"); text_layer_set_font(&data->word_wrap_layer, gothic_14_bold); text_layer_set_text_alignment(&data->word_wrap_layer, GTextAlignmentCenter); text_layer_set_overflow_mode(&data->word_wrap_layer, GTextOverflowModeTrailingEllipsis); // Setup chil...
nter deep sleep mode. uint8_t unused; prv_read_register(HRM, ADDR_SYNC, &unused); PPG_DBG("Handshake handle done"); HRM->state->handshake_count++; PROFILER_NODE_STOP(hrm_handling); mutex_unlock(HRM->state->lock); // PPG_DBG log out each PPG data sample that we recorded for (int i = 0; i < data.ppg...
{ if (!gpio_input_read(&dev->int_gpio)) { break; } system_task_watchdog_feed(); psleep(1); }
return (attempt < max_attempts); } // Wait for the INT line to go high. Return true if it went high before timing out static bool prv_wait_int_high(HRMDevice *dev) { const int max_attempts = 300; int attempt; for (attempt = 0; attempt < max_attempts; attempt++) { if (gpio_input_read(&dev->int_gpio)) { ...
t8_t *)&bg_counter_app, sizeof(AppDBEntry)); bg_counter_app_id = app_db_get_install_id_for_uuid(&bg_counter_app.uuid); app_cache_add_entry(bg_counter_app_id, 10701); cl_assert_equal_i(BG_COUNTER_APP_ID, bg_counter_app_id); // simulate installing menu_layer_app on flash app_db_insert((uint8_t *)&menu_layer_ap...
{ AppMenuNode *node = app_menu_data_source_get_node_at_index(&data_source, i); cl_assert_equal_i(node->install_id, app_default_order[num_apps - 1 - i]); }
app_menu_data_source_deinit(&data_source); } void test_app_menu_data_source__check_default_order_watchfaces(void) { static const AppInstallId watchface_default_order[] = {APP_ID_TICTOC, BIG_TIME_APP_ID}; app_menu_data_source_init(&data_source, &(AppMenuD...
f (_clar.active_suite == NULL) { clar_print_onabort("No suite matching '%s' found.\n", argument); exit(-1); } break; } // Run a particular test only. This code was added on top of base clar. case 't': { int offset = (argument[2] == '=') ? 3 : 2; char *test_name = arg...
strcmp(s1, s2)
== 0); if (!match) { char buf[4096]; snprint_eq(buf, 4096, "'%s' != '%s'", s1, s2); clar__assert(0, file, line, err, buf, should_abort); } } void clar__assert_equal_i( int i1, int i2, const char *file, int line, const char *err, int should_abort) { if (i1 != i2) { char buf[128]; ...
#define HEALTH_DB_DEBUG 0 #define HEALTH_DB_MAX_KEY_LEN 30 static const char *HEALTH_DB_FILE_NAME = "healthdb"; static const int HEALTH_DB_MAX_SIZE = KiBYTES(12); static PebbleMutex *s_mutex; #define MOVEMENT_DATA_KEY_SUFFIX "_movementData" #define SLEEP_DATA_KEY_SUFFIX "_sleepData" #define STEP_TYPICALS_KEY_SUFFIX ...
{ break; }
} // For logging const DayInWeek cur_wday = time_util_get_day_in_week(rtc_get_time()); if (strstr(key, MOVEMENT_DATA_KEY_SUFFIX)) { MovementData *data = (MovementData *)val; if (!prv_is_last_processed_timestamp_valid(data->last_processed_timestamp)) { return; } PBL_LOG(LOG_LEVEL_INFO, "G...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return RockyResourceValidation_Invalid; }
}
4, -416}, { 176, 768, -432}, { 168, 800, -448}, { 152, 824, -496}, { 144, 752, -536}, { 176, 784, -448}, { 152, 800, -544}, { 144, 776, -480}, { 152, 808, -536}, { 144, 776, -488}, { 168, 840, -392}, { 160, 872, -536}, { 120, 824, -488}, { 104, 824, -576}, { 88, 8...
{ -328, 824, -424}, { -328, 816, -424}, { -336, 816, -448}, { -328, 800, -424}, { -320, 760, -408}, { -328, 752, -416}, { -312, 744, -416}, // 99 seconds { -296, 744, -448}, { -304, 728, -440}, { -312, 776, -456}, { -320, 808, -448}, { -336, 816, -432}, { -312, 82...
{ -472, 624, -472}, { -464, 616, -496}, { -448, 608, -472}, { -504, 568, -528}, { -536, 576, -520}, { -544, 576, -560}, { -544, 584, -536}, { -544, 560, -544}, { -560, 568, -536}, { -544, 592, -536}, { -544, 568, -504}, { -536, 584, -544}, { -536, 560, -568}, { -...
/* * 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...
(job, now)
; // If not scheduled yet, schedule it. if (!prv_is_scheduled(job)) { s_scheduled_jobs = list_sorted_add(s_scheduled_jobs, &job->list_node, prv_sort, true); } PBL_LOG(LOG_LEVEL_DEBUG, "Cron job scheduled for %ld (%+ld)", job->cached_execute_time, (job->cached_execute_time - now)); mutex_unlock(...
_proc(&layer, &outside_ny_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("outside_ny_offset_layer", ctx.parent_framebuffer, GColorWhite)); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &outside_x_y_layer_update_callback); layer_render_tree(&layer...
(ctx, GPoint(p.x + 6, p.y + 3))
; graphics_draw_pixel(ctx, GPoint(p.x + 7, p.y + 3)); } // Draws two columns of colors (first 32 colors in first column, second 32 colors in second column) // Offsets the two color columns based on input transparency static void prv_draw_boxes(GContext *ctx, uint8_t transparency) { int column = 3 - transparency; ...
e_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone)); cl_assert_equal_i(steps, 10); cl_assert_equal_i(duration_s, 10); cl_assert_equal_i(bpm, 110); // Get some more new data and out stats still shouldn't change (except HR) prv_inc_...
prv_put_bpm_event(50, HRMQuality_OffWrist)
; cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone)); cl_assert_equal_i(bpm, 0); cl_assert_equal_i(hr_zone, HRZone_Zone0); // Put a good quality reading. Verify it was accepted. prv_put_bpm_event(100, HRMQ...
, { -152, 760, 880}, { -192, 720, 736}, { -88, 480, 504}, { -48, 464, 256}, { -104, 512, 224}, { -176, 512, 344}, { -232, 712, 512}, { -200, 928, 720}, { -160, 992, 896}, { -176, 904, 760}, { -264, 1000, 776}, { -112, 984, 1080}, { 96, 920, 752}, { -16, 848, 736},...
{ -344, 648, 512}, { -512, 816, 688}, { -480, 936, 864}, { -416, 888, 712}, // 40 seconds { -528, 1176, 1208}, { -48, 944, 1000}, { -104, 848, 840}, { -144, 712, 744}, { -48, 536, 488}, { -64, 392, 224}, { -144, 448, 224}, { -280, 480, 352}, { -344, 624, 536}, ...
{ -48, 800, 1112}, { 120, 728, 720}, { -24, 656, 560}, { 0, 432, 272}, { -96, 344, 128}, { -264, 488, 408}, { -336, 576, 632}, { -320, 704, 808}, { -424, 744, 864}, { -528, 800, 1040}, { -520, 784, 840}, { -408, 840, 1312}, // 43 seconds { -176, 576, 928}, { ...
pfs_init(false)
; int num_iters = 30; for (int i = 0; i < num_iters; i++) { int files_written = run_full_flash_region_test(); if ((i % 2) == 0) { pfs_init(true); // simulate a reboot } // delete all files for (int i = (files_written - 1); i >= 0; i--) { char name[128]; snprintf(name, sizeof(...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(window, animated)
; } static void deinit(void) { window_destroy(window); } int main(void) { init(); app_event_loop(); deinit(); }
pfs_stress_callback, NULL); } extern void command_read_word(const char* address_str) { int32_t address = str_to_address(address_str); if (address == -1) { prompt_send_response("Invalid address"); return; } uint32_t word = *(uint32_t*) address; char buffer[32]; prompt_send_response_fmt(buffer, siz...
prompt_send_response("Invalid length")
mic_window.icon_layer, true); } else { kino_reel_destroy(image); } data->voice_event_sub = (EventServiceInfo) { .type = PEBBLE_VOICE_SERVICE_EVENT, .handler = prv_voice_event_handler, .context = data }; event_service_client_subscribe(&data->voice_event_sub); prv_disable_select_click(data);...
{ if (app_window_stack_get_top_window() == &voice_window->mic_window.window) { prv_mic_window_disappear(&voice_window->mic_window.window); } }
void voice_window_regain_focus(VoiceWindow *voice_window) { if (app_window_stack_get_top_window() == &voice_window->mic_window.window) { prv_mic_window_appear(&voice_window->mic_window.window); } } void voice_window_transcription_dialog_keep_alive_on_select(VoiceWindow *voice_window, ...
*macro_ptr = macro_spec; if (zero_pad || ((i != macro_units) && (add_units == FormatUnits_None))) { *macro_ptr++ = '0'; } if (!modulus && (i == macro_units)) { *macro_ptr++ = 'f'; } strcpy(macro_ptr, s_Tstrings[add_units][i]); macro_ptr += strlen(s_Tst...
if (*state->position == '\0') { state->error->status = TemplateStringErrorStatus_MissingClosingQuote; return; }
// Skip the delimiter state->position++; } static void prv_format_skip_format_string(TemplateStringState *state, char delimiter) { // No match, so let's move along to the next one. while ((*state->position != delimiter) && (*state->position != '\0')) { prv_handle_escape_character(state); if (state->er...
/* * 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, ">> Reading Addr 0x%"PRIx32" value is 0x%"PRIx16, read_addr, read_buffer); }