prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
< 6)); } pmic_set_charger_state(true); // Enable AutoResume: Resumes charging on voltage drop after EOC prv_set_register_bit(PmicRegisters_CHARGE_CNTL, 6, true); } static void prv_configure_battery_measure(void) { // Set PMIC GPIO5 (the battery measure enable pin) as an open-drain output // with no pull ...
__builtin_unreachable()
; } return false; } // We have no way of directly reading Vsup with as3701b on Silk. Just assume // that we are getting what we've configured as regulated Vsup. uint16_t pmic_get_vsys(void) { uint8_t cfg; prv_read_register(PmicRegisters_CHARGE_CONFIG_1, &cfg); const uint8_t vsup_voltage = (cfg & 0x6) >> 1; ...
{ -1088, 592, 112}, { -976, 464, 272}, { -1472, 664, 104}, { -976, 568, 0}, { -1232, 520, 48}, { -1472, 288, 48}, { -1392, 296, 0}, { -1224, 232, -56}, { -1184, 120, -8}, { -1320, 136, 56}, { -1384, 104, 48}, { -1544, 248, 32}, { -1608, -152, 112}, // 18 seconds ...
{ -1416, 240, -152}, { -1384, 152, 8}, { -1368, 96, 104}, { -1248, 120, 96}, // 23 seconds { -1048, 0, 104}, { -992, -728, 536}, { -608, -96, -184}, { -1144, -200, -128}, { -1664, 216, -176}, { -1872, 504, -424}, { -1656, 304, -136}, { -1408, 184, -8}, { -1248, 39...
{ -952, 96, -208}, { -824, 200, -144}, { -864, 208, -80}, { -1104, 256, -168}, { -1256, 264, -128}, { -1504, 624, 48}, { -1200, 1208, -136}, { -1464, 584, -248}, { -1296, 512, -96}, { -1176, 576, -176}, { -1440, 400, -40}, { -1640, 280, 72}, { -1360, 264, -8}, { ...
mp) { // TODO: For safety, could disallow this op if user has orig file hdl open pfs_remove(f->name); // Note: if we reboot before updating the tmp state flag to done, the tmp & // original file will be deleted. This is an extremely small window, but // could be resolved by checking on reboot to see...
(sizeof(PFSFileListEntry) + file_hdr.file_namelen + 1)
; *entry = (PFSFileListEntry) {}; strcpy(entry->name, file_name); head = list_insert_before(head, &entry->list_node); } mutex_unlock_recursive(s_pfs_mutex); return (PFSFileListEntry *)head; } void pfs_delete_file_list(PFSFileListEntry *head) { ListNode *node = (ListNode *)head; ListNode *next; ...
= time_util_utc_to_local_offset(), .num_types = ARRAY_LENGTH(types), .types = types, .num_samples = ARRAY_LENGTH(offset_sec), .offset_sec = offset_sec, .num_values = ARRAY_LENGTH(values), .values = values, }, }; ProtobufLogRef ref = prv_test_encode_measureme...
// Flush it out now, this should end up in our transport method being called TestPLParsedMsg *msg = prv_flush_get_record(&input, false /* use_data_logging */, session_ref); prv_assert_msg_equal(&input, msg); // ------------------ // Send another set of measurements uint32_t offset_sec_b[] = {2, 4, 6}; u...
x, bool highlighted) { PBL_ASSERT(index < NUM_ACTION_BAR_LEGACY2_ITEMS, "Index: %"PRIu8, index); const uint8_t bit = (1 << index); if (highlighted) { action_bar->is_highlighted |= bit; } else { action_bar->is_highlighted &= ~bit; } } static void action_bar_legacy2_changed_proc(ActionBarLayerLegacy2 ...
click_recognizer_get_button_id(recognizer)
; const uint8_t index = button_id - 1; const GBitmap *icon = action_bar->icons[index]; // is_highlighted will cause the icon in the action bar to render normal or inverted: action_bar_legacy2_set_highlighted(action_bar, index, is_highlighted); if (icon == NULL) { return; } else { layer_mark_dirty(&...
{ 1184, 512, -368}, { 1296, 616, -400}, { 1400, 920, -432}, { 1024, 688, -376}, { 1392, 728, -272}, { 1088, 640, -416}, { 1192, 520, -336}, { 1304, 448, -184}, { 1208, 344, -176}, { 976, 296, -216}, { 976, 248, -248}, { 1152, 232, -216}, { 1320, 224, -224}, { 1184, 15...
{ 1176, 320, -192}, { 1288, 296, -240}, { 1360, 224, -264}, { 1184, 192, -336}, { 1144, 56, -384}, { 1128, -120, -288}, { 688, -248, -144}, { 1248, -176, -200}, // 47 seconds { 1024, 32, -152}, { 1264, 128, -312}, { 1416, 248, -416}, { 1240, 248, -424}, { 936, 168...
{ 1120, 288, -280}, { 1312, 368, -280}, { 1208, 528, -368}, { 1432, 600, -520}, { 1224, 656, -392}, { 1096, 584, -376}, { 1088, 608, -384}, { 1032, 512, -448}, { 1288, 464, -344}, { 1440, 408, -264}, { 1400, 272, -168}, { 1224, 200, -104}, { 1272, 240, -184}, { 1...
health_service_sum_today(HealthMetricRestingKCalories)
, value); // Feed in 100 steps/minute over 1 hour (walking rate) prv_feed_cannned_accel_data(SECONDS_PER_HOUR, 100, ActivitySleepStateAwake); const int k_exp_steps = 100 * MINUTES_PER_HOUR; // Test the derived metrics activity_get_metric(ActivityMetricStepCount, 1, &value); cl_assert_equal_i(value, k_exp_...
ayer_get_global_frame((Layer *)&peek_layer->kino_layer, &layer_frame); if (grect_equal(&icon_from, &GRectZero)) { icon_from = (GRect) { .origin.x = layer_frame.origin.x + (layer_frame.size.w - size.w) / 2, .origin.y = layer_frame.origin.y + (layer_frame.size.h - size.h) / 2, .size = size, };...
{ if (number) { prv_set_text(&peek_layer->number, number); } if (title) { prv_set_text(&peek_layer->title, title); } if (subtitle) { prv_set_text(&peek_layer->subtitle, subtitle); } prv_layout_text(peek_layer); }
void peek_layer_clear_fields(PeekLayer *peek_layer) { peek_layer_set_fields(peek_layer, "", "", ""); } void peek_layer_set_fields_hidden(PeekLayer *peek_layer, bool hidden) { layer_set_hidden(&peek_layer->number.text_layer.layer, hidden); layer_set_hidden(&peek_layer->title.text_layer.layer, hidden); layer_s...
le = LayoutContentSizeDefault, .text.style_font = TextStyleFont_Title, .text.fixed_lines = 1, .text.alignment = PBL_IF_RECT_ELSE(LayoutTextAlignment_Left, LayoutTextAlignment_Right), .text.extent.offset.y = -13, .text.extent.margin.h = -7, }; GTextNodeText *text_node = (GTextNodeText *)lay...
rtc_get_time()
< layout->info->timestamp) { clock_get_until_time(buffer, config->buffer_size, layout->info->timestamp, 24 /* max_relative_hrs */); } else { strncpy(buffer, prv_get_secondary_text(layout), config->buffer_size); buffer[config->buffer_size - 1] = '\0'; } } static GTextNode *prv_...
/* * 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...
pfs_remove(iter->name)
; iter = (PFSFileListEntry *)iter->list_node.next; } pfs_delete_file_list(bad_file_list); } // Return a pointer to the store for the given UUID. Each task that uses persist // must call persist_service_client_open() to create/open the store during its // startup and persist_service_client_close() during its sh...
out* text_layout = layout ? (TextLayout*) layout : (TextLayout*) &stack_layout; prv_graphics_text_layout_update(ctx, text, font, box, overflow_mode, alignment, text_layout); return text_layout->max_used_size; } void graphics_draw_text(GContext* ctx, const char* text, GFont const font, GRect...
{ return; }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(!alerts_should_notify_for_type(AlertPhoneCall))
; } void test_alerts__phone_calls_only(void) { cl_assert(alerts_get_mask() == AlertMaskAllOn); alerts_set_mask(AlertMaskPhoneCalls); // Should allow a phone call notification cl_assert(alerts_should_notify_for_type(AlertPhoneCall)); // Should not allow any other notifications through cl_assert(!alerts_s...
}, { -144, 472, -816}, { -160, 544, -728}, // 49 seconds { -120, 488, -840}, { -160, 464, -808}, { -208, 376, -792}, { -224, 424, -824}, { -256, 544, -928}, { -248, 456, -1000}, { -256, 496, -968}, { -216, 576, -976}, { -144, 472, -944}, { -88, 352, -992}, { -128,...
{ -48, 416, -1016}, { -112, 456, -1016}, { -72, 520, -1008}, { -128, 336, -952}, { -104, 576, -968}, { -120, 384, -912}, { -160, 488, -800}, { -120, 528, -944}, { -192, 568, -728}, { -120, 528, -856}, { -152, 472, -688}, { -40, 448, -920}, { -56, 512, -928}, { -80...
{ -128, 824, -528}, // 57 seconds { -88, 1016, -624}, { -144, 896, -496}, { -88, 976, -536}, { -88, 1008, -544}, { -72, 776, -448}, { -16, 928, -520}, { -64, 752, -416}, { 72, 960, -600}, { -64, 776, -552}, { -64, 1016, -696}, { -152, 912, -632}, { -152, 872, -66...
range_text_layer, range_subtitle_text_layer); const int range_origin_y = prv_selection_config()->range_origin_y; const int extra_line_offset_y = PBL_IF_RECT_ELSE(2, 4); prv_vertical_align_text_layer(time_selection_window, top_layer, range_origin_y, 1, extra_line_offset_y); const...
(selection_layer, &GRectZero, num_cells)
; for (int i = 0; i < num_cells; i++) { const unsigned int cell_width = prv_cell_width(i, num_cells); selection_layer_set_cell_width(selection_layer, i, cell_width); } selection_layer_set_cell_padding(selection_layer, padding); selection_layer_set_inactive_bg_color(selection_layer, GColorDarkGray); s...
ED here quiets the linter UNUSED int16_t bottom_inset = 0; #if PBL_ROUND // On round displays, inset the box from the bottom to account for drawing the indicator at the // bottom center, and then draw the indicator const bool selected_with_indicator = (selected && !item->is_leaf); if (selected_with_indicator)...
{ return aml->num_items + (item_index - aml->num_items) / SHORT_COL_COUNT; }
} T_STATIC void prv_set_selected_index(ActionMenuLayer *aml, int new_selected_index, bool animated) { new_selected_index = CLIP(new_selected_index, 0, aml->num_items + aml->num_short_items - 1); if (new_selected_index != aml->selected_index) { // Unschedule any running item animation but don't NULL the point...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_flash_send_and_receive_byte(FLASH_CMD_DUMMY)
; return result; } static void prv_flash_wait_for_write_bounded(volatile int cycles_to_wait) { prv_flash_start_cmd(); prv_flash_send_and_receive_byte(FLASH_CMD_READ_STATUS_REG); uint8_t status_register = 0; do { if (cycles_to_wait-- < 1) { break; } status_register = prv_flash_read_next_by...
(offset 138 to 203, 65 min) // Which had deep sleep of about 55 min // // AlgDlsMinuteData *activity_sample_sleep_1(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME sleep_1 //> TEST_VERSION 2 //> TEST_TOTAL 380 //> TEST_TOTAL_MIN 360 //> TEST_TOTAL_MAX 400 //...
{ 0, 0x75, 0, 0x0}, { 0, 0x76, 103, 0x0}, { 0, 0x86, 0, 0x0}, { 0, 0x75, 180, 0x0}, { 0, 0x65, 0, 0x0}, { 0, 0x75, 0, 0x0}, { 0, 0x75, 0, 0x0}, { 0, 0x75, 13, 0x0}, { 0, 0x75, 0, 0x0}, // 90: Local time: 09:00:00 PM { 0, 0x75, 199, 0x0}, { 0, 0x75, 0, 0x0}, ...
// @return true if sensor is stable static bool prv_is_sensor_stable(const HRMData *data) { // Passing a NULL data pointer means reset our state if (!data) { s_manager_state.sensor_stable = false; s_manager_state.sensor_start_ticks = 0; return false; } // Ignore the "no accel" quality reading samp...
(state->update_interval_s * MS_PER_SECOND)
; } int64_t subscriber_remaining_ticks = (int64_t)milliseconds_to_ticks(state->update_interval_s * MS_PER_SECOND) - subscriber_age_ticks - spin_up_ticks; subscriber_remaining_ticks = MAX(0, subscriber_remaining_ticks); remaining_ticks = MIN(remaining_ticks, subsc...
/* * 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...
mfg_info_get_watch_color()
, WATCH_INFO_COLOR_RED); mfg_info_set_watch_color(WATCH_INFO_COLOR_GREEN); cl_assert_equal_i(mfg_info_get_watch_color(), WATCH_INFO_COLOR_GREEN); } void test_snowy_mfg_info__rtc_freq(void) { cl_assert_equal_i(mfg_info_get_rtc_freq(), 0); mfg_info_set_rtc_freq(0xfefefefe); cl_assert_equal_i(mfg_info_get_rtc...
ialog_set_icon(dialog, RESOURCE_ID_GENERIC_CONFIRMATION_LARGE); dialog_set_background_color(dialog, GColorJaegerGreen); dialog_set_timeout(dialog, DIALOG_TIMEOUT_DISMISS); simple_dialog_push(simple_dialog, prv_get_window_stack()); } // -----------------------------------------------------------------------------...
prv_show_snooze_confirm_dialog()
; actionable_dialog_pop(s_alarm_popup_data->alarm_popup); } static void prv_click_provider(void *context) { window_single_click_subscribe(BUTTON_ID_DOWN, prv_dismiss_click_handler); window_single_click_subscribe(BUTTON_ID_UP, prv_snooze_click_handler); window_single_click_subscribe(BUTTON_ID_BACK, prv_snooze_c...
(&out_metadata, FLASH_REGION_SAFE_FIRMWARE_BEGIN, check_crc)
; if (success) { strncpy(dest, out_metadata.version_tag, dest_len_bytes); } return success; } bool version_is_prf_installed(void) { FirmwareDescription firmware_description = firmware_storage_read_firmware_description(FLASH_REGION_SAFE_FIRMWARE_BEGIN); return firmware_storage_check_valid_firmware_...
/* * 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...
expandable_dialog_create("Weather - warning dialog")
; Dialog *dialog = expandable_dialog_get_dialog(expandable_dialog); dialog_set_destroy_on_pop(dialog, false); dialog_set_icon(dialog, RESOURCE_ID_GENERIC_WARNING_TINY); dialog_set_text(dialog, localized_string); const DialogCallbacks callbacks = { .unload = prv_warning_dialog_unload, }; dialog_set_ca...
/* * 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...
(".log_buffer")
)); static LogBuffer s_log_buffer = { .level = LOG_LEVEL_ALWAYS, .transmitting = false, }; /* * Duplicate _VERBOSE -- let's have a reasonable entry for every value should something go * wrong on the packing end. */ static const uint8_t LEVEL_MAP[8] = { LOG_LEVEL_ALWAYS, LOG_LEVEL_ERROR, LOG_LEVEL_WARNING, ...
ctx->draw_state.compositing_mode = GCompOpTintLuminance; ctx->draw_state.tint_color = processor_with_data->desired_tint_color; } static void prv_structured_glance_icon_bitmap_processor_post_func( GBitmapProcessor *processor, GContext *ctx, UNUSED const GBitmap *bitmap_used, UNUSED const GRect *global_clipp...
{ return NULL; }
GTextNodeTextDynamic *dynamic_text_node = graphics_text_node_create_text_dynamic(buffer_size, update, structured_glance); GTextNodeText *underlying_text_node_text = &dynamic_text_node->text; underlying_text_node_text->font = font; underlying_text_node_text->color = launcher_app_glance_structured_ge...
test_gdraw_command__clone_image(void) { cl_assert_equal_p(gdraw_command_image_clone(NULL), NULL); size_t size = sizeof(GDrawCommandImage) + (3 * sizeof(GDrawCommand)) + (sizeof(GPoint) * 6); GDrawCommandImage *image = malloc(size); memset(image, 0, size); GDrawCommandList *command_list = pr...
cl_assert_equal_p(end, expected_end)
, { -664, 728, 184}, { -624, 744, 160}, { -648, 824, 96}, { -736, 616, 320}, { -736, 432, 352}, { -808, 608, 184}, { -704, 616, 344}, { -800, 816, 232}, { -728, 672, 120}, { -824, 584, 72}, { -840, 456, 56}, { -696, 528, -40}, { -664, 632, 8}, { -616, 760, 64}, ...
{ -696, 656, -464}, // 70 seconds { -704, 552, -256}, { -760, 688, -176}, { -712, 560, -80}, { -704, 552, 136}, { -776, 544, 232}, { -760, 672, 304}, { -696, 856, 8}, { -696, 656, 152}, { -648, 744, 224}, { -608, 784, 272}, { -648, 1032, 264}, { -632, 760, 368}, ...
{ -808, 512, -448}, { -744, 408, -512}, { -784, 464, -424}, { -880, 512, -120}, { -840, 632, -88}, { -912, 544, -80}, { -792, 584, -280}, { -736, 440, -120}, { -912, 544, 8}, { -904, 632, -128}, // 73 seconds { -800, 576, -136}, { -824, 440, -192}, { -848, 432, -...
/* * 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...
(animation, AnimationCurveEaseOut)
prv_clear_all_interrupt_flags(this)
; // Start the DMA transfer this->stream->periph->CR |= DMA_SxCR_EN; } void dma_request_start_direct(DMARequest *this, void *dst, const void *src, uint32_t length, DMADirectRequestHandler handler, void *context) { PBL_ASSERTN(this->state->initialized); PBL_ASSERTN(this->state->t...
BT_WATCHDOG_TIMER.timer.peripheral, RCC_APB1Periph_TIM6); s_spi_transport.watchdog_timer_active = false; } static void prv_watchdog_start(void) { prv_lock(); if (!s_spi_transport.watchdog_timer_active) { TIM_SetCounter(BOARD_BT_WATCHDOG_TIMER.timer.peripheral, 0); // Reset the count to 0. TIM_Cmd(BOARD_B...
prv_give_semamphore_from_isr(should_context_switch)
; } } static void prv_handle_receiving_complete_isr(bool *should_context_switch) { // Wait for the controller to signal that it's ready prv_watchdog_start(); s_spi_transport.state = SPITransportState_WaitingForReceiving_Footer; } static void prv_handle_int_waiting_for_receiving(void) { s_spi_transport.state...
{ 344, 600, 872}, { 216, 648, 936}, { 240, 664, 1288}, { -16, 480, 1440}, { 112, 624, 1056}, { 152, 328, 1032}, { 168, 448, 776}, { 192, 304, 768}, { 216, 360, 712}, { 240, 368, 904}, { 224, 400, 872}, { 232, 480, 968}, { 160, 432, 880}, // 11 seconds { 112, 584...
{ 56, 608, 680}, { 80, 648, 576}, { 120, 552, 544}, { 200, 568, 576}, { 200, 600, 672}, { 176, 680, 624}, { 216, 616, 664}, { 256, 632, 624}, { 216, 624, 744}, { 104, 824, 704}, { 96, 752, 1216}, { -48, 968, 1408}, { -48, 808, 1208}, { -8, 472, 936}, { 40, 536...
{ 176, 368, 616}, { 176, 368, 728}, { 208, 520, 840}, { 224, 480, 856}, { 184, 504, 912}, { 64, 712, 952}, { 32, 736, 912}, { 8, 880, 1304}, { -80, 688, 896}, { 48, 808, 664}, { 168, 592, 600}, { 136, 592, 552}, { 200, 584, 576}, { 248, 528, 664}, { 264, 696,...
600, -816}, { -144, 592, -800}, { -128, 584, -800}, { -128, 584, -784}, { -136, 584, -792}, { -136, 584, -808}, { -128, 592, -816}, { -136, 600, -808}, { -136, 600, -792}, { -136, 592, -792}, { -144, 584, -808}, { -136, 600, -808}, { -144, 592, -808}, { -136, 584, -8...
{ -136, 552, -952}, { -152, 448, -880}, { -144, 432, -880}, { -144, 448, -880}, { -152, 472, -888}, { -168, 488, -888}, { -152, 504, -880}, { -160, 488, -872}, { -160, 472, -872}, { -160, 480, -872}, { -160, 480, -888}, // 341 seconds { -160, 480, -880}, { -160, 4...
{ -144, 480, -880}, { -144, 472, -880}, { -144, 496, -872}, { -144, 504, -872}, { -144, 480, -872}, { -152, 472, -880}, { -144, 488, -888}, { -144, 504, -872}, { -144, 472, -864}, { -152, 464, -872}, { -152, 488, -880}, { -152, 512, -880}, { -144, 512, -872}, { -...
_system_task_callbacks_invoke_pending(); // Advance to 6pm EST prv_feed_cannned_accel_data(6 * SECONDS_PER_HOUR, 50, ActivitySleepStateAwake); // switch into PST (which would be 3pm) tz_info = (TimezoneInfo) { .tm_zone = "PST", .tm_gmtoff = -8 * SECONDS_PER_HOUR, }; time_util_update_timezone(&tz_i...
(20 * SECONDS_PER_MINUTE, 100, ActivitySleepStateAwake)
SSERTN(md); if (!app_cache_entry_exists(id)) { PBL_LOG(LOG_LEVEL_DEBUG, "Cache entry did not exist on launch attempt"); return true; } *md = app_install_get_md(id, is_worker); if (!is_worker && rocky_app_validate_resources(*md) == RockyResourceValidation_Invalid) { PBL_LOG(LOG_LEVEL_DEBUG, "App h...
analytics_inc(ANALYTICS_APP_METRIC_ROCKY_CRASHED_COUNT, AnalyticsClient_App)
; } analytics_inc(ANALYTICS_APP_METRIC_CRASHED_COUNT, AnalyticsClient_App); } else if (task == PebbleTask_Worker) { analytics_inc(ANALYTICS_APP_METRIC_BG_CRASHED_COUNT, AnalyticsClient_Worker); } if (context->app_md->is_rocky_app) { analytics_inc(ANALYTICS_DEVICE_METRIC_APP_ROCKY_CRA...
6}, { 112, 72, 328}, { -608, 376, 880}, { -144, 1232, 840}, { 32, 1240, 736}, { 64, 1048, 984}, { -8, 1408, 1048}, { 72, 1448, 816}, { 104, 1216, 624}, { 72, 696, 800}, { 0, 824, 872}, { 0, 664, 864}, { -24, 608, 640}, { -8, 408, 424}, { -32, 288, 376}, { -48,...
{ -1440, 160, 304}, { -2896, 856, 328}, { -2544, 536, 424}, // 52 seconds { -1328, 1272, -272}, { -728, -144, 176}, { -1200, 536, 312}, { -1120, 408, 120}, { -1008, 136, 128}, { -744, 136, 200}, { -608, 96, 232}, { -648, 64, 240}, { -736, 88, 304}, { -800, 208, 21...
{ -1160, 480, 16}, { -896, 328, 160}, { -736, 304, 104}, { -744, 280, 24}, { -856, 344, 96}, { -792, 248, 128}, { -728, 272, 136}, { -1016, 264, 128}, { -1192, 440, 304}, { -1424, 632, 264}, { -1368, 648, 112}, { -992, 536, 184}, // 55 seconds { -1032, 456, 192},...
" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "bitblt_private.h" #include "graphics.h" #include "graphics_private.h" #include "gtypes.h" #include "system/passert....
WITHIN(x, x_min, x_max)
|| y1 > y2) { // Outside of drawing bounds.. return; } // Capture framebuffer & pass it to drawing implementation GBitmap *framebuffer = graphics_capture_frame_buffer(ctx); if (!framebuffer) { // Couldn't capture framebuffer return; } ctx->draw_state.draw_implementation->blend_vertical_l...
tion = implementation; PBL_LOG(LOG_LEVEL_INFO, "Music server connected: %s", implementation->debug_name); } else { PBL_LOG(LOG_LEVEL_ERROR, "Server <0x%p> connected, but another <0x%p> is already registered", implementation, s_music_ctx.implementation); } } else { if (s_music_ct...
(s_music_ctx.mutex)
; prv_put_pos_changed_event(); } void music_update_track_duration(uint32_t track_duration_ms) { mutex_lock_recursive(s_music_ctx.mutex); s_music_ctx.track_length_ms = track_duration_ms; mutex_unlock_recursive(s_music_ctx.mutex); prv_put_pos_changed_event(); } void music_get_now_playing(char *title, char...
reate_custom_animation(void) { // Create a custom animation with a custom update procedure Animation *d = animation_create(); animation_set_implementation(d, &s_custom_implementation); animation_set_duration(d, DURATION); return d; } static void click_handler(ClickRecognizerRef recognizer, Window *window) {...
GRect(0, 92, 60, 60)
; s_text_layer_a = text_layer_create(from_rect_a); text_layer_set_text(s_text_layer_a, "Started!"); layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_text_layer_a)); s_text_layer_b = text_layer_create(from_rect_b); text_layer_set_text(s_text_layer_b, "Spawned"); layer_add_child(window_...
l_layer, MenuCellSpan *cursor, bool highlight) { prv_prepare_row(ctx, menu_layer, cell_layer, highlight); const GRect prev_bounds = cell_layer->bounds; // in theory, we could decrement the origin by cell_content_origin_offset_y after the call // in practice once shouldn't trust the draw_row implementation co...
(it->it.menu_layer, &it->cell_layer, &it->it.cursor, it->ctx)
; // Draw the separator on top of the cell: if (top_diff >= it->it.cursor.sep) { prv_menu_layer_draw_separator(it->it.menu_layer, &it->cell_layer, &it->it.cursor, it->ctx); } } } static void prv_menu_layer_render_row_from_iterator(MenuIterator *iterator) { MenuRenderIterator *it = (MenuRenderIter...
/* * 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...
{ fake_app_timer_init(); rocky_runtime_context_init(); jerry_init(JERRY_INIT_EMPTY); s_tick_timer_service_subscribe = (MockCallRecordings){0}; s_log_internal__expected = NULL; }
_tuple == NULL_TUPLE); break; case SOME_STRING_KEY: is_string_updated = true; cl_assert(new_tuple->type == TUPLE_CSTRING); cl_assert(new_tuple->length == strlen(NEW_STRING) + 1); cl_assert(strcmp(new_tuple->value->cstring, NEW_STRING) == 0); cl_assert(old_tuple->type == TUPLE_CST...
(should_update_existing_keys_only == false)
; cl_assert(tuple->type == TUPLE_INT); cl_assert(tuple->length == sizeof(int8_t)); cl_assert(tuple->value->int8 == -3); break; default: break; } tuple = dict_read_next(&dest_iter); } if (test_not_enough_storage || should_update_existing_keys_...
&(GSize) {DISP_COLS, DISP_ROWS}); graphics_context_init(&s_ctx, &s_fb, GContextInitializationMode_App); s_bitblt_bitmap_into_bitmap_tiled_calls = (MockBitbltBitmapIntoBitmapTiledCallRecordings) {}; } void test_gbitmap_processor__cleanup(void) { } // Tests /////////////////////// #define EXPECTED_RECT_IN_PRE_FUN...
(bitmap_used, BITMAP_TO_SPECIFY_IN_PRE_FUNCTION)
; // Check that the rect here is the clipped version of the rect we specified in the .pre function cl_assert_equal_rect(*global_clipped_grect_used, EXPECTED_CLIPPED_RECT_AFTER_DRAWING_BITMAP); } void test_gbitmap_processor__pre_and_post_functions(void) { GBitmap bitmap = {0}; const GRect rect = EXPECTED_RECT_...
g_provider(void *context) { window_single_repeating_click_subscribe(BUTTON_ID_UP, 100, up_handler); window_single_repeating_click_subscribe(BUTTON_ID_SELECT, 100, select_handler); window_single_repeating_click_subscribe(BUTTON_ID_DOWN, 100, down_handler); } static void draw_ui_element(GContext *ctx, GRect bounds...
layer_add_child(window_layer, data->canvas_layer)
; } static void main_window_unload(Window *window) { AppData *data = window_get_user_data(s_window); layer_destroy(data->canvas_layer); } static void init(void) { AppData *data = task_zalloc(sizeof(AppData)); if (!data) { return; } s_window = window_create(); window_set_user_data(s_window, data); ...
/* * 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...
path_layer_init(arrow, &ARROW_PATH_INFO)
; path_layer_set_fill_color(arrow, GColorBlack); path_layer_set_stroke_color(arrow, GColorBlack); layer_set_frame(&arrow->layer, &ARROW_RECTS[id]); if (id == BUTTON_ID_BACK) { gpath_rotate_to(&arrow->path, (TRIG_MAX_ANGLE / 2)); gpath_move_to(&arrow->path, GPoint(26, 24)); } layer_add_child(&data...
/* * 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...
(bounds, window, sections, ARRAY_LENGTH(sections), NULL)
; layer_add_child(window_layer, simple_menu_layer_get_layer(s_main_window_data.menu_layer)); } static void window_unload(Window *window) { simple_menu_layer_destroy(s_main_window_data.menu_layer); } static void init(void) { Window *window = s_main_window_data.window; window = window_create(); window_set_wi...
.duration = 1, .type = TimelineItemTypePin, .flags = 0, .layout = LayoutIdTest, } } }; // Setup ///////////////////////// void test_timeline__initialize(void) { fake_rtc_init(0, 0); // Note: creating a settings file is going to result in one malloc for the FD name pin_db_init(); time_...
iter_prev(&iterator)
); cl_assert(uuid_equal(&state.pin.header.id, &s_items[2].header.id)); // check fifth cl_assert(iter_next(&iterator)); cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[4].header.id)); // check sixth cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.head...
ics_context_mask_create(ctx, transparent); cl_assert(mask); const GSize mask_size = ctx->dest_bitmap.bounds.size; for (int16_t y = 0; y < mask_size.h; y++) { const uint8_t mask_pixel_value = (uint8_t)(y / num_pixels_per_mask_value); for (int16_t x = 0; x < mask_size.w; x++) { test_graphics_context_...
{ GContext *ctx = s_ctx; prv_prepare_canvas_for_hline_applying_test(ctx); graphics_context_set_antialiased(ctx, true); GDrawMask *mask = prv_create_mask_for_hline_applying_test(ctx); cl_assert(graphics_context_mask_use(ctx, mask)); for (int16_t y = 0; y < num_src_colors; y++) { GColor src_color = (...
////////////////////////////////////// // APPLYING VERTICAL LINE HELPERS // ////////////////////////////////////// static const int16_t vline_applying_test_row_height = hline_applying_test_column_width; static void prv_prepare_canvas_for_vline_applying_test(GContext *ctx) { const GSize bitmap_size = GSize(num_s...
arning_points_index = -1; } static void prv_enter_low_power(void *ignored) { #ifndef RECOVERY_FW watchface_start_low_power(); modal_manager_pop_all_below_priority(ModalPriorityAlarm); modal_manager_set_min_priority(ModalPriorityAlarm); // Override the vibe intensity to Medium in low-power mode vibes_set_defa...
(RebootReasonCode_ShutdownMenuItem)
; } else { prv_transition(BatteryShutdownCharging, NULL); } } void battery_ui_reset_fsm_for_tests(void) { s_state = BatteryGood; s_warning_points_index = -1; }
llback = complete_cb; data->action_complete.callback_data = cb_data; // We can assume that this is a standalone action since we have no action menu data->standalone_action = true; } else if (complete_cb) { // If data is NULL, something went wrong (or local action), so call callback in case caller ...
(canned_responses_count, parent_level)
; for (size_t i = 0; i < canned_responses_count; i++) { const char *label = string_list_get_at(responses_list, i); action_menu_level_add_action(template_level, label, prv_action_menu_cb, action); } } else { // hard-wired default responses in case the phone app doesn't provide any static ch...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
text_layer_init(fail, &bounds)
; text_layer_set_font(fail, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD)); text_layer_set_text_alignment(fail, GTextAlignmentRight); text_layer_set_text(fail, "Fail"); layer_add_child(&window->layer, &fail->layer); results_ui->test = test; window_set_click_config_provider_with_context(window, prv_click_...
, "No AppInbox for tag <%d>", tag); } return inbox; } //! We don't report "number of messages consumed", because that would force the system to parse //! the contents of the (app space) buffer, which might have been corrupted by the app. //! Note that it's in theory possible for a misbehaving app to pass in a cons...
info.message_handler(msg->data, msg->length, &info)
; } else { PBL_LOG(LOG_LEVEL_ERROR, "Corrupted AppInbox message!"); } ++num_message_consumed; } if (info.num_failed) { if (info.dropped_handler) { info.dropped_handler(info.num_failed); } else { PBL_LOG(LOG_LEVEL_ERROR, "Dropped %"PRIu32" messages but no dropped_handler", ...
counter_app = { .name = BG_COUNTER_APP_NAME, .uuid = {0x1e, 0xb1, 0xd3, 0x9b, 0x56, 0x98, 0x48, 0x44, 0xb3, 0x94, 0x1f, 0x87, 0xb6, 0xbe, 0xae, 0x67}, .info_flags = PROCESS_INFO_HAS_WORKER | PROCESS_INFO_STANDARD_APP, .icon_resource_id = 0, .app_version = { .major = 1, .minor = 0, }, .s...
{ cl_assert_equal_p(data, &menu_layer); menu_layer_reload_data(&menu_layer); }
void test_app_menu_data_source__pass_init(void) { app_menu_data_source_init(&data_source, &(AppMenuDataSourceCallbacks) { .changed = prv_menu_layer_reload_data, .filter = everything_filter_callback, }, &menu_layer); uint16_t num_apps = app_menu_data_source_get_count(&data_source); for (uint16_t i = 0...
rt_equal_i(prv_last_update_distance(a), ANIMATION_NORMALIZED_MAX); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 1); cl_assert_...
// since a is embedded within seq int32_t position; animation_get_elapsed(seq, &position); cl_assert_equal_i(position, 100); // Now, advance sequence to almost the end of seq. Positions don't include the delay, so // pass false for 'include_delay' animation_set_elapsed(seq, animation_get_duration(seq, f...
// -------------------------------------------------------------------------------------- // Test creating a sequence where the first argument is already completed. // We will first create animation 'a' and run it to the end // We will then create a sequence out of 'a' + 'b' and verify that if we advance that 'b' r...
x68, 0xa4, 0x36, 0x79, 0x7d, 0xe2, 0x05}, .timestamp = 1, .duration = 0, .type = TimelineItemTypeReminder, .layout = LayoutIdTest, }, .attr_list = (AttributeList) { .num_attributes = 1, .attributes = (Attribute[1]) {{ .id = AttributeIdTitle, .cstring = "test 1" }} } }; static TimelineItem...
cl_assert(reminder_db_get_len((uint8_t *)&item4.header.id, sizeof(Uuid)) == 0)
f typedef struct { Window window; TextLayer status; char status_string[20]; TextLayer details; char details_string[45]; RuninTestState test_state; uint32_t seconds_remaining; bool countdown_running; bool fastcharge_enabled; int pass_count; } AppData; static void prv_handle_second_tick(struct t...
app_state_set_user_data(data)
2_t sleep_enter_seconds, int32_t sleep_exit_seconds, int32_t sleep_total_seconds, ActivityScalarStore sleep_average_seconds, Uuid *uuid) { prv_generate_sleep_pin_strings(sleep_enter_seconds, sleep_exit_seconds, sleep_total_seconds); // ...
kernel_free(response_items)
; kernel_free(time_range); kernel_free(end_time); kernel_free(start_time); kernel_free(short_subtitle); kernel_free(elapsed); i18n_free_all(&pin_attr_list); attribute_list_destroy_list(&pin_attr_list); return item; } // ----------------------------------------------------------------------------------...
48, 8, -1000}, { 48, 24, -992}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 16, -1008}, { 48, 24, -1000}, { 40, 24, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 24, -1008}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 16, -1000}...
{ 48, 8, -992}, { 48, 32, -1000}, { 40, 8, -1000}, { 48, 16, -1008}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 16, -1000}, { 48, 16, -1000}, { 48, 16, -1000}, { 48, 16, -...
{ 48, 16, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1008}, { 40, 24, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 24, -992}, { 48, 16, -1000}, { 48, 24...
/* * 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.dest_bitmap, TEST_NAMED_PBI_FILE("off_screen_right_aa_clipping"))
/* * 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 (time_tm) { time_t temp = rtc_get_time(); gmtime_r(&temp, time_tm); }
} void rtc_set_time(time_t time) { s_time_base = time; } void rtc_set_timezone(TimezoneInfo *tzinfo) { s_tzinfo = *tzinfo; } bool rtc_is_timezone_set(void) { // The actual driver checks for the first 4 chars as a uint32_t being 0 return memcmp(s_tzinfo.tm_zone, "\0\0\0\0", 4) != 0; } void rtc_get_timezone(...
/* * 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...
{ PWR_FlashPowerDownCmd(power_down ? ENABLE : DISABLE); }
void pwr_access_backup_domain(bool enable_access) { periph_config_enable(PWR, RCC_APB1Periph_PWR); PWR_BackupAccessCmd(enable_access ? ENABLE : DISABLE); periph_config_disable(PWR, RCC_APB1Periph_PWR); }
X(0x8b0000)}, {"darksalmon", GColorARGB8FromHEX(0xe9967a)}, {"darkseagreen", GColorARGB8FromHEX(0x8fbc8f)}, {"darkslateblue", GColorARGB8FromHEX(0x483d8b)}, {"darkslategray", GColorARGB8FromHEX(0x2f4f4f)}, {"darkslategrey", GColorARGB8FromHEX(0x2f4f4f)}, {"darkturquoise", GColorARGB8FromHEX(0x00ced1)}, {"...
GColorARGB8FromHEX(0x2e8b57)
}, {"seashell", GColorARGB8FromHEX(0xfff5ee)}, {"sienna", GColorARGB8FromHEX(0xa0522d)}, {"skyblue", GColorARGB8FromHEX(0x87ceeb)}, {"slateblue", GColorARGB8FromHEX(0x6a5acd)}, {"slategray", GColorARGB8FromHEX(0x708090)}, {"slategrey", GColorARGB8FromHEX(0x708090)}, {"snow", GColorARGB8FromHEX(0xfffafa)},...
e_link_send_begin( PULSE2_RELIABLE_TRANSPORT_COMMAND); size_t packet_size = sizeof(ReliablePacket) + info_length; packet->i = (struct ReliableInfoPacket) { .sequence_number = sequence_number, .poll = true, .ack_number = s_receive_variable, .protocol = hton16(app_protocol), .length = hton16...
(LOG_LEVEL_DEBUG, "Received malformed response packet")
; prv_bounce_ncp_state(); return; } ReliablePacket *packet = raw_packet; if (!packet->is_supervisory) { PBL_LOG(LOG_LEVEL_DEBUG, "Received Information packet response; this is " "not permitted by the protocol (Information packets can only be " "commands). Discarding."); re...
/* * 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...
fake_spi_flash_init(0 /* offset */, 0x1000000 /* length */)
.dest_bitmap, "fill_rect_origin_rmax_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_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2), GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_re...
gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r3_aa_clip_nxny.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY , ORIGIN_RECT_CLIP_NXNY , true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY , ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_aa_clip_nxny.${BIT_DEPTH_NAME}.pbi")); s...
l_s(dstbuf, "zero1"); // Length modifiers int64_t hurf = 0x123456789ABCDEF0ULL; snprintf(dstbuf, 256, "%hhd,%hd,%d,%ld", hurf, hurf, hurf, hurf); cl_assert_equal_s(dstbuf, "-16,-8464,-1698898192,-1698898192"); snprintf(dstbuf, 256, "%lld,%jd", hurf, hurf); cl_assert_equal_s(dstbuf, "1311768467463790320,131...
(dstbuf, "There are 4 lights, 4294967292")
; // Space for positive signed // No signed conversion occurs, so this is a no-op snprintf(dstbuf, 256, "There are % u lights, the absolute value of % u", 4, -4); cl_assert_equal_s(dstbuf, "There are 4 lights, the absolute value of 4294967292"); // Plus for positive signed // No signed conversion occurs, ...
private.h" #include "window_stack_animation.h" #include "window_stack_private.h" #include "applib/applib_malloc.auto.h" #include "applib/legacy2/ui/status_bar_legacy2.h" #include "kernel/events.h" #include "kernel/pbl_malloc.h" #include "kernel/ui/kernel_ui.h" #include "process_management/app_manager.h" #include "proc...
{ PBL_ASSERTN(window_to && transition); WindowStack *window_stack = window_to->parent_window_stack; WindowTransitioningContext *context = &window_stack->transition_context; if (context->animation) { // If we currently have an animation, run it to completion immediately before starting // another transi...
// TODO: PBL-17645 cleanup container view in animation.stopped } static void prv_next_inserter(WindowStackItem *stack_item) { WindowStack *window_stack = stack_item->window->parent_window_stack; WindowStackItem *prev_item = (WindowStackItem *)window_stack->list_head; // Insert after the found previous item: ...
R_SIZE * num_regions); cl_assert(fd >= 0); char buf[PFS_SECTOR_SIZE]; for (int i = 0; i < num_regions; i++) { memset(buf, 0xff - i, sizeof(buf)); cl_assert_equal_i(pfs_write(fd, (uint8_t *)&buf[0], sizeof(buf)), sizeof(buf)); } pfs_close(fd); fd = pfs_open("page_lookup", OP_FLAG_READ | OP_FLAG_USE_...
pfs_read(0, NULL, rd_len)
; cl_assert(rv == E_INVALID_ARGUMENT); int fd = pfs_open("newfile", OP_FLAG_WRITE, FILE_TYPE_STATIC, rd_len); cl_assert(fd >= 0); uint8_t buf[rd_len]; rv = pfs_read(fd, buf, rd_len); cl_assert(rv == E_INVALID_ARGUMENT); pfs_close(fd); fd = pfs_open("newfile", OP_FLAG_READ, 0, 0); rv = pfs_read(fd, b...
ssage_outbox_begin(&iter), APP_MSG_OK); cl_assert_equal_i(dict_write_data(iter, TEST_KEY, (const uint8_t*)TEST_DATA, MAX_DATA_SIZE), DICT_OK); cl_assert_equal_i(app_message_outbox_send(), result); } static void prv_send_test_data(void) { prv_send_test_data_expecting_result(APP_MSG_OK); } static void prv_s...
(app_message_is_accepting_outbound(), false)
; prv_call_outbox_sent(AppOutboxStatusSuccess); cl_assert_equal_b(s_nack_sent_is_called, true); cl_assert_equal_i(s_out_sent_call_count, 0); cl_assert_equal_i(s_out_failed_call_count, 1); cl_assert_equal_i(s_failure_result, APP_MSG_SEND_REJECTED); // Check the state is reset properly cl_assert_equal_b(...
DEFINE_SYSCALL(bool, sys_ble_scan_stop, void)
{ return gap_le_stop_scan(); } DEFINE_SYSCALL(bool, sys_ble_scan_is_scanning, void) { return gap_le_is_scanning(); } DEFINE_SYSCALL(bool, sys_ble_consume_scan_results, uint8_t *buffer, uint16_t *size_in_out) { if (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(size_in_out, sizeof(*size_in_out));...
Disconnected; s_music_ctx.implementation = NULL; PBL_LOG(LOG_LEVEL_INFO, "Music server disconnected: %s", implementation->debug_name); } else { PBL_LOG(LOG_LEVEL_ERROR, "Unknown server <%p> disconnected", implementation); } } if (change_type != None) { // Upon connect and disconnect, ...
{ strcpy(title, s_music_ctx.title); }
if (artist) { strcpy(artist, s_music_ctx.artist); } if (album) { strcpy(album, s_music_ctx.album); } mutex_unlock_recursive(s_music_ctx.mutex); } bool music_get_player_name(char *player_name_out) { mutex_lock_recursive(s_music_ctx.mutex); const bool has_player_name = (s_music_ctx.player_name[0...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
((Version) { 5, 2 }, (Version) { 5, 1 })
> 0); cl_assert(version_compare((Version) { 5, 0 }, (Version) { 5, 1 }) < 0); cl_assert(version_compare((Version) { 4, 2 }, (Version) { 5, 1 }) < 0); cl_assert(version_compare((Version) { 6, 0 }, (Version) { 5, 1 }) > 0); }
eset(void); extern void launcher_app_message_protocol_msg_callback_deprecated(CommSession *session, const uint8_t* data, size_t length); // Fakes //////////////////////////////////// #inc...
cl_assert_equal_i(APP_RUN_STATE_RUN_COMMAND, s_last_cmd)
k = 0, GenericServiceResultNotSupported = 1, NumGenericServiceResults } GenericServiceResult; typedef enum { GenericServiceTypeRead = 0, GenericServiceTypeWrite = 1, GenericServiceTypeWriteRead = 2, NumGenericServiceTypes } GenericServiceType; typedef enum { ReservedServiceManagement = 0x0101, Reserve...
for (i = 0; i < length / sizeof(uint16_t); i++) { if ((services[i] > ReservedServiceMax) || (services[i] == ReservedServiceControl)) { has_valid_service = true; smartstrap_connection_state_set_by_service(services[i], true); } else { PBL_LOG(LOG_LEVEL_DEBUG, "Skipping invalid service_...
layer_init(&layer_a, &GRectZero); layer_add_child(root, &layer_a); manager.window = &window; manager.active_layer = &layer_a; manager.state = RecognizerManagerState_RecognizersActive; recognizer_add_to_list(r[0], &layer_a.recognizer_list); recognizer_add_to_list(r[1], &layer_a.recognizer_list); recogni...
(NULL, 0, &s_recognizers_reset)
; cl_assert_equal_i(r[0]->state, RecognizerState_Started); cl_assert_equal_i(r[1]->state, RecognizerState_Completed); recognizer_set_simultaneous_with(r[0], prv_simultaneous_with_cb); r[0]->state = RecognizerState_Started; r[1]->state = RecognizerState_Completed; manager.active_layer = &layer_a; manager....
MAX_RELATIVE_HRS); cl_assert_equal_s("1 H AGO", time_buf); // June 9th 2015, 17:30:00 (T+01:30:00) rtc_set_time(event_time + SECONDS_PER_HOUR + (30 * SECONDS_PER_MINUTE)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("2 H AGO", time_buf); /...
cl_assert_equal_s("2 minutes ago", time_buf)
; // June 9th 2015, 15:00:00 (T-01:00:00) rtc_set_time(event_time - (1 * SECONDS_PER_HOUR)); clock_get_until_time(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("In 1 hour", time_buf); // June 9th 2015, 14:00:00 (T-02:00:00) rtc_set_time(event_time - (2 * SECONDS_PER_HOUR)); ...
, AttributeIdTitle, ""), "Title2"); cl_assert_equal_s(attribute_get_string(&list, AttributeIdSubtitle, ""), "Subtitle"); cl_assert_equal_i(list.num_attributes, 2); attribute_list_add_uint32(&list, AttributeIdLastUpdated, value_uint32); attribute_list_add_uint8(&list, AttributeIdBgColor, value_uint8); cl_asse...
(attribute_get_string(&deserialization_result_attribute_list, AttributeIdSubtitleTemplateString, NULL), expected_app_glance_subtitle_after_deserializing)
; } void test_attribute__app_glance_subtitle_in_attribute_list(void) { Attribute app_glance_subtitle_attributes[] = { { .id = AttributeIdSubtitleTemplateString, .cstring = "Your app at a glance!" }, }; AttributeList app_glance_subtitle_attribute_list = { .num_attributes = ARRAY_LENGTH(a...
P_HISTORY_HOURS_FOR_TODAY * MINUTES_PER_HOUR; // The test data AlgMinuteDLSSample minute_data[num_minutes]; prv_create_test_data(num_minutes, minute_data); // Fill with garbage for more than ALG_MINUTE_DATA_FILE_LEN to force us to // chop off old data. s_capture_dls_records = false; uint32_t max_minutes...
for (int i = 0; i < num_minutes; i++) { prv_assert_minute_data(&retrieve[i], &minute_data[i]); }
s_sys_activity_get_sessions_values.out.num_sessions = 7; health_service_activities_iterate(HealthActivityRun | HealthActivityWalk | HealthActivityOpenWorkout, now - (100 * SECONDS_PER_MINUTE), now, HealthIter...
(0 < prv_session_compare( &(ActivitySession) {.start_utc = now, .length_min = 10}, &(ActivitySession) {.start_utc = now - (2 * SECONDS_PER_MINUTE), .length_min = 5}, HealthIterationDirectionFuture))
; // both end at the same time cl_assert(0 == prv_session_compare( &(ActivitySession) {.start_utc = now, .length_min = 10}, &(ActivitySession) {.start_utc = now + (5 * SECONDS_PER_MINUTE), .length_min = 5}, HealthIterationDirectionPast)); // a ends later cl_assert(0 > prv_session_compare( &(Ac...
eather, }, .attr_list = { .num_attributes = 1, .attributes = &title_attr, }, }; // ALL DAY PIN static TimelineItem item6 = { .header = { .id = {0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, .timestamp = 100*60, .duration = 10, ...
{ cl_assert(timeline_add(&item1)); timeline_event_handle_blobdb_event(); rtc_set_time(30 * 60); timeline_event_init(); cl_assert_equal_i(fake_event_get_count(), 1); cl_assert(!prv_get_calendar_ongoing()); TimerID timer_id = stub_new_timer_get_next(); cl_assert_equal_i(timer_id, TIMER_INVALID_ID); cl_...
void test_calendar_handle__past_event_added_and_removed(void) { rtc_set_time(30 * 60); timeline_event_init(); cl_assert_equal_i(fake_event_get_count(), 1); cl_assert(!prv_get_calendar_ongoing()); TimerID timer_id = stub_new_timer_get_next(); cl_assert_equal_i(timer_id, TIMER_INVALID_ID); cl_assert(!stub...
dd_child(root_layer, (Layer *)peek_layer); const int standing_ms = 1 * MS_PER_SECOND; data->peek_layer_timer = evented_timer_register(PEEK_LAYER_UNFOLD_DURATION + standing_ms, false, prv_finished_failure_callback, data); } else { prv_finished_failure_ca...
(animation, (AnimationHandlers) { .stopped = prv_animation_stopped_failure, }, data)
; data->result_animation = animation; animation_schedule(animation); #else // Don't animate, just show the peek layer immediately. prv_show_peek_layer(data); #endif } //////////////////////////// // Internal Helper Functions //////////////////////////// //! Used to clean up the application's data before exi...
ize) { 3 * HORIZ_ADVANCE_PX + 1, FONT_HEIGHT + 1 } }; TextLayoutExtended layout = (TextLayoutExtended) { }; GContext gcontext = (GContext) { }; layout.hash = 0; layout.box = (GRect) { (GPoint) { 0, 0 }, (GSize) { 7 * HORIZ_ADVANCE_PX + 1, FONT_HEIGHT - 1} }; layout.font = (GFont) { 0 }; layout.overflow_mod...
cl_assert_equal_p(data1, data2)
; // values are still 0 cl_assert_equal_p(data2->perimeter.impl, NULL); cl_assert_equal_i(data2->paging.page_on_screen.size_h, 0); } #include "applib/legacy2/ui/text_layer_legacy2.h" void test_text_layout__delta(void) { GContext gcontext = (GContext) { }; GFont font = (GFont) { 0 }; GRect box = (GRect) { ...
8}, { 1104, 0, -8}, { 960, 40, 8}, { 1032, -24, -16}, { 1080, 16, -72}, { 968, 16, -192}, { 1112, -112, -56}, { 1120, -80, 0}, { 1112, 24, -144}, { 1104, 72, -208}, { 992, 88, -232}, { 752, 88, -128}, { 744, 64, -80}, { 936, 64, 0}, { 1200, 128, 64}, { 1192, 2...
// 24 seconds { 1344, 64, -224}, { 1272, 56, -216}, { 872, 120, -184}, { 680, 104, -104}, { 752, 136, -40}, { 976, 144, -24}, { 1000, 192, -80}, { 920, 216, -128}, { 1192, 192, -128}, { 1352, 288, -112}, { 1080, 336, -48}, { 1200, 368, -120}, { 1064, 400, -200}, ...
/* * 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...
{ expandable_dialog_pop(context); }
static void prv_push_first_use_dialog(void) { const void *i18n_owner = prv_push_first_use_dialog; // Use this function as the i18n owner /// Title for the Quick Launch first use dialog. const char *header = i18n_get("Quick Launch", i18n_owner); /// Help text for the Quick Launch first use dialog. const char...
_invalid(app_smartstrap_attribute_end_write(attr, 0, true)); assert_result_invalid(app_smartstrap_attribute_end_write(attr, 100, false)); assert_result_invalid(app_smartstrap_attribute_end_write(attr, 100, true)); // smartstrap_attribute_read() assert_result_invalid(app_smartstrap_attribute_read(NULL)); // ...
cl_assert(write_length == 100)
; // end the write request assert_result_ok(app_smartstrap_attribute_end_write(attr, 100, false)); // trigger the write request to be sent stub_pebble_tasks_set_current(PebbleTask_KernelBackground); cl_assert(smartstrap_attribute_send_pending()); // check that it was sent successfully SmartstrapRequest...
IVE_HRS); cl_assert_equal_s("Yesterday, 12:00 PM", time_buf); // June 10th 2015, 11:00:00 (T+23:00:00) rtc_set_time(event_time + (23 * SECONDS_PER_HOUR)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("Yesterday, 12:00 PM", time_buf); // June...
rtc_set_time(event_time + (1 * SECONDS_PER_MINUTE))
; clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("1 MIN AGO", time_buf); // June 9th 2015, 16:02:00 (T+00:02:00) rtc_set_time(event_time + (2 * SECONDS_PER_MINUTE)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_REL...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_s(buffer, "012345678901234")
; } } void test_snowy_mfg_info__1_to_2_conversion(void) { // Force in an old data version. typedef struct { uint32_t data_version; uint32_t color; uint32_t rtc_freq; } MfgDataV1; MfgDataV1 old_data = { .data_version = 1, .color = 3, .rtc_freq = 4 }; flash_write_bytes((const uin...
VEL_DEBUG, "state transition %d->%d valid:%d", data->state, next_state, can_transition); if (can_transition) { data->state = next_state; } return can_transition; } ///////////////////////////////////// // Exit Animation & Inactivity Timer ///////////////////////////////////// T_STATIC void prv_ini...
prv_cleanup_timer(&data->intro_timer_id)
; } else if (prev_state == TimelineAppStateStationary || prev_state == TimelineAppStateUpDown) { TimelineLayout *first_timeline_layout = timeline_layer_get_current_layout(&data->timeline_layer); if (!first_timeline_layout) { return NULL; } prv_init_peek_layer(data); GR...
/* * 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...
{ job->cb_data = (void*)((uintptr_t)data + 1); }
static void prv_clock_change(int32_t time_diff, int32_t gmt_diff, bool dst_trans) { PebbleSetTimeEvent set_time_info = { .utc_time_delta = time_diff, .gmt_offset_delta = gmt_diff, .dst_changed = dst_trans, }; rtc_set_time(rtc_get_time() + time_diff); g_timezone.tm_gmtoff += gmt_diff; time_util_u...
if (i2c_hal_is_busy(bus)) { PBL_LOG(LOG_LEVEL_ERROR, "Timed out waiting for bus %s to become non-busy", bus->name); return false; } } return true; } //! Set up and start a transfer to a bus, wait for it to finish and clean up after the transfer //! has completed static bool prv_do_transfer(I2CBu...
(bus->state)
; // Wait for bus to to clear the busy flag before a new transfer starts // Theoretically a transfer could complete successfully, but the busy flag never clears, // which would cause the next transfer to fail if (!prv_wait_for_not_busy(bus)) { // Reset I2C bus if busy flag does not clear prv_bus_reset(...
/* * 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_cache, 1, &input)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_update_status_async()
; } static uint32_t prv_calc_timeout(const TimelineItem *item) { const time_t now = rtc_get_time(); const time_t start = item->header.timestamp; const time_t end = start + (item->header.duration * SECONDS_PER_MINUTE); if (now >= end) { return 0; } const uint32_t timeout_s = ((start > now) ? start : end...
.h" #include "stubs_logging.h" #include "stubs_passert.h" #include "stubs_queue.h" #include "stubs_mutex.h" #include "stubs_reboot_reason.h" #include "stubs_syscall_internal.h" #include "fake_pbl_malloc.h" #include "fake_new_timer.h" // NOTE: This must match the definition of EventedTimer in kernel/services/evented_t...
(!stub_new_timer_is_scheduled(sys_timer_id))
; // However, we want to test the case where we send the delete command but the timer goes off before the // command is applied. Run the timer anyway. stub_new_timer_fire(sys_timer_id); // However, the timer should have been canceled in the evented_timer system, and we shouldn't see an event // be generated...
rviceTimeScopeOnce); cl_assert_equal_i(123, result); // This is the equivalent to `peek_value` with HeartRateBPM. Make sure it is equal. result = health_service_aggregate_averaged(HealthMetricHeartRateBPM, now_utc - 60, now_utc - 60, ...
PBL_LOG(LOG_LEVEL_DEBUG, "Updating weekly stats with %"PRIi32": sum: %"PRIi32", " "avg: %"PRIi32" ", value, weekly_stats.sum, weekly_stats.avg)
; } if (day_in_week == Sunday || day_in_week == Saturday) { prv_update_stats(&weekend_stats, value); } else { prv_update_stats(&weekday_stats, value); } prv_update_stats(&daily_stats, value); } // ---------------------------------------- // Compute each combination of agg/stat an...
t e = { .type = PEBBLE_HEALTH_SERVICE_EVENT, .health_event = { .type = HealthEventMovementUpdate, .data.movement_update = { .steps = s_activity_state.step_data.steps, }, }, }; event_put(&e); } } // ----------------------------------------------------------...
accel_session_delete(s_activity_state.accel_session)
; s_activity_state.accel_session = NULL; } // Close down heart rate support prv_heart_rate_deinit(); PBL_ASSERTN(activity_algorithm_deinit()); s_activity_state.started = false; PBL_LOG(LOG_LEVEL_INFO, "activity tracking stopped"); PebbleEvent event = { .type = PEBBLE_ACTIVITY_EVENT, .activi...
0 AM { 0, 0x66, 56, 212}, { 0, 0x57, 3813, 193}, { 9, 0x65, 4973, 212}, { 0, 0x46, 8622, 161}, { 26, 0x42, 5735, 186}, { 79, 0x42, 8500, 184}, { 113, 0x42, 5296, 177}, { 120, 0x33, 5074, 175}, { 120, 0x32, 5317, 172}, { 119, 0x33, 5103, 152}, { 77, 0x22, 3209, 177}, { 120...
{ 0, 0x8b, 0, 228}, { 0, 0x8b, 0, 228}, { 0, 0x8b, 0, 228}, { 0, 0x8b, 0, 228}, { 0, 0x8b, 0, 228}, { 0, 0x8b, 0, 228}, { 0, 0x8b, 0, 228}, { 0, 0x8b, 0, 228}, { 0, 0x8b, 0, 228}, { 0, 0x8b, 0, 228}, { 0, 0x8b, 0, 228}, { 0, 0x8b, 0, 228}, { 0, 0x8b, 0, 228}, { 0,...
{ 0, 0x54, 29, 183}, { 0, 0x54, 0, 179}, // 250: Local time: 10:31:00 AM { 0, 0x54, 0, 183}, { 0, 0x44, 196, 191}, { 0, 0x43, 910, 188}, { 0, 0x43, 13, 185}, { 0, 0x44, 56, 179}, { 9, 0x63, 1731, 190}, { 0, 0x53, 2419, 180}, { 0, 0x54, 1741, 182}, { 0, 0x53, 2018, 154}, ...
Sleep Duration 1111, // Deep Sleep Duration 2222, // Fall Asleep Time 3333, // Wakeup Time 4444, // Active Time 5555, // Typical sleep duration 6666, // Typical deep sleep duration 7777, // Typical fall asleep time 8888, // Typical wakeup ...
{ const char *key = "monday_sleepData"; cl_assert_equal_i(health_db_insert((uint8_t *)key, strlen(key), (uint8_t *)s_sleep_data, sizeof(s_sleep_data)), S_SUCCESS); cl_assert_equal_i(s_metric_updated_count, NUM_CURRENT_SLEEP_METRICS); // check typicals ...
void test_health_db__hr_zone_data(void) { const char *key = "monday_heartRateZoneData"; cl_assert_equal_i(health_db_insert((uint8_t *)key, strlen(key), (uint8_t *)s_hr_zone_data, sizeof(s_hr_zone_data)), S_SUCCESS); cl_assert_equal_i(s_metric_updated_cou...
/* * 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 BTErrnoOK; }
uint16_t gatt_client_subscriptions_consume_notification(BLECharacteristic *characteristic_ref_out, uint8_t *value_out, uint16_t *value_length_in_out, ...
/* * 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(is_invalid == true)
; } void test_hdlc__decode_escaped_special(void) { // 2 escaped special characters uint8_t data; bool should_store, is_invalid, is_complete; HdlcStreamingContext ctx; hdlc_streaming_decode_reset(&ctx); // escaped escape character data = HDLC_ESCAPE; is_complete = hdlc_streaming_decode(&ctx, &data, &sh...
und); mutex_lock(s_attr_list_lock); if (prv_find_by_state(SmartstrapAttributeStateRequestInProgress)) { // we already have a request in progress mutex_unlock(s_attr_list_lock); return false; } // get the next attribute which has a pending request SmartstrapAttributeInternal *attr = prv_find_by_st...
kernel_free(attr)
; } attr = next; } mutex_unlock(s_attr_list_lock); } // Syscalls // NOTE: These all run on the consumer task which moves attributes from Idle to RequestPending //////////////////////////////////////////////////////////////////////////////// DEFINE_SYSCALL(bool, sys_smartstrap_attribute_register, uint16_t...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
flash_erase_sector(sector_addr, prv_erase_sector, state)
; } else { pulse_bulkio_erase_message_send(PulseBulkIODomainType_ExternalFlash, S_SUCCESS, state->cookie); kernel_free(state); } } static status_t external_flash_domain_erase(uint8_t *packet_data, size_t length, uint8_t cookie) { if (length != sizeof(ExternalFlashEraseOptions)) { return E_INVALID_ARG...
/* * 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 new_state == AccessoryInputStateMfg; }
return false; } // The accessory state is used to differentiate between different consumers of the accessory port. // Before a consumer uses the accessory port, it must set its state and return the state to idle // once it has finished. No other consumer will be permitted to use the accessory port until the // stat...