prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
te_reg(BMI160_REG_INT_MOTION_1, BOARD_CONFIG_ACCEL.accel_config.shake_thresholds[AccelThresholdHigh]); } } static void prv_enable_shake_detection(void) { // don't automatically power-up the gryo when an anymotion interrupt fires! prv_write_reg(BMI160_REG_PMU_TRIGGER, 0x0); // Enable the anymotion det...
(LOG_LEVEL_DEBUG, "enable double tap detection %d", on)
; if (s_double_tap_detection_enabled == on) { // the requested change matches what we already have! return; } prv_update_accel_interrupts(on); if (on) { prv_enable_double_tap_detection(); } else { prv_disable_double_tap_detection(); } s_double_tap_detection_enabled = on; } bool accel_ge...
gly // Also test that upcoming items take priority ADD_EVENT( .item = &s_item1 ); CHECK_EVENT( .count = 2, .item_id = s_item1.header.id, .num_concurrent = 0, .timeout_ms = SECONDS_PER_MINUTE * MS_PER_SECOND, .time_type = TimelinePeekTimeType_ShowWillStart, .is_first_event = true ); ...
(30 * SECONDS_PER_MINUTE)
/* * 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 (cmd == RCC_APB2PeriphClockCmd) { return "APB2"; } else if (cmd == RCC_AHB1PeriphClockCmd) { return "AHB1"; } else if (cmd == RCC_AHB2PeriphClockCmd) { return "AHB2"; } else { return NULL; }
} #endif // F(S)MC is the only AHB3 peripheral #ifdef FMC_R_BASE #define AHB3_BASE FMC_R_BASE #else #define AHB3_BASE FSMC_R_BASE #endif _Static_assert(APB1PERIPH_BASE < APB2PERIPH_BASE, "Clock mapping assumptions don't hold"); _Static_assert(APB2PERIPH_BASE < AHB1PERIPH_BASE, "Clock mapping assumptions don't hold")...
/* * 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...
rocky_global_init(s_preferences_api)
; EXECUTE_SCRIPT("var size = _rocky.userPreferences.contentSize"); ASSERT_JS_GLOBAL_EQUALS_S("size", "medium"); } void test_rocky_api_preferences__large(void) { s_preferred_content_size = PreferredContentSizeLarge; rocky_global_init(s_preferences_api); EXECUTE_SCRIPT("var size = _rocky.userPreferences.cont...
* limitations under the License. */ #include "sync.h" #include "endpoint_private.h" #include "services/common/bluetooth/bluetooth_persistent_storage.h" #include "services/common/comm_session/session.h" #include "services/common/analytics/analytics.h" #include "system/logging.h" #include "system/passert.h" #include "...
(data, length)
, BLOB_DB_INVALID_DATA); return; } const uint8_t *iter = data; BlobDBToken token; BlobDBId db_id; // Read token and db_id iter = endpoint_private_read_token_db_id(iter, &token, &db_id); // read key length and key bytes ptr uint8_t key_size; const uint8_t *key_bytes = NULL; iter = prv_read_key...
/* * 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...
{ char buffer[32]; uint32_t result = mfg_selftest(); for (uint32_t i = 0; i < ARRAY_LENGTH(s_test_cases); i++) { const struct SelfTestCase* test = s_test_cases + i; char *pass_fail; if (test->func != 0) { // Test is implemented pass_fail = bool_to_pass_fail(bitset32_get(&result, i)); } else...
size); } jerry_value_t jerry_create_boolean(bool value) { return (jerry_value_t)EM_ASM_INT({ return __jerryRefs.ref(Boolean($0)); }, value); } jerry_value_t jerry_create_error(jerry_error_t error_type, const jerry_char_t *message_p) { return jerry_create_error_sz(error_type, message_p, strlen((const ch...
jerry_value_is_string(prop_name_val)
) { return false; } return (bool)EM_ASM_INT({ var obj = __jerryRefs.get($0); var name = __jerryRefs.get($1); return obj.hasOwnProperty(name); }, obj_val, prop_name_val); } bool jerry_delete_property(const jerry_value_t obj_val, const jerry_value_t prop_name_val) { if (!jerry_value_is_ob...
{ -136, -584, -928}, // 133 seconds { -160, -552, -888}, { -176, -568, -880}, { -224, -592, -848}, { -208, -568, -856}, { -176, -552, -832}, { -176, -584, -864}, { -120, -592, -920}, { -208, -592, -976}, { -80, -632, -904}, { -216, -648, -864}, { -136, -616, -784}, {...
{ 240, 864, 200}, { 248, 864, 176}, { 256, 864, 176}, { 248, 848, 208}, { 256, 856, 240}, { 256, 848, 200}, { 256, 856, 184}, { 240, 872, 168}, { 232, 848, 216}, { 240, 856, 208}, { 264, 872, 176}, // 139 seconds { 256, 856, 208}, { 240, 864, 208}, { 240, 864,...
{ 248, 896, -16}, { 240, 904, 16}, { 232, 888, 40}, { 256, 872, -16}, { 256, 864, -40}, { 216, 896, -24}, { 224, 896, 16}, { 232, 904, -24}, { 232, 888, -40}, { 240, 888, -8}, { 216, 888, 8}, { 224, 872, -32}, { 216, 872, -72}, { 232, 904, -48}, { 248, 912, -...
(s_mic_mutex)
; return success; } void mic_stop(MicDevice *this) { mutex_lock_recursive(s_mic_mutex); if (!s_running) { goto unlock; } // Disable DMA and I2S dma_request_stop(MIC_I2S_RX_DMA); I2S_Cmd(BOARD_CONFIG.mic_config.spi, DISABLE); // Disable I2S clock periph_config_acquire_lock(); periph_config_d...
{ 1536, 376, 80}, { 1736, 504, 80}, { 1360, 504, -8}, { 1168, 288, 184}, { 1344, 312, 184}, { 1248, 272, 176}, { 952, 312, 80}, { 848, 296, 40}, { 824, 280, 48}, { 832, 280, 88}, { 840, 336, 96}, { 744, 88, 160}, { 752, 80, 112}, { 944, 160, 128}, // 11 second...
{ 888, 288, -56}, { 1112, 400, -64}, { 1424, 448, -80}, { 1840, 440, 48}, { 1704, 496, 0}, { 1264, 408, -32}, { 1312, 240, 72}, { 1288, 232, 80}, { 1144, 256, 72}, { 904, 216, 104}, { 784, 192, 112}, { 760, 184, 112}, { 736, 136, 136}, { 776, 144, 152}, { 768,...
{ 808, 136, 152}, { 784, 152, 104}, // 19 seconds { 808, 128, 152}, { 776, 152, 96}, { 784, 160, 112}, { 904, 24, 136}, { 1064, 72, 32}, { 1344, -8, 112}, { 1496, 136, -56}, { 1368, 288, -280}, { 1360, 240, -248}, { 1552, 424, -184}, { 1440, 368, -16}, { 1040...
/* * 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_stroke_color(ctx, GColorBlack); graphics_context_set_antialiased(ctx, false); graphics_draw_round_rect(ctx, &GRect(2, -10, 28, 20), 4); }
void test_graphics_draw_round_rect_${BIT_DEPTH_NAME}__origin_layer(void) { GContext ctx; Layer layer; test_graphics_context_init(&ctx, fb); layer_init(&layer, &GRect(0, 0, 32, 24)); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ct...
TY_SESSION_UPDATE_MIN minutes cl_assert(value <= 40 * SECONDS_PER_MINUTE && value >= (40 - ACTIVITY_SESSION_UPDATE_MIN) * SECONDS_PER_MINUTE); // Verify the root metrics. Since we also verify these using the health_service api, set // the task to the app task now stub_pebble_tasks_set_current(Pebbl...
(true, false, &enabled, &session_id, &num_samples, &seconds)
; cl_assert(enabled); cl_assert_equal_i(num_samples, 0); // Feed in 510 values to test entire dynamic range const int k_raw_samples = 510; AccelRawData raw_data[k_raw_samples]; for (int i = 0; i < k_raw_samples; i++) { // We store multiples of 8 because the compression algorithm divides b...
urned from the time() call. timestamp = time_local_to_utc(timestamp); } time_t current_time = rtc_get_time(); int32_t time_difference = timestamp - current_time; WakeupId wakeup_id = s_wakeup_state.next_wakeup_id++; // Disallow scheduling past events if (time_difference <= 0) { return E_INVALID_AR...
{ SettingsFile wakeup_settings; if (settings_file_open(&wakeup_settings, SETTINGS_FILE_NAME, SETTINGS_FILE_SIZE) == S_SUCCESS) { // Check if current app already has MAX_WAKEUP_EVENTS_PER_APP scheduled // or if the minute event window is already occupied struct prv_check_app_and_wakeup_event_s ...
mutex_unlock(s_mutex); return status; } static void prv_delete_events_by_uuid_callback(SettingsFile *old_file, SettingsFile *new_file, SettingsRecordInfo *info, void *context) { // Check if valid entry if (info->key_len != sizeof(WakeupId) || info->val_len != sizeof(WakeupEntry)) { return; } Wak...
/* * 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...
{ InvokeActionMsgCbData *action = data; comm_session_send_data(comm_session_get_system_session(), TIMELINE_ACTION_ENDPOINT, (uint8_t *)&action->msg, action->length, COMM_SESSION_DEFAULT_TIMEOUT); kernel_free(action); }
static ActionResultType prv_get_action_result_type(ResponseHeader *header) { switch (header->response) { case ResponseACK: return ActionResultTypeSuccess; case ResponseNACKContactAmbiguity: case ResponseNACKAddressAmbiguity: return ActionResultTypeChaining; case ResponseNACKStartReply: ...
e_minutes < s_activity_reward_settings.reward.activity.trigger_active_minutes) { INSIGHTS_LOG_DEBUG("Not showing activity reward - have only been currently active for " "%"PRIu16" minutes out of %"PRIu8, s_activity_reward_state.active_minutes, s_activity_reward_se...
if (config->open_app.enabled) { actions[num_actions++] = (TimelineItemAction) { .id = action_id++, .type = TimelineItemActionTypeOpenWatchApp, .attr_list = open_app_action_attr_list, }; }
if (config->response.enabled) { actions[num_actions++] = (TimelineItemAction) { .id = config->response.type, .type = TimelineItemActionTypeInsightResponse, .attr_list = response_action_attr_list, }; } TimelineItemActionGroup action_group = { .num_actions = num_actions, .actions ...
count. s_total_step_count = 0; // Put some steps and make sure we don't delete or freak out, and append the new step count. prv_inc_steps_and_put_event(50); cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone))...
prv_inc_time(1 * SECONDS_PER_MINUTE)
sion_id = audio_endpoint_setup_transfer(prv_audio_transfer_setup_complete_handler, prv_audio_transfer_stopped_handler); PBL_ASSERTN(s_session_id != AUDIO_ENDPOINT_SESSION_INVALID_ID); PBL_LOG(LOG_LEVEL_INFO, "Send session setup message. Session type: %d", session_typ...
mutex_unlock(s_lock)
elease_value(arg); mismatch_args[i] = 0; } } static jerry_value_t prv_dummy(const jerry_value_t function_obj_p, const jerry_value_t this_val, const jerry_value_t args_p[], const jerry_length_t args_count) { return 0; }...
(output, sizeof(output))
); cl_assert_equal_s(output, cases[i].expected_output); ASSERT_JS_ERROR(error_value, NULL /* Never errors out! */); } // Exercise ROCKY_ARG_STR (too small buffer provided): { char output[1] = {0xff}; ROCKY_ARGS_ASSIGN(ROCKY_ARG_STR(output, 0)); cl_assert_equal_s(output, ""); ...
gs = 0, .layout = LayoutIdTest, } }, { .header = { .id = {0xdd}, .parent_id = {0}, .timestamp = s_feb_5_midnight + 8 * 60 * 60 + 15 * 60, // 8:15-8:16 am .duration = 1, .type = TimelineItemTypePin, .flags = 0, .layout = LayoutIdTest, } } }; // Setup /////...
(&state.pin.header.id, &s_items[2].header.id)
); // check fourth cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[5].header.id)); // check third again cl_assert(iter_prev(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[2].header.id)); // check fifth cl_assert(iter_next(&iterator)); cl_assert(it...
continue; } // End of a sample if (strcmp(token, "}") == 0) { PBL_ASSERTN(state->test_entry.name[0] != 0); break; } } // Did we get samples? if (state->test_entry.num_samples > 0) { return true; } else { return false; } } // --------------------------------------...
{ sscanf(token + strlen(token) + 1, "%d, 0x%x, %d", &steps, &orientation, &vmc); }
else if (state->test_entry.version == 2) { sscanf(token + strlen(token) + 1, "%d, 0x%x, %d, %d", &steps, &orientation, &vmc, &light); } else if (state->test_entry.version == 3) { sscanf(token + strlen(token) + 1, "%d, 0x%x, %d, %d, %d", &steps, &orientation, &vmc, &light, &plugged_...
nt.x, point.y + 1)); graphics_draw_pixel(ctx, GPoint(point.x + 1, point.y + 1)); } else if (alpha == ALPHA_0) { graphics_context_set_stroke_color(ctx, bg_color); graphics_draw_pixel(ctx, point); graphics_draw_pixel(ctx, GPoint(point.x + 1, point.y)); graphics_draw_pixel(ctx, GPoint(point.x, point....
(s_canvas_layer)
; } static void select_handler(ClickRecognizerRef recognizer, void *context) { AppData *data = window_get_user_data(s_window); data->property = (data->property + 1) % PROPERTY_MAX; layer_mark_dirty(s_canvas_layer); } static void down_handler(ClickRecognizerRef recognizer, void *context) { AppData *data = wind...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_i(ctx.dest_bitmap.info.format, GBitmapFormat8BitCircular)
; memset(ctx.dest_bitmap.addr, GColorRedARGB8, FRAMEBUFFER_SIZE_BYTES); GRect radial_container_rect = ctx.dest_bitmap.bounds; radial_container_rect = grect_inset(radial_container_rect, GEdgeInsets(-10)); const uint16_t inset_thickness = radial_container_rect.size.w / 4; graphics_context_set_fill_color(&ctx,...
sizeof(s_short_data_fragment)), true); ppogatt_send_next(transport); prv_assert_sent_data(s_characteristics[0][PPoGATTCharacteristicData], sn, s_short_data_fragment, sizeof(s_short_data_fragment)); } // Ack the last one (sn == s_tx_window_size ...
{ prv_assert_sent_data(s_characteristics[0][PPoGATTCharacteristicData], sn /* sn */, s_short_data_fragment, sizeof(s_short_data_fragment) - sn); }
} void test_ppogatt__retransmit_timed_out_data_packets_first_but_not_later_ones(void) { test_ppogatt__open_session_when_found_pebble_app(); uint8_t sn = 0; Transport *transport = ppogatt_client_for_uuid(&s_meta_v0_system.app_uuid); // Get s_tx_window_size packets in flight: uint8_t secs_passed = 0; for (...
rent_write_header; //! the current header we are writing to App } demo_server_hdl_t; static int8_t s_ble_perip_wdog_id; static void prv_log_conn_params(const gap_conn_params_t *conn_params) { PBL_LOG(LOG_LEVEL_DEBUG, "Current conn params: intvl min: %d max: %d latency: %d STO: %d", (int)conn_params->inter...
connection_get_address(conn, &addr)
, { 1016, 232, -48}, { 920, 160, -144}, { 976, 192, -120}, { 1024, 232, -248}, { 1256, 256, -296}, { 1208, 240, -128}, // 40 seconds { 984, 168, -104}, { 872, 160, -80}, { 968, 224, -80}, { 1040, 312, -144}, { 1032, 344, -160}, { 992, 304, -88}, { 1200, 360, -24},...
{ 1424, 152, -80}, { 1304, 320, -128}, { 1128, 264, -112}, { 1008, 120, -48}, { 1176, 104, -8}, { 968, 112, -200}, { 1032, 320, -144}, { 976, 152, 32}, { 1008, 152, -88}, { 1024, 88, -280}, { 1360, 120, -168}, { 1336, 160, 80}, { 1104, 192, -8}, { 920, 320, -24}, ...
{ 1360, 336, 40}, { 1120, 288, -80}, { 944, 224, -48}, { 1128, 344, -72}, { 1304, 376, 8}, { 1296, 352, 40}, { 1152, 384, 80}, { 1584, 448, 200}, { 1512, 656, 368}, { 1016, 808, 88}, { 1232, 880, -32}, { 904, 704, -40}, { 864, 600, 40}, { 912, 648, 48}, { 122...
/* * 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...
dictation_session_destroy(app_data->session)
; app_data->session = NULL; } static void prv_up_click_handler(ClickRecognizerRef recognizer, void *context) { AppData *app_data = context; app_data->confirm = !app_data->confirm; dictation_session_enable_confirmation(app_data->session, app_data->confirm); } static void prv_click_config_provider(void *context...
, &fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_context_set_fill_color(&ctx, GColorBlue); graphics_fill_rect(&ctx, &GRect(10, 10, 100, 140)); graphics_context_set_fill_color(&ctx, GColorRed); ctx.draw_state.fill_color.a = 0; graphics_fill_rect(&ctx, &GRect(20, 20, 70, 20)); ctx.draw_sta...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r1_aa_no_clip.${BIT_DEPTH_NAME}.pbi"))
; setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 2, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r2_aa_no_clip.${BIT_DEPTH_NAME}.pbi")); // TODO: Remove these #ifdefs in PBL-15916 when support ...
r_init(&iter, (IteratorCallback)&prv_iter_next, NULL, &iter_state); while (iter_next(&iter)) { // Check header flags to detect deleted notifications uint8_t status = iter_state.header.common.status; if (status & TimelineItemStatusDeleted) { // Skip over deleted notification pfs_seek(*fd, iter_...
(OP_FLAG_READ)
; if (fd < 0) { return false; } SerializedTimelineItemHeader header = { .common.id = UUID_INVALID }; bool found = prv_find_next_notification(&header, prv_uuid_equal_func, (void *)id, fd); prv_file_close(fd); return found; } static bool prv_get_notification(TimelineItem *notification, SerializedT...
"Already closed!"); goto unlock; } session->transport_imp->reset(session->transport); } unlock: bt_unlock(); } // ------------------------------------------------------------------------------------------------- // Interfaces towards Transport (reading from the send buffer to actually transmit the da...
session_remote_version_start_requests(session)
; comm_session_analytics_open_session(session); prv_put_comm_session_event(true, is_system); if (is_system && (session->destination == TransportDestinationHybrid)) { // For Android, if the app is connected, PebbleKit should be // working as well prv_put_comm_session_event(true, false); } retur...
, }; GDrawCommandFrame *frame; frame = &sequence->frames[0]; *frame = (GDrawCommandFrame) { .duration = 15, }; frame->command_list = (GDrawCommandList) { .num_commands = 3 }; GDrawCommand *command; command = gdraw_command_list_get_command(&frame->command_list, 0); GPoint points1[] = { { 3, ...
cl_assert_equal_p(frame, gdraw_command_sequence_get_frame_by_index(sequence, 1))
; frame = gdraw_command_sequence_get_frame_by_index(sequence, 0); frame->duration = 15; // test that the sequence loops when the play count is greater than 1 sequence->play_count = 2; frame = gdraw_command_sequence_get_frame_by_elapsed(sequence, 45); cl_assert_equal_p(frame, gdraw_command_sequence_get_fram...
iteria have been met, show reward prv_push_reward(now_utc, &SLEEP_REWARD_NOTIF_CONFIG); } // ----------------------------------------------------------------------------------------- // Format a time given in seconds after midnight static void prv_strcat_formatted_time(int32_t time_seconds, char *out_buf, size_t buf...
i18n_get("%s of sleep", &pin_attr_list)
; /// "10H 30M of sleep" snprintf(short_subtitle, max_attr_length, short_subtitle_fmt, elapsed); attribute_list_add_cstring(&pin_attr_list, AttributeIdShortSubtitle, short_subtitle); attribute_list_add_cstring(&pin_attr_list, AttributeIdSubtitle, elapsed); const char *title_i18n = PBL_IF_RECT_ELSE(i18n_noop("Y...
sprite-sheets // http://opengameart.org/content/pixel-puncher-sprites // http://opengameart.org/content/spike-man-monster // http://opengameart.org/content/platformer-baddies // http://opengameart.org/content/greyscale-special-effects-%E2%80%94-various-dimensions-and-flavours // http://opengameart.org/content/bouncing-...
cl_assert(bitmap_sequence)
; GBitmap *bitmap = gbitmap_create_blank(gbitmap_sequence_get_bitmap_size(bitmap_sequence), GBitmapFormat8Bit); cl_assert(bitmap); // first frame always shows at the beginning (0 ms) status = gbitmap_sequence_update_bitmap_by_elapsed(bitmap_sequence, bitmap, 0); cl_assert_eq...
/* * 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...
EXECUTE_SCRIPT("var pileOfPooCESU8 = '\xed\xa0\xbd\xed\xb2\xa9';")
; // Expect a pair of surrogate code points: EXECUTE_SCRIPT_AND_ASSERT_RV_EQUALS_S("pileOfPooCESU8.charCodeAt(0).toString(16)", "d83d"); EXECUTE_SCRIPT_AND_ASSERT_RV_EQUALS_S("pileOfPooCESU8.charCodeAt(1).toString(16)", "dca9"); } void test_rocky_text_encoding__jerry_handles_utf8_strings_in_source(void) { // S...
0) }; GColor bg_color = (GColor){ .argb = (data->bg_color.argb | ALPHA_100) }; uint8_t alpha = data->alpha; if (alpha == ALPHA_100) { graphics_context_set_stroke_color(ctx, fg_color); graphics_draw_pixel(ctx, point); graphics_draw_pixel(ctx, GPoint(point.x + 1, point.y)); graphics_draw_pixel(ctx,...
(origin.x + 4*color_index_match - 1, origin.y - 1 + height_offset, COLOR_BAR_WIDTH + 2, COLOR_BAR_HEIGHT + 2)
1); graphics_draw_vertical_line_dotted(&ctx, GPoint(8, 0), 2); graphics_draw_vertical_line_dotted(&ctx, GPoint(10, 0), 3); graphics_draw_vertical_line_dotted(&ctx, GPoint(12, 0), 4); graphics_draw_vertical_line_dotted(&ctx, GPoint(14, 0), 20); graphics_draw_vertical_line_dotted(&ctx, GPoint(16, 0), 21); gra...
graphics_draw_vertical_line_dotted(&ctx, GPoint(14, 0), 20)
; graphics_draw_vertical_line_dotted(&ctx, GPoint(16, 0), 21); graphics_draw_vertical_line_dotted(&ctx, GPoint(18, 0), 22); graphics_draw_vertical_line_dotted(&ctx, GPoint(20, 0), MAX_NUM_ROWS - 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(22, 0), MAX_NUM_ROWS + 1 ); cl_check(gbitmap_pbi_eq(&ctx.dest_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...
{ // Configure SCS before CRESET and before configuring the SPI so that we don't end up with the // FPGA in the "SPI Master Configuration Interface" on bigboards which don't have NVCM. If we end // up in this mode, the FPGA will drive the clock and put the SPI peripheral in a bad state. gpio_output_init(&ICE40L...
bool display_program(const uint8_t *fpga_bitstream, uint32_t bitstream_size) { InputConfig creset_input = { .gpio = ICE40LP->creset.gpio, .gpio_pin = ICE40LP->creset.gpio_pin, }; delay_ms(1); gpio_output_set(&ICE40LP->spi.scs, true); // SCS asserted (low) gpio_output_set(&ICE40LP->creset, false);...
/* * 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...
jerry_get_utf8_string_size(value)
; char buf[sz + 1]; memset(buf, 0, sz + 1); jerry_string_to_utf8_char_buffer(value, (jerry_char_t *)buf, sz); rv = strtoul(buf, NULL, 0); } return rv; } int32_t jerry_get_int32_value(jerry_value_t value) { return (int32_t)(round(jerry_get_number_value(value))); } int32_t jerry_get_angle_value(j...
/* * 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 (pebble_task_get_current() == PebbleTask_App) { window_stack = app_state_get_window_stack(); } else { // Bluetooth disconnection events are always displayed at maximum priority. window_stack = modal_manager_get_window_stack(ModalPriorityCritical); }
simple_dialog_push(&bt_dialog->dialog, window_stack); } BtConnDialog *bt_conn_dialog_create(void) { BtConnDialog *bt_dialog = applib_malloc(sizeof(BtConnDialog)); bt_conn_dialog_init(bt_dialog, NULL, 0); return bt_dialog; } void bt_conn_dialog_init(BtConnDialog *bt_dialog, char *text_buffer, size_t buffer_si...
s, Monday, &val_out)); cl_assert_equal_i(val_out, s_sleep_data[SD_TypicalWakeupTime]); } void test_health_db__hr_zone_data(void) { const char *key = "monday_heartRateZoneData"; cl_assert_equal_i(health_db_insert((uint8_t *)key, strlen(key), (uint8_t *)s_hr_zone_data, sizeof(s...
health_db_insert((uint8_t *)average_sleep_key, strlen(average_sleep_key), (uint8_t *)&average_sleep_val, sizeof(average_sleep_val))
, S_SUCCESS); cl_assert(health_db_get_monthly_average_value(ActivityMetricSleepTotalSeconds, &val_out)); cl_assert_equal_i(val_out, average_sleep_val); } void test_health_db__notify_listeners(void) { char *key; s_metric_updated_count = 0; key = "tuesday_sleepData"; cl_assert_equal_i(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...
app_launch_trigger()
; } } void app_launch_invalidate_all_references(void) { s_app_launch_characteristic = BLE_CHARACTERISTIC_INVALID; } void app_launch_handle_service_removed( BLECharacteristic *characteristics, uint8_t num_characteristics) { app_launch_invalidate_all_references(); } // ---------------------------------------...
(stack), &current_stack, false); cl_assert_equal_p(b, actual); cl_assert_equal_i(0, current_stack); cl_assert_equal_p(b, stack[0]); // test limited stack size (go to sibling instead of child) stack[0] = a; current_stack = 0; actual = __layer_tree_traverse_next__test_accessor(stack, 1, &current_stack, tr...
GPoint(9, 9)
), &child_a); cl_assert_equal_p(layer_find_layer_containing_point(&parent, &GPoint(6, 6)), &child_d); cl_assert_equal_p(layer_find_layer_containing_point(&parent, &GPoint(15, 15)), &child_e); } static bool prv_override_layer_contains_point(const Layer *layer, const GPoint *point) { return true; } void test_laye...
ayer_set_selected_next(&l, false, MenuRowAlignNone, false); cl_assert_equal_i(2 * FOCUSED + NORMAL, l.selection.y); cl_assert_equal_i(NORMAL, l.selection.h); cl_assert_equal_b(false, s_content_available[ContentIndicatorDirectionUp]); cl_assert_equal_b(true, s_content_available[ContentIndicatorDirectionDown]); ...
{ if (new_index->row == 1) { new_index->row = 2; } if (new_index->row == 3) { new_index->row = 4; } }
void test_menu_layer__center_focused_handles_skipped_rows(void) { MenuLayer l; menu_layer_init(&l, &GRect(10, 10, DISP_COLS, DISP_ROWS)); menu_layer_set_center_focused(&l, true); menu_layer_set_callbacks(&l, NULL, &(MenuLayerCallbacks) { .draw_row = prv_draw_row, .get_num_rows = prv_get_num_rows, ...
le_data(PPoGATTClient *client, const PPoGATTPacket *packet, uint16_t payload_length) { if (client->in.next_expected_data_sn == packet->sn) { client->out.ack_packet_to_send = (const PPoGATTPacket) { .sn = client->in.next_expected_data_sn, .type = PPoGATTPacketTypeAck, };...
if (/*meta->ppogatt_max_version >= 0x01 &&*/ value_length >= sizeof(PPoGATTMetaV1)) { const PPoGATTMetaV1 *meta_v1 = (const PPoGATTMetaV1 *)value; if (meta_v1->pp_session_type >= PPoGATTSessionTypeCount) { PBL_LOG(LOG_LEVEL_ERROR, "Invalid session type %u", meta_v1->pp_session_type); goto handle_err...
BTErrno e = gatt_client_subscriptions_subscribe(client->characteristics.data, BLESubscriptionNotifications, GAPLEClientKernel); if (e == BTErrnoOK) { // Delete any existing client with this UUID, last one wins....
i/system_icons.h" #include "kernel/util/factory_reset.h" #include "resource/resource_ids.auto.h" #include "services/common/i18n/i18n.h" #include "services/common/system_task.h" #include "settings_bluetooth.h" #include "system/logging.h" #define MESSAGE_BUF_SIZE 96 typedef struct ConfirmUIData { Window window; Act...
(msg_text_layer, text_flow_inset)
; #endif // handle different title heights gracefully GContext *ctx = graphics_context_get_current_context(); const uint16_t msg_text_height_px = text_layer_get_content_size(ctx, msg_text_layer).h; const int text_spacing = 7; const uint16_t forget_text_y_offset_px = msg_text_y_offset_px + msg_text_height_px ...
/* * 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...
jerry_value_is_number(value)
le's point of view. typedef enum { GAPLERoleSlave, GAPLERoleMaster, } GAPLERole; // ------------------------------------------------------------------------------------------------- // Static Variables -- MUST be protected with bt_lock/unlock! //! The list of connection intents. static GAPLEConnectionIntent * s_i...
{ *task_mask &= ~gap_le_pebble_task_bit_for_client(c); }
} } //! extern'd for gatt.c, used to determine to what tasks a "Buffer Empty" event should be sent. //! Helper function to build a PebbleTaskBitset task_mask of the clients' tasks that are virtually //! connected to specified real connection and therefore need to receive events for it. //! bt_lock is assumed to be ...
tionNode*) list_get_at( (ListNode*) notifications_data->notification_list, notif_idx); if (!node) { return; } LoadedNotificationNode *loaded_node = prv_loaded_notification_list_load_item( &notifications_data->loaded_notification_list, node); if (!loaded_node) { return; } TimelineItem *...
(data->loaded_notification_list)
(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_origin_color_assign_0.Xbit.pbi")); // Top-left corner rotation point, Angle 45 setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign); graphics_draw_rotated_bitmap(&ctx, test_image_color, G...
(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign)
_order); first_fire_b = MIN(first_fire_b, prv_last_handler_entry(&s_started_handler_calls, spawn_b)->fire_order); cl_assert(last_fire_a < first_fire_b); cl_assert_equal_i(prv_count_animations(), 0); } // -------------------------------------------------------------------------------------- ...
prv_last_update_distance(a)
ine_spacing_delta; if (config->alignment) { text_node->alignment = ToGTextAlignment(config->alignment); } #if PBL_COLOR const LayoutColors *colors = layout_get_colors(layout); switch (config->color) { case LayoutColor_None: break; case LayoutColor_Primary: text_node->color = colors->prim...
{ const uint16_t num_nodes = config->num_nodes; for (int i = 0; i < num_nodes; i++) { GTextNode *node = layout_create_text_node_from_config(layout, config->nodes[i]); graphics_text_node_container_add_child(container_node, node); } prv_set_text_node_extent(&container_node->node, &config->extent); }
static GTextNodeHorizontal *prv_create_horizontal_container_node_from_config( const LayoutLayer *layout, const LayoutNodeHorizontalConfig *config) { const int capacity = config->container.num_nodes + config->container.extra_capacity; GTextNodeHorizontal *horizontal_node = graphics_text_node_create_horizontal(...
ne CORRECTION_VAL_MASK ((1 << BITS_PER_CORRECTION_VAL) - 1) static CompassStatus s_current_cal_status = CompassStatusDataInvalid; static int16_t s_active_corr[3] = { 0 }; static bool s_service_init = false; static bool s_saved_corr_present = false; static int16_t s_saved_corr[3] = { 0 }; static int32_t s_l...
{ int32_t mx = mag_data->x - s_active_corr[0]; int32_t my = mag_data->y - s_active_corr[1]; int32_t mz = mag_data->z - s_active_corr[2]; int32_t mx_rot, my_rot; // per freescale AN4249, roll is unstable close to verticle but pitch is ok int32_t corr = 0; if (TRIGANGLE_TO_DEG(pitch) > 82) { pitch = T...
t roughly 5km/h, so we should be close to 50km const int long_walk_time = 10 * MINUTES_PER_HOUR; steps = walking_cadence_spm * long_walk_time; time_ms = long_walk_time * SECONDS_PER_MINUTE * MS_PER_SECOND; int long_walk_distance_m = activity_private_compute_distance_mm(steps, time_ms) / MM_PER_METER; cl_asser...
cl_assert_within(long_run_calories, 3000, 3200)
; // And finally throw in a specific value so that anyone who touches the function will have to // check up on the unit tests cl_assert_equal_i(long_run_calories, 3172); } // --------------------------------------------------------------------------------------- void test_activity_calculators__inactive_calories...
ength(TimelineLayer *layer, GRect *first_icon_frame_out, GRect *second_icon_frame_out) { const int full_line_length = prv_get_line_length(layer, first_icon_frame_out, second_icon_frame_out); return (3 * full_line_length) / 5; } #define REL_BAR_BACK_TO_BACK_OFFSET 10 #de...
if (curr_rel_bar_anim) { // Delay to avoid overlapping moving icon with bars animation_set_delay(curr_rel_bar_anim, REL_BAR_CURR_ANIM_DELAY(duration)); animation_set_duration(curr_rel_bar_anim, REL_BAR_CURR_ANIM_DURATION(duration)); animation_set_custom_interpolation(curr_rel_bar_anim, interpolate); ...
return curr_rel_bar_anim; } #define REL_BAR_LINE_CHECK_LENGTH 6 #define REL_BAR_LINE_WIDTH 2 #define REL_BAR_LINE_HORIZ_OFFSET ((SIDEBAR_WIDTH / 2) + (REL_BAR_LINE_WIDTH / 2)) #define REL_BAR_LINE_NOTCH_HORIZ_OFFSET ((REL_BAR_LINE_CHECK_LENGTH / 2) + (REL_BAR_LINE_WIDTH / 2)) static void prv_draw_rel_bar_line(Time...
/* * 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...
(title, BUFFER_SIZE, "Section Header (%i)", section_index)
; menu_cell_basic_header_draw(ctx, cell_layer, title); (void)data; } static void detail_window_load(Window *window) { AppData *data = window_get_user_data(window); TextLayer *text_layer = &data->detail_text; text_layer_init(text_layer, &window->layer.bounds); text_layer_set_text(text_layer, data->detail_te...
/* * 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...
{ switch (level) { case JERRY_LOG_LEVEL_ERROR: return LOG_LEVEL_ERROR; case JERRY_LOG_LEVEL_WARNING: return LOG_LEVEL_WARNING; case JERRY_LOG_LEVEL_TRACE: return LOG_LEVEL_DEBUG_VERBOSE; case JERRY_LOG_LEVEL_DEBUG: default: return LOG_LEVEL_DEBUG; break; } }
/** * Provide log message implementation for the engine. */ void jerry_port_log(jerry_log_level_t level, const char* format, ...) { const uint8_t log_level = prv_pbl_log_level_from_jerry_log_level(level); if (log_level > LOG_LEVEL_DEBUG) { return; } va_list args; va_start(args, format); app_log_var...
nt(50); cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone)); cl_assert_equal_i(steps, 1060); } // --------------------------------------------------------------------------------------- // Open the app and close ...
cl_assert_equal_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()); // Wait 20 minutes. By t...
er *app_msg_retry_timer; } out; struct { uint8_t *reassembly_buffer; size_t received_size_bytes; size_t total_size_bytes; } in; } s_state; //////////////////////////////////////////////////////////////////////////////// // Forward Declarations ///////////////////////////////////////////////////////...
{ PBL_LOG(LOG_LEVEL_ERROR, "Failed to outbox_begin"); return; }
size_t bytes_remaining; size_t payload_size; prv_calc_current_chunk_size(&bytes_remaining, &payload_size); OutgoingObject *obj = s_state.out.object_queue; // There is no dict_write_... API that lets us write a Tuple's byte array in multiple calls, // so we're just going to poke in the data "manually" he...
ss, total_progress, inner_bounds); #endif graphics_context_set_stroke_color(ctx, color); graphics_context_set_stroke_width(ctx, line_width); graphics_draw_line(ctx, line_inner_point, line_outer_point); } #if ROBERT_SCREEN_RES static void prv_draw_seperator(GC...
graphics_text_node_draw(&container->node, ctx, &bounds, NULL, NULL)
; graphics_text_node_destroy(&container->node); } #if PBL_BW || ROBERT_SCREEN_RES static void prv_draw_bpm(GContext *ctx, int32_t current_bpm, GFont font, GBitmap *heart_icon, GRect bounds, bool screen_is_obstructed, void *i18n_owner) { #if PBL_BW bounds.origin.y += screen_is_obstructed ? ...
//////////////////////// #include "stubs_app_state.h" #include "stubs_applib_resource.h" #include "stubs_compiled_with_legacy2_sdk.h" #include "stubs_heap.h" #include "stubs_logging.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_pebble_tasks.h" #include "stubs_print.h" #include "stubs_resou...
gtransform_is_equal(&t, &t_c)
awChildMethod)(GTextNodeDrawContext *context, GTextNode *child_node); typedef GAxisAlign (*GTextNodeGetAxisAlignMethod)(GTextNode *node); typedef struct { GTextNodeDestroyMethod destructor; GTextNodeDrawMethod draw; GTextNodeDrawMethod will_draw; GTextNodeDrawMethod did_draw; bool is_container; } GTextNodeB...
{ return; }
GTextNodeContainer *container_node = (GTextNodeContainer *)node; prv_container_each(container_node, prv_destroy_container_iter, NULL); prv_destroy_text_node_base(&container_node->node); } static bool prv_container_add_child(GTextNodeContainer *container_node, GTextNode *child) { if (!container_node || !child)...
/* * 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...
(WelcomeVersionCurrent)
; } void welcome_push_notification(bool factory_reset_or_first_use) { const WelcomeVersion version = welcome_get_welcome_version(); // This check only works if it is called before getting started complete is set if (!factory_reset_or_first_use && (version < WelcomeVersion_4xNormalFirmware)) { // This has com...
/* * 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_m(val, val_out, val_len); }
free(val_out); } static void set_and_verify(SettingsFile *file, uint8_t *key, int key_len, uint8_t *val, int val_len) { cl_must_pass(settings_file_set(file, key, key_len, val, val_len)); verify(file, key, key_len, val, val_len); } void test_settings_file__set_get_one(void) { printf...
andler(ClickRecognizerRef recognizer, void *context) { HealthAPITestAppData *data = (HealthAPITestAppData *)context; window_stack_push(data->debug_window, true /* Animated */); } // ------------------------------------------------------------------------------- static void steps_click_config_provider(void *contex...
graphics_fill_radial(ctx, bounds, GOvalScaleModeFitCircle, 15, 0, TRIG_MAX_ANGLE * percent / 100)
/* * 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 char *src = src_ptr; char *dst = dst_ptr; uint8_t code = 0x01; size_t code_idx = 0; size_t dst_idx = 1; for (size_t src_idx = 0; src_idx < length; ++src_idx) { if (src[src_idx] == '\0') { dst[code_idx] = code; code_idx = dst_idx++; code = 0x01; } else { dst[dst_idx++...
808}, { 472, 112, -808}, { 472, 104, -816}, { 472, 112, -808}, { 472, 112, -808}, { 472, 104, -816}, { 472, 104, -808}, { 472, 112, -816}, { 480, 96, -808}, { 472, 104, -816}, { 472, 120, -816}, { 472, 88, -816}, { 472, 96, -808}, { 472, 104, -808}, { 472, 104, -8...
{ 376, -112, -864}, { 360, -168, -864}, { 288, -224, -856}, { 272, -304, -864}, { 248, -384, -888}, { 224, -416, -824}, { 216, -416, -848}, { 208, -416, -824}, { 208, -416, -808}, // 100 seconds { 216, -432, -824}, { 200, -448, -808}, { 216, -392, -856}, { 216, -4...
{ 208, -384, -1016}, { 184, -480, -944}, { 184, -296, -928}, { 168, -320, -848}, { 184, -384, -880}, { 184, -440, -848}, { 192, -368, -848}, { 216, -352, -864}, { 216, -360, -856}, { 224, -312, -888}, { 224, -328, -872}, { 240, -328, -864}, { 232, -336, -872}, { ...
- FLASH_REGION_DEBUG_DB_BEGIN) / DEBUG_DB_NUM_FILES) #define FILE_ID_BIT_WIDTH 4 #define VERSION_ID_BIT_WIDTH 2 #define CURRENT_VERSION_ID 1 typedef struct PACKED { uint8_t magic:2; //<! Set to 0x2 if valid. //! The file id of this file. We always replace the oldest of the two files if they're both //! valid...
PBL_LOG(LOG_LEVEL_DEBUG, "Found files {%u, %u, %u, %u}, using file %u with new id %u", file_id[0], file_id[1], file_id[2], file_id[3], s_current_file_index, s_current_file_id)
; debug_db_reformat_header_section(); } bool debug_db_is_generation_valid(int file_generation) { PBL_ASSERTN(file_generation >= 0 && file_generation < DEBUG_DB_NUM_FILES); FileHeaderBasic file_header; flash_read_bytes((uint8_t*) &file_header, get_file_address(generation_to_index(file_generation)), sizeof(fil...
t_buf); } static void prv_start_call_duration_timer(void) { if (s_phone_ui_data->call_start_time == 0) { s_phone_ui_data->call_start_time = rtc_get_time(); } s_phone_ui_data->call_duration_timer = evented_timer_register( 1000, true /* repeating */, prv_update_call_time, NULL); // Update call time i...
prv_start_call_duration_timer()
; } else { prv_set_status_text(ACCEPTED); prv_window_pop_with_delay(ACCEPT_DELAY_MS); } prv_set_answer_window(); } static void prv_decline_call(void) { prv_stop_ringing(); phone_call_decline(); prv_stop_call_duration_timer(); prv_set_icon_resource(TIMELINE_RESOURCE_DISMISSED_PHONE_CALL); prv_...
for (int i = 0; i < config->separator.h; i++) { // First point from bottom will be +0, second +1, third +0, etc. separator_start_point.y--; separator_start_point.x += i & 1; graphics_draw_horizontal_line_dotted(ctx, separator_start_point, separator_width); separator_start_point.x -= i & ...
{ grect_align(&arrow_rect, aml_bounds, GAlignBottom, true /* clip */); content_indicator_draw_arrow(ctx, &arrow_rect, ContentIndicatorDirectionDown, fg_color, bg_color, GAlignBottom); }
"0", 2, }, { "'%R')", 66, true, "1", 7, }, { "'%R')", 3607, true, "1:00", 8, }, { "'%R')", -3666, true, "-1:01", 7, }, // Advanced %T tests { "'%0T')", 3666, true, "01:01:06", 1, }, { "'%uT')", 3666, true, "1 hour, 1 minute, and 6 seconds", 1, }, ...
("Invalid status code\n")
; } else { printf("%s\n", s_error_strings[s_error.status]); } #endif cl_assert_equal_i(s_error.status, test->expect_status); cl_assert_equal_i(err_index, test->expect_index); } cl_assert_equal_s(s_output, test->expect_str); cl_assert_equal_i(s_cond.eval_time, test->expect_ev...
eforeTimingMenuIndex_StartTime; } else if (before_time_m <= 5) { return PeekBeforeTimingMenuIndex_5Min; } else if (before_time_m <= 10) { return PeekBeforeTimingMenuIndex_10Min; } else if (before_time_m <= 15) { return PeekBeforeTimingMenuIndex_15Min; } else if (before_time_m <= 30) { return Pee...
{ PBL_ASSERTN(context); expandable_dialog_pop(context); Window *window = prv_create_settings_window(); app_window_stack_push(window, true /* animated */); }
static Window *prv_create_first_use_dialog(void) { const void *i18n_owner = prv_create_first_use_dialog; // Use this function as the i18n owner /// Title for the Timeline Quick View first use dialog. const char *header = i18n_get("Quick View", i18n_owner); /// Help text for the Timeline Quick View first use d...
6), 5); // T facing left - even vert, even horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(100, 90), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(100, 95), 5); // T facing left - odd vert, odd horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(131, 91), 10); graphics_draw_horizontal_lin...
(ctx, true)
; graphics_context_set_stroke_width(ctx, 1); graphics_draw_line(ctx, GPoint(20,20), GPoint(20,20)); graphics_context_set_antialiased(ctx, false); graphics_context_set_stroke_width(ctx, 2); graphics_draw_line(ctx, GPoint(30,30), GPoint(30,30)); graphics_context_set_antialiased(ctx, true); graphics_contex...
size_t length, GAPLEClient client) { cl_assert_equal_i(characteristic, s_characteristics[ANCSCharacteristicControl]); if (s_gatt_client_op_write_should_fail_once) { s_gatt_client_op_write_should_fail_once = false; return BTErrnoInvalidParameter; } if (s_ga...
ARRAY_LENGTH(s_invalid_attribute_length)
r */, &device); fake_event_clear_last(); const BleAddressAndIRKChange e = { .device = device, .is_address_updated = true, .new_device = device, .is_resolved = true, .irk = *(const SMIdentityResolvingKey *) fake_GAPAPI_get_fake_irk(), }; bt_driver_handle_le_connection_handle_update_address_a...
(&device, true /* is_master*/)
for (int i = 0; i < NUM_COPY_VARIANTS; i++) { prv_push_sleep_summary_notification(now_utc, total_seconds + deviate_seconds, total_seconds, i); prv_push_sleep_summary_notification(now_utc, total_seconds, total_seconds, i); prv_push_sleep_summary_notification(n...
system_task_add_callback(prv_test_push_rewards, NULL)
; } void activity_insights_test_push_day_insights(void) { system_task_add_callback(prv_test_push_day_insights, NULL); } void activity_insights_test_push_walk_run_sessions(void) { system_task_add_callback(prv_test_push_walk_run_session, NULL); } void activity_insights_test_push_nap_session(void) { system_task_a...
ytes) { prv_assert_valid_task(); bool success = false; bool got_session_file = prv_get_session_file(session, num_bytes); if (!got_session_file) { goto exit; } success = prv_write_data(&session->storage, data, num_bytes); exit: if (got_session_file) { prv_release_session_file(session); } if...
{ if (read_offset >= logging_session->storage.write_offset) { break; } }
// Read the chunk header if (!prv_pfs_seek(logging_session->storage.fd, read_offset, FSeekSet)) { last_whole_items_read_bytes = -1; goto exit; } if (!prv_pfs_read(logging_session->storage.fd, &chunk_hdr, sizeof(chunk_hdr))) { last_whole_items_read_bytes = -1; goto exit; } ...
assert(!alerts_should_notify_for_type(AlertInvalid)); cl_assert(!alerts_should_notify_for_type(AlertMobile)); cl_assert(!alerts_should_notify_for_type(AlertReminder)); cl_assert(!alerts_should_notify_for_type(AlertPhoneCall)); } void test_alerts__phone_calls_only(void) { cl_assert(alerts_get_mask() == AlertMas...
(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(!alerts_should_vibrate_for_type(AlertReminder)); alerts_s...
_val, &tm); const char *strftime_format = prv_strftime_format(format, is_24h_style); const size_t str_len = strftime(buffer, buffer_len, strftime_format, &tm); const bool strip_leading_char = buffer[0] == '0' && prv_strip_leading_zero(format, is_24h_style); if (strip_leading_char) { memmove(buffer, buffer...
jerry_create_external_function(prv_to_locale_time_string)
; jerry_set_object_field(date_prototype, ROCKY_DATE_TOLOCALETIMESTRING, locale_time_string); JS_VAR locale_date_string = jerry_create_external_function(prv_to_locale_date_string); jerry_set_object_field(date_prototype, ROCKY_DATE_TOLOCALEDATESTRING, locale_date_string); JS_VAR locale_string = jerry_create_exter...
{ -760, 160, 272}, { -672, 144, 232}, { -560, 80, 200}, { -568, 128, 176}, { -632, 104, 240}, // 96 seconds { -800, 72, 288}, { -952, 208, 328}, { -1328, 256, 368}, { -1960, 552, 616}, { -1336, 632, 272}, { -1112, 696, -40}, { -1040, 240, 216}, { -1136, 176, 232},...
{ -1424, 312, 16}, { -1456, 232, 72}, { -1464, 64, 240}, { -1424, 200, 264}, { -1296, 416, 408}, { -1080, 472, 432}, { -1056, 304, 384}, { -1112, 312, 328}, { -960, 384, 328}, { -816, 416, 280}, { -976, 496, 504}, { -1016, 544, 608}, { -1376, 704, 520}, { -1024, ...
{ -24, -272, -904}, { 16, -272, -952}, { -8, -352, -944}, { -128, -320, -968}, { 16, -336, -1088}, { 152, -360, -960}, { 256, -296, -920}, { 128, -192, -840}, { 112, -120, -848}, { 176, -136, -912}, { 168, -160, -880}, { 184, -128, -896}, { 96, -184, -856}, { 64, ...
{ -608, -504, -496}, { -792, -416, -480}, { -944, -656, -656}, { -912, -328, -736}, { -952, -64, -696}, { -912, 48, -608}, { -752, 120, -592}, // 21 seconds { -632, -32, -368}, { -344, -184, -624}, { -352, -432, -600}, { -384, -312, -784}, { -480, -312, -688}, { -...
{ 536, 688, 136}, { 480, 680, 80}, { 424, 744, 80}, { 408, 792, 16}, { 416, 872, 80}, { 440, 904, 80}, { 496, 872, 136}, { 536, 976, 128}, { 496, 896, 112}, { 488, 832, 88}, { 512, 800, 96}, { 560, 840, 120}, { 560, 824, 160}, { 528, 824, 176}, { 520, 784, 16...
ON_ORIGIN_RECT, END_ON_ORIGIN_RECT, 10); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_inside_origin_layer_aa.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 10); graphics_line_draw_precise_stroked_aa(&ctx, START_ON_ORIGIN_RECT_XY, END_ON_ORIG...
(&ctx.dest_bitmap, "draw_stroke_precise_same_point_offset_layer_aa.${BIT_DEPTH_NAME}.pbi")
); #endif } void test_graphics_draw_stroke_precise_${BIT_DEPTH_NAME}__offset_layer_non_aa(void) { GContext ctx; test_graphics_context_init(&ctx, fb); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, false, 10); graphics_line_draw_precise_stroked_non_aa(&ctx, START_ON_ORIGIN_RECT, END_ON_OR...
int16_t fin_offset_x; int16_t past_fin_offset_y; int16_t future_fin_offset_y; uint16_t past_top_margin; uint16_t past_thin_pin_margin; uint16_t future_top_margin; uint16_t left_margin; uint16_t right_margin; int16_t icon_offset_y; uint16_t icon_right_margin; uint16_t fat_pin_height; uint16_t thin_...
GSize(width, style->fat_pin_height)
; break; case LayoutLayerModePinnedThin: *size = GSize(width, style->thin_pin_height); break; } } static void prv_get_frame(TimelineLayer *layer, int index, GRect *frame) { const TimelineLayerStyle *style = prv_get_style(); index = CLIP(index, 0, (int)ARRAY_LENGTH(s_height_offsets) - 1); ...
/* * 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...
( PULSE_MAX_SEND_SIZE + PULSE_MIN_FRAME_LENGTH)
+ COBS_OVERHEAD(PULSE_MAX_SEND_SIZE)]; typedef void (*ProtocolHandlerFunc)(void *packet, size_t length); typedef void (*LinkStateChangedHandlerFunc)(PulseLinkState link_state); typedef struct PACKED ProtocolHandler { uint8_t number; ProtocolHandlerFunc handler; LinkStateChangedHandlerFunc link_state_handler; }...
2; // June 9th 2015, 12:00:00 (T+00:00:00) rtc_set_time(event_time); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("NOW", time_buf); // June 9th 2015, 12:00:59 (T+00:00:59) rtc_set_time(event_time + (1 * SECONDS_PER_MINUTE) - 1); clock_get...
("2 H AGO", time_buf)
; // June 9th 2015, 14:00:00 (T+02:00:00) rtc_set_time(event_time + (2 * SECONDS_PER_HOUR)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("12:00 PM", time_buf); // June 9th 2015, 23:59:59 (T+11:59:59) rtc_set_time(event_time + (11 * SECONDS_...
; cl_assert_equal_i(s_num_alarm_events_put, 1); cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); } void test_alarm_smart__dont_trigger_30_min_early_deep_sleep(void) { AlarmId id; id = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALARM_KIND_EVERYDAY, .is_smart = ...
cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); }
ic void prv_render_current_sleep_text(GContext *ctx, Layer *base_layer) { HealthSleepSummaryCardData *data = layer_get_data(base_layer); const int y = PBL_IF_RECT_ELSE(PBL_IF_BW_ELSE(85, 83), 88); const GRect rect = GRect(0, y, base_layer->bounds.size.w, 35); const int current_sleep = health_data_current_slee...
fonts_get_system_font(FONT_KEY_LECO_26_BOLD_NUMBERS_AM_PM)
, .unit_font = fonts_get_system_font(FONT_KEY_LECO_20_BOLD_NUMBERS), .typical_font = fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD), .em_dash_font = fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD), }; return base_layer; } void health_sleep_summary_card_select_click_handler(Layer *layer) { HealthSleepS...
aturday_00_30); do_not_disturb_handle_clock_change(); active = do_not_disturb_is_active(); cl_assert(active == false); // Timer will go off at 01:00 on Saturday. (0.5 hours) cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 1800 * MS_PER_SECOND); rtc_set_time(s_saturday_01_30); do_not_disturb...
rtc_set_time(s_saturday_10_30)
; do_not_disturb_handle_clock_change(); active = do_not_disturb_is_active(); cl_assert(active == false); // Timer will go off at 01:00 on Sunday. (13.5 hours) cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 48600 * MS_PER_SECOND); rtc_set_time(s_sunday_9_30); do_not_disturb_handle_clock_cha...
gsFile *file, SettingsRecordInfo *info, void *context) { // check entry is valid if (info->val_len == 0 || info->key_len != sizeof(BTBondingID)) { return true; // continue iterating } KeyForSMPairingItrData *itr_data = (KeyForSMPairingItrData*) context; BT...
if (is_gateway && status == GapBondingFileSetUpdated) { prv_update_bondings(key, BtPersistBondingTypeBLE); }
ies, sessions); cl_assert_equal_i(sessions[0].type, ActivitySessionType_Nap); cl_assert_equal_i(sessions[1].type, ActivitySessionType_Nap); } { // Create a 2 hour session that ends after 9pm ==> should be regular sleep ActivitySession sessions[] = { { .start_utc = start_of_today + (20 * S...
("\n Counted %d steps next 40m", steps_awake_100m - steps_awake_60m)
bool schedule_6[7] = {false, false, false, false, true, false, false}; char alarm_day_text_6[32] = {0}; alarm_get_string_for_custom(schedule_6, alarm_day_text_6); cl_assert_equal_s(alarm_day_text_6, "Thursdays"); bool schedule_7[7] = {false, false, false, false, false, true, false}; char alarm_day_text_7[32]...
alarm_get_string_for_kind(ALARM_KIND_WEEKENDS, all_caps)
, "Weekends"); cl_assert_equal_s(alarm_get_string_for_kind(ALARM_KIND_JUST_ONCE, all_caps), "Once"); cl_assert_equal_s(alarm_get_string_for_kind(ALARM_KIND_CUSTOM, all_caps), "Custom"); all_caps = true; cl_assert_equal_s(alarm_get_string_for_kind(ALARM_KIND_EVERYDAY, all_caps), "EVERY DAY"); cl_assert_equal_...
true; } // If there is no valid UUID, it means we don't know what app UUID is associated with the // transport, consider it as a fallback option: const bool is_unknown_app_session = (session->destination == TransportDestinationApp && uuid_is_invalid(session_uuid)); const...
{ if (app_manager_get_current_app_md()->allow_js) { return comm_session_get_system_session(); } return comm_session_get_by_type(CommSessionTypeApp); }
void comm_session_sanitize_app_session(CommSession **session_in_out) { CommSession *permitted_session = comm_session_get_current_app_session(); if (!permitted_session) { // No session connected that can serve the currently running app *session_in_out = NULL; return; } if (*session_in_out == NULL) ...
he intent for the device: GAPLEConnectionIntent *intent = prv_get_intent_by_bonding_id(bonding_id); BTErrno ret_value; if (!intent) { // No intent for given device ret_value = BTErrnoInvalidParameter; } else { ret_value = prv_unregister_intent(intent, client, true /* should_send_disconnection_event ...
bt_unlock()
; return count; }
(&s_items[s_correct_order[1]].header.id, &timeline_model_get_iter_state(-1)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[2]].header.id, &timeline_model_get_iter_state(0)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[3]].header.id, &timeline_model_get_iter_state...
(timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(3))
; cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(4)); cl_assert(timeline_model_get_iter_state(2) == timeline_model_get_iter_state_with_timeline_idx(5)); cl_assert(timeline_model_iter_prev(&new_idx, NULL)); cl_assert_equal_i(new_idx, 2); cl_assert_equal_i(timelin...
T(page_idx[i]), sizeof(data)); data.magic = SprfMagic_ValidEntry; flash_write_bytes((uint8_t *) &data, SPRF_PAGE_FLASH_OFFSET(page_idx[i]), sizeof(data)); // Call init and see if it found the valid page shared_prf_storage_init(); uint32_t desired_page_idx = page_idx[i]; if (page_idx[i] > SPRF_M...
(PAIRING_INFO.remote_encryption_info.rand, pairing_info_out.remote_encryption_info.rand)
; cl_assert_equal_i(PAIRING_INFO.remote_encryption_info.ediv, pairing_info_out.remote_encryption_info.ediv); cl_assert_equal_i(memcmp(&PAIRING_INFO.remote_encryption_info.ltk, &pairing_info_out.remote_encryption_info.ltk, sizeof(SMLongTermKey)), 0); cl_assert_equal_i...
le_input(void) { // NOTE: This function may be called from an ISR if (s_input_enabled) { return; } prv_lock(); if (s_sent_data) { // wait for the TC flag to be set uart_wait_for_tx_complete(ACCESSORY_UART); // wait a little for the lines to settle down const uint32_t us_to_wait = (1000000...
{ s_did_send_byte = false; if (s_stream_cb(s_stream_context)) { // the callback MUST send a byte in order for this interrupt to trigger again PBL_ASSERTN(s_did_send_byte); } else { // we're done sending portBASE_TYPE was_higher_task_woken = pdFALSE; xSemaphoreGiveFromISR(s_send...
else { // we haven't yet received back the byte we sent uart_set_tx_interrupt_enabled(dev, false); } return should_context_switch; } // Commands //////////////////////////////////////////////////////////////////// void command_accessory_power_set(const char *on) { if (!strcmp(on, "on")) { accessory_...
2, -320}, { 1352, 304, -240}, { 1832, 496, -352}, { 1792, 832, -384}, { 1352, 816, -496}, { 1040, 1040, -624}, { 952, 1080, -384}, { 1152, 992, -240}, { 1072, 760, -312}, { 1112, 792, -216}, { 1336, 832, -96}, { 1376, 480, -80}, { 1312, 304, -104}, { 1328, 248, -128},...
{ 1064, 288, -88}, // 26 seconds { 1040, 288, -8}, { 1040, 264, -40}, { 1080, 224, -64}, { 1152, 232, -72}, { 944, 240, -184}, { 720, -24, -208}, { 680, 16, -232}, { 832, 176, -376}, { 1056, 232, -384}, { 1272, 352, -304}, { 1176, 400, -272}, { 1056, 440, -184}, ...
p_state.h" #include "stubs_applib_resource.h" #include "stubs_compiled_with_legacy2_sdk.h" #include "stubs_heap.h" #include "stubs_logging.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_pebble_tasks.h" #include "stubs_print.h" #include "stubs_resources.h" #include "stubs_serial.h" #include ...
gtransform_is_only_scale(&t)
); cl_assert(gtransform_is_only_scale(&t_c)); t_c = GTransformScaleFromNumber(2, 5); cl_assert(gtransform_is_equal(&t, &t_c)); // Test Translation Matrix t = GTransformTranslation(GTransformNumberFromNumber(2), GTransformNumberFromNumber(5)); t_c = GTransformFromNumbers(1, 0, 0, 1, 2, 5); cl_assert(gtr...
music_ctx.mutex = mutex_create_recursive(); } static void copy_and_truncate(char *dest, const char *src, size_t src_length) { size_t cropped_length = MIN(MUSIC_BUFFER_LENGTH - 1, src_length); if (src) { memcpy(dest, src, cropped_length); } dest[cropped_length] = 0; } static void prv_put_now_playing_change...
prv_update_string_and_put_event(title, title_length, o)
e file system. This is the sum of the // file sizes of all the DLS files. static uint32_t prv_get_total_file_system_bytes(void) { uint32_t size = 0; dls_list_for_each_session(prv_accumulate_size_cb, &size); PBL_LOG_D(LOG_DOMAIN_DATA_LOGGING, LOG_LEVEL_DEBUG, "Total used space: %d", (int)size); return size; } ...
PBL_ASSERTN(session->storage.fd != DLS_INVALID_FILE)
; status_t status = pfs_close(session->storage.fd); if (status != S_SUCCESS) { PBL_LOG(LOG_LEVEL_ERROR, "Error %d closing file for session %d", (int)status, session->comm.session_id); } session->storage.fd = DLS_INVALID_FILE; } // --------------------------------------------------------------...
, { -1200, 40, -64}, { -1224, 56, -80}, { -1144, 64, -80}, { -1024, 96, -72}, { -1096, 72, -24}, { -1048, -56, 56}, { -784, -88, -48}, { -1064, 16, -152}, { -1176, 72, -288}, { -1024, 48, -384}, // 21 seconds { -1240, -16, -368}, { -1376, -24, -336}, { -1240, -16,...
{ -1536, 616, -16}, { -1496, 616, -16}, { -1560, 1096, -56}, { -1552, 936, -24}, { -1288, 1136, -280}, { -1112, 1000, -352}, { -680, 536, -496}, { -264, 344, -520}, { 56, -192, -464}, { 424, -344, -528}, { 320, -208, -552}, { 304, -408, -408}, { 184, -480, -344}, ...
{ -216, -496, -512}, { -400, -104, -472}, { -496, 136, -432}, { -600, 240, -272}, { -720, 552, -592}, { -752, 552, -392}, { -1064, 792, -552}, { -1232, 696, -432}, { -1448, 872, -352}, { -1920, 768, -288}, { -2568, 928, -168}, // 29 seconds { -1808, 1144, 24}, { ...
:30 AM DoNotDisturbSchedule weekday_schedule_2 = { .from_hour = 22, .from_minute = 30, .to_hour = 8, .to_minute = 30, }; // 12 AM - 10 AM DoNotDisturbSchedule weekend_schedule_2 = { .from_hour = 0, .from_minute = 0, .to_hour = 10, .to_minute = 0, }; do_not_disturb_set_sched...
do_not_disturb_is_manually_enabled()
; cl_assert(enabled == true); active = do_not_disturb_is_active(); cl_assert(active == true); do_not_disturb_set_manually_enabled(false); enabled = do_not_disturb_is_manually_enabled(); cl_assert(enabled == false); active = do_not_disturb_is_active(); cl_assert(active == false); // Reset override an...