prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
(label, data)
, .range = { .update = true, .text = is_smart ? i18n_get(range_text, data) : NULL, .duration_m = SMART_ALARM_RANGE_S / SECONDS_PER_MINUTE, .enabled = is_smart, }, }; time_selection_window_configure(&data->time_picker_window, &config); // Reset the selection layer to the first cell ...
{ return rocky_error_arguments_missing(); }
// Type check: RockyArgTypeCheckError type_error; if (!imp.check_type(&argv[i], &type_error)) { return rocky_error_unexpected_type(i + type_error.arg_offset, type_error.expected_type_name); } // Check value, transform & assign: RockyArgValueCheck...
*/ pdp->is_writable_defined, /* $3 */ pdp->is_writable, /* $4 */ pdp->is_enumerable_defined, /* $5 */ pdp->is_enumerable, /* $6 */ pdp->is_configurable_defined, /* $7 */ pdp->is_configurable, /* $8 */ pdp->value, /* $9 */ pdp->gette...
__jerryRefs.ref(Object.keys(__jerryRefs.get($0)))
; }, value); } jerry_value_t jerry_get_prototype(const jerry_value_t value) { if (!jerry_value_is_object(value)) { return TYPE_ERROR_ARG; } return (jerry_value_t)EM_ASM_INT({ return __jerryRefs.ref(__jerryRefs.get($0).prototype); }, value); } jerry_value_t jerry_set_prototype(const jerry_value...
ter_state->start_time, timeline_iter_state->midnight, timeline_iter_state->direction, timeline_iter_state->show_all_day_events) || !timeline_exists(&timeline_iter_state->node->id)); timeline_item_free_allocated_buffer(&timeline_iter_state->pin); timeline_iter_state->pin = (TimelineItem){}; sta...
{ time_t today_midnight = time_util_get_midnight_of(now); if (today_midnight > item->header.timestamp || prv_should_show_all_day_events(timeline, now, today_midnight, TimelineIterDirectionPast)) { return TimelineIterDirectionPast; } else { return TimelineIterDirectionFuture; } }
else if (item->header.timestamp < now) { return TimelineIterDirectionPast; } else { return TimelineIterDirectionFuture; } } bool timeline_nodes_equal(TimelineNode *a, TimelineNode *b) { if (a == NULL || b == NULL) { return (a == b); } return (uuid_equal(&a->id, &b->id) && (a->timestamp == b->tim...
regular timer firing a bunch of times to expire the timeout for all the packets: for (int i = 0; i < PPOGATT_TIMEOUT_TICKS; ++i) { regular_timer_fire_seconds(PPOGATT_TIMEOUT_TICK_INTERVAL_SECS); } fake_comm_session_process_send_next(); // The data should *NOT* get concatenated in a single packet, even th...
(transport, s_short_data_fragment, sizeof(s_short_data_fragment) - sn)
, true); // Only now the system task callback is fired (prv_send_next_packets_async): fake_comm_session_process_send_next(); // Expect the new data to come through, no retransmissions at all. // (They all got considered Ack'd by the one Ack) prv_assert_sent_data(s_characteristics[0][PPoGATTCharacteristicData...
0, 0, 0); cl_assert_equal_i(s_command_list_index, 0); } void test_flash_region__erase_optimal_range_sectors_simple(void) { // Erase one sector 0x10000 - 0x20000 flash_region_erase_optimal_range(64 * 1024, 64 * 1024, 2 * 64 * 1024, 2 * 64 * 1024); cl_assert_equal_i(s_command_list_index, 1); cl_assert_equal_...
(s_command_list[1].addr, 36 * 1024)
(app) { app->last_activity = RECENT_APP_LAST_ACTIVITY_INVALID; } } mutex_unlock_recursive(s_recent_apps.mutex); } void app_install_mark_prioritized(AppInstallId install_id, bool can_expire) { if (install_id == INSTALL_ID_INVALID) { return; } mutex_lock_recursive(s_recent_apps.mutex); { c...
(install_id, db_entry, cb_data->entry_buf)
; cb_data->cb(cb_data->entry_buf, cb_data->data); } void app_install_enumerate_entries(AppInstallEnumerateCb cb, void *data) { // Keep this off of the stack. This function presses the limits of our stack. AppInstallEntry *entry = kernel_malloc_check(sizeof(AppInstallEntry)); // Iterate over the registry for...
teNumStates, } BtTestState; static const char* status_text[] = { [BtTestStateInit] = "Initializing", [BtTestStateStopped] = "Stopped", [BtTestStateStarting] = "Starting", [BtTestStateStopping] = "Stopping", [BtTestStateStarted] = "Started", [BtTestStateFailed] = "Failed", [BtTestStateResetting] = "Resett...
fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD)
if ((rot_start.y.integer - i) * (rot_end.y.integer - i) <= 0) { bool is_down = rot_end.y.integer != rot_start.y.integer ? rot_end.y.integer > rot_start.y.integer : last_is_down; // don't count end points in the same direction to avoid double intersections if (!(rot_sta...
(&path->points[i], path->rotation, &path->offset)
; if (min_x > rot_points[i].x) { min_x = rot_points[i].x; } if (max_x < rot_points[i].x) { max_x = rot_points[i].x; } if (min_y > rot_points[i].y) { min_y = rot_points[i].y; } if (max_y < rot_points[i].y) { max_y = rot_points[i].y; } if (found_start_direction) { continue; } // use th...
i(height_mm, value); value = activity_prefs_get_weight_dag(); cl_assert_equal_i(weight_dag, value); value = activity_prefs_get_gender(); cl_assert_equal_i(gender, value); value = activity_prefs_get_age_years(); cl_assert_equal_i(age_years, value); // Reset settings activity_prefs_set_height_mm(ACTIVITY...
ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricStepCount, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){0, 100, 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_METRIC_HISTORY(ActivityMetricSleepRestfulSeconds, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){0, 1 * SECONDS_PER_MINUTE, 0, 0, 0, 0, 0})); fo...
recover after reset bus_unlock(bus); return false; } } // Take binary semaphore so that next take will block PBL_ASSERT(semaphore_take(bus), "Could not acquire semaphore token"); // Set up transfer bus->transfer.device_address = device_address; bus->transfer.register_address = register_ad...
(LOG_LEVEL_ERROR, "Write failed on bus %" PRId8, BOARD_CONFIG.i2c_device_map[device_id])
; } return result; } /*------------------------INTERRUPT FUNCTIONS--------------------------*/ //! End a transfer and disable further interrupts //! Only call from interrupt functions static portBASE_TYPE end_transfer_irq(I2cBus *bus, bool result) { bus->i2c->CR2 &= ~(I2C_CR2_ITEVTEN | I2C_CR2_ITERREN | I2C_CR...
lance_cache = list_insert_before(service->glance_cache, &cache_entry->node); glance = cache_entry->glance; } // Try to load the glance requested if we didn't find it in the cache if (!glance) { glance = prv_load_glance_for_node(node, service); if (!glance) { // Just bail out and don't modify th...
(service->handlers_context)
lookup(angle); GTransformNumber num = GTransformNumberFromNumber((float)cosine / TRIG_MAX_RATIO); GTransformNumber num2 = (GTransformNumber) { .raw_value = (int32_t)(((int64_t)cosine * GTransformNumberOne.raw_value) / TRIG_MAX_RATIO) }; cl_assert(num.raw_valu...
(&t_new, &t_c)
); // Test pointer re-use gtransform_concat(&t2, &t1, &t2); cl_assert(gtransform_is_equal(&t2, &t_c)); // Test non-identity concatenation with identity t1 = GTransformIdentity(); t2 = GTransformFromNumbers(1, 2, 3, 4, 5, 6); t_c = GTransformFromNumbers(1, 2, 3, 4, 5, 6); gtransform_concat(&t_new, &t1,...
/* * 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...
malloc(sizeof(FrameBuffer))
; framebuffer_init(s_fb, &(GSize) {DISP_COLS, DISP_ROWS}); test_graphics_context_init(&s_ctx, s_fb); read_pbi("no_litter_crop.png.pbi", &test_image); } void test_graphics_draw_bitmap__cleanup(void) { free(s_fb); free(test_image.addr); } // Layout Test Support //////////////////////////////////// #define TE...
/* * 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...
sys_resource_mapped_use()
; return true; } return false; } bool applib_resource_is_mmapped(const void *bytes) { return resource_storage_builtin_bytes_are_readonly(bytes) || resource_storage_flash_bytes_are_readonly(bytes); } bool applib_resource_munmap(const void *bytes) { if (resource_storage_builtin_bytes_are_readonly(...
&r)); compare_notifications(&e, &r); free(r.allocated_buffer); //Free up enough space for one notification by removing one notification_storage_remove(&uuids[i/2]); e.header.id = uuids[i/2]; e.header.timestamp = timestamp + i/2; cl_assert_equal_b(notification_storage_get(&uuids[i/2], &r), false); //Ad...
uuid_generate(&i2)
; TimelineItem e2 = { .header = { .id = i2, .type = TimelineItemTypeNotification, .status = 0, .ancs_uid = 1, .layout = LayoutIdGeneric, .timestamp = 0x53f0dda6, }, .attr_list = { .num_attributes = 2, .attributes = attributes, }, .action_group = { ...
backing storage static Tuple * get_safe_cursor(DictionaryIterator *iter) { // If iter->cursor is already at the end, return now so we don't try and read past the end of // the malloc'ed block (when fetching iter->cursor->length) and possibly cause a memory read // exception. if ((void*)iter->cursor >= iter->e...
if ((result = dict_write_tuplet(iter, &tuplets[i])) != DICT_OK) { return result; }
} *size_in_out = dict_write_end(iter); return DICT_OK; } // Legacy version to prevent previous app breakage, __deprecated preserves order DictionaryResult dict_serialize_tuplets_to_buffer_with_iter__deprecated(const uint8_t tuplets_count, const Tuplet * const tuplets, DictionaryIterator *iter, uint8_t *buff...
/* * 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_app_message_inbox()
; if (*app_message_inbox) { PBL_LOG(LOG_LEVEL_INFO, "App PP receiver already open, not opening again"); return true; } // Make sure that at least one message of `buffer_size` will fit, by adding the header size: // Allocate overhead for 1 (N)ACK + 1 Push message: static const uint32_t min_num_message...
/* * 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...
layer_render_tree(&layer, &ctx)
; cl_check(framebuffer_is_empty("outside_x_origin_layer", ctx.parent_framebuffer, GColorWhite)); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &outside_y_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("outside_y_origin_layer", ctx.parent_framebuf...
If we use these registers to tell the sensor how frequently it's handshaking with us in our // time domain, this will let the sensor do this compensation for us. // The value programmed in here is in units of 0.1ms (value of 10000 = 1 second). #define ADDR_HOST_ONE_SECOND_TIME_MSB (0x0a) #define ADDR_HOST_ONE_SECOND_T...
(dev->i2c_slave)
; bool rv = i2c_write_register(dev->i2c_slave, register_address, value); i2c_release(dev->i2c_slave); return rv; } static bool prv_write_register_block(HRMDevice *dev, uint8_t register_address, const void *buffer, uint32_t length) { i2c_use(dev->i2c_slave); bool rv = i2c_...
n SmartstrapResultBusy; } mutex_lock(s_read_lock); // populate the read info s_read_info = (ReadInfo) { .service_id = service_id, .attribute_id = attribute_id, }; // add the header FrameInfo header = (FrameInfo) { .version = GENERIC_SERVICE_VERSION, .type = type, .error = GenericServ...
mbuf_free(s_reserved_read_mbuf)
; s_reserved_read_mbuf = NULL; return false; } return true; } else { // Unsupported reserved service and/or attribute return false; } } else { // Notification wasn't for a reserved service, send a notification event smartstrap_attribute_sen...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ uuid_generate(&weather_prefs->locations[i]); }
} void test_watch_app_prefs_db__cleanup(void) { } // Tests //////////////////////////////////////////////////////////////// void test_watch_app_prefs_db__insert_send_text(void) { const int data_len = sizeof(s_send_text_prefs); cl_assert_equal_i( watch_app_prefs_db_insert(SEND_TEXT_KEY, SEND_TEXT_KEY_LEN,...
oop("Alarm") } }; event_put(&e); } // ---------------------------------------------------------------------------------------------- static bool prv_record_alarm_op(AlarmId id, AlarmConfig *config, void *context) { // Add a pin to the timeline (will show up in the past) prv_add_pin(id, config, rtc_get_tim...
{ PBL_ASSERT(alarm->id >= 0 && alarm->id < MAX_CONFIGURED_ALARMS, "Invalid id %d", alarm->id); AlarmStorageKey key = { .id = alarm->id, .type = ALARM_DATA_CONFIG }; AlarmConfig config = { .kind = alarm->config.kind, .is_disabled = alarm->config.is_disabled, .hour = alarm->config.hour, .minute = a...
// ---------------------------------------------------------------------------------------------- static void prv_add_and_schedule_alarm(SettingsFile *file, Alarm *alarm) { prv_check_and_schedule_alarm(file, alarm, true /* refresh */); prv_persist_alarm(file, alarm); } // ----------------------------------------...
/* * 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...
{ // Simple fake, can only handle one call cl_assert_equal_p(s_launcher_task_callback, NULL); s_launcher_task_callback = callback; s_launcher_task_callback_data = data; }
// Tests: Disover AMS /////////////////////////////////////////////////////////// #define NUM_AMS_INSTANCES 2 static BLECharacteristic s_characteristics[NUM_AMS_INSTANCES][NumAMSCharacteristic] = { // AMS instance one: [0] = { [AMSCharacteristicRemoteCommand] = 1, [AMSCharacteristicEntityUpdate] = 2, ...
ate_averaged_accessible( HealthMetric metric, time_t time_start, time_t time_end, HealthAggregation aggregation, HealthServiceTimeScope scope) { #if !CAPABILITY_HAS_HEALTH_TRACKING return HealthServiceAccessibilityMaskNotSupported; #else if (prv_is_heart_rate_metric(metric) && !sys_activity_prefs_heart_rate_is_...
if (hr_median_age >= HS_MAX_AGE_HR_SAMPLE) { return 0; }
sys_activity_get_metric(ActivityMetricHeartRateFilteredBPM, 1, &value); return value; } else if (valid_hr_sample_num) { // If this is scope-once, the metric is BPM, and the time range is less than // HS_MAX_MINUTE_DATA_SEC, we can use minute history since the amount of data is manageable. ...
/* * 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...
{ total = (UINT32_MAX - g_profiler.start) + g_profiler.end; }
e(pg); } } // A full filesystem is bad for wear leveling since the same sectors will // wind up getting written repeatedly. We should really be enforcing this // within pfs_open but for now we will just let external callers use this // routine before allocating large files uint32_t tot_capacity = (pfs_...
if (bytes == NULL) { prompt_send_response("malloc error"); goto cleanup; }
memset(bytes, 0x00, num_bytes); if ((num_bytes = pfs_read(fd, bytes, num_bytes)) < 0) { prompt_send_response_fmt(buf, sizeof(buf), "rd err: %d", num_bytes); goto cleanup; } PBL_HEXDUMP_D_SERIAL(LOG_LEVEL_DEBUG, bytes, num_bytes); prompt_send_response("DONE"); cleanup: kernel_free(bytes); } void...
educes the strain on the BT controller scheduler and // frees up more slots for outbound data packets. As long as we send an Ack // before the in-flight window fills, the phone can keep pushing data. // If very little data is in flight, flushing Ac...
for (uint32_t sn = client->out.next_expected_ack_sn; sn != sn_end_excl; sn = prv_next_sn(sn)) { prv_set_payload_size_for_sn(client, sn, 0); }
} // ------------------------------------------------------------------------------------------------- // Ack Time-out related things. // The effective timeout duration will be between 2 and 3 seconds, depending on when in the second // the timeout is set (RegularTimer is used). static void prv_reset_ack_timeout(PPo...
/* * 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...
mcu_state_is_privileged()
) { contents->task_char = toupper(contents->task_char); } contents->time_ms = timestamp_ms; // Obtain the filename strncpy(contents->src_filename, GET_FILE_NAME(src_filename), sizeof(contents->src_filename)); // Obtain the line number contents->line_number = src_line_number; return offsetof(Messag...
left - even vert, odd horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(100, 70), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(101, 75), 5); // T facing left - odd vert, even horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(131, 71), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(1...
(ctx, GPoint(-2, 5), GPoint(5, -2))
; // top left corner graphics_draw_line(ctx, GPoint(10, -2), GPoint(10, 2)); // top graphics_draw_line(ctx, GPoint(15, -2), GPoint(22, 5)); // top right corner graphics_draw_line(ctx, GPoint(18, 10), GPoint(22, 10)); // right graphics_draw_line(ctx, GPoint(22, 15), GPoint(15, 22)); // bottom right corner ...
test(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED)) { // We're good, we're just starting normally. dbgserial_putstr("Booting normally"); boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_ONE); boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_TWO); return false; } // We failed to start our firmware successfully! ...
boot_bit_clear(BOOT_BIT_STANDBY_MODE_REQUESTED)
; enter_standby_mode(); } else if (PWR_GetFlagStatus(PWR_FLAG_SB) == SET) { // Woke up from standby // Clear the standby flag since only a power reset clears it PWR_ClearFlag(PWR_FLAG_SB); // Before coming out of standby make sure we should be waking up if (should_leave_standby_mode()) { le...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_s("P*T", tz_info.tm_zone)
; cl_assert_equal_i(-8 * 60 * 60, tz_info.tm_gmtoff); TimezoneDSTRule start; TimezoneDSTRule end; result = timezone_database_load_dst_rule(tz_info.dst_id, &start, &end); cl_assert_equal_i(start.ds_label, 'D'); cl_assert_equal_i(start.month, 2); cl_assert_equal_i(start.mday, 8); cl_assert_equal_i(start...
/* * 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...
reminders_update_timer()
; } } status_t reminders_delete(ReminderId *reminder_id) { return reminder_db_delete_item(reminder_id, true /* send_event */); } T_STATIC uint32_t prv_calculate_snooze_delay(TimelineItem *item) { time_t current_time_utc = rtc_get_time(); time_t reminder_time_utc = item->header.timestamp; if (current_time_ut...
aller->number, number); } } // Tests /////////////////////////////////////////////////////////// static Transport *s_transport; static CommSession *s_session; void test_phone_pp__initialize(void) { fake_event_init(); fake_comm_session_init(); s_transport = fake_transport_create(TransportDestinationSystem, NU...
(memcmp(expected_decline_msg, data, sizeof(expected_decline_msg)), 0)
; } void test_phone_pp__decline_call(void) { fake_transport_set_sent_cb(s_transport, prv_assert_decline_call_sent_cb); pp_decline_call(expected_cookie); fake_comm_session_process_send_next(); } static void prv_assert_get_phone_call_state_sent_cb(uint16_t endpoint_id, ...
/* * 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...
(true /* write erase headers */)
; load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false /* is_next */); resource_init(); prv_initialize_icons(); } void test_menu_layer_system_cells__cleanup(void) { free(fb); fb = NULL; gbitmap_deinit(&s_tictoc_icon_bitmap); gbitmap_deinit(&s_smart_alarm_icon_bit...
s and * limitations under the License. */ #include "session_remote_version.h" #include "comm/bt_lock.h" #include "kernel/events.h" #include "kernel/pbl_malloc.h" #include "services/common/bluetooth/bluetooth_persistent_storage.h" #include "services/common/comm_session/session_internal.h" #include "services/common...
{ int request_version = 0; // Check which version of the response we are being given based on the length of the // message that the callback was given. if (length >= sizeof(struct VersionsPhoneResponseV3)) { request_version = 3; } else if (length >= sizeof(struct VersionsPhoneResponseV2)) { request_v...
capability_flags = response->protocol_capabilities; } } comm_session_set_capabilities(session, capability_flags); const uint32_t platform_bits = ntohl(response->platform_bitfield); bt_driver_reconnect_notify_platform_bitfield(platform_bits); const bool is_system = comm_session_is_system(session);...
nce_for_row(LauncherMenuLayer *launcher_menu_layer, uint16_t row) { if (!launcher_menu_layer || !launcher_menu_layer->selection_animations_enabled) { return; } // Get the app menu node for the glance that is about to be selected AppMenuDataSource *data_source = launcher_menu_layer->data_source; AppMenuNo...
(frame, GEdgeInsets(down_arrow_layer_frame_origin_y, 0, 0, 0))
; Layer *down_arrow_layer = &launcher_menu_layer->down_arrow_layer; layer_init(down_arrow_layer, &down_arrow_layer_frame); layer_add_child(container_layer, down_arrow_layer); ContentIndicator *content_indicator = scroll_layer_get_content_indicator(&menu_layer->scroll_layer); ContentIndicatorConfig cont...
State state = {0}; TimelineNode *head = NULL; timeline_init(&head); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionPast, s_feb_5_midnight + 8 * 60 * 60 + 16 * 60), 0); #if !CAPABILITY_HAS_CORE_NAVIGATION4 cl_assert(uuid_equal(&state.pin.header.id, &s_extra_case_items[1]...
cl_assert(!iter_prev(&iterator))
; cl_assert(state.node); timeline_iter_deinit(&iterator, &state, &head); } void test_timeline__delete_last_items(void) { Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; timeline_init(&head); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDir...
on_uid; const uint32_t no_content_uid = ((GetNotificationAttributesMsg*)s_this_message_has_no_content_response)->notification_uid; const uint32_t multiple_complete_dict_uid = ((GetNotificationAttributesMsg*)s_multiple_complete_dicts)->notification_uid; const uint32_t split_timestamp_uid = ((GetNotificationAttribu...
{ prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_split_timestamp_dict_part_one), (uint8_t*) s_split_timestamp_dict_part_one); prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_split_timestamp_dict_part_two), (uint8_t*) s_split_timestamp_dict_part_two); s_num_ds_notifications_received += 2; }
else if (uid == message_dict_uid) { prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_message_dict), (uint8_t*) s_message_dict); s_num_ds_notifications_received++; } else if (uid == app_name_title_dict_uid) { prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_app_name_title_dict), (uint8_t *)s_app_name_ti...
nt(is_connected); if (is_connected) { light_enable_interaction(); } else { // Chances are the Pebble of our dear customer has been charging away // from the phone and is disconnected because of that. Try reconnecting // immediately upon disconnecting the charger: bt_d...
if (set_time_info->gmt_offset_delta != 0 || set_time_info->dst_changed || ABS(set_time_info->utc_time_delta) > 15) { alarm_handle_clock_change(); wakeup_handle_clock_change(); cron_service_handle_clock_change(set_time_info); }
// TODO: evaluate if these need to change on every time update do_not_disturb_handle_clock_change(); reminders_update_timer(); #endif return; } case PEBBLE_BLE_SCAN_EVENT: case PEBBLE_BLE_CONNECTION_EVENT: case PEBBLE_BLE_GATT_CLIENT_EVENT: kernel_le_client_handle_event(e...
Destination White memset(dest_data, 0b11111111, sizeof(dest_data)); bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, (GPoint){0}, GCompOpTint, GColorClear); cl_check(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_1bit_comptint_white_on_white-expect.1bit.pbi")); memset(dest_data, 0b11111111, sizeof(dest_...
gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_1bit_bounds_and_origin_offset-expect.8bit.pbi")
); gbitmap_destroy(src_bitmap); }
ead as uint32_t uint8_t buffer[world_length]; flash_read_bytes(buffer, flash_new_fw_addr, world_length); return firmware_is_new_world(buffer); } static bool prv_erase_old_firmware(bool new_world, uint32_t firmware_length) { dbgserial_putstr("erase_old_firmware"); uint32_t system_flash_base = FIRMWARE_NEWWO...
( flash_new_fw_addr + sizeof(FirmwareDescription), &firmware_description)
) { dbgserial_putstr("Invalid firmware CRC in SPI flash!"); return UPDATE_FW_ERROR_MICRO_FLASH_UNTOUCHED; } bool new_world = prv_check_firmware_world(flash_new_fw_addr + sizeof(FirmwareDescription)); prv_erase_old_firmware(new_world, firmware_description.firmware_length); prv_write_new_firmware(new_w...
6_t) 0xffff) static BTDeviceInternal s_device; static GAPLEConnection *s_connection; static uint16_t s_handle; static BTDeviceInternal prv_dummy_device(uint8_t octet) { BTDeviceAddress address = { .octets = { [0] = octet, [1] = octet, [2] = octet, [3] = octet, [4] = octet, [5...
(memcmp(buffer, value, value_length), 0)
; cl_assert_equal_i(characteristic_out, characteristic); } } free(buffer); } static void prv_assert_notification_event(BLECharacteristic characteristic, const uint8_t *value, uint16_t assert_value_length, bool kernel, boo...
/* * 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 (progress_callback) { progress_callback(sector - first_sector + 1, count, progress_context); }
ne_Event_Type_ActivitySessionEvent) { cl_assert_equal_i(a_event->activity_session.type.type.internal_type, b_event->activity_session.type.type.internal_type); cl_assert_equal_i(a_event->activity_session.start_reason, b_event->activity_session.start_rea...
time_util_update_timezone(&tz_info)
equal_i(s_num_timeline_removes, 9); } void test_alarm__alarm_delete(void) { AlarmId id1, id2, id3, id4, id5, id6, id7; id1 = alarm_create(&(AlarmInfo) { .hour = 3, .minute = 14, .kind = ALARM_KIND_EVERYDAY }); id2 = alarm_create(&(AlarmInfo) { .hour = 4, .minute = 14, .kind = ALARM_KIND_EVERYDAY }); alarm_dele...
{ const AlarmId dummy_alarm_id = 0; const AlarmKind alarm_kind = ALARM_KIND_WEEKENDS; Uuid added_pin_uuid; alarm_pin_add(s_monday, dummy_alarm_id, AlarmType_Basic, alarm_kind, &added_pin_uuid); cl_assert(uuid_equal(&added_pin_uuid, &s_last_timeline_item_added->header.id)); AttributeList *pin_attr_list = &s...
/* * 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...
gpio_release(af_config->gpio)
; recognizer_handle_touch_event(r, &(TouchEvent) { .type = TouchEvent_Liftoff }); cl_assert_equal_i(last_touch_event.type, TouchEvent_Liftoff); cl_assert_equal_b(updated, true); cl_assert_equal_i(rec_event, RecognizerEvent_Completed); r->state = RecognizerState_Possible; updated = false; new_state = Reco...
(!recognizer_should_evaluate_simultaneously(NULL, NULL))
; cl_assert(!recognizer_should_evaluate_simultaneously(r1, NULL)); cl_assert(!recognizer_should_evaluate_simultaneously(NULL, r2)); cl_assert(!recognizer_should_evaluate_simultaneously(r1, r2)); recognizer_set_simultaneous_with(r1, prv_simultaneous_with_cb); cl_assert(!recognizer_should_evaluate_simultaneous...
boot_bit_clear(BOOT_BIT_BOOTLOADER_TEST_A | BOOT_BIT_BOOTLOADER_TEST_B); psleep(10000); system_hard_reset(); for (;;) {} // won't get here, rest gets optimized out #endif #ifdef RECOVERY_FW boot_bit_clear(BOOT_BIT_RECOVERY_START_IN_PROGRESS); #endif extern uint32_t __kernel_main_stack_start__[]; exte...
longjmp(s_sjlj_jmpbuf, 0)
; } static void prv_sjlj_first(int r) { PBL_ASSERT(s_sjlj_num == 0, "SJLJ TRACK INCORRECT @ FIRST"); s_sjlj_num++; prv_sjlj_second(r); PBL_ASSERT(1, "SJLJ IS BROKEN (longjmp didn't occur)"); } static void prv_sjlj_main(int r) { PBL_ASSERT(s_sjlj_num == 2, "SJLJ TRACK INCORRECT @ MAIN"); s_sjlj_num++; PBL_...
ED_BY_LOCAL_HOST); } void __disabled_test_gap_le_connect__register_for_already_connected_device(void) { BTErrno e; BTDeviceInternal device = prv_dummy_device(1); // Register connection intent for kernel: e = gap_le_connect_connect(&device, true /* auto_reconnect */, ...
{ BTDeviceInternal device = prv_dummy_device(1); // Register connection intent for app: gap_le_connect_connect(&device, false /* no auto_reconnect */, false /* is_pairing_required */, GAPLEClientApp); prv_fake_connect(&device, true /* is_...
void __disabled_test_gap_le_connect__two_clients_one_without_autoreconnect(void) { BTDeviceInternal device = prv_dummy_device(1); // Register auto-reconnecting connection intent for kernel: gap_le_connect_connect(&device, true /* auto_reconnect */, false /* is_pa...
/* * 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...
(config->alignment)
; } #if PBL_COLOR const LayoutColors *colors = layout_get_colors(layout); switch (config->color) { case LayoutColor_None: break; case LayoutColor_Primary: text_node->color = colors->primary_color; break; case LayoutColor_Secondary: text_node->color = colors->secondary_color; ...
bgserial_print("...\r\n\r\n"); // Disable all interrupts, just in case. for (int i = 0; i < 8; ++i) { // Interrupt Clear-Enable Register NVIC->ICER[i] = 0xFFFFFFFF; // Interrupt Clear-Pending Register NVIC->ICPR[i] = 0xFFFFFFFF; } // Set the peripheral clock enable registers to their reset val...
(BOOT_BIT_RESET_LOOP_DETECT_ONE)
ctive == true); // Timer will go off at 09:00 on Saturday. (7.5 hours) cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 27000 * MS_PER_SECOND); rtc_set_time(s_saturday_10_30); do_not_disturb_handle_clock_change(); active = do_not_disturb_is_active(); cl_assert(active == false); // Timer will...
cl_assert(active == true)
; // Timer will go off at 10:00 on Sunday. (0.5 hours) cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 1800 * MS_PER_SECOND); rtc_set_time(s_sunday_10_00); do_not_disturb_handle_clock_change(); active = do_not_disturb_is_active(); cl_assert(active == false); // Timer will go off at 01:00 on...
include "applib/graphics/graphics.h" #include "applib/pbl_std/locale.h" #include "applib/ui/animation_private.h" #include "applib/ui/app_window_stack.h" #include "applib/ui/layer.h" #include "applib/ui/recognizer/recognizer_list.h" #include "applib/unobstructed_area_service.h" #include "kernel/util/segment.h" #include ...
memory_segment_split(app_state_ram, NULL, row_size * LEGACY_2X_DISP_ROWS)
; if (!fb_data) { return false; } *s_app_state_ptr->legacy2_framebuffer = (GBitmap) { .addr = fb_data, .row_size_bytes = row_size, .info.is_bitmap_heap_allocated = false, .info.format = GBitmapFormat1Bit, .info.version = GBITMAP_VERSION_0, .bounds = { { 0, 0 }, { L...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(args->new_worker_id)
; worker_manager_put_launch_worker_event(args->new_worker_id); } s_is_on_screen = false; task_free(args); } static void prv_click_config_provider(void *context) { window_single_click_subscribe(BUTTON_ID_UP, prv_click_confirm_decline_callback); window_single_click_subscribe(BUTTON_ID_DOWN, prv_click_conf...
ack_remove(window, true); prv_window_unload(window); } // Setup and Teardown //////////////////////////////////// void test_window_stack__initialize(void) { s_last_click_configured_window = NULL; WindowStack *stack = app_state_get_window_stack(); *stack = (WindowStack) {}; modal_manager_reset(); prv_re...
window_stack_push(stack, windows[1], true)
; cl_assert_equal_i(window_stack_count(stack), 2); cl_assert_equal_i(windows[0]->on_screen, false); cl_assert_equal_i(windows[1]->on_screen, true); window_stack_push(stack, windows[2], true); cl_assert_equal_i(window_stack_count(stack), 3); cl_assert_equal_i(windows[0]->on_screen, false); cl_assert_equal...
time_util_get_midnight_of(now)
, now + 12345); cl_assert_equal_i(result, 1000); // yesterday result = health_service_sum(HealthMetricStepCount, time_util_get_midnight_of(now) - SECONDS_PER_DAY, time_util_get_midnight_of(now)); cl_assert_equal_i(result,...
_WIDTH, RECT_HEIGHT) #define ORIGIN_DRAW_RECT_CLIP_XY GRect(6, 6, RECT_WIDTH, RECT_HEIGHT) #define ORIGIN_DRAW_RECT_CLIP_NXNY GRect(-16, -16, RECT_WIDTH, RECT_HEIGHT) void test_graphics_fill_rect_8bit__transparency(void) { GContext ctx; FrameBuffer fb; framebuffer_init(&fb, &(GSize) {DISP_COLS, DISP_ROWS}); ...
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1)
; graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 0, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r0_aa_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLI...
te->scs_selected); prv_spi_transmit_flush_blocking(slave->spi_bus); prv_spi_send_data(slave->spi_bus, out); prv_spi_receive_wait_ready_blocking(slave->spi_bus); return prv_spi_receive_data(slave->spi_bus); } void spi_ll_slave_write(const SPISlavePort *slave, uint8_t out) { PBL_ASSERTN(slave->slave_state->ini...
prv_spi_dma_cmd(slave->spi_bus, SpiI2sDma_ReqRx, false)
; slave->slave_state->dma_complete_handler = NULL; slave->slave_state->dma_complete_context = NULL; } void spi_ll_slave_write_dma_start(const SPISlavePort *slave, const void *out, size_t len, SPIDMACompleteHandler handler, void *context) { PBL_ASSERTN(slave->tx_dma); PBL_ASSER...
/* * 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 uint16_t icon_text_spacing_px = PBL_IF_ROUND_ELSE(2, 4); const uint16_t text_x = TEXT_LEFT_MARGIN_PX; const uint16_t text_y = icon_top_margin_px + MAX(icon_size.h, 6) + icon_text_spacing_px; const uint16_t text_w = frame_size.w - TEXT_LEFT_MARGIN_PX - TEXT_RIGHT_MARGIN_PX; // Limit to 2 lines if ther...
static void prv_simple_dialog_load(Window *window) { SimpleDialog *simple_dialog = window_get_user_data(window); Dialog *dialog = &simple_dialog->dialog; // Ownership of icon is taken over by KinoLayer in dialog_init_icon_layer() call below KinoReel *icon = dialog_create_icon(dialog); const GSize icon_size...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(USART3, USART_FLAG_TC)
rt_dma_request_state; static DMARequest DBG_UART_RX_DMA_REQUEST = { .state = &s_dbg_uart_dma_request_state, .stream = &DMA2_STREAM2_DEVICE, .channel = 4, .irq_priority = IRQ_PRIORITY_INVALID, // no interrupts .priority = DMARequestPriority_VeryHigh, .type = DMARequestType_PeripheralToMemory, .data_size = ...
IRQ_MAP(USART6, uart_irq_handler, ACCESSORY_UART)
; // I2C DEVICES static I2CBusState I2C_PMIC_HRM_BUS_STATE = {}; static const I2CBusHal I2C_PMIC_HRM_BUS_HAL = { .i2c = I2C3, .clock_ctrl = RCC_APB1Periph_I2C3, .clock_speed = 400000, .duty_cycle = I2CDutyCycle_2, .ev_irq_channel = I2C3_EV_IRQn, .er_irq_channel = I2C3_ER_IRQn, }; static const I2CBus I2...
if (!from_reel) { return; } const uint32_t duration = TIMELINE_CARD_TRANSITION_MS; GRect icon_from, icon_to; layer_get_global_frame((Layer *)&card_timeline_layout->icon_layer, &icon_from); layer_get_global_frame((Layer *)&pin_timeline_layout->icon_layer, &icon_to); // Unclip for the scaling animation...
prv_change_reel(layout, new_reel)
; // Unclip for the scaling animation layer_set_clips(&layout->icon_layer.layer, false); } PropertyAnimation *property_animation = property_animation_create_layer_frame((Layer *)layout, (GRect *)from, (GRect *)to); Animation *animation = property_animation_get_animation(property_animation); anim...
ed = false; notification_window_focus_notification(&node->id, animated); } static uint16_t prv_get_num_rows_callback(struct MenuLayer *menu_layer, uint16_t section_index, void *data) { NotificationsData *notifications_data = data; NotificationNode *node = notifications_d...
IS_EMPTY_STRING(subtitle)
) { // we got neither, use the body if (IS_EMPTY_STRING(body)) { // we're screwed... empty message title = "[Empty]"; } else { // try to show as much content as possible in title + subtitle title = body; subtitle = strchr(body, '\n'); // NULL handled gracefully downstream }...
gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_8bit_compor-expect.8bit.pbi")
); gbitmap_destroy(src_bitmap); } // Setup: // - Source is a 1bit image of a white cross with a black background // Result: // - The image names describe the expected result of each destination color / tint color // combination void test_bitblt__1bit_to_8bit_comptint(void) { GBitmap *src_bitmap = get_gbit...
/* * 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...
(written_pcba_serial1, pcba_serial)
; // Write second time const char* written_pcba_serial2 = "abcdefghijkx"; command_pcba_serial_write(written_pcba_serial2); pcba_serial = mfg_get_pcba_serial_number(); cl_assert_equal_s(written_pcba_serial2, pcba_serial); // Write third time const char* written_pcba_serial3 = "asdfghjklq"; command_pcba...
/* * 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...
(layer, &from_rect_a, &to_rect_a)
; animation_set_duration((Animation*)a, DURATION); animation_set_handlers((Animation*) a, (AnimationHandlers) { .started = (AnimationStartedHandler) animation_started, .stopped = (AnimationStoppedHandler) animation_stopped, }, NULL /* callback data */); PropertyAnimation *a_rev = property_animation_clo...
ext_slice_expiration_time = service->next_slice_expiration_time; const bool is_new_slice_expire_time_earlier_than_existing_earliest = (new_slice_expire_time != APP_GLANCE_SLICE_NO_EXPIRATION) && ((next_slice_expiration_time == APP_GLANCE_SLICE_NO_EXPIRATION) || (new_slice_expire_time < next_slice...
if (!service || !uuid || !glance) { return; }
// If necessary, evict the LRU cache entry const uint32_t cache_entry_count = list_count(service->glance_cache); PBL_ASSERTN(cache_entry_count <= LAUNCHER_APP_GLANCE_SERVICE_CACHE_NUM_ENTRIES); if (cache_entry_count == LAUNCHER_APP_GLANCE_SERVICE_CACHE_NUM_ENTRIES) { LauncherAppGlanceCacheEntry *cache_ent...
intf("\nGot line: %s", line); // Find first token char *token = strtok(line, " \t\n"); if (!token) { continue; } // If this is a pre-processor directive, skip it if (token[0] == '#') { continue; } // If this is a comment skip it if (strcmp(token, "//") == 0) { co...
(NULL, " \t\n")
; 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) { ...
* You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * S...
(&s_buffer)
cb; void *cb_context; uint32_t expected_duration; } s_erase = { 0 }; static TimerID s_erase_poll_timer; static TimerID s_erase_suspend_timer; static uint32_t s_analytics_read_count; static uint32_t s_analytics_read_bytes_count; static uint32_t s_analytics_write_bytes_count; static uint32_t s_system_analytics_rea...
{ // An erase was interrupted by e.g. a crash. Retry the erase so the // incompletely-erased sector doesn't cause us trouble later on. PBL_LOG(LOG_LEVEL_WARNING, "Flash erase to 0x%"PRIx32" was interrupted " "last boot. Restarting the erase...", erase_in_progress_address); // When an erase ...
flash_impl_clear_nvram_erase_status(); mutex_unlock(s_flash_lock); } #if UNITTEST void flash_api_reset_for_test(void) { s_erase = (struct FlashEraseContext) {0}; s_flash_lock = NULL; } TimerID flash_api_get_erase_poll_timer_for_test(void) { return s_erase_poll_timer; } #endif //! Assumes that s_flash_loc...
= { .addr = dest_data, .row_size_bytes = 100, .info.format = GBitmapFormat8Bit, .info.version = GBITMAP_VERSION_CURRENT, .bounds = { { 0, 0 }, { 100, 100 } } }; memset(dest_data, GColorBlue.argb, sizeof(dest_data)); GRect dest_rect = GRect(0, 0, src_bitmap->bounds.size.w*2, src_bitmap->bounds...
cl_assert(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_8bit_src_origin_offset_wrap-expect.8bit.pbi"))
; gbitmap_destroy(src_bitmap); } // Setup: // - Source width is not a multiple of 8 (ie. not byte aligned in source) // - Source starts with 2 rows and 4 columns of black pixels. // - Dest is all blue. // - Src origin is set to (4, 2) // - dest origin is set to 22, 6 // - dest size is twice the height /...
s_pfs_mutex); return (res); } int pfs_write(int fd, const void *buf_ptr, size_t size) { const uint8_t *buf = buf_ptr; mutex_lock_recursive(s_pfs_mutex); int res = E_UNKNOWN; if (!FD_VALID(fd) || (buf == NULL) || (size == 0)) { res = E_INVALID_ARGUMENT; goto cleanup; } File *file = &PFS_FD(fd).fi...
(LOG_LEVEL_WARNING, "Removing temp file at %d", curr_pg)
; unlink_flash_file(curr_pg); } } else if (page_type_bits_set(page_flags, DELETED_START_PAGE_MASK) && !is_delete_complete(curr_pg)) { PBL_LOG(LOG_LEVEL_WARNING, "Delete of %d did not complete", curr_pg); unlink_flash_file(curr_pg); } } update_last_written_page(); } static...
/* * 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...
while (length < src_length) { int8_t header = *((int8_t*) src++); length++; if (header >= 0) { int count = header + 1; memcpy(dest, src, count); dest += count; src += count; length += count; } else { int count = 1 - header; memset(dest, *src, count); de...
}
/ duration = whole_number test_reel_data->duration_ms = ANIMATION_DURATION_INFINITE; kino_player_play(test_player); animation_set_elapsed(test_player->animation, 20); animation_set_duration(test_player->animation, 300); prv_play_animation_update(test_player->animation, 0); // intentionally bad value cl_...
(test_reel)
/* * 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, &kino_layer->layer.bounds)
/* * 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...
("Checksumming ")
; dbgserial_print_hex(firmware_description->firmware_length); dbgserial_print(" bytes\r\n"); const uint32_t crc = crc32(CRC32_INIT, (const uint8_t *)FIRMWARE_BASE, firmware_description->firmware_length); dbgserial_print("Checksum - wanted "); dbgserial_print_hex(firmware_descrip...
ed if (type != AnalyticsEvent_BtLeDisconnect) { analytics_event_bt_connection_or_disconnection(type, reason); } else { if (!vers_info) { // We expect version info PBL_LOG(LOG_LEVEL_WARNING, "Le Disconnect but no version info?"); } else { analytics_event_bt_le_disconnection(reason, vers_info-...
serial_distance32(orig_stats->num_mic_errors, stats_buf->num_mic_errors)
; PBL_LOG(LOG_LEVEL_INFO, "%sBytes Conn Stats: Events: %"PRIu32", Sync Errs: %"PRIu32 ", Skipped Events: %"PRIu32" Other Errs: %"PRIu32, is_putbytes ? "Put" : "Get", stats_buf->num_conn_events, stats_buf->num_sync_errors, stats_buf->num_conn_events_skipped, prv_calc_other_errors(stats...
NULL)); s_test_impl.reset = dummy; s_test_impl.cancel = NULL; cl_assert_passert(recognizer_create_with_data(&s_test_impl, &s_test_impl_data, sizeof(s_test_impl_data), dummy, NULL)); recognizer_destroy(r); } void te...
recognizer_transition_state(r, RecognizerState_Started)
); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Updated)); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Cancelled)); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Completed)); r->state = RecognizerState_Started; event_type = -1; recognizer_transiti...
another subscription for this app. if (is_app_subscription) { HRMSubscriberState * state = prv_get_subscriber_state_from_app_id(current_task, app_id); if (state != NULL) { session_ref = state->session_ref; PBL_LOG(LOG_LEVEL_DEBUG, "Removing existing subscription for this app"); prv_remove_an...
if (state) { state->update_interval_s = update_interval_s; state->expire_utc = (expire_s != 0) ? (rtc_get_time() + expire_s) : 0; state->sent_expiration_event = false; success = true; }
system_task_add_callback(prv_update_hrm_enable_system_cb, NULL); mutex_unlock_recursive(s_manager_state.lock); return success; } DEFINE_SYSCALL(bool, sys_hrm_manager_is_hrm_present) { return s_hrm_present; } void hrm_manager_enable(bool on) { mutex_lock_recursive(s_manager_state.lock); s_manager_state.en...
count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_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), 0); cl_assert_equal_i(prv_...
(prv_count_handler_entries(&s_teardown_handler_calls, b), 1)
; cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, complex), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, c), 1); cl_assert_equal_i(prv_last_update_distance(a), ANIMATION_NORMALIZED_MAX); cl_assert_equal_i(prv_last_update_distance(b), ANIMATION_NORMALIZED_MAX)...
) { return (intent->client[GAPLEClientKernel].is_used | intent->client[GAPLEClientApp].is_used); } // ------------------------------------------------------------------------------------------------- static bool prv_is_intent_requiring_encryption(const GAPLEConnectionIntent *intent) { return (intent->cli...
(request->bonding.id)
; } else { is_already_connected = gap_le_connection_is_connected(request->device); intent = prv_get_intent_by_device(request->device); } const bool is_existing_intent = (intent != NULL); if (is_existing_intent) { if (intent->client[c].is_used) { return BTErrnoInvalidState; } } else { ...
-88, -184}, { 912, -80, -64}, { 1160, -24, 16}, // 18 seconds { 1552, 88, 8}, { 1888, 120, -112}, { 2112, 64, -56}, { 1560, 152, -184}, { 1072, 80, -224}, { 832, -112, -80}, { 992, -120, 64}, { 1088, -152, 136}, { 1040, -40, 64}, { 952, 24, 0}, { 880, 16, -112}, ...
{ 1192, -48, 56}, { 1144, -8, 56}, { 960, -24, -8}, { 864, -56, 0}, { 848, -24, -16}, { 864, -56, -56}, { 840, -40, -72}, { 904, -56, -104}, { 1280, -88, -16}, { 1336, 24, -152}, { 1200, 32, -248}, { 1080, -32, -296}, { 1296, 0, -440}, { 1272, 0, -200}, { 1112...
{ 1032, -232, -296}, { 944, -376, -216}, { 944, -360, -256}, { 944, -336, -304}, { 936, -312, -248}, { 968, -224, -192}, { 1072, -136, -216}, { 1040, -56, -184}, { 984, -64, -136}, { 896, -64, -160}, { 1288, -152, -112}, { 1712, -88, -280}, { 1152, -56, -112}, { ...
xp_session); prv_feed_activity_minutes(minute_raw_data, k_minute_data_len); cl_assert_equal_i(s_num_captured_activity_sessions, 1); ASSERT_ACTIVITY_SESSION_PRESENT(s_captured_activity_sessions, s_num_captured_activity_sessions, &exp_session); } // -------------------------------------------------------...
kernel_free(s_kalg_state)
; s_kalg_state = NULL; } // --------------------------------------------------------------------------------------- void test_kraepelin_algorithm__sleep_stats(void) { // Init algorithm state s_kalg_state = kernel_zalloc(kalg_state_size()); // It's easier to understand the algorithm log messages if we start a...
oll_layer_set_paging(scroll_layer, false); cl_assert_equal_b(false, prv_scroll_layer_is_paging_enabled(scroll_layer)); // verify shadow layer is hidden on paging disabled cl_assert_equal_b(true, scroll_layer_get_shadow_hidden(scroll_layer)); } void test_scroll_layer__paging_vs_shadow_bits(void) { ScrollLayer *...
scroll_layer_get_content_offset(scroll_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...
PBL_LOG(LOG_LEVEL_WARNING, "Invalid recovery firmware CRC in SPI flash!")
/* * 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...
(RESOURCE_ID_NOTIFICATION_GENERIC_LARGE)
; KinoReel *to_image = kino_reel_create_with_resource(RESOURCE_ID_GENERIC_CONFIRMATION_LARGE); KinoReel *icon_reel = kino_reel_morph_square_create(from_image, true); kino_reel_transform_set_to_reel(icon_reel, to_image, true); kino_reel_transform_set_transform_duration(icon_reel, 10000); kino_layer_set_reel(&...
cl_assert_equal_i(recognizers[4]->state, RecognizerState_Failed)
; // A touchdown occurs where no layers are touched while a window recognizer is active e.type = TouchEvent_Touchdown; s_active_layer = NULL; recognizer_manager_handle_touch_event(&e, &manager); prv_compare_recognizers_processed((int[]) { 0 }, 1, &s_recognizers_handled); prv_compare_recognizers_processed(N...
nclude "system/passert.h" #include <bluetooth/gap_le_connect.h> #include <bluetooth/hrm_service.h> #include <btutil/bt_device.h> #include <util/list.h> #include <util/size.h> #if CAPABILITY_HAS_BUILTIN_HRM #define BLE_HRM_UPDATE_INTERVAL_SEC (1) typedef struct BLEHRMSharingRequest { GAPLEConnection *connection; }...
prv_is_sharing(connection)
) { *ctx->next_permitted_device = connection->device; ++ctx->next_permitted_device; --ctx->slots_left; } } static size_t prv_copy_sharing_devices(BTDeviceInternal *devices_out, size_t max_devices) { bt_lock(); CopySharingDevicesCtx ctx = { .next_permitted_de...
redCircularBufferClient) {}; shared_circular_buffer_add_client(&buffer, &client); // We should start out empty cl_assert(!shared_circular_buffer_read(&buffer, &client, 1, &out_buffer, &out_length)); cl_assert(shared_circular_buffer_write(&buffer, (uint8_t*) "123", 3, false)); cl_assert_equal_i(shared_circul...
shared_circular_buffer_consume(&buffer, &client2, 4)
); cl_assert(memcmp(out_buffer, "1234", 4) == 0); cl_assert_equal_i(shared_circular_buffer_get_write_space_remaining(&buffer), 6); // Make client2 fall behind cl_assert(shared_circular_buffer_write(&buffer, (uint8_t*) "abcdef", 6, false)); cl_assert_equal_i(shared_circular_buffer_get_write_space_remaining(&...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ PBL_LOG(LOG_LEVEL_ERROR, "Too short"); return true; }
return false; } static bool prv_receive_push_cmd(CommSession *session, AppMessagePush *push_message, size_t length) { if (prv_has_invalid_length(sizeof(AppMessagePush), length)) { return false; } bool success = false; // Scan the dictionary: const size_t dict_size = ...
put (unspecified digits, acts as zero) snprintf(dstbuf, 256, "%.izero%.i", 0, 1); cl_assert_equal_s(dstbuf, "zero1"); // Minimum digits output (negative digits, acts as zero) snprintf(dstbuf, 256, "%.-3izero%.-3i", 0, 1); cl_assert_equal_s(dstbuf, "zero1"); // Minimum digits output (non-zero digits output...
cl_assert_equal_s(dstbuf, "1311768467463790320,1311768467463790320")
; snprintf(dstbuf, 256, "%zu,%tu", hurf, hurf); cl_assert_equal_s(dstbuf, "2596069104,2596069104"); } void test_sprintf__percent_o(void) { char dstbuf[256]; // Simple %o snprintf(dstbuf, 256, "There are %o lights, %o", 8, -4); cl_assert_equal_s(dstbuf, "There are 10 lights, 37777777774"); // Alternate ...
"fake_spi_flash.h" #include "fake_session.h" #include "fake_new_timer.h" #include "fake_pbl_malloc.h" #include "fake_rtc.h" #include "stubs_analytics.h" #include "stubs_bt_lock.h" #include "stubs_hexdump.h" #include "stubs_logging.h" #include "stubs_mutex.h" #include "stubs_passert.h" #include "stubs_prompt.h" #include...
{ uint8_t buffer[num_bytes]; uint32_t read_bytes = dls_test_read(logging_session, buffer, num_bytes); cl_assert(read_bytes == num_bytes); uint32_t session_crc = legacy_defective_checksum_memory(buffer, num_bytes); cl_assert(crc == session_crc); dls_test_consume(logging_session, num_bytes); cl_assert(dls...
// ---------------------------------------------------------------------------------------- // log some random data, return its crc32 static uint32_t prv_log_random_data(DataLoggingSessionRef logging_session, int item_size, int num_items) { PBL_LOG(LOG_LEVEL_INFO, "Logging %d byt...
bool did_change, const MenuCellSpan *prev_selection, bool was_animating, bool animated) { if (menu_layer->center_focused && animated) { prv_schedule_center_focus_animation(menu_layer, up, prev_selection, was_animating); } else { pr...
(menu_layer, &new_index, menu_layer->selection.index, menu_layer->callback_context)
; if (menu_index_compare(&new_index, &menu_layer->selection.index) == 0) { // locked into old index } else if (menu_index_compare(&new_index, &it->it.cursor.index) == 0) { // new index is the index we wanted to select menu_layer->selection = it->it.cursor; } else { // w...
ver, (uint8_t *)data, strlen(data)); prv_assert_no_handler_calls(); g_default_kernel_receiver_implementation.finish(receiver); // CBs shouldn't immediately execute since they are pended on KernelBG prv_assert_no_handler_calls(); prv_set_expected_data(data, strlen(data)); fake_system_task_callbacks_invoke...
(receiver, (uint8_t *)data, strlen(data))
; prv_assert_no_handler_calls(); g_default_kernel_receiver_implementation.finish(receiver); g_default_kernel_receiver_implementation.cleanup(receiver); // our msg should not have been freed since it was offloaded to kernelBG cl_assert(fake_pbl_malloc_num_net_allocs() != 0); prv_set_expected_data(data, st...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(memcmp(out_buffer, (uint8_t*) "56789", 5) == 0)
; cl_assert(shared_circular_buffer_consume(&buffer, &client, 5)); // Get the rest of the wrapped read cl_assert(shared_circular_buffer_read(&buffer, &client, 1, &out_buffer, &out_length)); cl_assert_equal_i(out_length, 1); cl_assert(memcmp(out_buffer, (uint8_t*) "a", 1) == 0); cl_assert(shared_circular_buf...
ude "applib/ui/layer.h" #include "clar.h" #include "util.h" #include <stdio.h> // Helper Functions //////////////////////////////////// #include "test_graphics.h" #if SCREEN_COLOR_DEPTH_BITS == 8 #include "8bit/test_framebuffer.h" #else #include "1bit/test_framebuffer.h" #endif // Stubs //////////////////////...
test_graphics_context_reset(&ctx, fb)
str_buf[TIME_BUFFER_LENGTH]; strftime(time_str_buf, TIME_BUFFER_LENGTH, format, &time); safe_strcat(out_buf, string_strip_leading_whitespace(time_str_buf), buf_length); } // ----------------------------------------------------------------------------------------- // Generates the sleep enter/exit time and total ti...
(TIME_STRING_TIME_LENGTH)
); return (S_SUCCESS); } static status_t write_pg_header(PageHeader *hdr, uint16_t pg) { // recover current erase count which is updated in erase routine prv_flash_read((uint8_t *)&hdr->erase_count, sizeof(hdr->erase_count), prv_page_to_flash_offset(pg) + offsetof(PageHeader, erase_count)); prv_flash_rea...
if (s_test_last_page_written_override != -1) { s_last_page_written = s_test_last_page_written_override; }
#endif } //! @param region - The erase sector we want to scan through //! @param first_free_page - Populated with the first erased page found //! in the region. If none are found, populated with INVALID_PAGE //! @return A bitmask indicating which pages in the sector are occupied. //! For example, 0b1001 would...
/* * 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_prf_storage_ble_delete_count++; }
/////////////////////////////////////////////////////////////////////////////////////////////////// //! BT Classic Pairing Data bool shared_prf_storage_get_bt_classic_pairing_data(BTDeviceAddress *addr_out, char *device_name_out, ...