prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
utes.h> #include <util/math.h> #include <util/size.h> #include <util/uuid.h> // Dialog SDK #include "ble_gap.h" #include "ble_gatt.h" #include "ble_gattc.h" #include "ble_gatts.h" #include "ble_service.h" #include "ble_uuid.h" #include "storage.h" #include <inttypes.h> #include <string.h> // Hack Alert // // There ...
if (!state) { state = (PPoGATTWorkAroundState *)kernel_zalloc_check(sizeof(PPoGATTWorkAroundState)); connection_set_ppogatt_wa_state(conn, state); }
return state; } void ppogatt_destroy_state(PPoGATTWorkAroundState *state) { if (state->pending_response_data) { kernel_free(state->pending_response_data); } kernel_free(state); } static bool prv_is_emulated_server_wa_requested(uint16_t conn_idx) { bool enabled = false; storage_acquire(); device_t *...
/* * 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 (!uuid) { return INSTALL_ID_INVALID; } return s_app_install_id; }
bool app_install_id_from_system(AppInstallId id) { return (id < INSTALL_ID_INVALID); } bool app_install_id_from_app_db(AppInstallId id) { return (id > INSTALL_ID_INVALID); } #define APP_GLANCE_TEST_UUID \ (UuidMake(0x3d, 0xc6, 0xb9, 0x4c, 0x4, 0x2, 0x48, 0xf4, \ 0xbe, 0x14, 0x81, 0x17, 0xf1, 0...
Y_CANVAS_UNOBSTRUCTEDLEFT, unobstructed_left); jerry_set_object_field(canvas, ROCKY_CANVAS_UNOBSTRUCTEDTOP, unobstructed_right); jerry_set_object_field(canvas, ROCKY_CANVAS_UNOBSTRUCTEDWIDTH, unobstructed_width); jerry_set_object_field(canvas, ROCKY_CANVAS_UNOBSTRUCTEDHEIGHT, unobstructed_height); } re...
{ func(rocky_api_graphics_get_gcontext(), color); }
; return jerry_create_undefined(); } #define COLOR_BUFFER_LENGTH (12) T_STATIC void prv_graphics_color_to_char_buffer(GColor8 color, char *buf_out) { if (color.a <= 1) { strncpy(buf_out, "transparent", COLOR_BUFFER_LENGTH); } else { snprintf(buf_out, COLOR_BUFFER_LENGTH, "#%02X%02X%02X", co...
set_stroke_color(ctx, GColorBlack); graphics_context_set_antialiased(ctx, false); graphics_draw_circle(ctx, GPoint(14, 14), 12); } void white_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorWhite); graphics_context_set_antialiased(ctx, false); graphics_draw_circ...
{ GContext ctx; test_graphics_context_init(&ctx, fb); // Big circles setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_BIG); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_origin_aa_r16_no_clip.${BIT_DEPTH_NAME}.p...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_origin_aa_r8_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // Small circles setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_SMALL); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "...
{ PebbleTask task = pebble_task_get_current(); if (task == PebbleTask_App) { app_crashed(); app_manager_get_task_context()->safe_to_kill = true; } else if (task == PebbleTask_Worker) { app_crashed(); worker_manager_get_task_context()->safe_to_kill = true; // If not release mode, generate a cor...
DEFINE_SYSCALL(NORETURN, sys_app_fault, uint32_t stashed_lr) { // This is the privileged side of handling a failed assert/croak from unprivileged code. // Always run on the current task. CrashInfo crash_info = make_crash_info_pc(stashed_lr); setup_log_app_crash_info(crash_info); system_task_add_callback(p...
void) { bool ret = prv_write_register(PmicRegisters_PWR_CFG, 0xB2); if (ret) { // Goodbye cruel world. The PMIC should be removing our power at any time now. while(1); __builtin_unreachable(); } return false; } static bool prv_set_mon_config_register(uint8_t value) { return prv_write_register(...
i2c_use(I2C_DEVICE_MAX14690)
; return true; } void set_ldo3_power_state(bool enabled) { i2c_use(I2C_DEVICE_MAX14690); prv_update_rail_state(PmicRail_LDO3, enabled); i2c_release(I2C_DEVICE_MAX14690); } void set_4V5_power_state(bool enabled) { gpio_use(GPIOF); GPIO_WriteBit(GPIOF, GPIO_Pin_2, enabled?Bit_SET:Bit_RESET); gpio_release...
/* * 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...
strftime(buf, buf_size, "%e", &good_data)
; if (r == 0 || strncmp(buf, " 5", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"e\": %s", buf); } r = strftime(buf, buf_size, "%F", &good_data); if (r == 0 || strncmp(buf, "2015-05-05", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"F\": %s", buf); } r = strftime(buf,...
0x99, 0x2c, 0x7a, 0x1f, 0x3b, 0x96, 0xa9, 0x70}; AppInstallId tictoc_id; AppInstallId music_id; AppInstallId sports_id; AppInstallId bg_counter_id; AppInstallId menu_layer_id; void test_app_install_manager__initialize(void) { fake_spi_flash_init(0, 0x1000000); pfs_init(false); app_install_manager_init(); ...
(&bg_counter.uuid, &uuid_entry)
); cl_assert_equal_b(true, app_install_entries_equal(&id_entry, &uuid_entry)); cl_assert_equal_b(true, app_install_get_entry_for_install_id(menu_layer_id, &id_entry)); cl_assert_equal_b(true, app_install_get_entry_for_uuid(&menu_layer.uuid, &uuid_entry)); cl_assert_equal_b(true, app_install_entries_equal(&id_e...
send it out through data logging, // make it the size of a data logging record uint8_t *msg_buffer = kernel_zalloc(PLOG_DLS_RECORD_SIZE); if (!msg_buffer) { return NULL; } // Number of bytes that are needed to encode the payload structure // (not including the data blob) const uint32_t payload_hdr_si...
(num_values == session->config.measurements.num_types, "Wrong number of values passed")
; PROTOBUF_LOG_DEBUG("Session: 0x%x - Adding measurement sample with %"PRIu32" values", (int)session_ref, num_values); // Encode the Measurement PLogPackedVarintsEncoderArg packed_varint_encoder_arg = { .num_values = num_values, .values = values, }; pebble_pipeline_Measurement m...
nstall_manager.h" #include "services/normal/filesystem/app_file.h" #include "services/normal/filesystem/pfs.h" #include "services/normal/legacy/persist_map.h" #include "services/normal/settings/settings_file.h" #include "system/logging.h" #include "system/passert.h" #include "util/list.h" #include "util/units.h" #defi...
prv_get_file_name(filename, sizeof(filename), uuid)
)); PBL_ASSERTN(PASSED(settings_file_open(&store->file, filename, PERSIST_STORAGE_MAX_SPACE))); store->file_open = true; } return &store->file; } void persist_service_unlock_store(SettingsFile *store) { prv_unlock(); } // Create a store for a client of the given UUID it doesn't already exist. If it // e...
.busy = 1 << 0, .write_enable = 1 << 1, }, .flag_status_bit_masks = { .erase_suspend = 1 << 3, }, .dummy_cycles = { .fast_read = 4, }, .block_lock = { .has_lock_data = false, .locked_check = 0xff, .protection_enabled_mask = (1 << 7), }, .reset_latency_ms = 13, .suspend_to_...
(QSPI_FLASH, buffer, start_addr, len)
; } status_t flash_impl_get_write_status(void) { return qspi_flash_get_write_status(QSPI_FLASH); } status_t flash_impl_enter_low_power_mode(void) { qspi_flash_set_lower_power_mode(QSPI_FLASH, true); return S_SUCCESS; } status_t flash_impl_exit_low_power_mode(void) { qspi_flash_set_lower_power_mode(QSPI_FLASH,...
ms[cd->menu_count - 1] = *item; } static void prv_append_regulatory_compliance_mark(SystemCertificationData *cd, GBitmap *mark) { // Determine whether adding this mark overflows the cell, necessitating // another cell for this mark. uint16_t mark_width = mark->bo...
i18n_get("Certification", data)
); SystemCertificationData *cd = &data->certification_data; *cd = (SystemCertificationData) {}; // Load up the assets gbitmap_init_with_resource(&cd->fcc_mark, RESOURCE_ID_SYSTEM_FCC_MARK); gbitmap_init_with_resource(&cd->kcc_mark, RESOURCE_ID_SYSTEM_KCC_MARK); gbitmap_init_with_resource(&cd->ce_mark, RES...
t = GBitmapFormat8Bit, .info.version = GBITMAP_VERSION_CURRENT, .bounds = src_bitmap->bounds }; // Verify that the compositing mode is correctly applied when the source is opaque and // the tint color is not clear. memset(dest_data, GColorClear.argb, sizeof(dest_data)); memset(expect_bmp_data, GColor...
GRect(offset_x, y_lower, 3, 1)
; bitblt_bitmap_into_bitmap_tiled(&dest_bitmap, &src_bmp, lower_rect, GPointZero, GCompOpAssign, GColorWhite); bitblt_bitmap_into_bitmap_tiled(&dest_bitmap, &src_bmp, lower_left_legend_rect, GPointZero, GCompOpAssign, GColorWhite); bitb...
/* * 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...
evented_timer_cancel(s_timer)
; } const PebbleProcessMd* mfg_accel_app_get_info(void) { static const PebbleProcessMdSystem s_app_info = { .common.main_func = &s_main, // UUID: ED2E214A-D4B5-4360-B5EC-612B9E49FB95 .common.uuid = { 0xED, 0x2E, 0x21, 0x4A, 0xD4, 0xB5, 0x43, 0x60, 0xB5, 0xEC, 0x61, 0x2B, 0x9E, 0x49, ...
-- // Sample captured at: 2016-05-19 21:05:00 local, 2016-05-20 04:05:00 GMT AlgDlsMinuteData *activity_sample_sleep_shut_down_1(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME sleep_shut_down_1 //> TEST_VERSION 3 //> TEST_TOTAL -1 //> TEST_TOTAL_MIN...
{ 0, 0x62, 6031, 238, 0}, { 0, 0x8d, 0, 237, 0}, { 0, 0x8c, 593, 237, 0}, { 0, 0x8d, 0, 238, 0}, { 0, 0x8e, 0, 238, 0}, { 0, 0x8e, 0, 237, 0}, { 0, 0x8e, 0, 237, 0}, { 0, 0x8e, 0, 238, 0}, { 0, 0x8e, 0, 166, 0}, { 9, 0x80, 735, 181, 0}, { 15, 0x82, 656, ...
{ 0, 0x5d, 0, 128, 0}, { 0, 0x5d, 0, 129, 0}, { 0, 0x5d, 0, 128, 0}, { 0, 0x5d, 0, 128, 0}, { 0, 0x5d, 0, 128, 0}, { 0, 0x5d, 0, 129, 0}, { 0, 0x5d, 0, 128, 0}, // 120: Local time: 2016-05-19 11:05:00 PM { 0, 0x5d, 0, 129, 0}, { 0, 0x5d, 0, 128, 0}, { 0...
_RATIO), GTransformNumberFromNumber((float)cosine / TRIG_MAX_RATIO), GTransformNumberZero, GTransformNumberZero); cl_assert(gtransform_is_equal(&t, &t_c)); angle = DEG_TO_TRIGANGLE(46); cosine = cos_lookup(angle); sine = sin_lookup(angle); t_c = GTran...
(gtransform_is_equal(&t1, &t_c))
; } void test_graphics_gtransform_${BIT_DEPTH_NAME}__rotation(void) { GTransform t_new; GTransform t1; GTransform t2; GTransform t_c; // matrix to compare against // Test rotation t1 = GTransformFromNumbers(10, 10, 10, 10, 10, 10); t2 = GTransformFromNumbers(10, 10, 10, 10, 10, 10); // Initialize a, ...
found previous item: list_insert_after(&prev_item->list_node, &stack_item->list_node); } static void prv_push_inserter(WindowStackItem *stack_item) { WindowStack *window_stack = stack_item->window->parent_window_stack; WindowStackItem *prev_item = (WindowStackItem *)(window_stack->list_head); // Insert befor...
(pop_item->window)
) { window_from = pop_item->window; // If no transition is explicitly provided, use the one specified when pushed. transition = transition ?: pop_item->pop_transition_implementation; PBL_ASSERTN(transition); } else { // We don't intentionally clean up the .pop_transition of a previous element if ...
/* * 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...
(MAX_TO_APP_EVENTS, sizeof(PebbleEvent))
; s_app_task_context = (ProcessContext) { 0 }; } // --------------------------------------------------------------------------------------------- bool app_manager_is_initialized(void) { return s_to_app_event_queue != NULL; } static bool s_first_app_launched = false; bool app_manager_is_first_app_launched(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...
cl_assert_equal_i(a.num_attributes, b.num_attributes)
; for (int i = 0; i < a.num_attributes; i++) { cl_assert_equal_i(a.attributes[i].id, b.attributes[i].id); switch (a.attributes[i].id) { case AttributeIdTitle: case AttributeIdSubtitle: case AttributeIdBody: cl_assert_equal_s(a.attributes[i].cstring, b.attributes[i].cstring); ...
(&ctx, fb); 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, GCornerTopLeft); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_offset_r8_quad_top_left.${BIT_DEPTH_NAME}.pbi")); setup_test_...
for (int r = 0; r <= 15; r++) { graphics_circle_quadrant_draw_1px_aa(&ctx, pt, r, c.mask); // center point follows a grid pt.x += 30; if (pt.x > 120) { pt.x = CENTER_OF_ORIGIN_RECT.x; pt.y += 30; } }
// construct file name and create meaningful assert description char filename[100]; snprintf(filename, sizeof(filename), "draw_circle_offset_aa_r8_%s.${BIT_DEPTH_NAME}.pbi", c.filename_part); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, filename)); } #endif } void test_graphics_draw_circle_$...
(EllipsisDrawConfig){ .start_quadrant = (EllipsisPartDrawConfig){TO_TRIG(0),GCornerNone}, .full_quadrants = GCornersAll, .end_quadrant = (EllipsisPartDrawConfig){TO_TRIG(0),GCornerNone} })); cl_assert_equal_edc(prv_calc_draw_config_ellipsis(TO_TRIG(360), TO_TRIG(370)), ((EllipsisDrawConfig){ .start...
TO_TRIG(270)
, TO_TRIG(360 + 180)), ((EllipsisDrawConfig){ .start_quadrant = (EllipsisPartDrawConfig){TO_TRIG(270),GCornerTopLeft}, .full_quadrants = (GCornersTop | GCornerBottomRight), .end_quadrant = (EllipsisPartDrawConfig){TO_TRIG(180),GCornerBottomLeft} })); // ## Section with regular angles // Within same q...
mation_legacy2.h" #include "applib/legacy2/ui/animation_private_legacy2.h" #include "applib/app_logging.h" #include "applib/applib_malloc.auto.h" #include "process_state/app_state/app_state.h" #include "kernel/kernel_applib_state.h" #include "kernel/memory_layout.h" #include "services/common/animation_service.h" #...
if (!node) { node = list_find(state->scheduled_head, prv_parent_list_filter, &info); }
se.h" #include "console/pulse2_transport_impl.h" #include "console/pulse_control_message_protocol.h" #include "system/passert.h" #include <util/attributes.h> #include <util/net.h> #include <stdbool.h> #include <stddef.h> #include <stdint.h> static bool s_layer_up = false; // Best Effort transport Control Protocol //...
{ ppp_control_protocol_lower_layer_is_down(PULSE2_BECP); }
void pulse2_best_effort_init(void) { ppp_control_protocol_init(PULSE2_BECP); ppp_control_protocol_open(PULSE2_BECP); } #endif
2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS"...
{ request_version = 2; }
GColor highlighted_color = (is_white) ? GColorBlack : GColorWhite; for (unsigned int index = 0; index < NUM_ACTION_BAR_LEGACY2_ITEMS; ++index) { const GBitmap *icon = action_bar->icons[index]; if (icon) { const bool is_highlighted = action_bar_legacy2_is_highlighted(action_bar, index); if (is_high...
{ void *context = action_bar_legacy2_get_context(action_bar); // For UP, SELECT and DOWN, setup the raw handler and assign the user specified context: for (ButtonId button_id = BUTTON_ID_UP; button_id < NUM_BUTTONS; ++button_id) { window_raw_click_subscribe(button_id, action_bar_legacy2_raw_down_handler, ...
inline static void action_bar_legacy2_update_click_config_provider( ActionBarLayerLegacy2 *action_bar) { if (action_bar->window) { window_set_click_config_provider_with_context( action_bar->window, (ClickConfigProvider) action_bar_legacy2_click_config_provider, action_bar); } } vo...
/* * 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...
(atoi(" +713713"), +713713)
; } void test_atoi__error(void) { cl_assert_equal_i(atoi("2147483647"), 2147483647); // last valid value cl_assert_equal_i(atoi("4294967287"), (int)4294967287); // signed integer overflow // ((2147483648 * 10) + 1) & 0xFFFFFFFF cl_assert_equal_i(atoi("21474836481"), 1); // ((2147483647 * 10) + 1) & 0xFFFFFFF...
le_test_semaphore); } #if CAPABILITY_HAS_MICROPHONE static void prv_mic_cb(int16_t *samples, size_t sample_count, void *context) { // Just throw away the recorded samples. } #endif static bool prv_run_test_step(BTLETestStep step, AppData *data) { data->current_test_step = step; PBL_LOG(LOG_LEVEL_DEBUG, "Run tes...
{ snprintf(data->status_string, STATUS_STRING_LENGTH, "Packets Received: %"PRIu16, data->rx_test_received_packets); app_window_stack_push(&data->status_window, true); }
here, we will never use a different // rate, and the accelerometer service will be made aware of our running rate. actual_interval = BMA255SampleInterval_125HZ; prv_enable_operating_mode(AccelOperatingMode_Data, actual_interval); return accel_get_sampling_interval(); } static void prv_configure_operating_mod...
(BMA255PowerMode_Normal)
; // Need to transition to Normal first prv_set_accel_power_mode(BMA255PowerMode_Standby); if (num_samples > BMA255_FIFO_MAX_FRAMES) { num_samples = BMA255_FIFO_MAX_FRAMES; } BMA255_DBG("Setting num samples to: %"PRIu32, num_samples); // Note that with the bma255, we do not want to use Bypass mode when ...
x.origin.x + levels_layer->frame.origin.x, .y = ctx->draw_state.drawing_box.origin.y + levels_layer->frame.origin.y, }, .size = levels_layer->frame.size, }; grect_clip(&ctx->draw_state.clip_box, &levels_layer_frame_in_ctx_space); } // translate the dr...
layer_get_unobstructed_bounds(layer, &bounds)
; return bounds; } //! Sets the window on the layer and on all of its children static void layer_set_window(Layer *layer, Window *window) { layer->window = window; Layer *child = layer->first_child; while (child) { layer_set_window(child, window); child = child->next_sibling; } } struct Window *laye...
qspi_flash_check_whoami(QSPI_FLASH)
; } FlashAddress flash_impl_get_sector_base_address(FlashAddress addr) { return (addr & SECTOR_ADDR_MASK); } FlashAddress flash_impl_get_subsector_base_address(FlashAddress addr) { return (addr & SUBSECTOR_ADDR_MASK); } void flash_impl_enable_write_protection(void) { } status_t flash_impl_write_protect(FlashAdd...
arbitrary radius values - this affects all tests here setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornersBottom); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rma...
(RECT_WIDTH, RECT_HEIGHT)
) / 2) - 1, GCornerTopLeft); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_aa_topleft.${BIT_DEPTH_NAME}.pbi")); 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_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCo...
ct_origin_sw11_clip_nxny.${BIT_DEPTH_NAME}.pbi")); #endif } #define OFFSET_RECT_NO_CLIP GRect(20, 10, 144, 168) #define OFFSET_RECT_CLIP_XY GRect(20, 10, 20, 20) #define OFFSET_RECT_CLIP_NXNY GRect(20, 10, 144, 168) #define OFFSET_DRAW_RECT_NO_CLIP GRect(6, 6, 30, 40) #define OFFSET_DRAW_RECT_CL...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw5_clip_xy.${BIT_DEPTH_NAME}.pbi"))
-15134) static bool prv_config_charger(void) { const uint8_t CHARGE_VOLTAGE_4300 = 0b101; const uint8_t CHARGE_VOLTAGE_4200 = 0b011; // [AS] HACK alert! (see PBL-19186) // The MAX14690 state machine is stupid and kicks us into a charge complete state when the charger // is connected and the battery voltage i...
{ rail_control_reg = PmicRegisters_LDO3_CONFIG; ref_count = &s_ldo3_ref_count; }
else { WTF; } uint8_t register_value; bool success = prv_read_register(rail_control_reg, &register_value); if (!success) { // Failed to read the current register value return false; } if (enable) { if (*ref_count) { (*ref_count)++; return true; } else { // Set the r...
ic, &characteristic_uuid, 1); cl_assert_equal_i(num_copied, 1); fake_kernel_malloc_mark(); // Try to subscribe to the non-subscribe-able characteristic: BTErrno e = gatt_client_subscriptions_subscribe(characteristic, ...
{ s_write_descriptor_cccd_result = -1; fake_kernel_malloc_mark(); // Try to subscribe for indications to the indicatable characteristic: BTErrno e = gatt_client_subscriptions_subscribe(prv_get_indicatable_characteristic(), BLESubscriptionIndications, ...
0, 0x65, 0, 0x0}, { 0, 0x65, 0, 0x0}, { 0, 0x65, 0, 0x0}, { 0, 0x65, 0, 0x0}, { 0, 0x65, 0, 0x0}, { 0, 0x65, 0, 0x0}, { 0, 0x65, 0, 0x0}, { 0, 0x65, 0, 0x0}, { 0, 0x65, 0, 0x0}, { 0, 0x55, 343, 0x0}, { 0, 0x55, 0, 0x0}, // 330: Local time: 02:41:00 AM { 0, 0x55, 113, 0x0...
{ 0, 0x7e, 0, 0x0}, { 0, 0x7d, 568, 0x0}, { 0, 0x6c, 0, 0x0}, { 0, 0x6c, 0, 0x0}, { 0, 0x31, 3670, 0x0}, { 0, 0x13, 156, 0x0}, { 9, 0x62, 8046, 0x0}, // 450: Local time: 04:41:00 AM { 0, 0x70, 25, 0x0}, { 0, 0x70, 0, 0x0}, { 0, 0x70, 0, 0x0}, { 0, 0x70, 926, 0x0}, { 0...
{ 0, 0x6f, 612, 0x0}, { 0, 0x6f, 938, 0x0}, { 0, 0x6f, 1135, 0x0}, { 0, 0x6f, 1403, 0x0}, { 0, 0x78, 5613, 0x0}, { 0, 0x69, 583, 0x0}, { 0, 0x68, 1614, 0x0}, { 0, 0x80, 2307, 0x0}, { 0, 0x60, 703, 0x0}, // 510: Local time: 05:40:00 AM { 0, 0x6f, 701, 0x0}, { 0, 0x60, 0, ...
ount(), 0); cl_assert_equal_i(regular_timer_seconds_count(), 0); regular_timer_deinit(); fake_gatt_client_op_deinit(); fake_gatt_client_subscriptions_deinit(); // Check for leaks: fake_pbl_malloc_check_net_allocs(); fake_pbl_malloc_clear_tracking(); fake_comm_session_cleanup(); free(s_client_reset_r...
{ PPoGATTMetaV0 future_meta_non_compatible = s_meta_v0_system; future_meta_non_compatible.ppogatt_min_version = 0xaa; future_meta_non_compatible.ppogatt_max_version = 0xff; prv_notify_services_discovered(1); ppogatt_handle_read_or_notification(s_characteristics[0][PPoGATTCharacteristicMeta], ...
void test_ppogatt__handles_invalid_uuid_meta(void) { PPoGATTMetaV0 meta_invalid_uuid = s_meta_v0_system; meta_invalid_uuid.app_uuid = UUID_INVALID; prv_notify_services_discovered(1); ppogatt_handle_read_or_notification(s_characteristics[0][PPoGATTCharacteristicMeta], (c...
l_i(0b00111000, BITS_BETWEEN(3, 5)); cl_assert_equal_i(0b00010000, BITS_BETWEEN(4, 4)); } // Flash memory is organized into twelve sectors of unequal sizes. // Sectors 0-3 are 16 KiB. Sector 4 is 64 KiB. // The remaining sectors are 128 KiB. // Bitset of sectors that have been "erased" static uint32_t erased_sector...
(flash_locked)
; cl_assert_equal_s(testdata, (const char *)&flash_written_data[10]); assert_flash_unwritten(0, 10); assert_flash_unwritten(10 + sizeof(testdata), 90 - sizeof(testdata)); cl_assert(callback_called); } void test_system_flash__write_error(void) { return_status = FLASH_ERROR_OPERATION; malloc_flash_data(10); ...
TATE_CHANGE } static void prv_on_code_reject(PPPControlProtocol *this, struct LCPPacket *packet) { // TODO } static void prv_on_protocol_reject(PPPControlProtocol *this, struct LCPPacket *packet) { // TODO } static void prv_on_echo_request(PPPCont...
(protocol, body, body_len)
; } } } void pulse2_reliable_retransmit_timer_start(unsigned int timeout_ms, uint8_t sequence_number) { mutex_lock(s_reliable_timer_state_lock); RtcTicks timeout_ticks = timeout_ms * RTC_TICKS_HZ / 1000; s_reliable_timer_expiry_time_tick = rtc_get_ticks() + timeo...
8}, { 1200, 80, 48}, { 1160, 136, 16}, { 1128, 240, -48}, { 992, 248, -104}, { 856, 168, -56}, { 984, 80, -56}, { 912, 112, -216}, // 45 seconds { 944, 80, -240}, { 1360, 48, 40}, { 1632, 216, -160}, { 1520, 296, -224}, { 1400, 232, -168}, { 1232, 208, -224}, ...
{ 1088, 128, -40}, { 1112, 176, -232}, { 1120, 120, -280}, { 1352, 72, -24}, { 1352, 176, -168}, { 1328, 232, -248}, { 1360, 248, -232}, { 1160, 264, -312}, { 936, 312, -280}, { 888, 288, -136}, { 960, 360, -88}, { 1000, 368, -104}, { 992, 376, -152}, { 1168, 424,...
handle slice type %d", structured_glance->glance.current_slice.type); return; } // Evaluate the subtitle as a template string const char *subtitle_template_string = structured_glance->glance.current_slice.icon_and_subtitle.template_string; TemplateStringEvalConditions template_string_ree...
(&node->uuid, &s_generic_structured_glance_impl, should_consider_slices, generic_glance)
; if (structured_glance) { if (generic_glance->use_legacy_28x28_icon_size_limit) { launcher_app_glance_structured_set_icon_max_size(structured_glance, LAUNCHER_APP_GLANCE_STRUCTURED_ICON_LEGACY_MAX_SIZE); } return &structured_glance->glance; } else { return NULL; } }
d to turn off the feature when not //! in use. static uint8_t s_shake_subscribers_count = 0; //! Reference count of how many double tap subscribers we have. Used to turn off the feature when //! not in use. static uint8_t s_double_tap_subscribers_count = 0; //! Circular buffer that raw accel data is written into befor...
MIN(state->sampling_interval_us, *lowest_interval_us)
/* * 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...
{ LauncherAppGlanceWatchfaces *watchfaces_glance = launcher_app_glance_structured_get_data(structured_glance); return NULL_SAFE_FIELD_ACCESS(watchfaces_glance, icon, 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...
(menu_layer, NULL, &(MenuLayerCallbacks) { .get_num_sections = prv_menu_get_num_sections_callback, .get_num_rows = prv_menu_get_num_rows_callback, .get_header_height = prv_menu_get_header_height_callback, .get_cell_height = prv_menu_get_cell_height_callback, .get_separator_height = prv_menu_get_sepa...
; menu_layer_set_click_config_onto_window(menu_layer, window); layer_add_child(window_get_root_layer(window), menu_layer_get_layer(menu_layer)); app_window_stack_push(window, true); } static void deinit(void) { menu_layer_destroy(menu_layer); window_destroy(window); } static void s_main(void) { init(); ...
/* * 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...
("", string_list_get_at(list, 3))
; // 2 strings (last is not terminated and will fall through) will return 2 strings // when deserializing, the deserializer puts a \0 at the end // this case demonstrates the problem with incorrectly initialized data list->serialized_byte_length = 3; list->data[0] = 'a'; list->data[1] = '\0'; list->data[...
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(iter_next(&iterator)); c...
(&iterator)
); cl_assert(uuid_equal(&state.pin.header.id, &s_extra_case_items[2].header.id)); cl_assert(!iter_next(&iterator)); } // 5am, no events passed void test_timeline__extra_case_none_backwards(void) { prv_insert_extra_case_items(); Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = ...
/* * 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...
memcmp(out_buffer, "1234", 4)
== 0); cl_assert_equal_i(circular_buffer_get_write_space_remaining(&buffer), 2); cl_assert(circular_buffer_consume(&buffer, 4)); cl_assert_equal_i(circular_buffer_get_write_space_remaining(&buffer), 6); // Now there's just 56 in the buffer. Fill it to the brim cl_assert(circular_buffer_write(&buffer, (uint...
/* * 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...
mutex_create_recursive()
; // create and populate list of all Analytics for (uint32_t i = 0; i < num_nodes; i++) { prv_add_analytic_node(i); } } void analytics_init(void) { analytics_init_private(DialogAnalyticMetric_Count); } void analytics_reset_nodes(void) { prv_lock(); // Zero out all values ListNode *iter = s_analyti...
buffer, chunk_size); legacy_defective_checksum_update(&checksum, buffer, chunk_size); num_bytes -= chunk_size; } pfs_read(fd, buffer, num_bytes); legacy_defective_checksum_update(&checksum, buffer, num_bytes); uint32_t crc = legacy_defective_checksum_finish(&checksum); mutex_unlock_recursive(s_pfs_...
(buffer, sizeof(buffer), "fd open err: %d", fd)
; return; } size_t num_bytes = pfs_get_file_size(fd); uint32_t crc = pfs_crc_calculate_file(fd, 0, num_bytes); pfs_close(fd); prompt_send_response_fmt(buffer, sizeof(buffer), "CRC: %"PRIx32, crc); } /* * Routines to facilitate unit testing */ #if UNITTEST uint16_t test_get_file_start_page(int fd) { r...
352, -440, 328}, { 2072, -384, 272}, { 1728, -296, 232}, { 1472, -216, 168}, { 1352, -280, 168}, { 1104, -480, 128}, { 848, -512, 0}, { 720, -520, 0}, { 552, -592, -16}, { 520, -560, -64}, { 1016, -552, 48}, { 1456, -440, 48}, { 1904, -256, 112}, { 1992, -8, 240}, ...
{ 1344, -88, 32}, { 1392, -8, 80}, { 1496, 192, 200}, { 1576, 600, 264}, { 1552, 552, 240}, // 48 seconds { 1024, 320, 104}, { 1536, 176, 168}, { 1824, -144, 416}, { 1904, -304, 312}, { 1784, -296, 232}, { 1504, -256, 208}, { 1328, -216, 168}, { 1272, -240, 136}, ...
/* * 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...
("Missing IRK and/or ERK root key(s)!")
; } BTDeviceAddress addr; if (shared_prf_storage_get_ble_pinned_address(&addr)) { prompt_send_response_fmt(buf, DISPLAY_BUF_LEN, "\nPinned address: "BT_DEVICE_ADDRESS_FMT, BT_DEVICE_ADDRESS_XPLODE_PTR(&addr)); } SM128BitKey link_key; uint8_t platform_bits; if (bt_drive...
------------------------------------------------------------------------------------------------ bool shared_circular_buffer_write(SharedCircularBuffer* buffer, const uint8_t* data, uint16_t length, bool advance_slackers) { // If no clients, no need to write if (!buffer->clients) { PBL_LOG(LOG_LEVEL_WARN...
(data, read_ptr, chunk)
72, -120, 160}, { 1296, 344, -128}, { 1088, 440, -296}, { 792, 192, 48}, { 768, 16, 32}, { 816, 80, 96}, { 848, 248, 0}, { 864, 264, 24}, // 36 seconds { 832, 408, -112}, { 920, 296, -96}, { 1120, 328, -128}, { 1240, 256, -88}, { 1512, 184, 40}, { 1592, 240, 64}, ...
{ 1376, 312, 16}, { 992, 248, 32}, { 1096, 152, 56}, { 1160, 24, 168}, { 944, 56, 152}, { 808, 56, 104}, { 768, 24, 72}, { 760, -8, 80}, { 792, -8, 96}, { 832, -48, 48}, { 928, -112, 40}, { 960, -64, -16}, // 42 seconds { 1360, -216, 40}, { 1472, -192, 168}, ...
{ 776, 120, 40}, { 816, 72, 64}, { 880, 192, 64}, { 880, 288, -32}, { 984, 392, -136}, { 1112, 328, -80}, { 1256, 216, 8}, { 1496, 64, 152}, { 1704, 152, 120}, { 1120, 232, 48}, { 1016, 176, 80}, { 1104, 0, 160}, { 1104, -64, 192}, { 856, -48, 168}, { 784, -1...
uint32_t delay_ms) { prv_refresh_pop_timer_with_timeout(data, delay_ms, true); } static time_t prv_get_stale_time(TimelineItem *item) { // Reminders become stale 10 minutes after their start time, or when the event is over return item->header.timestamp + MAX(10, item->header.duration) * SECONDS_P...
(ModalPriorityNotification)
; } static void prv_push_snooze_dialog(void) { SimpleDialog *simple_dialog = simple_dialog_create("Snooze"); Dialog *dialog = simple_dialog_get_dialog(simple_dialog); const char *msg = i18n_get("Snoozed", dialog); dialog_set_text(dialog, msg); dialog_set_icon(dialog, RESOURCE_ID_REMINDER_SNOOZE); i18n_free...
icon and record its resource ID workout_glance->icon = kino_reel_create_with_resource(new_icon_resource_id); PBL_ASSERTN(workout_glance->icon); workout_glance->icon_resource_id = new_icon_resource_id; return true; } static uint32_t prv_get_workout_icon_resource_id_for_type(ActivitySessionType type) { switch...
prv_timer_callback(structured_glance)
; const uint32_t timer_interval_ms = 1000; workout_glance->timer = app_timer_register_repeatable(timer_interval_ms, prv_timer_callback, structured_glance, true /* repeating */); return &structured_glance->glance; }
sizeof(Uuid), (uint8_t*)&temp, sizeof(AppDBEntry))); cl_assert_equal_i(5, app_db_check_next_unique_id()); // check app 1 memset(&temp, 0, sizeof(AppDBEntry)); cl_assert_equal_i(S_SUCCESS, app_db_get_app_entry_for_uuid(&app1.uuid, &temp)); cl_assert_equal_b(true, uuid_equal(&app1.uuid, &temp.uuid)); cl_a...
cl_assert_equal_b(true, app_db_exists_install_id(2))
; cl_assert_equal_b(true, app_db_exists_install_id(3)); cl_assert_equal_b(false, app_db_exists_install_id(4)); } static const uint8_t some_data[] = {0x01, 0x02, 0x17, 0x54}; void prv_enumerate_entries(AppInstallId install_id, AppDBEntry *entry, void *data) { switch(install_id) { case 1: cl_assert_equa...
/* * 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 ((ch == ':') || prv_format_string_ending(ch)); }
e "lis3dh.h" #include "board/board.h" #include "drivers/exti.h" #include "drivers/gpio.h" #include "drivers/i2c.h" #include "drivers/legacy/accel.h" #include "drivers/periph_config.h" #include "drivers/vibe.h" #include "kernel/events.h" #include "pebble_errors.h" #include "registers.h" #include "services/common/accel_...
if (!prv_write_register(LIS3DH_FIFO_CTRL_REG, mode)) { return; }
} } static void prv_reset(void) { lis3dh_lock(); if (i2c_bitbang_recovery(I2C_LIS3DH)) { prv_clear_fifo(); } lis3dh_unlock(); analytics_inc(ANALYTICS_DEVICE_METRIC_ACCEL_RESET_COUNT, AnalyticsClient_System); } bool lis3dh_read(uint8_t register_address, uint8_t read_size, uint8_t *buffer) { bool ru...
ineNode *current = (TimelineNode *)list_get_tail((ListNode *)head); while (current) { if (prv_show_event(current, timestamp, today_midnight, TimelineIterDirectionPast, show_all_day_events)) { break; } current = (TimelineNode *)current->node.prev; } return current; } static TimelineNode *pr...
for (int i = 0; i < num_nodes; i++) { nodes[i]->timestamp = midnight; nodes[i]->duration = MINUTES_PER_DAY; nodes[i]->all_day = true; midnight += SECONDS_PER_DAY; }
} static void prv_add_nodes_for_serialized_item(TimelineNode **list_head, CommonTimelineItemHeader *header) { int num_nodes = prv_num_nodes_for_serialized_item(header); TimelineNode *nodes[num_nodes]; // copy UUID to all the nodes for (int i = 0; i < num_nodes; i++) { // each node requires its own mall...
acts_db_delete, .flush = contacts_db_flush, #else // Disabled on tintin for code savings .disabled = true, #endif }, [BlobDBIdWatchAppPrefs] = { #if !PLATFORM_TINTIN .init = watch_app_prefs_db_init, .insert = watch_app_prefs_db_insert, .get_len = watch_app_prefs_db_get_len, .read = watch...
{ if (!prv_db_valid(db_id)) { return NULL; } const BlobDB *db = &s_blob_dbs[db_id]; if (db->get_dirty_list) { return db->get_dirty_list(); } return NULL; }
lesystem/pfs.h" #include "services/normal/settings/settings_file.h" #include "process_management/app_install_manager.h" #include "util/attributes.h" #include "clar.h" // Fakes ////////////////////////////////////////////////////////// #include "fake_app_manager.h" #include "fake_new_timer.h" #include "fake_pbl_malloc...
cl_must_pass(settings_file_exists(&file, (uint8_t*)&wakeup_id, sizeof(wakeup_id)))
* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License....
(true, s_get_called)
; cl_assert_equal_b(true, s_close_called); } void test_app_session_capabilities__cache_file_but_no_key_and_not_connected(void) { bool has_cap = comm_session_current_app_session_cache_has_capability(CommSessionInfiniteLogDumping); cl_assert_equal_b(false, has_cap); cl_assert_equal_b(true, s_get_called); ...
/* * 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_services_added(handler, info.device, info.status)
; break; case PebbleServicesRemoved: // TODO (PBL-22087): This is suboptimal. Before we release the BLE API, we should // either communicate to the App all the handles which have changed or // allow the getters for removed services to still work for the duration // of the callback. For...
te == BTPairingUIStateAwaitingUserConfirmation); prv_exit_awaiting_user_confirmation(data); data->ui_state = BTPairingUIStateAwaitingResult; prv_send_response(true /* is_confirmed */); prv_adjust_background_frame_for_state(data); } static void prv_decline_click_handler(ClickRecognizerRef recognizer, void *ctx)...
(device_name_layer, &GRect(x_offset, 122 + y_offset, width - x_offset, 30), data->device_name_layer_buffer, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD), GColorBlack, GColorC...
; layer_add_child(&window->layer, &device_name_layer->layer); } // Confirmation token: if (prv_has_confirmation_token(data)) { TextLayer *code_text_layer = &data->code_text_layer; text_layer_init_with_parameters(code_text_layer, &GRect(x_offset, 148 + y_offset, widt...
/* * 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 (e->bluetooth.comm_session_event.is_open) { if (bt_dialog->connected_handler) { bt_dialog->connected_handler(true, bt_dialog->context); } // handler to NULL so it won't be called again during the unload bt_dialog->connected_handler = NULL; dialog_pop(&bt_dialog->dialog.dialog); }
} static void prv_bt_dialog_unload(void *context) { BtConnDialog *bt_dialog = context; event_service_client_unsubscribe(&bt_dialog->pebble_app_event_sub); if (bt_dialog->connected_handler) { bt_dialog->connected_handler(false, bt_dialog->context); } if (bt_dialog->owns_buffer) { applib_free(bt_dialo...
(PropertyAnimationPrivate *)from); if (prop) { clone = &prop->animation; clone->is_property_animation = true; } } else { clone = applib_type_malloc(AnimationPrivate); } if (!clone) { return NULL; } clone_h = ...
animation_service_timer_event_received()
; if(!s_paused){ // Run all animations for this time interval prv_run(state, now, NULL /*top-level animation*/, 0/*top-level start time*/, true/*do_update*/); } // Frame rate control: const int32_t frame_interval_ms = serial_distance32(state->aux->last_frame_time_ms, now); const int32_t error_ms = f...
&window->window, WINDOW_NAME("NoMusicWindow")); window_set_background_color(&window->window, PBL_IF_COLOR_ELSE(GColorLightGray, GColorWhite)); window_set_window_handlers(&window->window, &(WindowHandlers) { .unload = prv_unload_no_music_window }); const MusicAppSizeConfig *config = prv_config(); gbitm...
MIN((data->track_pos * 100) / data->track_length, 100)
; progress_layer_set_progress(&data->track_pos_bar, percent); prv_copy_time_period(data->position_buffer, sizeof(data->position_buffer), data->track_pos / 1000); prv_copy_time_period(data->length_buffer, sizeof(data->length_buffer), data->track_length / 1000...
t bool shutting_down = (entry->force_shut_down_at == i); kalg_activities_update(s_kalg_state, now, entry->samples[i].v5_fields.steps, vmc, entry->samples[i].v5_fields.orientation, entry->samples[i].v5_fields.plugged_in, 0 /*res...
prv_sample_discovery_init(&s_activity_sample_discovery_state.common, SampleFileType_MinuteSamples, "activity/activity_samples")
per Y data->circle_origin.x += (data->circle_velocity_x * PIXEL_SPEED_PER_FRAME); if (data->circle_origin.x - data->circle_radius < 0 || data->circle_origin.x + data->circle_radius > data->window.layer.bounds.size.w) { data->circle_velocity_x = data->circle_velocity_x * -1; data-...
{ gpath_draw_outline_open(ctx, data->bucket); }
} } static int64_t prv_time_64(void) { time_t s; uint16_t ms; rtc_get_time_ms(&s, &ms); return (int64_t)s * 1000 + ms; } static void layer_update_proc(Layer *layer, GContext* ctx) { AppData *data = app_state_get_user_data(); graphics_context_set_fill_color(ctx, GColorBlack); if (stroke_width_enabled...
{ 328, 792, -376}, { 328, 792, -376}, { 320, 792, -376}, { 320, 800, -376}, { 328, 792, -376}, { 328, 800, -376}, { 328, 800, -376}, { 328, 800, -376}, { 336, 800, -384}, { 328, 800, -384}, { 328, 800, -376}, { 328, 792, -376}, { 328, 800, -376}, { 328, 800, -376}, ...
{ -432, 552, -720}, { -432, 560, -720}, { -440, 560, -728}, { -440, 552, -728}, { -440, 560, -728}, { -440, 552, -728}, { -432, 560, -712}, { -440, 552, -728}, { -440, 560, -720}, { -440, 560, -720}, { -440, 560, -728}, { -448, 552, -728}, // 110 seconds { -440, 5...
{ -232, 168, -1064}, { -464, 128, -1032}, { -496, -104, -976}, { -400, 88, -968}, { -360, 256, -944}, { -352, 360, -936}, { -360, 248, -944}, { -392, 160, -936}, { -384, 152, -952}, { -392, 192, -944}, { -376, 224, -952}, { -384, 120, -960}, { -384, 168, -960}, {...
e_ad_destroy(BLEAdData *ad) { applib_free(ad); } // ----------------------------------------------------------------------------- //! The smallest UUID width, by reducing the width when a UUID is based on the //! Bluetooth base UUID. @see bt_uuid_expand_16bit @see bt_uuid_expand_32bit static uint8_t prv_smallest_bt_...
for (unsigned int i = 0; i < num_uuids; ++i) { switch (max_width_bytes) { case 16: element->uuid_128[i] = uuids[i]; break; case 4: element->uuid_32[i] = prv_convert_to_32bit_uuid(&uuids[i]); break; case 2: element->uuid_16[i] = prv_convert_to_16bit_uuid(&uuids[i]); break; default: WT...
return prv_write_element_to_ad_data(ad, (const BLEAdElement *) element); } // ----------------------------------------------------------------------------- bool ble_ad_set_local_name(BLEAdData *ad, const char *local_name) { if (!local_name) { return false; } const size_t length...
/* * 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...
{ packed_pixel_set(s_data, x /* color_index */, x, y, BITS_PER_PIXEL, s_bmp.row_size_bytes); }
} memset(dest_bitmap_data, GColorWhite.argb, sizeof(dest_bitmap_data)); #if SCREEN_COLOR_DEPTH_BITS == 8 char print_buf[20]; for (int y = 0; y < HEIGHT; ++y) { for (int x = 0; x < WIDTH; ++x) { snprintf(print_buf, sizeof(print_buf), "Failed index = %d, %d", x, y); cl_check_(gcolor_equal(get_bi...
p_state.next_wakeup_id = wakeup_id + 1; } // schedule non-expired events if (time_difference > 0) { // Using settings_file_rewrite, need to write to keep key/value settings_file_set(new_file, (uint8_t*)&wakeup_id, sizeof(WakeupId), (uint8_t*)&entry, sizeof(WakeupEntry)); } else { if (entry....
{ return retval; }
// If this new event is sooner than the currently scheduled timer, make this // the current one prv_wakeup_timer_next_pending(); return wakeup_id; } static void prv_wakeup_settings_delete_entry(WakeupId wakeup_id) { mutex_lock(s_mutex); { SettingsFile wakeup_settings; if (settings_file_open(&wak...
e); if (bitmap) { // Perform conversion uint8_t *src_data = (uint8_t *)src_bitmap->addr; uint8_t *dest_data = (uint8_t *)bitmap->addr; for (int y = 0; y < bitmap->bounds.size.h; ++y) { for (int b = 0; b < bitmap->row_size_bytes; ++b) { int dest_idx = y * bitmap->row_size_by...
{ if (!bitmap) { return false; } memset(bitmap, 0, prv_gbitmap_size()); const size_t data_size = sys_resource_size(app_num, resource_id); uint8_t *data = applib_resource_mmap_or_load(app_num, resource_id, 0, data_size, false); if (!data) { return false; } // Scan the resource data to see if i...
uint16_t gbitmap_get_bytes_per_row(const GBitmap *bitmap) { if (!bitmap) { return 0; } return bitmap->row_size_bytes; } static bool prv_gbitmap_is_context(const GBitmap *bitmap) { return (bitmap->addr == graphics_context_get_bitmap(app_state_get_graphics_context())->addr); } GBitmapFormat gbitmap_get_fo...
/* * 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...
pebble_task_get_current()
== PebbleTask_Worker) { // Not allowed from workers syscall_failed(); } syscall_assert_userspace_buffer(data, num_bytes); } return resource_load_byte_range_system(app_num, id, start_offset, data, num_bytes); } DEFINE_SYSCALL(bool, sys_resource_bytes_are_readonly, void *ptr) { return resour...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ bt_persistent_storage_delete_ble_pairing_by_id(id); analytics_inc(ANALYTICS_DEVICE_METRIC_BLE_PAIRING_FORGET_COUNT, AnalyticsClient_System); }
static void prv_remote_menu_cleanup(ActionMenu *action_menu, const ActionMenuItem *item, void *context) { ActionMenuLevel *root_level = action_menu_get_root_level(action_menu); SettingsRemoteData *data = (SettingsRemoteData *) context; i18n...
uf)); mbuf_iterator_init(&s_read_consumer.mbuf_iter, &s_header_mbuf); system_task_add_callback_from_isr(prv_schedule_notify_timeout, NULL, &should_context_switch); } return should_context_switch; } // Sending functions //////////////////////////////////////////////////////////////////////////////// stati...
(&start_flag_mbuf, MBUF_FLAG_IS_FRAMING, true)
; // Header FrameHeader header = (FrameHeader) { .version = SMARTSTRAP_PROTOCOL_VERSION, .flags = { .is_read = is_read, .is_master = true, }, .profile = profile }; MBuf header_mbuf = MBUF_EMPTY; mbuf_set_data(&header_mbuf, &header, sizeof(header)); mbuf_append(&start_flag_mbuf, ...
.remote_encryption_info = { .ltk = (const SMLongTermKey) { .data = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, }, }, .rand = 0x11223344, .ediv = 9876, }, .irk = (const SMIdentityResolvingKey) { ...
cl_assert_equal_i(memcmp(&pairing_info->remote_encryption_info.ltk, &pairing_info_out.remote_encryption_info.ltk, sizeof(SMLongTermKey)), 0)
; cl_assert_equal_i(memcmp(&pairing_info->irk, &pairing_info_out.irk, sizeof(SMIdentityResolvingKey)), 0); cl_assert_equal_i(memcmp(&pairing_info->csrk, &pairing_info_out.csrk, sizeof(SM128BitKey)), 0); } void test_shared_prf_storage_v2__bt_classic_and_le_pair...
compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, eit...
(valid_message, " possible postamble")
; uint8_t message_buf[128]; ANCSAttribute *message = (ANCSAttribute *)&message_buf; message->length = strlen(valid_message); memcpy(message->value, valid_message, strlen(valid_message)); // Existing prefs iOSNotifPrefs existing_prefs = { .attr_list = { .num_attributes = 3, .attributes = (A...
mit_succeeded; prv_mark_pb_jobs_complete(1); prv_cleanup_and_send_response((commit_succeeded) ? ResponseAck : ResponseNack); } static bool prv_is_valid_command_for_current_state(PutBytesCommand command) { switch (s_pb_state.current_command) { case PutBytesIdle: return (command == PutBytesInit || command ==...
(s_pb_state.timer_id, PUT_TIMEOUT_MS, prv_timer_callback, &s_pb_state, 0 /*flags*/)
); prv_mark_pb_jobs_complete(num_put_jobs); // At this point we have updated the outstanding jobs. Check to see if a job started to arrive in // the meantime which needs to be ack'ed now that space is free bool do_ack; prv_lock_pb_job_state(); { do_ack = put_jobs->need_to_ack_later; put_jobs->need...
cell_width * num_columns_accounting_for_focused_unfocused) + (GRID_CELL_PADDING * (num_columns_accounting_for_focused_unfocused + 1)); const int16_t bitmap_height = prv_calculate_overall_grid_height(); const GSize bitmap_size = GSize(bitmap_width, bitmap_height); s_dest_bitmap = gbitmap_create_blank(bitmap_si...
(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE))
art_page) + FILE_NAME_OFFSET); if (!f->is_tmp) { update_curr_state(f->start_page, TMP_STATE_OFFSET, TMP_STATE_DONE); } // finally, mark the creation as complete update_curr_state(start_page, CREATE_STATE_OFFSET, CREATE_STATE_DONE); return (S_SUCCESS); } static status_t scan_to_offset(File *f, uint32_t...
PFS_FD(fd)
_i(prv_count_handler_entries(&s_stopped_handler_calls, seq), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, c), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, c), 1); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, c), 1); cl_assert_equa...
animation_sequence_create(a, b, NULL)
; cl_assert(seq != NULL); animation_set_delay(seq, delay_seq); animation_set_play_count(seq, play_count_seq); // Check durations cl_assert_equal_i(animation_get_duration(a, false, false), duration_a); cl_assert_equal_i(animation_get_duration(a, false, true), play_count_a * duration_a); cl_assert_equal_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...
_Static_assert(offsetof(HeartRateZoneData, version) == 0, "Version not at the start of HeartRateZoneData")
; _Static_assert(sizeof(HeartRateZoneData) % sizeof(uint32_t) == 0, "HeartRateZoneData size is invalid"); static status_t prv_file_open_and_lock(SettingsFile *file) { mutex_lock(s_mutex); status_t rv = settings_file_open(file, HEALTH_DB_FILE_NAME, HEALTH_DB_MAX_SIZE); if (rv != S_SUCCESS) { ...
// Size value is 1 more than it should be // value (made up for now) 0x00 }; void test_blob_db_endpoint__handle_insert_command_smallest_length(void) { // Process Command uint8_t *resp_ptr = process_blob_db_command(s_insert_cmd_smallest_length, sizeof(s_insert_cmd_smallest_length)); // Check Res...
(TEST_DB_ID == *(uint8_t*)cmd_ptr)
; cmd_ptr += sizeof(uint8_t); cl_assert((cmd_ptr - s_invalid_operation_cmd) == sizeof(s_invalid_operation_cmd)) ; // Process Command uint8_t *resp_ptr = process_blob_db_command(s_invalid_operation_cmd, sizeof(s_invalid_operation_cmd)); // Check Response cl_assert(token == *(uint16_t*)resp_ptr); resp_pt...
rmNumberFromNumber((float)cosine / TRIG_MAX_RATIO), GTransformNumberFromNumber(-(float)sine / TRIG_MAX_RATIO), GTransformNumberFromNumber((float)sine / TRIG_MAX_RATIO), GTransformNumberFromNumber((float)cosine / TRIG_MAX_RATIO), GTransformNumbe...
(gtransform_is_equal(&t1, &t2))
; // ensure t1 has not changed // Test pointer re-use gtransform_translate(&t1, &t1, GTransformNumberFromNumber(10), GTransformNumberFromNumber(200)); cl_assert(gtransform_is_equal(&t1, &t_c)); } void test_graphics_gtransform_${BIT_DEPTH_NAME}__rotation(void) { GTransform t_new; GTransform t1; GTransform...
OFFSET_RECT_EVEN, false, 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(1, 0), MAX_NUM_ROWS); graphics_draw_vertical_line_dotted(&ctx, GPoint(3, 0), MAX_NUM_ROWS + 4); graphics_draw_vertical_line_dotted(&ctx, GPoint(5, 0), 0); graphics_draw_vertical_line_dotted(&ctx, GPoint(7, 0), 1); graphics_draw_verti...
(&ctx, GPoint(5, 0), 0)
; graphics_draw_vertical_line_dotted(&ctx, GPoint(7, 0), 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(9, 0), 2); graphics_draw_vertical_line_dotted(&ctx, GPoint(11, 0), 3); graphics_draw_vertical_line_dotted(&ctx, GPoint(13, 0), 4); graphics_draw_vertical_line_dotted(&ctx, GPoint(15, 0), 20); graphic...
, false); cl_assert_equal_i(3 * NORMAL, l.selection.y); cl_assert_equal_i(-FOCUSED, scroll_layer_get_content_offset(&l.scroll_layer).y); cl_assert_equal_i(FOCUSED, l.selection.h); cl_assert_equal_b(true, s_content_available[ContentIndicatorDirectionUp]); cl_assert_equal_b(true, s_content_available[ContentIndi...
cl_assert_equal_i(0, menu_layer_get_selected_index(&l).section)
} } static void check_and_handle_resuming_from_standby(void) { periph_config_enable(RCC_APB1PeriphClockCmd, RCC_APB1Periph_PWR); if (PWR_GetFlagStatus(PWR_FLAG_SB) == SET) { // We just woke up from standby. For some reason this leaves the system in a funny state, // so clear the flag and reboot again to...
if (check_and_increment_reset_loop_detection_bits()) { sad_watch(ERROR_RESET_LOOP); }
watchdog_init(); #ifndef NO_WATCHDOG watchdog_start(); #endif jump_to_fw(); }
m_height); } const int16_t header_padding = 6 * aml->num_items; const int16_t header_height = ((bounds->size.h - total_h) / 2) - padding; return MAX(header_height - header_padding, 0); } static void prv_draw_header_cb(GContext *ctx, const Layer *cell_layer, uint16_t section_index, ...
(aml, selected_index, false /* animated */)
; } // Public API ///////////////////// void action_menu_layer_click_config_provider(ActionMenuLayer *aml) { window_single_repeating_click_subscribe(BUTTON_ID_UP, 100, prv_scroll_handler); window_set_click_context(BUTTON_ID_UP, aml); window_single_repeating_click_subscribe(BUTTON_ID_DOWN, 100, prv_scroll_handle...
/* * 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...
(dev->qspi, dev->state->part->instructions.enter_quad_mode)
/* * 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...
{ applib_resource_track_mmapped(mapped_data); result = (uint8_t *)(mapped_data + offset); }
else { // TODO: PBL-40010 clean this up // we are wasting 7 bytes here so that clients of this API have the chance to // align the data result = applib_malloc(num_bytes + (used_aligned ? 7 : 0)); if (!result || sys_resource_load_range(app_num, resource_id, offset, ...
20, 248}, { -40, 920, 256}, { -40, 920, 256}, // 119 seconds { -40, 920, 248}, { -40, 920, 248}, { -40, 920, 248}, { -40, 920, 256}, { -40, 920, 248}, { -40, 920, 248}, { -40, 920, 248}, { -40, 920, 248}, { -48, 920, 248}, { -24, 920, 232}, { -40, 912, 240}, {...
{ -40, 928, 216}, { -40, 928, 208}, { -40, 928, 216}, { -48, 928, 208}, { -48, 936, 216}, { -40, 920, 208}, { -40, 928, 208}, { -48, 928, 200}, { -40, 928, 208}, // 125 seconds { -32, 920, 200}, { -40, 928, 216}, { -40, 928, 216}, { -40, 928, 208}, { -40, 936,...
{ -40, 912, 248}, { -32, 920, 256}, { -32, 912, 256}, { -32, 920, 248}, { -40, 920, 256}, { -40, 920, 256}, { -40, 912, 248}, { -32, 912, 248}, { -40, 912, 256}, { -32, 912, 256}, { -40, 920, 256}, { -40, 912, 248}, { -40, 912, 248}, // 128 seconds { -40, 912...
de "stubs_prompt.h" #include "stubs_serial.h" #include "stubs_sleep.h" #include "stubs_passert.h" #include "stubs_task_watchdog.h" void app_storage_delete_app(AppInstallId id) { char buffer[30]; itoa_int(id, buffer, 10); pfs_remove(buffer); } bool app_storage_app_exists(AppInstallId id) { return true; } AppI...
cl_assert_equal_i(S_SUCCESS, app_cache_add_entry(app3.id, app3.size))
; // remove 3 cl_assert_equal_i(S_SUCCESS, app_cache_remove_entry(app1.id)); cl_assert_equal_i(S_SUCCESS, app_cache_remove_entry(app2.id)); cl_assert_equal_i(S_SUCCESS, app_cache_remove_entry(app3.id)); cl_assert_equal_i(fake_event_get_count(), 3); // ensure the one that is evicted is INVALID_ID cl_ass...
eleted the entry // in the DB or the mute attribute (neither of which should happen) PBL_LOG(LOG_LEVEL_WARNING, "Could not mute notification. No prefs or mute attribute"); } ios_notif_pref_db_free_prefs(notif_prefs); } static void prv_mute_notification_always(ActionMenu *action_menu, ...
if (has_snooze_action) { action_menu_level_add_action(root_level, i18n_get("Snooze", root_level), prv_snooze_reminder_cb, window_data); }
for (int i = 0; i < item->action_group.num_actions; i++) { TimelineItemAction *action = &item->action_group.actions[i]; if (prv_should_show_action_in_action_menu(window_data, item, action) && action != dismiss_action) { timeline_actions_add_action_to_root_level(action, root_level); } } ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ const ButtonConfig* button_config = &BOARD_CONFIG_BUTTON.buttons[id]; uint8_t bit = GPIO_ReadInputDataBit(button_config->gpio, button_config->gpio_pin); return bit; }
LID + 1); } else { s_next_unique_flash_app_id = (data.max_id + 1); } PBL_LOG(LOG_LEVEL_INFO, "Found %"PRIu32" apps. Next ID: %"PRIu32" ", data.num_apps, s_next_unique_flash_app_id); prv_close_file_and_unlock_mutex(); } status_t app_db_insert(const uint8_t *key, int key_len, const uint8_t *val, ...
pfs_remove(SETTINGS_FILE_NAME)
------------------ // Make sure there is at least 'needed' bytes available in our file system space // allowed for data logging static bool prv_make_file_system_space(uint32_t needed) { // Make sure we have at least 'needed' bytes free in the file system uint32_t used_space = prv_get_total_file_system_bytes(); if...
if (file_size == 0) { prv_release_session_file(session); return false; }
// Add a minium buffer to needed. This gives us a little insurance and also allows for the // extra space needed for the chunk header byte that occurs at least once evvery // DLS_MAX_CHUNK_SIZE_BYTES bytes. space_needed += DLS_MIN_FREE_BYTES; uint32_t space_avail = file_size - session->storage.write_offset;...
/* * 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 false; }
cl_assert_equal_m(s_expected_send_data, data, length); s_sent_action = true; return true; } static void prv_support_sms_replies(void) { // Store the preference in our DB char *key = "com.apple.MobileSMS"; int key_len = strlen(key); const int flags = 0; const int num_attributes = 0; const int num_ac...
r *timeline_layer = context; timeline_layer->sidebar_width = value; layer_mark_dirty((Layer *)timeline_layer); } static int16_t prv_sidebar_getter(void *context) { TimelineLayer *timeline_layer = context; return timeline_layer->sidebar_width; } Animation *timeline_layer_create_sidebar_animation(TimelineLayer ...
(&layer->layer, false)
; layer_set_update_proc(&layer->layer, prv_update_proc); TimelineIterState *state = timeline_model_get_current_state(); layer->current_day = NULL_SAFE_FIELD_ACCESS(state, current_day, 0); const TimelineLayerStyle *style = prv_get_style(); // The arrow is inverted on round, so hide it by extending the width of...
/* * 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 (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(out_cb, sizeof(*out_cb)); syscall_assert_userspace_buffer(out_cb_data, sizeof(*out_cb_data)); } mutex_lock(s_mutex); EventedTimer *timer = prv_find_timer(timer_id); // It's possible that the client made a call to delete the timer just ...
//! Wrapper for the user supplied callback. We installed this callback by posting a PEBBLE_CALLBACK_EVENT //! to the client's event queue. This gets executed on the target task. static void prv_evented_timer_event_callback(void* data) { // Note this may be running on the app task, so we have to jump through hoops ...