prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
RE_OCCURRED); // We have a "three strikes" algorithm: if the watch fails three times, return true // to tell the parent we should load the recovery firmware. A reset for any other reason // will reset this algorithm. if (boot_bit_test(BOOT_BIT_FW_START_FAIL_STRIKE_TWO)) { // Yikes, our firmware is screwed....
("Last firmware boot was stable; clear strikes")
_text(transcription_dialog, transcription, len); app_transcription_dialog_push(transcription_dialog); transcription_dialog_set_callback(transcription_dialog, prv_transcription_dialog_cb, data); } ///////////////////////////////////// // Set up dialog labels and callbacks typedef struct DialogNode { const char *...
(window, &(WindowHandlers) { .load = prv_window_load, })
; const bool animated = true; app_window_stack_push(window, animated); } static void prv_handle_deinit() { DialogsData *data = app_state_get_user_data(); menu_layer_deinit(&data->menu_layer); i18n_free_all(data); app_free(data); } //////////////////// // App boilerplate static void s_main(void) { prv_h...
Main); const AppInstallId id = config->id; const bool is_worker = config->worker; if (id == INSTALL_ID_INVALID) { PBL_LOG(LOG_LEVEL_DEBUG, "Invalid ID"); return; } const PebbleProcessMd *md = NULL; #if !RECOVERY_FW if (app_install_id_from_app_db(id)) { if (!process_manager_check_SDK_compatib...
(ANALYTICS_APP_METRIC_FRONT_MOST_TIME)
; } analytics_external_collect_app_cpu_stats(); analytics_external_collect_app_flash_read_stats(); } // --------------------------------------------------------------------------------------------- //! This method returns true if the process is safe to kill (it has exited out of it's main function). If the //! ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
memcpy(val, s_ios_pref_db_insert_dict, sizeof(s_ios_pref_db_insert_dict))
; ios_notif_pref_db_insert(key, sizeof(key), val, sizeof(val)); uint32_t flags = ios_notif_pref_db_get_flags(key, sizeof(key)); cl_assert_equal_i(flags, 0); } void test_ios_notif_pref_db__store_prefs(void) { // Create an attribute list and action group AttributeList attr_list; attribute_list_init_list(0,...
alse, false, false, false}; char alarm_day_text_4[32] = {0}; alarm_get_string_for_custom(schedule_4, alarm_day_text_4); cl_assert_equal_s(alarm_day_text_4, "Tuesdays"); bool schedule_5[7] = {false, false, false, true, false, false, false}; char alarm_day_text_5[32] = {0}; alarm_get_string_for_custom(schedu...
cl_assert_equal_i(s_num_alarm_events_put, 0)
; s_current_minute = 10; cl_assert_equal_i(s_num_alarm_events_put, 1); } void test_alarm__get_string_for_kind(void) { bool all_caps = false; cl_assert_equal_s(alarm_get_string_for_kind(ALARM_KIND_EVERYDAY, all_caps), "Every Day"); cl_assert_equal_s(alarm_get_string_for_kind(ALARM_KIND_WEEKDAYS, all_caps), "W...
ystem_task.h" #include "services/normal/accessory/smartstrap_attribute.h" #include "services/normal/accessory/smartstrap_comms.h" #include "services/normal/accessory/smartstrap_connection.h" #include "services/normal/accessory/smartstrap_profiles.h" #include "services/normal/accessory/smartstrap_state.h" #include "sysc...
if ((current_state == SmartstrapAttributeStateWritePending) && (new_state == SmartstrapAttributeStateIdle)) { return pebble_task_get_current() == CONSUMER_TASK; } else if ((current_state == SmartstrapAttributeStateRequestPending) && (new_state == SmartstrapAttributeStateIdle)) { retu...
} static void prv_set_attribute_state(SmartstrapAttributeInternal *attr, SmartstrapAttributeState new_state) { PBL_ASSERTN(prv_is_valid_fsm_transition(attr, new_state)); attr->state = new_state; } //! Note; This should only be called from the consumer task static bool prv_star...
/* * 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...
IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable)
; IWDG_SetPrescaler(IWDG_Prescaler_64); // ~8 seconds IWDG_SetReload(0xfff); IWDG_WriteAccessCmd(IWDG_WriteAccess_Disable); DBGMCU_APB1PeriphConfig(DBGMCU_IWDG_STOP, ENABLE); } void watchdog_start(void) { IWDG_Enable(); watchdog_feed(); } // This behaves differently from the bootloader and the firmware...
I_FILE)); } // Tests 2-bit palettized PBI loading into gbitmap // Result: // - gbitmap matches platform loaded PBI void test_bitblt_circular__color_2_bit(void) { GBitmap *bitmap = setup_png_test(TEST_PNG_FILE); GBitmap *native_framebuffer = graphics_context_get_bitmap(ctx); cl_assert(native_framebuffer->info.f...
(gbitmap_pbi_eq(native_framebuffer, TEST_PBI_FILE))
; } void test_bitblt_circular__8_bit_converted_circular_offset(void) { GBitmap *bitmap = setup_png_test(TEST_NAMED_PNG_FILE("test_bitblt_circular__spiral")); cl_assert(bitmap->info.format == GBitmapFormat8Bit); // Convert input PNG from rectangular to circular gbitmap_8bit_to_8bit_circular(bitmap); cl_asser...
} // ------------------------------------------------------------------------------------------- // @param state our context // @param now the time we are running to. When called from animation_set_elapsed, this will // be in the future, otherwise it will be the current time // @param top_level_animation only u...
{ break; }
animation_array[array_len++] = arg; } } // Create from an array return func(animation_array, array_len); } // ------------------------------------------------------------------------------------------- // Complex animations don't perform any logic in their update callback static void prv_complex_ani...
rrent size down to 0. // When this completes, prv_animation_stopped_failure will show the peek layer. GRect *start = &data->progress_layer.layer.frame; GRect stop = *start; stop.size.w = 0; PropertyAnimation *prop_anim = property_animation_create_layer_frame((Layer *)&data->progress_layer, start, &stop...
(window_stack, (Window *)window, animated)
dex, void *context) { ActivityDemoAppData *data = context; prv_display_scalar_history_alert(data, "Resting Calories", ActivityMetricRestingKCalories); } // ----------------------------------------------------------------------------------------- static void prv_debug_cmd_active_calorie_history(int index, void *co...
(data->debug_card.dialog_text)
; } // ----------------------------------------------------------------------------------------- static void prv_debug_cmd_step_sessions(int index, void *context) { ActivityDemoAppData *data = context; // Allocate space for the sessions. Usually, there will only be about 4 or 5 sessions // (1 container and a h...
// unexpected error goto cleanup; } // check to see if we are trying to read the file and it doesn't exist bool is_read_only = (op_flags & (OP_FLAG_READ | OP_FLAG_WRITE | OP_FLAG_OVERWRITE)) == OP_FLAG_READ; bool is_tmp = ((op_flags & OP_FLAG_OVERWRITE) != 0); if ((is_read_only || is_tmp) && (res ...
(fd, &hdr, sizeof(hdr))
ion 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS...
PBL_ASSERTN(ctx)
; ctx->lock = false; framebuffer_dirty_all(ctx->parent_framebuffer); return true; } void test_simple_dialog__initialize(void) { fb = malloc(sizeof(FrameBuffer)); framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); test_graphics_context_init(&s_ctx, fb); framebuffer_clear(fb); // Setup resources f...
ColorBlack, false); graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4); ASSERT_CALLED(prv_draw_round_rect_stroked(&context, &GRect(20, 80, 40, 10), 4, SW_ODD)); } void test_graphics_context_${BIT_DEPTH_NAME}__draw_antialiased_stroke_width_2(void) { // Stroke width = 2, antialiased setup_test(&contex...
GPoint(50, 50)
/* * 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_IF_RECT_ELSE(PBL_IF_BW_ELSE(43, 38), 43)
/* * 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 true; }
return false; } bool gtransform_is_only_scale(const GTransform * const t) { if (!t) { return false; } if ((t->b.raw_value == GTransformNumberZero.raw_value) && (t->c.raw_value == GTransformNumberZero.raw_value) && (t->tx.raw_value == GTransformNumberZero.raw_value) && (t->ty.raw_value ...
_switch); } else { BMI160_DBG("%s", "We fell behind on motion interrupt handling!"); } } static uint8_t prv_get_fifo_frame_size(void) { return 6; // we are just storing {x, y, z} accel data in the fifo today } static uint16_t prv_get_current_fifo_length_and_timestamp(uint64_t *timestamp_us) { int retries ...
(BMI160_REG_INT_STATUS_1)
, status); } } static void bmi160_IRQ2_handler(bool *should_context_switch) { if (!s_accel_outstanding_data_work) { s_accel_outstanding_data_work = true; accel_offload_work_from_isr(prv_handle_data, should_context_switch); } else { BMI160_DBG("%s", "We fell behind on data handling"); } } // in ord...
/* * 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); }
// ---------------------------------------------------------------------------------------- //! @param data unused static void prv_check_all_sessions_timer_cb(void *data) { // If sends are not enabled, do nothing if (!prv_sends_enabled()) { PBL_LOG(LOG_LEVEL_INFO, "Not sending sessions beause sending is disa...
viour_Off); settings_file_set(file, PREF_KEY_BACKLIGHT_ENABLED, sizeof(PREF_KEY_BACKLIGHT_ENABLED), &temp, sizeof(temp)); temp = (backlight_behaviour != BacklightBehaviour_On); settings_file_set(file, PREF_KEY_BACKLIGHT_AMBIENT_SENSOR_ENABLED, sizeof(PREF_KEY_BACK...
(entry, value, val_len)
; } } // ------------------------------------------------------------------------------------ // Exported function used by blob_db API to set the backing store for a specific key bool prefs_private_write_backing(const uint8_t *key, size_t key_len, const void *value, int value_len) { ...
/* * 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 true; }
te))); cl_assert_equal_i(gbitmap_get_format(bitmap), GBitmapFormat2BitPalette); } // Tests 4-bit transparent palettized PNG loading into gbitmap // Result: // - gbitmap matches platform loaded PNG void test_png__color_4_bit_transparent(void) { GBitmap *bitmap = setup_png_test(TEST_PNG_FILE_FMT(4bitpalette)); c...
cl_assert_equal_i(gbitmap_get_format(bitmap), GBitmapFormat8Bit)
; }
if (callbacks->draw_row) { const bool is_selected = menu_cell_layer_is_highlighted(cell_layer); callbacks->draw_row(callbacks, ctx, cell_layer, row, is_selected); }
} static uint16_t prv_get_num_rows_callback(MenuLayer *menu_layer, uint16_t section_index, void *context) { PBL_ASSERTN(section_index < SettingsMenuItem_Count); SettingsData *data = context; SettingsCallbacks *callbacks = prv_get_current_callbacks(data); return callb...
nt8_t *)&app_id, sizeof(AppInstallId)); prv_close_file_and_unlock_mutex(); return exists; } typedef struct { AppDBEnumerateCb cb; void *data; AppDBEntry *entry_buf; } EnumerateData; static bool prv_enumerate_entries(SettingsFile *file, SettingsRecordInfo *info, void *co...
PBL_ASSERTN(key_len == 16)
; AppInstallId app_id = prv_find_install_id_for_uuid(&s_app_db.settings_file, (Uuid *)key); if (app_id == INSTALL_ID_INVALID) { rv = E_DOES_NOT_EXIST; } else { rv = settings_file_get(&s_app_db.settings_file, (uint8_t *)&app_id, sizeof(AppInstallId), val_out, val_len); } pr...
oami(void) { const uint8_t chip_id = bma255_read_register(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; ...
BMA255_DBG("%2d: %"PRId16" %"PRId16" %"PRId16" %"PRIu32, i, data[i].x, data[i].y, data[i].z, (uint32_t)data[i].timestamp_us)
; accel_cb_new_sample(&data[i]); } // clear of fifo overrun flag must happen after draining samples, also the samples available will // get drained too! if ((fifo_status & 0x80) && !s_fifo_overrun_detected) { s_fifo_overrun_detected = true; // We don't clear the interrupt here because you are only ...
/* * 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, "No connection for dev_name_request: " BT_DEVICE_ADDRESS_FMT, BT_DEVICE_ADDRESS_XPLODE_PTR(&addr->address)); return; }
prv_gap_le_device_name_request(connection); } static void prv_handle_request_all_cb(Connection *connection, void *data) { prv_gap_le_device_name_request(connection); } void gap_le_device_name_handle_request_all(void) { connection_for_each(prv_handle_request_all_cb, NULL); }
/* * 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...
(diff <= 1 && diff >= -1)
; } cl_assert(isnan(log(-1.0))); cl_assert(log(0) == -HUGE_VAL); cl_assert(isnan(log(NAN))); cl_assert(isinf(log(INFINITY))); }
xc9, 0x7f, 0x40, 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, 0x4...
(pin_db_read_item_header(&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); }
{ 416, 680, -576}, { 416, 664, -576}, { 416, 672, -576}, { 416, 672, -576}, { 408, 672, -568}, { 416, 672, -576}, { 416, 672, -568}, { 416, 680, -576}, { 408, 672, -576}, { 408, 664, -568}, { 416, 672, -576}, { 408, 664, -576}, { 408, 672, -576}, { 416, 672, -576}...
{ 416, 680, -568}, { 416, 672, -568}, { 416, 672, -560}, { 416, 688, -552}, { 416, 696, -552}, { 416, 688, -544}, // 77 seconds { 424, 696, -544}, { 416, 696, -544}, { 416, 696, -544}, { 416, 696, -544}, { 416, 696, -544}, { 416, 704, -544}, { 400, 760, -552}, ...
framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); test_graphics_context_init(&context, fb); } // Teardown void test_graphics_context_${BIT_DEPTH_NAME}__cleanup(void) { free(fb); } ///////////////////////////////////// /// TESTS ///////////////////////////////////// void test_graphics_context_${BIT_DEPTH_NA...
(context.draw_state.stroke_width == 11)
; // Make sure setting to zero is ignored draw_state = graphics_context_get_drawing_state(&context); graphics_context_set_stroke_width(&context, 0); cl_assert(memcmp(&draw_state, &context.draw_state, sizeof(GDrawState)) == 0); // Check draw state memset(&draw_state, 0x5A, sizeof(GDrawState)); graphics_c...
0xb9, 0x60, 0xf2, 0xb0, 0x2a, 0x6d, 0xd7, 0x57}; static const Uuid sports_uuid = {0x4d, 0xab, 0x81, 0xa6, 0xd2, 0xfc, 0x45, 0x8a, 0x99, 0x2c, 0x7a, 0x1f, 0x3b, 0x96, 0xa9, 0x70}; AppInstallId tictoc_id; AppInstallId music_id; AppInstallId sports_id; AppInstallId bg_co...
(&id_entry, &uuid_entry)
); cl_assert_equal_b(true, app_install_get_entry_for_install_id(bg_counter_id, &id_entry)); cl_assert_equal_b(true, app_install_get_entry_for_uuid(&bg_counter.uuid, &uuid_entry)); cl_assert_equal_b(true, app_install_entries_equal(&id_entry, &uuid_entry)); cl_assert_equal_b(true, app_install_get_entry_for_inst...
_name)) && prv_field_valid((uint8_t *)&data->getting_started, sizeof(data->getting_started)))) { return true; } return false; } // Stored struct setters static void prv_write_to_current_page(SharedPRFData *data, bool write_metadata) { if (data) { if (write_metadata) { data->magic = SprfMag...
if (data->magic == SprfMagic_UnpopulatedEntry) { // Struct that is written is currently unpopulated. Set it up and write // the struct's Magic and Version prv_write_to_current_page(data, true); } else if ((old_crc == new_crc) && same_data) { // We are trying to write the same data, ignore the write ...
PBL_LOG(LOG_LEVEL_DEBUG, "Overwriting SPRF field at offset %d, size %d", (int)offset, (int)field_size); // write the crc first so it's easier to detect a non empty field (we can just read if the CRC is // not 0xFFFFFFFF instead of comparing all bytes. *(uint32_t *)field = new_crc; flash_write_by...
r *item_layer = &data->pin_window.item_detail_layer; timeline_layout_transition_card_to_pin(item_layer->timeline_layout, pin_timeline_layout); } #endif // animate the timeline layer from the left Layer *layer = &data->timeline_layer.layer; GPoint from_origin = { -layer->bounds.size.w, 0 }; Animation *lay...
if (!timeline_model_is_empty()) { timeline_layer_set_sidebar_width(&s_app_data->timeline_layer, timeline_layer_get_ideal_sidebar_width()); }
#endif } static void NOINLINE prv_deinit(void) { prv_cleanup_timer(&s_app_data->intro_timer_id); prv_cleanup_timer(&s_app_data->inactive_timer_id); event_service_client_unsubscribe(&s_app_data->focus_event_info); event_service_client_unsubscribe(&s_app_data->blobdb_event_info); timeline_layer_deinit(&s_ap...
/* * 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...
memcpy(buffer, s_state.storage + (start_addr - s_state.offset), buffer_size)
; } void flash_write_bytes(const uint8_t* buffer, uint32_t start_addr, uint32_t buffer_size) { cl_assert(start_addr >= s_state.offset); cl_assert(start_addr + buffer_size <= s_state.offset + s_state.length); ++s_state.write_count; for (int i = 0; i < buffer_size; ++i) { if (s_state.jmp_on_failure != NULL...
t(parent.first_child == &child_a); cl_assert(child_a.next_sibling == &child_c); cl_assert(grand_child_a.parent == &child_a); cl_assert(child_c.parent == &parent); // Remove first-child (child_a): // // +-parent // | // '->child_c // // +-child_a // | // '->grand_child_a //...
cl_assert_equal_p(a, stack[0])
cl_assert(do_not_disturb_is_smart_dnd_enabled() == false); active = do_not_disturb_is_active(); cl_assert(active == false); // Manual && !Scheduled && !Smart do_not_disturb_set_manually_enabled(true); cl_assert(do_not_disturb_is_manually_enabled() == true); cl_assert(do_not_disturb_is_schedule_enabled(W...
do_not_disturb_is_schedule_enabled(WeekdaySchedule)
== true); active = do_not_disturb_is_active(); cl_assert(active == false); // Both OFF } void test_do_not_disturb__disable_manual_dnd_when_scheduled_ends(void) { bool active; // Time 00:00, Manual and Scheduled DND both OFF DoNotDisturbSchedule schedule = { .from_hour = 1, .from_minute = 0, .to_...
ableDialog *) transcription_dialog)->scroll_layer; TextLayer *text_layer = &dialog->text_layer; const GSize size = text_layer_get_content_size(graphics_context_get_current_context(), text_layer); const uint16_t font_height = fonts_get_font_height(text_layer->font); text_layer_set_size(text_layer, (GSize...
{ action_bar_layer_clear_icon(&transcription_dialog->e_dialog.action_bar, BUTTON_ID_SELECT); }
else { transcription_dialog_pop(transcription_dialog); } } static void prv_transcription_dialog_select_handler(ClickRecognizerRef recognizer, void *context) { TranscriptionDialog *transcription_dialog = context; if (transcription_dialog->select_pressed) { // We are waiting to pop the window, don't run t...
Length // Attribute text: "Subtitle" 'S', 'u', 'b', 't', 'i', 't', 'l', 'e', // Attribute 3 0x03, // Attribute ID - Body 0x3f, 0x00, // Attribute Length // Attribute text: "This is a test notification. Look at it and behold the awesome." 0x54, 0x68, 0x69, 0x73, 0x20, 0x6...
cl_assert_equal_s(item->attr_list.attributes[1].cstring, "Subtitle")
; cl_assert_equal_i(item->attr_list.attributes[2].id, AttributeIdBody); cl_assert_equal_s(item->attr_list.attributes[2].cstring, "This is a test notification. " "Look at it and behold the awesome."); cl_assert_equal_i(item->action_group.num_actions, ...
er fat permits. .primary_secondary_peek_margin_h = -5, .thin_can_have_secondary = true, }; static const TimelineLayoutStyle * const s_styles[NumPreferredContentSizes] = { [PreferredContentSizeSmall] = &s_style_medium, [PreferredContentSizeMedium] = &s_style_medium, [PreferredContentSizeLarge] = &s_style_larg...
timeline_layout_init_with_icon_id(layout, config, timeline_layout_impl, icon_resource)
; } void timeline_layout_deinit(TimelineLayout *timeline_layout) { if (timeline_layout->metric_icon_layers) { for (unsigned int i = 0; i < timeline_layout->num_metric_icon_layers; i++) { kino_layer_destroy(timeline_layout->metric_icon_layers[i]); } task_free(timeline_layout->metric_icon_layers); ...
ction, ConnectionFlag_IsSubscribedToGattMtuNotifications); } bool connection_is_subscribed_to_conn_param_notifications(const Connection *connection) { return prv_get_flag(connection, ConnectionFlag_IsSubscribedToConnParamNotifications); } // // Setters // void connection_set_gateway(Connection *connection, bool is...
{ prv_lock(); { GattOperation *node = kernel_malloc_check(sizeof(GattOperation)); *node = (GattOperation) { .object_ref = context_ref, .resp_dest = resp_dest, .op_type = op_type, }; connection->gatt_op_list = (GattOperation *) list_get_head(list_append((ListNode *)connectio...
, &buffer, serialized_prefs->num_attributes, serialized_prefs->num_actions, attributes_per_action); if (!attributes_actions_deserialize(&notif_prefs->attr_list, &notif_prefs->action_group, ...
{ if (key_len == 0) { return E_INVALID_ARGUMENT; } SettingsFile file; status_t rv = prv_file_open_and_lock(&file); if (rv != S_SUCCESS) { return rv; } rv = settings_file_delete(&file, key, key_len); prv_file_close_and_unlock(&file); return rv; }
1 }; Fixed_S16_3 x2_fixed = (Fixed_S16_3) { .integer = x2 }; const uint8_t gradient_width = (uint8_t)((x2 - x1) / 2); x2_fixed.integer -= gradient_width; const int16_t clip_box_min_x = ctx->draw_state.clip_box.origin.x; const int16_t clip_box_max_x = (int16_t)(grect_get_max_x(&ctx->draw_state.clip_box) - 1);...
(ctx, transparent_mask)
; GDrawMask *opaque_mask = graphics_context_mask_create(ctx, false /* transparent */); cl_assert(opaque_mask); // Verify all mask pixels are initialized to be opaque (3) prv_verify_mask_pixel_values(ctx, opaque_mask, 3); graphics_context_mask_destroy(ctx, opaque_mask); } //extern const GDrawRawImplementatio...
_in_low_power); cl_assert_equal_i(s_power_state, PowerStateGood); } void test_battery_monitor__low_first_run(void) { int low_mv = battery_curve_lookup_voltage_by_percent(3, false); fake_battery_init(low_mv, false, false); battery_monitor_init(); periodic_timer_trigger(1); cl_assert(battery_monitor_critic...
(okay_mv, false, false)
; battery_monitor_init(); periodic_timer_trigger(1); fake_battery_set_millivolts(discharge_mv); periodic_timer_trigger(1); cl_assert(s_in_low_power); // If we somehow begin charging, ignore it. fake_battery_set_charging(true); periodic_timer_trigger(1); cl_assert(s_in_low_power); // If we're charg...
/* * 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 E_UNKNOWN; }
if (data.max_id == INSTALL_ID_INVALID) { s_next_unique_flash_app_id = (INSTALL_ID_INVALID + 1); } else { s_next_unique_flash_app_id = (data.max_id + 1); } PBL_LOG(LOG_LEVEL_INFO, "Found %"PRIu32" apps. Next ID: %"PRIu32" ", data.num_apps, s_next_unique_flash_app_id); prv_close_file_and_un...
app_install_clear_app_db()
history_buffer(&context); exit: if (file) { prv_minute_data_file_close(file); } prv_unlock(); if (success) { // Return number of records that were written, including missing records in the middle *num_records = context.last_record_idx_written + 1; *utc_start = context.utc_start; } else { ...
prv_init_minute_record(&record.hdr, rtc_get_time() - (ALG_MINUTES_PER_DLS_RECORD * SECONDS_PER_MINUTE), false /*for_file*/)
; // Fill in fake data for (uint32_t i = 0; i < ALG_MINUTES_PER_FILE_RECORD; i++) { record.samples[i] = (AlgMinuteDLSSample) { .base = { .steps = i, .orientation = 20 + i, .vmc = 40 + i, .light = 60 + i, }, .resting_calories = 1000 + i, .active_calories =...
in, int16_t max, int16_t overshoot, uint32_t delay_duration, uint32_t pulse_duration) { uint32_t stage_duration = (pulse_duration / 3); // Declare these here so that if we goto cleanup, then the variables are initialized Pro...
if (animation_is_scheduled(data->mic_window.mic_dot_anim)) { animation_unschedule(data->mic_window.mic_dot_anim); }
const GRect *root_frame = &window_get_root_layer(&data->mic_window.window)->frame; GRect dot_frame = data->mic_window.mic_dot_layer.frame; grect_align(&dot_frame, root_frame, GAlignCenter, false); layer_set_frame(&data->mic_window.mic_dot_layer, &dot_frame); layer_set_hidden(&data->mic_window.mic_dot_layer,...
(buf)), sizeof(buf)); cl_assert(memcmp(buf, bufcmp, sizeof(buf)) == 0); cl_assert_equal_i(pfs_close(fd), S_SUCCESS); } } void test_pfs__garbage_collection_when_full(void) { char file_name[10]; int num = 0; int fd; while (1) { snprintf(file_name, sizeof(file_name), "file%d", num++); fd = pfs_o...
cl_assert_equal_i(read_byte, 0xff - i)
; } } pfs_close(fd); } void test_pfs__write(void) { int rv = pfs_write(-1, NULL, 0); cl_assert(rv == E_INVALID_ARGUMENT); rv = pfs_write(1000000, NULL, 0); cl_assert(rv == E_INVALID_ARGUMENT); rv = pfs_write(0, NULL, 0); cl_assert(rv == E_INVALID_ARGUMENT); uint8_t buf[10]; int fd = pfs_ope...
CONDS_PER_HOUR) - 2); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("Wed, 2:00 PM", time_buf); // June 9th 2015, 23:59:59 (T-14:00:01) rtc_set_time(event_time - (14 * SECONDS_PER_HOUR) - 1); clock_get_until_time_capitalized(time_buf, sizeof(tim...
rtc_set_time(jun10th_noon_2015)
; // Our test event is at June 12th 2015, 12:00 // Now + two days const int event_time = jun10th_noon_2015 + (2 * SECONDS_PER_DAY); // if the event is in 24 hours on the same day, then show it. const int MAX_RELATIVE_HRS = 24; // June 10th 2015, 12:00:00 (T-48:00:00) rtc_set_time(jun10th_noon_2015); ...
switch (state->recv_state) { case QemuRecvState_WaitingHdrSignatureMSB: { state->msg_buffer_bytes = 0; shared_circular_buffer_read_consume(&state->isr_buffer, &state->isr_buffer_client, 1, &byte, &bytes_read); bytes_avail -= bytes_read; if (byte == QEMU_HEADER_MSB) {...
shared_circular_buffer_write(&state->isr_buffer, &byte, 1, false /*advance_slackers*/)
; }
// the same blending on the first and last pixel x2--; const Fixed_S16_3 x1_fixed = (Fixed_S16_3) { .integer = x1, .fraction = 4, }; const Fixed_S16_3 x2_fixed = (Fixed_S16_3) { .integer = x2, .fraction = 4, }; prv_mask_recording_assign_horizontal_line(ctx, y, x1_fixed, x2_fixed, color); } ...
CHECK_EXPECTED_TEST_IMAGE(s_ctx)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert(success)
_ms(10); } } static void prv_print_reset_reason(void) { dbgserial_print("Reset Register "); dbgserial_print_hex(RCC->CSR); dbgserial_newline(); if (RCC_GetFlagStatus(RCC_FLAG_BORRST) == SET) { dbgserial_putstr("Brown out reset"); } } // SystemInit does this for the firmware, but since the bootloader i...
boot_bit_dump()
; // If the recovery firmware crashed at start-up, the watch is now a // $150 brick. That's life! if (prv_check_for_recovery_start_failure()) { boot_bit_clear(BOOT_BIT_RECOVERY_START_IN_PROGRESS); prv_sad_watch(ERROR_CANT_LOAD_FW); } bool force_boot_recovery_mode = prv_check_force_boot_recovery(); ...
--------------------------------------------------------------- void NOINLINE activity_insights_process_minute_data(time_t now_utc) { // Update our active stats - needs to happen each iteration to ensure it's current // If we're above the 'active' threshold, increment the number of consecutive active minutes, // ...
activity_private_settings_open()
; if (file) { prv_restore_state(file, ActivitySettingsKeyInsightSleepRewardTime, &s_sleep_reward_state.common.last_triggered_utc, sizeof(s_sleep_reward_state.common.last_triggered_utc)); prv_restore_state(file, ActivitySettingsKeyInsightActivityRewardTime, ...
ce_init(PebbleEventType type, EventServiceAddSubscriberCallback start_cb, EventServiceRemoveSubscriberCallback stop_cb) {} void sys_vibe_history_start_collecting(void) {} void sys_vibe_history_stop_collecting(void) {} int32_t sys_vibe_get_vibe_strength(void) { return 0;...
(sessions[i])
; stub_pebble_tasks_set_current(tasks[i]); } } // enumerate through all possible sampling rate combinations and confirm // that the correct frequency is selected void test_accel_manager__subscription_sampling_rates(void) { int sample_rates[] = { ACCEL_SAMPLING_10HZ, ACCEL_SAMPLING_25HZ, ...
endpoint_analytics.h" #include "kernel/pbl_malloc.h" #include "kernel/util/freertos_utils.h" #include "system/passert.h" #include <util/list.h> #include <util/size.h> #include <os/mutex.h> // FreeRTOS #include "FreeRTOSConfig.h" // Dialog SDK #include "sys_rtc.h" #include <stdint.h> #define MS_PER_SECOND (1000) /...
prv_find_analytic(metric)
/* * 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...
(kino_layer)
config->insight_type, session ? session->type : ActivitySessionType_None); if (session && session->start_utc) { attribute_list_add_uint32(&notif_attr_list, AttributeIdTimestamp, session->start_utc); } if (config->headings) { attribute_list_add_string_l...
activity_get_metric(ActivityMetricStepCount, 1, &steps)
; return steps; } // ------------------------------------------------------------------------------------------------ // Creates a notification to notify the user of the activity summary static void prv_push_activity_summary_notification( time_t notif_time, int32_t steps_total, int32_t steps_average, int variant...
S, DISP_ROWS}); framebuffer_clear(&s_fb); graphics_context_init(&s_ctx, &s_fb, GContextInitializationMode_App); s_app_state_get_graphics_context = &s_ctx; // Setup resources fake_spi_flash_init(0 /* offset */, 0x1000000 /* length */); pfs_init(false /* run filesystem check */); pfs_format(true /* write e...
(&s_ctx.dest_bitmap, TEST_PBI_FILE)
{ -1344, 480, 128}, { -1192, 336, 224}, { -1232, 184, 296}, { -1080, 168, 280}, { -1232, 64, 360}, { -1200, -256, 280}, { -1176, -152, 120}, { -1168, 64, -24}, { -1104, 456, -288}, { -1392, 344, -56}, { -1496, 72, 152}, { -1360, -96, 16}, { -1464, 304, 240}, { -10...
{ -1104, 328, 280}, { -720, 256, 192}, { -488, 224, 88}, { -512, 168, 72}, { -728, 328, 64}, { -920, 424, -24}, { -920, 424, 0}, { -1136, 376, -56}, { -1344, 296, -88}, { -1976, 416, -200}, { -1368, 344, -168}, { -1432, 176, -320}, { -1464, 288, -64}, { -1400, 96...
/* * 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...
snprintf(dstbuf, 256, "%#llo", val)
; cl_assert_equal_s(dstbuf, "01777777777777777777777"); } void test_sprintf__null(void) { cl_assert_equal_i(snprintf(NULL, 0, "Hello!\nI am error"), 17); } void test_sprintf__percent_d(void) { char dstbuf[256]; // Simple %d snprintf(dstbuf, 256, "There are %d lights, %d", 4, -4); cl_assert_equal_s(dstbu...
SG_APP_NOT_RUNNING"; case APP_MSG_INVALID_ARGS: return "APP_MSG_INVALID_ARGS"; case APP_MSG_BUSY: return "APP_MSG_BUSY"; case APP_MSG_BUFFER_OVERFLOW: return "APP_MSG_BUFFER_OVERFLOW"; case APP_MSG_ALREADY_RELEASED: return "APP_MSG_ALREADY_RELEASED"; case APP_MSG_CALLBACK_ALREADY_REGISTERED: return ...
if (bpm) { dict_write_uint8(app_data->out_iter, AppMessageKey_HeartRate, bpm); dict_write_uint8(app_data->out_iter, AppMessageKey_Confidence, bpm_quality); }
if (led_current) { dict_write_uint16(app_data->out_iter, AppMessageKey_Current, led_current); } if (hrm->debug->ppg_data.num_samples) { HRMPPGData *d = &hrm->debug->ppg_data; dict_write_data(app_data->out_iter, AppMessageKey_TIA, (uint8_t *)d->tia, d-...
void *user_data) { #if PBL_COLOR // We know that correct delta is always positive, and treat that as an input from // antialiased function, otherwise its treated as non-AA if (delta_begin.raw_value >= 0 || delta_end.raw_value >= 0) { x_range_begin.integer++; x_range_end.integer--...
{ return; }
GPointPrecise* rot_points = applib_malloc(path->num_points * sizeof(GPointPrecise)); if (!rot_points) { return; } int min_x, max_x, min_y, max_y; GPointPrecise rot_start, rot_end; bool found_start_direction = false; bool start_is_down = false; Intersection *intersections_up = NULL; Intersection...
yer; test_graphics_context_init(&ctx, fb); layer_init(&layer, &GRect(10, 10, 10, 10)); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_pixel_inside_offset_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_res...
(p.x + 2, p.y + 1)
); graphics_draw_pixel(ctx, GPoint(p.x + 3, p.y + 1)); graphics_draw_pixel(ctx, GPoint(p.x + 4, p.y + 1)); graphics_draw_pixel(ctx, GPoint(p.x + 5, p.y + 1)); graphics_draw_pixel(ctx, GPoint(p.x + 6, p.y + 1)); graphics_draw_pixel(ctx, GPoint(p.x + 7, p.y + 1)); graphics_draw_pixel(ctx, GPoint(p.x + 0, p.y...
cl_assert_equal_i(shared_prf_storage_get_valid_page_number(), 0); shared_prf_storage_set_ble_pinned_address(NULL); rv = shared_prf_storage_get_ble_pinned_address(NULL); cl_assert_equal_b(rv, false); cl_assert_equal_i(shared_prf_storage_get_valid_page_number(), 1); } void test_shared_prf_storage_v3__rewrite_p...
(DEVICE_NAME, device_name_out)
; } // Sets the getting started field, then corrupts the getting_started crc void test_shared_prf_storage_v3__handle_currupt_field_same(void) { bool GETTING_STARTED_COMPLETE = true; shared_prf_storage_set_getting_started_complete(GETTING_STARTED_COMPLETE); cl_assert_equal_i(shared_prf_storage_get_valid_page_numb...
/* * 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...
{ // After the user toggles BT back on, immediately attempt to reconnect once: if (bt_ctl_is_airplane_mode_on() == false) { bt_driver_reconnect_try_now(true /*ignore_paused*/); } }
static void settings_bluetooth_toggle_airplane_mode(SettingsBluetoothData* data) { const bool airplane_mode = bt_ctl_is_airplane_mode_on(); bt_ctl_set_airplane_mode_async(!airplane_mode); data->toggle_state = airplane_mode ? ToggleStateEnablingBluetooth : ToggleStateDisablingBluetooth; settings_menu_mar...
ss_pinning, true); cl_assert_equal_i(flags, 0xff); cl_assert_equal_b(sm_is_pairing_info_equal_identity(&PAIRING_INFO, &pairing_info_out), true); cl_assert_equal_s(device_name_out, DEVICE_NAME); // Check local_name cl_assert_equal_b(shared_prf_storage_get_local_device_name(device_name_out, ...
shared_prf_storage_set_getting_started_complete(true)
; // Should have moved to the next page cl_assert_equal_b(shared_prf_storage_get_valid_page_number(), 1); } // Test that when we write the ble_data and the ble_name separately, a page rewrite isn't triggered void test_shared_prf_storage_v3__write_ble_data_and_ble_name_separately(void) { shared_prf_storage_store_...
_address; } return registry->cursor->begin; } static void move_cursor_to_active_registry(Registry* registry) { // Search for an active registry, starting at the start of the registry sector // in flash (`REGISTRY_FLASH_BEGIN`). // If cursor loops back to the start of the registry sector, then the // entir...
{ Record* r = registry->records + i; if (r->active) { if (record_compare(r, key, key_length, uuid)) { return i; } } }
return -1; } Record* registry_private_get(const char* key, const uint8_t key_length, const uint8_t* uuid, Registry* registry) { const int idx = record_get_index(key, key_length, uuid, registry); PBL_ASSERTN(idx < registry->num_records); if (idx >= 0) { return registry->recor...
0, 0x0}, { 0, 0x8d, 0, 0x0}, { 0, 0x8d, 0, 0x0}, { 0, 0x8d, 0, 0x0}, { 0, 0x8d, 0, 0x0}, { 0, 0x8d, 0, 0x0}, { 0, 0x8d, 0, 0x0}, { 0, 0x8d, 10, 0x0}, { 0, 0x8c, 0, 0x0}, { 0, 0x8c, 0, 0x0}, { 0, 0x8c, 0, 0x0}, { 0, 0x8c, 0, 0x0}, { 0, 0x8c, 0, 0x0}, { 0,...
{ 0, 0x69, 2976, 0x0}, { 0, 0x6a, 2994, 0x0}, { 0, 0x78, 976, 0x0}, { 0, 0x79, 771, 0x0}, { 0, 0x69, 408, 0x0}, { 0, 0x68, 0, 0x0}, { 0, 0x68, 0, 0x0}, { 0, 0x68, 436, 0x0}, { 0, 0x68, 211, 0x0}, { 0, 0x59, 235, 0x0}, { 0, 0x66, 922, 0x0}, { 0, 0x69, 2359, 0x0...
opped_handler_calls.entries[0].finished); // Destroy it animation_destroy(h); #endif } // -------------------------------------------------------------------------------------- // Test that we can reschedule an animation after it completes and have it run again void test_animation__reschedule(void) { #ifdef TEST...
while (s_stopped_handler_calls.num_calls < 2) { prv_fire_animation_timer(); time_ms = prv_now_ms(); DPRINTF("rescheduled count: %d\n", s_stopped_handler_calls.num_calls); DPRINTF("%"PRIu64": frame at: %d, %d, %d %d\n", time_ms - start_ms, layer.frame.origin.x, layer.frame.origin.y, ...
// Make sure we detected a reset of the elapsed after rescheduling cl_assert(s_stopped_handler_calls.num_calls == 2); cl_assert(detected_reset_of_elapsed); // Make sure the frame reached the "to" state cl_assert_equal_point(layer.frame.origin, to_r.origin); #endif } // ----------------------------------...
ce_id); } return false; } if (app_num == SYSTEM_APP && !sys_resource_get_and_cache(app_num, resource_id)) { return false; } PBL_LOG_D(LOG_DOMAIN_TEXT, LOG_LEVEL_DEBUG, "FMD read: bytes:%d", (int)sizeof(FontMetaDataV3)); FontMetaDataV3 header; SYS_PROFILER_NODE_START(text_render_flash); uint...
{ sys_font_reload_font(font_info); }
// if we cannot find the codepoint we are looking for, we should always be // able to find the wildcard (square box) or ' ' character to display. We use // the wildcard codepoint from the base font in case the extension pack has // been deleted const Codepoint codepoint_list[] = { codepoint, font_info->base...
GColorWhiteARGB8, gcolor_get_bw(GColorWhite).argb); cl_assert_equal_i(GColorBlackARGB8, gcolor_get_bw(GColorBlack).argb); cl_assert_equal_i(GColorWhiteARGB8, gcolor_get_bw(GColorLightGray).argb); cl_assert_equal_i(GColorBlackARGB8, gcolor_get_bw(GColorDarkGray).argb); cl_assert_equal_i(GColorWhiteARGB8, gcolor_...
(GColorYellow, GColorBlack, GColorWhite)
line_item_storage_exists_with_parent(TimelineItemStorage *storage, const Uuid *parent_id) { mutex_lock(storage->mutex); FindChildrenInfo info = { .parent_id = *parent_id, .num_children = 0, .find_all = false, }; status_t rv = settings_file_each(&storage->file, prv_each_find_children, &info); if (...
(storage->mutex)
g_gfx_test_##name; #include "gfx_test_list.h" #undef GFX_TEST #define GFX_TEST(name) &g_gfx_test_##name, static GfxTest *s_tests[] = { #include "gfx_test_list.h" }; static void prv_pop_test_window(void *data) { AppData *app_data = data; app_window_stack_pop(false); app_window_stack_push(&app_data->results_window...
(window, false)
; MenuLayer *menu = &app_data->test_menu; menu_layer_init(menu, &window->layer.bounds); menu_layer_set_callbacks(menu, app_data, &(MenuLayerCallbacks){ .get_num_rows = prv_get_num_rows, .draw_row = prv_draw_row, .select_click = prv_click_handler, }); menu_layer_set_click_config_onto_window(menu, ...
{ 776, 424, -136}, { 936, 128, 16}, { 1336, 448, 40}, { 1448, 40, -56}, { 1408, -48, -192}, { 944, -48, -368}, { 1216, -144, -400}, { 1032, -152, -256}, { 1072, 288, -304}, { 1088, 88, -312}, { 928, 216, -208}, { 720, 320, -56}, { 792, 328, 8}, { 1024, 368, -152}, ...
// 175 seconds { 1120, 568, 160}, { 832, 408, 0}, { 696, 376, -32}, { 848, 384, -88}, { 1152, 344, 48}, { 1400, 424, 88}, { 1312, 320, -48}, { 1160, 328, 24}, { 1256, 448, -40}, { 1024, 256, 216}, { 576, 544, -256}, { 920, 360, -200}, { 816, 472, -8}, { 504, 3...
{ -336, -352, -1032}, { -248, -440, -1104}, { -344, -496, -984}, { -328, -448, -1056}, { -392, -240, -936}, { -432, -368, -800}, { -208, -192, -816}, { -24, -168, -568}, // 178 seconds { 24, -200, -272}, { 64, 16, -264}, { 96, 72, -304}, { 184, 232, -368}, { 296,...
E_BACK_DIALOG_TIMEOUT_MS 2000 #define ACCEL_MAX_IDLE_DELTA 100 #define DEBUG_STATIONARY 0 //! Used for describing the stationary event reason in analytics typedef enum { StationaryAnalyticsEnterNormally, StationaryAnalyticsEnterFromPeek, StationaryAnalyticsExitNormally, StationaryAnalyticsExitToPeek, Statio...
(StationaryActionWakeUp)
; } static void prv_stationary_check_launcher_task_cb(void *unused_data) { if (prv_update_and_check_accel_is_stationary()) { prv_watch_is_motionless(); } else { prv_watch_is_in_motion(); } } //! Called every minute to determine whether any motion has occured since the last time //! the call was made. Th...
otif_attributes, 1); cl_assert_equal_i(s_num_ds_notifications_received, 1); cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 1); } void test_ancs__should_filter_out_loading_messages_from_mail_app(void) { // Get notification for which we'll get a "Loading..." response: prv_send_n...
cl_assert_equal_i(s_num_ds_notifications_received, 1)
; ns_notification.uid = comple_dict_uid; prv_fake_receiving_ns_notification(sizeof(ns_notification), (uint8_t*) &ns_notification); cl_assert_equal_i(s_num_requested_notif_attributes, 2); cl_assert_equal_i(s_num_ds_notifications_received, 2); ns_notification.uid = s_invalid_param_uid; // This will return w...
, false, 3); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw3_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 3); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY); cl_check(gbi...
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, 1)
; graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw1_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // AA = true, SW = 2 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, 2); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLI...
start_bottom); prv_get_angles_mask_edge(y_middle, center, config.end_quadrant.quadrant, &ending_edge, &starting_edge, end_top, end_bottom); // Now we use only one with valuable data - same starting/ending is rejected if (starting_edge == ending_edge) { y_middle...
{ int16_t inner_edge = prv_get_ellipsis_border(y, radius_inner_y_sq, radius_inner_x_sq).raw_value; int16_t inner_left = center.x.raw_value - inner_edge; int16_t inner_right = center.x.raw_value + inner_edge; // Using top/bottom flags we make sure to not draw outside of given angles r...
else { // If theres nothing in the middle, draw top and bottom parts of the circle if (draw_top) { prv_draw_scanline_collision_points(ctx, center.y.integer - i - special_line_offset_top, left, right, top_starting_edge, top_ending_edge, ...
) { struct tm time_tm = s_init_time_tm; time_t utc_sec = mktime(&time_tm); rtc_set_time(utc_sec); prv_activity_init_and_set_enabled(true); ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricStepCount, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){300, 200, 100, 0, 0, 0, 0})); ASSERT_EQUAL_...
fclose(file)
; free(buf); printf("\nSaved current settings file to %s", out_path); } // --------------------------------------------------------------------------------------- // Create the settings file in PFS from a file saved in the local file system static void prv_load_settings_file_onto_pfs(const char *filename, const ...
/* * 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...
memcpy(expected_message->value, valid_message, strlen(valid_message))
; uint8_t bad_app_id_buf[128]; ANCSAttribute *bad_app_id = (ANCSAttribute *)&bad_app_id_buf; bad_app_id->length = strlen(IOS_MAIL_APP_ID); memcpy(bad_app_id->value, IOS_MAIL_APP_ID, strlen(IOS_MAIL_APP_ID)); const char *bad_string = "Phil was here"; uint8_t bad_message_buf[128]; ANCSAttribute *bad_mess...
e)); const int32_t width_of_action_bar_with_padding = ACTION_BAR_WIDTH + PBL_IF_RECT_ELSE(2, -4); const int32_t width = window->layer.bounds.size.w - width_of_action_bar_with_padding; const int32_t x_offset = PBL_IF_RECT_ELSE(0, 22); #if PLATFORM_ROBERT || PLATFORM_CALCULUS const int32_t info_text_y_offset = 3...
text_layer_deinit(&data->info_text_layer)
; text_layer_deinit(&data->device_name_text_layer); text_layer_deinit(&data->code_text_layer); gbitmap_destroy(data->approve_bitmap); gbitmap_destroy(data->decline_bitmap); action_bar_layer_deinit(&data->action_bar_layer); new_timer_delete(data->timer); if (data->ui_state == BTPairingUIState...
KING versions_msg.capabilities.activity_insights_support = 1; #endif versions_msg.capabilities.voice_api_support = 1; versions_msg.capabilities.unread_coredump_support = 1; // FIXME: PBL-31627 In PRF, APP_ID_SEND_TEXT isn't defined - requiring the #ifdef and ternary op. #ifdef APP_ID_SEND_TEXT versions_msg.ca...
prompt_send_response_fmt(buffer, sizeof(buffer), "System Resources:\n CRC:0x%"PRIx32"\n Valid:%s", system_resources_version.crc, bool_to_str(system_resource_is_valid()))
; #if CAPABILITY_HAS_PMIC uint8_t chip_id; uint8_t chip_revision; uint8_t buck1_vset; pmic_read_chip_info(&chip_id, &chip_revision, &buck1_vset); prompt_send_response_fmt(buffer, sizeof(buffer), "PMIC Chip Id: 0x%"PRIx8" Chip Rev: 0x%"PRIx8" Buck1 VSET: 0...
oken) + 1, "%d", &state->test_entry.in_deep_sleep.value); } else if (strcmp(token, "TEST_IN_DEEP_SLEEP_MIN") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.in_deep_sleep.min); } else if (strcmp(token, "TEST_IN_DEEP_SLEEP_MAX") == 0) { sscanf(token + strlen(token) + 1, "%d...
{ sscanf(token + strlen(token) + 1, "%d", &state->test_entry.activity_type.value); }
else if (strcmp(token, "TEST_ACTIVITY_TYPE_MIN") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.activity_type.min); } else if (strcmp(token, "TEST_ACTIVITY_TYPE_MAX") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.activity_type.max); } else if (strcm...
/* * 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_uint32(&list, AttributeIdLastUpdated, now)
to_frame); } // ----------------------------------------------------------------------------------------- PropertyAnimation *property_animation_create_bounds_origin(Layer *layer, GPoint *from, GPoint *to) { // no legacy2 support as this was never exposed on 2.x PropertyAnimation *re...
prv_find_property_animation(property_animation_h)
; if (!property_animation) { return false; } if (size > MEMBER_SIZE(PropertyAnimationPrivate, values.from)) { APP_LOG(APP_LOG_LEVEL_WARNING, "invalid size"); return false; } if (set) { memcpy(&property_animation->values.from, value, size); } else { memcpy(value, &property_animation->val...
iter)); cl_assert_equal_b(true, app_inbox_service_is_being_written_for_tag(AppInboxServiceTagUnitTest)); cl_assert_equal_i(1, app_inbox_service_num_failed_for_tag(AppInboxServiceTagUnitTest)); } void test_app_inbox__app_inbox_service_begin_not_enough_storage_space(void) { prv_create_test_inbox(); cl_assert_equ...
app_inbox_service_write(AppInboxServiceTagUnitTest, s_test_data, BUFFER_SIZE)
); app_inbox_service_cancel(AppInboxServiceTagUnitTest); // No events expected: assert_num_callback_events(0); // The buffer should be completely available again: cl_assert_equal_b(true, app_inbox_service_begin(AppInboxServiceTagUnitTest, BUFFER_SIZE, s_writ...
tatus; while ((status = flash_impl_get_write_status()) == E_BUSY) { psleep(0); } #ifdef TEST_FLASH_LOCK_PROTECTION if (s_assert_write_error) { PBL_ASSERT(FAILED(status), "flash write unexpectedly succeeded: %" PRId32, status); } else { #endif PBL_ASSERT(PASSED(status), "...
flash_impl_get_erase_status()
y_items[2].header.id)); cl_assert(!uuid_equal(&first_all_day_event, &state.pin.header.id)); cl_assert(state.node->all_day); cl_assert_equal_i(state.pin.header.timestamp, 1421136000); // back to the first cl_assert(iter_prev(&iterator)); cl_assert(uuid_equal(&first_all_day_event, &state.pin.header.id)); c...
(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionPast, 1421183640), 0)
; cl_assert(uuid_equal(&state.pin.header.id, &s_items[4].header.id)); cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[0].header.id)); // check all day events cl_assert(iter_next(&iterator)); Uuid first_all_day_event = state.pin.header.id; cl_assert(uuid_equal(&state.pi...
{ -1072, 272, -176}, { -1072, 368, -136}, { -1248, 648, -128}, { -1296, 600, -72}, { -1192, 704, -400}, { -1000, 552, -392}, { -1112, 504, -376}, { -1552, 408, -152}, { -1968, 296, -56}, { -1752, -136, -104}, { -1720, 152, -56}, { -1512, 80, -40}, { -1376, 96, 8}, { ...
{ -1752, 408, -64}, { -1280, 688, 400}, { -1344, 424, -96}, { -1296, 392, 8}, { -1304, 312, 88}, { -1080, 376, 64}, { -944, 368, 104}, { -1064, 560, 120}, { -1000, 608, 160}, { -1120, 584, 40}, // 24 seconds { -912, 680, 8}, { -920, 568, -64}, { -1280, 552, -16}, ...
{ -824, 496, -112}, { -904, 576, -144}, { -1248, 592, 104}, { -1616, 520, 184}, { -1672, 352, 96}, { -1624, 264, 160}, { -1608, 176, 160}, { -1584, 152, 136}, { -1440, 136, 136}, { -1264, 160, 112}, { -1240, 152, 152}, { -1112, -272, 208}, { -808, -656, 96}, { -1...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(gbitmap_init_with_resource_system(&bitmap, 0, 0))
; // But now change the palette format to something that requires more space and watch it fail s_fake_bitmap_data.info.format = GBitmapFormat4BitPalette; cl_assert(!gbitmap_init_with_resource_system(&bitmap, 0, 0)); // But if we have space for the palette, it should pass s_resource_size = prv_calculate_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...
(app_num, resource_id)
; if (image == NULL) { return NULL; } return kino_reel_pdci_create(image, true); }
ey); return ltk; } static key_ltk_t *prv_create_local_ltk_from_info(const SMLocalEncryptionInfo *enc_info) { key_ltk_t *ltk = kernel_zalloc_check(sizeof(key_ltk_t)); ltk->rand = enc_info->rand; ltk->ediv = enc_info->ediv; memcpy(ltk->key, enc_info->ltk.data, sizeof(ltk->key)); ltk->key_size = sizeof(ltk->k...
{ // If the device did not exchange an IRK, we have been given the devices identity address and // this is how we will associate our connection with the device in the future. Therefore, mark // is_remote_identity_info_valid as true but leave the irk 0'ed out to indicate it is unused PBL_LOG(LOG_...
info->is_mitm_protection_enabled = dev->mitm; bonding.is_gateway = connection_is_gateway(connection); if (connection_should_pin_address(connection)) { bonding.should_pin_address = true; connection_get_local_address(connection, &bonding.pinned_address); } BleBondingFlag flags = 0; ...
.seconds_last_day = 33142 + utc_to_local_delta, .seconds_total_last_day = 33142 + utc_to_local_delta, })); } void test_health__range_to_day_id_rejects_invalid_values(void) { const time_t now = rtc_get_time(); bool result; // check that we *can* return success result = prv_calculate_time_range(now - 10,...
(values, ARRAY_LENGTH(values), &range)
; cl_assert_equal_i(values[0], 4 * 1000 / 5); cl_assert_equal_i(values[1], 1000); cl_assert_equal_i(values[2], 1000 / 10); // ensure we don't calculate a single day multiple times values[0] = 1000; values[2] = 1000; range.num_days = 1; prv_adjust_value_boundaries(values, ARRAY_LENGTH(values), &range); ...
-64}, { 904, 264, 0}, // 16 seconds { 776, 328, -32}, { 720, 400, -40}, { 720, 336, -16}, { 776, 296, -64}, { 888, 288, -56}, { 1112, 400, -64}, { 1424, 448, -80}, { 1840, 440, 48}, { 1704, 496, 0}, { 1264, 408, -32}, { 1312, 240, 72}, { 1288, 232, 80}, { 1144...
{ 1296, 632, -184}, { 1272, 616, 136}, { 1144, 288, 272}, { 1024, 144, 40}, { 776, 136, 32}, { 704, 304, 0}, { 752, 400, -24}, { 896, 424, -8}, // 22 seconds { 936, 432, 16}, { 1064, 440, 8}, { 1296, 480, -16}, { 1424, 368, 200}, { 1768, 432, 160}, { 1416, 536...
{ 1528, 296, 128}, { 1544, 496, 40}, { 1248, 544, -40}, { 1344, 368, 24}, { 1344, 344, 40}, { 1232, 312, 72}, { 968, 232, 112}, { 856, 224, 80}, { 832, 248, 96}, { 824, 184, 136}, { 840, 160, 144}, { 832, 144, 128}, { 880, 144, 176}, // 25 seconds { 1048, 80,...
AlgMinuteFileRecord *file_record, AlgMinuteDLSRecord *dls_record, bool force_send) { // Get the circular buffer client we are working with SharedCircularBufferClient *cbuf_client = file_record ? &s_alg_state->file_minute_data_client ...
{ // Handle writing the record out to data logging DataLoggingResult result = dls_log(dls_session, dls_record, 1); // PBL-43622: Will revert later PBL_LOG(LOG_LEVEL_INFO, "Logging %"PRIu8" MLD Records, First UTC: %"PRIu32, dls_record->hdr.num_samples, dls_record->hdr.time_utc); ...
} } // ------------------------------------------------------------------------------------------- // Handle storage and logging of the minute data static void prv_log_minute_data(time_t utc_now, AlgMinuteRecord *minute_rec) { // Store the minute data into our circular buffer. The only place we ever read from th...
th_create(&s_bolt_path_info); s_duplicates_path = gpath_create(&s_duplicates_path_info); s_crossing_path = gpath_create(&s_crossing_path_info); s_infinite_path = gpath_create(&s_infinite_path_info); s_aa_clipping_path = gpath_create(&s_aa_clipping_path_info); prv_reset(); } void test_graphics_gpath_${BIT_DEP...
gpath_move_to(s_house_path, GPoint(SCREEN_WIDTH, SCREEN_HEIGHT / 2)); ctx.draw_state.drawing_box = GRect(-SCREEN_WIDTH / 2, 0, SCREEN_WIDTH, SCREEN_HEIGHT); ctx.draw_state.clip_box = GRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); prv_filled_update_proc(NULL, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_...
/* * 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 (rv != S_SUCCESS) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to open settings file"); mutex_unlock(s_mutex); }
, until all visible rows have been drawn. static void prv_menu_scroll_offset_changed_handler(ScrollLayer *scroll_layer, MenuLayer *menu_layer) { // TODO: we might need to propagate this event down to MenuLayerCallbacks } static void prv_menu_select_click_handler(Cl...
{ return MENU_CELL_LEGACY2_BASIC_SEPARATOR_HEIGHT; }
else { return MENU_CELL_BASIC_SEPARATOR_HEIGHT; } } static inline int16_t prv_menu_layer_get_header_height(MenuLayer *menu_layer, uint16_t section_index) { if (menu_layer->callbacks.get_header_height) { return menu_layer->callbacks.get_header_height(menu_layer, section_index, menu_layer->callback_cont...
(slave->bus, Write, slave->address, register_address_start, write_size, (uint8_t*)buffer, SendRegisterAddress)
; if (!result) { PBL_LOG(LOG_LEVEL_ERROR, "Write failed on bus %s", slave->bus->name); } return result; } bool i2c_write_block(I2CSlavePort *slave, uint32_t write_size, const uint8_t* buffer) { PBL_ASSERTN(slave); PBL_ASSERTN(buffer); // Do transfer locks the bus bool result = prv_do_transfer(slav...
T_INCLUDE_COMPLEX // Create animations // Create a sequence Animation *a = prv_create_test_animation(); Animation *b = prv_create_test_animation(); Animation *seq = animation_sequence_create(a, b, NULL); cl_assert(seq != NULL); // Create a spawn Animation *c = prv_create_test_animation(); Animation...
animation_set_curve(h, AnimationCurveEaseOut)
; cl_assert(animation_get_curve(h) == AnimationCurveEaseOut); static const PropertyAnimationImplementation implementation2 = { .base = { .setup = prv_setup_handler, .update = (AnimationUpdateImplementation) property_animation_update_gpoint, .teardown = prv_teardown_handler }, .acces...