prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
t frame_length) { if (frame_length < PULSE_MIN_FRAME_LENGTH || frame_length == SIZE_MAX) { // Decoding failed, this frame is bogus return; } uint32_t fcs; if (crc32(CRC32_INIT, s_current_rx_frame, frame_length) == CRC32_RESIDUE) { net16 protocol_be; memcpy(&protocol_be, s_current_rx_frame, size...
if (timeout && uxQueueMessagesWaiting(s_pulse_task_queue) == 0) { s_pulse_task_idle = true; xSemaphoreTake(s_pulse_task_service_semaphore, timeout); s_pulse_task_idle = false; // Read the timer state again in case it changed while we were waiting. timeout = prv_poll_timer(&timer_sequence_...
// Even if the timer expired, drain the received bytes queue first. // We don't want to risk the queue filling up while the timer // handler is running. char c; while (xQueueReceive(s_pulse_task_queue, &c, 0) == pdTRUE) { if (UNLIKELY(c == FRAME_DELIMITER)) { size_t decoded_length = ...
eminder, } // don't care about the rest }; static TimelineItem item2 = { .header = { .id = {0x55, 0xcb, 0x7c, 0x75, 0x8a, 0x35, 0x44, 0x87, 0x90, 0xa4, 0x91, 0x3f, 0x1f, 0xa6, 0x76, 0x01}, .timestamp = 100, .duration = 0, .type = TimelineItemTypeReminder, } }; static TimelineItem i...
new_timer_scheduled(get_reminder_timer_id(), NULL)
terator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[3].header.id)); cl_assert(state.node); cl_assert(iter_prev(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[1].header.id)); } void test_timeline__forward_and_back(void) { Iterator iterator = {0}; TimelineIterState state = {0}; ...
iter_next(&iterator)
); cl_assert(uuid_equal(&state.pin.header.id, &s_items[0].header.id)); // check done cl_assert(iter_next(&iterator) == false); } static void prv_insert_long_items(void) { cl_assert_equal_i(pin_db_flush(), 0); for (unsigned int i = 0; i < ARRAY_LENGTH(s_long_items); i++) { cl_assert_equal_i(pin_db_insert_...
he device because no one is using it const int result = bt_driver_gap_le_disconnect(device); if (result != 0) { PBL_LOG(LOG_LEVEL_ERROR, "Ble disconnect failed: %d", result); } } else { if (prv_is_intent_using_whitelist(intent)) { // Remove from white-list: prv_mutate...
bt_persistent_storage_get_ble_pairing_by_id(bonding_id, &request.bonding.irk, &request.bonding.device, NULL)
) { return BTErrnoInvalidParameter; } bt_lock(); BTErrno ret_value = prv_register_intent(&request, auto_reconnect, is_pairing_required, client); bt_unlock(); return ret_value; } // ------------------------------------------------------------------------------------------------- BTErrno gap_le_connect_ca...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(sizeof s_boot_fpga < 1<<16, "FPGA bitstream too big")
ayout); prv_deinit_icon(timeline_layout); layer_deinit(&timeline_layout->layout_layer.layer); i18n_free_all(timeline_layout); } void timeline_layout_init_info(TimelineLayoutInfo *info, TimelineItem *item, time_t current_day) { *info = (TimelineLayoutInfo) { .timestamp = item->header.timestamp, .duratio...
layer_add_child(&timeline_layout->layout_layer.layer, &icon_layer->layer)
; kino_layer_play(icon_layer); } static void prv_deinit_icon(TimelineLayout *layout) { kino_layer_deinit(&layout->icon_layer); } //////////////////////// // Layout Impl //////////////////////// GSize timeline_layout_get_content_size(GContext *ctx, LayoutLayer *layout) { return ((TimelineLayout *)layout)->view_...
/* * 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 = 7; i >= 0; --i) { uint32_t digit = (num & (0xf << (i * 4))) >> (i * 4); char c; if (digit < 0xa) { c = '0' + digit; } else if (digit < 0x10) { c = 'a' + (digit - 0xa); } else { c = ' '; } *buffer++ = c; }
*buffer = '\0'; } static int8_t ascii_hex_to_int(const uint8_t c) { if (isdigit(c)) return c - '0'; if (isupper(c)) return (c - 'A') + 10; if (islower(c)) return (c - 'a') + 10; return -1; } static uint8_t ascii_hex_to_uint(const uint8_t msb, const uint8_t lsb) { return 16 * ascii_hex_to_int(msb) + asci...
ized, property_animation->values.from.grect.size.h, property_animation->values.to.grect.size.h); ((PropertyAnimationImplementation*) property_animation->animation.implementation) ->accessors.setter.grect(property_animation->subject, result); } // -----------------------------------------------...
{ PBL_ASSERTN(!animation_private_using_legacy_2(NULL)); PropertyAnimationPrivate *property_animation = prv_find_property_animation(property_animation_h); if (!property_animation) { return; } Fixed_S32_16 result = interpolate_fixed32(distance_normalized, pr...
// ----------------------------------------------------------------------------------------- static void prv_init(PropertyAnimationPrivate *property_animation, const PropertyAnimationImplementation *implementation, void *subject, void *from_value, void *to_value)...
aw_buffer = buffer; state->samples_per_update = samples_per_update; state->num_samples = 0; prv_update_driver_config(); } mutex_unlock_recursive(s_accel_manager_mutex); return 0; } DEFINE_SYSCALL(uint32_t, sys_accel_manager_get_num_samples, AccelManagerState *state, uint64_t *time...
PBL_LOG(LOG_LEVEL_WARNING, "Accel subscriber fell behind, truncating data")
; rv = shared_circular_buffer_write(&s_buffer, (uint8_t *)&accel_buffer_data, sizeof(accel_buffer_data), true /*advance_slackers*/); } PBL_ASSERTN(rv); prv_dispatch_data(); } void accel_cb_shake_detected(IMUCoordinateAxis axis, int32_t direction) { PebbleEvent e = { ...
ed under it status_bar_layer_set_colors(&data->status_layer, PBL_IF_ROUND_ELSE(GColorClear, status_color), gcolor_legible_over(status_color)); } static void prv_interaction_handler(SwapLayer *swap_layer, void *context) { NotificationWindowData *data = context; prv_refresh_pop_timer(...
(swap_layer)
); StatusBarLayer *status_layer = &data->status_layer; status_bar_layer_init(status_layer); status_bar_layer_set_colors(status_layer, PBL_IF_RECT_ELSE(GColorBlack, GColorClear), PBL_IF_RECT_ELSE(GColorWhite, GColorBlack)); status_bar_layer_set_separator_mode(status_layer, StatusBa...
/* * 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(!vibe_score_info_is_valid(VibeScoreId_Invalid))
set /////////////////////////////////////////////////////////////////////////////////////////////////// //! Tests void test_sprintf__basic(void) { char dstbuf[256]; cl_assert_equal_i(snprintf(dstbuf, 256, "Hello!\nI am error"), 17); cl_assert_equal_s(dstbuf, "Hello!\nI am error"); snprintf(dstbuf, 256, "Wha...
(dstbuf, "-1698898192,-1698898192")
; } // Literally copy-paste from %d void test_sprintf__percent_i(void) { char dstbuf[256]; // Simple %i snprintf(dstbuf, 256, "There are %i lights, %i", 4, -4); cl_assert_equal_s(dstbuf, "There are 4 lights, -4"); // Alternate form snprintf(dstbuf, 256, "There are %#i lights, %#i", 4, -4); cl_assert_eq...
_HANDLES; fd++) { File *f = &PFS_FD(fd).file; if ((f->is_tmp == is_tmp) && (f->name != NULL)) { if (strcmp(f->name, name) == 0) { PBL_ASSERTN(PFS_FD(fd).fd_status != FD_STATUS_FREE); *fdp = fd; return ((PFS_FD(fd).fd_status == FD_STATUS_IN_USE) ? FDBusy : FDAlreadyLoaded); } ...
(file, &pg_offset)
!= S_SUCCESS) { res = E_INTERNAL; goto cleanup; } size_t bytes_written = 0; while (bytes_written < size) { size_t bytes_to_write = MIN(free_bytes_in_page(file->curr_page) - pg_offset, size - bytes_written); prv_flash_write(buf + bytes_written, bytes_to_write, prv_page_to_flash_o...
xt_node = prv_create_text_node_buffer(NULL); prv_set_text_node_text_parameters_from_config(text_node, layout, config); return text_node; } static void prv_setup_container_node_from_config( GTextNodeContainer *container_node, const LayoutLayer *layout, const LayoutNodeContainerConfig *config) { const uint...
layout_create_text_node_from_config( layout, &s_heading_config.extent.node)
; GTextNodeText *paragraph_node = (GTextNodeText *)layout_create_text_node_from_config( layout, &s_paragraph_config.extent.node); heading_node->text = (char *)heading; paragraph_node->text = (char *)paragraph; graphics_text_node_container_add_child(&vertical_node->container, &heading...
lid(session), true); comm_session_close(session, CommSessionCloseReason_UnderlyingDisconnection); cl_assert_equal_b(comm_session_is_valid(session), false); } void test_session__get_type_system(void) { Transport *transport = (Transport *) TransportID1; CommSession *session = comm_session_open(transport, &s_tran...
((Uuid)UUID_SYSTEM)
; cl_assert_equal_p(comm_session_get_current_app_session(), NULL); comm_session_close(system_session, CommSessionCloseReason_UnderlyingDisconnection); comm_session_close(legacy_app_session, CommSessionCloseReason_UnderlyingDisconnection); comm_session_close(modern_app_session, CommSessionCloseReason_Underlying...
lace stub #endif audio_endpoint_stop_transfer(s_session_id); PBL_LOG(LOG_LEVEL_INFO, "Stop recording audio"); prv_teardown_session(); } static void prv_cancel_recording(void) { #if !defined(TARGET_QEMU) // TODO: reenable // mic_stop(MIC); #endif audio_endpoint_cancel_transfer(s_session_id); PBL_LOG(LOG...
mutex_unlock(s_lock)
; } static VoiceStatus prv_get_status_from_result(VoiceEndpointResult result) { VoiceStatus status; switch (result) { case VoiceEndpointResultFailServiceUnavailable: status = VoiceStatusErrorConnectivity; break; case VoiceEndpointResultFailDisabled: status = VoiceStatusErrorDisabled; ...
/* * 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 ((pebble_task_get_handle_for_task(PebbleTask_KernelMain) == NULL) || mcu_state_is_isr() || portIN_CRITICAL() || (xTaskGetSchedulerState() != taskSCHEDULER_RUNNING)) { // phase 1 || in an ISR || in a critical section use_mutex = false; } else if (s_log_state_mutex == INVALID_MUTEX_HANDLE) { // p...
if (use_mutex) { // Logging operations shouldn't take long to complete. Use a timeout in case we run into // an unlikely deadlock situation (one task doing a synchronous log to flash and another task // trying to log from flash code) bool success = mutex_lock_recursive_with_timeout(s_log_state_mutex...
e "clar.h" #include "util.h" #include <string.h> #include <stdio.h> // Stubs //////////////////////////////////// #include "graphics_common_stubs.h" #include "stubs_applib_resource.h" #include "test_graphics.h" static GContext ctx; static FrameBuffer framebuffer; // Helpers //////////////////////////////////// sta...
("test_bitblt__8bit_assign.8bit.pbi")
; GRect bounds = gbitmap_get_bounds(src_bitmap); uint8_t dest_data[bounds.size.w * bounds.size.h]; GBitmap dest_bitmap = { .addr = dest_data, .row_size_bytes = bounds.size.w, .info.format = GBitmapFormat8Bit, .info.version = GBITMAP_VERSION_CURRENT, .bounds = src_bitmap->bounds }; uint8_...
\n", i, key, val); set_and_verify(&file, key, key_len, val, val_len); // delete the first iteration if (j < 255) { settings_file_delete(&file, key, key_len); } } printf("Making sure we handle running out of storage gracefully...\n"); memcpy(key, "k255", 5); memcpy(val, "v255", 5); cl_ass...
cl_assert_equal_m(original_value, val_out, val_len_out)
; free(val_out); return RecordResultOld; } else if (val_len_out == new_value_length) { printf("new! %d\n", new_value_length); cl_assert_equal_m(new_value, val_out, val_len_out); free(val_out); return RecordResultNew; } // Should not get here! This means that neither the o...
e for the specific language governing permissions and * limitations under the License. */ #include "BSCAPI.h" #include "clar.h" #include "bluetooth/bt_driver_comm.h" #include "services/common/comm_session/session.h" #include "services/common/comm_session/session_remote_version.h" #include "services/common/comm_sessi...
comm_session_init()
th) { i2c_use(dev->i2c_slave); bool rv = i2c_write_register_block(dev->i2c_slave, register_address, length, buffer); i2c_release(dev->i2c_slave); return rv; } static bool prv_read_register(HRMDevice *dev, uint8_t register_address, uint8_t *value) { i2c_use(dev->i2c_slave); bool rv = i2c_read_register(dev->...
{ data->hrm_quality = HRMQuality_Good; }
else if (hrm_data_regs.sqi <= AS7000SQIThreshold_Acceptable) { data->hrm_quality = HRMQuality_Acceptable; } else if (hrm_data_regs.sqi <= AS7000SQIThreshold_Poor) { data->hrm_quality = HRMQuality_Poor; } else if (hrm_data_regs.sqi <= AS7000SQIThreshold_Worst) { data->hrm_quality = HRMQuality_Worst; }...
OG_LEVEL_DEBUG, "Got link control status: Ok"); smartstrap_connection_state_set(true); } else if (status == LinkControlStatusBaudRate) { PBL_LOG(LOG_LEVEL_DEBUG, "Got link control status: Baud rate"); prv_do_send(LinkControlTypeBaud); } else if (status == LinkControlStatusDisconnect) { P...
(s_read_mbuf)
; s_read_mbuf = NULL; } const SmartstrapProfileInfo *smartstrap_link_control_get_info(void) { static const SmartstrapProfileInfo s_link_control_info = { .profile = SmartstrapProfileLinkControl, .read_complete = prv_read_complete, .control = prv_send_control, .read_aborted = prv_read_aborted, }; ...
65243370); stub_pebble_tasks_set_current(PebbleTask_App); app_manager_get_task_context()->to_process_event_queue = (void *)0x1; fake_system_task_callbacks_cleanup(); s_activity_prefs_heart_rate_is_enabled = true; s_event_count = 0; s_num_cb_events_1 = 0; s_num_cb_events_2 = 0; memset(&s_hrm_state, 0, ...
{ AppInstallId app_id = 1; const uint16_t expire_s = SECONDS_PER_MINUTE; HRMSessionRef session_ref = sys_hrm_manager_app_subscribe(app_id, 1, expire_s, HRMFeature_BPM); cl_assert(sys_hrm_manager_get_app_subscription(app_id) == session_ref); prv_fake_send_new_data(); // We should get the BPM event cl_a...
// Test that system subscriptions expire correctly void test_hrm_manager__kernel_expiration(void) { stub_pebble_tasks_set_current(PebbleTask_KernelBackground); const uint16_t expire_s = SECONDS_PER_MINUTE; HRMSessionRef session_ref = hrm_manager_subscribe_with_callback(INSTALL_ID_INVALID, 1, ...
ity > (MAX_PLOT_BRIGHTNESS / 2)) { // We're not plotting anything, bail return; } #endif // PBL_COLOR ctx->draw_state.draw_implementation->blend_vertical_line(ctx, x, y_min, y_max, color); } void graphics_private_plot_horizontal_line(GContext *ctx, int16_t y, Fixed_S16_3 x1, Fixed_S16_3 x2, ...
(y, clip_box->origin.y, grect_get_max_y(clip_box) - 1)
) { return; } const int16_t min_valid_x = clip_box->origin.x; const int16_t max_valid_x = grect_get_max_x(clip_box) - 1; // x1/x2 clipping and verification happens in raw drawing function to preserve gradients ctx->draw_state.draw_implementation->assign_horizontal_line_delta(ctx, y, x1, x2, ...
nt32_t)); info->get_val(file, (uint8_t *)&value, sizeof(uint32_t)); cl_assert(value == desired_value); return true; } static void prv_test_settings_file_compaction(const bool manual) { // If manual is enabled, then the test will force a compaction every so often // If manual is disabled, then the test will o...
settings_file_set(&file, key, key_len, val, val_len)
e at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific languag...
hash((uint8_t *)serial, full_len)
// We need to wait a bit for the rail to stabilize before continuing to use the device. // It takes 2.6ms for the LDO rails to ramp. psleep(3); return true; } return false; } } else { if (*ref_count <= 1) { // Set the register byte to XXXXX00X to disable the rail, ...
(PmicRegisters_CHIP_REV, chip_revision)
/* * 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...
(rotation)
rflowModeFill, GTextAlignmentLeft, NULL); } static void prv_draw_rt_cell_round(GContext *ctx, const Layer *cell_layer, GBitmap *mark, const char *text, bool is_selected) { GRect rt_rect = cell_layer->bounds; const int16_t horizontal_padding = 10; const int16_t vertical_padding ...
(ctx, fcc_number_subtitle, fcc_number_subtitle_font, box, text_overflow_mode, GTextAlignmentCenter, NULL)
; } // Align the FCC mark icon to be drawn in the top right of the container box.size = fcc_mark_icon->bounds.size; grect_align(&box, &container_rect, GAlignTopRight, true /* clip */); prv_draw_mark_with_inversion(ctx, fcc_mark_icon, &box, cell_is_highlighted); } static void prv_draw_fcc_cell( GContext ...
addr; } void dcache_flush(const void *addr, size_t size) { s_flush_size = size; s_flush_addr = (uintptr_t)addr; } bool syscall_internal_check_return_address(void * ret_addr) { s_addr_result = UserSpaceBuffer_Unchecked; return cl_mock_type(bool); } void syscall_assert_userspace_buffer(const void* buf, size_t ...
{ cl_will_return(icache_is_enabled, false); cl_will_return(dcache_is_enabled, true); cl_will_return(icache_line_size, 1); cl_will_return(dcache_line_size, 1); s_invalidate_addr = s_flush_addr = 0xAA55; s_invalidate_size = s_flush_size = 0x55AA; cl_will_return(syscall_internal_check_return_address, true...
void test_cpu_cache__without_dcache(void) { cl_will_return(icache_is_enabled, true); cl_will_return(dcache_is_enabled, false); cl_will_return(icache_line_size, 1); cl_will_return(dcache_line_size, 1); s_invalidate_addr = s_flush_addr = 0xAA55; s_invalidate_size = s_flush_size = 0x55AA; cl_will_return...
st_bitmap, src_bitmap, GPointZero, GCompOpAnd, GColorWhite); cl_assert(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__8bit_assign-expect.8bit.pbi")); memset(dest_data, GColorGreen.argb, sizeof(dest_data)); bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, GPointZero, GCompOpClear, GColorWhite); cl_assert(gbitmap...
memset(dest_data, GColorWhite.argb, sizeof(dest_data))
; GBitmap dest_bitmap = { .addr = dest_data, .row_size_bytes = TOTAL_WIDTH, .info.format = GBitmapFormat8Bit, .info.version = GBITMAP_VERSION_CURRENT, .bounds = (GRect){GPointZero, (GSize){TOTAL_WIDTH, TOTAL_HEIGHT}} }; GColor color = (GColor){ .a = 3, .r = 0, .g = 0, .b = 0 }; uint8_t src...
r 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 "drivers/debounced_button.h" #include "board/board.h" #include "drivers/bu...
{ // Create bitmask with all 1s, except on the counter byte for this button_id in button_counter_register. AND to mask out: const uint32_t updated_button_counter_register = button_counter_register & ~(0xff << (button_id << 3)); if (button_counter_register != updated_button_counter_register) { RTC_Writ...
__enable_irq(); } void debounced_button_init(void) { button_init(); #if defined(BOARD_SNOWY_BB2) || defined(BOARD_SPALDING_BB2) // Snowy BB2s have a capacitor that results in a really slow rise time (~0.4ms). Sleep for // at least 1 ms to prevent fake button events psleep(2); #endif for (int i = 0; i <...
ssion: for (int i = 0; i < PPOGATT_TIMEOUT_TICKS; ++i) { regular_timer_fire_seconds(PPOGATT_TIMEOUT_TICK_INTERVAL_SECS); } // Simulate receiving an ack for the last, after the roll-back, but before the packets are // retransmitted (the last part shouldn't matter much, but simplifies the test a bit) prv_r...
{ test_ppogatt__open_session_when_found_pebble_app(); Transport *transport = ppogatt_client_for_uuid(&s_meta_v0_system.app_uuid); // Get a packet in flight: uint8_t sn = 0; cl_assert_equal_b(fake_comm_session_send_buffer_write_raw_by_transport(transport, ...
//! When client ID info got added to the Reset Packet (PBL-14099), a potential buffer overrun //! situation got introduced accidentally. This test is a white-box test to catch this issue. //! For the Reset Packet, a buffer needs to be allocated. The size of this buffer is based upon //! the MTU of the connection. It'...
clude "kernel/events.h" #include "kernel/util/delay.h" #include "os/tick.h" #include "services/common/touch/touch.h" #include "system/logging.h" #include "system/passert.h" #include "util/attributes.h" #include "util/net.h" #include <stdint.h> // general constants for the controller #define INIT_TIMEOUT_S (1) // def...
((uint8_t *)&request, sizeof(request))
; prv_wait_for_interrupt(); StatusRegisterResponse response = { }; prv_read_data((uint8_t *)&response, sizeof(response)); PBL_ASSERTN(response.packet_id == PACKET_ID_STATUS_RESPONSE); // TODO: remove this assert and footer ones below once we're sure the controller FW is stable PBL_ASSERTN(response.padding ...
graphics_context_set_fill_color(ctx, face->bob_center_color)
; graphics_fill_oval(ctx, bob_center_rect, GOvalScaleModeFitCircle); } static void prv_draw_non_local_clock(GContext *ctx, NonLocalClockFace *clock) { // TODO: The non-local clock text is currently baked into the background image. prv_draw_clock_face(ctx, &clock->face); } static void prv_update_proc(Layer *lay...
, 0, 0})); ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricSleepRestfulSeconds, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){0, 1 * SECONDS_PER_MINUTE, 0, 0, 0, 0, 0})); for (int i = 0; i < ACTIVITY_HISTORY_DAYS; i++) { if (i == 0) { exp_resting_kcalories[i] = 1; } else if (i == 1) { exp_resting_kc...
cl_assert_equal_i(value, ROUND(exp_resting_calories, ACTIVITY_CALORIES_PER_KCAL))
; // Test that ActivityMetricStepMinutes responds correctly prv_feed_cannned_accel_data(1 * SECONDS_PER_MINUTE, 100, ActivitySleepStateAwake); prv_feed_cannned_accel_data(1 * SECONDS_PER_MINUTE, 10, ActivitySleepStateAwake); prv_feed_cannned_accel_data(1 * SECONDS_PER_MINUTE, 100, ActivitySleepStateAwake); ...
if (status_bar_layer->title_timer_id != TIMER_INVALID_ID) { app_timer_cancel(status_bar_layer->title_timer_id); }
event_service_client_unsubscribe(&(status_bar_layer->tick_event)); } Layer *status_bar_layer_get_layer(StatusBarLayer *status_bar_layer) { PBL_ASSERTN(status_bar_layer); return &status_bar_layer->layer; } void status_bar_layer_set_colors(StatusBarLayer *status_bar_layer, GColor background, ...
/* * 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...
uuid_to_string(uuid, uuid_string)
; ANALYTICS_LOG_DEBUG("app launch event: uuid %s", uuid_string); #endif analytics_logging_log_event(&event_blob); } // ------------------------------------------------------------------------------------------ // Log a pin open/create/update event. static void prv_simple_pin_event(time_t timestamp, const Uuid *p...
AppData *app_data = data; TextLayer *status = &app_data->status; text_layer_set_text(status, status_text[app_data->test_state]); } static void prv_bt_event_handler(PebbleEvent *e, void* data) { AppData *app_data = (AppData*)data; switch (app_data->test_state) { case BtTestStateStarting: { PBL_ASSE...
bt_ctl_set_override_mode(BtCtlModeOverrideRun)
; bt_ctl_reset_bluetooth(); } static void handle_deinit() { AppData *data = app_state_get_user_data(); bt_ctl_set_override_mode(BtCtlModeOverrideNone); event_service_client_unsubscribe(&bt_state_change_event_info); task_free(data); } static void s_main(void) { handle_init(); app_event_loop(); handle...
be the integer start/end of the line, so we need to adjust them so we see // the same blending on the first and last pixel y2--; const Fixed_S16_3 y1_fixed = (Fixed_S16_3) { .integer = y1, .fraction = 4, }; const Fixed_S16_3 y2_fixed = (Fixed_S16_3) { .integer = y2, .fraction = 4, }; prv_...
{ // FIXME PBL-34552: This test produces an incorrect image, see JIRA const Fixed_S16_3 x1_fixed = (Fixed_S16_3) { .integer = x1 }; Fixed_S16_3 x2_fixed = (Fixed_S16_3) { .integer = x2 }; const uint8_t gradient_width = (uint8_t)((x2 - x1) / 2); x2_fixed.integer -= gradient_width; const int16_t clip_box_min...
void test_graphics_context_mask__apply_assign_horizontal_line_delta_raw(void) { prv_mask_apply_hline_test_pattern(prv_hline_pattern_apply_assign_horizontal_line_delta_raw); CHECK_EXPECTED_TEST_IMAGE(s_ctx); }; ////////////////////////////////// // APPLYING VERTICAL LINE TESTS // /////////////////////////////////...
NT, }, [ANCSCharacteristicData] = { [0] = ANALYTICS_DEVICE_METRIC_NOTIFICATION_ANCS_DS_SUBSCRIBE_COUNT, [1] = ANALYTICS_DEVICE_METRIC_NOTIFICATION_ANCS_DS_SUBSCRIBE_FAIL_COUNT, } }; const bool no_error = (error == BLEGATTErrorSuccess); AnalyticsMetric metric = metric_matrix[characteristic...
if (nsnotification->category_id == CategoryIDIncomingCall) { properties |= ANCSProperty_IncomingCall; } else if (nsnotification->category_id == CategoryIDVoicemail) { properties |= ANCSProperty_VoiceMail; }
gs); common->is_unprivileged = true; // We don't know the load address of the process until the process is // actually loaded, so we can't convert the entry point's offset into // an address until it's actually been loaded into that address. // Just shove the unmodified offset into the struct and let the //...
if (version_compare(app_sdk_version, first_3x_version) < 0) { // 2.x SDKs didn't support anything but Aplite return PlatformTypeAplite; }
// 3.0 <= SDK < 4.0 if (version_compare(app_sdk_version, first_4x_version) < 0) { return PBL_PLATFORM_SWITCH(PBL_PLATFORM_TYPE_CURRENT, /* aplite */ PlatformTypeAplite, // unreachable, since we don't build for Tintin anymore /* basalt */ PlatformTypeBasalt, /* chalk */ PlatformTy...
/* * 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...
(&char_iter)
); } void test_char_iterator__decode_test_string_with_formatting_char(void) { Iterator char_iter; CharIterState char_iter_state; Utf8IterState* utf8_iter_state = (Utf8IterState*) &char_iter_state.utf8_iter_state; // Skip over codepoints that aren't newline and < 0x20 bool success = false; const Utf8Bounds...
D, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "animation.h" #include "animation_interpolate.h" #include "animation_private.h" #include "applib/graphics/gtypes.h" #include "system/passert.h" #include "util/math.h" #in...
{ return to; }
else if (frame_idx < 0) { return from; } else if (frame_idx < num_frames_in) { return from + (frames_in ? (direction * frames_in[frame_idx]) : 0); } else if ((frame_idx < (num_frames_in + num_frames_mid)) && (num_frames_mid > 0)) { const int64_t shifted_normalized = normalized - (((int64_t) num...
/* * 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...
( error_response.session, SCREENSHOT_ENDPOINT_ID, (const uint8_t *) &error_response.header, sizeof(error_response.header), COMM_SESSION_DEFAULT_TIMEOUT)
ndow); TextLayer *text = &data->text; const GColor bg_color = text->background_color; if (gcolor_equal(bg_color, GColorBlack)) { text_layer_set_background_color(text, GColorWhite); text_layer_set_text_color(text, GColorBlack); } else { text_layer_set_background_color(text, GColorBlack); text_lay...
window_raw_click_subscribe(BUTTON_ID_DOWN, (ClickHandler) raw_down_click_handler, (ClickHandler) raw_up_click_handler, NULL)
; } static void prv_window_load(Window *window) { ClickAppData *data = window_get_user_data(window); TextLayer *text = &data->text; text_layer_init(text, &window->layer.bounds); text_layer_set_text(text, "Use select button and try different clicks: single, hold-to-repeat, multiple, long press, etc.\n\nNOTE: a ...
th_older_creation_time_than_existing_not_inserted(void) { // Insert the first glance blob SerializedAppGlanceHeader app_glance_1 = (SerializedAppGlanceHeader) { .version = APP_GLANCE_DB_CURRENT_VERSION, .creation_time = 1464734484, // Tue, 31 May 2016 22:41:24 GMT }; const size_t glance_1_size = sizeof(...
prv_insert_dummy_glance_blob_with_size(APP_GLANCE_DB_SLICE_MAX_SIZE + 1)
, E_INVALID_ARGUMENT); } void test_app_glance_db__check_invalid_slice_total_sizes_blob_not_inserted(void) { cl_assert_equal_i(app_glance_db_insert((uint8_t *)&APP_GLANCE_TEST_UUID, UUID_SIZE, (uint8_t *)&s_app_glance_with_invalid_slice_total_sizes, ...
_t rv = settings_file_open(&fd, BT_PERSISTENT_STORAGE_FILE_NAME, BT_PERSISTENT_STORAGE_FILE_SIZE); if (rv) { return; } settings_file_rewrite(&fd, prv_delete_all_pairings_itr, NULL); settings_file_close(&fd); } prv_unlock(); shared_prf_storage_erase_ble_...
(&id, val, sizeof(BTBondingID))
; prompt_send_response_fmt(display_buf, DISPLAY_BUF_LEN, "%s : %d", ACTIVE_GATEWAY_KEY, (int)id); } else if (memcmp(key, IS_UNFAITHFUL_KEY, info->key_len) == 0) { PBL_ASSERTN(info->val_len == sizeof(bool)); bool is_unfaithful; memcpy(&is_unfaithful, val, sizeof(bool)); pr...
l_data, &rec_event); NEW_RECOGNIZER(fail) = test_recognizer_create(&s_test_impl_data, NULL); recognizer_set_fail_after(r, fail); new_state = RecognizerState_Completed; recognizer_handle_touch_event(r, &(TouchEvent) { .type = TouchEvent_Touchdown }); cl_assert_equal_i(last_touch_event.type, TouchEvent_Liftoff...
(strcmp(recognizer->subscriber.data, names[s_list_idx++]) == 0, s)
; return (s_list_idx < *((int *)context)); } void test_recognizer__list_iterate(void) { NEW_RECOGNIZER(r1) = test_recognizer_create(&s_test_impl_data, "R1"); NEW_RECOGNIZER(r2) = test_recognizer_create(&s_test_impl_data, "R2"); NEW_RECOGNIZER(r3) = test_recognizer_create(&s_test_impl_data, "R3"); Recognize...
/* * 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_kernel_main_timer_id != TIMER_INVALID_ID) { new_timer_delete(s_kernel_main_timer_id); s_kernel_main_timer_id = TIMER_INVALID_ID; }
, -144, -992}, { -160, -152, -1000}, { -152, -152, -1000}, { -168, -160, -992}, { -176, -144, -992}, { -176, -144, -976}, { -176, -152, -1000}, { -144, -160, -1000}, { -176, -160, -992}, { -176, -152, -1000}, { -176, -144, -984}, { -168, -152, -992}, { -152, -152, -1000},...
{ -144, -176, -1016}, { -168, -152, -1008}, { -168, -168, -968}, { -176, -184, -992}, { -168, -184, -984}, { -168, -184, -976}, { -168, -176, -1008}, { -152, -144, -1008}, { -160, -144, -1016}, { -168, -184, -960}, { -176, -184, -960}, // 139 seconds { -168, -184, -97...
2)); #else ASSERT_CALLED(graphics_circle_draw_stroked_non_aa(&context, GPoint(50, 50), 10, 2)); #endif setup_test(&context, true, 2, GColorBlack, GColorBlack, false); graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4); #if PBL_COLOR ASSERT_CALLED(prv_draw_round_rect_aa_stroked(&context, &GRect(20, ...
(&context, &GRect(20, 80, 40, 10), 4, GCornersAll)
; ASSERT_CALLED(prv_fill_rect_non_aa(&context, &GRect(20, 80, 40, 10), 4, GCornersAll, GColorBlack)); } void test_graphics_context_${BIT_DEPTH_NAME}__fill_antialiased(void) { // Fill shape, antialiased (Stroke width/color N/A) setup_test(&context, true, 5, GColorBlack, GColorBlack, false); graphics_fill_rect(...
ach GDB to ble chip and type `p/x ALL_REGISTERS` // 5. Copy, reformat, and paste output to the squashed register values. #define DEFAULT_REGISTER_DEBUG 0 #if DEFAULT_REGISTER_DEBUG typedef struct AllRegisters { // DCDC uint16_t DCDC_CTRL_0_REG; uint16_t DCDC_CTRL_1_REG; uint16_t DCDC_CTRL_2_REG; uint16_t ...
REG_SETF(DCDC, DCDC_CTRL_1_REG, DCDC_STARTUP_DELAY, 0xA)
; REG_SETF(DCDC, DCDC_CTRL_1_REG, DCDC_GLOBAL_MAX_IDLE_TIME, 0x20); REG_SETF(DCDC, DCDC_CTRL_1_REG, DCDC_TIMEOUT, 0x10); REG_SETF(DCDC, DCDC_CTRL_2_REG, DCDC_TIMEOUT_IRQ_TRIG, 0x8); REG_SETF(DCDC, DCDC_CTRL_2_REG, DCDC_TIMEOUT_IRQ_RES, 0x8); REG_SETF(DCDC, DCDC_CTRL_2_REG, DCDC_TUNE, 0x0); REG_SETF(DCDC, D...
util/attributes.h" typedef struct LauncherAppWindowData { Window window; LauncherMenuLayer launcher_menu_layer; AppMenuDataSource app_menu_data_source; } LauncherAppWindowData; typedef struct LauncherAppPersistedData { bool valid; RtcTicks leave_time; LauncherMenuLayerSelectionState selection_state; Lau...
(&data->launcher_menu_layer, &s_launcher_app_persisted_data.selection_state)
; app_focus_service_unsubscribe(); launcher_menu_layer_deinit(&data->launcher_menu_layer); app_menu_data_source_deinit(&data->app_menu_data_source); } //////////////////// // App boilerplate static void prv_launcher_menu_window_push(void) { LauncherAppWindowData *data = app_zalloc_check(sizeof(*data)); app...
app_window_stack_push(window, animated)
; } static void prv_handle_deinit() { DialogsData *data = app_state_get_user_data(); menu_layer_deinit(&data->menu_layer); i18n_free_all(data); app_free(data); } //////////////////// // App boilerplate static void s_main(void) { prv_handle_init(); app_event_loop(); prv_handle_deinit(); } const PebbleP...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&s_low_power_data->low_power_window, GColorLightGray)
/* * 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...
(line_buffer, LINE_BUFFER_LENGTH, "%04x ", offset)
SettingsRecordInfo *info, void *context) { // check entry is valid if (info->val_len == 0 || info->key_len != sizeof(BTBondingID)) { return true; // continue iterating } ForEachBTCPairingData *itr_data = (ForEachBTCPairingData*) context; BTBondingID key; BtPersistBondingData stored_data; inf...
prv_file_get(&DEVICE_NAME_KEY, sizeof(DEVICE_NAME_KEY), local_device_name_out, max_size)
; if (!read_size) { return false; } return true; } void bt_persistent_storage_set_local_device_name(char *local_device_name, size_t size) { if (!local_device_name) { return; } shared_prf_storage_set_local_device_name(local_device_name); prv_file_set(&DEVICE_NAME_KEY, sizeof(DEVICE_NAME_KEY), ...
ExpandableDialog dialog; AlarmsAppData *data; } FirstUseDialog; static void prv_alarms_app_opened_click_handler(ClickRecognizerRef recognizer, void *context) { ExpandableDialog *expandable_dialog = context; expandable_dialog_pop(expandable_dialog); } static void prv_push_alarms_app_opened_dialog(AlarmsAppData *...
(prv_handle_alarm_editor_complete, data)
; app_window_stack_push(editor, true); app_window_stack_insert_next(&data->window); } #if CAPABILITY_HAS_HEALTH_TRACKING uint32_t version = alarm_prefs_get_alarms_app_opened(); if (version == 0) { prv_push_alarms_app_opened_dialog(data); } alarm_prefs_set_alarms_app_opened(CURRENT_ALARMS_APP_VERS...
uint8_t data, const UARTRXErrorFlags *err_flags); static bool prv_tx_irq_handler(UARTDevice *dev); static void prv_lock(void) { if (mcu_state_is_isr()) { // assume we're in an ISR for the UART and don't need to worry about being blocked return; } mutex_lock_recursive(s_blocked_lock); } static void prv...
(ACCESSORY_UART, true)
/* * 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...
connection_by_address(&hdr->addr)
; if (!conn) { rv = BTErrnoInvalidParameter; goto respond; } const uint16_t conn_idx = connection_get_idx(conn); if (ppogatt_emulated_server_handle_msg(conn_idx, conn, msg)) { return; } const GattReqSource req_source = GattReqSourceHost; switch (msg->command_id) { case HcMessageID_Gatt_...
y_layer_implementation = { .base = { .update = property_animation_update_mark_dirty, }, }; PropertyAnimation *property_animation_create_mark_dirty(struct Layer *layer) { // no legacy2 support as this was never exposed on 2.x PropertyAnimation *result = property_animation_create(&s_dirty_layer_imple...
(property_animation_h)
; if (!property_animation) { return false; } if (size > MEMBER_SIZE(PropertyAnimationPrivate, values.to)) { APP_LOG(APP_LOG_LEVEL_WARNING, "invalid size"); return false; } if (set) { memcpy(&property_animation->values.to, value, size); } else { memcpy(value, &property_animation->values....
/* * 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...
(!pstring_equal(ps1, ps2))
; cl_assert(!pstring_equal(ps1, ps3)); cl_assert(!pstring_equal(ps2, ps3)); cl_assert(!pstring_equal(ps1, NULL)); cl_assert(!pstring_equal(NULL, NULL)); } void test_pstring__equal_cstring(void) { const char *str1 = "Phil"; uint8_t ps1_buf[128]; PascalString16 *ps1 = (PascalString16 *)&ps1_buf; ps1->str...
AnalyticsClient_System); analytics_set(ANALYTICS_DEVICE_METRIC_STACK_FREE_NEWTIMERS, prv_task_get_stack_free(PebbleTask_NewTimers), AnalyticsClient_System); } QueueHandle_t pebble_task_get_to_queue(PebbleTask task) { QueueHandle_t queue; switch (task) { case PebbleTask_KernelMain: queue = event_g...
memory_layout_get_app_region()
, false /* allow_user_access */); mpu_init_region_from_region(&worker_region, memory_layout_get_worker_region(), false /* allow_user_access */); const MpuRegion *region_ptrs[portNUM_CONFIGURABLE_REGIONS] = { &app_region, &worker_region, NULL, ...
{ 136, 1928, 216}, { -184, 1384, -40}, { -344, 800, -152}, { -632, 232, -144}, { -656, -48, -168}, { -480, -208, -24}, { -392, 488, 96}, { -376, 3304, 712}, { 376, 2488, 920}, { 368, 1536, 424}, { 416, 824, 176}, { 424, 216, 64}, { 512, -208, 72}, { 584, -488, 296},...
{ -328, 824, 72}, { -352, 208, 24}, { -352, 136, -304}, { -192, -24, -176}, { -232, 240, 48}, // 24 seconds { -448, 1920, 432}, { -112, 2624, 1032}, { 296, 1896, 608}, { 376, 1224, 224}, { 336, 600, 32}, { 440, -112, 40}, { 552, -216, -16}, { 416, -264, 248}, ...
{ 480, -288, 384}, { 952, 680, 616}, { 480, 2736, 776}, { 544, 2504, 256}, { 48, 1752, 72}, { -208, 1344, -80}, { -432, 576, 0}, { -648, 120, -112}, { -448, 0, -216}, { -320, -120, -80}, { -272, 552, 96}, { -672, 3096, 616}, { 64, 2696, 704}, // 27 seconds { ...
low_power); cl_assert_equal_i(s_power_state, PowerStateGood); // good -> critical fake_battery_set_millivolts(critical_mv); fake_battery_set_charging(false); fake_battery_set_connected(false); periodic_timer_trigger(20); cl_assert(battery_monitor_critical_lockout()); cl_assert_equal_i(s_power_state, Po...
(20, false)
; fake_battery_init(start_mv, false, false); // Start off with a nice battery level battery_monitor_init(); periodic_timer_trigger(1); cl_assert_equal_i(battery_get_charge_state().charge_percent, 50); // Pretend vibe activated or something like that. // - The reported mV goes down and stop mode is disa...
rt) { original_idx = s_next_region_idx; s_next_region_idx = TOTAL_NUM_FLASH_REGIONS; } else { s_next_region_idx = original_idx; } s_ftl_size = 0; for (unsigned int i = 0; i < s_next_region_idx; i++) { s_ftl_size += prv_region_size(i); } PBL_LOG(LOG_LEVEL_DEBUG, "Filesystem: Temporary size...
(size == SUBSECTOR_SIZE_BYTES)
; flash_erase_subsector_blocking( s_region_list[idx].start + offset - curr_virt_offset_begin); } else if (operation == FTLEraseSector) { PBL_ASSERTN(size == SECTOR_SIZE_BYTES); flash_erase_sector_blocking( s_region_list[idx].start + offset - curr_virt_offset_begin);...
id graphics_context_init(GContext *context, FrameBuffer *framebuffer, GContextInitializationMode init_mode) { PBL_ASSERTN(context); PBL_ASSERTN(framebuffer); *context = (GContext) { // For apps, this is run before the app has a chance to run, so there's no concern here of the /...
(ctx->draw_state.antialiased, false)
f struct WorkoutActiveWindow { Window window; ActionBarLayer action_bar; StatusBarLayer status_layer; Layer base_layer; Layer top_metric_layer; Layer middle_metric_layer; Layer scrollable_metric_layer; WorkoutDialog end_workout_dialog; ButtonId pause_button; WorkoutController *workout_controller; ...
("SPEED (KM/H)")
); #endif case WorkoutMetricType_Distance: #if PBL_RECT /// Distance Label return i18n_noop("DISTANCE"); #else /// Distance Label with units return active_window->workout_controller->get_distance_string(i18n_noop("DISTANCE (MI)"), ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(S_SUCCESS, app_cache_add_entry(app1.id, app1.size))
; cl_assert_equal_i(S_SUCCESS, app_cache_add_entry(app2.id, app2.size)); cl_assert_equal_i(S_SUCCESS, app_cache_add_entry(app3.id, app3.size)); // remove 2 cl_assert_equal_i(S_SUCCESS, app_cache_remove_entry(app1.id)); PebbleEvent e = fake_event_get_last(); cl_assert_equal_i(e.type, PEBBLE_APP_CACHE_EVENT)...
y_time(layout_ref)) { clock_get_friendly_date(buffer, config->buffer_size, layout->info->timestamp); } } static GTextNode *prv_card_view_constructor(TimelineLayout *timeline_layout) { static const LayoutNodeTextDynamicConfig s_title_config = { .text.extent.node.type = LayoutNodeType_TextDynamic, .updat...
IF_ICON_AT_TOP_ELSE(&s_title_config.text.extent.node, &s_subtitle_config.text.extent.node)
, IF_ICON_AT_TOP_ELSE(&s_subtitle_config.text.extent.node, &s_icon_config.node), &s_glance_location_config.text.extent.node, &s_page_break_config, &s_location_config.text.extent.node, &s_body_header_config.text.extent.node, &s_body_config.text.extent.node, }; static const LayoutNodeVerticalC...
/* * 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...
is_app_file_name("@abcdef01/abc")
== true); } void test_app_file__is_app_file_name_negative(void) { cl_assert(is_app_file_name("@feedface/abc") == true); } void test_app_file__is_app_file_name_obviously_false(void) { cl_assert(is_app_file_name("appdb") == false); } void test_app_file__is_app_file_name_tricky_false_1(void) { cl_assert(is_app_f...
d layout_id, AttributeList *pin_attr_list, HealthCardType health_card_type, int num_responses, ResponseItem *response_items) { AttributeList open_attr_list = {0}; prv_set_open_app_action(&open_attr_list, health_card_type, pin_attr_list); AttributeList remove_attr_list = {0}; attribute_list_add_cstring(...
(&pin_attr_list, AttributeIdShortTitle, i18n_get(config->short_title, &pin_attr_list))
; attribute_list_add_cstring(&pin_attr_list, AttributeIdShortSubtitle, config->short_subtitle); static struct { const char *avg_relation; uint8_t bg_color; TimelineResourceId card_icon; } s_tier_config[PercentTierCount] = { [PercentTier_Fail] = { .avg_relation = PBL_IF_RECT_ELSE(i18n_noop("...
ID_ARGUMENT); fd = pfs_open("newfile2", OP_FLAG_WRITE, FILE_TYPE_STATIC, 8000); cl_assert(fd >= 0); cl_assert(pfs_close(fd) == S_SUCCESS); } void test_pfs__page_lookup_cache(void) { // create fragmentation in the filesystem char file_small[10]; char buf_small[50]; for (int i = 0; i < num_pages(); i++) ...
(pfs_close(tmp_fd), S_SUCCESS)
; uint8_t new_buf[strlen(overwrite_string)]; fd = pfs_open(file, OP_FLAG_READ, 0, 0); cl_assert(fd >= 0); rv = pfs_read(fd, &new_buf[0], strlen(overwrite_string)); cl_assert_equal_i(rv, strlen(overwrite_string)); cl_assert(memcmp(overwrite_string, new_buf, strlen(overwrite_string)) == 0); pfs_close(fd); ...
(5 * MS_PER_SECOND) typedef struct { uint8_t command_id; union { Buffer buffer; // `Buffer` has a variable sized uint8_t at the end of the struct. `buffer_storage` adds // the required backing storage space right after it: uint8_t buffer_storage[sizeof(Buffer) + NOTIFICATION_ATTRIBUTES_MAX_BUFFER_L...
while (head) { cur = head; list_remove(cur, &head, NULL); kernel_free(cur); }
s_ancs_client->queue = NULL; } static void prv_notif_queue_push_common(NotificationQueueNode *node) { if (prv_notif_queue_find(node)) { // already in the queue PBL_LOG(LOG_LEVEL_WARNING, "ANCS item already in Queue"); kernel_free(node); return; } if (s_ancs_client->state == ANCSClientStateIdl...
/ Factor in the play count of this animation now if (animation->play_count == ANIMATION_PLAY_COUNT_INFINITE_STORED) { duration = PLAY_DURATION_INFINITE; } else { duration *= animation->play_count; } } return duration; } // ------------------------------------------------------------------...
(state, animation)
); } // ------------------------------------------------------------------------------------------- // Determine if any of an animation's descendents are scheduled static bool prv_animation_children_scheduled(AnimationState *state, AnimationPrivate *animation) { if (animation->type != AnimationTypePrimitive) { ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(data, 0, sizeof(KinoLayerDemoData))
; app_state_set_user_data(data); Window *window = &data->window; window_init(window, WINDOW_NAME("Kino Layer")); window_set_user_data(window, data); window_set_window_handlers(window, &(WindowHandlers) { .load = prv_window_load, .appear = prv_window_appear, }); window_set_click_config_provider_...
in the sessions list static void prv_assert_sleep_activity_present(ActivitySession *exp_session, char *file, int line) { ActivitySession sessions[ACTIVITY_MAX_ACTIVITY_SESSIONS_COUNT]; uint32_t num_sessions = ACTIVITY_MAX_ACTIVITY_SESSIONS_COUNT; activity_get_sessions(&num_sessions, sessions); for (int i = 0; i...
if (s_test_alg_state.minute_data.sleep_current_container_idx >= 0) { cl_assert(prior_state != ActivitySleepStateAwake); ActivitySession *session = &s_test_alg_state.minute_data.sessions [s_test_alg_state.minute_data.sleep_current_container_idx]; session->length_mi...
!UNITTEST // apparently, GCC doesn't inline this otherwise // scary, I wonder how many more places like these aren't inlined ALWAYS_INLINE #endif GBitmapDataRowInfo prv_gbitmap_get_data_row_info(const GBitmap *bitmap, uint16_t y) { if (bitmap->info.format == GBitmapFormat8BitCircular) { const GBitmapDataRowInfoI...
PBL_ASSERTN(!process_manager_compiled_with_legacy2_sdk())
; GColor *palette = NULL; uint8_t palette_size = gbitmap_get_palette_size(format); if (palette_size > 0) { palette = applib_zalloc(palette_size * sizeof(GColor)); } return palette; } #define BITMAP_FORMAT_IS_CIRCULAR_FULL_SCREEN(size, format) \ ((format) == GBitmapFormat8BitCircular && (size).w == DISP...
ry); } activity_init(); activity_set_enabled(true); // Restart tracking if (tracking) { activity_start_tracking(test_mode); while (!s_activity_state.started) { sys_psleep(1); } } return true; } // ----------------------------------------------------------------------------------------...
(s_activity_state.mutex)
; { // set the current steps to new_steps s_activity_state.step_data.steps = new_steps; activity_algorithm_metrics_changed_notification(); // set all the step average values in the DB to 0 (except the first and last key) // The first key is set to the current_avg so that the current step average ...
de "services/common/light.h" #include "services/normal/app_cache.h" #include "services/normal/app_inbox_service.h" #include "services/normal/app_outbox_service.h" #include "shell/normal/app_idle_timeout.h" #include "shell/normal/watchface.h" #include "shell/shell.h" #include "shell/system_app_state_machine.h" #include ...
{ PBL_ASSERT_TASK(PebbleTask_App); }
#include "services/common/i18n/i18n.h" #include "services/normal/alarms/alarm.h" #include "services/normal/timeline/timeline.h" #include "shell/system_theme.h" #include "system/logging.h" #include "system/passert.h" #include "util/string.h" #include "util/time/time.h" #include "util/trig.h" #include <stdio.h> #includ...
prv_get_list_idx_of_alarm_id(data, select_alarm)
}; menu_layer_reload_data(&data->menu_layer); menu_layer_set_selected_index(&data->menu_layer, selected_menu_index, MenuRowAlignCenter, false); } static void prv_handle_alarm_editor_complete(AlarmEditorResult result, AlarmId id, voi...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
list_sorted_add((ListNode *)data->alarm_list_head, (ListNode *)new_node, prv_alarm_comparator, false)
; } static void prv_update_alarm_list(AlarmsAppData *data) { prv_clear_alarm_list(data); alarm_for_each(prv_add_alarm_to_list, data); data->can_schedule_alarm = alarm_can_schedule(); } static bool prv_are_alarms_scheduled(AlarmsAppData *data) { return (list_count((ListNode*) data->alarm_list_head) > 0); } ...
uniform //! with `app_db_get_app_entry_for_install_id` status_t app_db_get_app_entry_for_uuid(const Uuid *uuid, AppDBEntry *entry) { return app_db_read((uint8_t *)uuid, sizeof(Uuid), (uint8_t *)entry, sizeof(AppDBEntry)); } status_t app_db_get_app_entry_for_install_id(AppInstallId app_id, AppDBEntry *entry) { sta...
if (rv == S_SUCCESS) { // app install something app_install_do_callbacks(new_install ? APP_AVAILABLE : APP_UPGRADED, app_id, NULL, NULL, NULL); }
return rv; } int app_db_get_len(const uint8_t *key, int key_len) { status_t rv = prv_lock_mutex_and_open_file(); if (rv != S_SUCCESS) { return rv; } PBL_ASSERTN(key_len == 16); // should not increment !!!! AppInstallId app_id = prv_find_install_id_for_uuid(&s_app_db.settings_file, (Uuid *)key); ...
meline/attribute.h" #include "services/normal/timeline/notification_layout.h" #include "services/normal/timeline/swap_layer.h" #include "services/normal/timeline/timeline.h" #include "services/normal/timeline/timeline_actions.h" #include "services/normal/timeline/timeline_resources.h" #include "system/logging.h" #inclu...
{ prv_cleanup_timer(&data->pop_timer_id); prv_cancel_reminder_watchdog(data); prv_cleanup_timer(&data->peek_layer_timer); }
/* * 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...
(LLC_OUTMSG_INVALID_LLC_MESSAGE, type, (char*)packet + 1, length - 1)
; return; } } void pulse_llc_link_state_handler(PulseLinkState link_state) { } void pulse_llc_send_link_opened_msg(void) { typedef struct PACKED Response { uint8_t type; uint8_t pulse_version; uint16_t mtu; uint16_t mru; uint8_t timeout; } Response; Response *response = pulse_best_e...
, { -424, -224, -968}, { -432, -216, -968}, { -352, -312, -856}, { 72, -416, -864}, { -352, -424, -816}, { -232, -216, -960}, { -120, -328, -1176}, { -304, -376, -1136}, { -360, -128, -880}, { -224, -256, -1000}, { -336, -368, -888}, { -216, -328, -872}, { -264, -232,...
{ -168, 8, -1016}, { -240, 24, -1016}, { -248, 48, -1024}, { -240, 24, -1000}, { -312, 64, -1016}, { -264, 56, -1016}, { -240, 56, -1008}, { -248, 48, -1008}, { -240, 48, -1008}, { -232, 56, -1000}, { -248, 56, -1008}, { -248, 56, -1008}, { -264, 48, -1008}, { -24...
{ -256, 96, -1008}, { -224, 80, -1016}, { -128, 16, -1000}, { -224, 88, -1000}, // 199 seconds { -304, 88, -1008}, { -256, 96, -1000}, { -248, 96, -1024}, { -160, 48, -992}, { -168, 56, -1000}, { -184, 72, -1016}, { -224, 80, -1016}, { -192, -40, -984}, { -256, 1...
ion); } // -------------------------------------------------------------------------------------- // Test a run session of 30 minutes long that starts 10 minutes in that has a 2 minute // gap in the middle { memset(minute_raw_data, 0, k_minute_data_bytes); s_num_captured_activity_sessions = 0; t...
kalg_state_size()
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(sizeof(response->body), body_length)
; if (body_length) { memcpy(response->body, body, body_length); } pulse_best_effort_send(response, 2 + body_length); } void pulse_llc_unknown_protocol_handler(uint8_t protocol, void *packet, size_t length) { prv_bad_packet_response(LLC_OUTMSG_UNKNOWN_PROTOCOL_NUMBER...
t( const BleConnectionUpdateCompleteEvent *event) { } typedef struct PairingUserConfirmationCtx PairingUserConfirmationCtx; void bt_driver_cb_pairing_confirm_handle_request(const PairingUserConfirmationCtx *ctx, const char *device_name, ...
(id_1, &irk_out, &device_out, NULL /* name */)
; cl_assert(ret); cl_assert_equal_m(&irk_out, &pairing_1.irk, sizeof(irk_out)); cl_assert_equal_m(&device_out, &pairing_1.identity, sizeof(device_out)); // Re-pair device 1 again: // In case the device is the same as the existing pairing, make sure the operation is "change" // and not "delete" to avoid di...
488, 16}, { -656, 344, 72}, { -424, 416, -40}, { -440, 384, -24}, { -416, 272, 88}, { -464, 264, 104}, { -552, 272, 104}, { -648, 344, 80}, { -1016, 400, 56}, { -1064, 416, 40}, { -1304, 472, -80}, { -1296, 520, -72}, { -944, 568, -312}, { -960, 568, -328}, { -744...
{ -1032, 432, 136}, { -944, 536, -232}, // 34 seconds { -976, 616, -96}, { -712, 336, 8}, { -456, 352, -64}, { -424, 368, -56}, { -416, 304, 24}, { -488, 240, 104}, { -568, 280, 88}, { -744, 328, 72}, { -872, 288, 104}, { -1144, 384, 112}, { -1272, 512, -48}, ...
if ((smartstrap_fsm_state_get() != SmartstrapStateReadInProgress) && (smartstrap_fsm_state_get() != SmartstrapStateNotifyInProgress)) { return false; } bool should_context_switch = false; bool hdlc_err; bool should_store; bool is_complete = hdlc_streaming_decode(&s_read_info.hdlc_ctx, &data, &sho...
accessory_enable_input()
sert_value_length); cl_assert_equal_i(header.characteristic, characteristic); if (should_consume) { uint16_t value_length = assert_value_length; gatt_client_subscriptions_consume_notification(&characteristic_out, buffer, &value_length, GAPLEClien...
UuidMake(0xF7, 0x68, 0x09, 0x5B, 0x1B, 0xFA, 0x4F, 0x63, 0x97, 0xEE, 0xFD, 0xED, 0xAC, 0x66, 0xF9, 0xB0)
; BLEService service; uint8_t num_copied = gatt_client_copy_service_refs_matching_uuid(&s_device, &service, 1, &service_uuid); cl_assert_equal_i(num_copied, 1); // UUID for Characteristic that has no CCCD: Uuid characteristic_uuid = UuidMake(...
} else { return S_SUCCESS; } } status_t qspi_flash_erase_begin(QSPIFlash *dev, uint32_t addr, bool is_subsector) { uint8_t instruction; if (is_subsector) { instruction = dev->state->part->instructions.erase_sector_4k; } else { instruction = dev->state->part->instructions.erase_block_64k; } qs...
prv_read_mmap_with_params(dev, addr, buffer, length, instruction, dummy_cycles, is_ddr)
; } else { qspi_indirect_read(dev->qspi, instruction, addr, dummy_cycles, buffer, length, is_ddr); } qspi_release(dev->qspi); } int qspi_flash_write_page_begin(QSPIFlash *dev, const void *buffer, uint32_t addr, uint32_t length) { const uint32_t offset_in_page = addr % PAGE_S...
is file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITION...
{ return; }
const bool next_state = !ctx->enabled; ctx->config.impl->callbacks.set_state(next_state, ctx->config.context); ctx->enabled = next_state; if (ctx->config.set_exit_reason) { app_exit_reason_set(APP_EXIT_ACTION_PERFORMED_SUCCESSFULLY); } prv_vibe(next_state); } static void prv_handle_prompt_confirm(Clic...
; cl_assert_equal_b(false, app_install_id_from_app_db(-1)); cl_assert_equal_b(false, app_install_id_from_app_db(0)); cl_assert_equal_b(true, app_install_id_from_app_db(1)); cl_assert_equal_b(true, app_install_id_from_app_db(1000000)); } void test_app_install_manager__get_md(void) { const PebbleProcessMd *tic...
(0, INIT_TIME)
; cl_assert_equal_b(false, app_install_is_prioritized(music_id)); // Update most recent time. app_install_mark_prioritized(music_id, true /* can_expire */); cl_assert_equal_b(true, app_install_is_prioritized(music_id)); // Clear recent time. app_install_unmark_prioritized(music_id); cl_assert_equal_b(f...
static void prv_outbox_try_send_next(void); T_STATIC jerry_value_t prv_json_parse(const char *object); //////////////////////////////////////////////////////////////////////////////// // Comm Session Handling //////////////////////////////////////////////////////////////////////////////// T_STATIC void prv_handle_con...
{ *next_chunk = (PostMessageChunkPayload) { .total_size_bytes = bytes_remaining, .is_first = true, }; }
else { *next_chunk = (PostMessageChunkPayload) { .offset_bytes = obj->offset_bytes, .continuation_is_first = false, }; } // Copy the JSON fragment: memcpy(next_chunk->chunk_data, &obj->data_buffer[obj->offset_bytes], payload_size); // Move the cursor just like a dict_write_data() call woul...
LOG_LEVEL_DEBUG, "Read BMA255 whoami byte 0x%"PRIx8", expecting 0x%"PRIx8, chip_id, BMA255_CHIP_ID); return (chip_id == BMA255_CHIP_ID); } static uint64_t prv_get_curr_system_time_ms(void) { time_t time_s; uint16_t time_ms; rtc_get_time_ms(&time_s, &time_ms); return (((uint64_t)time_s) * 1000 + tim...
(&data[i])
; } // clear of fifo overrun flag must happen after draining samples, also the samples available will // get drained too! if ((fifo_status & 0x80) && !s_fifo_overrun_detected) { s_fifo_overrun_detected = true; // We don't clear the interrupt here because you are only supposed to touch the fifo config ...
void) { // settings has to be at the beginning. The app_menu_data_source module enforces it // This test will move the music app to the second position AppInstallId written_order[] = {APP_ID_SETTINGS, APP_ID_NOTIFICATIONS, APP_ID_ALARMS, APP_ID_WATCHFACES, APP_ID_WORKOUT, BG_COUN...
(storage_order, num_entries)
; app_menu_data_source_init(&data_source, &(AppMenuDataSourceCallbacks) { .changed = prv_menu_layer_reload_data, .filter = everything_filter_callback, }, &menu_layer); const uint16_t num_apps = app_menu_data_source_get_count(&data_source); for (uint16_t i = 0; i < num_apps; i++) { AppMenuNode *nod...
, }, }; mutex_lock(s_attr_list_lock); SmartstrapAttributeInternal *attr = prv_find_by_ids(service_id, attribute_id); mutex_unlock(s_attr_list_lock); if (!attr) { // this attribute has likely since been destroyed return; } event.smartstrap.attribute = mbuf_get_data(&attr->mbuf); if (type == S...
prv_find_by_buffer((uint8_t *)app_attr)
; if (!attr) { mutex_unlock(s_attr_list_lock); return; } prv_queue_deferred_delete(attr, true /* do_free */); mutex_unlock(s_attr_list_lock); } void smartstrap_attribute_unregister_all(void) { mutex_lock(s_attr_list_lock); SmartstrapAttributeInternal *attr; FOREACH_VALID_ATTR(attr) { // At th...