prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
l resume = false; Uuid system_uuid = UUID_SYSTEM; state->activity_dls_session = dls_create( DlsSystemTagActivitySession, DATA_LOGGING_BYTE_ARRAY, sizeof(dls_record), buffered, resume, &system_uuid); if (!state->activity_dls_session) { PBL_LOG(LOG_LEVEL_WARNING, "Error creating activity...
|| (session->type == ActivitySessionType_RestfulNap)) { if (session_exit_utc <= max_end_utc) { // Accumulate restful sleep stats stats->restful_minutes += session->length_min; } stats->last_deep_exit_utc = MAX(stats->last_deep_exit_utc, session_exit_utc); } } return rv; ...
// -------------------------------------------------------------------------------------------- // Goes through a list of activity sessions and updates our sleep totals in the metrics // accordingly. We also take this opportunity to post a sleep metric changed event for the SDK // if the sleep totals have changed. /...
_handler; static PendingInfo s_pending_did_read; static PendingInfo s_pending_did_write; static PendingInfo s_pending_notified; // Stubs / fakes void event_service_client_subscribe(EventServiceInfo *info) { cl_assert(info->type == PEBBLE_SMARTSTRAP_EVENT); s_event_handler = info->handler; } void event_service_c...
(NULL, 100, false)
); assert_result_invalid(app_smartstrap_attribute_end_write(NULL, 100, true)); assert_result_invalid(app_smartstrap_attribute_end_write(attr, 0, false)); assert_result_invalid(app_smartstrap_attribute_end_write(attr, 0, true)); assert_result_invalid(app_smartstrap_attribute_end_write(attr, 100, false)); asser...
aphics_circle_quadrant_draw_stroked_non_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, STROKE_SMALL,GCornerBottomLeft); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_r8_quad_bottom_left.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, STROKE_SM...
(&ctx.dest_bitmap, "stroke_circle_offset_aa_r8_quads_bottom.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, STROKE_SMALL); graphics_circle_quadrant_draw_stroked_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, STROKE_SMALL,GCornersRight); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_aa_r8_quads_right.${BIT_DEPTH_NAME}.pbi"))...
optional offset from the beginning of the object's section in flash. This is useful if //! you need to insert some derived metadata after the object has been written to flash. uint32_t start_offset; } MemoryLayout; static const MemoryLayout* prv_get_layout_for_type(PutBytesObjectType object_type) { static const...
{ const MemoryLayout *layout = prv_get_layout_for_type(object_type); storage->impl_data = (void*) layout; storage->current_offset = layout->start_offset; // This erase operation will take awhile, so disable the task watchdog for the current task // while we're doing this. bool previous_system_task_watchdo...
uint32_t pb_storage_raw_get_max_size(PutBytesObjectType object_type) { const MemoryLayout *layout = prv_get_layout_for_type(object_type); return layout->end_address - layout->start_address; } void pb_storage_raw_write(PutBytesStorage *storage, uint32_t offset, const uint8_t *buffer, uin...
} else { subtitle_text_frame_height = 0; } } else { icon_frame_size = GSizeZero; } } // We'll reuse this rect to conserve stack space; here it is used as the title text frame GRect rect = (GRect) { .origin = cell_layer_bounds->origin, .size = GSize(cell_layer_bounds_size....
if (render_subtitle && (subtitle_text_frame_height != 0)) { int16_t subtitle_text_frame_origin_y = (int16_t)(title_text_frame_origin_y + title_text_frame_height - subtitle_text_cap_offset); if (icon_align == GAlignLeft) { subtitle_text_frame_origin_y += icon_on_left_title_subtitle_vertical_spacing...
/* * 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...
("713713")
, 713713); } void test_atoi__whitespace_pfx(void) { cl_assert_equal_i(atoi(" 500"), 500); cl_assert_equal_i(atoi(" 765"), 765); cl_assert_equal_i(atoi(" 573888"), 573888); cl_assert_equal_i(atoi(" 713713"), 713713); } void test_atoi__suffix(void) { cl_assert_equal_i(atoi("500hurf"...
ing permissions and * limitations under the License. */ #include "resource_storage_flash.h" #include "resource_storage_impl.h" #include "drivers/flash.h" #include "kernel/pbl_malloc.h" #include "resource/resource_version.auto.h" #include "services/normal/process_management/app_storage.h" #include "system/bootbits.h...
flash_calculate_legacy_defective_checksum(addr, SECTOR_SIZE_BYTES)
GPoint(x, y); } static void prv_fill_segment(GContext *ctx, HealthProgressSegment *segment, GColor color, HealthProgressBarValue start, HealthProgressBarValue end) { GPoint p1, p2, p3, p4; if (segment->type == HealthProgressSegmentType_Vertical) { p1 = prv_get_point_between_points...
prv_total_offset_to_segment_offset(segment, to_total)
; prv_fill_segment(ctx, segment, color, from, to); } void health_progress_bar_outline(GContext *ctx, HealthProgressBar *progress_bar, GColor color) { graphics_context_set_stroke_color(ctx, color); graphics_context_set_stroke_width(ctx, 2); for (int i = 0; i < progress_bar->num_segments; i++) { HealthProg...
ging.h" #include "stubs_memory_layout.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_resources.h" #include "stubs_syscalls.h" #include <stdio.h> // stubs InterpolateInt64Function animation_private_current_interpolate_override(void) { return NULL; } static FrameBuffer *fb = NULL; // S...
(-181, 1, 1, 181, 0, 0, ANIMATION_NORMALIZED_MAX, interp)
; cl_assert_equal_i(y, -181 * 181); } void test_gdraw_command_transforms__segmented_scale(void) { GContext ctx; test_graphics_context_init(&ctx, fb); graphics_context_set_fill_color(&ctx, GColorFromHEX(0x55aaff)); graphics_context_set_antialiased(&ctx, true); graphics_fill_rect(&ctx, &ctx.dest_bitmap.bound...
graphics_draw_circle(&context, GPoint(50, 50), 10); ASSERT_CALLED(graphics_circle_draw_1px_non_aa(&context, GPoint(50, 50), 10)); setup_test(&context, false, 1, GColorBlack, GColorBlack, false); graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4); ASSERT_CALLED(prv_draw_round_rect(&context, &GRect...
(&context, GPoint(50, 50), 10)
; #if PBL_COLOR ASSERT_CALLED(graphics_circle_draw_stroked_aa(&context, GPoint(50, 50), 10, 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...
arging ? "YES" : "NO", is_connected ? "YES" : "NO"); PebbleEvent event = { .type = PEBBLE_BATTERY_CONNECTION_EVENT, .battery_connection = { .is_connected = battery_is_usb_connected(), }, }; event_put(&event); } // Read the interrupt status registers to clear pending bits. static void prv_clear...
{ PBL_LOG(LOG_LEVEL_DEBUG, "Found the as3701b"); }
else { PBL_LOG(LOG_LEVEL_DEBUG, "Error: read as3701b whoami byte 0x%x, expecting 0x11", chip_id); } return found; } static void prv_set_sd1_voltage(void) { // STM32F4 running at 1.76V may trigger a Power Down Reset (PDR). The power supply has a // tolerance of 3%. Set the voltage rail to 1.825V so our the...
/* * 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...
{ PLogTypesDecoderArg *decoder_info = *(PLogTypesDecoderArg **)arg; uint64_t value; bool success = pb_decode_varint(stream, &value); if (*decoder_info->num_types < decoder_info->max_num_types) { decoder_info->types[(*decoder_info->num_types)++] = value; } return success; }
typedef struct PLogMeasurementsDecoderArg { uint32_t max_num_samples; uint32_t *num_samples; uint32_t *offset_sec; uint32_t max_num_values; uint32_t *num_values; uint32_t *values; } PLogMeasurementsDecoderArg; // ----------------------------------------------------------------------------------------- /...
GE(graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10))); ASSERT_NO_CHANGE(graphics_draw_rect(&context, &GRect(10, 20, 40, 10))); ASSERT_NO_CHANGE(graphics_draw_circle(&context, GPoint(50, 50), 10)); ASSERT_NO_CHANGE(graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4)); setup_test(&context, tru...
cl_assert(ctx.lock == false)
t.h" #include "stubs_prompt.h" #include "stubs_regular_timer.h" #include "stubs_serial.h" #include "stubs_sleep.h" #include "stubs_system_reset.h" #include "stubs_task_watchdog.h" static int s_ble_bonding_change_add_count; static int s_ble_bonding_change_update_count; static int s_ble_bonding_change_delete_count; sta...
(bt_persistent_storage_set_ble_pinned_address(&address), true)
_EQUAL_METRIC_HISTORY(ActivityMetricActiveKCalories, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){0, exp_active_kcalories, 0, 0, 0, 0, 0})); ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricSleepTotalSeconds, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){0, 2 * SECONDS_PER_MINUTE, 0, 0, 0, 0, 0})); ASSERT_EQUAL_METRI...
ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricSleepRestfulSeconds, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){1 * SECONDS_PER_MINUTE, 0, 0, 0, 0, 0, 0}))
; // Expected resting calories uint32_t exp_resting_kcalories[ACTIVITY_HISTORY_DAYS]; for (int i = 0; i < ACTIVITY_HISTORY_DAYS; i++) { if (i == 0) { // All tests start at 5pm, we we just entered 3 minutes of data. uint32_t minutes_today = 17 * MINUTES_PER_HOUR + 3 + ACTIVITY_SESSION_UPDATE_MIN; ...
/* * 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...
gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_inside_origin_layer.${BIT_DEPTH_NAME}.pbi")
); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_x_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_across_x_origin_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&laye...
state->num_samples++; samples_drained++; } // If buffer is full, notify subscriber to process it if (!state->event_posted && state->num_samples >= state->samples_per_update) { // Notify the subscriber that data is available state->event_posted = prv_call_data_callback(state); ...
mutex_lock_recursive(s_accel_manager_mutex)
; AccelDriverSample data; int result = accel_peek(&data); if (result == 0 /* success */) { prv_copy_accel_sample_to_accel_data(&data, accel_data); prv_update_last_accel_data(&data); } mutex_unlock_recursive(s_accel_manager_mutex); return result; } DEFINE_SYSCALL(AccelManagerState*, sys_accel_man...
84, 40, -72}, { 1008, 48, -32}, // 51 seconds { 808, 56, -16}, { 704, 16, -24}, { 632, 24, -24}, { 624, 8, -64}, { 696, 32, -72}, { 808, 32, -176}, { 960, -16, -192}, { 1296, -112, -104}, { 1744, -88, -168}, { 1776, -16, -208}, { 1456, 160, -304}, { 1120, 264, -36...
{ 992, 56, 24}, { 904, 112, -96}, { 928, 112, -136}, { 968, 128, -176}, { 1000, 88, -160}, { 1008, 80, -168}, { 1056, 80, -184}, { 1048, 88, -224}, // 57 seconds { 1144, 88, -224}, { 1464, 72, -224}, { 1296, 72, -224}, { 1056, 80, -288}, { 816, 104, -376}, { 8...
{ 1008, -40, -296}, { 1008, -32, -296}, { 1136, -24, -288}, { 1480, 24, -400}, { 1384, 24, -304}, { 1104, 24, -224}, { 872, 64, -256}, { 976, 80, -280}, { 1104, 56, -232}, { 1232, 8, -168}, { 1152, -8, -80}, { 1056, -32, -72}, { 1024, -24, -48}, { 1000, 16, -64},...
abled = enable; } void accel_set_shake_sensitivity_high(bool sensitivity_high) { // Configure the threshold level at which the BMI160 will think shake has occurred if (sensitivity_high) { bma255_write_register(BMA255Register_INT_6, BOARD_CONFIG_ACCEL.accel_config.shake_thresholds[AccelThresholdLow]); ...
bma255_read_register(BMA255Register_PMU_LPW)
; const uint8_t lp = bma255_read_register(BMA255Register_PMU_LOW_POWER); const uint8_t fifo_cfg0 = bma255_read_register(BMA255Register_FIFO_CONFIG_0); const uint8_t fifo_cfg1 = bma255_read_register(BMA255Register_FIFO_CONFIG_1); const uint8_t fifo_status = bma255_read_register(BMA255Register_FIFO_STATUS); con...
icense for the specific language governing permissions and * limitations under the License. */ #include "health_sleep_detail_card.h" #include "health_detail_card.h" #include "services/normal/activity/health_util.h" #include "kernel/pbl_malloc.h" #include "services/common/clock.h" #include "services/common/i18n/i18n...
(GColorClear, GColorBlack)
/* * 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(gbitmap_pbi_eq(native_framebuffer, TEST_PBI_FILE))
; } // Tests 8-bit bitblt to circular display buffer // Result: // - gbitmap matches platform loaded PBI void test_bitblt_circular__color_8_bit(void) { GBitmap *bitmap = setup_png_test(TEST_PNG_FILE); GBitmap *native_framebuffer = graphics_context_get_bitmap(ctx); cl_assert(native_framebuffer->info.format == G...
low PBL_LOG(LOG_LEVEL_ERROR, "Overflow while validating resource"); return 0; } // Make sure the store's calculated length is not past the end of the store. if (prv_get_length(entry) < store_length) { return 0; } // Return the length of the store's resource data return resource_end_offset; } ...
{ return 0; }
return manifest.num_resources; } // if resource_id == 0 then check all of resource storage, else just validate // that the resource requested is valid bool resource_storage_check(ResAppNum app_num, uint32_t resource_id, const ResourceVersion *expected_version) { ResourceStoreEntry entr...
_events; resp->current_supervision_timeout_10ms = params.supervision_timeout_10ms; return sizeof(PebblePairingServiceConnParamsReadNotif); } static void prv_handle_trigger_pairing(uint16_t conn_idx, const PairingTriggerRequestData *req) { PBL_LOG(LOG_LEVEL_DEBUG, "Trigger pairing! should_pin_address=%d...
{ PBL_LOG(LOG_LEVEL_ERROR, "ble_gatts_read_cfm: %u", e); }
strncpy(data->fg_text_buffer, "FG =", sizeof(data->fg_text_buffer)); if (data->property == PROPERTY_FG_COLOR) { set_text_element(data->fg_text, data->fg_text_buffer, true); } else { set_text_element(data->fg_text, data->fg_text_buffer, false); } // Set BG Text strncpy(data->bg_text_buffer, "BG =",...
graphics_fill_round_rect(ctx, &GRect(35, 47, 32, 22), 4, GCornersAll)
; } // Draw background color GColor bg_color = (GColor){ .argb = (data->bg_color.argb | ALPHA_100) }; graphics_context_set_fill_color(ctx, bg_color); graphics_fill_round_rect(ctx, &GRect(36, 48, 30, 20), 4, GCornersAll); } #define COLOR_BAR_WIDTH 4 #define COLOR_BAR_HEIGHT 24 #define ROW_LENGTH 32 static voi...
te = kernel_malloc_check(sizeof(AccelManagerState)); *state = (AccelManagerState) { .task = handler_task, .data_cb_handler = data_cb, .data_cb_context = context, .sampling_interval_us = (US_PER_SECOND / rate), .samples_per_update = ACCEL_MAX_SAMPLES_PER_UPDATE, }; bool no_subs...
(s_accel_manager_mutex)
ta; PulseTransferFD *pulse_fd = &s_transfer_fds[fd_num]; const size_t max_read_len = (PULSE_MAX_SEND_SIZE - sizeof(ReadResponse)); size_t read_len = MIN(pulse_fd->transfer_state.bytes_left, max_read_len); ReadResponse *resp = pulse_reliable_send_begin(PULSE2_BULKIO_PROTOCOL); resp->opcode = BULKIO_RESP_DOMA...
prv_get_fd(cmd, length)
; if (!pulse_fd) { // prv_get_fd has already sent an error response return; } uint32_t bytes_read = 0; const unsigned int chunk_size = 128; uint8_t buffer[chunk_size]; uint32_t crc = crc32(0, NULL, 0); while (bytes_read < cmd->crc.length) { uint32_t read_len = MIN(cmd->crc.length - bytes_rea...
b cron; *time_out = prv_build_cron(&config, &cron) - rtc_get_time(); } alarm_is_scheduled = true; cleanup: prv_file_close_and_unlock(&file); return alarm_is_scheduled; } // ---------------------------------------------------------------------------------------------- bool alarm_get_kind(AlarmId id, AlarmK...
{ return false; }
bool rv = false; for (int i = 0; i < MAX_CONFIGURED_ALARMS; ++i) { AlarmConfig config; if (!prv_alarm_get_config(&file, i, &config)) { rv = true; break; } } prv_file_close_and_unlock(&file); return rv; } // ---------------------------------------------------------------------------...
es/common/i18n/i18n.h" #include "services/normal/activity/activity.h" #include "services/normal/alarms/alarm.h" #include "system/logging.h" #include "system/passert.h" #include <string.h> #define ALARM_DAY_LIST_CELL_HEIGHT PBL_IF_RECT_ELSE(menu_cell_small_cell_height(), \ ...
i18n_free_all(&data->day_picker_window)
; task_free(data); data = NULL; } static void prv_handle_selection(int index, void *callback_context) { AlarmEditorData *data = (AlarmEditorData *)callback_context; data->day_picker_was_completed = true; data->alarm_kind = prv_index_to_alarm_kind(index); if (data->creating_alarm) { const AlarmInfo in...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&qspi_config)
; QSPI_Cmd(ENABLE); qspi_release(dev); } void qspi_use(QSPIPort *dev) { if (dev->state->use_count++ == 0) { periph_config_enable(QUADSPI, dev->clock_ctrl); } } void qspi_release(QSPIPort *dev) { PBL_ASSERTN(dev->state->use_count > 0); if (--dev->state->use_count == 0) { periph_config_disable(QUAD...
608}, { 736, 16, -592}, { 736, 8, -592}, // 80 seconds { 736, 8, -584}, { 744, 16, -584}, { 736, 16, -584}, { 736, 16, -592}, { 744, 16, -584}, { 744, 8, -592}, { 744, 16, -584}, { 736, 8, -584}, { 744, 16, -584}, { 744, 8, -584}, { 744, 16, -592}, { 736, 24, ...
{ 720, 8, -624}, { 720, -8, -624}, { 720, 8, -632}, { 720, 0, -624}, // 86 seconds { 712, -8, -608}, { 720, 8, -616}, { 728, 8, -616}, { 728, 0, -608}, { 720, 8, -608}, { 728, -8, -608}, { 736, 16, -608}, { 720, -16, -616}, { 720, 8, -608}, { 736, -24, -616}, ...
{ 712, -24, -608}, { 720, 0, -600}, { 720, 8, -600}, { 728, 24, -624}, { 720, 8, -632}, { 704, -8, -608}, { 720, 0, -608}, { 712, -8, -624}, { 704, 16, -632}, // 89 seconds { 696, 8, -648}, { 704, 16, -648}, { 704, 16, -640}, { 704, 8, -640}, { 696, 8, -632},...
/* * 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_bad_packet_response(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...
rging ? "YES" : "NO", is_connected ? "YES" : "NO"); PebbleEvent event = { .type = PEBBLE_BATTERY_CONNECTION_EVENT, .battery_connection = { .is_connected = battery_is_usb_connected(), }, }; event_put(&event); } // Read the interrupt status registers to clear pending bits. static void prv_clear_...
PBL_LOG(LOG_LEVEL_DEBUG, "Found the as3701b")
; } else { PBL_LOG(LOG_LEVEL_DEBUG, "Error: read as3701b whoami byte 0x%x, expecting 0x11", chip_id); } return found; } static void prv_set_sd1_voltage(void) { // STM32F4 running at 1.76V may trigger a Power Down Reset (PDR). The power supply has a // tolerance of 3%. Set the voltage rail to 1.825V so ou...
/* * 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...
(ps2->str_value, ps2_str, strlen(ps2_str))
; const char *ps3_str = "PhilG"; uint8_t ps3_buf[128]; PascalString16 *ps3 = (PascalString16 *)&ps3_buf; ps3->str_length = strlen(ps3_str); memcpy(ps3->str_value, ps3_str, strlen(ps3_str)); const char *ps4_str = "Phil"; uint8_t ps4_buf[128]; PascalString16 *ps4 = (PascalString16 *)&ps4_buf; ps4->str...
1]; p3 = segment->points[2]; p4 = segment->points[3]; } GPathBuilder *builder = gpath_builder_create(5); gpath_builder_move_to_point(builder, p1); gpath_builder_line_to_point(builder, p2); gpath_builder_line_to_point(builder, p3); gpath_builder_line_to_point(builder, p4); GPath *path = gpath_buil...
(ctx, p2, p3)
; } else { graphics_line_draw_precise_stroked(ctx, p1, p2); graphics_line_draw_precise_stroked(ctx, p2, p3); } } }
i(s_num_alarms_fired, 2); s_current_day = s_wednesday; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 2); } void test_alarm__custom_alarm_partial_weekdays(void) { AlarmId id1; bool schedule_1[7] = {false, true, true, true, true, false, false}; id1 = alarm_create(&(AlarmInfo) { .hour = 10, ....
alarm_create(&(AlarmInfo) { .hour = 1, .minute = 30, .kind = ALARM_KIND_CUSTOM, .scheduled_days = &schedule_1 })
; prv_assert_alarm_config(id1, 1, 30, false, ALARM_KIND_CUSTOM, schedule_1); // It's currently Thursday @ 00:00, 2 days + 1:30 till next alarm /* cl_assert_equal_i(s_alarm_timer_timeout_ms, */ /* (SECONDS_PER_DAY * 2 + prv_hours_and_minutes_to_seconds(1, 30)) * 1000); */ s_current_day = s_s...
_DAY, .type = TimelineItemTypePin, .all_day = 1, .layout = LayoutIdTest, }, .attr_list = { .num_attributes = 0, .attributes = NULL, }, .action_group = { .num_actions = 0, .actions = NULL, }, .allocated_buffer = NULL, } }; static const in...
(&iterator)
((button < 0 || button > NUM_BUTTONS)) { return; } switch(*click_type) { case 's': offset = ClickHandlerOffsetSingle; break; case 'm': offset = ClickHandlerOffsetMulti; break; case 'l': offset = ClickHandlerOffsetLong; break; case 'r': offset = ClickHa...
if (reset_using_event) { return; }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
fs_rm(_clar_path)
; } char *mkdtemp(char *template); static int build_sandbox_path(void) { const char path_tail[] = "clar_tmp_XXXXXX"; size_t len; if (find_tmp_path(_clar_path, sizeof(_clar_path)) < 0) return -1; len = strlen(_clar_path); #ifdef _WIN32 { /* normalize path to POSIX forward slashes */ size_t i; for (i = 0;...
/* * 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 buffer[UUID_STRING_BUFFER_LENGTH]; const Uuid test_uuid_1 = (Uuid) { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 }; uuid_to_string(&test_uuid_1, buffer); cl_assert_equal_s(buffer, "{00010203-0405-0607-0809-000102030405}"); const Uuid system = UUID_SYSTEM; uuid_to_string(&system, buffer); ...
s_context_set_fill_color(ctx, AVG_LINE_COLOR); graphics_fill_rect(ctx, &avg_line_box); } static void prv_draw_avg_info_text(HealthGraphCard *graph_card, GContext *ctx, int offset_x, int offset_y, int height) { const GRect *bounds = &graph_card->layer.bounds; const GRect avg_tex...
if (graph_card->selection == HealthGraphIndex_Average) { graphics_text_layout_get_max_used_size(ctx, graph_card->info_avg, graph_card->legend_font, *bounds, GTextOverflowModeWordWrap, GTextAlignmentLeft, (GTextAttributes *)&text_l...
, now, HealthServiceTimeScopeOnce, true}, .out = { HealthServiceAccessibilityMaskNoPermission } }, }; // Run all the tests HealthServiceAccessibilityMask accessible; for (int i = 0; i < ARRAY_LENGTH(tests); i++) { const TestInputOutput *test = &tests[i]; s_activity_prefs_heart_rate_enabled = ...
health_service_metric_aggregate_averaged_accessible(test->in.metric, test->in.time_start, test->in.time_end, test...
; PBL_LOG(LOG_LEVEL_DEBUG, "%s\nMetric: %d, start: %d, end: %d, Aggregation: %d, Scope: %d", test->desc, (int)test->in.metric, (int)test->in.time_start, (int)test->in.time_end, (int)test->in.aggregation, (int)test->in.scope); cl_assert_equal_i(accessible, tests[i].out.accessible); } } ...
_FONT_FALLBACK_INTERNAL; cl_assert(text_resources_init_font(0, font_fallback, 0, &s_font_info)); int8_t horiz_advance = text_resources_get_glyph_horiz_advance(&s_font_cache, WILDCARD_CODEPOINT, &s_font_info); cl_assert(horiz_advance != 0); cl_asse...
(0, gothic_18_emoji_handle, 0, &s_font_info)
); uint8_t glyph_size_bytes; const GlyphData *glyph; const Codepoint PHONE_CODEPOINT = 0x260E; glyph = text_resources_get_glyph(&s_font_cache, PHONE_CODEPOINT, &s_font_info); cl_assert(glyph != NULL); glyph_size_bytes = glyph_get_size_bytes(glyph); cl_assert_equal_m(phone_bytes, glyph->data, glyph_size_...
maining_chunk_bytes > 0 && state->row < state->height) { const uint8_t *restrict framebuffer_row_data = (uint8_t *)framebuffer_get_line(state->fb, state->row); const uint16_t framebuffer_current_column = state->col / cols_per_byt...
(LOG_LEVEL_ERROR, "first byte can't be %u", sub_command)
; prv_send_error_response(session, SCREENSHOT_MALFORMED_COMMAND); return; } if (s_screenshot_in_progress) { PBL_LOG(LOG_LEVEL_ERROR, "Screenshot already in progress."); // Use a low timeout, if we are already in screenshot_send_next_chunk with the send buffer locked, then this // would block fo...
------------------------------------- // BLE Scan API callback static void ble_scan_handler(BTDevice device, int8_t rssi, const BLEAdData *ad_data) { const BTDeviceAddress address = bt_device_get_address(device); APP_LOG(APP_LOG_LEVEL_INFO, "Got Advertisem...
(result->local_name)
) { snprintf(title, sizeof(title), "%s %s", result->local_name, hrm_str); } else { const BTDeviceAddress address = bt_device_get_address(result->device); snprintf(title, sizeof(title), BT_DEVICE_ADDRESS_FMT " %s", BT_DEVICE_ADDRESS_XPLODE(address), hrm_str); } // Build the subtitle strin...
/* * 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_command_list[0].type, SectorEraseCommand)
setup_log_app_crash_info(crash_info)
; system_task_add_callback(prv_log_app_lr_and_pc_system_task, &s_current_app_crash_info); prv_kill_user_process(stashed_lr); for (;;) {} // Not Reached } static void hardware_fault_landing_zone(void) { prv_log_app_lr_and_pc_system_task(&s_current_app_crash_info); prv_kill_user_process(0); } static void pr...
ing = "Title" }, { .id = AttributeIdBody, .cstring = "Body" }, { .id = AttributeIdMuteDayOfWeek, .uint8 = MuteBitfield_Always }, { .id = AttributeIdAppName, .cstring = "Awesome" }, { .id = AttributeIdLastUpdated, .uint32 = s_now }, } }; s_expected_attributes = &expected_attributes; an...
ancs_filtering_is_muted(&mute_weekdays)
); s_now += SECONDS_PER_DAY; // Sunday Jan 3, 2016 cl_assert(ancs_filtering_is_muted(&mute_always)); cl_assert(ancs_filtering_is_muted(&mute_weekends)); cl_assert(!ancs_filtering_is_muted(&mute_weekdays)); s_now += SECONDS_PER_DAY; // Monday Jan 4, 2016 cl_assert(ancs_filtering_is_muted(&mute_always)); ...
_hidden(timeline_layer, true); // hide until the peek is over layer_set_hidden((Layer *)&timeline_layer->day_separator, true); layer_add_child(&window->layer, (Layer *)timeline_layer); // peek layer prv_init_peek_layer(s_app_data); prv_setup_peek(s_app_data); } static void prv_timeline_window_appear(Window ...
{ data->timeline_model.direction = TimelineIterDirectionPast; }
256}, { -32, 912, 256}, { -40, 912, 264}, { -32, 920, 256}, { -32, 912, 256}, { -40, 912, 264}, { -40, 912, 264}, { -32, 920, 248}, { -40, 920, 264}, { -40, 912, 264}, { -32, 920, 256}, { -32, 920, 256}, { -32, 920, 264}, { -32, 912, 256}, { -40, 920, 248}, {...
{ -24, 920, 256}, { -32, 928, 248}, { -24, 912, 256}, { -24, 912, 256}, { -32, 912, 256}, { -24, 912, 256}, { -24, 912, 248}, { -24, 920, 240}, // 249 seconds { -32, 920, 256}, { -32, 920, 248}, { -24, 920, 256}, { -24, 912, 248}, { -32, 920, 248}, { -32, 912,...
{ -32, 920, 264}, { -24, 904, 248}, { -24, 912, 288}, { -32, 912, 264}, { -32, 912, 280}, { -32, 912, 264}, { -32, 912, 272}, { -32, 912, 272}, { -32, 912, 272}, { -32, 912, 272}, { -32, 912, 272}, { -32, 912, 280}, { -32, 912, 280}, { -32, 912, 280}, { -32, ...
/* * 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...
vprintf(fmt, args)
; va_end(args); printf("\n"); } bool process_manager_compiled_with_legacy2_sdk(void) { return false; } ResAppNum sys_get_current_resource_num(void) { return 1; // 0 is system } size_t sys_resource_load_range(ResAppNum app_num, uint32_t id, uint32_t start_bytes, uint8_t *buffer,...
/* * 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 (new_state == SERIAL_CONSOLE_STATE_LOGGING) { stop_mode_enable(InhibitorDbgSerial); dbgserial_enable_rx_exti(); } else if (s_serial_console_state == SERIAL_CONSOLE_STATE_LOGGING) { stop_mode_disable(InhibitorDbgSerial); }
s_get_max_batched_pb_ops(); int num_ops = 500; if (max_batched_ops < 2) { // This race condition is not possible if we aren't pre-Acking return; } prv_receive_init(VALID_OBJECT_SIZE * num_ops, ObjectFirmware); fake_comm_session_process_send_next(); fake_system_task_callbacks_invoke_pending(); uint8...
assert_nack_count(1)
; } void test_put_bytes__abort_message_ok(void) { prv_receive_init_and_put_fw_object(); prv_process_and_reset_test_counters(); prv_receive_abort(s_last_response_cookie); assert_ack_count(1); assert_nack_count(0); assert_cleanup_event(ObjectFirmware, VALID_OBJECT_SIZE); } ////////////////////////////////...
te, the samples could be replayed anywhere from //! 10x slower to 10x faster than they were recorded (100 Hz recording //! with 10 Hz replay, or vice versa). //! //! The driver was exceptionally braindead before, buffering up all of //! the samples it could and replaying them from a 256-sample deep //! buffer. With a t...
if (s_num_fifo_samples > 0) { AccelDriverSample sample; prv_construct_driver_sample(&sample); ACCEL_LOG_DEBUG("Accel sample to manager: %d, %d, %d", sample.x, sample.y, sample.z); accel_cb_new_sample(&sample); }
if (s_num_fifo_samples == 0 && s_current_rcv_sample >= s_num_rcv_samples) { prv_stop_timer(); } mutex_unlock(s_accel_mutex); } // Start/reschedule the timer that feeds the FIFO/s_latest_reading out of the // samples received from the host static void prv_reschedule_timer(void) { bool success = new_time...
/* * 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...
{ DebounceConnection conn_id = e->is_system ? MobileAppDebounce : PebbleKitDebounce; bool timer_stopped = false; if (!e->is_open) { // If we become disconnected don't update apps until we have had a chance // to recover the connection. This will make our BT connection seem more // reliable. regula...
); tail = list_append(&a, &c); cl_assert(tail == &c); cl_assert(list_get_prev(&a) == NULL); cl_assert(list_get_next(&a) == &b); cl_assert(list_get_prev(&b) == &a); cl_assert(list_get_next(&b) == &c); cl_assert(list_get_prev(&c) == &b); cl_assert(list_get_next(&c) == NULL); } void test_list__prepend(voi...
(list_find_prev(&bar[2].list_node, filter_odd, false, NULL) == &bar[1].list_node)
; // '1' is the first odd number, so NULL is prev: cl_assert(list_find_prev(&bar[1].list_node, filter_odd, false, NULL) == NULL); // Test wrap around, find '3' before '0': cl_assert(list_find_prev(&bar[0].list_node, filter_odd, true, NULL) == &bar[3].list_node); // Test wrap around matching last item, find '4...
size = offsetof(PageHeader, erase_count) + sizeof(pg_hdr.erase_count); for (uint16_t i = start; i < end; i++) { prv_flash_write((uint8_t*)&pg_hdr, erased_header_size, prv_page_to_flash_offset(i)); } } typedef enum { PageHdrValid = 0, PageAndFileHdrValid = 1, HdrCrcCorrupt = -1, HdrVersionCheckFail = -2...
(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...
{ p = s2; while (*p) { if (s1[len] == *p++) { return len; } } len++; }
-112}, { 1160, 432, -48}, { 1144, 352, -24}, { 1240, 392, -96}, // 43 seconds { 1096, 296, -88}, { 1128, 256, 0}, { 1408, 240, 40}, { 1320, 168, 48}, { 1128, 40, 120}, { 1152, -64, 104}, { 1176, -72, 16}, { 1112, -8, -24}, { 944, 8, -24}, { 1128, -72, -8}, { 1...
{ 1144, 112, 16}, { 1024, 0, 72}, { 1088, -56, 40}, { 1144, -32, -40}, { 1048, 40, -80}, { 928, 8, -72}, { 1048, -72, -56}, { 968, -88, -160}, { 792, -152, -168}, { 1104, -184, -16}, { 1184, -40, -120}, // 49 seconds { 1272, 56, -192}, { 1352, 32, -208}, { 120...
{ 1040, 88, -224}, { 760, 64, -64}, { 784, 80, -80}, { 920, 152, -72}, { 1064, 208, -112}, { 1000, 224, -152}, { 1128, 184, -104}, { 1424, 288, -88}, { 1080, 384, -16}, { 1192, 384, -72}, { 1176, 448, -192}, { 1200, 264, -56}, { 1304, 232, 64}, { 1496, 200, 48}, ...
/* * 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...
reg_entry->md_fn()
; if (md && uuid_equal(&md->uuid, uuid)) { return reg_entry->id; } } else if ((reg_entry->type == AppInstallStorageResources) && uuid_equal(&reg_entry->uuid, uuid)) { return reg_entry->id; } } return INSTALL_ID_INVALID; } bool app_install_is_prioritized(AppInstallId instal...
if (c == KernelLEClientPPoGATT) { // We are trying to track down an issue on iOS where PPoGATT doesn't get opened (PBL-40084) // This message should help us determine if iOS is publishing the service PBL_LOG(LOG_LEVEL_INFO, "Found an instance of %s at 0x%"PRIx16"-0x%"PRIx16"!", ...
if (ticks_spent >= ((RTC_TICKS_HZ * 33) / 1000)) { // Doing this might actually cause an issue if the characteristic(s) for which there are still // notifications pending in the buffer become invalid before the time they are processed. // Probably not a big deal. gatt_client_subscriptions_resche...
// This is ugly and causes double-copying the data... // TODO: https://pebbletechnology.atlassian.net/browse/PBL-14164 uint8_t *buffer = (uint8_t *) kernel_malloc(header.value_length); if (UNLIKELY(header.value_length && !buffer)) { PBL_LOG(LOG_LEVEL_ERROR, "OOM for GATT notification"); re...
k, ARRAY_LENGTH(stack), &current_stack, true); cl_assert_equal_p(aaa, actual); cl_assert_equal_i(2, current_stack); cl_assert_equal_p(a, stack[0]); cl_assert_equal_p(aa, stack[1]); cl_assert_equal_p(aaa, stack[2]); // go to child if possible actual = __layer_tree_traverse_next__test_accessor(stack, ARRAY...
(layer_find_layer_containing_point(&child_a, &GPoint(9, 9)), &child_a)
; cl_assert_equal_p(layer_find_layer_containing_point(&child_a, &GPoint(0, 0)), &child_a); cl_assert_equal_p(layer_find_layer_containing_point(&parent, &GPoint(9, 9)), &child_a); cl_assert_equal_p(layer_find_layer_containing_point(&parent, &GPoint(10, 10)), &parent); layer_add_child(&child_a, &child_f); cl_...
/* * 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...
graphics_context_set_text_color(ctx, text_color)
; graphics_draw_text(ctx, text, small_font, text_box, overflow_mode, alignment, NULL); } } void health_ui_render_typical_text_box(GContext *ctx, Layer *layer, const char *value_text) { time_t now = rtc_get_time(); struct tm time_tm; localtime_r(&now, &time_tm); char weekday[8]; strftime(weekday, sizeof...
te->test_entry.name); continue; } // Look for and parse the expected values if (strcmp(token, "//>") == 0) { token = strtok(NULL, " \t\n"); if (strcmp(token, "TEST_VERSION") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.version); } else if (strcmp(token...
(strlen(CLAR_FIXTURE_PATH) + strlen(test_files_path) + 2)
; sprintf(state->res_path, "%s/%s", CLAR_FIXTURE_PATH, test_files_path); state->dp = opendir(state->res_path); if (state->dp == NULL) { printf("\nCould not open directory %s", state->res_path); return false; } state->type = samples_type; return true; } // ----------------------------------------...
ding = true; return APP_MSG_OK; } static bool s_comm_session_connected; CommSession *sys_app_pp_get_comm_session(void) { return (CommSession *)s_comm_session_connected; } static void prv_rcv_app_message_ack(AppMessageResult result) { void *context = NULL; cl_assert_equal_b(s_is_outbox_message_pending, true); ...
(s_outbox_iterator.cursor != s_outbox_iterator.dictionary->head)
; \ Tuplet tuplets[] = { __VA_ARGS__ }; \ uint32_t buffer_size = dict_calc_buffer_size_from_tuplets(tuplets, ARRAY_LENGTH(tuplets)); \ uint8_t buffer[buffer_size]; \ DictionaryIterator expected_it; \ const DictionaryResult result = \ dict_serialize_tuplets_to_buffer_with_iter(&expected_it, t...
777777777"); } void test_sprintf__null(void) { cl_assert_equal_i(snprintf(NULL, 0, "Hello!\nI am error"), 17); } void test_sprintf__percent_d(void) { char dstbuf[256]; // Simple %d snprintf(dstbuf, 256, "There are %d lights, %d", 4, -4); cl_assert_equal_s(dstbuf, "There are 4 lights, -4"); // Alternate...
(dstbuf, "There are 4 lights, the absolute value of -4")
; // Plus for positive signed snprintf(dstbuf, 256, "There are %+i lights, the absolute value of %+i", 4, -4); cl_assert_equal_s(dstbuf, "There are +4 lights, the absolute value of -4"); // Minimum digits output snprintf(dstbuf, 256, "There are %.2i lights, %.2i", 4, -4); cl_assert_equal_s(dstbuf, "There ...
esn't exist in plain Jerry context EXECUTE_SCRIPT(test_object); ASSERT_JS_GLOBAL_EQUALS_S("t", "undefined"); // rocky_global_init() injects global... static const RockyGlobalAPI *apis[] = { NULL, }; rocky_global_init(apis); EXECUTE_SCRIPT(test_object); ASSERT_JS_GLOBAL_EQUALS_S("t", "object"); ...
cl_assert_equal_b(true, rocky_global_has_event_handlers("a"))
; cl_assert_equal_b(true, rocky_global_has_event_handlers("b")); prv_add_event_listener_to_list("a", jerry_create_external_function(prv_listener_a2)); cl_assert_equal_b(true, rocky_global_has_event_handlers("a")); cl_assert_equal_b(true, rocky_global_has_event_handlers("b")); jerry_value_t a_event = rocky_g...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(offset + length <= s_storage_data.total_size)
; if (s_do_before_write) { s_do_before_write(); s_do_before_write = NULL; } memcpy(s_storage_data.buffer + offset, buffer, length); } static uint32_t fake_pb_storage_mem_calculate_crc(PutBytesStorage *storage, PutBytesCrcType crc_type) { PBL_ASSERTN(storage->impl_data == &s_storage_data); return s_...
*= (invert ? -1 : 1); accel_cb_shake_detected(axis, direction); } } // Services tap/motion interrupts static void prv_bma255_IRQ1_handler(bool *should_context_switch) { BMA255_DBG("Slope Int"); if (!s_accel_outstanding_motion_work) { s_accel_outstanding_motion_work = true; accel_offload_work_from_is...
bma255_read_register(BMA255Register_PMU_LPW)
, bma255_read_register(BMA255Register_PMU_LOW_POWER)); s_accel_power_mode = mode; } static BMA255ODR prv_get_odr(BMA255SampleInterval sample_interval) { BMA255ODR odr = 0; switch (sample_interval) { case BMA255SampleInterval_1HZ: odr = BMA255ODR_1HZ; break; case BMA255SampleInte...
0, -200, -856}, { 408, -128, -808}, { 520, -264, -976}, { 432, -192, -840}, { 552, -200, -880}, { 560, -216, -808}, // 112 seconds { 664, -128, -1016}, { 544, -224, -1008}, { 464, -296, -968}, { 400, -376, -920}, { 368, -424, -800}, { 320, -416, -760}, { 312, -448, -7...
{ 560, 216, -720}, { 408, 648, -680}, { 256, 624, -592}, { 216, 576, -560}, { 280, 400, -736}, { 288, 296, -792}, { 288, 304, -904}, { 264, 296, -904}, { 216, 192, -904}, { 336, 232, -952}, { 368, 88, -920}, { 448, 120, -872}, { 448, 48, -928}, { 424, -8, -952}, ...
{ -832, 552, 104}, { -840, 632, 40}, // 120 seconds // elapsed: 2 minutes { -792, 664, -32}, { -712, 712, -48}, { -720, 752, -136}, { -656, 752, -144}, { -656, 744, -216}, { -640, 728, -248}, { -600, 736, -264}, { -600, 752, -256}, { -584, 768, -280}, { -576, 776...
/* * 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...
analytics_storage_give_lock()
; } void analytics_inc(AnalyticsMetric metric, AnalyticsClient client) { analytics_add(metric, 1, client); } void analytics_inc_for_uuid(AnalyticsMetric metric, const Uuid *uuid) { analytics_add_for_uuid(metric, 1, uuid); } void analytics_add_for_uuid(AnalyticsMetric metric, int64_t amount, const Uuid *uuid) { ...
UTURE_NAVIGATION_COUNT, AnalyticsClient_System); } } static void prv_click_config_provider(void *context) { window_single_click_subscribe(BUTTON_ID_BACK, prv_back_click_handler); window_single_click_subscribe(BUTTON_ID_UP, prv_up_down_click_handler); window_single_click_subscribe(BUTTON_ID_DOWN, prv_up_down_cl...
timeline_layer_create_speed_lines_animation(&data->timeline_layer)
: NULL; return animation_spawn_create(peek_out, sidebar_slide, speed_lines, NULL); } static void prv_play_peek_in(TimelineAppData *data) { // Skip the first frame since the icon is offscreen const int num_frames_skip = 1; // The peek layer scale animation has a bounce back effect, so the icon reaches the des...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (task == PebbleTask_App) { heap = app_state_get_heap(); } else if (task == PebbleTask_Worker) { heap = worker_state_get_heap(); } else { WTF; }
2_t delay) { // Initialize the peek layer if (timeline_res_id || message) { Layer *root_layer = window_get_root_layer(&data->window); PeekLayer *peek_layer = &data->peek_layer; peek_layer_init(peek_layer, &root_layer->frame); peek_layer_set_title_font(peek_layer, fonts_get_system_font(FONT_KEY_GOTHI...
if (window->state == ProgressWindowState_Result) { // Ignore requests to change the result once we already have one return; }
window->state = ProgressWindowState_Result; prv_cancel_fake_progress_timer(window); prv_schedule_progress_failure_animation(window, timeline_res, message, delay); } void progress_window_set_callbacks(ProgressWindow *window, ProgressWindowCallbacks callbacks, void *context) { ...
t_framebuffer_size = graphics_context_get_framebuffer_size(ctx); layer_init(&status_bar_layer->layer, &GRect(0, 0, current_framebuffer_size.w, prv_height())); status_bar_layer->layer.update_proc = prv_status_bar_layer_render; status_bar_layer->layer.property_changed_proc = prv_status_bar_property_changed; // ...
PBL_ASSERTN(status_bar_layer)
; strncpy(status_bar_layer->config.info_text_buffer, text, INFO_TEXT_BUFFER_SIZE); layer_mark_dirty(&(status_bar_layer->layer)); } // Sets info text either ot X/Y or percentage if total is larger than MAX_INFO_TOTAL void status_bar_layer_set_info_progress(StatusBarLayer *status_bar_layer, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&s_ctx, &line, &word_iter_state.current, &text_box_params)
); cl_assert(line.height_px == 10); cl_assert(line.width_px == 3 * HORIZ_ADVANCE_PX); cl_assert(iter_next(&word_iter)); cl_assert(line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params)); cl_assert(line.height_px == 10); cl_assert(line.width_px == 7 * HORIZ_ADVANCE_PX); // Should not h...
property_animation_init(animation_h, &s_frame_layer_implementation, layer, from_frame, to_frame); } // ----------------------------------------------------------------------------------------- PropertyAnimation *property_animation_create_bounds_origin(Layer *layer, GPoint *from, GPo...
{ if (!value) { return false; } if (animation_private_using_legacy_2(NULL)) { // We need to enable other applib modules like sroll_layer, menu_layer, etc. which are // compiled to use the 3.0 animation API to work with 2.0 apps. PropertyAnimationLegacy2 *legacy = (PropertyAnimationLegacy2 *)prope...
ior for // 2.x compiled apps - no need to restore original since original 2.x did not do any restore ctx->draw_state.text_color = GColorBlack; } if (config->value && (icon_align != GAlignRight)) { value_box.size.w -= horizontal_margin; const GFont value_font = prv_get_cell_value_font(config); ...
graphics_text_layout_get_text_height(ctx, config->title, title_font, cell_layer_bounds_size.w, config->overflow_mode, text_alignment)
: title_font_height * intitial_title_text_lines; const int title_text_cap_offset = (config->title) ? fonts_get_font_cap_offset(title_font) : 0; int16_t container_height = title_text_frame_height + subtitle_text_frame_height; if (icon_align == GAlignTop) { // The icon is rendered above the others, add ...
/* * 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_fmt(buf, DISPLAY_BUF_LEN, "\nPinned address: "BT_DEVICE_ADDRESS_FMT, BT_DEVICE_ADDRESS_XPLODE_PTR(&addr)); }
SM128BitKey link_key; uint8_t platform_bits; if (bt_driver_supports_bt_classic()) { if (shared_prf_storage_get_bt_classic_pairing_data(&addr, &name[0], &link_key, &platform_bits)) { bluetooth_persistent_storage_debug_dump_classic_pairing_info( ...
ed_circular_buffer_add_subsampled_client( &s_buffer, &state->buffer_client, 1, 1); // Update the sampling rate and num samples of the driver considering the new // subscriber's request prv_update_driver_config(); } mutex_unlock_recursive(s_accel_manager_mutex); return state; } DEFINE_SYSCAL...
{ bool success = true; mutex_lock_recursive(s_accel_manager_mutex); if (samples > state->num_samples) { PBL_LOG(LOG_LEVEL_ERROR, "Consuming more samples than exist %d vs %d!", (int)samples, (int)state->num_samples); success = false; } else if (samples != state->num_samples) { PBL_LOG(LO...
/* * TODO: APIs that still need to be implemented */ void accel_manager_enable(bool on) { } void accel_manager_exit_low_power_mode(void) { } // Return true if we are "idle", defined as seeing no movement in the last hour. bool accel_is_idle(void) { // It was idle recently, see if it's still idle. Note we avoi...
ith_resource_system(icon_res_info.res_app_num, icon_res_info.res_id); loaded_node->icon_is_default = (timeline_res_id == NOTIF_FALLBACK_ICON) || (timeline_res_id == TIMELINE_RESOURCE_NOTIFICATION_GENERIC); *loade...
(actionable_dialog)
; data->actionable_dialog = actionable_dialog; } static GColor prv_invert_bw_color(GColor color) { if (gcolor_equal(color, GColorBlack)) { return GColorWhite; } else if (gcolor_equal(color, GColorWhite)) { return GColorBlack; } return color; } static void prv_invert_pdc_colors(GDrawCommandProcessor ...
} const char *get_timezone_abbr(void) { static const char s_timezone_abbr[] = "A"; return s_timezone_abbr; } void sys_copy_timezone_abbr(char* timezone_abbr, time_t time) { const char* sys_tz = get_timezone_abbr(); strncpy(timezone_abbr, sys_tz, TZ_LEN); } struct tm *sys_gmtime_r(const time_t *timep, struct ...
cl_assert_equal_s(tmbuf, "2015-01-02")
; #endif #if EXTENSION_TZ tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%G %g", &jan_2_2015__13_00_00); cl_assert_equal_s(tmbuf, "2015 15"); tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%k %l", &jan_2_2015__13_00_00); cl_assert_equal_s(tmbuf, "13 1"); #endif tmbuf[0] = '\0'; strftime(tmbuf, s...
t_buffer, false); } // Set BG Text strncpy(data->bg_text_buffer, "BG =", sizeof(data->bg_text_buffer)); if (data->property == PROPERTY_BG_COLOR) { set_text_element(data->bg_text, data->bg_text_buffer, true); } else { set_text_element(data->bg_text, data->bg_text_buffer, false); } // Set FG Color...
(ctx, &GRect(36, 48, 30, 20), 4, GCornersAll)
; } #define COLOR_BAR_WIDTH 4 #define COLOR_BAR_HEIGHT 24 #define ROW_LENGTH 32 static void draw_color_wheel_box(GContext* ctx, AppData *data) { GPoint origin = GPoint(8, 114); GColor compare_color = GColorClear; uint8_t color_index_match = 0; uint16_t height_offset = 0; bool compare = true; if (data->pro...
xt_set_stroke_color(GContext* ctx, GColor color) { record_mock_call(s_graphics_context_set_stroke_color) { .ctx = ctx, .color = color, }; ctx->draw_state.stroke_color = color; } static MockCallRecordings s_graphics_context_set_stroke_width; void graphics_context_set_stroke_width(GContext* ctx, uint8_t stroke...
(JERRY_INIT_EMPTY)
; s_app_window_stack_get_top_window = (Window){}; s_context = (GContext){}; s_app_state_get_graphics_context = &s_context; s_app_event_loop_callback = NULL; s_graphics_context_set_stroke_color = (MockCallRecordings){0}; s_graphics_context_set_stroke_width = (MockCallRecordings){0}; s_graphics_context_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...
(dstbuf, 256, "%.1dzero%.1d", 0, 1)
; cl_assert_equal_s(dstbuf, "0zero1"); // Variable length character output snprintf(dstbuf, 256, "There are %*d lights", 3, 4); cl_assert_equal_s(dstbuf, "There are 4 lights"); // Left-align, Variable length character output snprintf(dstbuf, 256, "There are %*d lights", -3, 4); cl_assert_equal_s(dstbu...
layer.bounds.size.h) { data->rect_velocity_y = data->rect_velocity_y * -1; } } else if (shape == RECTANGLE_ROUND) { // Move rounded line X per 4*Y data->rectr.origin.x += (data->rectr_velocity_x * PIXEL_SPEED_PER_FRAME); if (data->rectr.origin.x < 0 || data->rectr.origin.x ...
{ graphics_draw_pixel(ctx, data->point_p0); }
else if (shape == LINE) { graphics_draw_line(ctx, data->line_p0, data->line_p1); } else if (shape == SQUARE) { graphics_draw_rect(ctx, &data->square); } else if (shape == RECTANGLE) { graphics_draw_rect(ctx, &data->rect); } else if (shape == RECTANGLE_ROUND) { graphics_draw_round_re...
Sent: this->state->restart_count = MAX_CONFIGURE; // fallthrough case LinkState_AckReceived: case LinkState_Opened: PBL_LOG(LOG_LEVEL_WARNING, "Unexpected Configure-Nak/Rej received after Ack"); prv_handle_nak_or_reject(this, packet); prv_transition_to(this, LinkState...
(this, LinkState_Closed)
; break; case LinkState_RequestSent: case LinkState_AckReceived: case LinkState_AckSent: case LinkState_Opened: this->state->restart_count = MAX_TERMINATE; prv_send_terminate_request(this); // fallthrough case LinkState_Stopping: prv_transition_to(this, LinkState_Closin...
_get_elapsed(b, &elapsed_ms); cl_assert_equal_i(elapsed_ms, -1 * (delay_seq + delay_a + duration_a + delay_b)); // Start prv_advance_to_ms_with_timers(start_ms + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_ca...
(&s_started_handler_calls, a)
, 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b),...
const GRect *cell_layer_bounds, bool is_chosen) { const int32_t left_icon_spacing = PBL_IF_RECT_ELSE(0, 14); const GSize not_chosen_icon_bounds = gbitmap_get_bounds(&option_menu->not_chosen_image).size; const GSize chosen_icon_bounds = gbitmap_get_bounds(&option_menu->chosen_image).size; PBL_ASSERTN(...
if (option_menu->callbacks.unload) { option_menu->callbacks.unload(option_menu, option_menu->context); }
} void option_menu_set_status_colors(OptionMenu *option_menu, GColor background, GColor foreground) { option_menu->status_colors.background = background; option_menu->status_colors.foreground = foreground; status_bar_layer_set_colors(&option_menu->status_layer, option_menu->status_...
compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, eit...
health_service_private_get_metric_history(HealthMetricSleepSeconds, DAYS_PER_WEEK, health_data->sleep_data)
; activity_get_metric_typical(ActivityMetricSleepTotalSeconds, local_tm.tm_wday, &health_data->typical_sleep); activity_get_metric(ActivityMetricSleepRestfulSeconds, 1, &health_data->deep_sleep); activity_get_metric(ActivityMetricSleepEnterAtSeconds, 1, &health_data->sleep_start); ...
te_subscription(s_device_a, true); prv_assert_event_service_subscribed(false); cl_assert_equal_i(s_hrm_manager_subscribe_with_callback_call_count, 0); ble_hrm_handle_disconnection(&s_conn_a); prv_assert_event_service_subscribed(false); cl_assert_equal_i(s_hrm_manager_subscribe_with_callback_call_count, 0); ...
regular_timer_is_scheduled(timer)
); bt_driver_cb_hrm_service_update_subscription(s_device_a, false); cl_assert_equal_b(false, regular_timer_is_scheduled(timer)); bt_driver_cb_hrm_service_update_subscription(s_device_a, true); cl_assert_equal_b(true, regular_timer_is_scheduled(timer)); cl_assert_equal_i(0, s_ble_hrm_push_reminder_popup_cal...
* distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "workout.h" #include "workout_active.h" #include "workout...
dialog_show_status_bar_layer(dialog, true)
_config_provider, expandable_dialog); } x = PBL_IF_RECT_ELSE(left_margin_px, (show_action_bar) ? (frame.size.w - right_margin_px - left_margin_px - action_bar_offset - right_aligned_box_reduction - icon_size.h) : (90 - icon_size.h / 2)); y = icon_offset + PBL_IF_RECT_ELSE(0, 5); if (dialog_i...
(expandable_dialog, dialog_name)
&s_sleep_summary_settings)) { s_sleep_summary_settings.enabled = false; // worst-case, we disable the insight } if (!activity_insights_settings_read(ACTIVITY_INSIGHTS_SETTINGS_ACTIVITY_SUMMARY, &s_activity_summary_settings)) { s_activity_summary_settings.enabled = ...
{ s_sleep_pin_state.removed = true; }
} } // ------------------------------------------------------------------------------------------------ // QA Testing functions static void prv_test_push_summary_pins(void *unused) { time_t now_utc = rtc_get_time(); int minute_of_day = (20 * MINUTES_PER_HOUR) + 30; // Activity pins only trigger after 8:30 Uu...
20, 256}, { -40, 912, 256}, { -32, 920, 256}, { -32, 920, 256}, { -40, 912, 256}, { -40, 920, 264}, { -32, 920, 256}, { -32, 912, 256}, // 136 seconds { -32, 920, 256}, { -32, 912, 256}, { -40, 920, 264}, { -40, 920, 256}, { -32, 912, 256}, { -40, 912, 256}, {...
{ -40, 920, 256}, { -40, 920, 264}, { -48, 920, 248}, { -40, 912, 256}, { -40, 912, 248}, { -48, 912, 256}, { -40, 920, 248}, { -40, 920, 248}, { -40, 920, 256}, { -48, 912, 248}, { -40, 912, 256}, // 142 seconds { -48, 912, 248}, { -40, 912, 264}, { -40, 912,...
{ -40, 912, 256}, { -40, 912, 256}, { -40, 920, 248}, { -40, 912, 256}, { -40, 912, 256}, { -40, 912, 256}, { -40, 920, 256}, { -40, 912, 256}, { -40, 912, 256}, { -40, 920, 256}, { -40, 912, 256}, { -40, 912, 256}, { -40, 920, 256}, { -48, 912, 256}, { -40, ...
/* * 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_resources_init_font(0, RESOURCE_ID_GOTHIC_18_BOLD, 0, &s_font_info))
; test_graphics_context_init(&ctx, fb); setup_test_aa_sw(&ctx, fb, ctx.dest_bitmap.bounds, ctx.dest_bitmap.bounds, false, 1); prv_prepare_fb_steps(GSize(DISP_COLS, DISP_ROWS)); } void test_graphics_draw_text_flow__cleanup(void) { free(fb); gbitmap_destroy(s_dest_bitmap); s_dest_bitmap = NULL; } #defin...
/* * 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...
gbitmap_get_data_row_info(framebuffer, (uint16_t)y)
; if (!prv_clip_x_values_to_data_row_info(&current_data_row_info, &min_x, &max_x)) { return; } // Update the relevant mask row pixel values for (int x = min_x; x <= max_x; x++) { const GPoint p = GPoint(x, y); // Calculate the new mask pixel value const GColor8Component src_color_luminance = g...
he file to watch const char* name; //! Which events will invoke callbacks (see FILE_CHANGED_EVENT_ flags in pfs.h) uint8_t event_flags; //! Caller provided data pointer void *data; //! Callback pointer PFSFileChangedCallback callback; } PFSFileChangedCallbackNode; static uint8_t *s_pfs_page_flags_cache =...
{ kernel_free(s_pfs_page_flags_cache); s_pfs_page_flags_cache = NULL; }
n region_count; } bool timezone_database_load_region_info(uint16_t region_id, TimezoneInfo *tz_info) { const int region_offset = // Skip over the region count TZDATA_HEADER_BYTES + // Skip over the regions list (region_id * REGION_BYTES); //! Struct for reading data from a raw database of ...
{ return i; }
} return -1; } static int prv_search_links_by_name(const char *region_name, int region_name_length) { char name_asciz[256] = {0}; memcpy(name_asciz, region_name, region_name_length); const int link_section_offset = // Skip over the region count TZDATA_HEADER_BYTES + // Skip over the regi...
.x + 1, point.y)); graphics_draw_pixel(ctx, GPoint(point.x, point.y + 1)); graphics_draw_pixel(ctx, GPoint(point.x + 1, point.y + 1)); } else if (alpha == ALPHA_66) { graphics_context_set_stroke_color(ctx, fg_color); graphics_draw_pixel(ctx, point); graphics_draw_pixel(ctx, GPoint(point.x + 1, poi...
window_get_user_data(s_window)
; if (data->property == PROPERTY_FG_COLOR) { data->fg_color_index = (data->fg_color_index + 1) & 0x3F; data->fg_color.argb = (s_color_table[data->fg_color_index] | ALPHA_100); } else if (data->property == PROPERTY_BG_COLOR) { data->bg_color_index = (data->bg_color_index + 1) & 0x3F; data->bg_color.a...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(buffer, length)
; } i18n_get_with_buffer(string, buffer, length); } DEFINE_SYSCALL(size_t, sys_i18n_get_length, const char *string) { if (PRIVILEGE_WAS_ELEVATED) { if (pebble_task_get_current() == PebbleTask_Worker) { // not allowed from workers syscall_failed(); } if (!memory_layout_is_cstring_in_regio...