prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
result.size.w = interpolate_int16( distance_normalized, property_animation->values.from.grect.size.w, property_animation->values.to.grect.size.w); result.size.h = interpolate_int16( distance_normalized, property_animation->values.from.grect.size.h, property_animation->values.to....
{ return; }
" #include "services/normal/activity/activity.h" #include "services/normal/notifications/alerts_preferences.h" #include "services/normal/notifications/alerts_preferences_private.h" #include "services/normal/timeline/calendar.h" #include "syscall/syscall_internal.h" #include "system/logging.h" #include "system/passert.h...
(prv_try_update_schedule_mode, (void*)(uintptr_t) clear_manual_override)
; } static void prv_update_schedule_mode_timer_callback(void* not_used) { prv_try_update_schedule_mode_callback(true); } static DoNotDisturbScheduleType prv_current_schedule_type(void) { struct tm time; rtc_get_time_tm(&time); return ((time.tm_wday == Saturday || time.tm_wday == Sunday) ? WeekendSch...
t_bytes_receiver_impl.write(r, data, length); g_put_bytes_receiver_impl.finish(r); } else { PBL_LOG(LOG_LEVEL_ERROR, "No receiver returned!"); } } static void prv_receive_init(uint32_t total_size, PutBytesObjectType object_type) { InitRequest init_msg = (InitRequest) { .cmd = CmdInit, .total_size...
(s_last_response_cookie, EXPECTED_CRC)
/* * 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, GPoint(50, 40), GPoint(70, 35))
; } void across_nx_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_context_set_stroke_width(ctx, 10); graphics_context_set_antialiased(ctx, false); graphics_draw_line(ctx, GPoint(-25, 35), GPoint(15, 40)); } void across_y_layer_update_callback(La...
cl_assert_equal_p(l.flow_data.perimeter.impl, g_perimeter_for_display); cl_assert_equal_i(l.flow_data.perimeter.inset, 123); } void test_text_layout__create_destroy(void) { GTextAttributes *attributes = graphics_text_attributes_create(); cl_assert_equal_p(attributes->font, NULL); cl_assert_equal_i(attribute...
process_manager_compiled_with_legacy2_sdk()
) { // Test negative spacing graphics_text_layout_set_line_spacing_delta((void*)&layout, (-FONT_HEIGHT)); graphics_text_layout_get_max_used_size(&gcontext, "JR Whopper 123", font, box, GTextOverflowModeWordWrap, GTextAlignmentLeft, (void*)&layout); cl_assert_equal_i(layout.max_used_size.w, 4 * HORIZ_ADV...
/* * 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 (reel && reel->impl->get_elapsed) { return reel->impl->get_elapsed(reel); } return 0; }
x40, 0x9e, 0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0x01}, .timestamp = 1, .duration = 0, .type = TimelineItemTypePin, .layout = LayoutIdTest, // don't care about the rest } }; static TimelineItem item2 = { .header = { .id = {0x55, 0xcb, 0x7c, 0x75, 0x8a, 0x35, 0x44, 0x87, ...
(&item, &item1.header.id)
); cl_assert_equal_i(item.header.status, 0); cl_must_pass(pin_db_set_status_bits(&item1.header.id, TimelineItemStatusDismissed)); cl_must_pass(pin_db_read_item_header(&item, &item1.header.id)); cl_assert_equal_i(item.header.status, TimelineItemStatusDismissed); }
Point(2, 5)); GPointPrecise pointP_c = GPointPrecise((2 % GPOINT_PRECISE_MAX) << GPOINT_PRECISE_PRECISION, (5 % GPOINT_PRECISE_MAX) << GPOINT_PRECISE_PRECISION); cl_assert(gpointprecise_equal(&pointP, &pointP_c)); GVectorPrecise vectorP = GVectorPreciseFromGVector(GVec...
cl_assert(gtransform_is_equal(&t1, &t_c))
; // Test concatenation of two non-identity matrices t1 = GTransformFromNumbers(3, 5, 7, 11, 13, 17); t2 = GTransformFromNumbers(1, 2, 3, 4, 5, 6); t_c = GTransformFromNumbers(18, 26, 40, 58, 69, 100); gtransform_concat(&t_new, &t1, &t2); cl_assert(gtransform_is_equal(&t_new, &t_c)); } void test_grap...
t_equal_i(test_value, set_value); // Destroy it animation_destroy(h); #endif } // -------------------------------------------------------------------------------------- // Test a basic gpoint property animation void test_animation__property_gpoint(void) { #ifdef TEST_INCLUDE_BASIC PropertyAnimation *prop_h; ...
animation_schedule(h)
; // Test the accessor functions GTransform test_value; property_animation_get_from_gtransform(prop_h, &test_value); cl_assert_equal_gtransform(test_value, start_value); property_animation_get_to_gtransform(prop_h, &test_value); cl_assert_equal_gtransform(test_value, end_value); GTransform set_value; ...
/* * 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 (!process_manager_compiled_with_legacy2_sdk() && menu_layer->scroll_layer.animation) { Animation *scroll_layer_animation = property_animation_get_animation(menu_layer->scroll_layer.animation); animation_set_elapsed(scroll_layer_animation, animation_get_duration(scroll_layer_...
se TimelineItemActionTypeAncsDial: { const char *caller_id = attribute_get_string(&item->attr_list, AttributeIdTitle, "Unknown"); prv_put_outgoing_call_event(item->header.ancs_uid, caller_id); notifications_handle_notification_action_result(NULL);...
info->get_val(file, (uint8_t *)&header, sizeof(CommonTimelineItemHeader))
; // Flags & Status are stored inverted. header.flags = ~header.flags; header.status = ~header.status; // Count up the calendar pins and other (non-system) pins that are currently visible on timeline PinAnalyticsInfo *analytics_info = context; if (prv_is_in_window(header.timestamp, header.duration, analyti...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
bt_device_equal(&a->identity.opaque, &b->identity.opaque)
DC_V18_IDLE_HYST, 0x4); REG_SETF(DCDC, DCDC_V18_1_REG, DCDC_V18_IDLE_MIN, 0x10); REG_SETF(DCDC, DCDC_VDD_0_REG, DCDC_VDD_FAST_RAMPING, 0x1); REG_SETF(DCDC, DCDC_VDD_0_REG, DCDC_VDD_VOLTAGE, 0x10); REG_SETF(DCDC, DCDC_VDD_0_REG, DCDC_VDD_CUR_LIM_MAX_HV, 0x18); REG_SETF(DCDC, DCDC_VDD_0_REG, DCDC_VDD_CUR_LIM_M...
REG_SETF(CRG_TOP, FORCE_SLEEP_REG, FORCE_FTDF_SLEEP, 0x0)
; // GUESS REG_SETF(CRG_TOP, LDOS_DISABLE_REG, LDOS_DISABLE, 0x0); // GUESS REG_SETF(CRG_TOP, AON_SPARE_REG, OSC16_HOLD_AMP_REG, 0x0); // GUESS REG_SETF(CRG_TOP, AON_SPARE_REG, OSC16_SH_DISABLE, 0x0); // GUESS REG_SETF(CRG_TOP, AON_SPARE_REG, EN_BATSYS_RET, 0x0); // GUESS REG_SETF(CRG_TOP, AON_SPARE_REG, EN...
/* * 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...
app_state_get_user_data()
; number_window_destroy(data); } static void s_main(void) { handle_init(); app_event_loop(); handle_deinit(); } const PebbleProcessMd* vibe_score_demo_get_info() { static const PebbleProcessMdSystem s_vibe_score_info = { .common.main_func = s_main, .name = "Vibe Patterns" }; return (const Pebble...
callback_context) { AlarmsAppData *data = (AlarmsAppData *)callback_context; AlarmNode *new_node = task_malloc_check(sizeof(AlarmNode)); list_init((ListNode*) new_node); new_node->id = id; new_node->info = *info; memcpy(&new_node->scheduled_days, info->scheduled_days, sizeof(new_node->scheduled_days)); n...
{ return cell_index->row == 0; }
static uint16_t prv_alarm_list_get_num_sections_callback(struct MenuLayer *menu_layer, void *callback_context) { return 1; } static uint16_t prv_alarm_list_get_num_rows_callback(struct MenuLayer *menu_layer, ...
or one of it's children, and if so advance it if (!top_level_animation || animation == top_level_animation || prv_is_descendent_of(state, animation, top_level_animation)) { ANIMATION_LOG_DEBUG("advancing animation %d to %"PRIu32" ms", (int)animation->handle, now - ...
{ if (!used_children[i]) { continue; } // Undo setting of the parent and child_idx on the components we modified. AnimationPrivate *component = prv_find_animation_by_handle(state, animation_array[i], false /*quiet*/); ...
prv_unlink_and_free(state, parent); parent_h = NULL; } return parent_h; } // ------------------------------------------------------------------------------------------- static Animation *prv_complex_create(Animation **animation_array, uint32_t array_len, AnimationTyp...
/* * 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; }
text_layer_deinit(text_layer); applib_free(text_layer); } void text_layer_deinit(TextLayer *text_layer) { PBL_ASSERTN(text_layer); layer_deinit(&text_layer->layer); graphics_text_layout_cache_deinit(&text_layer->layout_cache); text_layer->layout_cache = NULL; } Layer* text_layer_get_layer(TextLayer *text...
GColor color) { PBL_ASSERTN(ctx); if (ctx->lock) { return; } #if PBL_BW color = gcolor_get_bw(color); #else color = gcolor_closest_opaque(color); #endif ctx->draw_state.stroke_color = color; } void graphics_context_set_stroke_color_2bit(GContext* ctx, GColor2 color) { graphics_context_set_...
graphics_capture_frame_buffer_format(ctx, GBITMAP_NATIVE_FORMAT)
; } #include "system/profiler.h" MOCKABLE bool graphics_release_frame_buffer(GContext *ctx, GBitmap *buffer) { PBL_ASSERTN(ctx); GBitmap *native_framebuffer = graphics_context_get_bitmap(ctx); if (gbitmap_get_format(buffer) != GBITMAP_NATIVE_FORMAT) { ctx->lock = false; bitblt_bitmap_into_bitmap(native_f...
)); cl_assert_equal_i(BITS_BETWEEN(0, 0), erased_sector); cl_assert(flash_locked); } void test_system_flash__erase_16KB_sectors(void) { cl_assert(system_flash_erase(FLASH_BASE, 48 KiB, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(0, 2), erased_sector); cl_assert(flash_locked); } void callback_is_called_cb(u...
(stderr, "0x%.08x", num)
; } extern void dbgserial_putstr(char *str) { fprintf(stderr, "%s\n", str); }
} // Look for and parse the expected values if (strcmp(token, "//>") == 0) { token = strtok(NULL, " \t\n"); if (strcmp(token, "TEST_EXPECTED") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.exp_steps); } else if (strcmp(token, "TEST_EXPECTED_MIN") == 0) { ...
if (strcmp(token, "TEST_VERSION") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.version); } else if (strcmp(token, "TEST_TOTAL") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.total.value); } else if (strcmp(token, "TEST_TOTAL_MIN") == 0) { s...
sscanf(token + strlen(token) + 1, "%d", &state->test_entry.end_at.min); } else if (strcmp(token, "TEST_END_AT_MAX") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.end_at.max); } else if (strcmp(token, "TEST_CUR_STATE_ELAPSED") == 0) { sscanf(token + strlen(toke...
/* * 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_fill_color(ctx, GColorClear)
; graphics_fill_round_rect(ctx, &GRect(2, 2, 28, 20), 4, GCornersAll); } void corners_clipped_update_callback(Layer* me, GContext* ctx) { graphics_context_set_antialiased(ctx, false); graphics_context_set_fill_color(ctx, GColorBlack); graphics_fill_round_rect(ctx, &GRect(-19, 0, 20, 20), 4, GCornersAll); } vo...
ompositor_render_modal(); ctx->draw_state.drawing_box.origin = drawing_box_origin; } const int32_t s_small_movement_size = DISP_COLS * 0.042; // 6 on snowy const int32_t s_large_movement_size = DISP_COLS * 0.14; // 20 on snowy const int32_t s_upwards_movement_size = DISP_ROWS * 0.18; // 30 on snowy static void prv_...
(s_data.second_anim, AnimationCurveEaseOut)
:00 on Thursday. (7.0 hours) cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 25200 * MS_PER_SECOND); // Check that there is a timer scheduled cl_assert(stub_new_timer_is_scheduled(get_dnd_timer_id())); do_not_disturb_set_schedule_enabled(WeekdaySchedule, false); active = do_not_disturb_is_activ...
(get_dnd_timer_id())
, 43200 * MS_PER_SECOND); } void test_do_not_disturb__toggle_manually_enabled(void) { bool active, enabled; cl_assert(do_not_disturb_is_smart_dnd_enabled() == false); cl_assert(do_not_disturb_is_manually_enabled() == false); cl_assert(do_not_disturb_is_schedule_enabled(WeekdaySchedule) == false); cl_assert(...
" #include "services/common/hrm/hrm_manager.h" #include "services/normal/filesystem/pfs.h" #include "services/common/system_task.h" #include "services/normal/accessory/smartstrap_attribute.h" #include "services/normal/app_cache.h" #include "services/normal/data_logging/data_logging_service.h" #include "services/normal/...
{ PebbleEvent event = { .type = PEBBLE_PROCESS_KILL_EVENT, .kill = { .gracefully = gracefully, .task = task, }, }; // When we have decided to exit the app, // it doesn't need to process any queued accel data // or other services before exiting, so clear the to_process_event_queue Pr...
t_nack_upon_oom(void) { fake_malloc_set_largest_free_block(1024); // PutBytes allocates ~2K prv_receive_init(1024 * 1024, ObjectFirmware); fake_malloc_set_largest_free_block(~0); assert_ack_count(0); assert_nack_count(1); } ///////////////////////////////////////////////////////////////////////////////////...
cl_assert_equal_i(event.put_bytes.bytes_transferred, sizeof(chunk))
; cl_assert_equal_i(event.put_bytes.progress_percent, 100 * sizeof(chunk) / VALID_OBJECT_SIZE); cl_assert_equal_b(event.put_bytes.failed, false); } static uint32_t s_next_value_to_write; static void prv_cb_before_write(void) { prv_receive_put(s_last_response_cookie, (uint8_t *)&s_next_value_to_write, VALID_OBJEC...
(&data->certification_data.fcc_mark)
; gbitmap_deinit(&data->certification_data.kcc_mark); gbitmap_deinit(&data->certification_data.ce_mark); gbitmap_deinit(&data->certification_data.weee_mark); gbitmap_deinit(&data->certification_data.r_mark); gbitmap_deinit(&data->certification_data.t_mark); gbitmap_deinit(&data->certification_data.aus_rcm_m...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (found) { found->more_recent = NULL; *cur_ptr = found; return (found->data); } else { return (NULL); }
end_workout(active_window); } static void prv_up_click_handler(ClickRecognizerRef recognizer, void *context) { WorkoutActiveWindow *active_window = context; if (active_window->pause_button == BUTTON_ID_UP) { prv_handle_pause_button(active_window); } } static void prv_select_click_handler(ClickRecognizerRef...
(&active_window->top_metric_layer, prv_static_layer_update_proc)
; layer_add_child(&active_window->base_layer, &active_window->top_metric_layer); } else if (active_window->layout == WorkoutLayout_StaticAndScrollable) { // Two metrics. 1 big static metric above a smaller scrollable metric GRect top_metric_bounds = base_layer_bounds; top_metric_bounds.size.h = PBL_IF...
if (!state->cache) { return NULL; } switch (metric) { case HealthMetricHeartRateBPM: // If already registered, it's an error since we only have room for one registration per // metric right now if (state->cache->alert_threshold_heart_rate.threshold != 0) { APP_LOG(APP_LOG_LEVEL_IN...
{ return 0; }
if (time_end) { *time_end = *time_start + SECONDS_PER_MINUTE * num_records; } return num_records; #endif } // ---------------------------------------------------------------------------------------------- HealthActivityMask health_service_peek_current_activities(void) { #if !CAPABILITY_HAS_HEALTH_TRACKING...
dy_connected = true; is_already_encrypted = connection->is_encrypted; local_is_master = connection->local_is_master; connected_device = &connection->device; } intent = prv_get_intent_by_bonding_id(request->bonding.id); } else { is_already_connected = gap_le_connection_is_connected(reque...
{ // Disconnect the device because no one is using it const int result = bt_driver_gap_le_disconnect(device); if (result != 0) { PBL_LOG(LOG_LEVEL_ERROR, "Ble disconnect failed: %d", result); } }
else { if (prv_is_intent_using_whitelist(intent)) { // Remove from white-list: prv_mutate_whitelist_safely(device, false /* remove */); } } } if (should_send_disconnection_event) { // Send virtual disconnection event: const PebbleTaskBitset task_mask = ~gap_le_pebble_task_b...
rvice_begin(AppInboxServiceTagUnitTest, BUFFER_SIZE, s_writer)); cl_assert_equal_b(false, app_inbox_service_is_being_written_for_tag(AppInboxServiceTagUnitTest)); } void test_app_inbox__app_inbox_service_begin_already_being_written(void) { prv_create_test_inbox();...
(AppInboxServiceTagUnitTest)
; cl_assert_equal_i(1, app_inbox_service_num_success_for_tag(AppInboxServiceTagUnitTest)); cl_assert_equal_i(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_...
/* * 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...
WITHIN(block_addr, SECTOR_SIZE_BYTES, BOARD_NOR_FLASH_SIZE - SECTOR_SIZE_BYTES - 1)
) { // Middle of flash has 64k lock units block_addr = flash_impl_get_sector_base_address(block_addr); block_size = SECTOR_SIZE_BYTES; } else { // Start and end of flash have 1 sector of 4k lock units block_addr = flash_impl_get_subsector_base_address(block_addr); block_size = SU...
EEP_SUMMARY_PIN_CONFIG); } // ----------------------------------------------------------------------------------------- static bool prv_push_sleep_summary_pin(time_t now_utc, time_t pin_time_utc, int32_t sleep_enter_seconds, int32_t sleep_exit_seconds, ...
("I need more")
, }; TimelineItem *item = prv_create_pin_with_response_items( session->start_utc, now_utc, session->length_min, LayoutIdWeather, &pin_attr_list, HealthCardType_Sleep, num_responses, response_items); kernel_free(response_items); kernel_free(time_range); kernel_free(end_time); kernel_free(start_...
const struct clar_func *test_funcs = suite->tests; const struct clar_func *test = NULL; for (int i = 0; i < suite->test_count; i++) { if (!strcmp(test_funcs[i].name, test_name)) { test = &test_funcs[i]; break; } } if (test == NULL) { clar_print_onabor...
clar__assert(0, file, line, err, buf, should_abort)
; } } void clar__assert_equal_d( double d1, double d2, const char *file, int line, const char *err, int should_abort) { if (d1 != d2) { char buf[128]; snprint_eq(buf, 128, "%f != %f", d1, d2); clar__assert(0, file, line, err, buf, should_abort); } } void clar__assert_within( int n, ...
_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); // Second alarm goes off. No alarms should be up s_current_hour = 11; s_current_minute = 30; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 2); prv_assert_alarm_config(id2, 11, 30, true, ALARM_KIND_JUST_ONCE, just_once_schedule...
(id2, 11, 30, false, ALARM_KIND_CUSTOM, schedule_1)
; cl_assert_equal_i(s_num_timeline_adds, 2); // First alarm goes off. Second one should be up s_current_hour = 10; s_current_minute = 30; s_current_day = s_saturday; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 1); cl_assert_equal_i(s_num_alarm_events_put, 1); cl_assert_equal_i(s_num_...
d uuid[2]; uuid[0] = UuidMakeFromBEBytes(uuid_bytes); uuid[1] = UuidMakeFromLEBytes(uuid_bytes); // just reversed, laziness // 2x 128-bit UUIDs is not going to fit, expect false: cl_assert_equal_b(ble_ad_set_service_uuids(ad, uuid, 2), false); // Hand-construct expected raw advertisement data: uint8_t exp...
ble_ad_destroy(ad)
; } void test_ble_ad_parse__set_manufacturer_specific_data(void) { BLEAdData *ad; ad = ble_ad_create(); uint8_t expected_ad_data[] = { 1 /* +1 for Type byte */ + 13 /* Company ID + data */, 0xff, // Manufacturer Specific data 0x34, 0x12, 'h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd', }...
de "clar.h" // Stubs //////////////////////////////////// #include "stubs_analytics.h" #include "stubs_logging.h" #include "stubs_passert.h" #include "stubs_prompt.h" #include "stubs_serial.h" #include "fake_new_timer.h" #include "fake_battery.h" #include "fake_system_task.h" #include "fake_rtc.h" #include "kernel/ev...
( 5000, false, scaling_factor)
; int32_t delta_percent = end_percent - start_percent; cl_assert(delta_percent > (INT32_MAX - 100)); delta_percent = start_percent - end_percent; cl_assert(delta_percent < (INT32_MIN + 100)); } // Check that the percentage reported is somewhat protected from transient voltage changes void test_battery_monito...
opy if (left <= length) { goto _out_of_size; } memcpy(dest_str, fmt, length); dest_str += length; left -= length; fmt = ptr + 1; // End of string if (*ptr == '\0' || *fmt == '\0') { break; } char pad = '\0'; size_t width = 0; // Process flags // These a...
FMT_INTCOPY(prv_iso8601_year(t) % 100, 2, INTFMT_PADZERO)
; break; case 'G': // TZ FMT_INTCOPY(prv_iso8601_year(t), 4, INTFMT_PADZERO); break; case 'H': FMT_INTCOPY(t->tm_hour, 2, INTFMT_PADZERO); break; case 'I': FMT_INTCOPY(hour_12h, 2, INTFMT_PADZERO); break; case 'j': FMT_INTCOPY(t->tm...
case RockyArgTypeUInt16: *((uint16_t *)dest_ptr) = val; return true; case RockyArgTypeUInt32: *((uint32_t *)dest_ptr) = val; return true; case RockyArgTypeUInt64: *((uint64_t *)dest_ptr) = val; return true; case RockyArgTypeInt8: *((int8_t *)dest_ptr) = val; ...
{ if (rocky_api_graphics_color_from_value(argv[0], (GColor *)binding->ptr)) { return true; } *value_error_out = (RockyArgValueCheckError) { .error_msg = COLOR_ERROR_MSG, .arg_offset = 0, }; return false; }
static bool prv_check_type_is_number(const jerry_value_t argv[], RockyArgTypeCheckError *type_error_out) { if (jerry_value_is_number(argv[0])) { return true; }; *type_error_out = (RockyArgTypeCheckError) { .expected_type_name = ECMA_STRING_TYPE_NUMBER, .arg_offs...
th; 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); #endif width = window_width; break; case ...
(0, -2, width, 30)
; #endif #if PLATFORM_ROBERT || PLATFORM_CALCULUS layer_set_frame(&data->info_text_mask_layer, &GRect(x_offset, info_text_y_offset, width, 30)); #else layer_set_frame(&data->info_text_mask_layer, &GRect(x_offset, info_text_y_offset, width, 26)); #endif layer_set_clips(&data->info_text_mask_layer, true); 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...
cl_assert_equal_i(average_ms, 1000)
; // valid interval fake_rtc_increment_time_ms(1020); interval_timer_take_sample(&timer); num_intervals = interval_timer_get(&timer, &average_ms); cl_assert_equal_i(num_intervals, 2); cl_assert_equal_i(average_ms, 1010); // invalid interval, too high fake_rtc_increment_time_ms(1220); interval_timer...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ dls_list_for_each_session(prv_send_session, (void*) empty_all_data); }
>view_model.cur_level->parent_level == anim_ctx->next_level) { --data->view_model.num_dots; } else { ++data->view_model.num_dots; } data->view_model.cur_level = anim_ctx->next_level; // update the view prv_view_model_did_change(data); applib_free(anim_ctx); } static GEdgeInsets prv_action_menu_ins...
(data, parent_level)
; } else { prv_action_window_pop(true, &data->action_menu); } } static void prv_click_config_provider(void *context) { ActionMenuData *data = context; action_menu_layer_click_config_provider(&data->action_menu_layer); window_single_click_subscribe(BUTTON_ID_BACK, prv_back_click_handler); window_set_cli...
EFAULT_EFFECT_DURATION, .stroke_width = { .from = FIXED_S16_3_ONE, .to = FIXED_S16_3_ONE, .from_op = GStrokeWidthOpMultiply, .to_op = GStrokeWidthOpMultiply, }, }; KinoReel *reel = kino_reel_transform_create(&SCALE_SEGMENTED_TRANSFORM_IMPL, data); if (reel) { kino_reel_transfo...
{ data->stroke_width.curve = curve; }
} static AnimationProgress prv_ease_in_out_last_half(AnimationProgress progress) { return animation_timing_curve(animation_timing_clip(2 * (progress - ANIMATION_NORMALIZED_MAX / 2)) , AnimationCurveEaseInOut); } void kino_reel_scale_segmented_set_end_as_dot(KinoReel *reel, int16_t radius) { GRect frame = k...
nclude "util/math.h" #include "util/net.h" #include <string.h> #define ACCEL_LOG_DEBUG(fmt, args...) PBL_LOG_D(LOG_DOMAIN_ACCEL, LOG_LEVEL_DEBUG, fmt, ## args) static bool s_initialized; static PebbleMutex * s_accel_mutex; static uint32_t s_sampling_interval_ms = 0; static const AccelRawData s_default_sample = { ...
ACCEL_LOG_DEBUG(" x,y,z from host: %d, %d, %d", s_rcv_buffer[i].x, s_rcv_buffer[i].y, s_rcv_buffer[i].z)
; } // If we have any samples at all, make sure the timer is running. This is // required in order to feed the data at the right speed for peek mode. if (!s_timer_running && s_num_rcv_samples > 0) { prv_reschedule_timer(); } } mutex_unlock(s_accel_mutex); // Send a response, even thoug...
ed_complete(GETTING_STARTED_COMPLETE); shared_prf_storage_set_local_device_name(DEVICE_NAME); char device_name_out[BT_DEVICE_NAME_BUFFER_SIZE]; // Check pairing info SMPairingInfo pairing_info_out; bool requires_address_pinning = false; uint8_t flags = 0; shared_prf_storage_get_ble_pairing_data(&pairing...
(shared_prf_storage_get_getting_started_complete(), false)
; // Should have moved to the next page cl_assert_equal_b(shared_prf_storage_get_valid_page_number(), 1); // Let's do it again, but move the valid page to index NUM_PAGES - 1 so we force a wrap around fake_spi_flash_erase(); shared_prf_storage_set_valid_page_number(SPRF_NUM_PAGES - 1); shared_prf_storage_s...
s(length); prv_config_indirect_read(dev, instruction, addr, dummy_cycles, is_ddr); prv_read_bytes(buffer, length); QSPI_ClearFlag(QSPI_FLAG_TC); prv_wait_for_not_busy(); } void qspi_indirect_read_no_addr(QSPIPort *dev, uint8_t instruction, uint8_t dummy_cycles, void *buffer, ...
prv_indirect_write(dev, instruction, QSPI_ADDR_NO_ADDR, buffer, length)
; } void qspi_indirect_write(QSPIPort *dev, uint8_t instruction, uint32_t addr, const void *buffer, uint32_t length) { prv_indirect_write(dev, instruction, addr, buffer, length); } void qspi_indirect_write_no_addr_1line(QSPIPort *dev, uint8_t instruction) { prv_set_ddr_enabled(false); ...
/* * 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...
(0x8fbc8f)
}, {"darkslateblue", GColorARGB8FromHEX(0x483d8b)}, {"darkslategray", GColorARGB8FromHEX(0x2f4f4f)}, {"darkslategrey", GColorARGB8FromHEX(0x2f4f4f)}, {"darkturquoise", GColorARGB8FromHEX(0x00ced1)}, {"darkviolet", GColorARGB8FromHEX(0x9400d3)}, {"deeppink", GColorARGB8FromHEX(0xff1493)}, {"deepskyblue", 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...
(af_config.gpio, af_config.gpio_pin_source, af_config.gpio_af)
; gpio_release(af_config.gpio); }
sh_locked); } void test_system_flash__erase_16KB_sectors(void) { cl_assert(system_flash_erase(FLASH_BASE, 48 KiB, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(0, 2), erased_sector); cl_assert(flash_locked); } void callback_is_called_cb(uint32_t num, uint32_t den, void *context) { callback_called = true; cl_...
{ fprintf(stderr, "%s\n", str); }
* 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 "applib/graphics/graphics.h" #include "applib/graphics/framebuffer.h" #include "applib/ui/window_private.h" #include "appli...
(&layer, &across_y_layer_update_callback)
; layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_across_y_origin_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_ny_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_...
s_sleep_mode_allowed = true; #endif typedef struct { uint32_t active_count; RtcTicks ticks_when_stop_mode_disabled; RtcTicks total_ticks_while_disabled; } InhibitorTickProfile; // Note: These variables should be protected within a critical section since // they are read and modified by multiple threads static I...
if (s_inhibitor_profile[inhibitor].active_count == 0) { s_inhibitor_profile[inhibitor].total_ticks_while_disabled += rtc_get_ticks() - s_inhibitor_profile[inhibitor].ticks_when_stop_mode_disabled; }
portEXIT_CRITICAL(); } bool stop_mode_is_allowed(void) { #if PBL_NOSTOP return false; #else return s_num_items_disallowing_stop_mode == 0; #endif } void sleep_mode_enable(bool enable) { s_sleep_mode_allowed = enable; } bool sleep_mode_is_allowed(void) { #ifdef PBL_NOSLEEP return false; #endif return s_s...
264, 968, -160}, { 184, 680, -120}, { 272, 720, -96}, { 400, 688, -128}, { 432, 560, -40}, { 664, 584, 48}, { 808, 520, 24}, { 944, 392, 72}, { 1200, 296, 112}, { 1784, 224, 272}, { 1832, 464, 312}, { 1392, 720, -104}, { 808, 680, -120}, { 712, 248, 216}, { 704, 1...
{ 944, 352, 144}, { 776, 208, 152}, { 784, 144, 144}, // 8 seconds { 800, 184, 136}, { 840, 368, -16}, { 768, 336, -48}, { 936, 384, -40}, { 1128, 496, -160}, { 1392, 360, 120}, { 2160, 408, 192}, { 1240, 360, 120}, { 976, 256, 56}, { 1088, 216, 184}, { 1264, ...
xt_layer; char url_text_buffer[URL_BUFFER_SIZE]; bool is_showing_version; TextLayer name_text_layer; char name_text_buffer[NAME_BUFFER_SIZE]; AppTimer *spinner_close_timer; //! Is the mobile app currently connected (comm session is up?) bool is_pebble_mobile_app_connected; //! Has the mobile app ever ...
if (first_use_is_complete || data->has_pebble_mobile_app_connected) { // If first use was completed, it means we're in recovery mode. icon_res_id = RESOURCE_ID_LAUNCH_APP; #if PLATFORM_ROBERT || PLATFORM_CALCULUS icon_x_offset = 41; icon_y_offset = -21; text_y_offset = 140; #else icon_x_offset =...
if (first_use_is_complete) { #if PBL_BW && !PLATFORM_TINTIN // Override the icon to use the fullscreen version icon_res_id = RESOURCE_ID_RECOVERY_LAUNCH_APP; icon_x_offset = 0; icon_y_offset = 0; url_string = ""; // URL is baked into the background image background = GColorWhite; #else ...
/* * 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...
gcolor_get_grayscale(color)
; for (unsigned int row_number = 0; row_number < ARRAY_LENGTH(*look_up); row_number++) { (*look_up)[row_number].palette_pattern[palette_index] = graphics_private_get_1bit_grayscale_pattern(color, row_number); (*look_up)[row_number].transparent_mask[palette_index] = gcolor_is_transparent(...
ity_sessions = ACTIVITY_MAX_ACTIVITY_SESSIONS_COUNT; if (!activity_get_sessions(&health_data->num_activity_sessions, health_data->activity_sessions)) { PBL_LOG(LOG_LEVEL_ERROR, "Fetching activity sessions failed"); } else { ActivitySession *previous_session = NULL; for (unsi...
(health_data, today_min / k_minutes_per_step_avg)
/* * 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...
shared_prf_storage_get_bt_classic_pairing_data(&addr, &name[0], &link_key, &platform_bits)
0, 280, 0}, { 1296, 352, -8}, { 1176, 400, 0}, { 1136, 408, 8}, { 1528, 472, -24}, { 1288, 560, -56}, { 1304, 688, -80}, { 936, 888, -256}, { 1008, 480, -240}, { 888, 536, -104}, { 1184, 952, -104}, { 1944, 1064, 80}, { 1976, 792, 664}, { 1824, 144, 224}, // 43 se...
{ 1360, 336, 40}, { 1120, 288, -80}, { 944, 224, -48}, { 1128, 344, -72}, { 1304, 376, 8}, { 1296, 352, 40}, { 1152, 384, 80}, { 1584, 448, 200}, { 1512, 656, 368}, { 1016, 808, 88}, { 1232, 880, -32}, { 904, 704, -40}, { 864, 600, 40}, { 912, 648, 48}, { 1224...
{ 1088, 504, 0}, { 1384, 536, 16}, { 1424, 424, 40}, { 1296, 336, 72}, { 1256, 144, 176}, // 51 seconds { 1264, 152, 64}, { 1160, 168, -16}, { 960, 232, -56}, { 856, 208, -8}, { 1104, 224, 0}, { 992, 224, -72}, { 1296, 176, 32}, { 1000, 104, 104}, { 1160, 200...
s as zero) snprintf(dstbuf, 256, "%.dzero%.d", 0, 1); cl_assert_equal_s(dstbuf, "zero1"); // Minimum digits output (negative digits, acts as zero) snprintf(dstbuf, 256, "%.-3dzero%.-3d", 0, 1); cl_assert_equal_s(dstbuf, "zero1"); // Minimum digits output (non-zero digits outputting zero) snprintf(dstbuf...
(dstbuf, 256, "%hhi,%hi,%i,%li", hurf, hurf, hurf, hurf)
; cl_assert_equal_s(dstbuf, "-16,-8464,-1698898192,-1698898192"); snprintf(dstbuf, 256, "%lli,%ji", hurf, hurf); cl_assert_equal_s(dstbuf, "1311768467463790320,1311768467463790320"); snprintf(dstbuf, 256, "%zi,%ti", hurf, hurf); cl_assert_equal_s(dstbuf, "-1698898192,-1698898192"); } void test_sprintf__perce...
ense 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 "services/normal/notifications/do_not_disturb.h" #include "applib/ui/action_toggle....
strlen("dndManuallyEnabled")
, (void*)&expected_value, sizeof(bool)); } /////////////////////////////////////////////////////////////////////////////////////////////////// //! Tests void test_do_not_disturb__initialize(void) { fake_spi_flash_init(0, 0x1000000); pfs_init(false); pfs_format(false); rtc_set_time...
id) { cl_assert(system_flash_erase(FLASH_BASE, 128 KiB, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(0, 4), erased_sector); cl_assert(flash_locked); } void test_system_flash__erase_full_flash(void) { cl_assert(system_flash_erase(FLASH_BASE, 1024 KiB, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(0, 7), erased...
cl_assert_(address >= flash_data_start && address < flash_data_start + flash_data_length, "Address out of range")
; cl_assert_(flash_written_flag[address - flash_data_start] == false, "Overwriting an already-written byte"); if (return_status == FLASH_COMPLETE) { flash_written_data[address - flash_data_start] = data; } return return_status; } extern void dbgserial_print(char *str) { fprintf(stderr, "%s",...
B8}, {"indigo", GColorIndigoARGB8}, {"electricultramarine", GColorElectricUltramarineARGB8}, {"armygreen", GColorArmyGreenARGB8}, {"darkgray", GColorDarkGrayARGB8}, {"liberty", GColorLibertyARGB8}, {"verylightblue", GColorVeryLightBlueARGB8}, {"kellygreen", GColorKellyGreenARGB8}, {"maygreen", GColorMay...
prv_parse_hex_comps(color_value + 1, 2, &r, &g, &b, NULL)
) { *parsed_color = GColorFromRGB(r, g, b); return true; } } case 9: { // #RRGGBBAA if (prv_parse_hex_comps(color_value + 1, 2, &r, &g, &b, &a)) { *parsed_color = GColorFromRGBA(r, g, b, a); if (parsed_color->a == 0) { *parsed_color = GColorClear; } ...
ph_UART4 | RCC_APB1Periph_UART5 | RCC_APB1Periph_I2C1 | RCC_APB1Periph_I2C2 | RCC_APB1Periph_I2C3 | RCC_APB1Periph_CAN1 | RCC_APB1Periph_CAN2 | RCC_APB1Periph_PWR | RCC_APB1Periph_DAC | RCC_APB1Periph_UART7 | RCC_APB1Periph_UART8; const uint32_t apb2_periphs = RCC_APB2Periph_TIM1 | RCC_APB2Periph_...
{ dbgserial_putstr("Watchdog caused a reset"); }
.frame.size.w, layer.frame.size.h); // Unschedule after 2 iterations if (num_loops == 2) { DPRINTF("%"PRIu64": Unscheduling now\n", prv_now_ms()); animation_unschedule(h); stopped_at_r = layer.frame; unschedule_time = prv_now_ms(); } } // Make sure the frame stopped at ...
memset(&layer, 0, sizeof(layer))
; from_r = GRect(0, 0, 100, 200); // x, y, width, height to_r = GRect(1000, 2000, 100, 200); // x, y, width, height prop_h = property_animation_create_layer_frame(&layer, &from_r, &to_r); Animation *h = property_animation_get_animation(prop_h); void *context = &layer; animation_set_handlers(h, handlers,...
nuCellDimensions; static const MenuCellDimensions s_menu_cell_dimensions[NumPreferredContentSizes] = { //! @note these are the same as Medium until Small is designed [PreferredContentSizeSmall] = { .basic_cell_height = 44, .small_cell_height = 34, .horizontal_inset = 5, .title_subtitle_left_margin ...
{ // icon on left box.origin.x += ((config->icon->bounds.size.w & 1) + // Nudge odd-width icons one right ((s_icon_size.w - config->icon->bounds.size.w) / 2)); }
box.origin.y += (s_icon_size.h - config->icon->bounds.size.h) / 2; } else { const GRect container_rect = grect_inset(*bounds, GEdgeInsets(vertical_margin, horizontal_margin)); grect_align(&box, &container_rect, icon_align, true /* clip */); if ((icon_align == GAlignTopLeft) || (ic...
rdings){0}; s_graphics_context_set_stroke_width = (MockCallRecordings){0}; s_graphics_context_set_fill_color = (MockCallRecordings){0}; s_graphics_fill_rect = (MockCallRecordings){0}; s_graphics_fill_rect__color = GColorClear; s_graphics_draw_rect_precise = (MockCallRecordings){0}; s_graphics_fill_radial_pr...
("uol", 5)
; ASSERT_JS_GLOBAL_EQUALS_I("uot", 6); ASSERT_JS_GLOBAL_EQUALS_I("uow", 7); ASSERT_JS_GLOBAL_EQUALS_I("uoh", 8); } static const jerry_value_t prv_global_init_and_set_ctx(void) { rocky_global_init(s_graphics_api); // make this easily testable by putting it int JS context as global Layer l = {.bounds = GRec...
.draw_text.box); } void test_rocky_api_graphics__fill_text_coordinates(void) { prv_global_init_and_set_ctx(); EXECUTE_SCRIPT("ctx.fillText('some text', 0, 1.5);"); cl_assert_equal_rect((GRect(0, 2, large_int, large_int)), s_graphics_draw_text.last_call.draw_text.box); EXECUTE_SCRIPT("ct...
((GFont)-1, s_rocky_text_state.font)
; cl_assert_equal_i(1, s_fonts_get_system_font.call_count); EXECUTE_SCRIPT("ctx.font = '14px bold Gothic';\n"); cl_assert_equal_i(2, s_fonts_get_system_font.call_count); cl_assert_equal_p(FONT_KEY_GOTHIC_14_BOLD, s_fonts_get_system_font.last_call.font_key); EXECUTE_SCRIPT("ctx.font = '28px Gothic';\nvar f =...
all(const BTDeviceInternal *device); void test_gatt_client_discovery__rediscover_not_already_running(void) { BTDeviceInternal device = prv_connected_dummy_device(1); // Start discovery: cl_assert_equal_i(gatt_client_discovery_discover_all(&device), BTErrnoOK); prv_simulate_and_assert_discovery_of_one_service(...
prv_assert_event(&device, BTErrnoOK)
; cl_assert_equal_i(3, fake_gatt_is_service_discovery_start_count()); fake_gatt_put_discovery_indication_blood_pressure_service(TEST_GATT_CONNECTION_ID); gatt_client_discovery_discover_range(connection, &range_alt); // BP service should have been discovered fake_gatt_put_discovery_complete_event(GATT_SERVI...
, -456}, { 1200, 616, -488}, { 1016, 816, -560}, { 920, 744, -504}, { 832, 728, -464}, { 960, 720, -448}, { 1272, 720, -400}, { 1464, 616, -320}, { 1440, 456, -336}, { 1104, 224, -272}, { 952, 232, -288}, { 1000, 120, -296}, // 168 seconds { 1144, 112, -256}, { 12...
// 173 seconds { 896, 344, -400}, { 968, 216, -320}, { 1144, 208, -280}, { 1224, 240, -256}, { 1584, 80, -184}, { 1336, 40, -56}, { 1128, 192, -176}, { 1080, 72, -192}, { 728, -232, 304}, { 688, -144, -216}, { 848, -72, -304}, { 1136, -8, -272}, { 1008, 56, -456},...
--------------------- static void prv_put_alarm_event(void) { if (!s_alarms_enabled) { return; } AlarmConfig *config = s_most_recent_alarm_id != ALARM_INVALID_ID ? &s_most_recent_alarm_config : NULL; const bool is_smart = (config && confi...
prv_clear_snooze_timer()
; prv_process_most_recent_alarm(); } static void prv_cron_callback(CronJob *job, void *data) { system_task_add_callback(prv_timer_kernel_bg_callback, data); } // ---------------------------------------------------------------------------------------------- static void prv_persist_alarm(SettingsFile *fd, Alarm *al...
t) { gap_conn_params_t conn_params = evt->conn_params; PBL_LOG(LOG_LEVEL_DEBUG, "Master requesting conn param change, Conn Idx: %d - (%d %d %d %d)", evt->conn_idx, (int)conn_params.interval_min, (int)conn_params.interval_max, (int)conn_params.slave_latency, (int)conn_params.sup_timeout); // a...
prv_is_auto_accept_repairing_mode(conn, conn_idx)
) { PBL_LOG(LOG_LEVEL_DEBUG, "Auto-accepting pairing request"); extern void pair_reply(uint16_t conn_idx, bool is_confirmed); pair_reply(conn_idx, true); return; } hc_endpoint_pairing_send_pairing_request(&device); } static void prv_handle_address_resolved(const ble_evt_gap_address_resolved_t *evt...
amps; } s_le_conn_params = (LeConnectionParams){}; } static void prv_update_conn_params(uint16_t slave_latency_events, uint16_t supervision_to_10ms) { bt_lock(); s_le_conn_params.slave_latency_events += slave_latency_events; s_le_conn_params.supervision_to_ms += (supervisi...
analytics_stopwatch_stop(ANALYTICS_DEVICE_METRIC_BLE_CONNECT_TIME)
; analytics_stopwatch_stop(ANALYTICS_DEVICE_METRIC_BLE_CONNECT_ENCRYPTED_TIME); prv_update_conn_event_timer(0, true); } } void bluetooth_analytics_handle_encryption_change(void) { analytics_stopwatch_start(ANALYTICS_DEVICE_METRIC_BLE_CONNECT_ENCRYPTED_TIME, AnalyticsClient_Syst...
_dotted_line_even_offset_even_clip"))); // Clipping on odd boundaries - no offset setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_ODD, OFFSET_RECT_EVEN, false, 1); for (int16_t col = 0; col < MAX_NUM_COLS; col++) { graphics_draw_vertical_line_dotted(&ctx, GPoint(col, 0), MAX_NUM_ROWS); } cl_check(gbitmap_pbi...
for (int16_t col = 0; col < MAX_NUM_COLS; col++) { graphics_draw_vertical_line_dotted(&ctx, GPoint(col, 0), MAX_NUM_ROWS); }
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_vert_dotted_line_odd_offset_odd_clip"))); } void test_graphics_draw_line__dotted_cross(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // Test horizontal and vertical lines cross appropriately setup_test_aa_sw(&ctx, fb,...
/* * 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...
(144, 672)
); const GRect max_text_bounds = GRect(0, 0, 144, 672); TextLayer* text = &data->text; text_layer_init(text, &max_text_bounds); text_layer_set_font(text, s_system_font); text_layer_set_text(text, ALL_CODEPOINTS); // Trim text layer and scroll content to fit text box GSize max_size = text_layer_get_conte...
attributes[1].uint8, 1); timeline_item_destroy(item); } static Attribute action1_attributes[] = { {.id = AttributeIdTitle, .cstring = "Dismiss"}, }; static Attribute action2_attributes[] = { {.id = AttributeIdTitle, .cstring = "Like"}, {.id = AttributeIdAncsAction, .int8 = 1} }; static Attribute attributes[]...
cl_assert_equal_s("", string_list_get_at(list, 2))
; cl_assert_equal_s("", string_list_get_at(list, 3)); // 2 strings (last is not terminated and will fall through) will return 2 strings // when deserializing, the deserializer puts a \0 at the end // this case demonstrates the problem with incorrectly initialized data list->serialized_byte_length = 3; list...
ation, false /*delay*/, false /*play_count*/); } else { PBL_ASSERTN(animation->type == AnimationTypePrimitive); PBL_ASSERTN(animation->implementation->update != NULL); } if (now != earliest_start_time) { // This is a complex animation that has a ch...
(!animation_private_using_legacy_2(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...
{ const PlatformType platform = process_manager_current_platform(); return _ACTION_BAR_WIDTH(platform); }
static int prv_vertical_icon_margin(void) { const PlatformType platform = process_manager_current_platform(); return PBL_PLATFORM_SWITCH(platform, /*aplite*/ 24, /*basalt*/ 24, /*chalk*/ 53, /*diori...
; } void test_circular_buffer__copy(void) { CircularBuffer buffer; uint8_t storage[8]; circular_buffer_init(&buffer, storage, sizeof(storage)); const uint16_t data_out_size = 8; uint8_t data_out[data_out_size]; // Test copy when there is nothing in the buffer: cl_assert_equal_i(circular_buffer_copy(&bu...
cl_assert_equal_i(memcmp(copy_out, "234567", 6), 0)
; contiguous_num_bytes_left = circular_buffer_write_prepare(&buffer, &data_out); cl_assert_equal_i(contiguous_num_bytes_left, 2); memcpy(data_out, "AB", 2); circular_buffer_write_finish(&buffer, 2); cl_assert_equal_i(circular_buffer_copy(&buffer, copy_out, copy_out_size), 8); cl_assert_equal_i(memcmp(copy...
/* * 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_d(round(0.0), 0.0); cl_assert_equal_d(round(0.4), 0.0); cl_assert_equal_d(round(-0.4), -0.0); cl_assert_equal_d(round(0.5), 1.0); cl_assert_equal_d(round(-0.5), -1.0); cl_assert_equal_d(round(-1.0), -1.0); cl_assert_equal_d(round(1.7976931348623157e+308), 1.7976931348623157e+308); cl_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...
attribute_list_add_uint8(&attr_list, AttributeIdBgColor, GColorOrangeARGB8)
; AttributeList dismiss_action_attr_list = {}; attribute_list_add_cstring(&dismiss_action_attr_list, AttributeIdTitle, i18n_get("Dismiss", &attr_list)); AttributeList stop_action_attr_list = {}; attribute_list_add_cstring(&stop_action_attr_list, AttributeIdTitle, ...
{ 0, 0x69, 0, 148, 0}, { 0, 0x69, 0, 148, 0}, { 0, 0x69, 0, 147, 0}, { 0, 0x69, 0, 144, 0}, // 135: Local time: 2016-03-01 10:20:00 PM { 0, 0x69, 0, 147, 0}, { 0, 0x69, 0, 148, 0}, { 0, 0x69, 0, 148, 0}, { 0, 0x69, 0, 147, 0}, { 0, 0x69, 0, 150, 0}, { 0, 0x69, 0, 148, 0}, ...
{ 0, 0x18, 0, 149, 0}, { 0, 0x18, 0, 148, 0}, { 0, 0x18, 0, 148, 0}, { 0, 0x18, 0, 149, 0}, { 0, 0x18, 0, 148, 0}, { 0, 0x18, 0, 149, 0}, { 0, 0x18, 0, 148, 0}, { 0, 0x18, 0, 145, 0}, { 0, 0x18, 0, 148, 0}, { 0, 0x18, 11, 148, 0}, { 0, 0x18, 0, 149, 0}, { 0, 0x18, 0, 149...
e and subtract that from higher latency requests, but most of // the time we should be in the maximum latency (low power) state anyway // get & set the new state prv_handle_response_latency_for_le_conn(hdl); unlock: bt_unlock(); } static void prv_bt_le_gateway_response_latency_watchdog_cb(void *data) { // ...
regular_timer_remove_callback(watchdog_cb_info)
; } ListNode *curr_request = (ListNode *)(*info)->requests; while (curr_request != NULL) { ListNode *temp = list_get_next(curr_request); list_remove(curr_request, NULL, NULL); kernel_free(curr_request); curr_request = temp; } kernel_free(*info); *info = NULL; } void command_change_le_mode...
rvice_client_close(&test_uuid_a); } void test_persist__int(void) { const uint32_t key = 0; const uint32_t value = ~0; cl_assert_equal_i(persist_read_int(key), 0); cl_assert_equal_i(persist_write_int(key, value), sizeof(int)); cl_assert_equal_i(persist_get_size(key), sizeof(int)); cl_assert_equal_i(persist_...
persist_write_int(key, 2)
, sizeof(int)); cl_assert_equal_i(persist_read_int(key), 2); } /* * Confirm that overwriting with a smaller data size does not break tuple finding. */ void test_persist__overwrite_shrink(void) { cl_assert(PASSED(persist_write_int(0, 1))); cl_assert(PASSED(persist_write_bool(0, false))); cl_assert(PASSED(pers...
kernel/events.h" #include "kernel/pbl_malloc.h" #include "mcu/interrupts.h" #include "os/mutex.h" #include "services/common/analytics/analytics.h" #include "services/common/event_service.h" #include "services/common/system_task.h" #include "services/imu/units.h" #include "syscall/syscall.h" #include "syscall/syscall_in...
(s_accel_manager_mutex)
; } static void prv_double_tap_add_subscriber_cb(PebbleTask task) { mutex_lock_recursive(s_accel_manager_mutex); if (++s_double_tap_subscribers_count == 1) { PBL_LOG(LOG_LEVEL_DEBUG, "Starting accel double tap service"); accel_enable_double_tap_detection(true); prv_setup_subsampling(accel_get_sampling...
/* * 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...
ARRAY_LENGTH(devices)
; ble_gap_get_devices(GAP_DEVICE_FILTER_CONNECTED, NULL, &length, devices); for (int i = 0; i < (int)length; ++i) { const gap_device_t *const device = &devices[i]; uint16_t svc_chg_ccc = 0; ble_storage_get_u16(device->conn_idx, STORAGE_KEY_SVC_CHANGED_CCC, &svc_chg_ccc); const bool is_subscribed_to...
ude "stubs_status_bar_layer.h" #include "stubs_syscall_internal.h" #include "stubs_syscalls.h" #include "stubs_task_watchdog.h" #include "stubs_vibes.h" #include "stubs_window_manager.h" #include "stubs_window_stack.h" AnimationProgress animation_timing_scaled(AnimationProgress time_normalized, ...
cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE))
mon/system_task.h" #include "system/logging.h" #include "system/passert.h" #include "util/uuid.h" #include <inttypes.h> #include <stdlib.h> #include <string.h> static DataLoggingSession *s_logging_sessions; static PebbleRecursiveMutex * s_list_mutex; // --------------------------------------------------------------...
mutex_destroy(session->data->mutex)
; kernel_free(session->data); session->data = NULL; } else { mutex_unlock_recursive(s_list_mutex); mutex_unlock(session->data->mutex); } } // --------------------------------------------------------------------------------------- // Return session status DataLoggingStatus dls_get_session_status(Da...
60 * 60), 2); } void test_timeline__two_iterators(void) { uint8_t init_net_allocs = fake_pbl_malloc_num_net_allocs(); Iterator iterator1 = {0}; Iterator iterator2 = {0}; TimelineIterState state1 = {0}; TimelineIterState state2 = {0}; TimelineNode *head = NULL; // first iterator should alloc all the mem...
(uuid_equal(&state.pin.header.id, &s_items[1].header.id))
; timeline_iter_deinit(&iterator, &state, &head); } void test_timeline__multiday(void) { TimelineItem multiday_item = { .header = { .id = {0x29, 0xac, 0xd8, 0xb5, 0x9, 0xc7, 0x4c, 0x31, 0xbf, 0x6f, 0x3, 0x64, 0xd0, 0x5b, 0x9b, 0xc2}, .parent_id = {0}, .timestamp = 1425312000,...
cl_assert(fake_event_service_get_info(PEBBLE_UNOBSTRUCTED_AREA_EVENT)->handler); cl_assert_equal_p(app_state_get_unobstructed_area_state()->handlers.change, prv_change); const GRect to_area = GRect(0, 0, DISP_COLS, 200); const GRect area = GRect(0, 0, DISP_COLS, 200); const AnimationProgress progress = ANIM...
app_state_get_unobstructed_area_state()
->area = GRect(0, 0, 400, 400); Layer root_layer = { .bounds = GRect(30, 30, 30, 30), }; Layer layer = { .bounds = GRect(20, 20, 20, 20), }; layer_add_child(&root_layer, &layer); GRect unobstructed_bounds; layer_get_unobstructed_bounds(&layer, &unobstructed_bounds); cl_assert_equal_grect(unobst...
and * limitations under the License. */ #include "bma255.h" #include "bma255_regs.h" #include "bma255_private.h" #include "console/prompt.h" #include "drivers/accel.h" #include "drivers/exti.h" #include "drivers/gpio.h" #include "drivers/periph_config.h" #include "drivers/rtc.h" #include "drivers/spi.h" #include "k...
(BMA255Register_BGW_CHIP_ID)
; PBL_LOG(LOG_LEVEL_DEBUG, "Read BMA255 whoami byte 0x%"PRIx8", expecting 0x%"PRIx8, chip_id, BMA255_CHIP_ID); return (chip_id == BMA255_CHIP_ID); } static uint64_t prv_get_curr_system_time_ms(void) { time_t time_s; uint16_t time_ms; rtc_get_time_ms(&time_s, &time_ms); return (((uint64_t)time_s) ...
http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing ...
touch_set_touch_state(1, TouchState_FingerDown, GPointZero, 0, 0)
; touch_handle_update(1, TouchState_FingerUp, &GPoint(1, 13), 0, 3686401); event = fake_event_get_last(); cl_assert_equal_i(event.type, PEBBLE_TOUCH_EVENT); cl_assert_equal_i(event.touch.type, PebbleTouchEvent_TouchesAvailable); touch_event = touch_event_queue_get_event(1, 0); prv_test_touch_event(touch_eve...
tchdog.h" void app_install_clear_app_db(void) { } void put_bytes_cancel(void) { } typedef void (*InstallCallbackDoneCallback)(void*); bool app_install_do_callbacks(InstallEventType event_type, AppInstallId install_id, Uuid *uuid, InstallCallbackDoneCallback done_callback, void* done_callback_data) { return tru...
memset(&temp, 0, sizeof(AppDBEntry))
; AppInstallId app_one_id = app_db_get_install_id_for_uuid(&app1.uuid); cl_assert(app_one_id > 0); cl_assert_equal_i(S_SUCCESS, app_db_get_app_entry_for_install_id(app_one_id, &temp)); cl_assert_equal_b(true, uuid_equal(&app1.uuid, &temp.uuid)); // check app_db_get_install_id_for_uuid for app 2 memset(&tem...
dlers("minutechange")); cl_assert_equal_b(true, rocky_global_has_event_handlers("hourchange")); cl_assert_equal_b(true, rocky_global_has_event_handlers("daychange")); cl_assert_equal_i(5, s_tick_timer_service_subscribe.call_count); cl_assert_equal_i(SECOND_UNIT | MINUTE_UNIT | HOUR_UNIT | DAY_UNIT | MONTH_UNIT ...
("d", 17.0)
; EXECUTE_SCRIPT( "s = null;\n" "m = null;\n" "h = null;\n" "d = null;\n" ); struct tm tm = { .tm_sec = 1, .tm_min = 2, .tm_hour = 3, .tm_mday = 4, .tm_mon = 5, .tm_year = 116, // 2016 }; prv_tick_handler(&tm, SECOND_UNIT | MINUTE_UNIT | HOUR_UNIT | DAY_UNIT); ASSE...
---------------------------------------------------- static void sleep_window_load(Window *window) { HealthAPITestAppData *data = window_get_user_data(window); Layer *window_layer = window_get_root_layer(window); GRect root_bounds = layer_get_bounds(window_layer); data->sleep_card.text_layer = text_layer_creat...
persist_write_int(AppPersistKeyLapSteps, data->lap_steps)
; } if (data->steps_card.delta_step_layer) { if (data->lap_steps) { snprintf(data->steps_card.delta_step_text, sizeof(data->steps_card.delta_step_text), "%d", (int) (data->cur_steps - data->lap_steps)); text_layer_set_text(data->steps_card.delta_step_layer, data->steps_card.delta_step...
music_get_playback_state() == MusicPlayStatePlaying) { prv_update_pos(); } } static void prv_set_pos_update_timer(MusicAppData* data, MusicPlayState playstate) { if (!music_is_progress_reporting_supported()) { return; } switch (playstate) { case MusicPlayStatePlaying: // We need to update the...
(&data->track_pos_bar, &track_rect)
; progress_layer_set_background_color(&data->track_pos_bar, PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite)); progress_layer_set_foreground_color(&data->track_pos_bar, PBL_IF_COLOR_ELSE(GColorRed, GColorBlack)); progress_layer_set_corner_radi...
_ms, 9); cl_assert_equal_i(s_vibe_queue[1].strength, -100); cl_assert_equal_i(s_vibe_queue[2].duration_ms, 100); cl_assert_equal_i(s_vibe_queue[2].strength, 0); cl_assert_equal_i(s_vibe_queue[3].duration_ms, 15); cl_assert_equal_i(s_vibe_queue[3].strength, 100); cl_assert_equal_i(s_vibe_queue[4].duration_ms...
cl_assert(score)
; cl_assert_equal_i(vibe_score_get_repeat_delay_ms(score), 0); vibe_score_destroy(score); } void test_vibe_score__test_bad_attr_size(void) { uint8_t buffer[] = { 'V', 'I', 'B', 'E', // FourCC 1, 0, // version 0, 0, 0, 0, // reserved bytes 11, 0, // attr_list_size (right value is 12) ...
IONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "services/normal/settings/settings_file.h" #include "services/normal/settings/settings_raw_iter.h" #include "system/hexdump.h" #include "clar.h" #include ...
(&file, "test_file_set_get_one_many_times", 4096)
); printf("Making sure we still get the right value after closing & reopening the file...\n"); verify(&file, key, key_len, val, val_len); } static bool prv_each_check_all_values(SettingsFile *file, SettingsRecordInfo *info, void *context) { uint32_t desired_value = *(uint32_t *)context; uint32_t key; uint3...
/* * 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_app_db.mutex)
; status_t rv = settings_file_open(&s_app_db.settings_file, SETTINGS_FILE_NAME, SETTINGS_FILE_SIZE); if (rv != S_SUCCESS) { mutex_unlock(s_app_db.mutex); } return rv; } static void prv_close_file_and_unlock_mutex(void) { settings_file_...
/* * 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...
{ uint32_t minutes_after_midnight = secs_after_midnight / SECONDS_PER_MINUTE; uint32_t hour = minutes_after_midnight / MINUTES_PER_HOUR; uint32_t minute = minutes_after_midnight % MINUTES_PER_HOUR; snprintf(text, text_len, "%d:%02d", (int)hour, (int)minute); }
// ----------------------------------------------------------------------------------------- static void prv_display_alert(const char *text) { ExpandableDialog *expandable_dialog = expandable_dialog_create("Alert"); dialog_set_text(expandable_dialog_get_dialog(expandable_dialog), text); expandable_dialog_show_...
/* * 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...
(alarms_glance->icon)
; } app_free(alarms_glance); } static void prv_set_glance_icon(LauncherAppGlanceAlarms *alarms_glance, uint32_t new_icon_resource_id) { if (alarms_glance->icon_resource_id == new_icon_resource_id) { // Nothing to do, bail out return; } // Destroy the existing icon k...