prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
* http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language gover...
cl_assert_equal_i(watch_app_prefs_db_insert(SEND_TEXT_KEY, SEND_TEXT_KEY_LEN, s_send_text_prefs, (data_len - sizeof(SerializedSendTextContact))), E_INVALID_ARGUMENT)
; // Make sure we reject keys we don't recognize cl_assert_equal_i(watch_app_prefs_db_insert(INVALID_KEY, INVALID_KEY_LEN, s_send_text_prefs, data_len), E_INVALID_ARGUMENT); } void test_watch_app_prefs_db__insert_weather(void) { const int data_len = sizeof(s_weather_prefs); cl_assert_equal_i( wat...
/* * 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 false; }
; if (!layer_process_tree_level(node->first_child, ctx, iterator_func)) { return false; }; node = node->next_sibling; } return true; } void layer_process_tree(Layer *node, void *ctx, LayerIteratorFunc iterator_func) { layer_process_tree_level(node, ctx, iterator_func); } inline static Layer _...
cl_assert_equal_b(bonding_sync_contains_pairing_info(&pairing_3, false), false); } void test_bluetooth_persistent_storage_prf__get_ble_by_address(void) { bool ret; // Output variables SMIdentityResolvingKey irk_out; // Store a pairing SMPairingInfo pairing = (SMPairingInfo) { .irk = (SMIdentityResolv...
(id_1 != BT_BONDING_ID_INVALID)
; // Read it back ret = bt_persistent_storage_get_bt_classic_pairing_by_id(id_1, &addr_out, &link_key_out, name_out, &platform_bits_out); cl_assert(ret); cl_assert_equal_m(&addr_1, &addr_out, sizeof(addr_out)); cl_assert_equal_m(&link_key_1, &link_key_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...
text_layer_set_background_color(text, GColorBlack)
; text_layer_set_text_color(text, GColorWhite); } } static void raw_click_handler(ClickRecognizerRef recognizer, Window *window, const bool up) { ClickAppData *data = window_get_user_data(window); sniprintf(data->text_buffer, TEXT_BUFFER_SIZE, up ? "Raw UP" : "Raw DOWN"); if (up) { // PBL_LOG requires a f...
aphics_context_set_fill_color(ctx, GColorDarkGray); graphics_fill_circle(ctx, pos, dot_radius); } } #endif static void prv_draw_goal_line(GContext *ctx, int32_t current_progress, int32_t total_progress, int32_t line_length, int32_t line_width, GRect frame, GColor color) { const G...
string_strip_leading_whitespace(time_buffer)
, time_font, GColorWhite, container); if (!clock_is_24h_style()) { /// AM/PM for the current time strftime(am_pm_buffer, sizeof(am_pm_buffer), "%p", pbl_override_localtime(&now)); health_util_create_text_node_with_text( am_pm_buffer, am_pm_font, GColorWhite, container); } #if PBL_BW bo...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_i(0, gbitmap_get_data_row_info(&bmp, 3).min_x)
; cl_assert_equal_i(3, gbitmap_get_data_row_info(&bmp, 3).max_x); } void test_gbitmap_data_row_info__get_info_circular(void) { uint8_t some_addr; GBitmapDataRowInfoInternal infos[] = { {.offset = 1, .min_x = 2, .max_x = 3}, // 0 {.offset = 4, .min_x = 5, .max_x = 6}, // 1 {.offset = 7, ....
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (rv) { return rv; }
n prv_fake_receiving_ns_notification(sizeof(ns_notification), (uint8_t*) &ns_notification); cl_assert_equal_i(fake_kernel_services_notifications_acted_upon_count(), 0); // DIS service / iOS 9+ detected - enabling notification dismissal ancs_handle_ios9_or_newer_detected(); prv_fake_receiving_ns_notification(...
((uint8_t *)&s_complete_dict)
; cl_assert_equal_i(s_num_requested_notif_attributes, 2); cl_assert_equal_i(s_num_ds_notifications_received, 2); cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 1); } void test_ancs__get_notif_attributes_retry(void) { s_gatt_client_op_write_should_fail_once = true; prv_send_...
AlignCenter, false); static const int16_t UNFOLD_BOUNCE_AMOUNT = 10; static const int16_t UNFOLD_EXPAND_AMOUNT = 5; int16_t dot_size = data->mic_window.mic_dot_radius * 2; GRect icon_from = { .size = { dot_size, dot_size }, }; grect_align(&icon_from, &icon_frame, GAlignCenter, false); const bool ta...
applib_free(voice_window)
; } DictationSessionStatus voice_window_push(VoiceWindow *voice_window) { if (!connection_service_peek_pebble_app_connection()) { if (voice_window->show_error_dialog) { prv_push_bt_dialog(voice_window); // we return success because the user could reconnect the phone and watch and resume the UI ...
dex == SelectIndexOverflow) { data->word_wrap = !(data->word_wrap); } } text_layer_set_text_color(&data->direction_layer, GColorBlack); text_layer_set_background_color(&data->direction_layer, GColorWhite); text_layer_set_text_color(&data->word_wrap_layer, GColorBlack); text_layer_set_background_col...
(&window->layer, update_window)
; } static void push_window(struct AppState *data) { Window* window = &data->window; window_init(window, WINDOW_NAME("Text Clipping")); window_set_user_data(window, data); window_set_click_config_provider(window, (ClickConfigProvider) config_provider); window_set_window_handlers(window, &(WindowHandlers) { ...
eep(4); } // Minimum thresholds for axis delta in mgs at 4G scale static const uint16_t SELFTEST_THRESHOLDS[] = { [BMA255Axis_X] = 800, [BMA255Axis_Y] = 800, [BMA255Axis_Z] = 400, }; static const char AXIS_NAMES[] = { [BMA255Axis_X] = 'X', [BMA255Axis_Y] = 'Y', [BMA255Axis_Z] = 'Z', }; static const uint8...
(BMA255Register_INT_STATUS_0)
; const uint8_t int_status_1 = bma255_read_register(BMA255Register_INT_STATUS_1); const uint8_t int_status_2 = bma255_read_register(BMA255Register_INT_STATUS_2); const uint8_t int_status_3 = bma255_read_register(BMA255Register_INT_STATUS_3); char buf[64]; prompt_send_response_fmt(buf, 64, "(0x10) Bandwidth: ...
_STRING) + 1); cl_assert(strcmp(old_tuple->value->cstring, SOME_STRING) == 0); break; case SOME_DATA_KEY: is_data_updated = true; cl_assert(new_tuple->type == TUPLE_BYTE_ARRAY); cl_assert(new_tuple->length == sizeof(SOME_DATA)); cl_assert(old_tuple->type == TUPLE_BYTE_ARRAY); ...
cl_assert(has_tuple[INT8_IDX] == false)
; } else { cl_assert(has_tuple[INT8_IDX] == true); } cl_assert(has_tuple[STRING_IDX] == true); cl_assert(has_tuple[DATA_IDX] == 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...
{ cl_assert(gcolor_equal__deprecated(GColorBlue, GColorBlue)); cl_assert(gcolor_equal__deprecated(GColorRed, GColorRed)); cl_assert(!gcolor_equal__deprecated(GColorRed, GColorBlue)); // Check the behavior of the deprecated function (which is incorrect) that two colors with // zero alpha values but different ...
void test_graphics_colors__inverted_readable_color(void) { GColor8 (*fun)(GColor8) = gcolor_legible_over; // transparent colors result in transparen - who has a better idea? cl_assert_equal_i(GColorClearARGB8, fun(GColorClear).argb); // // obvious cases cl_assert_equal_i(GColorWhiteARGB8, fun(GColorBlack)....
tions under the License. */ #include "timezone_database.h" #include "resource/resource.h" #include "resource/resource_ids.auto.h" #include "services/common/clock.h" #include "system/passert.h" #include <util/attributes.h> #include <util/size.h> #include <string.h> // The format of the database is as follows // He...
prv_database_read(region_offset + 1 + TIMEZONE_CITY_LENGTH, &tz_data, sizeof(tz_data))
) { *tz_info = (TimezoneInfo) { .dst_id = 0 }; return false; } *tz_info = (TimezoneInfo) { .dst_id = tz_data.dst_id, .timezone_id = region_id, .tm_gmtoff = tz_data.gmt_offset_minutes * SECONDS_PER_MINUTE, // Leave the dst_start and dst_end timestamps uninitialized .dst_start = 0, .d...
-832}, { 64, 560, -832}, // 83 seconds { 72, 552, -824}, { 64, 544, -832}, { 64, 560, -832}, { 72, 560, -832}, { 72, 552, -832}, { 64, 544, -832}, { 72, 552, -832}, { 72, 560, -832}, { 72, 552, -832}, { 64, 552, -832}, { 64, 552, -824}, { 64, 552, -832}, { 64,...
{ 48, 600, -792}, { 48, 592, -800}, { 56, 600, -800}, { 56, 592, -800}, { 56, 600, -792}, { 56, 592, -808}, // 89 seconds { 56, 592, -800}, { 48, 592, -800}, { 48, 592, -792}, { 56, 600, -800}, { 56, 592, -792}, { 56, 600, -800}, { 56, 592, -800}, { 56, 592, -...
{ -296, 760, -632}, { -272, 600, -520}, { -272, 536, -320}, { -56, 680, -112}, { 72, 952, 80}, { 168, 960, 344}, { 208, 960, 456}, { 136, 1024, 384}, { 48, 968, 328}, { -88, 824, 64}, { -16, 880, 152}, // 92 seconds { -80, 1016, 288}, { -144, 960, 312}, { -17...
//! Tests if an entry with the given AppInstallId is in the cache bool app_cache_entry_exists(AppInstallId app_id) { bool exists = false; mutex_lock_recursive(s_app_cache_mutex); { SettingsFile file; status_t rv = settings_file_open(&file, APP_CACHE_FILE_NAME, APP_CACHE_MAX_SIZE); if (rv != S_SUCCESS...
{ SettingsFile file; status_t rv = settings_file_open(&file, APP_CACHE_FILE_NAME, APP_CACHE_MAX_SIZE); if (rv != S_SUCCESS) { goto unlock; } // set max so that any application will have a lower priority. AppCacheEachData to_evict = { .id = INSTALL_ID_INVALID, .priority = MAX_P...
unlock: mutex_unlock_recursive(s_app_cache_mutex); return ret_value; }
_t start_ms = prv_now_ms(); prv_advance_to_ms_with_timers(start_ms + duration_a + 2 * MIN_FRAME_INTERVAL_MS); // Should not have run at all cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 0); cl_assert_equa...
prv_count_handler_entries(&s_started_handler_calls, seq)
, 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, seq), 0); // Complete A and start B prv_advance_to_ms_with_timers(start_ms + duration_a + 2 * MIN_FRAME_INTERVAL_MS + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_hand...
me_t time_get_dst_end(void) { return s_dst_end; } DEFINE_SYSCALL(time_t, sys_time_utc_to_local, time_t t) { return time_utc_to_local(t); } time_t time_utc_to_local(time_t utc_time) { utc_time += time_get_isdst(utc_time) ? s_dst_adjust : 0; utc_time += s_timezone_gmtoffset; return utc_time; } time_t time_lo...
{ return is24h ? hours : (hours + 12 - 1) % 12 + 1; }
int time_util_get_seconds_until_daily_time(struct tm *time, int hour, int minute) { int hour_diff = hour - time->tm_hour; if (hour < time->tm_hour || (hour == time->tm_hour && minute <= time->tm_min)) { // It's past the mark, skip to tomorrow. hour_diff += HOURS_PER_DAY; } int minutes_diff = (hour_d...
| (new_state == RecognizerState_Completed) || (new_state == RecognizerState_Updated)); break; case RecognizerState_Cancelled: case RecognizerState_Completed: case RecognizerState_Failed: PBL_ASSERTN(new_state == RecognizerState_Possible); break; de...
{ PBL_ASSERTN(recognizer && recognizer->impl); recognizer_cancel(recognizer); recognizer->impl->reset(recognizer); prv_set_state(recognizer, RecognizerState_Possible); recognizer->flags = 0; }
void recognizer_cancel(Recognizer *recognizer) { PBL_ASSERTN(recognizer && recognizer->impl); if (!recognizer_is_active(recognizer)) { return; } if (recognizer->state == RecognizerState_Possible) { // Nothing to cancel return; } if (recognizer->impl->cancel(recognizer)) { recognizer->sub...
); if (r == 0 || strncmp(buf, "49", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"S\": %s", buf); } r = strftime(buf, buf_size, "%T", &good_data); if (r == 0 || strncmp(buf, "11:04:49", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"T\": %s", buf); } r = strftime(buf, ...
text_layer_create(GRect(0, 0, 144, 168))
/* * 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...
{ AppData *data = window_get_user_data(window); SimpleMenuLayer *menu = &data->menu; simple_menu_layer_init(menu, &(GRect){{0, 0}, window->layer.frame.size}, window, s_menu_sections, ARRAY_LENGTH(s_menu_sections), data); layer_add_child(&window->layer, simple_menu_layer_get_layer(menu)...
static void handle_init(void) { AppData *data = app_malloc_check(sizeof(AppData)); app_state_set_user_data(data); Window *window = &data->window; window_init(window, WINDOW_NAME("Simple Menu Demo")); window_set_user_data(window, data); window_set_window_handlers(window, &(WindowHandlers) { .load = p...
/* * 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...
{ dbgserial_putstr("itoa buffer too small"); return; }
592, -80, -184}, { 760, -144, -304}, { 976, -144, -344}, { 976, -112, -384}, { 1096, -40, -328}, { 992, -56, -320}, { 888, -104, -320}, { 904, -304, -336}, { 952, -368, -360}, { 1136, -544, -320}, { 968, -320, -376}, { 896, -424, -408}, { 856, -432, -472}, { 904, -36...
{ 1392, 80, -104}, { 1376, 32, -8}, { 1224, 8, 0}, { 1120, -40, -8}, { 1088, -40, 8}, // 29 seconds { 1024, -40, 8}, { 920, -40, -32}, { 920, -40, -88}, { 816, -48, -96}, { 808, -80, -120}, { 880, -80, -144}, { 928, -104, -168}, { 968, -112, -128}, { 1280, -10...
{ 1016, 32, 88}, { 984, 32, 120}, { 992, 40, 128}, { 1168, 64, 144}, { 1144, 96, 112}, { 984, 112, 72}, { 1064, 152, 120}, { 1096, 200, 224}, { 1128, 168, 296}, { 1136, 160, 280}, { 1112, 184, 176}, { 1128, 256, 112}, // 32 seconds { 1112, 248, 104}, { 1128, ...
(uint32_t resource_id) { ResAppNum app_num = sys_get_current_resource_num(); return gbitmap_sequence_create_with_resource_system(app_num, resource_id); } GBitmapSequence *gbitmap_sequence_create_with_resource_system(ResAppNum app_num, uint32_t resource_...
bitset8_update(row_data, x, pixel_is_white)
; } } else if ((bitmap_format == GBitmapFormat8Bit) || (bitmap_format == GBitmapFormat8BitCircular)) { GColor8 *const destination_pixel = (GColor8 *)(row_data + x); *destination_pixel = color; } else { WTF; // Unsupported destination type } } bool gbitmap_sequence_update_bitmap_next_...
ll_prefs_set_clock_24h_style(bool is24h) { prv_pref_set(PREF_KEY_CLOCK_24H, &is24h, sizeof(is24h)); } bool shell_prefs_is_timezone_source_manual(void) { return s_clock_timezone_source_is_manual; } void shell_prefs_set_timezone_source_manual(bool manual) { prv_pref_set(PREF_KEY_CLOCK_TIMEZONE_SOURCE_IS_MANUAL, &...
app_install_get_uuid_for_install_id(app_id, &pref.uuid)
; const char *key = NULL; switch (button) { case BUTTON_ID_UP: key = PREF_KEY_QUICK_LAUNCH_UP; break; case BUTTON_ID_DOWN: key = PREF_KEY_QUICK_LAUNCH_DOWN; break; case BUTTON_ID_SELECT: key = PREF_KEY_QUICK_LAUNCH_SELECT; break; case BUTTON_ID_BACK: key = ...
(0, 3), 148); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 5), 0); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 7), 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 9), 2); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 11), 3); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0...
GPoint(0, 1)
ctx->touch_queue.count++; } else { // overwrite the last event queue_idx = prv_get_idx_last_item(ctx); if (!pos) { diff_pos = ctx->touch_queue.events[queue_idx].diff_pos; } } TouchEvent *event = &ctx->touch_queue.events[queue_idx]; *event = (TouchEvent) { .index = touch_idx, .typ...
ARRAY_LENGTH(s_touch_ctx)
AR_FIXTURE_PATH, APP_REGISTRY_FIXTURE_PATH, name); // Check that file exists and fits in buffer struct stat st; cl_assert(stat(res_path, &st) == 0); FILE *file = fopen(res_path, "r"); cl_assert(file); uint8_t buf[st.st_size]; // copy file to fake flash storage cl_assert(fread(buf, 1, st.st_size, file)...
cl_assert_equal_i(-3, music_id)
; cl_assert_equal_i(-53, sports_id); // load system resources load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false); load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, true); resource_init(); // simulate installing bg_counter on fla...
/www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissio...
((char *)val, 7, "val%03d", i)
; printf("Iteration %d val %s\n", i, val); set_and_verify(&file, key, key_len, val, val_len); } settings_file_close(&file); cl_must_pass(settings_file_open(&file, "test_file_set_get_one_many_times", 4096)); printf("Making sure we still get the right value after closing & reopening the file...\n"); ...
ting, 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 "pebble_asserts.h" #in...
(basic_cell_height, l.selection.y)
; cl_assert_equal_i(-basic_cell_height, scroll_layer_get_content_offset(&l.scroll_layer).y); } void test_menu_layer__test_set_selected_center_focused(void) { MenuLayer l; const int height = 180; menu_layer_init(&l, &GRect(10, 10, height, 180)); menu_layer_set_center_focused(&l, true); m...
.layout = LayoutIdGeneric, .timestamp = 0x53f0dda6, }, .attr_list = { .num_attributes = 2, .attributes = attributes, }, .action_group = { .num_actions = 1, .actions = &actions[2], } }; Uuid i3; uuid_generate(&i3); TimelineItem e3 = { .header = { .id...
(&uuids[i % count], &r)
); compare_notifications(&e, &r); free(r.allocated_buffer); } //Check that no notifications have been deleted e.header.id = uuids[j]; e.header.timestamp = timestamp + j; cl_assert(notification_storage_get(&uuids[j], &r)); compare_notifications(&e, &r); free(r.allocated_buffer); //Free up enoug...
/* * 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...
{ next_state = RuninStateRunning; }
break; case RuninStateRunning: if (!data->countdown_running) { data->countdown_running = true; } if (!usb_is_connected) { data->pass_count = 0; next_state = RuninStatePlugCharger; break; } if (charge_percent > SLOW_THRESHOLD_PERCENTAGE && data->fa...
/* * 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_DEBUG, "Error with \"A\": %s", buf)
; } r = strftime(buf, buf_size, "%b", &good_data); if (r == 0 || strncmp(buf, "May", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"b\": %s", buf); } r = strftime(buf, buf_size, "%B", &good_data); if (r == 0 || strncmp(buf, "May", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "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...
prv_find_combo_timer()
; cl_assert(timer); cl_assert_equal_i(stub_new_timer_timeout(timer->id), 5000); // Pretend 5000ms have elapsed stub_new_timer_fire(timer->id); // We now should be in mfg mode cl_assert(s_mfg_mode_entered); } void test_getting_started_button_combo__push_and_release_other_button(void) { // Up (nothing) -...
a, 0x1f, 0x05, 0x0a, 0x0f, 0x0b, 0x1b, 0x06, 0x07, 0x2b, 0x16, 0x17, 0x01, 0x02, 0x03, 0x13, 0x27, 0x12, 0x23, 0x3b, 0x26, 0x37, 0x11, 0x22, 0x33, 0x32, 0x36, 0x21, 0x31, }; typedef enum { PROPERTY_FG_COLOR, PROPERTY_BG_COLOR, PROPERTY_ALPHA, // Add more...
graphics_draw_pixel(ctx, GPoint(point.x + 1, point.y))
; graphics_draw_pixel(ctx, GPoint(point.x, point.y + 1)); graphics_draw_pixel(ctx, GPoint(point.x + 1, point.y + 1)); } else if (alpha == ALPHA_66) { graphics_context_set_stroke_color(ctx, fg_color); graphics_draw_pixel(ctx, point); graphics_draw_pixel(ctx, GPoint(point.x + 1, point.y + 1)); g...
lse, false, false, 0x0 }, { true, true, false, false, 0x1 }, { true, true, true, false, 0x2 }, { true, true, true, true, 0x3 }, { true, false, false, false, 0x5 }, { true, false, true, false, 0x6 }, { true, false, true, false, 0x7 } // Both 0x6 and 0x7 map to the same permissions. }; static c...
(s_permission_mappings)
; ++i) { if (s_permission_mappings[i].value == access_permissions) { region.priv_read = s_permission_mappings[i].priv_read; region.priv_write = s_permission_mappings[i].priv_write; region.user_read = s_permission_mappings[i].user_read; region.user_write = s_permission_mappings[i].u...
hip) { return from_reel; } GContext *graphics_context_get_current_context(void) { return &s_ctx; } void test_weather_app_layout__initialize(void) { fb = malloc(sizeof(FrameBuffer)); framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); const GContextInitializationMode context_init_mode = GContextInitializ...
gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)
able can be called to reset bus) if (bus->state->user_count == 0) { prv_bus_rail_power_up(bus); } prv_bus_pins_cfg_i2c(bus); i2c_hal_enable(bus); } //! De-initialize and gate the clock to the peripheral //! Power down rail if the bus supports that and no devices are using it //! Always lock the bus and ...
(LOG_LEVEL_DEBUG, "I2C Bus %s recovered", slave->bus->name)
; } else { PBL_LOG(LOG_LEVEL_ERROR, "I2C Bus %s still hung after bitbang reset", slave->bus->name); } prv_bus_pins_cfg_i2c(slave->bus); prv_bus_reset(slave->bus); mutex_unlock(slave->bus->state->bus_mutex); return recovered; } /*--------------------DATA TRANSFER FUNCTIONS--------------------------*/...
/* * 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...
{ // Perform any one-time initialization here that should happen when the main FW boots. bt_lock_init(); hc_protocol_boot(); }
bool bt_driver_start(BTDriverConfig *config) { if (!system_resource_is_valid()) { return false; } // Do stuff that needs to happen when stack starts, i.e. bootstrap, load FW, ... if (!dialog_bootrom_load_second_stage_bootloader()) { // Failed to load BT bootloader. Shutdown if we haven't tried this a...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(EDITED, data->alarm_id, data->callback_context)
; } } static void prv_toggle_smart_alarm_handler(ActionMenu *action_menu, const ActionMenuItem *item, void *context) { AlarmDetailData *data = context; #if CAPABILITY_HAS_HEALTH_TRACKING if (!data->alarm_info.is_smart && !activity_prefs_tracking_is_enabled()) { // ...
raw_vertical_line_dotted(&ctx, GPoint(13, 0), 4); graphics_draw_vertical_line_dotted(&ctx, GPoint(15, 0), 20); graphics_draw_vertical_line_dotted(&ctx, GPoint(17, 0), 21); graphics_draw_vertical_line_dotted(&ctx, GPoint(19, 0), 22); graphics_draw_vertical_line_dotted(&ctx, GPoint(21, 0), MAX_NUM_ROWS - 1); gr...
(&ctx, GPoint(19, 0), 22)
; graphics_draw_vertical_line_dotted(&ctx, GPoint(21, 0), MAX_NUM_ROWS - 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(23, 0), MAX_NUM_ROWS + 1 ); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_vert_dotted_line_odd_offset_odd_cols_no_clip"))); // Test to make sure drawing on ...
indow; window_init(window, WINDOW_NAME("Bluetooth SSP")); window_set_window_handlers(window, &(WindowHandlers) { .load = prv_window_load, .unload = prv_window_unload, }); window_set_user_data(window, data); window_set_overrides_back_button(window, true); modal_window_push(window, ModalPriorityCriti...
(LOG_LEVEL_ERROR, "Got complete event for unknown process %p vs %p", event->ctx, s_data_ptr ? s_data_ptr->ctx : NULL)
; } break; default: WTF; } } //////////////////////////////////////////////////////////////////////////////////////////////////// // BT Driver callback implementations: static void prv_put_pairing_event(const PebbleBluetoothPairEvent *pair_event) { PebbleEvent event = { .type = PEBBLE_B...
the beginning of a cycle, the scheduler decides which job to advertise //! next. It will just round-robin through the jobs to advertise. //! //! Note that only one job is advertising at a time. Even though a job might //! have such a long interval that another job could be squeezed in between, //! clever things like th...
list_remove(&job->node, (ListNode **) &s_jobs, NULL)
; } // Part of CC2564 advertising bug work-around: if (job == s_current) { bt_driver_advert_client_set_cycled(false); } } static bool prv_is_registered_job(const GAPLEAdvertisingJob *job) { if (!job) { return false; } // Search jobs (can't use list_contains(), because circular): ListNode *nod...
r_get_unobstructed_bounds(layer, &unobstructed_bounds); #if UNITTEST unobstructed_bounds.size.h = bounds.size.h - s_unobstructed_area_height; #endif const bool screen_is_obstructed = (unobstructed_bounds.size.h != bounds.size.h); bounds.size.h = unobstructed_bounds.size.h; #if SNOWY_SCREEN_RES const int16_t...
(HealthMetricStepCount, time_start_of_today(), time_start_of_today() + SECONDS_PER_DAY, HealthServiceTimeScopeWeekly)
; } static void prv_update_hrm_bpm(KickstartData *data) { data->current_bpm = health_service_peek_current_value(HealthMetricHeartRateBPM); } static void prv_normalize_data(KickstartData *data) { // If the user's daily avg steps are very low (QA or a brand new pebble user), bump the value // to a slightly more r...
m_session_reset(CommSession *session) { bt_lock(); { if (!comm_session_is_valid(session)) { PBL_LOG(LOG_LEVEL_WARNING, "Already closed!"); goto unlock; } session->transport_imp->reset(session->transport); } unlock: bt_unlock(); } // ------------------------------------------------------...
prv_log_session_event(session, true /* is_open */)
d and also cleanly drive a re-start of the UI to a non-0 percentage if the FW update // is being resumed. Newer implementations should this! (See PBL-42130) static SemaphoreHandle_t s_firmware_update_semaphore; static bool s_is_recovery_fw = false; static FirmwareUpdateStatus s_update_status = FirmwareUpdateStopped; ...
{ return FirmwareUpdateStopped; }
FirmwareUpdateStatus result = s_update_status; if (result != FirmwareUpdateRunning) { prv_initialize_completion_status(event); services_set_runlevel(RunLevel_FirmwareUpdate); modal_manager_pop_all(); static const ProgressUIAppArgs s_update_args = { .progress_source = PROGRESS_UI_SOURCE_FW_...
aw_command_image_clone(image); cl_assert(clone != image); cl_assert_equal_i(gdraw_command_image_get_data_size(clone), size); cl_assert_equal_i(0, memcmp(clone, image, size)); free(clone); free(image); } void test_gdraw_command__draw_image(void) { GDrawCommandImage *image = malloc(sizeof(GDrawCommandImage)...
(processed_command, stroke_processor->stroke_color)
; } void test_gdraw_command__draw_command_list_processed(void) { GDrawCommandList *command_list = prv_create_command_list_3(); GColor stroke_color = GColorTiffanyBlue; SetStrokeColorProcessor stroke_processor = { .processor = { .command = prv_set_stroke_color, }, .stroke_color = stroke_color, ...
ing.h" #include "drivers/flash.h" #include "drivers/rtc.h" #include "drivers/watchdog.h" #include "flash_region/flash_region.h" #include "kernel/pbl_malloc.h" #include "system/logging.h" #include "system/passert.h" #include "kernel/util/sleep.h" #include "util/attributes.h" #include "util/math.h" #include "util/net.h" ...
(s_current_chunk_id)
; format_current_chunk(); } uint32_t flash_logging_log_start(uint8_t msg_length) { make_space_for_log(msg_length); LogHeader log_header = { .log_length = msg_length }; flash_write_bytes((const uint8_t*) &log_header, get_current_address(s_current_chunk, s_current_offset), sizeof(log_header)); s_current_offse...
ad = 0x0B, .page_program = 0x02, .erase_sector_4k = 0x20, .erase_block_64k = 0xD8, .write_enable = 0x06, .write_disable = 0x04, .read_status = 0x05, .read_flag_status = 0x2B, .erase_suspend = 0xB0, .erase_resume = 0x30, .enter_low_power = 0xB9, .exit_low_power = 0xAB, .en...
qspi_flash_erase_suspend(QSPI_FLASH, sector_addr)
; } status_t flash_impl_erase_resume(FlashAddress sector_addr) { qspi_flash_erase_resume(QSPI_FLASH, sector_addr); return S_SUCCESS; } status_t flash_impl_read_sync(void *buffer_ptr, FlashAddress start_addr, size_t buffer_size) { PBL_ASSERT(buffer_size > 0, "flash_impl_read_sync() called with 0 bytes to read");...
G_LEVEL_WARNING, "%d: Invalid page/file header", pg); continue; } // Add a new entry PFSFileListEntry *entry = kernel_malloc_check(sizeof(PFSFileListEntry) + file_hdr.file_namelen + 1); *entry = (PFSFileListEntry) {}; strcpy(entry->name, file_...
(fpc, 0x00, sizeof(FilePageCache) * MAX_PAGE_CACHE_ENTRIES)
; uint16_t virtual_pg = 0; uint16_t curr_page = f->start_page; uint16_t next_page; int cur_idx = 0; FilePageCache curr = { .virtual_pg = 0, .physical_pg = f->start_page, .contiguous_pgs = 0 }; while (get_next_page(curr_page, &next_page) == S_SUCCESS) { if (next_page == (curr_page + 1)) ...
BLECharacteristic characteristic_refs[num_characteristics]; // Test gatt_client_service_get_characteristics(): const uint8_t num_found_characteristics = gatt_client_service_get_characteristics(service_ref, characteristic_refs, num_characteristics); cl_assert_equal_i(num_characterist...
(service_refs[0])
; cl_assert(uuid_equal(&uuid, &bp_service->uuid)); } void test_gatt_client_accessors__get_characteristics_matching_uuids(void) { BTDeviceInternal device = prv_connected_dummy_device(1); // Start discovery: cl_assert_equal_i(gatt_client_discovery_discover_all(&device), BTErrnoOK); prv_mock_put_service_discov...
/* * 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...
(&attr_list)
; uint8_t deserialized_buffer[buffer_size]; AttributeList attr_list_out = {}; attribute_list_init_list(attr_list.num_attributes, &attr_list_out); const uint8_t *buffer = (uint8_t *)deserialized_buffer; const uint8_t *cursor = serialized_buffer; attribute_deserialize_list((char **)&buffer, (char *)&deserial...
/* * 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...
(0b00011111, BITS(4))
; cl_assert_equal_i(0b00111111, BITS_BETWEEN(0,5)); cl_assert_equal_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. // Bit...
/* * 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, circle_center, circle_radius)
; } else { graphics_fill_radial_internal(ctx, circle_center, circle_radius, circle_center.x + 1, 0, TRIG_MAX_ANGLE); } } } static void prv_round_flip_transition_animation_update(GContext *ctx, Animation *animation, ...
XXXX01X to enable the rail, mask and set register_value = (register_value & ~0x06) | 0x02; success = prv_write_register(rail_control_reg, register_value); if (success) { // We enabled the rail! *ref_count = 1; // We need to wait a bit for the rail to stabilize before continu...
gpio_output_init(&BOARD_CONFIG_ACCESSORY.power_en, GPIO_OType_OD, GPIO_Speed_50MHz)
; periph_config_release_lock(); } void set_4V5_power_state(bool enabled) { gpio_output_set(&BOARD_CONFIG_POWER.rail_4V5_ctrl, enabled); } void set_6V6_power_state(bool enabled) { if (BOARD_CONFIG_POWER.rail_6V6_ctrl.gpio) { gpio_output_set(&BOARD_CONFIG_POWER.rail_6V6_ctrl, enabled); } }
) { // Choose duration and elapsed to have clean division for // ANIMATION_NORMALIZED_MAX * elapsed / duration = whole_number test_reel_data->duration_ms = 300; kino_player_play(test_player); animation_set_elapsed(test_player->animation, 20); animation_set_duration(test_player->animation, ANIMATION_DURATIO...
animation_set_duration(test_player->animation, 300)
dr) { 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); flash_lock(); if (!s_flash_state.enabled) { flash_unlo...
PBL_LOG(LOG_LEVEL_DEBUG, "Nonvolatile Configuration Register: 0x%x", nonvolatile_config_register)
pinning */, false /* auto_accept_re_pairing */); cl_assert(id_3 != BT_BONDING_ID_INVALID); cl_assert_equal_i(s_ble_bonding_change_add_count, 3); cl_assert_equal_i(fake_shared_prf_storage_get_ble_store_count(), 2); // Read all three pairings back re...
(s_ble_bonding_change_delete_count, 1)
; cl_assert_equal_i(fake_shared_prf_storage_get_ble_delete_count(), 2); // Try to read it back ret = bt_persistent_storage_get_ble_pairing_by_id(id, &irk_out, &device_out, NULL); cl_assert(!ret); // Add the pairing again bonding_sync_add_bonding(&ble_bonding); id = bt_persistent_storage_store_ble_pairin...
; } delay_ms(1); } return true; } void *reset_vector, *initial_sp; prv_get_fw_reset_vector(&reset_vector, &initial_sp); if ((uintptr_t)reset_vector == 0xffffffff || (uintptr_t)initial_sp == 0xffffffff) { dbgserial_putstr("Firmware is erased"); return true; } return false;...
display_boot_splash()
; delay_us(1000000); } #endif if (is_button_stuck()) { sad_watch(ERROR_STUCK_BUTTON); } if (is_flash_broken()) { sad_watch(ERROR_BAD_SPI_FLASH); } boot_bit_dump(); // If the recovery firmware crashed at start-up, the watch is now a // $150 brick. That's life! if (check_for_recovery_sta...
/* * 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...
{ bool error = false; cl_assert(!ancs_util_is_complete_notif_attr_response(s_chunked_dict_part_one, sizeof(s_chunked_dict_part_one), &error)); cl_assert(!error); }
void test_ancs_util__should_not_parse_malformed_notif_attr_dict(void) { bool error = false; cl_assert(!ancs_util_is_complete_notif_attr_response(s_chunked_dict_part_two, sizeof(s_chunked_dict_part_two), &error)); cl_assert(error); } void test_ancs_util__should_extract_dict_from_buffer(void) { static ...
um_samples); } cl_assert_equal_i(num_samples, 0); } // --------------------------------------------------------------------------------------- // Init and enable the activity service static void prv_activity_init_and_set_enabled(bool enable) { activity_init(); activity_set_enabled(enable); fake_system_task_...
cl_assert_equal_i(sessions[i].length_min, health_sessions[i].length_min)
; } } // ============================================================================================= // Start of unit tests void test_activity__initialize(void) { TimezoneInfo tz_info = { .tm_zone = "UTC", .tm_gmtoff = 0, }; time_util_update_timezone(&tz_info); struct tm time_tm = s_init_time_tm...
/* * 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...
exti_disable(BOARD_CONFIG.dbgserial_int)
; // Start the timer system_task_add_callback_from_isr(prv_start_timer_callback, (void *)0, should_context_switch); if (!s_stop_mode_inhibited) { // We don't bother cancelling the timer if we leave the state where we don't want to stop mode // anymore. For example, if we ctrl-c to enter the prompt (disa...
; } // ------------------------------------------------------------------------------------------------- static void prv_handle_reset_complete(PPoGATTClient *client, const PPoGATTPacket *packet, uint16_t payload_length) { CommSession *session = comm_session_open((Transport *) c...
(LOG_LEVEL_WARNING, "Received retransmitted Ack for sn:%"PRIu32". Ignoring it.", sn)
; } else { PBL_LOG(LOG_LEVEL_ERROR, "Ack'd packet out of range %"PRIu32", [%u-%u].", sn, client->out.next_expected_ack_sn, client->out.next_data_sn); prv_start_reset(client); } } // ------------------------------------------------------------------------------------------------- static void pr...
/* * 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...
{ mutex_unlock_recursive(s_list_mutex); return false; }
PBL_ASSERTN(session->data); // Incrementing open_count insures that no one else can do a dls_unlock_session(inactivate=true) // on it and cause it to be freed before we grab the session->data->mutex below. session->data->open_count++; mutex_unlock_recursive(s_list_mutex); mutex_lock(session->data->mutex...
e_type; // items dynamically changing uint8_t op_flags; bool is_tmp; uint32_t offset; // the current offset within the file uint16_t curr_page; // the current page the offset is on FilePageCache *pg_cache; uint8_t pg_cache_len; } File; // The backing information tracked us...
{ prv_invalidate_page_flags_cache(0, s_pfs_page_count * PFS_PAGE_SIZE); }
static void prv_flash_write(const void *buffer, uint32_t size, uint32_t offset) { if ((offset + size) <= s_pfs_size) { ftl_write(buffer, size, offset); prv_invalidate_page_flags_cache(offset, size); } else { PBL_LOG(LOG_LEVEL_ERROR, "FS write out of bounds 0x%x", (int)offset); } } // Erases all pag...
/* * 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...
{ HealthData health_data = { .sleep_start = (23 * SECONDS_PER_HOUR) + (3 * SECONDS_PER_MINUTE), .sleep_end = (7 * SECONDS_PER_HOUR) + (45 * SECONDS_PER_MINUTE), }; prv_create_card_and_render(&health_data); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); }
void test_health_sleep_detail_card__render_sleep_session_same_start_end_time(void) { HealthData health_data = { .sleep_start = (16 * SECONDS_PER_HOUR), .sleep_end = (16 * SECONDS_PER_HOUR), }; prv_create_card_and_render(&health_data); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } vo...
See the License for the specific language governing permissions and * limitations under the License. */ #include "clar.h" #include "applib/graphics/gtypes.h" #include "applib/graphics/graphics.h" #include "stubs_applib_resource.h" #include "stubs_app_state.h" #include "stubs_compiled_with_legacy2_sdk.h" #include ...
{ GContext ctx = {}; graphics_context_set_fill_color(&ctx, (GColor8){.a= 3, .r = 3}); cl_assert_equal_i(GColorRedARGB8, ctx.draw_state.fill_color.argb); graphics_context_set_fill_color(&ctx, (GColor8){.a= 2, .r = 3}); cl_assert_equal_i(GColorRedARGB8, ctx.draw_state.fill_color.argb); graphics_context_set_fi...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
gpio_use(af_config->gpio)
; GPIO_Init(af_config->gpio, &init); gpio_release(af_config->gpio); } void gpio_af_configure_fixed_output(const AfConfig *af_config, bool asserted) { GPIO_InitTypeDef init = { .GPIO_Pin = af_config->gpio_pin, .GPIO_Mode = GPIO_Mode_OUT, .GPIO_Speed = GPIO_Speed_2MHz, .GPIO_OType = GPIO_OType_PP, ...
n erase header PageHeader pg_hdr; memset(&pg_hdr, 0xff, sizeof(pg_hdr)); pg_hdr.version = PFS_CUR_VERSION; pg_hdr.erase_count = erase_count; SET_PAGE_FLAGS(pg_hdr.page_flags, PAGE_FLAG_ERASED_PAGE); // write that header to each region in pfs uint8_t erased_header_size = offsetof(PageHeader, erase_count) ...
((uint8_t *)&hdr->last_written, sizeof(hdr->last_written), prv_page_to_flash_offset(page) + offsetof(PageHeader, last_written))
; // feed watchdog since erases can take a while & give lower priority tasks // a little time in case we are calling this from a high priority task and // stalling them task_watchdog_bit_set(pebble_task_get_current()); psleep(1); // mark the page as erased. This way we know that the erase completed // n...
{ 896, 320, -128}, { 1184, 328, -144}, { 1288, 200, 0}, // 19 seconds { 1792, 216, 120}, { 1576, 336, 128}, { 944, 296, 72}, { 1008, 192, 112}, { 1120, 40, 248}, { 944, 56, 224}, { 856, 96, 152}, { 760, 32, 136}, { 736, 56, 88}, { 768, -8, 104}, { 784, 8, 48}, ...
{ 736, -24, 88}, { 720, -32, 40}, { 816, -88, 56}, { 944, -64, 16}, { 1176, -40, 16}, { 1632, -160, 296}, { 1464, 320, 96}, // 25 seconds { 1016, 456, -208}, { 1024, 352, -64}, { 888, 112, 136}, { 776, 192, 96}, { 896, 248, 160}, { 944, 432, 120}, { 856, 480, ...
{ 1312, 304, 16}, { 1864, 352, 120}, { 1448, 360, 168}, { 792, 296, 80}, { 1096, 224, 216}, { 1168, 32, 312}, { 952, 64, 272}, { 808, 72, 240}, { 728, 64, 200}, { 720, 64, 136}, { 776, 32, 104}, // 28 seconds { 808, -16, 120}, { 920, -88, 104}, { 1136, -40, 4...
sult(data, true /* succeeded */); } static void prv_cleanup_do_response_menu(ActionMenu *action_menu, const ActionMenuItem *item, void *context) { timeline_item_destroy(context); } static void prv_handle_do_response_response(ActionResultData *data) { TimelineItem *item = t...
prv_handle_chaining_response(data, e)
; break; case ActionResultTypeDoResponse: prv_handle_do_response_response(data); break; default: prv_cleanup_action_result(data, false /* success */); PBL_LOG(LOG_LEVEL_WARNING, "Unknown Action Response"); break; } } static void prv_subscribe_to_action_results_and_timeouts...
&stored_data.ble_data.pairing_info.identity.opaque)) { itr_data->irk_out = stored_data.ble_data.pairing_info.irk; strncpy(itr_data->name_out, stored_data.ble_data.name, BT_DEVICE_NAME_BUFFER_SIZE); itr_data->found = true; return false; // stop iterating } return true; // continue iterati...
info->get_key(file, (uint8_t*) &key, info->key_len)
; info->get_val(file, (uint8_t*) &stored_data, MIN((unsigned)info->val_len, sizeof(stored_data))); if (stored_data.type == BtPersistBondingTypeBLE) { internal_itr_data->cb(key, &stored_data, internal_itr_data->cb_data); } return true; } void bt_persistent_storage_for_each_ble_pairing(BtPersistBondingDBEa...
window, false /* animated */); } static void prv_view_model_did_change(ActionMenuData *data) { ActionMenuViewModel *vm = &data->view_model; const ActionMenuLevel *cur_level = vm->cur_level; GRect frame = grect_inset(data->action_menu.window.layer.frame, vm->menu_insets); layer_set_frame(&data->action_menu_laye...
(content_out, anim_handlers, anim_ctx)
; return content_out; } static void prv_set_level(ActionMenuData *data, const ActionMenuLevel *level) { if (animation_is_scheduled(data->level_change_anim)) { // We are already animating. return; } Animation *content_out = prv_create_content_out_animation(data, level); Animation *content_in = prv_c...
prv_find_animation_by_handle(state, animation_h, false /*quiet*/); if (!prv_is_mutable(state, animation)) { return false; } animation->custom_function = function; if (function) { animation->curve = curve; } else { animation->curve = AnimationCurveDefault; } return true; } // ---------------...
if (!prv_is_mutable(state, animation)) { return false; }
// NOTE: We still need to implement reverse for sequence and spawn animations. // tracked in this JIRA: https://pebbletechnology.atlassian.net/browse/PBL-14838 animation->reverse = reverse; return true; } // ------------------------------------------------------------------------------------------- bool ani...
eScore *vibe_score; #endif } AlarmPopupData; AlarmPopupData *s_alarm_popup_data = NULL; static void prv_stop_animation_kernel_main_cb(void *callback_context) { if (s_alarm_popup_data) { dialog_set_icon((Dialog *) s_alarm_popup_data->alarm_popup, RESOURCE_ID_ALARM_CLOCK_LARGE_STATIC); } } ...
(action_bar)
; action_bar_layer_set_background_color(action_bar, GColorBlack); s_alarm_popup_data->action_bar_snooze = gbitmap_create_with_resource(RESOURCE_ID_ACTION_BAR_ICON_SNOOZE); s_alarm_popup_data->action_bar_dismiss = gbitmap_create_with_resource(RESOURCE_ID_ACTION_BAR_ICON_X); action_bar_layer_set_icon...
ey_len, (void*)&bool_data, sizeof(bool_data)); if (!read_size || ((bool_data != (uint8_t)true) && (bool_data != (uint8_t)false))) { return default_value; } // Default to false in the case of data corruption (anything other than 0x1 or 0x0). return bool_data; } //! Returns true if the set was successf...
{ bool has_pinned_ble_pairings = false; prv_file_each(prv_any_pinned_ble_pairings_itr, &has_pinned_ble_pairings); return has_pinned_ble_pairings; }
/////////////////////////////////////////////////////////////////////////////////////////////////// //! Shared PRF Storage static void prv_load_pinned_address_from_prf(void) { BTDeviceAddress pinned_address; if (shared_prf_storage_get_ble_pinned_address(&pinned_address)) { bt_persistent_storage_set_ble_pin...
ware * 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 "ecompass.h" #include "util/trig.h" #include "kern...
for (int i = 0; i < N_SAMPS; i++) { for (int j = 0; j < 3; j++) { raw_data[i][j] = (s_samples[i][j] - shift_factor[j]); // TODO: stop here if we have a chance of overflowing } }
int32_t r[N_SAMPS]; for (int i = 0; i < N_SAMPS; i++) { r[i] = raw_data[i][0] * raw_data[i][0] + raw_data[i][1] * raw_data[i][1] + raw_data[i][2] * raw_data[i][2]; } // We now find the origin by solving the linear equation discussed above for (int i = 0; i < N_SAMPS; i++) { matrix[...
/flash_private.h" #include "drivers/watchdog.h" #include "flash_region/flash_region.h" #include "kernel/util/delay.h" #include "util/math.h" #include "kernel/core_dump_private.h" //! We have our own flash driver for coredump support because it must not use //! any FreeRTOS constructs & we want to keep it as simple as...
prv_flash_end_cmd()
; prv_flash_wait_for_write(); } void cd_flash_read_bytes(void* buffer_ptr, uint32_t start_addr, uint32_t buffer_size) { uint8_t* buffer = buffer_ptr; prv_flash_wait_for_write(); prv_flash_start_cmd(); prv_flash_send_and_receive_byte(FLASH_CMD_READ); prv_flash_send_24b_address(start_addr); while (buffer_...
ply is used to multiply numbers in the field GF(2^8) #if MULTIPLY_AS_A_FUNCTION static uint8_t Multiply(uint8_t x, uint8_t y) { return (((y & 1) * x) ^ ((y>>1 & 1) * xtime(x)) ^ ((y>>2 & 1) * xtime(xtime(x))) ^ ((y>>3 & 1) * xtime(xtime(xtime(x)))) ^ ((y>>4 & 1) * xtime(xtime(x...
{ // Copy input to output, and work in-memory on output BlockCopy(output, input); state = (state_t*)output; Key = key; KeyExpansion(); // The next function call encrypts the PlainText with the Key using AES algorithm. Cipher(); }
void AES128_ECB_decrypt(const uint8_t* input, const uint8_t* key, uint8_t *output) { // Copy input to output, and work in-memory on output BlockCopy(output, input); state = (state_t*)output; // The KeyExpansion routine must be called before encryption. Key = key; KeyExpansion(); InvCipher(); } #endi...
28, -48}, { 1232, 104, -256}, { 1080, 8, -232}, { 1208, -32, -128}, { 1152, 96, -280}, { 1016, 112, -424}, { 1464, 32, -448}, { 1328, 120, -272}, { 1008, 128, -280}, { 1072, 216, -272}, { 1024, 408, -168}, { 1016, 464, -64}, { 904, 480, -104}, { 1240, 552, 24}, { ...
{ 1512, 232, -240}, { 1096, 336, -296}, { 784, 344, -248}, { 800, 376, -176}, // 13 seconds { 944, 368, -192}, { 1104, 376, -168}, { 1176, 416, -80}, { 1520, 600, -32}, { 1064, 800, -120}, { 1464, 824, -168}, { 1208, 648, -144}, { 1056, 528, -272}, { 1320, 520, -1...
{ 392, 8, -792}, { 304, -112, -616}, { 136, -200, -536}, { 64, -144, -552}, { 64, -192, -688}, { 72, -232, -888}, { 80, -264, -1064}, { 120, -360, -1128}, { 104, -376, -1120}, { 96, -416, -1104}, { 144, -288, -1080}, { 248, -128, -1104}, { 376, -192, -1008}, // 1...
me + offset_sec[i]); success = protobuf_log_session_add_measurements(session_ref, rtc_get_time(), num_values_per_sample, &values[i * num_values_per_sample]); cl_assert(success); if (s_saved_encoded_msg ==...
(&input, false /*use_data_logging*/, session_ref)
; } // --------------------------------------------------------------------------------------------- // Test using the data logging transport void test_protobuf_log__events_basic(void) { pebble_pipeline_Event events[] = { { .type = pebble_pipeline_Event_Type_UnknownEvent, .duration = 17, .has_d...
t(uuid_equal(&state.node->id, &multiday_item.header.id)); cl_assert(state.node->all_day); cl_assert_equal_i(state.node->timestamp, midnight_march_2_pst); cl_assert_equal_i(state.node->duration, MINUTES_PER_DAY); cl_assert_equal_i(state.current_day, midnight_march_2_pst); // day 2 cl_assert(iter_next(&itera...
timeline_init(&head)
, S_SUCCESS); const time_t time_21_00_march_1_pst = 1425272400; cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, time_21_00_march_1_pst), S_SUCCESS); const time_t midnight_march_3_pst = 1425369600; // day 1 cl_assert(uuid_equal...
/* * 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_Unlock()
; FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR|FLASH_FLAG_PGSERR); const uint8_t *data_array = data; for (uint32_t i = 0; i < length; ++i) { if (FLASH_ProgramByte(address + i, data_array[i]) != FLASH_COMPLETE) { dbgs...
n) static ActivitySessionType s_activity_type = DEFAULT_ACTIVITY_TYPE; //////////////////////////////////////////////////////////////////////////////////////////////////// // Helpers static void prv_prep_and_open_active_window(ActivitySessionType type) { WorkoutAppData *data = app_state_get_user_data(); data->w...
(dialog, true)
{ 0, 0x4b, 0, 141, 0}, { 0, 0x4b, 0, 141, 0}, { 0, 0x4b, 0, 141, 0}, { 0, 0x4b, 0, 141, 0}, { 0, 0x4b, 0, 141, 0}, { 0, 0x4b, 28, 141, 0}, { 0, 0x4b, 0, 141, 0}, { 0, 0x4b, 0, 141, 0}, { 0, 0x4b, 0, 141, 0}, { 0, 0x5b, 17, 141, 0}, { 0, 0x5b, 0, 141, 0},...
{ 0, 0x62, 2787, 139, 0}, { 0, 0x62, 0, 132, 0}, { 0, 0x62, 13, 140, 0}, { 0, 0x62, 0, 140, 0}, { 0, 0x61, 0, 140, 0}, { 0, 0x61, 0, 141, 0}, { 0, 0x61, 0, 141, 0}, { 0, 0x52, 466, 141, 0}, // 510: Local time: 2016-05-20 05:36:00 AM { 0, 0x33, 0, 141, 0}, ...
&end_time); cl_assert_equal_i(num_records, ALG_MINUTES_PER_FILE_RECORD - i); cl_assert_equal_i(start_time, oldest_to_fetch + (i * SECONDS_PER_MINUTE)); printf("\nReceived %d minute records", (int)num_records); for (int j = 0; j < num_records; j++) { printf("\nRecord:%d, steps: %d",...
prv_feed_cannned_accel_data(120, 0, ActivitySleepStateRestfulSleep)
; prv_feed_cannned_accel_data(120, 0, ActivitySleepStateLightSleep); // Wait long enough for our recompute sleep logic to run. prv_feed_cannned_accel_data(SECONDS_PER_MINUTE * ACTIVITY_SESSION_UPDATE_MIN, 0, ActivitySleepStateAwake); // Advance to next day prv_feed_cannned_acce...
= state->samples_per_update - state->num_samples; ask_for = MAX(ask_for, state->subsample_numerator); ask_for = ask_for / state->subsample_numerator * state->subsample_numerator; PBL_ASSERTN(state->num_samples + ask_for <= state->raw_buffer_size); num_samples = accel_consume_data(state...
DEFINE_SYSCALL(uint32_t, sys_accel_manager_get_buffer_size, AccelSessionRef session, uint32_t samples_per_update)
h" // Stubs /////////////////////////////////////////////////////////// int g_pbl_log_level = 0; void pbl_log(int level, const char* src_filename, int src_line_number, const char* fmt, ...) { } // Tests /////////////////////////////////////////////////////////// void test_list__initialize(void) { } void test_list__...
{ IntNode bar1 = { .value = 1 }; IntNode bar2 = { .value = 2 }; IntNode bar3 = { .value = 3 }; ListNode* head = 0; head = list_sorted_add(head, &bar2.list_node, (Comparator) sorting_comparator, false); cl_assert(head == &bar2.list_node); head = list_sorted_add(head, &bar3.list_node, (Comparator) sortin...
static bool is_odd(IntNode *node, void *data) { return (node->value & 1); (void)data; } static bool is_even(IntNode *node, void *data) { return ((node->value & 1) == 0); (void)data; } void test_list__find_next_and_prev(void) { IntNode bar[5] = {0}; ListNode* tail = NULL; for (int i = 0; i < 5; ++i) { ...
ault_push_create_animation(WindowTransitioningContext *context) { window_transition_context_disappear(context); window_transition_context_appear(context); return animation_create(); } const WindowTransitionImplementation window_transition_default_push_implementation = { .create_animation = window_transition_de...
(PebbleTask_KernelMain)
; modal_manager_pop_all(); fake_animation_cleanup(); cl_assert_equal_i(fake_pbl_malloc_num_net_allocs(), 0); } // Tests //////////////////////////////////// void test_window_stack__basic_app_push(void) { Window *window = window_create(); stub_pebble_tasks_set_current(PebbleTask_App); cl_check(app_sta...
/* * 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 (r == 0 || strncmp(buf, "05", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"d\": %s", buf); }
d)); // Test ble_ad_copy_service_uuids, destination array sized larged enough: const uint8_t count = 4; Uuid copied_uuids[count]; uint8_t found = ble_ad_copy_service_uuids(s_ad_data, copied_uuids, count); cl_assert_equal_i(found, 1); // Test ble_ad_copy_service_uuids, destination array too small: found ...
ble_ad_set_service_uuids(ad, uuid, 2)
, true); cl_assert_equal_i(memcmp(expected_ad_data, ad->data, sizeof(expected_ad_data)), 0); cl_assert_equal_i(ad->ad_data_length, sizeof(expected_ad_data)); cl_assert_equal_i(ad->scan_resp_data_length, 0); ble_ad_destroy(ad); // 7x 32-bit UUIDs should fit, expect true: ad = ble_...
/* * 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_layer_reset(&timeline_layer)
urn false. We are misusing the queue set by pulling events out // from the s_kernel_event_queue queue before it's activated so likely, the activated queue was // s_kernel_event_queue. if (!result) { return false; } } s_current_event = prv_get_fancy_type_from_event(event); return true; } ...
(preserve_queue)
; for (int i = 0; i < num_client_task_events_enqueued; ++i) { xQueueSend(s_system_event_queue_set, &preserve_queue, 0); } } QueueHandle_t event_kernel_to_kernel_event_queue(void) { return s_from_kernel_event_queue; } BaseType_t event_queue_cleanup_and_reset(QueueHandle_t queue) { int num_events_in_queue ...
/* * 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...
gdraw_command_sequence_get_data_size(sequence)
; GDrawCommandSequence *result = applib_malloc(size); if (result) { memcpy(result, sequence, size); } return result; } void gdraw_command_sequence_destroy(GDrawCommandSequence *sequence) { applib_resource_munmap_or_free(sequence); } bool gdraw_command_sequence_validate(GDrawCommandSequence *sequence, s...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ bool success = true; storage_acquire(); { device_t *dev = find_device_by_conn_idx(conn_idx); if (!dev) { success = false; goto release; } bool is_resolved = false; if (dev && dev->irk) { is_resolved = true; if (irk_out) { memcpy(irk_out, dev->irk->key, sizeof(...
/* * 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_get_called = true; if (!s_has_cache) { return E_DOES_NOT_EXIST; } *((uint64_t *)val_out) = s_get_value; return S_SUCCESS; }
aw 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 "applib/ui/dialogs/...
comm_session_send_data(session, PING_ENDPOINT, (uint8_t *)&pong, sizeof(pong), COMM_SESSION_DEFAULT_TIMEOUT)
; break; } case 1: if (length != sizeof(PongMsg)) { PBL_LOG(LOG_LEVEL_ERROR, "Invalid Pong, l=%u", length); return; } PongMsg *pong = (PongMsg *)data; PBL_LOG(LOG_LEVEL_DEBUG, "Pong c=%"PRIu32, ntohl(pong->hdr.cookie)); analytics_inc(ANALYTICS_DEVICE_METRIC_PONG_RECEIVED_COUNT,...
cl_assert_equal_i(rocky_api_app_message_get_state(), PostMessageStateAwaitingResetCompleteLocalInitiated); } void test_rocky_api_app_message__awaiting_reset_complete_rem_init__receive_complete_valid_version(void) { prv_init_and_goto_awaiting_reset_complete_remote_initiated(); RCV_RESET_COMPL...
(rocky_api_app_message_get_state(), PostMessageStateSessionOpen)
; } void test_rocky_api_app_message__awaiting_reset_complete_loc_init__rcv_chunk(void) { prv_init_and_goto_awaiting_reset_complete_local_initiated(); RCV_DUMMY_CHUNK(); // https://pebbletechnology.atlassian.net/browse/PBL-42466 // TODO: assert that chunk is NACK'd // Chunk is ignored, state isn't changed:...
/* &tail */); state->scheduled_head = list_sorted_add(state->scheduled_head, &animation->list_node, prv_scheduler_comparator, true /*ascending*/); } animation = next; } } // ----------------------------------------------------------------------------------...
{ if (teardown && animation->did_setup) { // When children unschedule themselves after running, their teardown isn't allowed to run // (because the parent might repeat). So, this is a chance to finally run the child's // teardown handler. if (animation->implementation->teardown != ...
e the graph begins #define GRAPH_OFFSET_Y PBL_IF_RECT_ELSE(38, 48) //! Marks where the graph ends and where the labels begin #define LABEL_OFFSET_Y PBL_IF_RECT_ELSE(118, 113) #define LABEL_HEIGHT 27 #define GRAPH_HEIGHT (LABEL_OFFSET_Y - GRAPH_OFFSET_Y) #define AVG_LINE_HEIGHT 4 #define AVG_LINE_LEGEND_WIDTH 10 #def...
(weekday, Monday, Thursday)
? 1 : 0; const int thin_width = 5; thin_box.origin.x += thin_offset_x + (box->size.w - thin_width) / 2; thin_box.size.w = thin_width; graphics_context_set_fill_color(ctx, bar_color); graphics_fill_rect(ctx, &thin_box); } static int16_t prv_draw_day_bar(GContext *ctx, int weekday, const GRect *box, ...