prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
kernel_le_client_deinit()
{ continue; }
// Write out a chunk header chunk_hdr.key = CORE_DUMP_CHUNK_KEY_MEMORY; chunk_hdr.size = region_buf[region].length + sizeof(CoreDumpMemoryHeader); if (flash_addr_max < (flash_addr + sizeof(chunk_hdr) + chunk_hdr.size)) { PBL_LOG(LOG_LEVEL_ERROR, "Insufficient space for BLE core dump -- RAM"); ...
touch/touch_client.h" #include "util/size.h" #include <stddef.h> #include <stdint.h> #include <stdbool.h> #include "fake_events.h" // Stubs #include "stubs_logging.h" #include "stubs_mutex.h" #include "stubs_passert.h" bool gpoint_equal(const GPoint * const point_a, const GPoint * const point_b) { return (point_a...
GPoint(1, 13)
, 5, 3686400); TouchEvent *touch_event = touch_event_queue_get_event(0, 0); prv_test_touch_event(touch_event, 0, TouchEvent_Touchdown, &GPoint(1, 13), 3686400, 5, &GPointZero, 0, 0, false); touch_handle_update(0, TouchState_FingerUp, NULL, 0, 3686410); touch_event = touch_event_queue_get_...
/* * 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_slice_expiration_timer_cb(service); return; }
const uint64_t time_until_slice_expires_ms = (uint64_t)time_until_slice_expires * MS_PER_SECOND; if (time_until_slice_expires_ms > UINT32_MAX) { // Slice expiration time is so far in the future that its offset in milliseconds from the // current time would overflow the argument to AppTimer, so just ignore...
e_name)) { // Don't include continue; } // Make sure the rest of the page header contents are valid. We are doing this after the // filename filter call because it requires more flash reads and is likely slower than the // filter call. if (read_header(pg, &pg_hdr, &file_hdr) != PageAndF...
get_avail_fd(name, &fd, is_tmp)
) == NoFDAvail) { res = E_OUT_OF_RESOURCES; goto cleanup; } else if (res == FDBusy) { res = E_BUSY; // the file is already open goto cleanup; } File *file = &PFS_FD(fd).file; // settings for cached & new fds file->op_flags = op_flags; file->offset = 0; // (re)set seek position file->is_t...
RNING, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_VERBOSE, LOG_LEVEL_DEBUG_VERBOSE, LOG_LEVEL_DEBUG_VERBOSE }; static const struct OVERRUN { HcProtocolMessage hc_header; BinLogMessage_Header_v1 header; uint8_t string[8]; } OVERRUN =...
(&s_log_buffer.circular_buffer, length, &data, &length)
; hw_uart_send(CONFIG_LOG_UART, data, length, prv_uart_tx_callback, NULL); } static void prv_log_to_buffer(uint8_t *buffer, uint16_t length) { prv_lock(); if (!circular_buffer_write(&s_log_buffer.circular_buffer, buffer, length)) { // Out of memory! Attempt to print an overrun message circular_buffer_wri...
troke to avoid division by zero GPointPrecise point; point.x.raw_value = (*p0).x.raw_value; point.y.raw_value = (*p0).y.raw_value; (*far_top) = point; (*far_bottom) = point; (*far_left) = point; (*far_right) = point; return false; } // Orthogonal vector for offset points GPointP...
prv_calc_far_points(&p0, &p1, radius, &far_top, &far_bottom, &far_left, &far_right)
; // To compensate for rounding errors we need to add half of the precision in specific places // - we add on top if line is leaning backward // - we add on bottom if line is leaning forward // - for lines with perfect horizontal or vertical lines this fix doesnt matter // same applies to same st...
8}, { -696, 368, -64}, { -888, 488, -32}, { -1104, 624, 152}, { -1488, 712, 80}, { -1776, 640, 168}, // 86 seconds { -1128, 416, -64}, { -1336, 592, -304}, { -1584, 592, -112}, { -1384, 496, 32}, { -1200, 1040, -128}, { -1112, 920, 80}, { -792, 912, -40}, { -576, ...
{ -1144, 424, -24}, { -1328, 512, 48}, { -1288, 712, 104}, { -1112, 360, -112}, { -1152, 656, -160}, { -1016, 616, -104}, { -1248, 600, 72}, { -1584, 480, 200}, { -1584, 280, 184}, { -1280, 160, 112}, { -1224, 168, 120}, { -1360, 152, 216}, { -1400, 72, 208}, { -1...
nt8_t complete; } FlashEraseResponse; typedef struct PACKED { uint32_t address; uint8_t data[]; } FlashWriteRequest; typedef struct PACKED { uint32_t address; uint32_t length; } FlashReadRequest; typedef struct PACKED { uint32_t address; uint32_t length; } FlashCRCRequest; typedef struct PACKED { uint...
{ if (!flash_sector_is_erased(sector * SECTOR_SIZE_BYTES + addr)) { return false; } }
return true; } static void prv_handle_ping_request(const void *payload, uint32_t length) { // echo it back prv_send_frame(OPCODE_PING, payload, length); } static void prv_handle_disconnect_request(const void *payload, uint32_t length) { if (length) { // should be 0 PBL_LOG(LOG_LEVEL_ERROR, "Invalid l...
ndrome // We'll rely on the ACK timeout for the next data packet to fire and roll back. PBL_LOG(LOG_LEVEL_WARNING, "Received retransmitted Ack for sn:%"PRIu32". Ignoring it.", sn); } else { PBL_LOG(LOG_LEVEL_ERROR, "Ack'd packet out of range %"PRIu32", [%u-%u].", sn, client->out.next_expected_...
(LOG_LEVEL_ERROR, "Found PPoGATT server from non-Pebble app, not connecting in PRF..")
; goto handle_error; } #endif // Use the highest version that both ends support: client->version = MIN(meta->ppogatt_max_version, PPOGATT_MAX_VERSION); // Parse additional v1 metadata fields: PPoGATTSessionType session_type = PPoGATTSessionType_InferredFromUuid; if (/*meta->ppogatt_max_version >= 0x01...
nt_loop_upkeep(); // The app is now obstructed by an opaque modal, it should be idle cl_assert_equal_b(s_app_idle, true); // Assert that the window pushed onto the app stack has lost focus // We do this by checking the last event, which should have been a focus // lost event. PebbleEvent event = fake_even...
cl_assert_equal_i(event.type, PEBBLE_APP_WILL_CHANGE_FOCUS_EVENT)
; cl_assert_equal_i(event.app_focus.in_focus, true); cl_assert_equal_i(window1->on_screen, true); window_stack_remove(window1, true); cl_assert_equal_i(window1->on_screen, false); cl_assert_equal_i(window_stack_count(app_stack), 0); window_destroy(window1); window_destroy(window2); } // Tests modal a...
liance 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, either ...
BT_DEVICE_ADDRESS_XPLODE(s_pinned_addr)
/* * 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...
ctx->config.impl->callbacks.get_state(ctx->config.context)
; } return ctx->enabled; } static void prv_call_set_state_callback(ActionToggleContext *ctx) { if (!ctx->config.impl->callbacks.set_state) { return; } const bool next_state = !ctx->enabled; ctx->config.impl->callbacks.set_state(next_state, ctx->config.context); ctx->enabled = next_state; if (ctx->c...
6, 576, 56}, { 288, 880, 80}, { 368, 1144, 112}, { 344, 1344, 216}, { 168, 1296, 320}, { 280, 1016, 320}, { 192, 1256, 200}, { 152, 1056, 416}, { 104, 1192, 344}, // 8 seconds { 40, 896, 296}, { 120, 704, 144}, { 224, 584, 80}, { 264, 576, 200}, { 248, 632, 200}, ...
{ 248, 944, 80}, { 280, 1192, 136}, { 72, 1288, 368}, { 144, 1280, 544}, { -128, 1504, 264}, { -8, 1168, 456}, { -112, 952, 352}, { -112, 848, 208}, { 56, 576, 160}, { 176, 568, 168}, { 168, 672, 184}, { 128, 736, 384}, { -64, 848, 160}, // 14 seconds { -96, 1...
{ 144, 672, 0}, { 112, 696, 160}, { 168, 1160, 312}, { 240, 1040, 232}, { 280, 1184, 352}, { 128, 1280, 488}, { 72, 1312, 680}, { -40, 1112, 384}, { 128, 904, 408}, { 152, 944, 216}, { 112, 728, 88}, { 232, 616, 304}, { 200, 776, 416}, { 128, 984, 464}, { 112...
/passert.h" #include "util/list.h" #include <stddef.h> static void prv_set_state(Recognizer *recognizer, RecognizerState new_state) { switch (recognizer->state) { case RecognizerState_Possible: PBL_ASSERTN((new_state == RecognizerState_Failed) || (new_state == RecognizerState_Possible) |...
{ PBL_ASSERTN(recognizer); PBL_ASSERTN(new_state < RecognizerStateCount); PBL_ASSERTN(new_state != RecognizerState_Possible); prv_set_state(recognizer, new_state); if (new_state != RecognizerState_Failed) { prv_send_subscriber_event(recognizer); } if (!recognizer->handling_touch_event) { recogniz...
//////////////////////////////////////////////////////////////////////////////////////////////////// // Private interface void recognizer_handle_touch_event(Recognizer *recognizer, const TouchEvent *touch_event) { PBL_ASSERTN(recognizer_is_active(recognizer)); PBL_ASSERTN(recognizer->impl); PBL_ASSERTN(touch_e...
; } //////////////////////////////////////////////////////////////////////////////////////////////////// // Consuming writes void test_app_inbox__multiple_writes_while_consuming(void) { prv_create_test_inbox_and_begin_write(); // Message 1: cl_assert_equal_b(true, app_inbox_service_write(AppInboxServiceTagUnit...
app_inbox_service_end(AppInboxServiceTagUnitTest)
); cl_assert_equal_i(1, app_inbox_destroy_and_deregister(s_inbox)); assert_num_callback_events(1); prv_process_callback_events(); assert_num_dropped_callbacks(0); assert_num_message_callbacks(0); } //////////////////////////////////////////////////////////////////////////////////////////////////// // app_...
is_being_written_for_tag(AppInboxServiceTagUnitTest)); } void test_app_inbox__app_inbox_service_begin_already_being_written(void) { prv_create_test_inbox(); cl_assert_equal_b(true, app_inbox_service_begin(AppInboxServiceTagUnitTest, BUFFER_SIZE, s_writer)); cl_as...
(0, app_inbox_service_num_failed_for_tag(AppInboxServiceTagUnitTest))
; prv_process_callback_events(); assert_message(0, s_test_data, BUFFER_SIZE); assert_num_message_callbacks(1); assert_num_dropped_callbacks(0); } //////////////////////////////////////////////////////////////////////////////////////////////////// // app_inbox_service_cancel void test_app_inbox__app_inbox_ser...
static const uint8_t FLASH_CMD_DUMMY = 0xA9; static const struct { SPI_TypeDef *const spi; GPIO_TypeDef *const spi_gpio; uint8_t scs_pin, sclk_pin, miso_pin, mosi_pin; } FLASH_CONFIG = { .spi = SPI1, .spi_gpio = GPIOA, .scs_pin = 4, .sclk_pin = 5, .miso_pin = 6, .mosi_pin = 7, }; static void prv_ena...
if (cycles_to_wait-- < 1) { break; }
status_register = prv_flash_read_next_byte(); } while (status_register & 0x1); prv_flash_end_cmd(); } static void prv_flash_wait_for_write(void) { prv_flash_start_cmd(); prv_flash_send_and_receive_byte(FLASH_CMD_READ_STATUS_REG); uint8_t status_register = 0; do { status_register = prv_flash_rea...
if (state->expire_utc && (utc_now >= state->expire_utc)) { // This subscription has expired expired_state = state; }
state = (HRMSubscriberState *)state->list_node.next; // If the prior subscription expired, remove it now if (expired_state) { PBL_LOG(LOG_LEVEL_DEBUG, "Subscription %"PRIu32" expired", expired_state->session_ref); prv_remove_and_free_subscription(expired_state); } } // Update the HRM ...
e_len); memcpy(resp + response_len, cmd, command_len); response_len += command_len; pulse_reliable_send(resp, response_len); } static void prv_respond_internal_error(Command *cmd, size_t length, status_t status_code) { InternalErrorResponse *resp = pulse_reliable_sen...
prv_get_fd(cmd, length)
; if (!pulse_fd) { // prv_get_fd has already sent an error response return; } status_t status = pulse_fd->impl->close_proc(pulse_fd->domain_state); if (FAILED(status)) { prv_respond_internal_error(cmd, length, status); return; } CloseResponse *resp = pulse_reliable_send_begin(PULSE2_BULKI...
LAY_WRITE_TIME, AnalyticsClient_App); analytics_inc(ANALYTICS_DEVICE_METRIC_DISPLAY_UPDATES_PER_HOUR, AnalyticsClient_System); prv_enable_display_spi_clock(); power_tracking_start(PowerSystemMcuDma1); SPI_I2S_DMACmd(BOARD_CONFIG_DISPLAY.spi, SPI_I2S_DMAReq_Tx, ENABLE); prv_display_context_init(&s_display_co...
prv_display_write_byte(0x00)
; // Disable display slave select prv_disable_chip_select(); prv_display_enter_static(); s_display_context.complete(); signed portBASE_TYPE was_higher_priority_task_woken = pdFALSE; xSemaphoreGiveFromISR(s_dma_update_in_progress_semaphore, &was_higher_priority_task_woken); ...
unt); } } iteration_count++; } PBL_LOG(LOG_LEVEL_DEBUG, "Ran %d iterations", iteration_count); PBL_LOG(LOG_LEVEL_DEBUG, ">PASS - STRESS TEST 1"); return FLASH_TEST_SUCCESS; } /***********************************************************/ /******************* Perf Data Test Functions ***********...
{ PBL_LOG(LOG_LEVEL_DEBUG, ">>>>>PASS FLASH TEST CASE %d<<<<<", test_case_num); }
else { PBL_LOG(LOG_LEVEL_DEBUG, ">>>>>FAIL FLASH TEST CASE %d, Status: %d<<<<<", test_case_num, status); } // Re-enable watchdog state if previously enabled if (previous_task_watchdog_state) { task_watchdog_bit_set(pebble_task_get_current()); task_watchdog_mask_set(pebble_task_get_current()); ...
/* * 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...
{ uint8_t message[] = { 0x0, 0x7, 'm', 'f', 'g', '_', 'x', 'x', 'x', }; uint8_t expected_response[] = { 0xff }; s_expected_response = expected_response; s_expected_response_length = sizeof(expected_response); factory_registry_protocol_msg_callback(NULL, message, sizeof(message)); cl_assert_equal_i(s_send...
GColor color) { // Extended sides AA calculations uint8_t left_aa_offset = (delta1.integer > 1) ? ((delta1.raw_value + (FIXED_S16_3_ONE.raw_value / 2)) / FIXED_S16_3_ONE.raw_value) : 1; uint8_t right_aa_offset = (delta2.integer > 1) ? ((delta2.raw_value + (FIXED_S...
graphics_capture_frame_buffer(ctx)
/* * 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_s(buffer, "")
; mfg_info_set_model("test_model"); mfg_info_get_model(buffer); cl_assert_equal_s(buffer, "test_model"); { char long_string[] = "01234567890123456789"; mfg_info_set_model(long_string); // We only expect to see the first 15 (MFG_INFO_MODEL_STRING_LENGTH - 1) characters mfg_info_get_...
/* * 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_start_ret_val = ret_value; }
.h = window->layer.bounds.size.h - scrollable_metric_bounds.origin.y; layer_init(&active_window->scrollable_metric_layer, &scrollable_metric_bounds); layer_set_update_proc(&active_window->scrollable_metric_layer, prv_scrollable_layer_update_proc); ...
{ if (metric == WorkoutMetricType_None) { PBL_LOG(LOG_LEVEL_ERROR, "Invalid argument"); return NULL; } WorkoutActiveWindow *active_window = app_zalloc_check(sizeof(WorkoutActiveWindow)); active_window->layout = WorkoutLayout_SingleMetric; active_window->top_metric = metric; prv_create_window_comm...
WorkoutActiveWindow *workout_active_create_double_layout(WorkoutMetricType top_metric, int num_scrollable_metrics, WorkoutMetricType *scrollable_metrics, ...
equal_i(prv_count_handler_entries(&s_setup_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, b), 0); cl_assert_equal_i(prv_last_update_distance(a), ANIMATION_NORMALIZED_MAX); #endif } // ---------------------------------------------------------------------------------...
cl_assert(seq != NULL)
E(3))); gbitmap_sequence_update_bitmap_next_frame(bitmap_sequence, bitmap, NULL); cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(4))); gbitmap_sequence_update_bitmap_next_frame(bitmap_sequence, bitmap, NULL); cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(5))); gbitmap_sequence_update_bitmap_next_frame(bit...
(bitmap_sequence, bitmap, 12345 * 1000)
; cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(5))); #endif } // Tests APNG file with 8-bit color, 5 frames and loop = 1 // Tests gbitmap_sequence_update_bitmap_by_elapsed with 0 delay frames for 1, 4 and 5 // and 2 & 3 have delay 1000ms // Result: // - gbitmaps matches platform decoded APNG void test_gbitmap_sequ...
ModalProperty_Exists | ModalProperty_CompositorTransitions | ModalProperty_RenderRequested); cl_assert_equal_i(windows[3][1]->on_screen, true); cl_assert_equal_i(windows[3][1]->is_click_configured, false); cl_assert_equal_i(windows[2][1]->on_screen, false); cl_assert_equal_i(windows[2][1]->...
{ Window *window1 = window_create(); Window *window2 = window_create(); WindowStack *app_stack = app_state_get_window_stack(); WindowStack *modal_stack = modal_manager_get_window_stack(ModalPriorityGeneric); cl_check(app_stack); cl_check(modal_stack); cl_check(!app_stack->list_head); cl_check(!modal_...
cl_assert_equal_i(window_stack_count(app_stack), 1); // Pop the modal window off the stack window_stack_remove(window2, true); cl_assert_equal_i(window_stack_count(modal_stack), 0); cl_assert_equal_i(window2->on_screen, false); // Switch to app happens via the compositor compositor_transition(NULL); ...
= 11; s_current_minute = 0; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 0); // Delete the 11:30 alarm alarm_delete(id2); // The 11:30 alarm should not go off either s_current_hour = 12; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 0); } void test_alarm__alarm_type_c...
alarm_create(&(AlarmInfo) { .hour = 10, .minute = 10, .kind = ALARM_KIND_JUST_ONCE })
; prv_assert_alarm_config(id1, 10, 10, false, ALARM_KIND_JUST_ONCE, just_once_schedule_thursday); id2 = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 20, .kind = ALARM_KIND_JUST_ONCE }); prv_assert_alarm_config(id2, 10, 20, false, ALARM_KIND_JUST_ONCE, just_once_schedule_thursday); // Skip ahead of both a...
ons under the License. */ #include <stddef.h> #include <stdio.h> #include <string.h> #include "drivers/crc.h" #include "drivers/flash.h" #include "flash_region.h" #include "git_version.auto.h" #include "system/firmware_storage.h" #include "system/passert.h" #include "version.h" //! The linker inserts the build id a...
{ size_t build_id_bytes_left; const uint8_t *build_id = version_get_build_id(&build_id_bytes_left); while (buffer_bytes_left >= 3 /* 2 hex digits, plus zero terminator */ && build_id_bytes_left > 0) { snprintf(buffer, buffer_bytes_left, "%02x", *build_id); buffer += 2; buffer_bytes_left -= 2...
static void version_fw_version_to_major_minor(unsigned int *major, unsigned int *minor, char *version_str) { // read in the two X's (vX.X) sscanf(version_str, "v%u.%u", major, minor); } //! Compares its two arguments for order. Returns a negative integer, zero, or a positive integer //! if the first argument i...
}, .allocated_buffer = NULL, }, { .header = { .id = {0x02}, .parent_id = {0}, .timestamp = 1421107200, // Tue Jan 13 midnight 2015 UTC .duration = MINUTES_PER_DAY, .type = TimelineItemTypePin, .all_day = 1, .layout = LayoutIdTest, }, .attr_...
(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}; TimelineNode *head = NULL; // Note: 1421178000 = Tue Jan 13 11:40:00 PST 2015 // check first timeline_init(&head); cl_assert_equal...
buffer_size - max_data; } const uint16_t remaining_length = buffer->buffer_size - buffer->write_index; if (remaining_length < length) { // Need to write the message in two chunks around the end of the buffer. Write the first chunk memcpy(&buffer->buffer[buffer->write_index], data, remaining_length); ...
shared_circular_buffer_remove_client(buffer, &client->buffer_client)
; } // ------------------------------------------------------------------------------------------------- void subsampled_shared_circular_buffer_client_set_ratio( SubsampledSharedCircularBufferClient *client, uint16_t numerator, uint16_t denominator) { PBL_ASSERTN(numerator > 0 && denominator >= numerator); ...
/* * 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...
DEFINE_SYSCALL(void, sys_analytics_logging_log_event, AnalyticsEventBlob *event_blob)
_set = false; return_status = FLASH_COMPLETE; flash_written_data = NULL; flash_written_flag = NULL; flash_data_start = 0; flash_data_length = 0; callback_called = false; } void test_system_flash__cleanup(void) { free(flash_written_data); free(flash_written_flag); } void test_system_flash__erase_zero_b...
(callback_called)
; } void test_system_flash__write_error(void) { return_status = FLASH_ERROR_OPERATION; malloc_flash_data(10); flash_data_start = FLASH_BASE; cl_assert(!system_flash_write(FLASH_BASE, "abc", 3, NULL, NULL)); cl_assert(flash_locked); assert_flash_unwritten(0, 10); } extern void FLASH_Lock(void) { flash_lo...
ne APP2_RESOURCES_FIXTURE_NAME "feature_menu_layer.pbpack" #define BACKGROUND_COUNTER_APP_NAME "Background Counter" #define MENU_LAYER_APP_NAME "MenuLayerName" void load_fixture_on_pfs(const char *name, const char *pfs_name) { char res_path[strlen(CLAR_FIXTURE_PATH) + strlen(APP_REGISTRY_FIXTURE_PATH) + strlen(name...
(0, 0x1000000)
; pfs_init(false); app_install_manager_init(); app_db_init(); app_db_flush(); app_cache_init(); app_cache_flush(); tictoc_id = app_install_get_id_for_uuid(&tictoc_uuid); music_id = app_install_get_id_for_uuid(&music_uuid); sports_id = app_install_get_id_for_uuid(&sports_uuid); cl_assert_equal_i(...
/ Set up an SPI prv_spi_slave_deinit(slave); prv_spi_slave_init(slave); // Set up DMA if (slave->rx_dma) { dma_request_init(slave->rx_dma); } if (slave->tx_dma) { dma_request_init(slave->tx_dma); } } static void prv_spi_acquire_helper(const SPISlavePort *slave) { spi_ll_slave_acquire(slave); ...
(slave->slave_state->scs_selected)
; slave->slave_state->scs_selected = false; gpio_output_set(&slave->spi_scs, false); // SCS not asserted (high) } uint8_t spi_ll_slave_read_write(const SPISlavePort *slave, uint8_t out) { PBL_ASSERTN(slave->slave_state->initialized); PBL_ASSERTN(slave->slave_state->acquired); PBL_ASSERTN(slave->slave_state-...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
text_layer_set_overflow_mode(&data->text_layer, data->overflow_mode)
; } else if (button == BUTTON_ID_DOWN) { if (data->line_spacing_delta < 5) { data->line_spacing_delta -= 1; } else { data->line_spacing_delta -= 5; } text_layer_set_line_spacing_delta(&data->text_layer, data->line_spacing_delta); } GSize size_used = text_layer_get_content_size(app_get...
t offset, size_t field_size) { flash_read_bytes(field_out, prv_current_page_flash_addr() + offset, field_size); if (!prv_field_valid(field_out, field_size)) { // If corrupted field, delete entire page PBL_LOG(LOG_LEVEL_WARNING, "Shared PRF Storage sector # %"PRIu32" is corrupted. Invalidating" ...
SPRF_PERSIST_FIELD(data, root_keys)
; } prv_unlock(); } //! //! BLE Pairing Data APIs //! bool shared_prf_storage_get_ble_pairing_data(SMPairingInfo *pairing_info_out, char *name_out, bool *requires_address_pinning_out, uint8_t *flags) { bool rv; prv_lock(...
if (property_animation) { property_animation_legacy2_init(property_animation, implementation, subject, from_value, to_value); }
return property_animation; } void property_animation_legacy2_destroy(struct PropertyAnimationLegacy2* property_animation) { if (property_animation == NULL) { return; } animation_legacy2_unschedule(&property_animation->animation); task_free(property_animation); } void property_animation_legacy2_init_lay...
F_RECT_ELSE(44, 46); #endif width = config_width; break; case BTPairingUIStateAwaitingResult: alignment = GAlignLeft; #if PLATFORM_ROBERT || PLATFORM_CALCULUS x_offset = 76; y_offset = 30; #else x_offset = PBL_IF_RECT_ELSE(49, 67); y_offset = PBL_IF_RECT_ELSE(22, 25); #endi...
{ BTPairingUIData *data = window_get_user_data(window); window_set_background_color(&data->window, PBL_IF_COLOR_ELSE(GColorLightGray, GColorWhite)); const int32_t width_of_action_bar_with_padding = ACTION_BAR_WIDTH + PBL_IF_RECT_ELSE(2, -4); const int32_t width = window->layer.bounds.size.w - width_of_action_b...
= 2; int duration_total = duration_a + play_count_b * duration_b; // Create 2 animations Animation *a = prv_create_test_animation(); animation_set_duration(a, duration_a); Animation *b = prv_create_test_animation(); animation_set_duration(b, duration_b); animation_set_play_count(b, play_count_b); //...
(&s_stopped_handler_calls, b)
/* * 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_s(dstbuf, "There are 4 lights, -4")
; // Space for positive signed snprintf(dstbuf, 256, "There are % d lights, the absolute value of % d", 4, -4); cl_assert_equal_s(dstbuf, "There are 4 lights, the absolute value of -4"); // Plus for positive signed snprintf(dstbuf, 256, "There are %+d lights, the absolute value of %+d", 4, -4); cl_assert...
UT_TICK_INTERVAL_SECS); } fake_comm_session_process_send_next(); prv_assert_sent_data(s_characteristics[0][PPoGATTCharacteristicData], sn, s_short_data_fragment, sizeof(s_short_data_fragment) - sn); } // The last straw: for (int i = 0; i < PPOGATT_TIMEOUT_TICKS; ++i) { re...
(s_characteristics[0][PPoGATTCharacteristicData], BLESubscriptionNotifications, BLEGATTErrorSuccess)
; // Expect nothing to be sent out by FW: fake_gatt_client_op_assert_no_write(); // No crash nor DUMA failures } void test_ppogatt__unsubcribe_when_no_memory_for_comm_session(void) { // TODO }
ack_artist(const char *artist, size_t artist_length) { off_t o = offsetof(__typeof__(s_music_ctx), artist); prv_update_string_and_put_event(artist, artist_length, o); } void music_update_track_album(const char *album, size_t album_length) { off_t o = offsetof(__typeof__(s_music_ctx), album); prv_update_string_...
prv_put_state_changed_event(state->playback_state)
r 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 in writing, software * distributed under the Licens...
cl_assert(grand_child_a.parent == &child_a)
; // Return early when (parent->paren == NULL): layer_remove_from_parent(&parent); } void test_layer__remove_child_layers(void) { Layer parent, child_a, child_b; Layer *layers[] = {&parent, &child_a, &child_b}; for (int i = 0; i < ARRAY_LENGTH(layers); ++i) { layer_init(layers[i], &GRectZero); } // ...
:00 1:00 D Rule US 2007 max - Nov Sun>=1 2:00 0 S Mar 8th 2015 10:00 UTC ~ Nov 1st 2015 09:00 UTC, GMT-8 */ [31]={ 1425808800, 1446368400,-8 * SECONDS_PER_HOUR }, /* Uruguay (Uruguay) [America/Montevideo] * Uruguay has abandoned DST */ [32]={ 0, ...
for (int32_t gmtoff = min_gmtoff; gmtoff <= max_gmtoff; gmtoff += gmtoff_slide) { prv_clock_reset(0); tzinfo.tm_gmtoff = gmtoff; rtc_set_timezone(&tzinfo); clock_init(); clock_set_time(jan1st_noon_2005); cl_assert_equal_i(rtc_get_time(), jan1st_noon_2005); time_t t = rtc_get_time(); st...
} void test_clock__cross_dst(void) { struct tm oct_31 = { .tm_sec = 0, .tm_min = 59, .tm_hour = 23, .tm_mday = 31, .tm_mon = 9, // Oct .tm_year = 2015 - 1900, .tm_isdst = 1, .tm_gmtoff = -5 * SECONDS_PER_HOUR, }; struct tm nov_7 = { .tm_sec = 0, .tm_min = 15, .tm_hou...
e/resource_ids.auto.h" #include "shell/system_theme.h" #include "system/passert.h" #include "util/math.h" #include <string.h> #define INDICATOR "»" static const int VERTICAL_PADDING = PBL_IF_COLOR_ELSE(2, 4); static const int EXTRA_PADDING_1_BIT = 2; static const int SHORT_COL_COUNT = 3; static const int MAX_NUM_VIS...
PBL_IF_COLOR_ELSE(inset, 2 * inset)
, 0); // We offset the text 5 pixels from the left of the cell. If the indicator is // present, the indicator also will be offset, so we add 5 pixels more spacing // between the text and the indicator. This extra padding isn't needed for round. const int nudge = PBL_IF_ROUND_ELSE(0, menu_cell_basic_horizontal...
{ 1216, 112, -128}, { 1184, 120, -112}, { 1104, 104, -96}, { 1096, 72, -88}, { 1200, 56, -104}, { 992, -16, -120}, { 1112, -80, -96}, { 976, -48, -72}, { 1208, 40, -192}, { 1312, 0, -224}, { 1384, 16, -256}, { 1168, 8, -208}, { 1016, 88, -256}, { 1008, 112, -240},...
{ 1192, 64, -368}, { 1592, 232, -320}, { 1712, 472, -320}, // 26 seconds { 1256, 472, -480}, { 1512, 584, -480}, { 864, 456, -424}, { 1128, 312, -320}, { 1272, 352, -224}, { 1424, 208, -112}, { 1224, 128, -32}, { 1112, 136, -80}, { 1168, 112, -128}, { 1184, 128, ...
#include <btutil/bt_device.h> #include <btutil/sm_util.h> //! About this module //! ----------------- //! - Book-keeping of connection-related state for GAP and GATT. //! - gap_le_connection.c registers connections with this module. //! - Passive. Does not initiate (dis)connections. // ------------------------------...
memcpy(irk_copy, irk, sizeof(*irk_copy))
; } connection->irk = irk_copy; } // ------------------------------------------------------------------------------------------------- GAPLEConnection *gap_le_connection_add(const BTDeviceInternal *device, const SMIdentityResolvingKey *irk, ...
form_fit = row_data->icon_form_fit, .horizontal_inset = row_data->horizontal_inset, .overflow_mode = GTextOverflowModeFill, }; prv_menu_cell_draw_dispatch(&s_ctx, &cell_layer, cell_type, &config, row_data->icon_subbitmap); } void prv_prepare_canvas_and_render_cells(MenuCellType cell_type, int16_t cell_widt...
{ const int16_t cell_width = 144; prv_prepare_canvas_and_render_cells( MenuCellType_BasicCustom, cell_width, s_menu_system_cell_layer_test_column_data, ARRAY_LENGTH(s_menu_system_cell_layer_test_column_data), /* is_legacy2 */ false); cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); ...
void test_menu_layer_system_cells__cell_width_32(void) { #if PBL_ROUND const int16_t cell_width = 32; prv_prepare_canvas_and_render_cells( MenuCellType_CellLayer, cell_width, s_menu_system_cell_layer_test_column_data, ARRAY_LENGTH(s_menu_system_cell_layer_test_column_data), /* is_legacy2 *...
; cl_assert_equal_i(size, sizeof(data)); cl_assert_equal_i(memcmp(buffer, data, sizeof(data)), 0); // Test ble_ad_copy_local_name, destination buffer large enough: char local_name[64]; size = ble_ad_copy_local_name(s_ad_data, local_name, 64); cl_assert_equal_s(local_name, "LightBlue"); cl_assert_equal_i(...
(ad, uuid, 1)
, true); cl_assert_equal_i(memcmp(expected_ad_data, ad->data, sizeof(expected_ad_data)), 0); cl_assert_equal_i(ad->ad_data_length, sizeof(expected_ad_data)); cl_assert_equal_i(ad->scan_resp_data_length, 0); ble_ad_destroy(ad); } void test_ble_ad_parse__set_service_uuids_32_bit(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...
(BMI160_SPI)
ON; #if PBL_ROUND // TODO PBL-28730: Fix peek layer so it does its own line wrapping message = i18n_get("No internet\nconnection", data); #else message = i18n_get("No internet connection", data); #endif break; case AppFetchResultIncompatibleJSFailure: // TODO: PBL-39752 make this a mor...
app_window_stack_pop(true)
; } else { app_fetch_cancel(data->install_entry.install_id); } } static void config_provider(void *context) { window_single_click_subscribe(BUTTON_ID_BACK, (ClickHandler) prv_click_handler); window_single_click_subscribe(BUTTON_ID_UP, (ClickHandler) prv_click_handler); window_single_click_subscribe(BUTTO...
{ 1200, -72, -64}, { 1056, -40, -80}, { 976, -16, -128}, { 1000, -8, -120}, { 1000, -32, -136}, { 928, -8, -168}, { 880, -16, -224}, { 848, -8, -232}, { 824, -8, -224}, // 113 seconds { 904, 8, -208}, { 984, 56, -192}, { 1080, 80, -144}, { 1544, 120, -160}, { ...
{ 1080, -88, -104}, { 1008, -56, -120}, { 936, -32, -176}, { 944, -40, -160}, { 1016, -80, -128}, { 1008, -104, -96}, { 1016, -88, -104}, { 1024, -56, -112}, { 1088, -56, -128}, { 1096, -64, -112}, { 1152, -64, -72}, { 1472, -48, -128}, { 1352, -32, -96}, { 1064, ...
window_stack); cl_assert_equal_i(window->on_screen, true); cl_assert_equal_i(window->is_loaded, false); window_stack_push(window->parent_window_stack, new_window, true); } static void prv_pop_window_load(Window *window) { prv_window_load(window); cl_check(window->parent_window_stack); cl_assert_equal_i(w...
(app_window_stack_count(), 2)
; cl_assert_equal_i(window1->on_screen, false); cl_assert_equal_i(window2->on_screen, true); app_window_stack_remove(window1, false); cl_assert_equal_i(app_window_stack_count(), 1); cl_assert_equal_i(window2->on_screen, true); cl_assert_equal_i(window1->on_screen, false); app_window_stack_remove(window...
val->hdr.time_utc); return false; } // This can take a while, so periodically tickle the KernelBG watchdog. if (context->watchdog_kicks_left > 0) { // Check counter as insurance against getting into an infinite loop and still tickling the // watchdog. system_task_watchdog_feed(); co...
if (was_sleeping) { // Zero out if we were sleeping in this minute file_record->samples[sample_idx].v5_fields.steps = 0; file_record->samples[sample_idx].v5_fields.active = false; }
} // ------------------------------------------------------------------------------------ // Add a record to the minute file static bool prv_write_minute_file_record(AlgMinuteFileRecord *file_record) { bool success = false; SettingsFile *minute_file = prv_minute_data_file_open(); if (!minute_file) { PBL_L...
/* * 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 index = 0; index < DialogTask_Last; ++index) { if (task == DialogTaskList[index]) { return index; } } return DialogTask_Error; }
void tasks_dump_free_space(void) { for (int i = 0; i < DialogTask_Last; i++) { OS_TASK task = DialogTaskList[i]; if (task != 0) { PBL_LOG(LOG_LEVEL_DEBUG, "Task %s stack has %d bytes free", pcTaskGetTaskName(task), ((int)uxTaskGetStackHighWaterMark(task) * sizeof(StackType_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...
{ return ((TimelineItemStatusReminded & hdr->common.status) == 0); }
status_t reminder_db_next_item_header(TimelineItem *next_item_out) { PBL_LOG(LOG_LEVEL_DEBUG, "Finding next item in queue."); TimelineItemId id; status_t rv = timeline_item_storage_next_item(&s_storage, &id, prv_reminder_filter); if (rv) { return rv; } rv = prv_read_item_header(next_item_out, &id); ...
DOFF_TICKS); cl_assert(!alerts_should_enable_backlight_for_type(AlertOther)); cl_assert(alerts_should_notify_for_type(AlertPhoneCall)); cl_assert(!alerts_should_vibrate_for_type(AlertPhoneCall)); alerts_set_notification_vibe_timestamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS); ...
(!alerts_should_notify_for_type(AlertOther))
; cl_assert(!alerts_should_vibrate_for_type(AlertOther)); alerts_set_notification_vibe_timestamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS); cl_assert(!alerts_should_enable_backlight_for_type(AlertOther)); s_dnd_active = false; alerts_set_mask(AlertMaskAllOn); alerts_set_dnd...
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 "pbl_malloc.h" #include "kernel_heap.h" #include "pebble_tasks.h" #include "process_management/app_manag...
heap_free(app_state_get_heap(), ptr, saved_lr)
; } void *app_realloc(void *ptr, size_t bytes) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; return heap_realloc(app_state_get_heap(), ptr, bytes, saved_lr); } void *app_zalloc(size_t size) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; return heap_zalloc(app_state_get_hea...
2bit(const uint8_t registers[2]) { int16_t reading = ((registers[0] >> 4) & 0x0F) | ((int16_t)registers[1] << 4); if (reading & 0x0800) { reading |= 0xF000; } return reading; } static void prv_convert_accel_raw_data_to_mgs(const uint8_t *buf, AccelDriverSample *data) { int16_t readings[3]; for (int i =...
bma255_read_register(BMA255Register_INT_STATUS_2)
; bool anymotion = (int0_status & BMA255_INT_STATUS_0_SLOPE_MASK); if (anymotion) { const AccelConfig *cfg = &BOARD_CONFIG_ACCEL.accel_config; IMUCoordinateAxis axis = AXIS_X; bool invert = false; if (int2_status & BMA255_INT_STATUS_2_SLOPE_FIRST_X) { axis = AXIS_X; invert = cfg->axes_...
//////// void test_stringlist__test(void) { StringList *list = malloc(20); memset(list, 0, 20); // no data list->serialized_byte_length = 0; cl_assert_equal_i(0, string_list_count(list)); list->serialized_byte_length = 3; // 4 empty strings cl_assert_equal_i(4, string_list_count(list)); cl_assert_eq...
cl_assert_equal_s("foo", string_list_get_at(list, 2))
; // truncated because of the max list size string_list_add_string(list, 20, "abc", 10); cl_assert_equal_i(17, list->serialized_byte_length); cl_assert_equal_i(4, string_list_count(list)); cl_assert_equal_s("a", string_list_get_at(list, 3)); }
vent *const hrm_event = &e->hrm; if (hrm_event->event_type != HRMEvent_BPM) { return; } const BleHrmServiceMeasurement measurement = { .bpm = hrm_event->bpm.bpm, .is_on_wrist = (hrm_event->bpm.quality > HRMQuality_NoSignal), }; BTDeviceInternal sharing_to_devices[4]; const size_t num_devices = ...
(prv_start_hrm_kernel_main)
; } ++s_ble_hrm_subscription_count; } else { --s_ble_hrm_subscription_count; if (s_ble_hrm_subscription_count == 0) { prv_stop_popup_timer(); prv_execute_on_kernel_main(prv_stop_hrm_kernel_main); } } // Emit for every subscription, so Settings/Bluetooth menu can update accordingly...
{ -1040, 624, 296}, { -1248, 608, 240}, { -1184, 480, 120}, { -1080, 480, 16}, { -1208, 488, 40}, { -1472, 480, 96}, { -1440, 456, 152}, { -1296, 200, 248}, { -1272, 208, 272}, { -1256, 136, 224}, // 55 seconds { -1104, 160, 240}, { -920, 208, 160}, { -880, 168, 19...
{ 184, 800, 128}, { 224, 632, 120}, { 256, 456, 176}, { 264, 424, 88}, { 256, 304, 56}, { 264, 152, 80}, { 168, 144, 24}, { 32, 248, 88}, { -184, 608, 456}, { -552, 1456, 672}, { -520, 1440, 752}, { -544, 1712, 744}, { -232, 1208, 536}, { -144, 1144, 368}, { -...
n true; } static bool prv_convert_and_assign_gcolor(const RockyArgBinding *binding, const jerry_value_t argv[], RockyArgValueCheckError *value_error_out) { if (rocky_api_graphics_color_from_value(argv[0], (GColor *)binding->ptr)) { ...
rocky_error_argument_invalid_at_index(i + value_error.arg_offset, value_error.error_msg)
; } } // Just ignore any surplus args return jerry_create_undefined(); }
er the License. */ #include "applib/app.h" #include "applib/app_comm.h" #include "applib/app_sync/app_sync.h" #include "kernel/event_loop.h" #include "kernel/pbl_malloc.h" #include "process_state/app_state/app_state.h" #include "services/normal/activity/activity_algorithm.h" #include "services/normal/activity/activit...
prv_update_scrollable_metrics(data)
; } break; } case SPORTS_UNITS_KEY: break; case SPORTS_HRM_KEY: { // This returns if the SPORTS_HRM_KEY value has not changed from the default 0 value if (new_tuple->value->uint8 == 0) { return; } if (!data->supports_third_party_hr) { data->suppo...
/* * 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(success)
; // Init mutable types utf8_iter_init(&utf8_iter, &utf8_iter_state, &utf8_bounds, utf8_bounds.start); // Tests cl_assert(!iter_next(&utf8_iter)); cl_assert(!iter_next(&utf8_iter)); cl_assert(!iter_next(&utf8_iter)); } void test_utf8_iterator__decode_valid_string(void) { // Mutable types Iterator utf...
/* * 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...
atol("21474836481")
, 1); // ((2147483647 * 10) + 1) & 0xFFFFFFFF cl_assert_equal_i(atol("21474836471"), (int)4294967287); // -1 * (((2147483647 * 10) + 1) & 0xFFFFFFFF) cl_assert_equal_i(atol("-21474836471"), -(int)4294967287); }
IS_SIGNED((int)-1)
== true); cl_assert(IS_SIGNED((unsigned int)1) == false); } void test_math__test_within_macro(void) { int16_t min; int16_t max; // Min and max are both positive //////////////////////////////// min = 5; max = 10; // Min and max themselves should satisfy WITHIN cl_assert_equal_b(WITHIN(min, min, ma...
(BUTTON_ID_UP, 100 /*ms*/, (ClickHandler)menu_up_click_handler)
; if (menu_layer->callbacks.select_click) { window_single_click_subscribe(BUTTON_ID_SELECT, (ClickHandler)prv_menu_select_click_handler); } if (menu_layer->callbacks.select_long_click) { window_long_click_subscribe(BUTTON_ID_SELECT, 0, (ClickHandler)prv_menu_select_long_click_handler, NULL); } ...
uct.h" #include <stdio.h> // Max size of the temperature and phrase displayed together #define WEATHER_APP_GLANCE_MAX_STRING_BUFFER_SIZE (WEATHER_SERVICE_MAX_SHORT_PHRASE_BUFFER_SIZE + 5) typedef struct LauncherAppGlanceWeather { char title[APP_NAME_SIZE_BYTES]; char fallback_title[APP_NAME_SIZE_BYTES]; char s...
strncpy(weather_glance->title, title, weather_glance_title_size - 1)
; // Zero out the glance's subtitle buffer const size_t weather_glance_subtitle_size = sizeof(weather_glance->subtitle); memset(weather_glance->subtitle, 0, weather_glance_subtitle_size); // We'll only set the subtitle if we have a default forecast if (forecast) { if (forecast->current_temp == WEATHER_SE...
/* * 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...
gdraw_command_sequence_create_with_resource(resource_id)
; cl_assert(sequence != NULL); } // Test that loading an invalid PDC file fails void test_gdraw_command_resources__load_invalid(void) { uint32_t resource_id = sys_resource_load_file_as_resource(TEST_IMAGES_PATH, TEST_PDC_FILE); cl_assert(resource_id != UINT32_MAX); // Test Command_Image GDrawCommandImage ...
(&src_bitmap->bounds)
, src_row_info.max_x + 1); int16_t src_x = src_initial_x + src_origin_offset.x; for (int16_t dest_x = dest_begin_x; dest_x < dest_end_x; ++dest_x, ++src_x) { if (!WITHIN(src_x, src_begin_x, src_end_x - 1)) { // Check if content should wrap (under and over) for ti...
((jerry_value_t)EM_ASM_INT_V({ \ return __jerryRefs.ref((value)); \ })) jerry_value_t jerry_create_array(uint32_t size) { return (jerry_value_t)EM_ASM_INT({ return __jerryRefs.ref(new Array($0)); }, size); } jerry_value_t jerry_create_boolean(bool value) { return (jerry_value_t)EM_ASM_IN...
({ var obj = __jerryRefs.get($0); var name = __jerryRefs.get($1); return (name in obj); }, obj_val, prop_name_val)
; } bool jerry_has_own_property(const jerry_value_t obj_val, const jerry_value_t prop_name_val) { if (!jerry_value_is_object(obj_val) || !jerry_value_is_string(prop_name_val)) { return false; } return (bool)EM_ASM_INT({ var obj = __jerryRefs.get($0); var name = __jerryRefs.get($1); return o...
144, 0}, { 832, 144, -8}, { 984, 176, -16}, { 1040, 192, -64}, { 1024, 160, -104}, { 1192, 176, -144}, // 105 seconds { 1152, 176, -120}, { 920, 120, -120}, { 1016, 168, -136}, { 1176, 192, -152}, { 1096, 208, -120}, { 904, 216, -96}, { 728, 184, -144}, { 632, 168...
{ 632, 192, -32}, { 720, 192, -72}, { 864, 256, -120}, { 1000, 264, -216}, { 992, 304, -288}, { 1032, 248, -272}, { 1328, 296, -264}, { 1352, 360, -224}, { 1080, 392, -240}, { 880, 320, -208}, { 928, 296, -168}, { 984, 248, -144}, { 1112, 208, -136}, { 1040, 112, ...
{ 912, 216, -128}, { 920, 208, -136}, { 928, 200, -128}, { 920, 200, -136}, { 920, 208, -152}, { 928, 200, -160}, { 928, 192, -176}, { 928, 176, -176}, { 912, 160, -168}, { 912, 152, -168}, { 880, 128, -184}, { 896, 80, -168}, { 904, 64, -152}, { 912, 96, -160}, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prompt_send_response("OK")
; } else { prompt_send_response("No app with id"); } } void command_worker_launch(const char *id_str) { int32_t id = atoi(id_str); if (id == 0) { prompt_send_response("invalid app number"); return; } AppInstallEntry entry; bool success = app_install_get_entry_for_install_id(id, &entry); i...
ength string as date... // Apple rdar://19639333 timestamp = rtc_get_time(); // copy out app ID to a char buffer char app_id_buffer[app_id->length + 1]; pstring_pstring16_to_string(&app_id->pstr, app_id_buffer); PBL_LOG(LOG_LEVEL_WARNING, "No valid date. Offending iOS app: %s", app_id_buffer); ...
if (!pstring_equal_cstring(&app_id->pstr, IOS_MAIL_APP_ID)) { return false; }
static const char loading_str[] = "Loading\xe2\x80\xa6"; if (pstring_equal_cstring(&message->pstr, loading_str)) { return true; } static const char no_content_str[] = "This message has no content."; if (pstring_equal_cstring(&message->pstr, no_content_str)) { return true; } return false; } stati...
rtc_get_time()
; struct tm local_tm; localtime_r(&now, &local_tm); //! Step / activity related data // Get the step totals for today and the past 6 days health_service_private_get_metric_history(HealthMetricStepCount, DAYS_PER_WEEK, health_data->step_data); // Update distance ...
timeline_iter_remove_node(head, node)
; return true; } else { return false; } } status_t timeline_iter_init(Iterator *iter, TimelineIterState *iter_state, TimelineNode **head, TimelineIterDirection direction, time_t timestamp) { iter_state->direction = direction; iter_state->start_time = timestamp; iter_state->midnight = time_util_ge...
ck, void *data) { int fd = prv_pmap_open_debug_wrapper(s_map_filename, OP_FLAG_READ, 0, 0); if (fd < 0) { PBL_LOG(LOG_LEVEL_WARNING, "pmap search (open) failed: %d", fd); return (fd); } int seek_result = seek_map(fd, callback, data); pfs_close(fd); return (seek_result); } static bool walk_max_use...
{ RETURN_STATUS_UP(search_result); }
/* * 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_set_highlight_colors(menu_layer, PBL_IF_COLOR_ELSE(SETTINGS_MENU_HIGHLIGHT_COLOR, GColorBlack), GColorWhite)
; menu_layer_set_click_config_onto_window(menu_layer, &data->window); layer_add_child(&data->window.layer, menu_layer_get_layer(menu_layer)); } static void prv_window_unload(Window *window) { SettingsAppData *data = window_get_user_data(window); menu_layer_deinit(&data->menu_layer); app_free(data); } stati...
-144, -992}, { -16, -152, -1000}, // 38 seconds { -8, -144, -992}, { -8, -152, -992}, { -8, -160, -992}, { -8, -144, -992}, { 0, -152, -992}, { -8, -144, -1000}, { -8, -160, -1000}, { -16, -176, -1016}, { -8, -184, -984}, { 16, -144, -968}, { 8, -128, -976}, { 0, ...
{ -8, -232, -976}, { -8, -248, -984}, { -16, -248, -984}, { -8, -248, -976}, { -8, -240, -976}, { -16, -240, -976}, { -24, -256, -992}, { -16, -256, -984}, { -16, -256, -976}, { -8, -240, -984}, { -16, -240, -976}, { -16, -240, -984}, // 44 seconds { -8, -248, -97...
(new_node->visibility == ProcessVisibilityQuickLaunch); const int override_cmp_rv = prv_app_override_comparator(app_node->install_id, new_node->install_id); if (is_app_quick_launch != is_new_quick_launch) { // Quick Launch only apps are first return ...
(source, install_id)
; break; case APP_ICON_NAME_UPDATED: prv_do_app_icon_name_updated(source, install_id); break; case APP_DB_CLEARED: prv_do_app_db_cleared(source); break; default: break; } kernel_free(install_data); } void prv_send_callback_to_app(AppMenuDataSource *data_source, AppI...
t *from_origin, GPoint *to_origin) { Animation *animation = property_animation_get_animation( property_animation_create_bounds_origin(&pin_window->layer, from_origin, to_origin)); animation_set_duration(animation, TIMELINE_CARD_TRANSITION_MS / 2); return animation; } static void prv_pin_window_load(Window ...
(window, colors->bg_color)
; } static void prv_pin_window_unload_modal(Window *window) { TimelinePinWindow *pin_window = (TimelinePinWindow *)window; event_service_client_unsubscribe(&pin_window->blobdb_event_info); timeline_item_destroy(pin_window->item_detail_layer.item); prv_pin_window_unload(window); kernel_free(window); } stati...
/* * 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...
(&time_tm)
; fake_rtc_init(0 /* initial_ticks */, utc_sec); // Setup graphics context framebuffer_init(&s_fb, &DISP_FRAME.size); framebuffer_clear(&s_fb); graphics_context_init(&s_ctx, &s_fb, GContextInitializationMode_App); s_app_state_get_graphics_context = &s_ctx; // Setup resources fake_spi_flash_init(0 /* o...
ddr, on_complete_cb, context, is_subsector, 0); if (remaining_ms) { // Start timer that will periodically check for the erase to complete new_timer_start(s_erase_poll_timer, remaining_ms, prv_flash_erase_timer_cb, NULL, 0); } } static void prv_blocking_erase_...
(s_flash_lock)
; flash_impl_erase_bulk_begin(); while (flash_impl_erase_is_in_progress()) { psleep(10); } mutex_unlock(s_flash_lock); } #endif void flash_sleep_when_idle(bool enable) { // the S29VS flash automatically enters and exits standby } bool flash_get_sleep_when_idle(void) { return false; } bool flash_is_in...
EL_DEBUG, "Error with \"A\": %s", buf); } r = strftime(buf, buf_size, "%b", &good_data); if (r == 0 || strncmp(buf, "May", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"b\": %s", buf); } r = strftime(buf, buf_size, "%B", &good_data); if (r == 0 || strncmp(buf, "May", buf_size) != 0) { ...
(buf, "2", buf_size)
!= 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"w\": %s", buf); } r = strftime(buf, buf_size, "%W", &good_data); if (r == 0 || strncmp(buf, "18", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"W\": %s", buf); } r = strftime(buf, buf_size, "%x", &good_data); if (r == 0 || strncmp(...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ PBL_ASSERT_TASK(PebbleTask_KernelMain); return &s_kernel_content_indicators_buffer; }
ContentIndicatorsBuffer *content_indicator_get_current_buffer(void) { if (pebble_task_get_current() == PebbleTask_App) { return app_state_get_content_indicators_buffer(); } else { return kernel_ui_get_content_indicators_buffer(); } } TimelineItemActionSource kernel_ui_get_current_timeline_item_action_s...
, "04"); s_clock_is_24h_style = false; EXECUTE_SCRIPT("s = d.toLocaleTimeString(undefined, {hour: 'numeric'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "8 PM"); EXECUTE_SCRIPT("s = d.toLocaleTimeString(undefined, " "{hour: 'numeric', hour12: true});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "8 PM"); EXEC...
EXECUTE_SCRIPT("var d = new Date();")
ibutes_create(); cl_assert_equal_p(attributes->font, NULL); cl_assert_equal_i(attributes->hash, 0); graphics_text_attributes_destroy(attributes); } void test_text_layout__get_default_flow_data(void) { const TextLayoutFlowData *data1 = graphics_text_layout_get_flow_data(NULL); cl_assert(data1 != NULL); cl_a...
(&gcontext, "JR Whopper 123", font, box, GTextOverflowModeWordWrap, GTextAlignmentLeft, (void*)&layout)
; cl_assert_equal_i(layout.max_used_size.w, 4 * HORIZ_ADVANCE_PX); // 4 lines - all four show up but all overlapped so 0 height is returned ("Jr\nWho-\npper\n 123") cl_assert_equal_i(layout.max_used_size.h, 0); graphics_text_layout_set_line_spacing_delta((void*)&layout, (1 - FONT_HEIGHT)); graphics...
/* * 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 (!prv_check_value_number_within_bounds(binding->type, &val, value_error_out)) { return false; }
if (binding->type != RockyArgTypeDouble && binding->type != RockyArgTypeFixedS16_3) { val = round(val); } void *const dest_ptr = binding->ptr; switch (binding->type) { case RockyArgTypeUInt8: *((uint8_t *)dest_ptr) = val; return true; case RockyArgTypeUInt16: *((uint16_t *)dest_...
in_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_y_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_across_y_origin_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, ...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_origin_aa_r2_no_clip.${BIT_DEPTH_NAME}.pbi"))
; // Radius of 0 - draw a single pixel setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT_NXNY, RADIUS_NONE); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_origin_aa_r0_no_clip.${BIT_DEPTH_NAME}.pbi")); } void test_graphics_...
(const uintptr_t ptr) { task_free((char *)ptr); } JERRY_FUNCTION(prv_postmessageerror_data_getter) { char *json_buffer = NULL; PBL_ASSERTN(jerry_get_object_native_handle(this_val, (uintptr_t *)&json_buffer)); PBL_ASSERTN(json_buffer); return prv_json_parse(json_buffer); } static void prv_object_queue_pop_he...
task_free(data_buffer)
; return prv_create_oom_error(); } *obj = (OutgoingObject) { .data_buffer = data_buffer, }; const bool is_first = prv_object_queue_add(obj); if (is_first) { if (s_state.state == PostMessageStateSessionOpen) { prv_outbox_try_send_next(); } else { prv_start_session_closed_object_que...
/* * 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_equal(&reg_entry->uuid, uuid)
) { return reg_entry->id; } } return INSTALL_ID_INVALID; } bool app_install_is_prioritized(AppInstallId install_id) { if (install_id == INSTALL_ID_INVALID) { return false; } bool rv = false; mutex_lock_recursive(s_recent_apps.mutex); { RecentApp *app = circular_cache_get(&s_recent_apps...
ted to " BT_DEVICE_ADDRESS_FMT, BT_DEVICE_ADDRESS_XPLODE(conn->device.address)); } return conn; } void command_bt_conn_param_set( char *interval_min_1_25ms, char *interval_max_1_25ms, char *slave_latency_events, char *timeout_10ms) { BleConnectionParamsUpdateReq req = { ...
strcmp(command, s_btle_pa_config_strings[index])
== 0) { break; } } if (index >= BtlePaConfigCount) { prompt_send_response_fmt(buffer, sizeof(buffer), "BTLE PA options are: %s, %s, %s", s_btle_pa_config_strings[BtlePaConfig_Disable], s_btle_pa_config_strings[BtlePaConfig_Enable], ...
/* * 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_s(NULL, string_list_get_at(list, 3))
; // 4 strings (first and last two are empty) list->serialized_byte_length = 4; list->data[0] = '\0'; list->data[1] = 'b'; list->data[2] = '\0'; list->data[3] = '\0'; // end of data list->data[4] = '\0'; cl_assert_equal_i(4, string_list_count(list)); cl_assert_equal_s("", string_list_get_at(list, 0))...
the dot radius graphics_context_set_stroke_color(ctx, inner_ring_color); graphics_context_set_fill_color(ctx, inner_ring_color); graphics_fill_radial_internal(ctx, center, inner_radial_inner_radius, inner_radial_outer_radius, 0, TRIG_MAX_ANGLE); } s...
{ prv_configure_dot_transition_animation(animation, TIMELINE_DOT_COLOR, TIMELINE_DOT_COLOR, TIMELINE_PAST_COLOR, CompositorTransitionDirectionUp, STATIC_DOT_ANIMATION_DURATION_MS, false); }
static void prv_dot_transition_from_timeline_past_animation_init(Animation *animation) { prv_configure_dot_transition_animation(animation, TIMELINE_DOT_COLOR, TIMELINE_DOT_COLOR, TIMELINE_PAST_COLOR, CompositorTransitionDirectionDown,...
TimelineItemActionTypeOpenWatchApp, .attr_list = open_app_action_attr_list, }; } if (config->response.enabled) { actions[num_actions++] = (TimelineItemAction) { .id = config->response.type, .type = TimelineItemActionTypeInsightResponse, .attr_list = response_action_attr_list, };...
i18n_noop("You walked %d steps which is %d%% below your typical. " "Being active makes you feel amaaaazing–try to get back on track tomorrow.")
, i18n_noop("You walked %d steps today which is %d%% below your typical. " "Don't worry, tomorrow is just around the corner 😀"), i18n_noop("You walked %d steps which is %d%% below your typical, " "but don't stress. You'll crush it tomorrow 😉"), }, }, [...