prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
SERTN(clipped_rect.origin.y < bitmap->bounds.size.h); PBL_ASSERTN(clipped_rect.origin.y >= 0); const uint16_t y = clipped_rect.origin.y; const uint16_t x_end = x + width; graphics_private_draw_horizontal_line_integral(ctx, &ctx->dest_bitmap, y, x, x_end, fill_color); } } //! Return the maximum round...
{ FillCircleImplFunc circle_func = graphics_internal_circle_quadrant_fill_aa; prv_fill_rect_internal(ctx, rect, radius, corner_mask, fill_color, 0, circle_func); }
-416}, { 1280, 488, -328}, { 1200, 456, -416}, { 1248, 488, -296}, { 1504, 424, -208}, { 1360, 320, -80}, { 1192, 256, -88}, { 1304, 280, -128}, { 1408, 296, -144}, { 1376, 256, -152}, { 1160, 176, -168}, // 53 seconds { 1144, 64, -184}, { 840, -176, -216}, { 688...
{ -96, 728, -648}, { -80, 872, -672}, { -104, 968, -688}, { -64, 1016, -664}, { -80, 928, -640}, { -88, 880, -544}, { -72, 944, -544}, { -120, 1032, -424}, { -128, 1048, -496}, { -72, 896, -408}, { -56, 776, -416}, { -8, 984, -448}, { -216, 1144, -320}, { -144, 84...
{ 992, 488, -120}, { 792, 440, -216}, { 552, 352, -408}, { 552, 240, -496}, { 704, 280, -352}, { 712, 456, -336}, // 5 seconds { 992, 744, -152}, { 1072, 1160, -32}, { 880, 1368, 56}, { 568, 1096, 24}, { 456, 1024, -24}, { 360, 1120, 40}, { 248, 1048, 40}, { ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
((ListNode*) new_node)
ULL, command); cl_assert_equal_i(s_stroke_color.argb, GColorClearARGB8); cl_assert_equal_i(s_fill_color.argb, GColorBlueARGB8); cl_assert_equal_i(s_stroke_width, 0); cl_assert_equal_i(s_path_num_points, 2); cl_assert_equal_b(s_path_open, false); cl_assert_equal_i(s_path_fill_count, 1); cl_assert_equal_i(s...
(command, true)
/* * 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(&data->text_layer, &GRect(frame.origin.x, frame.origin.y, frame.size.w, frame.size.h)); text_layer_set_background_color(&data->text_layer, GColorWhite); text_layer_set_text_color(&data->text_layer, GColorBlack); text_layer_set_text(&data->text_layer,...
static void click_handler(ClickRecognizerRef recognizer, Window *window) { AppState *data = window_get_user_data(window); ButtonId button = click_recognizer_get_button_id(recognizer); GRect frame = data->text_layer.layer.frame; if (button == BUTTON_ID_UP) { if (data->select_index == SelectIndexPixels) { ...
/* * 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 (s_valid_resources_found) { unused_bank_index = (s_active_bank + 1) % ARRAY_LENGTH(s_resource_banks); } else { static int s_unused_bank_index = -1; if (s_unused_bank_index == -1) { // A crude form of wear levelling to try and keep BB2s in infra happy // // For real watches, the only ...
return &s_resource_banks[unused_bank_index]; } static uint32_t resource_storage_system_bank_metadata_size(ResourceStoreEntry *entry) { return SYSTEM_STORE_METADATA_BYTES; } // PBL-28517 investigation extern uint8_t pbl_28517_flash_impl_get_status_register(uint32_t sector_addr); static uint32_t resource_storage_...
cl_assert_equal_m(&item2.header.id, stub_new_timer_callback_data(get_reminder_timer_id()), sizeof(TimelineItemId)); cl_assert(stub_new_timer_timeout(get_reminder_timer_id()) == 100 * 1000); // ...until we insert item 1 back cl_assert(S_SUCCESS == reminders_insert(&item1)); cl_assert_equal_m(&item1.header.id, s...
(&s_all_day_reminder)
PmicResetReason_ForcedReset = 0x02, //!< sw force_reset PmicResetReason_OnPulledHigh = 0x03, //!< Force sw power_off, ON pulled high PmicResetReason_Charger = 0x04, //!< Forced sw power_off, Charger detected. PmicResetReason_XRES = 0x05, //!< External trigger through XRES PmicResetReason_OverTemperature = 0x0...
{ prv_init_gpio(); if (!prv_is_alive()) { return false; } prv_start_120hz_clock(); return true; }
32_t steps, duration_s, distance_m, bpm; HRZone hr_zone; cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone)); cl_assert_equal_i(steps, 0); cl_assert_equal_i(duration_s, 0); cl_assert_equal_i(distance_m, 0);...
ROUND(activity_private_compute_active_calories(distance_delta_m * MM_PER_METER, 600 * MS_PER_SECOND), ACTIVITY_CALORIES_PER_KCAL)
cl_assert(list_get_prev(&a) == NULL); cl_assert(list_get_next(&a) == &b); cl_assert(list_get_prev(&b) == &a); cl_assert(list_get_next(&b) == &c); cl_assert(list_get_prev(&c) == &b); cl_assert(list_get_next(&c) == NULL); } void test_list__count(void) { ListNode a = LIST_NODE_NULL, b = LIST_NODE_NULL, c = LI...
for (int i = 0; i < 5; ++i) { bar[i].value = i * 2; }
// Wrap around once, find nothing and return NULL: cl_assert(list_find_next(&bar[3].list_node, (bool(*)(ListNode*, void*))is_odd, true, NULL) == NULL); cl_assert(list_find_prev(&bar[3].list_node, (bool(*)(ListNode*, void*))is_odd, true, NULL) == NULL); // Test NULL starting node: cl_assert(list_find_next(NU...
alendar_pin(-4 * 60 * 60, 60, !is_all_day, !recurring, 0, 0); prv_add_generic_pin(-6 * 60 * 60, !has_subtitle); prv_add_generic_pin(-5 * 60 * 60, has_subtitle); prv_add_sports_pin(-4 * 60 * 60, GColorBlack, is_ingame, !has_broadcaster); prv_add_activity_session_pin(-3 * 60 * 60, 30); prv_a...
{ // add CFLAGS="-DTIMELINE_PIN_SET=OneDayAway" before ./waf configure to skip menu #ifdef TIMELINE_PIN_SET #define PREFIX_PIN_SET(set) (__CONCAT(TimelinePinsDemo, set)) timeline_pins_demo_add_pins(PREFIX_PIN_SET(TIMELINE_PIN_SET)); #else OptionMenu *option_menu = option_menu_create(); const OptionMenuConfig...
} //! Power up I2C bus power supply //! Always lock bus and peripheral config access before use static void prv_bus_rail_power_up(I2CBus *bus) { if (!bus->rail_ctl_fn) { return; } static const uint32_t MIN_STOP_TIME_MS = 10; // check that at least enough time has elapsed since the last turn-off RtcTick...
PBL_ASSERTN(slave)
; static const int MAX_TOGGLE_COUNT = 10; static const int TOGGLE_DELAY = 10; // Protect access to bus mutex_lock(slave->bus->state->bus_mutex); if (slave->bus->state->user_count == 0) { PBL_LOG(LOG_LEVEL_ERROR, "Attempted bitbang recovery on disabled bus %s", slave->bus->name); mutex_unlock(slave-...
/* * 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...
list_count(&s_head->node)
/* * 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...
GPoint(20, 20)
); } #define ORIGIN_RECT_NO_CLIP GRect(0, 0, 144, 168) #define ORIGIN_RECT_CLIP_XY GRect(0, 0, 30, 40) #define ORIGIN_RECT_CLIP_NXNY GRect(0, 0, 30, 40) #define START_ON_ORIGIN_RECT GPoint(5, 5) #define END_ON_ORIGIN_RECT GPoint(25, 25) #define START_ON_ORIGIN_RECT_XY GPoint(15, 15) #...
/* * 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...
printf("Expected %"PRIx64", got %"PRIx64" (item_size=%"PRIu32")\n", expected, got, item_size)
seconds = 30 * SECONDS_PER_MINUTE, \ .trigger_notif_activity = 20, \ .trigger_notif_active_minutes = 5 \ } \ } \ } #define ACTIVITY_INSIGHTS_SETTINGS_ACTIVITY_REWARD_DEFAULT { \ .version = ACTIVITY_INSIGHTS_SETTINGS_CURRENT_STRUCT_VERSION, \ .enabled = false, \ .reward = {\ .min_days_data =...
if (prv_open_settings_and_lock(&file)) { settings_file_get(&file, ACTIVITY_INSIGHTS_SETTINGS_VERSION_KEY, strlen(ACTIVITY_INSIGHTS_SETTINGS_VERSION_KEY), &version, sizeof(uint16_t)); prv_close_settings_and_unlock(&file); }
return version; } bool activity_insights_settings_read(const char *insight_name, ActivityInsightSettings *settings_out) { bool rv = false; *settings_out = (ActivityInsightSettings) {}; SettingsFile file; if (prv_open_settings_and_lock(&file)) { if (settings_file_get...
/* * 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 (strstr((const char *)message->value, NEXMO_REAUTH_STRING)) { PBL_LOG(LOG_LEVEL_INFO, "Got Nexmo Reauth SMS"); return true; }
} return false; } void nexmo_handle_reauth_sms(uint32_t uid, const ANCSAttribute *app_id, const ANCSAttribute *message, iOSNotifPrefs *existing_notif_prefs) { const int num_existing_attributes = existing_notif_prefs ? ...
/* * 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...
(0b00111000, BITS_BETWEEN(3, 5))
; cl_assert_equal_i(0b00010000, BITS_BETWEEN(4, 4)); } // Flash memory is organized into twelve sectors of unequal sizes. // Sectors 0-3 are 16 KiB. Sector 4 is 64 KiB. // The remaining sectors are 128 KiB. // Bitset of sectors that have been "erased" static uint32_t erased_sector; static bool flash_locked, flash_f...
oll_layer, int8_t dir) { scroll_layer_scroll(scroll_layer, dir, true); } static void prv_offset_changed_handler(ScrollLayer *scroll_layer, void *context) { ExpandableDialog *expandable_dialog = context; ActionBarLayer *action_bar = &expandable_dialog->action_bar; GPoint offset = scroll_layer_get_content_offset...
layer_add_child(&window->layer, &scroll_layer->layer)
; #if PBL_ROUND uint16_t page_height = scroll_layer->layer.bounds.size.h; #endif // Set up the header if this dialog is set to have one. GTextAlignment alignment = PBL_IF_RECT_ELSE(GTextAlignmentLeft, (show_action_bar ? ...
stEntry *iter = *resource_list; while (iter) { PBL_LOG(LOG_LEVEL_INFO, "Orphaned resource file removed: %s", iter->name); pfs_remove(iter->name); iter = (PFSFileListEntry *)iter->list_node.next; } } // The bug addressed in PBL-34010 caused resource files to remain in the filesystem even // after the as...
(s_app_cache_mutex)
; { pfs_remove(APP_CACHE_FILE_NAME); prv_delete_cached_files(); } mutex_unlock_recursive(s_app_cache_mutex); } //////////////////////////////// // Testing only //////////////////////////////// static bool prv_each_get_size(SettingsFile *file, SettingsRecordInfo *info, void *context) { if ((info->key_l...
sizeof(s_server_reset_request), BLEGATTErrorSuccess); } static void prv_receive_reset_complete(BLECharacteristic characteristic) { ppogatt_handle_read_or_notification(characteristic, (const uint8_t *)s_client_reset_complete, s_client_reset_complete_size, BLEGATTErrorSucces...
fake_gatt_client_subscriptions_init()
; regular_timer_init(); fake_comm_session_init(); ppogatt_create(); } void test_ppogatt__cleanup(void) { ppogatt_destroy(); cl_assert_equal_i(ppogatt_client_count(), 0); cl_assert_equal_i(regular_timer_seconds_count(), 0); regular_timer_deinit(); fake_gatt_client_op_deinit(); fake_gatt_client_subscri...
white_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorWhite); graphics_context_set_antialiased(ctx, false); graphics_draw_line(ctx, GPoint(5, 35), GPoint(45, 40)); } void clear_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx...
gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_line_across_ny_offset_layer"))
); } void test_graphics_draw_line__clear(void) { GContext ctx; Layer layer; test_graphics_context_init(&ctx, fb); layer_init(&layer, &GRect(0, 0, 60, 60)); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST...
#include "fake_time.h" // Stubs #include "stubs_app_manager.h" #include "stubs_app_state.h" #include "stubs_logging.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_resources.h" #include "stubs_sleep.h" #include "stubs_serial.h" #include "stubs_syscalls.h" #include "stubs_sys_exit.h" size_t...
ASSERT_JS_GLOBAL_EQUALS_S("s", "8 PM")
; EXECUTE_SCRIPT("s = d.toLocaleTimeString(undefined, " "{hour: 'numeric', hour12: false});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "20"); EXECUTE_SCRIPT("s = d.toLocaleTimeString(undefined, {hour: '2-digit'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "08 PM"); EXECUTE_SCRIPT("s = d.toLocaleTimeString(un...
) { // In PPoGATT V1, two features were added to allow for enhanced throughput: // 1) Negotiable RX/TX in-flight windows - This let's the phone put more data out over the // air and not block waiting for an Ack // 2) Coalesced ACKing - Since 1) makes the window size large...
prv_total_num_bytes_awaiting_ack_up_to(client, client->out.next_data_sn)
; } static void prv_set_payload_size_for_sn(PPoGATTClient *client, uint32_t sn, uint16_t payload_size) { client->out.payload_sizes[sn] = payload_size; } static void prv_clear_payload_sizes_up_to(PPoGATTClient *client, uint32_t sn_end_excl) { for (uint32_t sn = client->out...
976, 40, 216}, { 864, 40, 128}, { 736, 96, 16}, { 624, -8, 16}, { 584, -56, -8}, { 712, -8, -96}, { 912, -72, 72}, { 1600, -152, 424}, { 1680, 792, 360}, { 1384, 1168, -160}, { 1120, 584, 40}, { 1024, 104, 400}, { 1056, -24, 368}, // 22 seconds { 1056, 176, 328}, ...
{ 616, -24, -104}, { 768, 80, -240}, { 1368, -96, -8}, { 1672, -16, 264}, { 1632, 424, 48}, { 1520, 600, -248}, { 1120, 352, 160}, { 968, 168, 288}, { 1008, 72, 304}, { 1008, 208, 192}, { 928, 344, 120}, { 840, 432, -24}, { 896, 472, -32}, { 968, 568, -40}, { ...
{ 1144, 448, -56}, { 1256, 400, 48}, { 1816, 632, 72}, { 1464, 560, 96}, { 960, 352, 40}, { 1176, 264, 56}, { 1384, 96, 200}, { 1264, 96, 256}, { 1160, 96, 176}, { 1048, 40, 200}, { 928, 16, 232}, { 832, 16, 168}, { 752, -16, 144}, { 656, -24, 96}, { 696, -40...
prv_transition_to_accepting(outbox); } else if (outbox->phase == OUT_AWAITING_REPLY_AND_OUTBOX_CALLBACK) { outbox->phase = OUT_AWAITING_OUTBOX_CALLBACK; } else { WTF; } } static void prv_handle_outbox_error_cb(void *data) { AppMessageResult result = (AppMessageResult)(uintptr_t) data; _Static_asse...
{ return APP_MSG_INVALID_ARGS; }
AppMessagePhaseOut phase = outbox->phase; *iterator = NULL; if (prv_is_message_pending(phase)) { PBL_LOG(LOG_LEVEL_ERROR, "Can't call app_message_outbox_begin() now, wait for sent_callback!"); // See https://pebbletechnology.atlassian.net/browse/PBL-10146 // Workaround for apps that sit in a while(...
t PASSED! Avg weighted error: %.2f", weighted_sum / num_tests); } cl_assert_equal_i(fail_count, 0); kernel_free(s_kalg_state); s_kalg_state = NULL; } // --------------------------------------------------------------------------------------- void test_kraepelin_algorithm__activity_tests(void) { bool success...
(num_tests > 0)
; // Let's sort the tests by name qsort(&test_entry[0], num_tests, sizeof(test_entry[0]), prv_qsort_activity_test_entry_cb); // --------------------------------------------------------------------------------- // Print results in a table printf("\n\n"); printf("\n%-24s", "name"); // Print header line ...
{ 160, 440, 704}, { 168, 520, 712}, { 184, 616, 736}, { 208, 632, 752}, { 232, 624, 704}, { 216, 576, 688}, { 232, 504, 728}, { 224, 520, 720}, { 216, 568, 776}, { 184, 528, 728}, { 152, 464, 664}, { 120, 496, 824}, { 112, 408, 848}, // 116 seconds { 48, 424, 1...
{ 224, 720, -424}, { 128, 544, -432}, { 200, 792, -448}, { 208, 896, -376}, { 208, 840, -232}, { 256, 800, -192}, { 192, 680, -88}, { 72, 808, -48}, { 72, 680, 120}, { 56, 1088, 56}, { -152, 1392, 16}, { -328, 1368, 88}, { 176, 1184, -112}, { 176, 1008, 104}, ...
{ -2536, 872, -216}, { -2640, 640, -56}, { -2288, 608, 256}, { -1720, 704, -144}, { -1504, 552, 128}, // 5 seconds { -1032, 464, 136}, { -712, 352, -32}, { -592, 216, -40}, { -496, 328, -208}, { -512, 320, -256}, { -672, 432, -176}, { -1272, 640, -48}, { -1544, 5...
ptured_history_event = *event; s_num_captured_history_events++; } } // --------------------------------------------------------------------------------------- // Test that we generate health events at the appropriate time void test_activity__health_events(void) { // Start activity tracking. This method assume...
time_util_update_timezone(&tz_info)
; // Start activity tracking. This method assumes it can be called from any task, so we must // invoke system callbacks to handle its KernelBG callback. activity_start_tracking(false /*test_mode*/); fake_system_task_callbacks_invoke_pending(); // Advance to 6pm EST prv_feed_cannned_accel_data(6 * SECONDS_...
US_0); const uint8_t int2_status = bma255_read_register(BMA255Register_INT_STATUS_2); bool anymotion = (int0_status & BMA255_INT_STATUS_0_SLOPE_MASK); if (anymotion) { const AccelConfig *cfg = &BOARD_CONFIG_ACCEL.accel_config; IMUCoordinateAxis axis = AXIS_X; bool invert = false; if (int2_status...
{ // Write to FIFO_CONFIG_1 to exit some unknown "intermittent state" // NOTE: This will clear the FIFO & FIFO status. bma255_read_modify_write(BMA255Register_FIFO_CONFIG_1, 0, 0); }
} static void prv_set_accel_power_mode(BMA255PowerMode mode) { PBL_ASSERTN(mode == BMA255PowerMode_Normal || mode == BMA255PowerMode_LowPower1 || mode == BMA255PowerMode_Standby); // Workaround for entering Normal Mode // LPM1 => Normal requires us to go through Suspend mode // LP...
t, data_out_size), 0); // Free up 2 bytes at the beginning: circular_buffer_consume(&buffer, 2); // Write data that will be wrapped: cl_assert_equal_b(circular_buffer_write(&buffer, (uint8_t *)"456789", 6), true); cl_assert_equal_i(circular_buffer_copy_offset(&buffer, 2 /* start_offset */, ...
circular_buffer_read_or_copy(&buffer, &data_out, sizeof(storage), malloc, &caller_should_free)
); cl_assert_equal_b(true, caller_should_free); cl_assert_equal_m(data_out, "12345678", sizeof(storage)); free(data_out); // Test OOM scenario: cl_assert_equal_b(false, circular_buffer_read_or_copy(&buffer, &data_out, sizeof(storage), prv_oom_malloc, &c...
und) num += range_size * ((lower_bound - num) / range_size + 1); return lower_bound + (num - lower_bound) % range_size; } static void up_click_handler(ClickRecognizerRef recognizer, NumberWindow *nf) { bool is_increased = false; int32_t new_val = nf->value + nf->step_size; if (new_val <= nf->max_val && new...
update_output_value(nf)
; } if (nf->min_val > max) { nf->min_val = max; } } void number_window_set_min(NumberWindow *nf, int32_t min) { nf->min_val = min; if (nf->value < min) { nf->value = min; update_output_value(nf); } if (nf->max_val < min) { nf->max_val = min; } } void number_window_set_value(NumberWindo...
ags[0] }, { .id = 2, .freed = &s_free_flags[1] }, { .id = 3, .freed = &s_free_flags[2] }, }; static const TestCacheItem ZERO_ITEM = {}; static void prv_destructor(void *item) { if (((TestCacheItem *)item)->freed) { *((TestCacheItem *)item)->freed = true; } } static int prv_comparator(void *a, void *...
(&s_cache_buffer[1], &s_test_item[1], sizeof(TestCacheItem))
; cl_assert_equal_m(&s_cache_buffer[2], &s_test_item[1], sizeof(TestCacheItem)); } void test_circular_cache__flush(void) { circular_cache_set_item_destructor(&s_test_cache, prv_destructor); circular_cache_push(&s_test_cache, &s_test_item[0]); circular_cache_flush(&s_test_cache); cl_assert(*s_test_item[0].f...
/* * 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...
(system_flash_erase(FLASH_BASE, 1024 KiB, NULL, NULL))
if (hr_zone_time_s) { const int zone_1_minutes = ROUND(hr_zone_time_s[HRZone_Zone1], SECONDS_PER_MINUTE); if (zone_1_minutes) { snprintf(hr_str, hr_buf_size, i18n_get("%d Min", headings), zone_1_minutes); string_list_add_string(headings, headings_buf_size, i18n_get("F...
prv_add_distance_metric_info(headings, headings_buf_size, values, values_buf_size, session); prv_add_step_metric_info(headings, headings_buf_size, values, values_buf_size, session); prv_add_active_calories_metric_info(headings, headings_buf_size, values, values_buf_si...
// ------------------------------------------------------------------------------------------------ static void prv_do_activity_session(time_t now_utc, ActivitySession *session) { if (!activity_prefs_activity_insights_are_enabled()) { return; } if (!s_activity_session_settings.enabled) { 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...
cron_service_wakeup()
; cl_assert_equal_i(s_num_alarms_fired, 1); cl_assert_equal_i(s_num_alarm_events_put, 1); cl_assert_equal_i(s_num_timeline_adds, 6); cl_assert_equal_i(s_num_timeline_removes, 3); cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); } void test_alarm_smart__trigger_30_min_early_vmc...
t_set_stroke_color(ctx, GColorWhite); graphics_context_set_antialiased(ctx, false); graphics_draw_circle(ctx, GPoint(14, 14), 12); } void clear_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorClear); graphics_context_set_antialiased(ctx, false); graphics_draw_ci...
graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM)
/* * 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_db_iterator_cb, NULL)
); } void test_weather_db__check_records_in_db(void) { for (int index = 0; index < WEATHER_DATA_SHARED_WEATHER_DB_NUM_DB_ENTRIES; index++) { WeatherDBEntry *to_check = task_zalloc_check(weather_shared_data_get_entry_size(index)); const WeatherDBKey *key = weather_shared_data_get_key(index); cl_assert_equ...
ing address within the page. * */ static void flash_write_page(const uint8_t* buffer, uint32_t start_addr, uint16_t buffer_size) { // Ensure that we're not trying to write more data than a single page (256 bytes) PBL_ASSERTN(buffer_size <= FLASH_PAGE_SIZE); PBL_ASSERTN(buffer_size); mutex_assert_held_by_curr_...
{ if (!buffer_size) { return; } PBL_ASSERTN((start_addr + buffer_size) <= BOARD_NOR_FLASH_SIZE); assert_usable_state(); flash_lock(); if (!s_flash_state.enabled) { flash_unlock(); return; } analytics_write_bytes_count += buffer_size; power_tracking_start(PowerSystemFlashWrite); ena...
void flash_erase_subsector_blocking(uint32_t subsector_addr) { assert_usable_state(); PBL_LOG(LOG_LEVEL_DEBUG, "Erasing subsector 0x%"PRIx32" (0x%"PRIx32" - 0x%"PRIx32")", subsector_addr, subsector_addr & SUBSECTOR_ADDR_MASK, (subsector_addr & SUBSECTOR_ADDR_MASK) + SUBSECTOR_SIZE_BYTES); fl...
/* * 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_LEVEL_DEBUG, "Locking mutex 1")
; mutex_lock(s_mutex); psleep(20); PBL_LOG(LOG_LEVEL_DEBUG, "Locking mutex 2"); mutex_lock(s_mutex2); } static void s_main(void) { window = window_create(); app_window_stack_push(window, true /* Animated */); deadlock(); app_event_loop(); } const PebbleProcessMd* deadlock_get_app_info(void) { stat...
// Teardown void test_graphics_draw_text_${BIT_DEPTH_NAME}__cleanup(void) { free(fb); } /////////////////////////////////////////////////////////// // Tests static FontInfo s_font_info; static const char *s_text_buffer = "Text Clipping"; static void prv_setup_resources(void) { // Setup resources fake_spi_flas...
(4, -46, 72, 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...
if (!s_hrm_present) { return; }
const uint32_t last_toggled_ts = s_activity_state.hr.toggled_sampling_at_ts; bool should_toggle = false; if (s_activity_state.hr.currently_sampling) { // If we are currently sampling, turn off when: // - We reach the end of our maximum time on, ACTIVITY_DEFAULT_HR_ON_TIME_SEC // - We get ACTIVITY_M...
imelineitem cl_assert_equal_i(fake_pbl_malloc_num_net_allocs(), init_net_allocs + ARRAY_LENGTH(s_items) + 2); // deinit should free all the memory timeline_iter_deinit(&iterator1, &state1, &head); timeline_iter_deinit(&iterator2, &state2, &head); cl_assert_equal_i(fake_pbl_malloc_num_net_...
(timeline_init(&head), S_SUCCESS)
; // 1425272400 is 21:00 March 1 2015 PST cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, 1425272400), S_SUCCESS); time_t midnight_march_2_pst = 1425283200; // day 1 cl_assert(uuid_equal(&state.pin.header.id, &multiday_item.header.id)); cl_assert(uuid_equal(&...
_id = prv_get_app_exit_reason_destination_install_id_override(); #endif if (destination_app_id == INSTALL_ID_INVALID) { // If we get here, the app exit reason didn't override the destination app ID if (!s_next_app.md) { destination_app_id = system_app_state_machine_get_last_registered_app(); } else...
(app_metadata)
); prompt_send_response_fmt(buffer, sizeof(buffer), "is watchface: %d", (app_metadata->process_type == ProcessTypeWatchface)); prompt_send_response_fmt(buffer, sizeof(buffer), "visibility: %u", app_metadata->visibility); prompt_send_response_fmt(buffer, sizeof(buffer), "bank: %d...
2K prv_receive_init(1024 * 1024, ObjectFirmware); fake_malloc_set_largest_free_block(~0); assert_ack_count(0); assert_nack_count(1); } //////////////////////////////////////////////////////////////////////////////////////////////////// // Put Message void test_put_bytes__put_message_too_short(void) { prv_r...
(event.put_bytes.progress_percent, 100 * sizeof(chunk) / VALID_OBJECT_SIZE)
; cl_assert_equal_b(event.put_bytes.failed, false); } static uint32_t s_next_value_to_write; static void prv_cb_before_write(void) { prv_receive_put(s_last_response_cookie, (uint8_t *)&s_next_value_to_write, VALID_OBJECT_SIZE); } void test_put_bytes__receive_batched_messages(void) { uint8_t max_batched_ops = pr...
CT_NXNY GPoint(10, 15) void test_graphics_draw_circle_${BIT_DEPTH_NAME}__origin_layer_aa(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // Big circles setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_BIG); ...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_across_x_offset_layer.${BIT_DEPTH_NAME}.pbi"))
; test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_nx_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_across_nx_offset_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&l...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(ANALYTICS_DEVICE_METRIC_BATTERY_CHARGE_TIME)
; } bool is_plugged = battery_is_usb_connected(); if (is_plugged) { analytics_stopwatch_start(ANALYTICS_DEVICE_METRIC_BATTERY_PLUGGED_TIME, AnalyticsClient_System); } else { analytics_stopwatch_stop(ANALYTICS_DEVICE_METRIC_BATTERY_PLUGGED_TIME); } } static void prv_update_done_charging(void) { prv...
e = (s_app_data->timeline_model.direction == TimelineIterDirectionFuture); frame.origin.y += is_future ? DISP_ROWS : -DISP_ROWS; timeline_layer_set_day_sep_frame(&data->timeline_layer, &frame); #endif focus_handler = prv_open_did_focus_handler; } else if (prv_set_state(data, TimelineAppStateHidePeek)) { ...
if (!prv_set_state(data, TimelineAppStatePopCard)) { return NULL; }
// Animation structure: // - Scheduled simultaneously // - Transition card to pin // - Move timeline layer from the left // - After completion // - Bounce back the timeline layer // - Move pin window to the right animation_unschedule(data->current_animation); timeline_layer_set_lay...
/* * 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...
peek_animations_draw_compositor_background_speed_lines( ctx, GPoint(PEEK_ANIMATIONS_SPEED_LINES_OFFSET_X, 0))
->config.long_click.release_handler != NULL); } static void prv_auto_repeat_single_click(ClickRecognizer *recognizer) { if (!recognizer->is_button_down) { // If this button isn't being held down anymore, don't re-register the timer. return; } ++(recognizer->number_of_clicks_counted); // Start the repet...
prv_dispatch_event(recognizer, ClickHandlerOffsetSingle, false)
; } } prv_click_reset(recognizer); } static void prv_multi_click_timeout_callback(void *data) { ClickRecognizer *recognizer = (ClickRecognizer *) data; recognizer->multi_click_timer = NULL; if (recognizer->config.multi_click.last_click_only && (recognizer->number_of_clicks_counted >= prv_multi_cli...
; cl_assert_equal_i(s_stroke_color.argb, GColorClearARGB8); cl_assert_equal_i(s_fill_color.argb, GColorClearARGB8); cl_assert_equal_i(s_stroke_width, 0); cl_assert_equal_i(s_path_num_points, 0); cl_assert_equal_b(s_radius, 0); cl_assert_equal_i(s_circle_fill_count, 0); cl_assert_equal_i(s_circle_stroke_co...
prv_create_command_list_3()
; size_t size = sizeof(GDrawCommandList) + (3 * sizeof(GDrawCommand)) + (sizeof(GPoint) * 6); cl_assert(gdraw_command_list_validate(command_list, size)); command_list->num_commands = 4; cl_assert(!gdraw_command_list_validate(command_list, size)); command_list->num_commands = 3; GDrawCommand *command ...
_layer->callbacks.select_long_click(menu_layer, &menu_layer->selection.index, menu_layer->callback_context); } } void menu_up_click_handler(ClickRecognizerRef recognizer, MenuLayer *menu_layer) { const bool up = true; const bool animated = true; menu_layer_set_selected_next(menu_layer, up, MenuRowAlign...
layer_set_bounds(cell_layer, &new_bounds)
; // Call the client, to ask to draw the separator: menu_layer->callbacks.draw_separator(ctx, cell_layer, &cursor->index, menu_layer->callback_context); // Restore current drawing state: graphics_context_set_drawing_state(ctx, prev_state); // Restore the layer bounds: layer_set_bounds(cell_la...
G_LEVEL_INFO, "Valid system resources found!"); s_valid_resources_found = true; return; } } // Welp, we found nothing. Leave s_valid_resources_found as false and when resource_storage_check // is called as part of system_resource_init we'll complain and handle missing resources. } // TODO PBL-21...
flash_write_bytes(buffer, BANK.begin, MANIFEST_SIZE)
; } bool resource_storage_system_bank_check(ResAppNum app_num, uint32_t resource_id, ResourceStoreEntry *entry, const ResourceVersion *expected_version) { if (!s_valid_resources_found) { // We determined that we had no valid banks d...
_num_rows, .selection_will_change = prv_skip_odd_rows, }); menu_layer_reload_data(&l); const int16_t basic_cell_height = menu_cell_basic_cell_height(); const int initial_scroll_offset = (DISP_ROWS - basic_cell_height) / 2; cl_assert_equal_i(0, menu_layer_get_selected_index(&l).section); cl_assert_equal_...
(10, 10, height, DISP_COLS)
); menu_layer_set_center_focused(&l, true); s_num_rows = 3; menu_layer_set_callbacks(&l, NULL, &(MenuLayerCallbacks) { .draw_row = prv_draw_row, .get_num_rows = prv_get_num_rows, .get_cell_height = prv_get_row_height_depending_on_selection_state, }); menu_layer_set_center_focused(&l, true); menu...
/* * 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...
notification_window_service_init()
; app_inbox_service_init(); app_outbox_service_init(); app_message_sender_init(); watchface_init(); timeline_peek_init(); #if CAPABILITY_HAS_HEALTH_TRACKING // Start activity tracking if enabled if (activity_prefs_tracking_is_enabled()) { activity_start_tracking(false /*test_mode*/); } workout_ser...
e, GContext* ctx) { graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(4, -40, 72, 32), GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL); } void draw_text_single_line_wordwrap_clip_outside_y(Layer* me, GContext* ctx) { graphics...
test_graphics_context_reset(&ctx, fb)
; layer_set_update_proc(&layer, &draw_text_single_line_ellipsis_clip_outside_nx); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_ellipsis_clip_outside_nx.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_te...
g_box.origin.x; x2.integer += ctx->draw_state.drawing_box.origin.x; y += ctx->draw_state.drawing_box.origin.y; GBitmap *framebuffer = graphics_capture_frame_buffer(ctx); if (!framebuffer) { // Couldn't capture framebuffer return; } graphics_private_draw_horizontal_line_prepared(ctx...
MIN(x0, x1)
/* * 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...
this->send_begin_fn(PULSE_CONTROL_MESSAGE_PROTOCOL)
; message->code = PCMPCode_PortClosed; memcpy(message->information, &port, sizeof(port)); this->send_fn(message, sizeof(PCMPPacket) + sizeof(port)); } #endif
or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "clar.h" #include "s...
audio_endpoint_add_frame(s_session_id, s_test_frame, sizeof(s_test_frame))
; } fake_transport_set_sent_cb(s_transport, prv_test_data_transfer_msg); fake_comm_session_process_send_next(); audio_endpoint_stop_transfer(s_session_id); fake_transport_set_sent_cb(s_transport, prv_test_stop_transfer_msg); fake_comm_session_process_send_next(); } void test_audio_endpoint__remote_stop_tr...
/* * 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...
{ *zone = (HealthDetailZone) { .label = app_zalloc_check(buffer_size), .progress = minutes * SECONDS_PER_MINUTE, .fill_color = PBL_IF_COLOR_ELSE(GColorSunsetOrange, GColorDarkGray), }; int pos = snprintf(zone->label, buffer_size, "%s ", i18n_get(zone_label, i18n_owner)); if (zone->progress) { h...
static void prv_set_heading_value(char *buffer, const size_t buffer_size, const int32_t zone_time_s, void *i18n_owner) { if (zone_time_s == 0) { strncpy(buffer, EN_DASH, buffer_size); return; } health_util_format_hours_and_minutes(buffer, buffer_size, zone_time_s, i18n...
/* * 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...
("", string_list_get_at(list, 1))
; cl_assert_equal_s("", string_list_get_at(list, 2)); cl_assert_equal_s(NULL, string_list_get_at(list, 3)); // 4 strings (first and last two are empty) list->serialized_byte_length = 4; list->data[0] = '\0'; list->data[1] = 'b'; list->data[2] = '\0'; list->data[3] = '\0'; // end of data list->data[4]...
8_t buffer[sizeof(PutRequest) + payload_size]; PutRequest *put_msg = (PutRequest *)buffer; *put_msg = (PutRequest) { .cmd = CmdPut, .cookie = htonl(cookie), .payload_size = htonl(payload_size), }; memcpy(&put_msg->payload[0], payload, payload_size); prv_receive_data(s_session, buffer, sizeof(buff...
(EXPECTED_CRC)
; fake_comm_session_init(); fake_event_reset_count(); Transport *transport = fake_transport_create(TransportDestinationSystem, NULL, prv_system_msg_sent_callback); s_session = fake_transport_set_connected(transport, true /* connected */); cl_assert_equal_p(comm_...
ageHandler)~0) #define NOT_PERMITTED_DROP_HANDLER ((AppInboxDroppedHandler)~0) #define TEST_TARGET_TASK (PebbleTask_App) typedef struct { ListNode node; PebbleEvent event; } EventNode; static EventNode *s_event_head; static bool s_can_send_event; bool process_manager_send_event_to_process(PebbleTask task, Pebble...
prv_cleanup_callback_events()
se 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 IS" BASIS, * WITHOUT WARRANTIES OR COND...
(decoded_codepoint, actual_codepoint)
aw_circle_${BIT_DEPTH_NAME}__zero_aa_swX_clear(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // Draw clear circles with antialiasing enabled setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 0); graphics_context_set_stroke_color(&ctx, GColorClear); prv_draw_circles(&...
(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1)
; GPoint pt = CENTER_OF_ORIGIN_RECT; uint16_t radius = 10; uint16_t stroke_width = 1; for (int r = 1; r <= 7; r++) { graphics_context_set_stroke_width(&ctx, stroke_width); graphics_draw_arc_internal(&ctx, pt, radius, test_angles[i].angle, TRIG_MAX_ANGLE); stroke_width += 1; rad...
dler(recognizer, window, true); } static void raw_down_click_handler(ClickRecognizerRef recognizer, Window *window) { raw_click_handler(recognizer, window, false); } static void select_multi_click_handler(ClickRecognizerRef recognizer, Window *window) { ClickAppData *data = window_get_user_data(window); const u...
app_window_stack_push(window, animated)
; } //////////////////// // App boilerplate static void handle_init(void) { ClickAppData *data = (ClickAppData*) app_malloc_check(sizeof(ClickAppData)); if (data == NULL) { PBL_CROAK("Out of memory"); } app_state_set_user_data(data); push_window(data); } static void handle_deinit(void) { ClickAppData...
) ((x & _S_IFDIR) != 0) # define snprint_eq(buf,sz,fmt,a,b) _snprintf_s(buf,sz,_TRUNCATE,fmt,a,b) # else # define snprint_eq snprintf # endif typedef struct _stat STAT_T; #else # ifdef UNITTEST_DEBUG # include <signal.h> # endif # include <sys/wait.h> /* waitpid(2) */ # include <unistd.h> # define _MAIN_CC # de...
clar_report_errors()
; else clar_print_ontest( test->name, _clar.test_count, (_clar.suite_errors > error_st) ); } static void clar_run_suite(const struct clar_suite *suite) { const struct clar_func *test = suite->tests; size_t i; if (!clar_category_is_suite_enabled(suite)) return; if (_clar.exit...
/* * 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_selection_config()
->default_cell_height; } /////////////////////////////////////////////////////////////////////////////////////////////////// //! Drawing helpers static int prv_get_pixels_for_bump_settle(int anim_percent_complete) { if (anim_percent_complete) { return SETTLE_HEIGHT_DIFF - ((SETTLE_HEIGHT_DIFF * anim_percent_com...
_get_prev(&a) == NULL); cl_assert(list_get_next(&a) == &b); cl_assert(list_get_prev(&b) == &a); cl_assert(list_get_next(&b) == &c); cl_assert(list_get_prev(&c) == &b); cl_assert(list_get_next(&c) == NULL); } void test_list__count(void) { ListNode a = LIST_NODE_NULL, b = LIST_NODE_NULL, c = LIST_NODE_NULL; ...
{ bar[i].value = i * 2; }
// Wrap around once, find nothing and return NULL: cl_assert(list_find_next(&bar[3].list_node, (bool(*)(ListNode*, void*))is_odd, true, NULL) == NULL); cl_assert(list_find_prev(&bar[3].list_node, (bool(*)(ListNode*, void*))is_odd, true, NULL) == NULL); // Test NULL starting node: cl_assert(list_find_next(NU...
a_len = sizeof(s_send_text_prefs); cl_assert_equal_i( watch_app_prefs_db_insert(SEND_TEXT_KEY, SEND_TEXT_KEY_LEN, s_send_text_prefs, data_len), S_SUCCESS); cl_assert_equal_i(watch_app_prefs_db_get_len(SEND_TEXT_KEY, SEND_TEXT_KEY_LEN), data_len); // Make sure we get back the correct data uint8_t s...
cl_assert_equal_m(s_send_text_prefs, send_text_prefs_out, data_len)
; task_free(send_text_prefs_out); } void test_watch_app_prefs_db__get_weather(void) { const int data_len = sizeof(s_weather_prefs); cl_assert_equal_i(watch_app_prefs_db_insert(WEATHER_KEY, WEATHER_KEY_LEN, s_weather_prefs, data_len), S_SUCCESS); cl_assert_equal_i(...
context, color); #if PBL_COLOR cl_assert_equal_i(context.draw_state.text_color.argb, GColorYellow.argb); #else cl_assert_equal_i(context.draw_state.text_color.argb, GColorWhite.argb); #endif color.a = 1; graphics_context_set_text_color(&context, color); cl_assert_equal_i(context.draw_state.text_color.argb, G...
(&context, false, 2, GColorBlack, GColorBlack, false)
; graphics_draw_circle(&context, GPoint(50, 50), 10); ASSERT_CALLED(graphics_circle_draw_stroked_non_aa(&context, GPoint(50, 50), 10, 2)); setup_test(&context, false, 2, GColorBlack, GColorBlack, false); graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4); ASSERT_CALLED(prv_draw_round_rect_stroked(...
/* * 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...
settings_file_exists(file, key, key_len)
) { const uint8_t key_crc8 = crc8_calculate_bytes(key, key_len, false); memcpy(val_out, s_settings_file.values[key_crc8], val_out_len); return S_SUCCESS; } memset(val_out, 0, val_out_len); return E_DOES_NOT_EXIST; } status_t settings_file_set(SettingsFile *file, const void *key, size_t key_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...
{ c = ' '; }
*buffer++ = c; } *buffer = '\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...
(s_data.app.peek_layer.hidden_fields_timer)
; window_set_on_screen(window, true, true); window_render(window, fake_graphics_context_get_context()); } // Tests ////////////////////// void test_timeline_no_events__future(void) { prv_create_no_events_and_render(false /* past */); FAKE_GRAPHICS_CONTEXT_CHECK_DEST_BITMAP_FILE(); } void test_timeline_no_ev...
/* * 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...
{ timeline_id &= ~SYSTEM_RESOURCE_FLAG; if (timeline_id >= NUM_TIMELINE_RESOURCES) { return RESOURCE_ID_INVALID; } return g_timeline_resources[timeline_id][size]; }
static bool prv_get_sys_resource(TimelineResourceId timeline_id, TimelineResourceSize size, AppResourceInfo *res_info) { const uint32_t res_id = prv_get_sys_resource_id(timeline_id, size); const bool success = (res_id != RESOURCE_ID_INVALID); if (success && res_info) { *res...
hich can be batched). If there are no //! subscribers, chooses the lowest power configuration settings static void prv_update_driver_config(void) { // TODO: Add low power support uint32_t lowest_interval_us; uint32_t max_n_samples; uint32_t max_batch = prv_get_sample_interval_info(&lowest_interval_us, &max_n_sa...
if (state->num_samples == 0) { state->timestamp_ms = s_last_empty_timestamp_ms + data.timestamp_delta_ms; } memcpy(state->raw_buffer + state->num_samples, &data, sizeof(AccelRawData)); state->num_samples++; samples_drained++; } // If buffer is full, notif...
d_listener(jerry_value_t event_listeners, uint32_t idx, jerry_value_t listener, void *data) { ListenerQueryData *query_data = data; if (query_data->listener == listener) { query_data->found = true; return false; } return true; } static bool prv_listener_is_registered(const char *...
(event_name, func)
; if (is_relevant) { break; } } } if (!is_relevant) { APP_LOG(LOG_LEVEL_WARNING, "Unknown event '%s'", event_name); return jerry_create_undefined(); } prv_add_event_listener_to_list((char *)event_name, func); return jerry_create_undefined(); } JERRY_FUNCTION(prv_remove_even...
ling: s_ready_to_install[request->type - 1].type = 0; // >>> Fall-through! <<< default: { storage_info = kernel_malloc_check(sizeof(PutBytesStorageInfo)); storage_info->index = request->index; } } const bool success = pb_storage_init(&s_pb_state.storage, s_pb_state.type, s_pb_state....
(s_pb_semaphore)
; return true; } static void prv_do_commit(void) { uint32_t elapsed_time_ms = ticks_to_milliseconds(rtc_get_ticks() - s_pb_state.start_ticks); const CommitRequest *request = (const CommitRequest *)s_pb_state.receiver.buffer; uint32_t crc = ntohl(request->crc); uint32_t calculated_crc = pb_storage_calculat...
/* * 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_LOG_LEVEL_INFO, "Read Descriptor %s, %u bytes, error: %u", uuid_buffer, value_length, error)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ const uint32_t NT_GNU_BUILD_ID = 3; const char *expected_name = "GNU"; const uint32_t expected_name_length = strlen(expected_name) + 1; return note->type == NT_GNU_BUILD_ID && note->name_length == expected_name_length && note->data_length == BUILD_ID_EXPECTED_LEN && (strncmp((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...
cl_assert(length <= BUFFER_SIZE)
; memcpy(s_app_message_pp_buffer, data, length); s_app_message_pp_received_length = length; } static void prv_protocol_msg_callback(CommSession *session, const uint8_t* data, size_t length) { app_message_app_protocol_msg_callback(session, data, length, NULL); } void app_mes...
/* * 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_must_pass(settings_file_open(file, SETTINGS_FILE_NAME, SETTINGS_FILE_SIZE))
aw_bytes_v1, buffer, expected_size); task_free(buffer); } void test_rocky_api_app_message__postmessage_just_before_connected(void) { prv_init_api(false /* start_connected */); EXECUTE_SCRIPT("var x = " SIMPLE_TEST_OBJECT ";" "var hasError = false;" "_rocky.on('postmessageerror...
MIN(TINY_CHUNK_SIZE, json_bytes_remaining)
; const size_t expected_size = sizeof(PostMessageChunkPayload) + json_bytes_size; const int payload_offset = expected_json_size - json_bytes_remaining; PostMessageChunkPayload *chunk = (PostMessageChunkPayload *)buffer; *chunk = (PostMessageChunkPayload) { .offset_bytes = payload_offset, .c...
0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the Lic...
cl_assert_equal_i(end.mday, 1)
; cl_assert_equal_i(end.hour, 2); } void test_timezone_database__kazakhstan(void) { { const int almaty_region = FIND_REGION("Asia/Almaty"); TimezoneInfo tz_info; bool result = timezone_database_load_region_info(almaty_region, &tz_info); cl_assert(result); cl_assert_equal_i(tz_info.dst_id, 0);...
loseReason_UnderlyingDisconnection); comm_session_close(modern_app_session, CommSessionCloseReason_UnderlyingDisconnection); } void test_session__assert_if_deinit_and_transport_did_not_clean_up_properly(void) { Transport *transport = (Transport *) TransportID1; CommSession *session = comm_session_open(transport,...
(transport, &transport_imp, TransportDestinationSystem)
ke sure they stick height_mm += 10; weight_dag += 11; gender = ActivityGenderOther; age_years += 10; activity_prefs_set_height_mm(height_mm); activity_prefs_set_weight_dag(weight_dag); activity_prefs_set_gender(gender); activity_prefs_set_age_years(age_years); // Re-init prv_activity_init_and_set_e...
(&new_activity)
; // Wait long enough for our midnight rollover to occur. We init time at 5pm, so we need to wait // for at least 7 hours. const int minutes_till_midnight = (7 * MINUTES_PER_HOUR) - ACTIVITY_SESSION_UPDATE_MIN - 3; prv_feed_cannned_accel_data(SECONDS_PER_MINUTE * (minutes_till_midnight + 1), 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...
{ va_list fmt_args; va_start(fmt_args, message); handle_passert_failed_vargs(filename, line_number, (uintptr_t)__builtin_return_address(0), "ASSERT", message, fmt_args); va_end(fmt_args); }
void passert_failed_no_message(const char* filename, int line_number) { handle_passert_failed(filename, line_number, (uintptr_t)__builtin_return_address(0), "ASSERTN", NULL); } void wtf(void) { uintptr_t saved_lr = (uintptr_t) __builtin_return_address(0); dbgserial_print("*** WTF "); dbgserial_print_hex(...
_corner_width(int row_index, int num_rows) { if (row_index >= num_rows) { return 0; } if (row_index < (int)ARRAY_LENGTH(s_rounded_corner_width)) { return s_rounded_corner_width[row_index]; } else if (num_rows - row_index - 1 < (int)ARRAY_LENGTH(s_rounded_corner_width)) { return s_rounded_corner_widt...
// Set the remaining pixels to black. const int bottom_bezel_length = (uintptr_t)&s_framebuffer.buffer[DISP_ROWS * DISP_COLS] - (uintptr_t)dst; memset(dst, GColorBlack.argb, bottom_bezel_length); }
if (s_state == CompositorState_AppAndModal) { compositor_render_modal(); } PROFILER_NODE_STOP(compositor); framebuffer_dirty_all(&s_framebuffer); } void compositor_render_modal(void) { GContext *ctx = kernel_ui_get_graphics_context(); // We make this GDrawState static to save stack space, thus th...
DAYS_PER_WEEK, health_data->step_data); // Update distance / calories now that we have our steps health_data_update_step_derived_metrics(health_data); // Get the step averages for each 15 minute window. Used for typical steps activity_get_step_averages(local_tm.tm_wd...
(ActivityMetricHeartRateZone3Minutes, 1, &health_data->hr_zone3_minutes)
; } int32_t *health_data_steps_get(HealthData *health_data) { return health_data->step_data; } int32_t health_data_current_steps_get(HealthData *health_data) { return health_data->step_data[0]; } int32_t health_data_current_distance_meters_get(HealthData *health_data) { return health_data->current_distance_met...
/* * 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...
(emx_resources_get_size(1, id_2) == 0)
; buf = 0; ASSERT(emx_resources_read(1, id_2, 0, (uint8_t *)&buf, 1) == 0); ASSERT(buf == 0); // verify 1 & 3 are OK buf = 0; ASSERT(emx_resources_read(1, id_3, 0, (uint8_t *)&buf, 1) == 4); ASSERT(buf == 3); ASSERT(s_read_3_called == 2); buf = 0; ASSERT(emx_resources_read(1, id_1, 0, (uint8_t *)&bu...
s = actions, } }; Uuid i2; uuid_generate(&i2); TimelineItem e2 = { .header = { .id = i2, .type = TimelineItemTypeNotification, .status = 0, .ancs_uid = 0, .layout = LayoutIdGeneric, .timestamp = 0x53f0dda6, }, .attr_list = { .num_attributes = 2, ....
(notification_storage_get(&uuids[0], &r))
; e.header.id = uuids[0]; e.header.timestamp = timestamp; compare_notifications(&e, &r); free(r.allocated_buffer); cl_assert(notification_storage_get(&uuids[i - 1], &r)); e.header.id = uuids[i - 1]; e.header.timestamp = timestamp + i - 1; compare_notifications(&e, &r); free(r.allocated_buffer); //...
ansform.h" #include "util/trig.h" #include "util/math_fixed.h" #include "clar.h" #include <stdio.h> #include <string.h> // Helper Functions //////////////////////////////////// // Stubs //////////////////////////////////// #include "stubs_app_state.h" #include "stubs_applib_resource.h" #include "stubs_compiled_wit...
(gtransform_is_identity(&t_c))
; // Test Scale Matrix t = GTransformScale(GTransformNumberFromNumber(2), GTransformNumberFromNumber(5)); t_c = GTransformFromNumbers(2, 0, 0, 5, 0, 0); cl_assert(gtransform_is_equal(&t, &t_c)); cl_assert(gtransform_is_only_scale(&t)); cl_assert(gtransform_is_only_scale(&t_c)); t_c = GTransformScaleFro...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
bt_ctl_set_airplane_mode_async(!airplane_mode)
; data->toggle_state = airplane_mode ? ToggleStateEnablingBluetooth : ToggleStateDisablingBluetooth; settings_menu_mark_dirty(SettingsMenuItemBluetooth); } bool is_remote_connected(StoredRemote* remote) { switch (remote->type) { case StoredRemoteTypeBTClassic: return remote->classic.connected; ...
/* * 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 desc->description_length == sizeof(FirmwareDescription); }
_buffer, "", number_buffer_size); } else { prv_copy_time_string_timestamp(number_buffer, number_buffer_size, word_buffer, word_buffer_size, timestamp); } } } // number: 10 // word: min to void clock_get_event_relative_time_string(char *number_buffer, int number_buffer_size, char *word_buffe...
snprintf(region_name, buffer_size, "UTC%+d%s", hour_offset, min_buf)
; } } else { strncpy(region_name, "---", buffer_size); } } int16_t clock_get_timezone_region_id(void) { return rtc_get_timezone_id(); } void clock_set_timezone_by_region_id(uint16_t region_id) { TimezoneInfo tz_info; prv_clock_get_timezone_info_from_region_id(region_id, rtc_get_time(), &tz_info); ...
} } }; static TimelineItem title_item2 = { .header = { .id = {0xac, 0x65, 0x2e, 0xb9, 0x26, 0xd6, 0x44, 0x2c, 0x98, 0x68, 0xa4, 0x36, 0x79, 0x7d, 0xe2, 0x05}, .timestamp = 1, .duration = 0, .type = TimelineItemTypeReminder, .layout = LayoutIdTest, }, .attr_list = (AttributeList...
(reminder_db_get_len((uint8_t *) &item4, sizeof(Uuid)) == 0)
; memset(&temp, 0, sizeof(TimelineItem)); cl_assert(S_SUCCESS == reminder_db_next_item_header(&temp)); temp.attr_list.attributes = NULL; cl_assert(memcmp(&item3, &temp, sizeof(TimelineItem)) == 0); cl_assert(S_SUCCESS == reminder_db_delete_item(&temp.header.id, true /* send_event */)); cl_asser...
es/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations ...
(result == DICT_OK)
; result = dict_write_data(&iter, SOME_DATA_KEY, SOME_DATA, sizeof(SOME_DATA)); cl_assert(result == DICT_OK); result = dict_write_cstring(&iter, SOME_STRING_KEY, SOME_STRING); cl_assert(result == DICT_OK); result = dict_write_uint8(&iter, SOME_UINT8_KEY, 8); cl_assert(result == DICT_OK); result = dict_wr...
8, 32, -1000}, { 48, 24, -1000}, { 48, 32, -1000}, { 48, 32, -1000}, { 48, 24, -1000}, { 56, 32, -1000}, { 48, 24, -1008}, { 48, 24, -1000}, { 48, 24, -992}, { 48, 24, -1000}, { 56, 24, -1000}, { 48, 24, -1000}, { 56, 24, -1000}, { 48, 24, -1000}, { 48, 32, -1000}...
{ 56, 24, -1000}, { 56, 24, -1000}, { 48, 32, -992}, { 56, 16, -1008}, { 48, 32, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 32, -1000}, { 48, 24, -992}, { 56, 24, -1000}, { 56, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, ...
{ 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 56, 24, -992}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 56, 24, -992}, { 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...
{ periph_config_enable(BOARD_CONFIG_DISPLAY.spi, BOARD_CONFIG_DISPLAY.spi_clk); power_tracking_start(PowerSystemMcuSpi2); }
static void prv_disable_display_spi_clock() { periph_config_disable(BOARD_CONFIG_DISPLAY.spi, BOARD_CONFIG_DISPLAY.spi_clk); power_tracking_stop(PowerSystemMcuSpi2); } static void prv_enable_chip_select(void) { gpio_output_set(&BOARD_CONFIG_DISPLAY.cs, true); // setup time > 3us // this produces a setup ti...
_stop_tracking_early(); } mutex_unlock_recursive(s_activity_state.mutex); return system_task_add_callback(prv_stop_tracking_cb, NULL); } // ------------------------------------------------------------------------------------------------ bool activity_tracking_on(void) { bool result; mutex_lock_recursive(s_a...
(bool, sys_activity_get_minute_history, HealthMinuteData *minute_data, uint32_t *num_records, time_t *utc_start)
{ if (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(utc_start, sizeof(*utc_start)); syscall_assert_userspace_buffer(num_records, sizeof(*num_records)); syscall_assert_userspace_buffer(minute_data, *num_records * sizeof(HealthMinuteData)); } return activity_get_minute_history(minute_data,...