prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
client) != NULL); } // ------------------------------------------------------------------------------------------------- static uint16_t prv_get_max_payload_size(const PPoGATTClient *client) { const BTDeviceInternal device = gatt_client_characteristic_get_device(client->characteristics.data); const uint16...
{ // only log this the first couple of times it happens if (s_disconnect_counter < (PPOGATT_DISCONNECT_COUNT_MAX + 3)) { PBL_LOG(LOG_LEVEL_ERROR, "Not disconnecting because max disconnects reached..."); } return; }
else { PBL_LOG(LOG_LEVEL_ERROR, "Disconnecting because max resets reached..."); // Record the time of this disconnect request analytics_event_PPoGATT_disconnect(rtc_get_time(), false); bt_lock(); const BLECharacteristic characteristic = client->characteristics.meta; GAPLEConnectio...
; } void menu_down_click_handler(ClickRecognizerRef recognizer, MenuLayer *menu_layer) { const bool up = false; const bool animated = true; menu_layer_set_selected_next(menu_layer, up, MenuRowAlignCenter, animated); } static void prv_menu_click_config_provider(MenuLayer *menu_layer) { // The config that gets ...
layer_set_bounds(cell_layer, &prev_bounds)
; } else { graphics_fill_rect( ctx, &GRect(0, y, menu_layer->scroll_layer.layer.bounds.size.w, cursor->sep)); } } static void prv_prepare_row(GContext *ctx, MenuLayer *menu_layer, Layer *cell_layer, bool highlight) { if (!process_manager_compiled_with_legacy2_sdk()) { ...
notification_storage_get(id, item)) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to read notification"); goto cleanup; } } else if (type == NotificationReminder) { // validate reminder int rv = reminder_db_read_item(item, id); if (rv != S_SUCCESS) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to read rem...
(&reminder)
; TimelineItem item; if (S_SUCCESS != pin_db_get(&reminder.header.parent_id, &item)) { return; } timeline_item_free_allocated_buffer(&item); // Use the latest stale time to auto-hide the reminder. const time_t reminder_stale_time = prv_get_stale_time(&reminder); const time_t event_stale_time = prv_g...
STRIKE_TWO); return true; } else if (boot_bit_test(BOOT_BIT_FW_START_FAIL_STRIKE_ONE)) { dbgserial_putstr("Boot failed, strike 2"); boot_bit_set(BOOT_BIT_FW_START_FAIL_STRIKE_TWO); } else { dbgserial_putstr("Boot failed, strike 1"); boot_bit_set(BOOT_BIT_FW_START_FAIL_STRIKE_ONE); } return ...
boot_bit_test(BOOT_BIT_FW_STABLE)
) { dbgserial_putstr("Last firmware boot was stable; clear strikes"); boot_bit_clear(BOOT_BIT_FW_STABLE); boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_ONE); boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_TWO); boot_bit_clear(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_ONE); boot_bit_clear(BOOT_BIT_RECOVE...
ol 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) { bar[i]....
cl_assert_equal_i(num_nodes, 3)
; }
/* * 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 (asserted) { spi_ll_slave_scs_assert(DIALOG_SPI); } else { spi_ll_slave_scs_deassert(DIALOG_SPI); } }
// // Low Level SPI TX/RX config // static void prv_enable_spi_clock(void) { spi_ll_slave_acquire(DIALOG_SPI); spi_ll_slave_drive_clock(DIALOG_SPI, false); } static void prv_disable_spi_clock(void) { // When the SPI peripheral is disabled, the CLK line floats. Let's // reconfigure the CLK GPIO to be active ...
/* * 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_convert_millivolts_to_12bit_reading(VREF_VOLTAGE)
* 40, .vmon_total = prv_convert_millivolts_to_12bit_reading(1800) * 40 }; uint32_t result = battery_convert_reading_to_millivolts(reading, 1, 1); cl_assert_equal_i(result, 1800); reading.vmon_total = prv_convert_millivolts_to_12bit_reading(1200) * 40; result = battery_convert_reading_to_millivolts(rea...
/* * 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, center, watch_hand_end, hand->thickness)
; } static void prv_draw_watch_hand_pointed(GContext *ctx, ClockHand *hand, GPoint center, GPath *path) { graphics_context_set_fill_color(ctx, hand->color); gpath_rotate_to(path, hand->angle); gpath_move_to(path, center); gpath_draw_filled(ctx, path); } static void prv_...
nd(); } alerts_preferences_check_and_set_first_use_complete(FirstUseSourceSmartDND); s_event_ongoing = false; s_num_dnd_events_put = 0; } void test_do_not_disturb__cleanup(void) { // Make sure we start in a common state: everything off do_not_disturb_set_manually_enabled(false); do_not_disturb_set_sche...
do_not_disturb_is_active()
; cl_assert(active == false); s_event_ongoing = true; // Manual && !Scheduled && Smart do_not_disturb_set_manually_enabled(true); do_not_disturb_set_schedule_enabled(WeekdaySchedule, false); active = do_not_disturb_is_active(); cl_assert(active == true); // Manual && Scheduled && Smart do_not_distur...
xny.${BIT_DEPTH_NAME}.pbi")); #endif } void test_graphics_draw_rect_${BIT_DEPTH_NAME}__offset_sw(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // SW = 1 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, false, 1); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP); cl_c...
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, false, 11)
; graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, false, 11); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_LOG(LOG_LEVEL_DEBUG, ">> Reading Addr 0x%"PRIx32" value is 0x%"PRIx8, read_addr, read_buffer)
_b(s_hrm_subscribed, true); cl_assert_equal_i(s_hrm_expiration, 0); prv_inc_time(1 * SECONDS_PER_MINUTE); cl_assert(workout_service_start_workout(ActivitySessionType_Run)); // Workout of 120 seconds duration. Should be valid prv_inc_time(2 * SECONDS_PER_MINUTE); cl_assert(workout_service_stop_workout()); ...
prv_put_bpm_event(ZONE_3_HR, HRMQuality_Good)
/* * 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 (endptr) { *endptr = (char*)nptr; }
return value * sign; } long int strtol(const char * restrict nptr, char ** restrict endptr, int base) { return strtoX_core(nptr, endptr, base, true, INT_MAX, INT_MIN); }
/* * 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 (state->impl && state->impl->filter(header, &state->context)) { if (prv_should_use_item(state, header)) { *state->filter_header = *header; } filter = true; }
} return filter; } static void prv_update_status(void) { PBL_ASSERT_TASK(PebbleTask_KernelBackground); if (!s_mutex) { return; } mutex_lock(s_mutex); new_timer_stop(s_timer); SerializedTimelineItemHeader *filter_headers = kernel_zalloc_check(TimelineEventServiceCount * sizeof(SerializedTimel...
/* * 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...
{ uintptr_t saved_lr = (uintptr_t) __builtin_return_address(0); prv_assert_held_by_curr_task(handle, is_held, saved_lr); }
void mutex_assert_recursive_held_by_curr_task(PebbleRecursiveMutex * handle, bool is_held) { uintptr_t saved_lr = (uintptr_t) __builtin_return_address(0); prv_assert_held_by_curr_task((PebbleMutex *) handle, is_held, saved_lr); } PebbleRecursiveMutex * mutex_create_recursive(void) { LightMutexHandle_t freertos...
/* * 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_manager_launch_new_app(&(AppLaunchConfig) { .md = prf_low_power_app_get_info(), }); }
else { // In MFG mode, disable low power mode above but don't close the app. if (mfg_is_mfg_mode()) { return; } app_manager_close_current_app(true); } #endif } void low_power_standby(void) { analytics_stopwatch_stop(ANALYTICS_DEVICE_METRIC_WATCH_ONLY_TIME); enter_standby(RebootReasonCode_L...
ar **logs = generate_unique_logs(space_avail, log_len, &num_logs); setup_and_test_expected_msg(logs, 0, 0, num_logs); // write two more additional logs which should cause the first erase // region to get erased logs = realloc(logs, sizeof(char *) * (num_logs + 2)); logs[num_logs] = task_strdup("Let's test if...
cl_assert_equal_i(start_addr, FLASH_LOG_INVALID_ADDR)
; char *msg = "0123456789"; start_addr = flash_logging_log_start(10); cl_assert(start_addr != FLASH_LOG_INVALID_ADDR); bool rv = flash_logging_write((uint8_t *)msg, start_addr, strlen(msg)); cl_assert(rv); rv = flash_logging_write((uint8_t *)msg, start_addr, strlen(msg)); cl_assert(!rv); setup_and_te...
prv_render_activity_type(ctx, layer, summary_window->icon, summary_window->name); } //////////////////////////////////////////////////////////////////////////////////////////////////// //! Handlers static void prv_up_click_handler(ClickRecognizerRef recognizer, void *context) { WorkoutSummaryWindow *summary_window ...
{ app_window_stack_push(&summary_window->window, true); }
void workout_summary_update_activity_type(WorkoutSummaryWindow *summary_window, ActivitySessionType activity_type) { summary_window->activity_type = activity_type; summary_window->icon = prv_get_icon_for_activity(activity_type); summary_window->name = workout_utils_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...
{ blob_db_set_accepting_messages(enabled); blob_db2_set_accepting_messages(enabled); }
const uint8_t *endpoint_private_read_token_db_id(const uint8_t *iter, BlobDBToken *out_token, BlobDBId *out_db_id) { // read token *out_token = *(BlobDBToken*)iter; iter += sizeof(BlobDBToken); // read database id *out_db_id = *iter; iter += sizeof(BlobDBId...
d(reel, ctx, offset, processor); } } static void prv_draw_processed_in_local(KinoReelTransformData *data, GContext *ctx, GPoint offset, KinoReelProcessor *processor) { KinoReel *reel = prv_get_current_reel(data); GDrawCommandList *source_list = kino_reel_get_gdraw_command_...
kino_reel_custom_get_data(reel)
; if (!data) { return; } if (data->owns_from_reel) { kino_reel_destroy(data->from_reel); } data->from_reel = from_reel; data->owns_from_reel = take_ownership; prv_free_list_copy(data); } KinoReel *kino_reel_transform_get_from_reel(KinoReel *reel) { KinoReelTransformData *data = kino_reel_custom...
/* * 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...
{ button_state |= (button_is_pressed(i) ? 0x01 : 0x00) << i; }
return button_state; } void button_init(void) { // Need to disable button wakeup functionality // or the buttons don't register input PWR_WakeUpPinCmd(PWR_WakeUp_Pin1, DISABLE); PWR_WakeUpPinCmd(PWR_WakeUp_Pin2, DISABLE); PWR_WakeUpPinCmd(PWR_WakeUp_Pin3, DISABLE); periph_config_enable(RCC_APB2PeriphCl...
e need to do this so we can pass in the GBitmapFormat // we need to use for the unit test output canvas instead of relying on GBITMAP_NATIVE_FORMAT, which // wouldn't work for Spalding since it uses GBitmapFormat8BitCircular GBitmap* graphics_capture_frame_buffer(GContext *ctx) { PBL_ASSERTN(ctx); return graphics_c...
cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE))
h focused and unfocused side-by-side const int num_columns_accounting_for_focused_unfocused = num_columns * 2; const int16_t bitmap_width = (cell_width * num_columns_accounting_for_focused_unfocused) + (GRID_CELL_PADDING * (num_columns_accounting_for_focused_unfocused + 1)); const int16_t bitmap_height = prv_...
prv_prepare_canvas_and_render_cells( MenuCellType_CellLayer, cell_width, s_menu_system_cell_layer_test_column_data, ARRAY_LENGTH(s_menu_system_cell_layer_test_column_data), /* is_legacy2 */ false)
; cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); } void test_menu_layer_system_cells__cell_width_144(void) { const int16_t cell_width = 144; prv_prepare_canvas_and_render_cells( MenuCellType_CellLayer, cell_width, s_menu_system_cell_layer_test_column_data, ARRAY_LENGTH(s_menu_system_ce...
age governing permissions and * limitations under the License. */ #include <applib/rockyjs/api/rocky_api_graphics_path2d.h> #include "clar.h" #include "test_jerry_port_common.h" #include "test_rocky_common.h" #include "applib/graphics/gpath.h" #include "applib/graphics/gtypes.h" #include "applib/rockyjs/api/rocky_a...
(0, 0, 144, 168)
}; const jerry_value_t ctx = prv_create_canvas_context_2d_for_layer(&l); cl_assert_equal_b(jerry_value_is_object(ctx), true); jerry_set_object_field(jerry_get_global_object(), "ctx", ctx); } void test_rocky_api_graphics_path2d__initialize(void) { fake_malloc_set_largest_free_block(~0); s_log_internal__expect...
ent in a few seconds, thus giving the process a chance to clean up. if (!process_manager_make_process_safe_to_kill(PebbleTask_Worker, gracefully)) { // Maybe next time... PBL_LOG(LOG_LEVEL_DEBUG, "Worker not ready to exit"); return; } // Save which worker we are exiting AppInstallId closing_worker_...
(PebbleTask_Worker, true /*graceful*/)
; } } // ------------------------------------------------------------------------------------------------ void command_worker_kill(void) { process_manager_put_kill_process_event(PebbleTask_Worker, true /*graceful*/); } // ------------------------------------------------------------------------------------------...
tmap->info.format, GBitmapFormat1Bit); uint8_t dest_data[bounds.size.w * bounds.size.h]; GBitmap dest_bitmap = { .addr = dest_data, .row_size_bytes = bounds.size.w, .info.format = GBitmapFormat8Bit, .info.version = GBITMAP_VERSION_CURRENT, .bounds = src_bitmap->bounds }; memset(dest_data, ...
gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_8bit_clipping-expect.8bit.pbi")
); gbitmap_destroy(src_bitmap); } // Setup: // - Source is 25 x 25. // - Source rows alternating: 1px black, 1px white. // - Dest is Blue, 100x100 // - Dest rect is 50 x 25, at (0, 0) // Result: // - 50x20 of alternating stripes, rest is blue. void test_bitblt__1bit_to_8bit_wrap_x(void) { GBitmap *src_b...
_for_type(AlertReminder)); cl_assert(alerts_should_notify_for_type(AlertOther)); cl_assert(!alerts_should_vibrate_for_type(AlertOther)); alerts_set_notification_vibe_timestamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS); cl_assert(!alerts_should_enable_backlight_for_type(AlertOth...
(AlertOther)
); alerts_set_notification_vibe_timestamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS); cl_assert(alerts_should_enable_backlight_for_type(AlertOther)); }
and_respond(true /* is_granted */); // Expect HRM manager to be subscribed to: cl_assert_equal_i(s_hrm_manager_subscribe_with_callback_call_count, 1); prv_assert_event_service_subscribed(true); cl_assert_equal_b(true, ble_hrm_is_sharing_to_connection(&s_conn_a)); // Device A subscribes again, should be a no...
cl_assert_equal_b(false, ble_hrm_is_sharing())
; prv_assert_event_service_subscribed(false); } void test_ble_hrm__revoke_after_disconnection(void) { ble_hrm_revoke_sharing_permission_for_connection(NULL); s_connections[0] = NULL; ble_hrm_revoke_sharing_permission_for_connection(&s_conn_a); cl_assert_equal_b(false, ble_hrm_is_sharing_to_connection(NULL)...
graphics_context_set_fill_color(&context, color); #if PBL_COLOR cl_assert_equal_i(context.draw_state.fill_color.argb, GColorOrange.argb); #else cl_assert_equal_i(context.draw_state.fill_color.argb, GColorDarkGray.argb); #endif color.a = 1; graphics_context_set_fill_color(&context, color); cl_assert_equal_i(c...
GPoint(5, 5)
, GPoint(45, 10)); ASSERT_CALLED(graphics_line_draw_1px_non_aa(&context, GPoint(5, 5), GPoint(45, 10))); setup_test(&context, false, 1, GColorBlack, GColorBlack, false); graphics_draw_rect(&context, &GRect(10, 20, 40, 10)); ASSERT_CALLED(prv_draw_rect(&context, &GRect(10, 20, 40, 10))); setup_test(&context,...
ell_event_loop.h" #include "shell/system_app_state_machine.h" #include "system/bootbits.h" #include "system/logging.h" #include "system/passert.h" #include "system/reset.h" #include "system/testinfra.h" #include "util/bitset.h" #include "util/struct.h" #include "system/version.h" #include <bluetooth/reconnect.h> #inc...
battery_state_handle_connection_event(is_connected)
; if (is_connected) { light_enable_interaction(); } else { // Chances are the Pebble of our dear customer has been charging away // from the phone and is disconnected because of that. Try reconnecting // immediately upon disconnecting the charger: bt_driver_reconnect_...
or_dialog(VoiceUiData *data, const char* header, const char *text, uint32_t resource_id) { prv_set_mic_window_state(data, StateError); ExpandableDialog *long_error_dialog = &data->long_error_dialog; expandable_dialog_init(long_error_dialog, "Error"); Dialog *dialog = expandable_dialog_get_dialog(long_error...
("Session setup successfully")
; data->start_ms = prv_get_time_ms(); data->speech_detected = false; data->dictation_timeout = app_timer_register(DICTATION_TIMEOUT, prv_dictation_timeout_cb, data); // Update UI prv_set_mic_window_state(data, StateRecording); break; case VoiceStatusErrorConnectivity:...
/* * 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(parent.first_child == &child_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...
{ if (s_data.info[0].logging_session == NULL) { // Sessions closed. return; } struct DataLoggingInfo*info = ck; log_moar_data(info); const int num_chunks = 30; snprintf(info->text, sizeof(info->text), "%lu (%i) %i/%i", info->crc, info->counter * s_chunk_size, info->counter, num_chunks); text_la...
static void close_sessions(void) { for (int i = 0; i < 3; ++i) { data_logging_finish(s_data.info[i].logging_session); s_data.info[i].logging_session = NULL; } text_layer_set_text(&s_data.log_layer, "Closed all logging sessions."); } static void start_logging(void) { const uint8_t item_size[] = {4, 2,...
0 }; Line line = (Line) { 0 }; // Allocate immutable types bool success = false; const char *sentence = "Foo bar"; const Utf8Bounds utf8_bounds = utf8_get_bounds(&success, sentence); cl_assert(success); const TextBoxParams text_box_params = (TextBoxParams) { .utf8_bounds = &utf8_bounds, // Wi...
(iter_next(&word_iter))
; cl_assert(!line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params)); cl_assert(line.height_px == 10); cl_assert(line.width_px == 2 * HORIZ_ADVANCE_PX); cl_assert(!line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params)); cl_assert(!line_add_word(&s_ctx, &line, &word_iter_...
gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)
); } void test_health_hr_summary_card__render_current_bpm(void) { HealthData health_data = { .current_hr_bpm = 110, }; prv_create_card_and_render(&health_data); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_health_hr_summary_card__render_timestamp(void) { rtc_set_time(SECONDS...
/* * 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...
(&launcher_event)
; } void notifications_handle_notification_removed(Uuid *notification_id) { Uuid *removed_id = kernel_malloc_check(sizeof(Uuid)); *removed_id = *notification_id; PebbleEvent launcher_event = { .type = PEBBLE_SYS_NOTIFICATION_EVENT, .sys_notification = { .type = NotificationRemoved, .notificat...
ime(); const time_t difference = timestamp - now; size_t starts_len = 0; if (difference <= SECONDS_PER_HOUR * max_relative_hrs && time_util_get_midnight_of(now) == time_util_get_midnight_of(timestamp)) { const char *starts = i18n_get("STARTS ", layout); // Freed by `timeline_layout_deinit` starts_le...
layout_create_text_node_from_config( layout_ref, &s_broadcaster_header_config.text.extent.node)
(T-11:30:00) rtc_set_time(event_time - (12 * SECONDS_PER_HOUR) + (30 * SECONDS_PER_MINUTE)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("IN 11 H", time_buf); // June 12th 2015, 00:30:01 (T-11:29:59) rtc_set_time(event_time - (12 * SECONDS_PER...
rtc_set_time(event_time + (59 * SECONDS_PER_MINUTE) + 30)
; clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("59 MIN AGO", time_buf); // June 9th 2015, 12:59:58 (T+00:59:58) rtc_set_time(event_time + (59 * SECONDS_PER_MINUTE) + 58); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, ...
{ if (!is_legacy2) { bool tint_icon = (icon && (gbitmap_get_format(icon) == GBitmapFormat1Bit)); if (tint_icon) { graphics_context_set_compositing_mode(ctx, GCompOpTint); } else if (ctx->draw_state.compositing_mode == GCompOpAssign) { graphics_context_set_compositing_mode(ctx, GCompOpSet); ...
static void prv_menu_cell_basic_draw_custom_rect( GContext *ctx, const Layer *cell_layer, const MenuCellLayerConfig *config) { const GRect *bounds = &cell_layer->bounds; const bool is_legacy2 = process_manager_compiled_with_legacy2_sdk(); const GFont title_font = prv_get_cell_title_font(config); const in...
/* * 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_origin_y_to_area(current_y, &state->area)
; state->event_info = (EventServiceInfo) { .type = PEBBLE_UNOBSTRUCTED_AREA_EVENT, .handler = prv_handle_unobstructed_area_event, .context = state, }; event_service_client_subscribe(&state->event_info); } void unobstructed_area_service_deinit(UnobstructedAreaState *state) { PBL_ASSERTN(state); ev...
platform_type_get_name(process_metadata_get_app_sdk_platform(app_md)); PBL_LOG(LOG_LEVEL_DEBUG, "Starting %s app <%s>", app_type, process_metadata_get_name(app_md)); // new logging only allows for 2 %s per format string... PBL_LOG(LOG_LEVEL_DEBUG, "Starting app with sdk platform %s", sdk_platform); } #define A...
memory_segment_split(&app_ram, &app_segment, app_segment_size)
); PBL_ASSERTN(memory_segment_split(&app_segment, NULL, stack_guard_size)); // No (accessible) memory segments can be placed between the top of APP_RAM // and the end of stack. Stacks always grow towards lower memory addresses, so // we want a stack overflow to touch the stack guard region before it begins //...
{ periph_config_enable(RCC_APB1PeriphClockCmd, RCC_APB1Periph_TIM3); // Standard peripheral functions are too big so toggle the registers manually: // Scale timer to roll over once per second TIM3->CR1 = TIM_CounterMode_Up | TIM_CKD_DIV1 | TIM_CR1_ARPE; // Prescaler divides by PSC + 1, which gives us 64000...
prv_display_write_byte(line[i])
mode = mode; layer_mark_dirty(&(status_bar_layer->layer)); } void status_bar_layer_set_separator_load_percentage(StatusBarLayer *status_bar_layer, int16_t percentage) { PBL_ASSERTN(status_bar_layer); // TODO: animation related function layer_mark_dirty(&(status_b...
(ctx, config->foreground_color)
endif return graphics_text_layout_get_text_height(ctx, item->label, font, box.size.w, GTextOverflowModeWordWrap, PBL_IF_ROUND_ELSE(GTextAlignmentCenter, GTextAlignmentLeft)); } // Item Scroll Animation /////////////////////////////////// static int16_t prv_get_cell_offset(void *subject) { ActionMenuLayer *a...
animation_set_handlers((Animation *)s_animation, (AnimationHandlers){0}, aml)
; // Create the reverse animation that takes us from the scrolled up position back down PropertyAnimation *r_animation = property_animation_create(&s_item_animation_implementation, (void *)aml, &item_animation->top_offset_y, &item_animation->bottom_offset_y); animation_set_duration((Animat...
al_number)); strncpy(versions_msg.iso_locale, i18n_get_locale(), ISO_LOCALE_LENGTH - 1); versions_msg.iso_locale[ISO_LOCALE_LENGTH - 1] = '\0'; versions_msg.lang_version = htons(i18n_get_version()); PBL_LOG(LOG_LEVEL_DEBUG, "Sending lang version: %d", versions_msg.lang_version); // Set the capabilities as z...
(buffer, sizeof(buffer), "Build Id:%s", build_id_string)
; char serial_number[MFG_SERIAL_NUMBER_SIZE + 1]; mfg_info_get_serialnumber(serial_number, sizeof(serial_number)); char hw_version[MFG_HW_VERSION_SIZE + 1]; mfg_info_get_hw_version(hw_version, sizeof(hw_version)); const uint32_t* mcu_serial = mcu_get_serial(); prompt_send_response_fmt(buffer, sizeof(buff...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
for (int i = 0; i < num_elements; ++i) { cl_assert_equal_i(b->bytes_written, i * sizeof(test_data)); cl_assert_equal_i(buffer_get_bytes_remaining(b), buffer_size - (i * sizeof(test_data))); bytes_written += buffer_add(b, (uint8_t *) test_data, sizeof(test_data)); cl_assert_equal_i(bytes_written, (i + 1)...
cl_assert(buffer_get_bytes_remaining(b) > 0); bytes_written = buffer_add(b, (uint8_t *) test_data, sizeof(test_data)); cl_assert_equal_i(bytes_written, 0); free(b); } void test_buffer__cannot_remove_beyond_written(void) { Buffer *b = buffer_create(5); cl_assert_equal_i(0, buffer_remove(b, 0, 0)); cl_a...
nclude "applib/rockyjs/api/rocky_api_global.h" #include "applib/rockyjs/api/rocky_api_datetime.h" #include "applib/rockyjs/pbl_jerry_port.h" // Standard #include <string.h> // Fakes #include "fake_app_timer.h" #include "fake_time.h" // Stubs #include "stubs_app_manager.h" #include "stubs_app_state.h" #include "stubs...
EXECUTE_SCRIPT("s = d.toLocaleTimeString(undefined, {hour: 'numeric'});")
; ASSERT_JS_GLOBAL_EQUALS_S("s", "8 PM"); EXECUTE_SCRIPT("s = d.toLocaleTimeString(undefined, " "{hour: 'numeric', hour12: true});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "8 PM"); EXECUTE_SCRIPT("s = d.toLocaleTimeString(undefined, " "{hour: 'numeric', hour12: false});"); ASSERT_JS...
ob_db/weather_db.h" #include "services/normal/weather/weather_types.h" #include "system/logging.h" #include "system/passert.h" static int prv_weather_data_list_node_comparator(void *a, void *b) { return ((WeatherDataListNode *)b)->id - ((WeatherDataListNode *)a)->id; } typedef struct WeatherDBIteratorContext { We...
{ uuid_to_string(key, key_string_buffer); PBL_LOG(LOG_LEVEL_WARNING, "Could not create forecast from %s's entry", key_string_buffer); task_free(node); return; }
ListNode *to_add = (ListNode *)node; list_init(to_add); const bool ascending = true; iterator_context->head = (WeatherDataListNode *)list_sorted_add((ListNode *)iterator_context->head, to_add, prv_weather_data_l...
me(1421445600); head = NULL; timeline_init(&head); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionPast, 1421445600), S_NO_MORE_ITEMS); cl_assert_equal_i(fake_pbl_malloc_num_net_allocs(), 0); } static void prv_inse...
uuid_equal(&state.pin.header.id, &s_items[1].header.id)
); } void test_timeline__all_day_past(void) { prv_insert_all_day_items(); Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; TimelineItem earlier_item = { .header = { .id = {0x04}, .parent_id = {0}, .timestamp = 1421049600 + 9 * 60 * 60, // 9am on Jan 12...
>rectr.size.h > data->window.layer.bounds.size.h) { data->rectr_velocity_y = data->rectr_velocity_y * -1; } } else if (shape == CIRCLE) { // Move the line X per Y data->circle_origin.x += (data->circle_velocity_x * PIXEL_SPEED_PER_FRAME); if (data->circle_origin.x - data->circle_radi...
if (shape == CIRCLE) { graphics_context_set_fill_color(ctx, data->circle_color); graphics_context_set_stroke_color(ctx, data->circle_color); graphics_draw_circle(ctx, data->circle_origin, data->circle_radius); } else if (shape == GPATH_TRIANGLE) { gpath_draw_outline(ctx, data->triangle); ...
HOUR)); clock_get_until_time(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("Yesterday, 4:00 PM", time_buf); // June 9th 2015, 02:00:00 (T-14:00:00) rtc_set_time(event_time - (14 * SECONDS_PER_HOUR)); clock_get_until_time(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS...
cl_assert_equal_s("Jun 9, 16:00", time_buf); }
void test_clock__month_named_date(void) { char time_buf[64]; const time_t jun10th_noon_2015 = 1433937600; prv_clock_reset(0); rtc_set_time(jun10th_noon_2015); // Our test event is at June 9th 2015, 16:00:00 // Now - one day const time_t event_time = jun10th_noon_2015 - SECONDS_PER_DAY + (4 * SECONDS...
VIBE_HOLDOFF_TICKS); cl_assert(!alerts_should_enable_backlight_for_type(AlertMobile)); cl_assert(alerts_should_notify_for_type(AlertReminder)); cl_assert(!alerts_should_vibrate_for_type(AlertReminder)); alerts_set_notification_vibe_timestamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_T...
cl_assert(!alerts_should_notify_for_type(AlertMobile))
; cl_assert(!alerts_should_vibrate_for_type(AlertMobile)); alerts_set_notification_vibe_timestamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS); cl_assert(!alerts_should_enable_backlight_for_type(AlertMobile)); cl_assert(!alerts_should_notify_for_type(AlertReminder)); cl_assert(!...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ PBL_ASSERTN(len < buffer_size); bt_dialog->text_buffer = text_buffer; bt_dialog->owns_buffer = false; }
stationary_handle_battery_connection_change_event(); #endif return; } case PEBBLE_BATTERY_STATE_CHANGE_EVENT: battery_monitor_handle_state_change_event(e->battery_state.new_state); #if CAPABILITY_HAS_MAGNETOMETER ecompass_handle_battery_state_change_event(e->battery_state.new_state); #...
kernel_le_client_handle_event(e)
; return; case PEBBLE_COMM_SESSION_EVENT: { PebbleCommSessionEvent *comm_session_event = &e->bluetooth.comm_session_event; debounced_connection_service_handle_event(comm_session_event); put_bytes_handle_comm_session_event(comm_session_event); #ifndef RECOVERY_FW if (comm_session_event...
prv_spi_send_data(slave->spi_bus, *(cptr++)); prv_spi_transmit_flush_blocking(slave->spi_bus); } } void spi_ll_slave_burst_read_write(const SPISlavePort *slave, const void *out, void *in, size_t len) { ...
PBL_ASSERTN(slave->slave_state->initialized)
; PBL_ASSERTN(slave->slave_state->acquired); prv_spi_dma_cmd(slave->spi_bus, SpiI2sDma_ReqTx, false); slave->slave_state->dma_complete_handler = NULL; slave->slave_state->dma_complete_context = NULL; } void spi_ll_slave_read_write_dma_start(const SPISlavePort *slave, const void *out, void *in, ...
dest_str += length; left -= length; fmt = ptr + 1; // End of string if (*ptr == '\0' || *fmt == '\0') { break; } char pad = '\0'; size_t width = 0; // Process flags // These are the only ones our old impl cared about. if (*fmt == '0' || *fmt == '+') { pad = *fmt...
prv_iso8601_year(t)
, 4, INTFMT_PADZERO); break; case 'H': FMT_INTCOPY(t->tm_hour, 2, INTFMT_PADZERO); break; case 'I': FMT_INTCOPY(hour_12h, 2, INTFMT_PADZERO); break; case 'j': FMT_INTCOPY(t->tm_yday+1, 3, INTFMT_PADZERO); break; case 'k': // TZ FMT_...
ert_item(&item2)); cl_assert_equal_i(S_SUCCESS, reminder_db_insert_item(&item1)); cl_assert_equal_i(S_SUCCESS, reminder_db_insert_item(&item3)); } // Setup //////////////////////////////////////////////////////////////// void test_reminder_db__initialize(void) { reminder_db_init(); } void test_reminder_db__c...
(sizeof(SerializedTimelineItemHeader) == reminder_db_get_len((uint8_t*) &item1.header.id, sizeof(TimelineItemId)))
; cl_assert(sizeof(SerializedTimelineItemHeader) == reminder_db_get_len((uint8_t*) &item2.header.id, sizeof(TimelineItemId))); cl_assert(sizeof(SerializedTimelineItemHeader) == reminder_db_get_len((uint8_t*) &item3.header.id, sizeof(TimelineItemId))); } void test_reminder_db__wrong_type_test(void) { TimelineIt...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_LOG_SYNC(LOG_LEVEL_WARNING, "System task callback: %p", current_cb)
; reboot_reason->watchdog.stuck_task_callback = (uint32_t)current_cb; } static void prv_log_stuck_task(RebootReason *reboot_reason, PebbleTask task) { TaskHandle_t *task_handle = pebble_task_get_handle_for_task(task); void *current_lr = (void*) ulTaskDebugGetStackedLR(task_handle); void *current_pc = (void*) u...
{ 1096, -80, -112}, { 840, -128, -192}, { 960, -64, -184}, { 1264, -16, -72}, { 1560, 168, -152}, { 1472, 264, -72}, { 1624, 344, -64}, { 1720, 400, -16}, { 1992, 528, 64}, { -1984, 720, 120}, { 1848, 832, 136}, { 1256, 912, 112}, { 1080, 480, -184}, { 896, 504, ...
{ // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_ron_1 //> TEST_EXPECTED 100 //> TEST_EXPECTED_MIN 90 //> TEST_EXPECTED_MAX 120 //> TEST_WEIGHT 1.0 static AccelRawData samples[] = { // elapsed: 0 minutes { 176, -144, -984}, { 176, -120, -968}, { ...
{ 520, -96, -784}, { 544, -72, -808}, { 584, -72, -824}, { 560, -96, -736}, { 648, -8, -712}, { 872, 88, -704}, { 912, 136, -536}, { 832, 256, -520}, { 848, 288, -464}, { 888, 288, -424}, { 880, 208, -360}, { 848, 208, -312}, { 864, 208, -264}, { 872, 176, -120},...
-176, -912}, { -128, -160, -896}, { -136, -152, -912}, { -128, -120, -968}, { -120, -80, -1032}, { -128, -56, -1072}, { -152, 40, -1184}, { -48, 272, -1392}, { 72, 240, -1416}, { -80, 104, -1136}, { -200, 296, -1008}, { -168, 304, -1008}, { -32, 248, -1048}, { -72, 1...
{ 1560, 496, -344}, { 1496, 496, -216}, { 1424, 376, -232}, { 1304, 280, -360}, { 1344, 752, -504}, { 1240, 1048, -736}, { 1056, 688, -576}, { 1280, 776, -552}, { 856, 448, -480}, { 1008, 200, -280}, { 1424, 472, -112}, { 1760, 456, -144}, { 1728, 440, -280}, { 16...
{ -416, 64, -80}, { -544, 80, -72}, { -728, 136, 72}, { -888, 56, 40}, { -1080, -40, -152}, { -1344, -56, -224}, { -1328, -144, -264}, { -1424, 56, -408}, { -1400, 16, -288}, { -1216, 472, -96}, { -816, 648, -312}, { -592, 368, -280}, { -568, 216, -296}, { -520, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_s(dstbuf, "There are +4 lights, the absolute value of -4")
; // Minimum digits output snprintf(dstbuf, 256, "There are %.2d lights, %.2d", 4, -4); cl_assert_equal_s(dstbuf, "There are 04 lights, -04"); // Minimum digits output (zero digits) snprintf(dstbuf, 256, "%.0dzero%.0d", 0, 1); cl_assert_equal_s(dstbuf, "zero1"); // Minimum digits output (unspecified di...
tart_hrm_kernel_main(void *unused) { PBL_LOG(LOG_LEVEL_INFO, "BLE HRM sharing started"); s_ble_hrm_session.service_info = (EventServiceInfo) { .type = PEBBLE_HRM_EVENT, .handler = prv_ble_hrm_handle_hrm_data, }; event_service_client_subscribe(&s_ble_hrm_session.service_info); s_ble_hrm_session.manager...
prv_get_permission_by_device(&connection->device)
== permission) { return; } const bool prev_is_sharing = prv_is_sharing(connection); prv_upsert_permission(&connection->device, permission); prv_update_is_sharing(connection, prev_is_sharing); } static void prv_disconnect_to_kill_subscription(GAPLEConnection *connection) { // Unfortunately, GATT does not...
/* * 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(!error)
lues[1], 33); cl_assert_equal_i(activity_metrics_prv_get_active_calories(), 22 * ACTIVITY_CALORIES_PER_KCAL); activity_metrics_prv_set_metric(ActivityMetricRestingKCalories, Thursday, 2000); activity_metrics_prv_set_metric(ActivityMetricRestingKCalories, Wednesday, 44); activity_get_metric(ActivityMetricRestin...
activity_sessions_is_session_type_ongoing(ActivitySessionType_Sleep)
); cl_assert_equal_i(0, health_service_peek_current_activities()); // Start on known boundary struct tm start_tm = { // Jan 1, 2015, 5am .tm_hour = 5, .tm_mday = 1, .tm_mon = 0, .tm_year = 115 }; time_t utc_sec = mktime(&start_tm); rtc_set_time(utc_sec); // Add a Sleep session cons...
cations_ancs_notifications_count(), 2); // // // Fall back asleep, make sure we get the reward // s_data.metric_history[ActivityMetricSleepState][0] = ActivitySleepStateLightSleep; // activity_insights_process_sleep_data(rtc_get_time()); // s_data.metric_history[ActivityMetricSleepState][0] = ActivitySleepStateAwak...
(ACTIVE_MINUTES)
; cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 0); } void test_activity_insights__activity_reward_trigger(void) { prv_set_step_history_avg(); activity_insights_init(rtc_get_time()); // This would trigger the insights if they weren't disabled s_data.steps_per_minute = 80; ...
{ -1240, 304, -48}, { -1200, 360, -48}, { -944, 384, -48}, { -664, 344, -24}, { -496, 336, -48}, { -488, 304, -8}, { -472, 208, 88}, { -456, 112, 88}, { -504, 112, 104}, { -528, 128, 144}, { -856, 224, 112}, { -1016, 248, 72}, { -1248, 360, 8}, { -1488, 400, -32}...
{ -784, 552, -72}, { -928, 568, -200}, { -1096, 576, -192}, { -1432, 512, -224}, { -1320, 440, -232}, { -1168, 1120, 72}, { -1064, 1248, 312}, // 39 seconds { -1144, 1248, 600}, { -912, 896, 344}, { -568, 392, 496}, { -568, 232, 480}, { -392, 288, 184}, { -304, 18...
{ -480, 264, 56}, { -536, 256, 72}, { -608, 304, 72}, { -696, 336, 40}, { -928, 360, 56}, { -944, 288, 64}, { -1328, 496, -64}, { -1184, 432, -136}, { -1064, 448, -272}, { -1016, 472, -336}, { -728, 392, -352}, { -368, 168, -304}, { -304, 168, -256}, { -320, 80, ...
/* * 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(s_mfg_mode_entered)
/* * 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_lock(); { PBL_ASSERTN(s_pra_cycling_pause_count); --s_pra_cycling_pause_count; if (s_pra_cycling_pause_count == 0) { PBL_LOG(LOG_LEVEL_INFO, "Resuming address cycling (pinned_addr="BT_DEVICE_ADDRESS_FMT")", BT_DEVICE_ADDRESS_XPLODE(s_pinned_addr)); prv_allow_cycling(true);...
void bt_local_addr_pin(const BTDeviceAddress *addr) { // In a previous version of the code, the main FW would not know yet what address would be used // for pinning until the BT driver would give the address to pin when a pairing was added. // A single, persistent pinned address is now generated up front in bt_...
RIu64" ms: Executing setup handler for %d\n", prv_now_ms(), (int)animation); } // -------------------------------------------------------------------------------------- // teardown handler void prv_teardown_handler(Animation *animation) { prv_add_handler_entry(&s_teardown_handler_calls, animation, false, NULL); DP...
(h != NULL)
; void *context = h; animation_set_handlers(h, handlers, context); animation_set_implementation(h, &implementation); return h; } // -------------------------------------------------------------------------------------- // Setup. Called before each of the tests execute void test_animation__initialize(void) {...
g_alloc_and_copy(json_str); cl_assert_equal_s(json_c_str, "{}"); task_free(json_c_str); } void test_rocky_api_app_message__json_parse(void) { JS_VAR number = prv_json_parse("1"); cl_assert(jerry_value_is_number(number)); cl_assert_equal_d(jerry_get_number_value(number), 1.0); JS_VAR object = prv_json_pars...
rocky_api_app_message_get_state()
, PostMessageStateSessionOpen); } void test_rocky_api_app_message__post_message_multi_chunk(void) { prv_init_and_goto_session_open_with_tiny_buffers(); EXECUTE_SCRIPT("var x = { \"x\" : 123 }; _rocky.postMessage(x);"); const char * const expected_json = "{\"x\":123}"; const size_t expected_json_size = strlen...
_size.h" #include "applib/tick_timer_service.h" #include "applib/ui/app_window_stack.h" #include "applib/ui/property_animation.h" #include "applib/ui/ui.h" #include "kernel/pbl_malloc.h" #include "kernel/ui/system_icons.h" #include "services/common/clock.h" #include "services/common/i18n/i18n.h" #include "services/norm...
GRect(config->horizontal_margin, config->title_field.origin_y, prv_text_layer_width(), config->title_field.size_h)
/* * 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...
for (unsigned int i = 0; i < ARRAY_LENGTH(s_receive_buffers); ++i) { if (s_receive_buffers[i]->taken == false) { buf = s_receive_buffers[i]; buf->taken = true; prv_reset_receive_buffer(buf); return buf; } }
return NULL; } static void prv_return_receive_buffer(IncomingPulseFrame *buf) { buf->taken = false; } static void prv_keepalive_timeout_expired(void *data) { pulse_end(); } static void prv_reset_keepalive_timer(void) { if (s_keepalive_timer) { new_timer_start(s_keepalive_timer, PULSE...
eBPM, threshold, &state->cache->alert_threshold_heart_rate); return (void *)HealthMetricHeartRateBPM; default: return NULL; } #endif } // ---------------------------------------------------------------------------------------------- bool health_service_cancel_metric_alert(...
(ActivityMetricSleepState, 1, &sleep_state)
) { return HealthActivityNone; } HealthActivityMask result = HealthActivityNone; if (sleep_state == ActivitySleepStateLightSleep) { result |= HealthActivitySleep; } // yes, when sleeping restful, there's also always an activity of HealthActivitySleep // when calling health_service_activities_iterat...
TypeBaud = 3, NumLinkControlTypes } LinkControlType; typedef enum { LinkControlStatusOk = 0, LinkControlStatusBaudRate = 1, LinkControlStatusDisconnect = 2 } LinkControlStatus; static const AccessoryBaud BAUDS[] = { AccessoryBaud9600, AccessoryBaud14400, AccessoryBaud19200, AccessoryBaud28800, Acces...
if ((profiles[i] > SmartstrapProfileInvalid) && (profiles[i] < NumSmartstrapProfiles) && (profiles[i] != SmartstrapProfileLinkControl)) { // handle the valid profile s_profiles |= (1 << profiles[i]); }
} if (s_profiles == 0) { PBL_LOG(LOG_LEVEL_WARNING, "No profiles specified"); smartstrap_link_control_disconnect(); success = false; } else { prv_do_send(LinkControlTypeStatus); } } else { // length is invalid (should be an even multiple of the size of ...
1, 13), 3686400, 5, &GPointZero, 10, -5, true); } void test_touch__handle_update_position(void) { touch_set_touch_state(0, TouchState_FingerDown, GPointZero, 3686380, 0); touch_handle_update(0, TouchState_FingerDown, &GPoint(10, 10), 5, 3686400); PebbleEvent event = fake_event_get_last(); ...
(0, TouchState_FingerDown, &GPoint(10, 10), 5, 3686400)
; TouchEvent *touch_event = touch_event_queue_get_event(0, 0); prv_test_touch_event(touch_event, 0, TouchEvent_PositionUpdate, &GPointZero, 3686380, 0, &GPoint(10, 10), 20, 5, true); touch_handle_update(0, TouchState_FingerDown, &GPoint(13, 13), 6, 3686420); touch_event = touch_event_que...
intf(dstbuf, 256, "You know Bagu? %+s", "Then I can let you cross"); cl_assert_equal_s(dstbuf, "You know Bagu? Then I can let you cross"); // Variable length character output snprintf(dstbuf, 256, "You know Bagu? %*s", 25, "Then I can let you cross"); cl_assert_equal_s(dstbuf, "You know Bagu? Then I can let y...
(hntest[0], 280)
; cl_assert_equal_i(hntest[1], 0); lntest[0] = lntest[1] = 0; snprintf(dstbuf, 512, "aaaa aaaa aaaa aaaa " // 0- 20 "aaaa aaaa aaaa aaaa " // 20- 40 "aaaa aaaa aaaa aaaa " // 40- 60 "aaaa aaaa aaaa aaaa " // 60- 80 "...
24, 456, 72}, { 1056, 288, 72}, { 1200, 144, 192}, { 1416, 128, 248}, { 1072, 88, 184}, { 864, 80, 152}, { 880, 32, 136}, { 840, -24, 120}, { 760, -16, 32}, // 19 seconds { 768, -64, 32}, { 848, -120, -32}, { 984, -40, -88}, { 1328, -216, -48}, { 1576, -80, 152}, ...
{ 1456, -184, 8}, { 1520, 80, 72}, { 1472, 336, -128}, { 1376, 416, -112}, { 976, 344, 96}, { 760, 240, 72}, { 792, 192, 128}, { 888, 264, 104}, { 896, 320, 88}, { 856, 360, -32}, { 928, 392, -128}, { 1152, 616, -376}, { 1256, 392, -152}, { 1480, 384, 16}, // ...
{ 1184, 232, 104}, { 1336, 112, 200}, { 1160, 104, 208}, { 912, 112, 136}, { 848, 80, 112}, { 784, 32, 72}, { 704, -8, -24}, { 760, -64, -24}, { 856, -176, 112}, { 984, -16, 16}, { 1072, -32, 56}, { 1656, -16, 136}, { 1440, 216, 80}, { 1224, 392, -112}, { 112...
char status_text[STATUS_TEXT_SIZE]; FlashTestCaseType test_case; uint8_t test_case_status; }; /***********************************************************/ /******************* Window Related Functions **************/ /***********************************************************/ static void handle_timer(struct t...
(msg_text_layer, GColorBlack)
; text_layer_set_text_color(msg_text_layer, GColorWhite); text_layer_set_font(msg_text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_14_BOLD)); layer_add_child(&window->layer, &msg_text_layer->layer); TextLayer *status_text_layer = &data->status_text_layer; text_layer_init(status_text_layer, &GRect(0, 106, wi...
PACKED { uint32_t init_req_magic; uint32_t append_offset; } InitRequestExtraInfo; typedef struct PACKED { PutBytesCommand cmd:8; uint32_t total_size; PutBytesObjectType type:7; bool has_cookie:1; union { struct { const uint8_t index; ///< The 0-indexed position for 'banked' objects. char ...
taskENTER_CRITICAL()
repare_next_packet(client, &heap_packet, &payload_size))) { ++loop_count; const BTErrno e = gatt_client_op_write_without_response(client->characteristics.data, (const uint8_t *) packet, sizeof...
{ rx_ack_timer_cb(client); client = (PPoGATTClient *) client->node.next; }
}
/* * 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 (config->peek_timer == NULL) { config->peek_timer = app_timer_register(PEEK_TIMEOUT_MS, prv_peek_timeout_callback, NULL); } else { app_timer_reschedule(config->peek_timer, PEEK_TIMEOUT_MS); }
/* * 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...
{ *is_dirty_out = (list_find((ListNode *)storage->entries, prv_find_dirty, NULL) != NULL); return S_SUCCESS; }
status_t ram_storage_mark_synced(RamStorage *storage, uint8_t *key, int key_len) { RamStorageEntry *entry = prv_get_entry(storage->entries, key, key_len); if (entry) { entry->flags &= ~RamStorageFlagDirty; return S_SUCCESS; } return E_DOES_NOT_EXIST; } status_t ram_storage_each(RamStorage *storage, ...
/* * 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...
applib_zalloc(sizeof(KinoReelImplGBitmap))
; if (reel) { kino_reel_gbitmap_init(reel, bitmap); reel->owns_bitmap = take_ownership; } return (KinoReel *)reel; } KinoReel *kino_reel_gbitmap_create_with_resource(uint32_t resource_id) { ResAppNum app_num = sys_get_current_resource_num(); return kino_reel_gbitmap_create_with_resource_system(app_n...
sure this wasn't caused due to an unrelated ANCS removal if (prv_call_is_ancs() && (s_call_identifier != event->call_identifier)) { PBL_LOG(LOG_LEVEL_INFO, "Ignoring hide call. Call identifier %"PRIu32" doesn't match %"PRIu32, s_call_identifier, event->call_identifier); return; } prv_call_end...
new_timer_create()
; } void phone_call_answer(void) { analytics_inc(ANALYTICS_DEVICE_METRIC_PHONE_CALL_ANSWER_COUNT, AnalyticsClient_System); PBL_LOG(LOG_LEVEL_INFO, "Call accepted"); if (prv_call_is_ancs()) { ancs_perform_action(s_call_identifier, ActionIDPositive); // We don't show an ongoing call UI on iOS, so from th...
s, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){1 * SECONDS_PER_MINUTE, 0, 0, 0, 0, 0, 0})); // Check that we have the expected # of activities ASSERT_NUM_ACTIVITY_SESSIONS(3); // 2 sleep sessions + 1 activity sessions ASSERT_STEP_ACTIVITY_SESSION_PRESENT(&walk_activity); // The expected resting calories ...
(actual_resting_kcalories[i], s_exp_5pm_resting_kcalories)
; } else if (i == 1) { cl_assert(actual_resting_kcalories[i] >= min_resting_kcalories && actual_resting_kcalories[i] <= exp_resting_kcalories_now); } else { cl_assert_equal_i(actual_resting_kcalories[i], exp_resting_kcalories[i]); } } } // ----------------------------------...
const uint8_t *request_payload, size_t request_payload_length) { if (!prv_check_initialized()) { return false; } HcProtocolMessage *message = prv_create_message(endpoint_id, command_id, request_payload, ...
if (!prv_check_initialized()) { return false; }
PBL_ASSERTN(!to_request->transaction_id.is_response); size_t message_length = sizeof(HcProtocolMessage) + response_payload_length; HcProtocolMessage *response = kernel_malloc_check(message_length); response->message_length = message_length; response->endpoint_id = to_request->endpoint_id; response->comman...
onsume_notification(&object_ref, value, &value_length, &has_more); if (handler) { handler(object_ref, value, value_length, 0 /* value_offset (future proofing) *...
if (!new_handler) { if (--ble_app_state->gatt_client_num_handlers == 0) { // Last GATT handler to be de-registered. // Unsubscribe from GATT Client event service: event_service_client_unsubscribe(&ble_app_state->gatt_client_service_info); } }
} return BTErrnoOK; } BTErrno ble_client_set_service_filter(const Uuid service_uuids[], uint8_t num_uuids) { // TODO return 0; } BTErrno ble_client_set_service_change_handler(BLEClientServiceChangeHandler handler) { const off_t offset = offsetof(BLEAppState, gatt_servi...
t *counts = task_zalloc(255); settings_file_each(&file, prv_each_cb, counts); for (int i = 0; i < 255; i++) { cl_assert_equal_i(counts[i], 1); } task_free(counts); } static const uint8_t STOPPING_NUM = 117; static bool prv_each_cb_quit_early(SettingsFile *file, SettingsRecordInfo *info, ...
cl_must_pass(settings_file_open(&file, "test_no_move", 4096))
; uint8_t key[5]; int key_len = 4; uint8_t val[5]; int val_len = 4; const int NUM_RECORDS = 128; // First, fill half the file up with random keys and values. This reduces // our usable space to slightly less than 2048 bytes. for (int i = 0; i < NUM_RECORDS; i++) { snprintf((char *)key, sizeof(key...
ge_flags, PAGE_FLAG_START_PAGE)) { if (!is_create_complete(curr_pg)) { // make sure file creation completed PBL_LOG(LOG_LEVEL_WARNING, "File at %d creation did not complete ", curr_pg); unlink_flash_file(curr_pg); } else if (is_tmp_file(curr_pg)) { // make sure this isn't a temp ...
kernel_free(callback_node)
; mutex_unlock_recursive(s_pfs_mutex); } // IMPORTANT: This call assumes that the caller has already grabbed s_pfs_mutex static void prv_invoke_watch_file_callbacks(const char* file_name, uint8_t event) { PFSFileChangedCallbackNode *callback_node = (PFSFileChangedCallbackNode *)s_hea...
will reset this algorithm. if (boot_bit_test(BOOT_BIT_FW_START_FAIL_STRIKE_TWO)) { // Yikes, our firmware is screwed. Boot into recovery mode. dbgserial_putstr("Failed to start firmware, strike three."); boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_ONE); boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_T...
{ dbgserial_putstr("PMIC woke from standby due to charger disconnect"); dbgserial_putstr("Putting PMIC back into standby"); pmic_power_off(); }
flash_init(); button_init(); display_init(); display_boot_splash(); #ifdef DISPLAY_DEMO_LOOP while (1) { for (int i=0; i < 92; ++i) { display_firmware_update_progress(i, 91); delay_us(80000); } for (uint32_t i=0; i <= 0xf; ++i) { display_error_code(i * 0x11111111); dela...
ub_idx--; if (sub_idx == ModalPriorityInvalid) { break; } cl_assert_equal_i(window_stack_count(window_stacks[sub_idx]), 1); cl_assert_equal_i(windows[sub_idx]->on_screen, false); } while (true); } while (idx < NumModalPriorities - 1); } void test_window_stack__modal_properties_tra...
(windows[3][0]->is_click_configured, true)
; cl_assert_equal_i(windows[2][1]->on_screen, false); cl_assert_equal_i(windows[2][1]->is_click_configured, false); cl_assert_equal_p(s_last_click_configured_window, windows[3][0]); // Add priority 3 transparent window 1 window_set_transparent(windows[3][1], true); window_stack_push(window_stacks[3], windo...
d. bool successful = comm_session_send_data(comm_session_get_system_session(), APP_FETCH_ENDPOINT_ID, (uint8_t*)request, sizeof(AppFetchInstallRequest), COMM_SESSION_DEFAULT_TIMEOUT); // log it char uuid_buffer[UUID_STRING_BUFFER_LENGTH]; uuid_to_string(&request->uuid, uuid_buffer); PBL_LOG(LOG_LEVEL_I...
system_task_add_callback(prv_cancel_fetch_from_system_task, (void *)(uintptr_t)app_id)
; } bool app_fetch_in_progress(void) { return s_fetch_state.in_progress; } //////////////////////////// // Exported Callbacks //////////////////////////// typedef struct __attribute__((__packed__)) { uint8_t command; uint8_t result_code; } AppFetchResponseData; //! System task callback triggered by app_fetch_...
tx; uint32_t index; union { struct PACKED { ImagingHeader header; uint8_t payload[MAX_DATA_LENGTH]; uint32_t checksum; } frame; uint8_t data[MAX_FRAME_LENGTH]; }; uint32_t checksum; } ReceiveBuffer; static bool s_enabled; static TimerID s_timeout_timer; static ReceiveBuffer s_buff...
if (length) { // should be 0 PBL_LOG(LOG_LEVEL_ERROR, "Invalid length (%"PRIu32")", length); return; }
PBL_LOG(LOG_LEVEL_WARNING, "Got reset request"); prv_send_frame(OPCODE_RESET, NULL, 0); prv_stop(NULL); system_reset(); } static bool prv_coredump_flash_base(uint32_t *addr, uint32_t *size) { CoreDumpFlashHeader flash_hdr; CoreDumpFlashRegionHeader region_hdr; uint32_t max_last_used = 0; uint32_t bas...
#else if (s_has_pending_create_connection) { PBL_LOG(LOG_LEVEL_ERROR, "Already connecting..."); return; } BLE_GAP_LOG_DEBUG("Starting connecting.."); unsigned int stack_id = bt_stack_id(); // See Bluetooth Spec 4.0, Volume 2, Part E, Chapter 7.8.12: const GAP_LE_Address_Type_t local_addr_type = Ble...
memcmp(connection->irk, &intent->bonding->irk, sizeof(*connection->irk))
); } else { return bt_device_equal(&connection->device.opaque, &intent->device.opaque); } } static void prv_intent_remove_and_free(GAPLEConnectionIntent *intent) { list_remove(&intent->node, (ListNode **) &s_intents, NULL); kernel_free(intent); } static bool prv_intent_filter_by_device(ListNode *node, voi...
char __DTCM_RAM_size__[]; PBL_ASSERT((uintptr_t)src >= (RAMDTCM_BASE + (uintptr_t)__DTCM_RAM_size__) || ((uintptr_t)src + length) <= RAMDTCM_BASE, "DMA transfer will be corrupted if MCU enters sleep mode"); #endif } static void prv_request_start(DMARequest *this, void *dst, const void *src...
prv_release_controller(this->stream->controller)
; // clean up our state this->state->transfer_dst = NULL; this->state->transfer_length = 0; this->state->direct_transfer_handler = NULL; this->state->circular_transfer_handler = NULL; this->state->context = NULL; this->state->transfer_type = DMARequestTransferType_None; this->stream->state->current_req...
/* * 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...
number_window_set_value(vibe_num_window, curr_percent)
; number_window_set_max(vibe_num_window, VIBE_STRENGTH_MAX); number_window_set_min(vibe_num_window, VIBE_STRENGTH_MIN); number_window_set_step_size(vibe_num_window, scale_granularity); app_window_stack_push(number_window_get_window(vibe_num_window), true); } static void handle_deinit(void) { NumberWindow *d...
/* * 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_ERROR, "No CommSession for phone command, ending call")
; prv_put_call_disconnect_event(); } else { comm_session_send_data(session, PHONE_CTRL_ENDPOINT, buffer, length + sizeof(cmd), COMM_SESSION_DEFAULT_TIMEOUT); } } void pp_answer_call(uint32_t cookie) { prv_send_phone_command_to_handset(PhoneCmdAnswer, (uint8_t*)&cookie, sizeof(cookie)); } void pp...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ *uuid_out = item->header.id; }
timeline_item_destroy(item); } // ---------------------------------------------------------------------------------------------- void alarm_pin_remove(Uuid *alarm_id) { pin_db_delete((uint8_t *)alarm_id, sizeof(Uuid)); }
GColorBlack, GColorClear, GTextAlignmentCenter, GTextOverflowModeTrailingEllipsis); layer_add_child(window_layer, text_layer_get_layer(&data->title_text)); GRect info_text_frame = (GRect) { .size = info_text_size }; info_text_frame.origin.y = title_text_frame.origin.y...
{ settings_factory_reset_window_push(); }
finished? OTOH, this might be tricky when we're also using INT toggles to // detect a spontaneous reset of the Dialog chip. // For now, let's try to collect a core dump and then cleanly restart BLE. The root cause // will be determined later. // Also, collect an analytic to see how frequently ...
xSemaphoreCreateBinary()
; PBL_ASSERTN(s_spi_transport.semph); prv_watchdog_init(); hc_protocol_cb_dispatcher_init(); s_spi_transport.task_is_running = false; s_spi_transport.task_should_deinit = false; TaskParameters_t task_params = { .pvTaskCode = prv_host_transport_main, .pcName = "BTTrans", .usStackDepth = confi...