prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
_unlock(); } } // ------------------------------------------------------------------------------------------------- bool comm_session_is_current_task_send_next_task(CommSession *session) { if (session->transport_imp->schedule) { return session->transport_imp->is_current_task_schedule_task(session->transport);...
{ // On Android + SPP, we can expect one Hybrid session, so we assume that the found session is // the hybrid one. // On iOS + iAP, we can expect at most one App session, so we assume that the found session is // the app one. if (ctx->fallback_session) { PBL_LOG(LOG_LEVEL_ERROR, "Fallback sess...
return false; } static CommSession *prv_get_app_session(void) { const Uuid *app_uuid = &app_manager_get_current_app_md()->uuid; if (uuid_is_system(app_uuid) || uuid_is_invalid(app_uuid)) { return NULL; } FindByAppUUIDContext ctx = (FindByAppUUIDContext) { .app_uuid = app_uuid, }; // Try most spe...
/* * 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_window_stack_push(&data->window, true /* Animated */)
; // Init text layer Layer *windowlayer = &data->window.layer; const int16_t width = windowlayer->bounds.size.w - ACTION_BAR_WIDTH - 6; text_layer_init(&data->count_layer, &GRect(0, 0, width, 20)); layer_add_child(&data->window.layer, &data->count_layer.layer); text_layer_init(&data->connected_layer, &GRec...
/* * 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...
{ uint8_t some_addr; GBitmap bmp = { .addr = &some_addr, .row_size_bytes = 123, .bounds = GRect(1, 2, 3, 4), .info.format = GBitmapFormat8Bit, }; cl_assert_equal_i(123, gbitmap_format_get_row_size_bytes(123, GBitmapFormat8Bit)); cl_assert_equal_i(123, gbitmap_get_bytes_per_row(&bmp));...
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, .min_x = 8, .max_x = 9}, // 2 // 0 {.offset = 10, .min_x = 11...
te = state; prv_update_ui_state(data, true); } static void prv_action_bar_revert(void *context) { MusicAppData *data = context; data->action_bar_revert_timer = NULL; prv_set_action_bar_state(data, ActionBarStateSkip); } static void reset_action_bar_revert_timer(MusicAppData *data) { app_timer_reschedule(dat...
window_long_click_subscribe(BUTTON_ID_DOWN, 0, prv_volume_long_click_start_handler, prv_volume_long_click_end_handler)
; window_long_click_subscribe(BUTTON_ID_SELECT, 0, prv_play_pause_long_click_start_handler, prv_play_pause_long_click_end_handler); } static void prv_volume_click_config_provider(void *context) { window_single_repeating_click_subscribe(BUTTON_ID_UP, VOLUME_REPEAT_INTERVAL_MS, ...
t_color(&ctx, GColorBlack); graphics_draw_text(&ctx, "jja", &s_font_info, RECT_NULL, GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL); cl_check(framebuffer_is_empty("draw_text_null", fb, GColorWhite)); setup_test_aa_sw(&ctx, fb, RECT_TEXT_0_0, RECT_TEXT_0_0, false, 1); graphics...
(framebuffer_is_empty("draw_text_null_null", fb, GColorWhite))
; } void test_graphics_draw_text_8bit__color(void) { GContext ctx; prv_setup_resources(); uint32_t gothic_18_handle = RESOURCE_ID_GOTHIC_18_BOLD; cl_assert(text_resources_init_font(0, gothic_18_handle, 0, &s_font_info)); test_graphics_context_init(&ctx, fb); setup_test_aa_sw(&ctx, fb, GRect(0, 0, 144, ...
GRect *first_icon_frame_out, GRect *second_icon_frame_out) { GRect first_icon_frame; GRect second_icon_frame; timeline_layer_get_icon_frame(timeline_layer, TIMELINE_LAYER_FIRST_VISIBLE_LAYOUT, &first_icon_frame); timeline_layer_get_icon_frame(timeli...
(layer, NULL, NULL)
; curr_rel_bar_anim = (Animation *)property_animation_create( &curr_implementation, layer, &curr_from_rel_bar_value, &curr_to_rel_bar_value); } else if ((layer->relbar_layer.curr_rel_bar.rel_bar_type == RelationshipBarTypeBackToBack) || (layer->relbar_layer.curr_rel_bar.rel_bar_type == Relati...
12, -216}, { -216, 888, -208}, { -224, 896, -256}, { -224, 888, -232}, { -240, 856, -200}, { -232, 872, -248}, { -224, 800, -144}, { -264, 936, -40}, // 60 seconds // elapsed: 1 minutes { -296, 880, 40}, { -280, 880, 144}, { -288, 920, 192}, { -248, 848, 296}, { -...
{ 616, 976, -576}, { 648, 720, -592}, { 184, 312, -448}, { -176, 104, -720}, { -184, -16, -824}, { -408, 40, -712}, { -168, 336, -1176}, { -176, 552, -824}, { -256, 904, -808}, { -272, 1080, -904}, { -328, 1160, -632}, { -336, 1056, -512}, { -360, 1040, -488}, { -...
{ 168, -16, -968}, { 168, -8, -976}, { 168, 8, -960}, { 184, 16, -984}, { 192, -8, -992}, { 200, 0, -1016}, { 200, -8, -992}, // 68 seconds { 216, -24, -976}, { 224, -48, -952}, { 240, -64, -944}, { 256, -64, -944}, { 264, -56, -952}, { 272, -32, -992}, { 264...
{ prompt_send_response("ERROR"); }
} #if BOOTLOADER_TEST_STAGE1 #include "bootloader_test_bin.auto.h" #include "drivers/flash.h" #include "flash_region/flash_region.h" #include "system/firmware_storage.h" #include "system/bootbits.h" #include "system/logging.h" #include "system/reset.h" #include "util/crc32.h" #include "util/legacy_checksum.h" static...
ent_queue = (void *)0x1; fake_system_task_callbacks_cleanup(); s_activity_prefs_heart_rate_is_enabled = true; s_event_count = 0; s_num_cb_events_1 = 0; s_num_cb_events_2 = 0; memset(&s_hrm_state, 0, sizeof(s_hrm_state)); hrm_manager_init(); hrm_manager_enable(true); fake_event_init(); } void test_h...
rtc_set_time(rtc_get_time() + expire_s + 1)
; // Send more data, the subscription should get expired now prv_fake_send_new_data(); cl_assert_equal_i(s_event_count, 3); cl_assert_equal_i(s_events_received[1].type, PEBBLE_HRM_EVENT); cl_assert_equal_i(s_events_received[1].hrm.event_type, HRMEvent_BPM); cl_assert_equal_i(s_events_received[2].type, PEBB...
_not_disturb_set_manually_enabled(true); do_not_disturb_set_schedule_enabled(WeekdaySchedule, true); active = do_not_disturb_is_active(); cl_assert(active == true); // !Manual && !Scheduled && Smart do_not_disturb_set_manually_enabled(false); // Overrides all DND and disables do_not_disturb_set_schedule_en...
(active == true)
; // Scheduled ON DoNotDisturbSchedule schedule_2 = { .from_hour = 5, .from_minute = 0, .to_hour = 13, .to_minute = 0, }; do_not_disturb_set_schedule(WeekdaySchedule, &schedule_2); rtc_set_time(s_thursday_12_00); do_not_disturb_handle_clock_change(); // Should still be in scheduled period ...
/* * 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_analytic_each_cb, data)
; analytics_reset_nodes(); done: hc_protocol_enqueue_response(msg, (uint8_t *)data, data_size); kernel_free(data); } #endif static void prv_handle_get_connection_event_stats(const HcProtocolMessage *msg) { SlaveConnEventStats stats; slave_window_stats_collect(&stats); hc_protocol_enqueue_response(msg, (u...
Point[]) { {-5, 10}, {5, 10}, {5, -61}, {0, -66}, {-5, -61}, }, }; void watch_model_handle_change(ClockModel *model) { MultiWatchData *data = app_state_get_user_data(); data->clock_model = *model; layer_mark_dirty(window_get_root_layer(&data->window)); } static GPointPrecise prv_gpoint_from_polar(const GP...
prv_draw_watch_hand(ctx, &face->minute_hand, center, data->minute_path)
y(s_crossing_path); gpath_destroy(s_aa_clipping_path); } // tests void test_graphics_gpath_${BIT_DEPTH_NAME}__filled(void) { GContext ctx; Layer layer; prv_reset(); s_current_path = s_house_path; test_graphics_context_init(&ctx, fb); prv_filled_update_proc(NULL, &ctx); cl_check(gbitmap_pbi_eq(&ctx.des...
(NULL, &ctx)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled_aa.${BIT_DEPTH_NAME}.pbi")); // Special case for two points that are duplicates... prv_reset(); test_graphics_context_init(&ctx, fb); s_current_path = s_single_duplicate_path; ctx.draw_state.clip_box = GRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT / 2); ...
/* * 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...
(1, s_tick_timer_service_subscribe.call_count)
/* * 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...
delay_us(7)
; GPIO_WriteBit(DISP_GPIO, DISP_PIN_SCS, Bit_RESET); // hold time > 1us // produce a delay 4ms delay_us(4); } //! These functions needed to be called around any commands that //! are sent to the display. NOINLINE only for code size savings. static NOINLINE void prv_enable_display_access(void) { prv_enable_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...
{ prv_resume_normal_operation(); }
} static void prv_standby_timer_callback(void* data) { // FIXME This is so broken: battery_state_force_update schedules a new timer callback to execute // immediately, which then pends a background task callback to perform the update, so this will // never update before we check the power_state. battery_state...
6_t x1_rounded = (x1.raw_value + FIXED_S16_3_HALF.raw_value) / FIXED_S16_3_FACTOR; const int16_t x2_rounded = (x2.raw_value + FIXED_S16_3_HALF.raw_value) / FIXED_S16_3_FACTOR; prv_assign_row_with_pattern_1bit(framebuffer, y, x1_rounded, x2_rounded - x1_rounded + 1, color); #endif } // This function draws vertical ...
if (!WITHIN(x, data_row_info.min_x, data_row_info.max_x)) { continue; }
GColor *output = (GColor *)(data_row_info.data + x); const unsigned int data_row_offset = data_row_info.data - (uint8_t *)framebuffer->addr; prv_set_color(ctx, output, data_row_offset, x, 1, gcolor_alpha_blend(color, *output)); } #else bool black = (gcolor_equal(color, GColorBlack)); for (int i = y1...
mmandTypePath, .hidden = false, .stroke_color = GColorRed, .stroke_width = 1, .fill_color = GColorBlue, .path_open = false, .num_points = 2, }; GPoint points[] = {{ 3, 97 }, {5, 5} }; memcpy(command->points, points, sizeof(points)); gdraw_command_draw(NULL, command); cl_assert_equal_i...
cl_assert_equal_i(s_path_fill_count, 1)
; cl_assert_equal_i(s_path_stroke_count, 1); cl_assert(prv_compare_points(points2, s_stroke_points, s_path_num_points)); cl_assert(prv_compare_points(points2, s_fill_points, s_path_num_points)); prv_reset(); // set path to be open gdraw_command_set_path_open(command, true); gdraw_command_draw(NULL, comma...
mmit(); break; case PutBytesAbort: prv_do_abort(); break; case PutBytesInstall: prv_do_install(request_token); break; default: // This case is unreachable due to the prv_is_invalid_command_for_current_state() test. break; } finally: prv_receiver_reset(); xSem...
(LOG_LEVEL_ERROR, "Put Bytes message too big")
; return false; } if (!s_pb_state.receiver.buffer) { if (!prv_init_put_job_queue_if_necessary()) { return false; // OOM } s_pb_state.receiver.buffer = prv_get_next_pb_job_buffer(); s_pb_state.receiver.length = 0; } if (prv_is_message_pending_processing()) { return false; } s...
uint8_t escaped_byte; } SendInfo; //! Info on the current frame being read static ReadInfo s_read_info; //! The consumer of the next frame which is read static ReadConsumer s_read_consumer; //! MBuf for storing the header when receiving static MBuf s_header_mbuf; static uint8_t s_header_data[sizeof(FrameHeader)]; //!...
if (!mbuf_iterator_write_byte(&s_read_consumer.mbuf_iter, s_read_info.footer_byte)) { // no room left to store this byte s_read_info.should_drop = true; }
} // Store this byte in the footer_byte. Note that we will still calculate the checksum on this byte // and verify that the checksum is 0 at the end, so if this byte is the actual footer byte (aka. // the checksum), we will still include it in the checksum. s_read_info.footer_byte = data; // increment the...
after we've unsubscribed return; } PBL_ASSERTN(state->data_handler != NULL || state->raw_data_handler != NULL || state->raw_data_handler_deprecated != NULL); uint16_t time_interval_ms = 1000 / state->sampling_rate; // Process in chunks to limit the amount of stack space we use up. uint32...
{ AccelServiceState * session = accel_service_private_get_session(PebbleTask_Unknown); accel_session_double_tap_subscribe(session, handler); }
// ---------------------------------------------------------------------------------------------- void accel_double_tap_service_unsubscribe(void) { AccelServiceState * session = accel_service_private_get_session(PebbleTask_Unknown); accel_session_double_tap_unsubscribe(session); } // --------------------------...
/* * 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_num_packets_sent, 1)
; cl_assert_equal_i(s_num_bytes_sent, LOG_METADATA_LENGTH + 4); cl_assert_equal_s(s_log_message_buffer, "Test"); s_num_bytes_sent = 0; pulse_logging_log(LOG_LEVEL_DEBUG, "", 0, "TestTestTestTestTest"); cl_assert_equal_i(s_num_event_puts, 0); cl_assert_equal_i(s_num_packets_sent, 2); cl_assert_equal_i(s...
size_t header_bytes_remaining) { // Try to set up a forward to the default system receiver that will send a nack back, based // on the header of the message: static const PebbleProtocolEndpoint kernel_nack_endpoint = { .endpoint_id = APP_MESSAGE_ENDPOINT_ID, .handler = app_message_app_protocol_syste...
{ prv_write(data, length); }
} static void prv_finally(AppMessageReceiver *receiver, void (*kernel_receiver_finally_cb)(Receiver *)) { kernel_receiver_finally_cb(receiver->kernel_receiver); kernel_free(receiver); } static void prv_app_message_receiver_finish(Receiver *receiver) { AppMessageReceiver *rcv = (AppMessa...
e->cached_size); const GAxis axis = prv_container(ctx->node)->axis; const GAxis max_axis = prv_get_opposite_axis(axis); ToGValue(&ctx->size)[axis] += size[axis]; ToGValue(&ctx->size)[max_axis] = MAX(ToGValue(&ctx->size)[max_axis], size[max_axis]); ctx->box.size = ctx->node->cached_size; ToGValue(&ctx->box.o...
{ return false; }
} return true; } static void prv_iter_will_draw(GTextNodeDrawContext *ctx, GTextNodeDrawContext *parent_ctx) { GTextNode *node = ctx->node; if (parent_ctx) { prv_container(parent_ctx->node)->will_draw_child(parent_ctx, node); prv_init_draw_context(ctx, node, parent_ctx->gcontext, &parent_ctx->box, par...
if_queue_operation(); } // ----------------------------------------------------------------------------- // Reset & Error Handling static void prv_reset_and_idle(void) { prv_set_state(ANCSClientStateIdle); prv_reset_reassembly_context(); } static void prv_reset_and_retry(void *unused) { if (s_ancs_client == NU...
prv_check_ancs_alive()
; } else { s_ancs_client->alive_check_pending = true; } } static void prv_is_ancs_alive_cb(void *data) { launcher_task_add_callback(prv_is_ancs_alive_launcher_task_cb, data); } // ----------------------------------------------------------------------------- //! With iOS 8.2 the pre-existing flag seems to be...
/* * 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 (!system_flash_write(FIRMWARE_BASE + i, buffer, chunk_size, NULL, NULL)) { dbgserial_putstr("We're dead"); return false; }
prv_display_write_progress(i + chunk_size, firmware_length, NULL); } return true; } static bool check_firmware_crc(FirmwareDescription* firmware_description) { dbgserial_print("Checksumming "); dbgserial_print_hex(firmware_description->firmware_length); dbgserial_print(" bytes\r\n"); const uint32_t c...
l_assert_equal_i(window_stack_count(modal_stack), 1); cl_assert_equal_i(window2->on_screen, true); cl_assert_equal_p(s_last_click_configured_window, window2); // Switch to modal happens via the compositor compositor_transition(NULL); // Call the upkeep function so the change in state is handled modal_manag...
(s_app_idle, false)
; // Assert that the window pushed onto the app stack has remained focused event = fake_event_get_last(); cl_assert_equal_i(event.type, PEBBLE_APP_WILL_CHANGE_FOCUS_EVENT); cl_assert_equal_i(event.app_focus.in_focus, true); cl_assert_equal_i(window1->on_screen, true); window_stack_remove(window1, 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...
fake_settings_file_reset()
; return S_SUCCESS; } #define APP_GLANCE_TEST_UUID \ (UuidMake(0x3d, 0xc6, 0xb9, 0x4c, 0x4, 0x2, 0x48, 0xf4, \ 0xbe, 0x14, 0x81, 0x17, 0xf1, 0xa, 0xa9, 0xc4)) // Setup //////////////////////////////////////////////////////////////// void test_app_glance_service__initialize(void) { fake_settings...
/* * 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...
action_bar_layer_remove_from_window(&confirmation_dialog->action_bar)
; action_bar_layer_deinit(&confirmation_dialog->action_bar); gbitmap_deinit(&confirmation_dialog->confirm_icon); gbitmap_deinit(&confirmation_dialog->decline_icon); actionable_dialog_pop(&confirmation_dialog->action_dialog); }
0, 0, 0, 0})); // If we ask for the sum of the latter half of yesterday, we should get 500 HealthValue steps = health_service_sum( HealthMetricStepCount, time_start_of_today() - (12 * SECONDS_PER_HOUR), time_start_of_today()); cl_assert_equal_i(steps, 500); // If we ask for the sum from latter ha...
abs(exp_distance_m - value)
; float pct_err = err * 100.0 / exp_distance_m; printf("\nTest %d: height:%d, steps:%d, seconds:%.1f, exp_distance:%d, exp_distance_2min:%d, " "act_distance_2min:%"PRIu32", pct_err: %.2f%% \n", i, params->height_in, params->steps, params->seconds, params->exp_distance_m, exp_distance_m, va...
/* * 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...
((uint8_t) (crc >> 8))
Rect(40, 40, 80, 40)); layer_add_child(&canvas, &layer); // Corner cases test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_ellipsis_clip_across_nx_zero_y_offset); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_ell...
test_graphics_context_reset(&ctx, fb)
; layer_set_update_proc(&layer, &draw_text_single_line_wordwrap_clip_across_nx); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_wordwrap_clip_across_nx.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text...
/* * 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...
(RebootReasonCode_ShutdownMenuItem)
; } static void prv_battery_state_handler(BatteryChargeState charge) { struct AppData *data = app_state_get_user_data(); if (charge.is_plugged && !data->was_plugged) { app_timer_cancel(data->poweroff_timer); } else if (!charge.is_plugged && data->was_plugged) { data->poweroff_timer = app_timer_register( ...
um_bytes = DLS_FILE_INIT_SIZE_BYTES/8 + (rand() % DLS_FILE_INIT_SIZE_BYTES/8); // By doing 16 loops, we are sure to cycle through the allocated file size at least twice. for (int j=0; j<16; j++) { prv_log_consume_random(logging_sessions[i], item_size, num_bytes); } } } // ------------------------...
(logging_sessions[i], buf[i], item_size, nb)
; bytes_left[i] -= nb; buf[i] += nb; } } for (int i = 0; i < 10; i++) { prv_check_session_data(logging_sessions[i], crcs[i], buf_size[i]); } } // ---------------------------------------------------------------------------------------- static void prv_do_recovery_test(int num_sessions) { u...
rections_with_same_layer_should_fail(void) { ContentIndicator content_indicator; content_indicator_init(&content_indicator); // Setting a dummy configuration for a direction should return true const ContentIndicatorConfig dummy_config = helper_get_dummy_config(); dummy_config.layer->update_proc = s_content_i...
(content_indicator_get_for_scroll_layer(&scroll_layer), NULL)
; // And the buffer should still be empty cl_assert(buffer_is_empty(buffer)); // Now we try to access it as the client, which should actually create the ContentIndicator ContentIndicator *content_indicator = content_indicator_get_or_create_for_scroll_layer( &scroll_layer); cl_assert(content_indicator); ...
4}, { 0, 0x34, 0}, { 0, 0x34, 0}, { 0, 0x34, 2}, { 0, 0x34, 0}, { 0, 0x34, 0}, { 0, 0x34, 0}, // 255: Local time: 02:37:00 AM { 0, 0x34, 0}, { 0, 0x34, 0}, { 0, 0x34, 0}, { 0, 0x34, 0}, { 0, 0x34, 0}, { 0, 0x34, 0}, { 0, 0x34, 0}, { 0, 0x34, 0}, { 0, 0x34,...
{ 0, 0x44, 0}, { 0, 0x44, 35}, { 0, 0x77, 14}, // 405: Local time: 05:07:00 AM { 0, 0x67, 8}, { 0, 0x67, 0}, { 0, 0x67, 0}, { 0, 0x67, 0}, { 0, 0x67, 3}, { 0, 0x67, 0}, { 0, 0x67, 0}, { 0, 0x67, 0}, { 0, 0x67, 9}, { 0, 0x66, 0}, { 0, 0x66, 9}, { 0, 0x66, 0...
// Stubs #include "stubs_app_manager.h" #include "stubs_app_state.h" #include "stubs_logging.h" #include "stubs_passert.h" #include "stubs_serial.h" #include "stubs_sys_exit.h" #define FUNC_NAME "f" #define ERROR_STRING "Oops!" T_STATIC void prv_log_uncaught_error(const jerry_value_t result); static int s_test_fu...
prv_do_call_user_function(script)
; cl_assert(*s_log_internal__expected == NULL); } void test_rocky_api_util__call_throw_error(void) { s_log_internal__expected = (const char *[]){ "Unhandled Error", " "ERROR_STRING, NULL }; const char *script = "var "FUNC_NAME" = function() { throw new Error('"ERROR_STRING"'); };"; prv_do_call_...
288, -184, -568}, { -288, -248, -640}, { -392, -272, -856}, { -512, -384, -880}, { -520, -320, -1216}, { -552, -352, -1264}, { -568, -304, -1248}, { -592, -296, -1024}, { -512, -328, -824}, { -400, -344, -640}, { -328, -376, -520}, { -240, -384, -488}, { -200, -400, -424}...
{ -1136, 88, 136}, { -984, 112, 24}, { -1088, 104, -48}, { -1104, 176, -384}, { -960, 112, -344}, { -1152, -112, -304}, { -1392, 72, -272}, { -1360, 96, -32}, { -1192, 240, 40}, { -1000, 304, 160}, { -1048, 352, 128}, // 91 seconds { -1112, 392, 64}, { -1032, 328,...
{ -1272, 464, -32}, { -1288, 520, -80}, { -1232, 184, 72}, { -1648, 336, 48}, { -1264, 408, -152}, { -1040, 408, -256}, { -1344, 480, -48}, { -1552, 352, 136}, { -1416, 184, 72}, { -1184, 32, 56}, { -1120, -88, 136}, { -1120, -104, 184}, { -1112, 96, 104}, { -115...
ze, and the render box will similarly be advanced //! by a size derived from the node's cached size. bool cached; } GTextNodeDrawContext; typedef bool (*ContainerIterCallback)(GTextNode *node, void *context); typedef void (*GTextNodeDestroyMethod)(GTextNode *node); typedef void (*GTextNodeDrawMethod)(GTextNodeDr...
{ *custom_node = (GTextNodeCustom) { .node.type = GTextNodeType_Custom, .node.free_on_destroy = true, .callback = callback, .user_data = user_data, }; }
return custom_node; } static void prv_destroy_text_node_base(GTextNode *node) { if (node && node->free_on_destroy) { task_free(node); } } static bool prv_destroy_container_iter(GTextNode *node, void *context) { graphics_text_node_destroy(node); return true; } static void prv_destroy_text_node_containe...
/* * 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, "GET_BYTES: Done sending data. Pushed %"PRIu32" bytes/sec", bytes_per_sec)
; bluetooth_analytics_handle_get_bytes_stats( state->object_type, state->num_bytes, elapsed_time_ms, &state->conn_event_stats); } // ----------------------------------------------------------------------------------------------- static void prv_protocol_send_next_chunk(void* raw_state) { GetBytesState* state =...
/* * 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_lock_recursive(s_analytics_lock); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ const PreferredContentSize runtime_platform_default_size = system_theme_get_default_content_size_for_runtime_platform(); return s_time_selection_configs[runtime_platform_default_size]; }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
kino_layer_deinit(&data->kino_layer)
; app_timer_cancel(data->timer); app_free(data); } static void prv_window_load_handler(Window* window) { LowPowerAppData *data = window_get_user_data(window); data->discharging_kino_area = GRect(PBL_IF_RECT_ELSE(4, 5), PBL_IF_RECT_ELSE(2, 4), ...
/* * 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...
{ int size; if (type == AttributeGroupType_Action) { size = num_group_type_elements * sizeof(TimelineItemAction); } else { size = num_group_type_elements * sizeof(Address); } for (int i = 0; i < num_group_type_elements; i++) { size += attributes_per_group_type_element[i] * sizeof(Attribute); }...
size_t attribute_group_get_required_buffer_size(AttributeGroupType type, uint8_t num_attributes, uint8_t num_group_type_elements, const uint8_t *attributes_per_group_type_ele...
/* * 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...
{ StatusBarDemoWindow *demo_window = (StatusBarDemoWindow *)window; status_bar_layer_deinit(&demo_window->status_bar); text_layer_deinit(&demo_window->text); window_deinit(window); }
static Window *prv_window_create(void) { typedef struct Description { char *debug_name; bool full_screen; uint8_t window_color; bool status_bar; uint8_t status_bar_color; } Description; static const Description descriptions[] = { { .debug_name = "non-full-screen (legacy status b...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
memcpy(s1, s2, n)
if CAPABILITY_HAS_BUILTIN_HRM case RXMenuIdx_HRM: title = "HRM"; subtitle = data->is_hrm_enabled ? "Enabled" : "Disabled"; break; #endif #if CAPABILITY_HAS_MICROPHONE case RXMenuIdx_Microphone: title = "Microphone"; subtitle = data->is_mic_enabled ? "Enabled" : "Disab...
{ AppData *data = app_state_get_user_data(); layer_remove_child_layers(window_get_root_layer(&data->txrx_window)); menu_layer_deinit(&data->txrx_menu_layer); if (data->current_test_step != BTLETestStep_None) { // Currently outstanding test not complete, finish it. switch (data->current_test_step) { ...
static void prv_enter_txrx_menu(AppData *data, BTLETestType test) { switch (test) { case BTLETestType_TX: case BTLETestType_RX: break; // OK default: WTF; } data->current_test = test; window_set_window_handlers(&data->txrx_window, &(WindowHandlers){ .load = prv_txrx_window_loa...
); s_current_day = s_sunday; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 3); s_current_day = s_monday; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 4); s_current_day = s_tuesday; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 5); s_current_day = s_w...
(s_num_alarm_events_put, 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...
{ assert_encode("", 0, 1); assert_out_equal("\x01", 1); }
void test_cobs_encode__zero(void) { assert_encode("\0", 1, 2); assert_out_equal("\x01\x01", 2); } void test_cobs_encode__simple(void) { assert_encode("Hello", 5, 6); assert_out_equal("\x06Hello", 6); } void test_cobs_encode__multiple_blocks(void) { assert_encode("Hello\0w\0rld", 11, 12); assert_out_equa...
AttributeIdLastUpdated, now); uint8_t buffer[Uint32ListSize(ActivitySessionMetricCount)]; Uint32List *icons = (Uint32List *)buffer; icons->num_values = ActivitySessionMetricCount, icons->values[0] = TIMELINE_RESOURCE_PACE; icons->values[1] = TIMELINE_RESOURCE_DURATION; icons->values[2] = TIMELINE_RESOURCE_...
(-24 * 60 * 60, has_subtitle)
; prv_add_weather_pin(-60 * 60); prv_add_weather_pin(60 * 60); prv_add_generic_pin(24 * 60 * 60, has_subtitle); goto timeline; case TimelinePinsDemo_Notifications: prv_add_notification(-60 * 60 * 24); prv_add_notification(-60 * 60); prv_add_notification(-60 * 30); prv...
pass_data_service_start, &prv_compass_data_service_stop); } void ecompass_service_handle(void) { static int samples_collected = 0; // read magnetometer sample MagData mag_data; MagReadStatus rv = mag_read_data(&mag_data); if (rv != MagReadSuccess) { if (rv == MagReadCommunicationFail) { // he...
DEFINE_SYSCALL(void, sys_ecompass_get_last_heading, CompassHeadingData *data)
{ if (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(data, sizeof(*data)); } *data = (CompassHeadingData) { .magnetic_heading = s_last_heading, .true_heading = s_last_heading, .compass_status = s_current_cal_status, .is_declination_valid = false }; } ///////////////////////////...
HealthServiceTimeScopeOnce); } // ---------------------------------------------------------------------------------------------- HealthServiceAccessibilityMask health_service_metric_averaged_accessible( HealthMetric metric, time_t time_start, time_t time_end, H...
(now_utc, time_start, time_end)
; const bool valid_hr_sample_num = ((now_utc - time_start) <= HS_MAX_MINUTE_DATA_SEC); if (metric == HealthMetricHeartRateBPM) { if (query_cur_minute) { // If the client is querying the service for the most recent Stable/Median/Filtered value // and it is within the last X minutes, return it. If it...
payload_size); return buffer; } void prv_cmp_last_received_notification(TimelineItem *item) { TimelineItem *notification = fake_notification_storage_get_last_notification(); size_t size1, size2; // Clear out the id since it is auto-generated memset(&notification->header.id, 0, sizeof(notificat...
{ prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_chunked_dict_part_one), (uint8_t*) s_chunked_dict_part_one); prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_chunked_dict_part_two), (uint8_t*) s_chunked_dict_part_two); s_num_ds_notifications_received += 2; }
else if (uid == message_size_attr_dict_uid) { prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_message_size_attr_dict), (uint8_t*) s_message_size_attr_dict); s_num_ds_notifications_received++; } else if (uid == attribute_at_end_uid) { prv_fake_receiving_ds_notification(ARRAY_LENGTH(memory_with_attribute...
/* * 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...
(true, false)
; bool need_to_all_caps_string = false; // First, try to extract an AlarmKind from the pin to request a string with the desired // capitalization Attribute *alarm_kind_attribute = attribute_find(attributes, AttributeIdAlarmKind); if (alarm_kind_attribute) { const AlarmKind alarm_kind = (AlarmKind)alarm_k...
/* * 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(idx >= 0 && idx < NUM_MAX_TIMERS)
; PBL_LOG(LOG_LEVEL_DEBUG, "STT normal callback %d executed", idx); s_app_data->fired_time[idx] = rtc_get_ticks(); return; } // ================================================================================= static void stuck_timer_callback(void* data) { PBL_LOG(LOG_LEVEL_DEBUG, "STT entering infinite loop ...
{ return s_rocky_path_steps_array_len; }
jerry_value_t rocky_api_graphics_path2d_call_fill(void) { // Args aren't correct, but it doesn't matter right now because the function doesn't use them: return prv_fill(jerry_create_undefined(), jerry_create_undefined(), NULL, 0); }
event(r, &ctx)); cl_assert(!handled); cl_assert(!ctx.triggered); r->state = RecognizerState_Started; cl_assert(prv_dispatch_touch_event(r, &ctx)); cl_assert(handled); cl_assert_equal_p(ctx.triggered, r); ctx.triggered = NULL; handled = false; r->state = RecognizerState_Updated; cl_assert(prv_dispa...
(&manager, &layer_b, &layer_c)
/* * 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 item_layer->scroll_offset_pixels; }
static void prv_update_scroll_offset(TimelineItemLayer *item_layer, int16_t new_offset, bool is_first_scroll) { static const PropertyAnimationImplementation implementation = { .base = { .update = (AnimationUpdateImplementation) property_animation_update_int16, }, ...
/* * 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...
weather_shared_data_assert_entries_equal(key, entry, weather_shared_data_get_entry(weather_shared_data_get_index_of_key(key)))
; } void test_weather_db__get_entries(void) { cl_assert_equal_i(S_SUCCESS, weather_db_for_each(prv_db_iterator_cb, NULL)); } void test_weather_db__check_records_in_db(void) { for (int index = 0; index < WEATHER_DATA_SHARED_WEATHER_DB_NUM_DB_ENTRIES; index++) { WeatherDBEntry *to_check = task_zalloc_check(weat...
_queue[2].duration_ms, 100); cl_assert_equal_i(s_vibe_queue[2].strength, 0); cl_assert_equal_i(s_vibe_queue[3].duration_ms, 15); cl_assert_equal_i(s_vibe_queue[3].strength, 100); cl_assert_equal_i(s_vibe_queue[4].duration_ms, 9); cl_assert_equal_i(s_vibe_queue[4].strength, -100); } void test_vibe_score__repe...
vibe_score_destroy(score)
; } void test_vibe_score__test_bad_attr_size(void) { uint8_t buffer[] = { 'V', 'I', 'B', 'E', // FourCC 1, 0, // version 0, 0, 0, 0, // reserved bytes 11, 0, // attr_list_size (right value is 12) 2, // GenericAttributeList.num_attributes VibeAttributeId_Notes, 4, 0, // Gener...
2_t)current_cb; } static void prv_log_stuck_system_task(RebootReason *reboot_reason) { void *current_cb = system_task_get_current_callback(); if (!current_cb) { PBL_LOG_SYNC(LOG_LEVEL_WARNING, "No system task callback in progress."); return; } PBL_LOG_SYNC(LOG_LEVEL_WARNING, "System task callback: %p...
system_task_get_current_callback()
/* * 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 prv_get_metric_data_type(metric)->element_type; }
uint32_t analytics_metric_num_elements(AnalyticsMetric metric) { return prv_get_metric_data_type(metric)->num_elements; } uint32_t analytics_metric_element_size(AnalyticsMetric metric) { const AnalyticsMetricDataType *type = prv_get_metric_data_type(metric); switch (type->element_type) { case ANALYTICS_METRI...
; num_chars = base64_encode(data->base64_buf, sizeof(data->base64_buf), binary_data + chunk_size, sizeof(data->record) - chunk_size); PBL_ASSERTN(num_chars + 1 < (int)sizeof(data->base64_buf)); pbl_log(LOG_LEVEL_INFO, __FILE_NAME__, __LINE__, "RAW: %s", data->base64_buf...
{ // Don't do anything if we are already deinited. if (!s_activity_state.started) { return; } // Demands the underlying activity algorithms to clean up their act(ivity sessions) and save off // any new data they have (only to RAM...persisted to flash a few lines later). activity_algorithm_early_deinit(...
// ------------------------------------------------------------------------------------------------ // Start activity tracking system callback static void prv_start_tracking_cb(void *context) { PBL_ASSERT_TASK(PebbleTask_KernelBackground); bool test_mode = (bool)context; activity_prefs_set_activated(); s_ac...
{ 1344, 360, -200}, { 1312, 344, -208}, { 1256, 264, -152}, { 976, 288, -200}, { 824, 376, -280}, { 752, 416, -264}, { 752, 424, -288}, { 840, 408, -344}, // 112 seconds { 872, 448, -368}, { 880, 456, -408}, { 888, 432, -416}, { 960, 432, -400}, { 976, 424, -360},...
{ 632, 336, -232}, { 752, 72, 56}, { 1160, 440, -280}, { 1152, 432, -288}, { 1336, 208, -248}, { 1328, 160, -88}, { 1104, 312, -88}, { 1024, 368, -144}, { 904, 360, -136}, { 808, 368, -120}, { 792, 344, -144}, { 808, 376, -152}, { 824, 440, -208}, { 840, 448, -25...
throw_string(void) { s_log_internal__expected = (const char *[]){ "Unhandled exception", " "ERROR_STRING, NULL }; prv_do_eval("throw '"ERROR_STRING"';"); cl_assert(*s_log_internal__expected == NULL); } void test_rocky_api_util__eval_throw_error(void) { s_log_internal__expected = (const char *[])...
jerry_get_object_field(now, "getYear")
; jerry_value_t result_seconds = jerry_call_function(getSeconds, now, NULL, 0); jerry_value_t result_minutes = jerry_call_function(getMinutes, now, NULL, 0); jerry_value_t result_hours = jerry_call_function(getHours, now, NULL, 0); jerry_value_t result_date = jerry_call_function(getDate, now, NULL, 0); jerry...
>select_index == SelectIndexOverflow) { text_layer_set_text_color(&data->word_wrap_layer, GColorWhite); text_layer_set_background_color(&data->word_wrap_layer, GColorBlack); } if (data->up_down_direction) { text_layer_set_text(&data->direction_layer, "Direction: Up/Down"); } else { text_layer_set...
(sizeof(struct AppState))
; app_state_set_user_data(data); push_window(data); } static void handle_deinit(void) { struct AppState* data = app_state_get_user_data(); app_free(data); } static void s_main(void) { handle_init(); app_event_loop(); handle_deinit(); } const PebbleProcessMd* text_clipping_app_get_info() { static c...
/* * 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_push_settings_menu()
_mutex); return 0; } // ------------------------------------------------------------------------------------------- DEFINE_SYSCALL(uint32_t, sys_accel_manager_get_buffer_size, AccelSessionRef session, uint32_t samples_per_update) { return samples_per_update + 1; } // -----------------------------...
sys_accel_manager_data_unsubscribe(session)
; AccelSubscriberState *state = prv_subscriber_state(session); PBL_ASSERTN(state == NULL); state = kernel_malloc_check(sizeof(AccelSubscriberState)); *state = (AccelSubscriberState) { .session_ref = session, .task = handler_task, .data_cb_handler = data_cb, .data_cb_context = co...
/* * 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...
{ window_single_click_subscribe(BUTTON_ID_SELECT, prv_select_click_handler); window_single_click_subscribe(BUTTON_ID_UP, prv_up_click_handler); window_single_click_subscribe(BUTTON_ID_DOWN, prv_down_click_handler); }
static void prv_window_load(Window *window) { Layer *window_layer = window_get_root_layer(window); GRect bounds = layer_get_bounds(window_layer); s_text_layer = text_layer_create(GRect(0, 72, bounds.size.w, 20)); text_layer_set_text(s_text_layer, "Press a button"); text_layer_set_text_alignment(s_text_laye...
eep_start_12h * HEALTH_PROGRESS_BAR_MAX_VALUE / TWELVE_HOURS); const int sleep_end = (sleep_end_12h * HEALTH_PROGRESS_BAR_MAX_VALUE / TWELVE_HOURS); const int typical_sleep_start_24h = health_data_sleep_get_typical_start_time(data->health_data); const int typical_sleep_start_12h = typical_sleep_start_24h %...
(ctx, CURRENT_TEXT_COLOR)
; graphics_draw_text(ctx, buffer, font, rect, GTextOverflowModeFill, GTextAlignmentCenter, NULL); } } static void prv_render_typical_sleep_text(GContext *ctx, Layer *base_layer) { HealthSleepSummaryCardData *data = layer_get_data(base_layer); const int typical_sleep = health_data_sleep_get_cur_wday_average(...
ics_add(ANALYTICS_DEVICE_METRIC_ACCEL_SAMPLE_COUNT, num_samples, AnalyticsClient_System); PBL_ASSERTN(state->num_samples <= state->raw_buffer_size); } // If buffer is full, notify subscriber to process it if (state->num_samples >= state->samples_per_update) { prv...
prv_update_driver_config()
; } unlock: mutex_unlock_recursive(s_mutex); return result; } // ------------------------------------------------------------------------------------------- // NOTE: This is guaranteed to be only called from the KernelMain task by the event_service static void prv_tap_add_subscriber_cb(PebbleTask task) { mute...
x33, 3754, 0x0}, { 102, 0x41, 8363, 0x0}, { 89, 0x41, 8813, 0x0}, { 86, 0x40, 6386, 0x0}, // 990: Local time: 03:35:00 PM { 97, 0x40, 7027, 0x0}, { 90, 0x40, 7602, 0x0}, { 88, 0x41, 9214, 0x0}, { 100, 0x40, 9685, 0x0}, { 89, 0x40, 10065, 0x0}, { 87, 0x40, 8055, 0x0}, { 91, 0x...
{ 80, 0x41, 9992, 0x0}, { 66, 0x41, 9614, 0x0}, { 90, 0x40, 9759, 0x0}, { 98, 0x40, 8518, 0x0}, { 73, 0x30, 10374, 0x0}, { 56, 0x52, 9762, 0x0}, { 86, 0x40, 7941, 0x0}, { 96, 0x40, 6704, 0x0}, { 64, 0x43, 11613, 0x0}, { 52, 0x52, 10028, 0x0}, { 89, 0x40, 6667, 0x0}, { 62,...
{ 0, 0x78, 1152, 0x0}, { 16, 0x67, 2163, 0x0}, { 10, 0x71, 5817, 0x0}, { 0, 0x65, 3060, 0x0}, { 0, 0x56, 3448, 0x0}, { 14, 0x56, 3219, 0x0}, // 1155: Local time: 06:20:01 PM { 0, 0x56, 2354, 0x0}, { 0, 0x4b, 3445, 0x0}, { 8, 0x6a, 1164, 0x0}, { 0, 0x74, 3689, 0x0}, { 0, ...
, // 1464820884 (Wed, 1 June 2016 22:41:24 GMT) // Slice 2 0x0B, 0x00, // Total size 0x00, // AppGlanceSliceType - AppGlanceSliceType_IconAndSubtitle 0x01, // Number of attributes // Slice Attributes 0x25, // Attribute ID - Attribu...
(glance_out)
; } void test_app_glance_db__blob_read_with_invalid_key_length_or_null_val_out_fails(void) { // Call the basic glance blob insert test to insert the basic glance blob test_app_glance_db__basic_glance_blob_insert_and_read(); const size_t glance_size = sizeof(s_app_glance_basic); uint8_t glance_out[glance_size]...
ns under the License. */ #include "compositor_launcher_app_transitions.h" #include "applib/graphics/bitblt.h" #include "applib/graphics/framebuffer.h" #include "applib/graphics/graphics_private.h" #include "apps/system_apps/launcher/default/launcher_app.h" #include "services/common/compositor/compositor_transitions....
(ctx, &stretch_rect_above_selection_rect)
{ 400, 768, -120}, { 504, 880, -128}, { 648, 984, -104}, { 600, 936, -112}, { 552, 848, -104}, { 552, 864, -152}, { 568, 728, -136}, { 640, 656, -160}, { 728, 640, -120}, // 29 seconds { 816, 624, -136}, { 736, 552, -168}, { 728, 376, -224}, { 728, 336, -200}, {...
{ 712, 712, -16}, { 656, 504, -40}, { 656, 496, -168}, { 600, 488, -272}, { 632, 520, -376}, { 616, 456, -328}, { 584, 464, -336}, { 568, 520, -360}, { 560, 552, -384}, { 664, 736, -280}, { 744, 840, -240}, { 664, 872, -264}, { 544, 848, -240}, { 432, 712, -152}, ...
{ 384, 696, -104}, { 272, 704, -72}, { 160, 656, -200}, { 400, 864, 176}, { 160, 1200, -696}, { 0, 680, -416}, { 24, 792, -496}, { 168, 688, -800}, { 320, 752, -704}, { -48, 576, -776}, { -80, 472, -792}, { -136, 472, -728}, { -80, 704, -336}, { 120, 616, -248}, ...
---------------------- static void prv_debug_cmd_weekday_averages(int index, void *context) { ActivityDemoAppData *data = context; prv_display_averages_alert(data, Monday); } // ----------------------------------------------------------------------------------------- static void prv_debug_cmd_weekend_averages(int...
snprintf(temp, sizeof(temp), "\n%"PRId8", 0x%"PRIx8", %"PRIu16", %"PRId8" ", m_data->steps, m_data->orientation, m_data->vmc, m_data->light)
; safe_strcat(data->debug_card.dialog_text, temp, sizeof(data->debug_card.dialog_text)); } } prv_display_alert(data->debug_card.dialog_text); exit: app_free(minute_data); } // ----------------------------------------------------------------------------------------- static void prv_debug_cmd_send_fak...
/* * 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_send_bytes(msg_data, sizeof(msg_data))
; prv_send_footer(); } for (int i=0; i<2; i++) { rcv_msg = qemu_serial_private_assemble_message(&s_state, &rcv_bytes, &rcv_protocol); cl_assert(rcv_msg); cl_assert_equal_i(rcv_protocol, QemuProtocol_SPP); cl_assert_equal_i(rcv_bytes, sizeof(msg_data)); cl_assert_equal_m(msg_data, rcv_msg, si...
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 int16_t title_height = fonts_get_font_height(title_font); ...
(ctx, config->subtitle, subtitle_font, box, config->overflow_mode, GTextAlignmentLeft, NULL)
; } } // This function duplicates `grect_inset()` but helps us save some stack space by using pointer // arguments and always inlining the function static ALWAYS_INLINE void prv_grect_inset(GRect *rect, GEdgeInsets *insets) { grect_standardize(rect); const int16_t new_width = rect->size.w - insets->left - insets...
/* * 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...
(transcription)
+ 11; app_data->result = malloc(size); if (!app_data->result) { APP_LOG(APP_LOG_LEVEL_ERROR, "Failed to allocated memory for transcription"); result = 99; } else { snprintf(app_data->result, size, "You said:\n%s", transcription); text_layer_set_text(app_data->result_text, app_data->...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
memset(s_dest_data, 0b11111111, sizeof(s_dest_data))
; } void test_bitblt_palette_1bit__cleanup(void) { } // Test images reside in "tests/fw/graphics/test_images/". // The wscript will convert them from PNGs in that directory to PBIs in the build directory. // Tests assign, from same size to same size. // Setup: // - Source is 50x50, the left half is semi transparen...
/* * 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...
ihex_encode(s_result, IHEX_TYPE_EOF, 0, NULL, 0)
; prv_assert_ihex(":00000001FF"); } void test_ihex__data_record(void) { uint8_t data[7] = { 1, 2, 3, 4, 5, 6, 7 }; ihex_encode(s_result, IHEX_TYPE_DATA, 0xABCD, data, sizeof(data)); prv_assert_ihex(":07ABCD000102030405060765"); } void test_ihex__empty_record_length(void) { cl_assert_equal_i(11, IHEX_RECORD_...
st_image_color, GPoint(30, 30), DEG_TO_TRIGANGLE(45), GPointZero); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_origin_color_set_center_45.Xbit.pbi")); // Test transparency setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GC...
cl_assert(test_image != NULL)
; // PBL-24705 grect_center_point is off by 1 GPoint center = GPoint(DISP_COLS / 2 - 1, DISP_ROWS / 2 - 1); // No Clip, Angle 0 setup_test_rotate_bitmap(ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign); graphics_draw_rotated_bitmap(ctx, test_image, GPoint( tes...
.array_size = array_size, .oldest_key = prv_minute_file_get_settings_key(oldest_requested_utc) - 1, .newest_key = prv_minute_file_get_settings_key(utc_now) + 1, .utc_start = 0, .oldest_requested_utc = oldest_requested_utc, .last_record_idx_written = -1, }; // Read the minute data from flas...
if ((i % 25) == 0) { PBL_LOG(LOG_LEVEL_DEBUG, "wrote %"PRIu32" records...", i); }
} PBL_LOG(LOG_LEVEL_DEBUG, "Done. End # of records: %"PRIu16, s_alg_state->num_minute_records); return success; } // ------------------------------------------------------------------------------- // Immediately send a fake logging record to data logging. This aids in testing the mobile // app bool activity_a...
ble */); cl_assert_equal_i(duration_s, 5 * SECONDS_PER_MINUTE); // Get some HR info prv_put_bpm_event(100, HRMQuality_Good); cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone)); cl_assert_equal_i(bpm, 100);...
(stored_session->step_data.active_kcalories, 200 + calculated_active_kcalories)
; cl_assert_equal_i(stored_session->step_data.resting_kcalories, ROUND(activity_private_compute_resting_calories(stored_session->length_min), ACTIVITY_CALORIES_PER_KCAL)); cl_assert_equal_b(stored_session->manual, true); cl_assert(stored_session->step_data.distance_me...
points); s_stroke_points = NULL; } if (s_fill_points) { free(s_fill_points); s_fill_points = NULL; } s_path_open = false; s_radius = 0; s_path_stroke_count = 0; s_path_stroke_precise_count = 0; s_path_fill_count = 0; s_path_fill_precise_count = 0; s_circle_stroke_count = 0; s_circle_f...
gdraw_command_draw(NULL, command)
; cl_assert_equal_i(s_stroke_color.argb, GColorClearARGB8); cl_assert_equal_i(s_fill_color.argb, GColorGreenARGB8); cl_assert_equal_i(s_stroke_width, 0); cl_assert_equal_i(s_path_num_points, 2); cl_assert_equal_b(s_path_open, false); cl_assert_equal_i(s_path_fill_count, 1); cl_assert_equal_i(s_path_stroke...
/* * 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...
{ GPointPrecise watch_hand_end = prv_gpoint_from_polar(&center, hand->length, hand->angle); if (hand->style == CLOCK_HAND_STYLE_ROUNDED_WITH_HIGHLIGHT) { graphics_context_set_stroke_color(ctx, GColorWhite); graphics_line_draw_precise_stroked_aa(ctx, center, watch_hand_end, hand->thickness + 2); } graphi...
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_dra...
000_FW_IMAGE); PBL_ASSERTN(image_length); PBL_LOG(LOG_LEVEL_DEBUG, "Loading FW image (%"PRIu32" bytes encoded)", image_length); // Skip over the image header. uint32_t cursor = sizeof(AS7000FWUpdateHeader); while (cursor < image_length) { // Make sure we can load enough data for a valid segment....
(LOG_LEVEL_ERROR, "AS7000 booted into loader! Something is very wrong.")
; goto failed; } // check that we can communicate with this chip if (info.protocol_version_major != EXPECTED_PROTOCOL_VERSION_MAJOR) { // we don't know how to talk with this chip, so bail PBL_LOG(LOG_LEVEL_ERROR, "Unexpected protocol version!"); goto failed; } if (info.application_id != AS70...
ss_management/app_install_manager.h" #include "services/normal/process_management/app_storage.h" #include "process_management/pebble_process_info.h" #include "process_management/pebble_process_md.h" #include "resource/resource.h" #include "resource/resource_storage.h" #include "resource/resource_storage_file.h" #includ...
(id, entry)
tle -> NA // Body -> Title // Footer -> Location #define LAYOUT_MAX_HEIGHT 2500 #define CARD_MARGIN PBL_IF_ROUND_ELSE(12, 10) // All paddings relate to padding above the object unless othersize noted #define CARD_BOTTOM_PADDING 18 // The y-position of a layout frame when its banner is peeking #define BANNER_PEEK_STATI...
{ const NotificationLayout *layout = (NotificationLayout *)layout_ref; clock_get_since_time(buffer, config->buffer_size, layout->info.item->header.timestamp); }
LINE_WIDTH; graphics_fill_rect(ctx, &notch); } #define REL_BAR_OVERLAP_STROKE_WIDTH 2 #define REL_BAR_OVERLAP_SIDE_MARGIN 2 #define REL_BAR_OVERLAP_NUDGE_X 1 #define REL_BAR_OVERLAP_LINE2_HORIZ_OFFSET ((2 * REL_BAR_OVERLAP_SIDE_MARGIN) + 1) static void prv_draw_rel_bar_overlap(TimelineLayer *timeline_layer, GContext...
(timeline_layer, ctx, current, rel_bar_value)
; break; case RelationshipBarTypeNone: // Draw nothing break; } } } // Timer callback that displays the current relationship bar if user has stopped fast clicking void prv_rel_bar_show(void *context) { TimelineLayer *layer = (TimelineLayer *)context; if (timeline_layer_should_an...
/* * 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_p(strrchr(testbuf, '\0'), testbuf+7)
; }
animations[num_animations++] = relbar_animation; } #endif Animation *animation = animation_spawn_create_from_array(animations, num_animations); return animation; } static void prv_place_day_separator(TimelineLayer *layer) { if (!layer_get_hidden((Layer *)&layer->day_separator)) { // already on screen ...
graphics_fill_circle(ctx, circle_center, circle_radius)
; } else { // Otherwise, use fill_radial to fill the sidebar as a radial on the right side of the screen const GPoint circle_center = GPoint(sidebar_x - circle_radius, bounds_center.y); // Add half the final sidebar width to the radius so we see a bounce-back effect at the end const TimelineLayerStyle...
/* * 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...
{ 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_draw_watch_hand(GContext *ctx, ClockHand *hand, GPointPrecise center, GPath *path) { switch (hand->style) { case CLOCK_HAND_STYLE_POINTED: prv_draw_watch_hand_pointed(ctx, hand, GPointFromGPointPrecise(center), path); case CLOCK_HAND_STYLE_ROUNDED: case CLOCK_HAND_STYLE_ROUNDED_WIT...
/* * 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 (GAPLEConnection *) list_find(&s_connections->node, prv_list_filter_for_addr, (void *) addr); }
static bool prv_list_filter_for_device(ListNode *found_node, void *data) { const BTDeviceInternal *device = (const BTDeviceInternal *) data; const GAPLEConnection *connection = (const GAPLEConnection *) found_node; return bt_device_equal(&connection->device.opaque, &device->opaque); } static GAPLEConnection * ...
= 0, .type = TimelineItemTypeReminder, .layout = LayoutIdTest, }, .attr_list = (AttributeList) { .num_attributes = 1, .attributes = (Attribute[1]) {{ .id = AttributeIdTitle, .cstring = "test 2" }} } }; static void prv_insert_default_reminders(void) { // add all four explicitly out of order c...
cl_assert(memcmp(&item3, &temp, sizeof(TimelineItem)) == 0)
// One slot is 625us: const uint32_t min_interval_ms = ((next->terms[next->cur_term].min_interval_slots * 5) / 8); const uint32_t max_interval_ms = ((next->terms[next->cur_term].max_interval_slots * 5) / 8); BLE_LOG_DEBUG("Enable Ad job %s", prv_string_for_debug_tag(next->tag)); bool result =...
memcpy(job->terms, terms, sizeof(GAPLEAdvertisingJobTerm) * num_terms)
; memcpy(job->payload.data, payload->data, payload->ad_data_length + payload->scan_resp_data_length); PBL_LOG(LOG_LEVEL_INFO, "Scheduling advertising job: %s", prv_string_for_debug_tag(job->tag)); // Schedule bt_lock(); { if (s_gap_le_advert_is_initialized && !s_deinit_in_progress) {...
prv_receive_data(s_session, (const uint8_t *) &incomplete_abort_msg, sizeof(incomplete_abort_msg)); assert_ack_count(0); assert_nack_count(1); } void test_put_bytes__abort_message_cookie_mismatch(void) { prv_receive_init_and_put_fw_object(); prv_process_and_reset_test_counters...
fake_system_task_callbacks_invoke_pending()
/* * 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...
voice_window_regain_focus(session->voice_window)
; } else { event_service_client_unsubscribe(&session->dictation_result_sub); voice_window_lose_focus(session->voice_window); } } static void prv_stop_session(DictationSession *session) { session->in_progress = false; event_service_client_unsubscribe(&session->dictation_result_sub); if (pebble_task_ge...
/* * 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...
hc_protocol_enqueue_response(msg, (const uint8_t *)&payload, sizeof(payload))
; break; } default: PBL_LOG(LOG_LEVEL_ERROR, "HcGap: unhandled message id: %d", msg->command_id); } } void hc_endpoint_gap_service_mtu_changed(const Connection *connection, uint16_t mtu) { HcProtocol_GapServiceMtuChanged mtu_resp = {}; connection_get_address(connection, &mtu_resp.addr); mtu...
n (mtu - num_bytes_overhead); } // ------------------------------------------------------------------------------------------------- static void prv_enter_awaiting_reset_complete(PPoGATTClient *client, bool self_initiated) { if (client->state == StateConnectedOpen) { // No need to consume the remaining bytes in...
{ 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; GAPLEConnection *con...
} prv_enter_awaiting_reset_complete(client, true /* self_initiated */); } // ------------------------------------------------------------------------------------------------- static void prv_handle_reset_request(PPoGATTClient *client) { if (client->state == StateConnectedClosedAwaitingResetCompleteSelfInitiate...