prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT_NXNY, RADIUS_MIN_CALCULATED); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_origin_aa_r3_no_clip.${BIT_DEPTH_NAME}.pbi")); // Radius of 2 - ending point for precomputed edges setup_test_aa_sw(&ct...
(&ctx, CENTER_OF_OFFSET_RECT_NXNY, RADIUS_MEDIUM)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_offset_aa_r8_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // Small circles setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, 1); graphics_draw_circle(&ctx, CENTER_OF_OFFSET_RECT, RADIUS_SMALL); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ bt_test_enter_hci_passthrough(); }
void command_bt_test_bt_sig_rf_mode(void) { if (bt_test_bt_sig_rf_test_mode()) { prompt_send_response("BT SIG RF Test Mode Enabled"); } else { prompt_send_response("Failed to enter BT SIG RF Test Mode"); } } void command_bt_prefs_wipe(void) { bt_driver_classic_disconnect(NULL); bt_persistent_storag...
/* * 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...
{ AppRunState *app_run_state = (AppRunState*)data; CommSession *session = comm_session_get_system_session(); if (session) { if (comm_session_has_capability(session, CommSessionRunState)) { char uuid_buffer[UUID_STRING_BUFFER_LENGTH]; bool success = comm_session_send_data(session, PB_APP_STATE_END...
r/jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-helpers.h" #include "applib/rockyjs/api/rocky_api_global.h" #include <clar.h> #include <math.h> // Fakes #include "fake_logging.h" #include "fake_pbl_malloc.h" #if EMSCRIPTEN #include "fake_time_timeshift_js.h" #else #include "fake_time.h" #endif // Stubs #...
prv_do_call_user_function(script)
; cl_assert(*s_log_internal__expected == NULL); } void test_rocky_api_util__call_throw_number(void) { s_log_internal__expected = (const char *[]){ "Unhandled exception", " 1", NULL }; const char *script = "var "FUNC_NAME" = function() { throw 1; };"; prv_do_call_user_function(script); cl_asse...
{ const SystemAppGlanceFactory *factory = &s_system_glance_factories[i]; if (uuid_equal(&factory->uuid, &node->uuid)) { glance = factory->constructor(node); break; } } // If we haven't loaded a glance yet, try loading a generic glance for the node if (!glance) { glance = launcher_app_...
prv_fetch_from_cache_or_load_glance_for_node(node, service)
: prv_load_glance_for_node(node, service); // Draw the glance in the provided frame launcher_app_glance_draw(ctx, frame, glance, is_highlighted); // If we didn't use the glance cache, destroy the glance now if (!use_glance_cache) { launcher_app_glance_destroy(glance); } } void...
gbitmap_destroy(src_bitmap)
; } // Test GCompOpTint, from same size to size. // Setup: // - Source is a 10x10 square, white. // - Destination is either a black or white square. // Result: // - When source is transparent or tint color is clear, dest is black. // - When source is opaque, dest is blended blue void test_bitblt__8bit_to_8bit_...
ctx->draw_state.stroke_color = tmp_color; // We're done here return; } else */ if (radius_outer.raw_value - radius_inner.raw_value < FIXED_S16_3_ONE.raw_value) { // Abort, abort! return; } prv_fill_oval_precise(ctx, center, radius_outer, radius_outer, radius_inner, radi...
(rect, scale_mode, &center, &radius)
; return gpoint_from_polar_precise(&center, radius.raw_value, angle); } GPoint gpoint_from_polar(GRect rect, GOvalScaleMode scale_mode, int32_t angle) { const GPointPrecise result = prv_gpointprecise_from_polar(&rect, scale_mode, angle); return GPointFromGPointPrecise(result); } GRect grect_centered_internal(co...
egion header base_address = core_dump_get_slot_address(start_idx); CD_ASSERTN(base_address + CORE_DUMP_MAX_SIZE <= CORE_DUMP_FLASH_END); prv_flash_erase_region(base_address, CORE_DUMP_MAX_SIZE); region_hdr = (CoreDumpFlashRegionHeader) { .magic = CORE_DUMP_FLASH_HDR_MAGIC, .last_used = max_last_used + 1...
// Pop the exception stack frame, taking stack alignment into account. // The 10th bit of the pushed xPSR indicates whether an alignment word was // inserted into the stack frame during exception entry in order to make // sp 8-byte aligned. // Note that this is going to be wrong if the flo...
// Write out this thread info chunk_hdr.key = CORE_DUMP_CHUNK_KEY_THREAD; chunk_hdr.size = sizeof(packed_info); s_flash_addr += prv_flash_write_bytes(&chunk_hdr, s_flash_addr, sizeof(chunk_hdr)); s_flash_addr += prv_flash_write_bytes(&packed_info, s_flash_addr, ...
AD_BYTES_COUNT, s_analytics_read_bytes_count, AnalyticsClient_App); analytics_set(ANALYTICS_APP_METRIC_FLASH_WRITE_BYTES_COUNT, s_analytics_write_bytes_count, AnalyticsClient_App); // The overhead cost of tracking whether each flash read was due to the foreground // or background ...
(s_erase.address)
; PBL_ASSERT(PASSED(status), "Erase suspend failure: %" PRId32, status); if (status == S_NO_ACTION_REQUIRED) { // The erase has already completed. No need to resume. s_erase.in_progress = false; } else { s_erase.suspended = true; } } } //! Assumes that s_flash_lock is held. static v...
/* * 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_cache_buffer[1], &s_test_item[2], sizeof(TestCacheItem))
; cl_assert_equal_m(&s_cache_buffer[2], &ZERO_ITEM, sizeof(TestCacheItem)); circular_cache_push(&s_test_cache, &s_test_item[1]); cl_assert_equal_m(&s_cache_buffer[0], &s_test_item[0], sizeof(TestCacheItem)); cl_assert_equal_m(&s_cache_buffer[1], &s_test_item[2], sizeof(TestCacheItem)); cl_assert_equal_m(&s_c...
-288}, { -496, -840, -280}, { -496, -840, -288}, { -496, -832, -288}, { -496, -848, -288}, { -504, -840, -296}, { -496, -840, -296}, { -496, -840, -288}, { -496, -848, -288}, { -496, -848, -288}, { -496, -840, -288}, { -496, -840, -280}, { -504, -840, -288}, { -496, -...
{ -496, -848, -280}, { -504, -848, -288}, { -504, -848, -280}, { -496, -840, -280}, { -496, -840, -296}, { -496, -840, -288}, { -496, -840, -288}, { -496, -848, -288}, { -496, -840, -280}, { -496, -840, -280}, { -496, -840, -280}, { -496, -840, -288}, { -496, -840, -2...
{ -496, -840, -288}, { -496, -832, -280}, { -496, -848, -288}, { -496, -848, -288}, // 134 seconds { -488, -832, -296}, { -496, -848, -296}, { -488, -832, -288}, { -496, -840, -288}, { -496, -840, -288}, { -496, -840, -288}, { -496, -840, -280}, { -496, -840, -288}, ...
/* * 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 (settings_file_exists(file, key, key_len)) { const uint8_t key_crc8 = crc8_calculate_bytes(key, key_len, false); return s_settings_file.val_lens[key_crc8]; }
return 0; } status_t settings_file_delete(SettingsFile *file, const void *key, size_t key_len) { if (settings_file_exists(file, key, key_len)) { const uint8_t key_crc8 = crc8_calculate_bytes(key, key_len, false); free(s_settings_file.values[key_crc8]); free(s_settings_fi...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
milliseconds_to_ticks(I2C_ERROR_TIMEOUT_MS)
mitRequest *request = (const CommitRequest *)s_pb_state.receiver.buffer; uint32_t crc = ntohl(request->crc); uint32_t calculated_crc = pb_storage_calculate_crc(&s_pb_state.storage, PutBytesCrcType_Legacy); bool commit_succeeded = (calculated_crc == crc); if (elapsed_time_ms > 0) { int bytes_per_sec = (int...
{ num_put_jobs = job_idx; break; }
token = prv_parse_token(PutBytesPut, (SharedHeader *)job->buffer); if (!prv_do_put((PutRequest *)job->buffer, job->request_length, token)) { // consume the jobs, they are all going to fail prv_mark_pb_jobs_complete(num_put_jobs); return; } } xSemaphoreTake(s_pb_semaphore, portMAX_D...
it 100 seconds before its // expiration time prv_check_expected_slice_data(expected_slice_data, expected_slice_data->expiration_time - 100); // Check that we get back nothing for the current slice if we set the time to exactly when the // only slice in the glance expires prv_check_expected_slice_data(NULL, e...
(no_expire_slice_data, expiring_slice_data->expiration_time + 9999999)
; }
_lock_recursive(s_accel_manager_mutex); AccelDriverSample data; int result = accel_peek(&data); if (result == 0 /* success */) { prv_copy_accel_sample_to_accel_data(&data, accel_data); prv_update_last_accel_data(&data); } mutex_unlock_recursive(s_accel_manager_mutex); return result; } DEFINE_SYS...
if (samples_per_update > ACCEL_MAX_SAMPLES_PER_UPDATE) { return -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...
if (!src_bitmap->palette) { return; }
const int8_t dest_begin_x = (dest_rect.origin.x / 32); const uint32_t * const dest_block_x_begin = ((uint32_t *)dest_bitmap->addr) + dest_begin_x; const int dest_row_length_words = (dest_bitmap->row_size_bytes / 4); // The number of bits between the beginning of dest_block and // the beginning of the nearest...
i")); // Radius of 2 - ending point for precomputed edges setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, STROKE_THREE); graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT_NXNY, RADIUS_MAX_PRECOMPUTED); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_origin_aa_r2_no_clip.${BIT...
graphics_circle_quadrant_draw_stroked_non_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, STROKE_SMALL,GCornerTopLeft)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_r8_quad_top_left.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, STROKE_SMALL); graphics_circle_quadrant_draw_stroked_non_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, STROKE_SMALL,GCornerTopR...
/* * 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 (dialog->callback_context) { dialog->callbacks.unload(dialog->callback_context); } else { dialog->callbacks.unload(dialog); }
} } KinoReel *dialog_create_icon(Dialog *dialog) { return kino_reel_create_with_resource_system(SYSTEM_APP, dialog->icon_id); } bool dialog_init_icon_layer(Dialog *dialog, KinoReel *image, GPoint icon_origin, bool animated) { if (!image) { return false; } const GRect icon_r...
/* * 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...
otp_get_slot(index)
; } } return DUMMY_HWVER; } const char* mfg_get_pcba_serial_number(void) { // Trying from "most recent" slot to "least recent": for (int i = ARRAY_LENGTH(OTP_PCBA_SLOT_INDICES) - 1; i >= 0; --i) { const uint8_t index = OTP_PCBA_SLOT_INDICES[i]; if (otp_is_locked(index)) { return otp_get_slot(...
96, -80}, { -888, -272, -96}, { -944, -280, -16}, { -904, -296, -56}, { -912, -312, -16}, { -880, -288, -120}, { -840, -288, -112}, { -824, -192, -184}, { -840, -96, -256}, { -800, -40, -352}, { -744, 48, -544}, { -784, 512, -1040}, { -792, 432, -1032}, { -704, 176, -...
{ -904, 216, -40}, { -840, 472, -432}, { -792, 1096, -1504}, { -632, 336, -1016}, { -800, -120, -264}, { -960, -552, -192}, { -896, -240, -304}, // 31 seconds { -944, 104, -224}, { -904, 176, -352}, { -864, 128, -360}, { -856, 200, -472}, { -880, 96, -424}, { -896...
/* * 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...
(dci_reel->image)
; } static GDrawCommandImage *prv_get_gdraw_command_image(KinoReel *reel) { if (reel) { return ((KinoReelImplPDCI*)reel)->image; } return NULL; } static GDrawCommandList *prv_get_gdraw_command_list(KinoReel *reel) { if (reel) { return gdraw_command_image_get_command_list(((KinoReelImplPDCI*)reel)->ima...
state.mutex); return success; } // ------------------------------------------------------------------------------------------------ // Get info on the sleep file typedef struct { bool success; bool completed; } ActivityDumpSleepLogContext; static void prv_dump_sleep_log_system_cb(void *context_param) { Activ...
{ activity_start_tracking(test_mode); while (!s_activity_state.started) { sys_psleep(1); } }
return true; } // ------------------------------------------------------------------------------------------------ // Get info on the sleep file typedef struct { bool compact_first; uint32_t num_records; uint32_t data_bytes; uint32_t minutes; bool success; bool completed; } ActivitySleepFileInfoContext...
the starting point if (alarm_a->info.hour > alarm_b->info.hour) { return true; } if (alarm_a->info.hour == alarm_b->info.hour && alarm_a->info.minute > alarm_b->info.minute) { return true; } return false; } static void prv_clear_alarm_list(AlarmsAppData* data) { while (data->alarm_list_head) { ...
(data, id)
; } } static void prv_handle_alarm_event(PebbleEvent *e, void *callback_context) { AlarmsAppData *data = (AlarmsAppData *)callback_context; prv_update_alarm_list(data); } static void prv_create_new_alarm(AlarmsAppData* data) { Window *editor = alarm_editor_create_new_alarm(prv_handle_alarm_editor_complete, da...
-72, -32}, { 584, -72, -88}, { 808, 32, -144}, { 1464, -248, 176}, { 1960, 48, 440}, // 16 seconds { 1872, 456, 200}, { 1712, 512, -48}, { 1472, 504, 168}, { 1232, 400, 312}, { 1128, 224, 376}, { 1048, 272, 256}, { 968, 328, 160}, { 912, 496, 40}, { 896, 544, 24},...
{ 1936, -288, 144}, { 1928, 176, 64}, { 1776, 384, -184}, { 1576, 320, -96}, { 1208, 264, 320}, { 1056, 152, 352}, { 1000, 144, 280}, { 888, 240, 216}, { 800, 368, 96}, { 776, 488, -56}, { 808, 480, 56}, // 22 seconds { 984, 328, 144}, { 1144, 448, 128}, { 164...
{ 1600, 312, 112}, { 1528, 256, 64}, { 1136, 312, 40}, { 1224, 176, 72}, { 1048, 112, 584}, { 1096, 160, 152}, { 1112, -96, 224}, { 904, 48, 152}, { 816, 80, 64}, { 728, 0, 104}, { 680, 0, 48}, { 664, -32, 48}, { 720, -80, 32}, { 952, -24, 0}, { 1256, -152, 1...
, uint32_t buffer_size); // ---------------------------------------------------------------------------------------- // Private globals static uint32_t s_flash_addr; // next address in flash to write to // Saved registers before we trigger our interrupt: [r0-r12, sp, lr, pc, xpsr] static ALIGN(4) Co...
(LOG_LEVEL_ALWAYS, __FILE_NAME__, 0)
; pulse_logging_log_sync_append(ctx, msg); pulse_logging_log_sync_append(ctx, s); pulse_logging_log_sync_send(ctx); #else int max_length = 256; while (*msg && max_length--) { dbgserial_putchar(*msg); ++msg; } dbgserial_putstr(s); #endif } // ------------------------------------------------------...
* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the Lice...
{ history[i] = s_sys_activity_get_metric_values.out.history[i]; }
} return s_sys_activity_get_metric_values.out.result; } void event_service_client_subscribe(EventServiceInfo * service_info) {} void event_service_client_unsubscribe(EventServiceInfo * service_info) {} static UnitsDistance s_units_distance_result; UnitsDistance sys_shell_prefs_get_units_distance(void) { retu...
ssert_equal_i(recognizers[3]->state, RecognizerState_Cancelled); // Layer C's and layer A's recognizers get reset when layer B becomes the new active layer prv_set_all_states(recognizers, k_rec_count, RecognizerState_Started); prv_cancel_layer_tree_recognizers(&manager, &layer_b, &layer_c); cl_assert_equal_i(r...
(recognizers[0]->state, RecognizerState_Possible)
; cl_assert_equal_i(recognizers[1]->state, RecognizerState_Possible); cl_assert_equal_i(recognizers[3]->state, RecognizerState_Possible); cl_assert_equal_i(recognizers[4]->state, RecognizerState_Possible); // All recognizers receive events while none have started recognizing e.type = TouchEvent_PositionUpdat...
e PREF_KEY_ACTIVITY_PREFERENCES "activityPreferences" static ActivitySettings s_activity_preferences = ACTIVITY_DEFAULT_PREFERENCES; #define PREF_KEY_ACTIVITY_ACTIVATED_TIMESTAMP "activityActivated" static time_t s_activity_activation_timestamp = 0; #define PREF_KEY_ACTIVITY_ACTIVATION_DELAY_INSIGHT "activityActivati...
{ s_backlight_intensity = *intensity; return true; }
s_backlight_intensity = prv_convert_backlight_percent_to_intensity(BOARD_CONFIG.backlight_on_percent); return false; } static bool prv_set_s_backlight_motion_enabled(bool *enabled) { s_backlight_motion_enabled = *enabled; return true; } static bool prv_set_s_stationary_mode_enabled(bool *enabled) { s_s...
s_invalidate_all_references(); } // Keep around the BLECharacteristic references: memcpy(s_ancs_client->characteristics, characteristics, sizeof(BLECharacteristic) * NumANCSCharacteristic); // Subscribe to Data, then to Notification characteristics: for (int c = ANCSCharacteristicData; c >= ANCSCha...
(data != NULL)
; analytics_inc(ANALYTICS_DEVICE_METRIC_NOTIFICATION_ANCS_DS_COUNT, AnalyticsClient_System); if (length < 1) { PBL_LOG(LOG_LEVEL_ERROR, "Received ANCS DS notification of length 0"); return; } analytics_add(ANALYTICS_DEVICE_METRIC_NOTIFICATION_BYTE_IN_COUNT, length, AnalyticsClient_System); if (s_a...
ected_image) { GContext *ctx = malloc(sizeof(GContext)); test_graphics_context_init(ctx, fb); framebuffer_clear(fb); graphics_context_set_antialiased(ctx, true); // Start by filling the framebuffer with green pixels to make things easier to see memset(ctx->dest_bitmap.addr, GColorGreenARGB8, FRAMEBUFFER_S...
prv_test_clipping_mask(prv_left_flip_third_quarter_frame_clipping, "left_flip_third_quarter_frame_clipping")
; }; // This test records a clipping mask of the last frame of the left "round flip" compositor // transition animation and then clips a full-screen red rectangle to the resulting mask static void prv_left_flip_last_frame_clipping(GContext *ctx) { compositor_round_flip_transitions_flip_animation_update(ctx, ANIMATI...
cl_assert(prv_get_subscriber_state_from_ref(session_ref) == state); cl_assert(state->update_interval_s == update_interval_b_s); cl_assert(state->expire_utc == rtc_get_time() + expire_b_s); } #define NUM_TEST_EVENTS 2 void test_hrm_manager__circular_buffer_event_copy(void) { // Make sure there will be unaligne...
(num_updates <= HRM_CHECK_SENSOR_DISABLE_COUNT)
; // The timer should be set to fire just before we need another update uint32_t timeout_ms = stub_new_timer_timeout(prv_get_timer_id()); cl_assert_equal_i(timeout_ms, (update_interval_s - HRM_SENSOR_SPIN_UP_SEC) * MS_PER_SECOND); // Fire the timer after the elapsed time, make sure we are re-enabled after th...
the initializer value is not constant static GDrawState prev_state; prev_state = ctx->draw_state; gpoint_add_eq(&ctx->draw_state.drawing_box.origin, s_animation_state.modal_offset); modal_manager_render(ctx); ctx->draw_state = prev_state; } // Compositor implementation ////////////////////////////////////...
{ if ((s_state == CompositorState_Transitioning) || !prv_should_render()) { // Don't let the modal redraw itself when the redraw loop is being currently driven by an // animation or if a display update is in progress. return; } if ((s_state == CompositorState_AppTransitionPending) && (modal_man...
s_app_hidden_and_unfocused = (!(update.properties & ModalProperty_Transparent) && !is_modal_unfocused); const bool was_app_hidden_and_unfocused = (!(last_properties & ModalProperty_Transparent) && !was_modal_unfocused); if (!was_app_hidden_and_unfocused && is_app_hidden_and_unfocused) { // The app i...
{ // A different modal window now has focus window->is_click_configured = false; }
// Set the last highest visible modal priority if (is_visible) { ctx->highest_idx = iter->current_idx; } // Update properties based on state changes // If this callback was called, there exists a modal ctx->properties |= ModalProperty_Exists; if (iter->current_idx > ModalPriorityDiscreet) { //...
lized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("59 MIN AGO", time_buf); // June 9th 2015, 12:59:59 (T+00:59:59) rtc_set_time(event_time + (59 * SECONDS_PER_MINUTE) + 59); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_...
("2 H AGO", time_buf)
; // June 9th 2015, 13:59:59 (T+01:59:59) rtc_set_time(event_time + SECONDS_PER_HOUR + (59 * SECONDS_PER_MINUTE) + 59); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("2 H AGO", time_buf); // June 9th 2015, 14:00:00 (T+02:00:00) rtc_set_time(e...
er.id, &s_all_day_items[2].header.id)); cl_assert(state.node->all_day); // check that the item we see is timestamped at local midnight rather than utc midnight // 1421136000 is midnight Jan 13, PST cl_assert_equal_i(state.pin.header.timestamp, 1421136000); // second all day event cl_assert(iter_next(&itera...
cl_assert(!iter_next(&iterator))
/* * 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...
(zero_length_date)
; cl_assert_equal_i(calculated, 0); }
{ cl_fail("Dictionary `B` contained more tuples than dictionary `A`."); } else if (a_tuple) { cl_fail("Dictionary `A` contained more tuples than dictionary `B`."); } } // Callbacks //////////////////////////////////// static void prv_out_sent_callback(DictionaryIterator *sent, void *context) { s_out_se...
{ cl_assert(false); }
} static void prv_no_reply_callback(uint16_t endpoint_id, const uint8_t* data, unsigned int length) { } // Overrides /////////////////////////////////// bool sys_app_pp_has_capability(CommSessionCapability capability) { return true; } static int s_sys_psleep_last_millis; void sys_psleep(int millis) { s...
312}, { 1120, 184, -120}, { 1600, 4000, -768}, { 664, 4000, -1600}, { -864, 2280, -848}, { -864, 1072, -416}, { -784, 360, -304}, { -728, -256, -192}, { -984, -328, -144}, { -848, -272, -240}, { -640, -168, -104}, { -824, 208, -72}, { -1928, 3048, -1440}, { -856, 400...
ARRAY_LENGTH(samples)
; return samples; } // ---------------------------------------------------------------- // Sample captured: 2015-10-09 10:43:31 local AccelRawData *activity_sample_run_100_temp_95866_6(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME run_100_temp_95866_6 //> TEST...
= (AnimationUpdateImplementation) prv_complex_animation_update, }; // ------------------------------------------------------------------------------------------- static Animation *prv_complex_init(Animation *parent_h, Animation **animation_array, uint32_t array_len, AnimationType ty...
prv_complex_create(children, num_children, from->type)
; clone = prv_find_animation_by_handle(state, clone_h, false /*quiet*/); } if (!clone) { for (int i = 0; i < num_children; i++) { animation_destroy(children[i]); } return NULL; } } else { if (from->is_property_animation) { PropertyAnimationPrivate *prop = propert...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (s_fsm_state != expected_state) { return false; }
tic 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; } void test_rocky_api_util_args__boolean(void) { // N...
(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, ""); ASSERT_JS_ERROR(error_value, NULL /* Never errors out! ...
t tomorrow_midnight = today_midnight + SECONDS_PER_DAY; return health_service_sum(metric, today_midnight, tomorrow_midnight); #endif } // ---------------------------------------------------------------------------------------------- HealthValue health_service_sum(HealthMetric metric, time_t time_start, time_t time_...
(metric, time_start, time_end, aggregation, scope)
) { return 0; } // Get our state HealthServiceState *state = prv_get_state(true); if (scope == HealthServiceTimeScopeOnce && prv_is_heart_rate_metric(metric)) { return prv_hr_aggregate_averaged(state, metric, time_start, time_end, aggregation); } // -------- // If asked for an averaged sum over...
/* * 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...
handle_deinit()
; } const PebbleProcessMd* timer_app_get_info() { static const PebbleProcessMdSystem s_app_info = { .common.main_func = &s_main, .name = "Timer Cancel Test" }; return (const PebbleProcessMd*) &s_app_info; }
/* * 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(4, string_list_count(list))
; cl_assert_equal_s("", string_list_get_at(list, 0)); cl_assert_equal_s("", string_list_get_at(list, 1)); cl_assert_equal_s("", string_list_get_at(list, 2)); cl_assert_equal_s("", string_list_get_at(list, 3)); // non-null-terminated string is treated as one string - this is the standard case // please note...
/* * 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_text_buf, 80, "Press [SELECT] to allocate %dB", ALLOC_SIZE)
; text_layer_set_text(text_heap_info, s_text_buf); layer_add_child(window_layer, text_layer_get_layer(text_heap_info)); } static void deinit(void) { // Don't free anything } int main(void) { init(); app_event_loop(); deinit(); }
bounds.origin.x + (((src_x - src_bitmap->bounds.origin.x)) % src_bitmap->bounds.size.w); } else { // Increment source but don't draw continue; } } GColor src_color = *(GColor8 *) &src[src_x]; GColor actual_color = src_col...
{ dest[dest_x] = GColorWhite.argb; }
} break; case GCompOpOr: for (int i = src_start_idx; i < src_end_idx; ++i, ++dest_x) { const uint32_t bit = (1 << i); const bool set = src & bit; if (set) { dest[dest_x] = GColorWhite.argb; } } brea...
tatus_t status = prv_try_restart_interrupted_erase( is_subsector, erase_in_progress_address); if (PASSED(status)) { break; } PBL_LOG(LOG_LEVEL_ERROR, "Flash erase failed, status %"PRIi32, status); if (attempt++ >= MAX_ERASE_RETRIES) { // We've tried all we can. No point...
{ #endif PBL_ASSERT(PASSED(status), "flash_impl_get_write_status returned %" PRId32, status); #ifdef TEST_FLASH_LOCK_PROTECTION } #endif buffer += written; start_addr += written; buffer_size -= written; // Give higher-priority tasks a chance to access the flash in between // e...
stop_mode_enable(InhibitorFlash); mutex_unlock(s_flash_lock); } // Returns 0 if the erase has completed, or a non-zero expected duration (in // ms) if not. If the erase has not finished (non-zero has been returned), the // caller is responsible for calling the prv_flash_erase_poll() method until // the erase comp...
.timestamp = 0x53f0dda6, }, .attr_list = { .num_attributes = 2, .attributes = attributes, }, .action_group = { .num_actions = 1, .actions = &actions[2], } }; Uuid i3; uuid_generate(&i3); TimelineItem e3 = { .header = { .id = i3, .type = TimelineItemTy...
free(r.allocated_buffer); const size_t block_size = file_size / 4; int erase_count = block_size / notif_size + (((block_size % notif_size) > 0) ? 1 : 0); int j; for (j = 0; j < erase_count; j++) { e.header.id = uuids[j]; e.header.timestamp = timestamp + j; cl_assert_equal_b(notification_storage_g...
free(r.allocated_buffer); //Ensure that compression does not remove old notifications e.header.id = uuids[j]; e.header.timestamp = timestamp + j; cl_assert(notification_storage_get(&uuids[j], &r)); compare_notifications(&e, &r); free(r.allocated_buffer); //Add another notification. Compression should...
oid *context) { timeline_item_destroy(context); } static void prv_handle_do_response_response(ActionResultData *data) { TimelineItem *item = timeline_item_copy(data->chaining_data.notif); if (!item) { PBL_LOG(LOG_LEVEL_WARNING, "No notification in chaining data"); prv_cleanup_action_result(data, false /*...
prv_cleanup_action_result(data, false /* success */)
; PBL_LOG(LOG_LEVEL_WARNING, "Unknown Action Response"); break; } } static void prv_subscribe_to_action_results_and_timeouts(ActionResultData *data, bool ignore_failures) { data->event_service_info = (EventServiceInfo) { .type = PEBBLE_SYS_NO...
PBL_ASSERTN(timer != TIMER_INVALID_ID); new_timer_start(timer, timeout, prv_ui_update_reset_delay_timer_callback, NULL, 0); } //! Note: For now we just call into storage directly for the status of FW installs. Someday, //! it would be nice for this exchange to take place as part of PutBytes extern bool pb_storage_...
(LOG_LEVEL_ERROR, "Invalid message received, type is %u", data[1])
; break; } } void system_message_send_firmware_start_response(FirmwareUpdateStatus status) { struct PACKED { uint8_t zero; uint8_t type; uint8_t status; } msg = { .zero = 0x00, .type = SysMsgFirmwareStartResponse, .status = status }; CommSession *session = comm_session_get_system...
/, 120 /*hr*/, HRMQuality_Good, true /*force_continuous*/); cl_assert_equal_i(s_num_hr_events, 1); // Should fire off an event. OffWrist, tell clients prv_advance_time_hr(1 /*sec*/, 120 /*hr*/, HRMQuality_OffWrist, true /*force_continuous*/); cl_assert_equal_i(s_num_hr_events, 2); cl_assert_equal_i(s_last_hr...
(ActivityMetricRestingKCalories, 2, metric_values)
ze = sizeof(s_test_transcription_example); result = transcription_validate(validate_test, test_size); cl_assert_equal_p(result, true); result = transcription_validate(NULL, test_size); cl_assert_equal_p(result, false); result = transcription_validate(validate_test, test_size - 1); cl_assert_equal_p(result...
transcription_iterate_words((TranscriptionWord *)words_test, 3, (TranscriptionWordIterateCb)prv_cb_return_false, (void *) 0)
; cl_assert_equal_p(result, words_test); s_count = 0; result = transcription_iterate_words((TranscriptionWord *)words_test, 3, (TranscriptionWordIterateCb)prv_cb_return_false, (void *) 1); cl_assert_equal_p(result, &words_test[7]); s_count = 0; result = transcription_iterate_words((TranscriptionWord...
h" #include "applib/graphics/graphics_private.h" #include "applib/graphics/graphics_private_raw.h" #include "applib/graphics/graphics_private_raw_mask.h" #include "applib/graphics/gtypes.h" #include "applib/graphics/framebuffer.h" #include "applib/ui/window_private.h" #include "applib/ui/layer.h" #include "util/graphic...
{ GColor src_color = (GColor) { .argb = (uint8_t)y }; for (int mask_value_index = 0; mask_value_index < num_mask_values; mask_value_index++) { int16_t x1 = (int16_t)(mask_value_index * num_pixels_per_mask_value); int16_t x2 = (int16_t)(x1 + num_pixels_per_mask_value - 1); record_func(ctx, y, x...
cl_assert(graphics_context_mask_record(ctx, NULL)); test_graphics_context_mask_debug(ctx, mask); graphics_context_mask_destroy(ctx, mask); } /////////////////////////////////////// // RECORDING VERTICAL LINE HELPERS // /////////////////////////////////////// static void prv_prepare_canvas_for_vline_record...
sk_KernelMain); PROFILER_NODE_START(compositor); // Don't trust the size field within the app framebuffer as the app could modify it. GSize app_framebuffer_size; app_manager_get_framebuffer_size(&app_framebuffer_size); const FrameBuffer *app_framebuffer = app_state_get_framebuffer(); if (gsize_equal(&app...
{ GContext *ctx = kernel_ui_get_graphics_context(); // We make this GDrawState static to save stack space, thus the declaration and init must be // performed on two separate lines because the initializer value is not constant static GDrawState prev_state; prev_state = ctx->draw_state; gpoint_add_eq(&ctx-...
// Compositor implementation /////////////////////////////////////////////////////////// T_STATIC void prv_handle_display_update_complete(void) { if (s_deferred_render.transition_complete.pending) { s_deferred_render.transition_complete.pending = false; prv_finish_transition(); } if (s_deferred_render....
nce_m, &bpm, &hr_zone)); cl_assert_equal_i(bpm, 180); cl_assert_equal_i(hr_zone, 3); cl_assert_equal_i(duration_s, 10 * SECONDS_PER_MINUTE + 10); cl_assert(workout_service_stop_workout()); cl_assert(!workout_service_get_current_workout_info(&steps, &durati...
(workout_service_pause_workout(true))
; // Get some new data but out stats shouldn't change (except HR) prv_inc_time(10); prv_inc_steps_and_put_event(10); prv_put_bpm_event(110, HRMQuality_Good); cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zon...
that is currently not visible and animates into view data->info_text_in_animation = property_animation_create_layer_frame(&data->info_text_layer2.layer, &above_pair_text, &pair_text_area); PBL_ASSERTN(data->info_text_in_animation); Animation *animation = prope...
if (!s_data_ptr) { return; }
bt_lock(); bt_driver_pairing_confirm(s_data_ptr->ctx, is_confirmed); bt_unlock(); } static bool prv_has_device_name(BTPairingUIData *data) { return (strlen(data->device_name_layer_buffer) != 0); } static bool prv_has_confirmation_token(BTPairingUIData *data) { return (strlen(data->code_text_layer_buffer) ...
indow) { const bool animated = true; app_window_stack_pop(animated); (void)recognizer; (void)window; } static void config_provider(Window *window) { window_single_click_subscribe(BUTTON_ID_UP, (ClickHandler) confirm_click_handler); window_long_click_subscribe(BUTTON_ID_UP, 1200, (ClickHandler) confirm_long...
(window, GColorCobaltBlue)
; #endif window_set_user_data(window, data); data->action_bar_icon_check = gbitmap_create_with_resource(RESOURCE_ID_ACTION_BAR_ICON_CHECK); data->action_bar_icon_x = gbitmap_create_with_resource(RESOURCE_ID_ACTION_BAR_ICON_X); const bool animated = true; app_window_stack_push(window, animated); } #undef MESS...
ayer_get_title_text_width(&data->status_layer); const int16_t status_offset = (icon_rect.size.w + icon_text_horizontal_spacing) / 2; new_status_frame.origin.x += is_visible ? status_offset : -status_offset; const int16_t new_icon_layer_x_offset = ((window_bounds_width - title_width) / 2) - status_offset; lay...
(&data->dnd_icon, RESOURCE_ID_QUIET_TIME_STATUS_BAR)
; // actual frame of the icon layer is calculated in prv_set_dnd_icon_visible() layer_init(&data->dnd_icon_layer, &GRectZero); layer_set_update_proc(&data->dnd_icon_layer, prv_draw_dnd_icon); layer_add_child(root_layer, &data->dnd_icon_layer); prv_dnd_status_changed(do_not_disturb_is_active()); // set up ...
904, 664}, { -576, 920, 544}, { -712, 816, 744}, { -584, 912, 640}, { -496, 824, 712}, { -440, 720, 720}, { -304, 608, 472}, { -320, 432, 320}, { -336, 368, 248}, { -368, 512, 288}, { -384, 632, 384}, { -408, 792, 464}, // 439 seconds { -440, 912, 616}, { -392, 89...
{ -456, 808, 424}, { -456, 960, 704}, { -424, 1000, 520}, { -496, 864, 584}, { -424, 928, 656}, { -264, 984, 480}, { -296, 720, 360}, { -296, 640, 248}, { -328, 512, 216}, { -376, 472, 232}, { -440, 520, 184}, { -512, 584, 296}, { -528, 712, 384}, { -576, 768, 360...
{ -432, 896, 680}, { -424, 664, 656}, { -288, 592, 536}, { -248, 472, 392}, { -256, 400, 352}, { -288, 512, 352}, // 447 seconds { -256, 608, 432}, { -256, 792, 432}, { -232, 864, 536}, { -224, 904, 624}, { -328, 928, 488}, { -432, 856, 800}, { -304, 968, 568}, ...
// logs that will be erased when the log buffer fills. // // On each boot, we create a file to hold all the messages for that boot. This // file is called a log generation or log. // // Within each eraseable unit multiple 'pages' exist. A log generation can span // one or more pages. Multiple log generations can be st...
_Static_assert((LOG_REGION_SIZE % LOG_PAGE_SIZE) == 0, "The log page size must be divisible by the log region size")
; _Static_assert(((FLASH_REGION_DEBUG_DB_END % ERASE_UNIT_SIZE) == 0) && ((FLASH_REGION_DEBUG_DB_END % ERASE_UNIT_SIZE) == 0), "Space for flash logging must be aligned on an erase region boundary"); _Static_assert(LOG_PAGE_SIZE <= ERASE_UNIT_SIZE, "Log pages must fit within an erase unit"); _Static_assert(...
w_data, id, true /* close am */); } } static void prv_clear_stale_reminders(void *data) { notifications_presented_list_each(prv_clear_if_stale_reminder, data); } static void prv_clear_stale_reminders_timer_cb(void *data) { // This functionality only exists for popups (modal windows) which currently all // run...
(item, action, NULL)
; } } static void prv_push_muted_dialog(void) { SimpleDialog *simple_dialog = simple_dialog_create("Muted"); Dialog *dialog = simple_dialog_get_dialog(simple_dialog); const char *msg = i18n_get("Muted", dialog); dialog_set_text(dialog, msg); dialog_set_icon(dialog, RESOURCE_ID_RESULT_MUTE_LARGE); dialog...
t_dotted_line_odd_offset_checkerboard_no_clip"))); // Clipping on even boundaries - no offset setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_EVEN, OFFSET_RECT_ODD, false, 1); for (int16_t col = 0; col < MAX_NUM_COLS; col++) { graphics_draw_vertical_line_dotted(&ctx, GPoint(col, 0), MAX_NUM_ROWS); } cl_check...
(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_dotted_line_cross")))
; } void test_graphics_draw_line_8bit__dotted_cross_color(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // Test horizontal and vertical lines cross appropriately setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_context_set_stroke_color(&ctx, GColorRed); ...
IC->QSPIC_ERASECMDA_REG = 0x0; QSPIC->QSPIC_ERASECMDB_REG = 0x0; QSPIC->QSPIC_BURSTBRK_REG = 0x0; QSPIC->QSPIC_STATUSCMD_REG = 0x0; QSPIC->QSPIC_CHCKERASE_REG = 0x0; QSPIC->QSPIC_GP_REG = 0x0; QSPIC->QSPIC_UCODE_START = 0x0; GPREG->PLL_SYS_CTRL1_REG = 0x100; GPREG->PLL_SYS_CTRL2_REG = 0x2006; GPREG->P...
REG_SETF(DCDC, DCDC_RET_1_REG, DCDC_V18_RET_CYCLES, 0x5)
; REG_SETF(DCDC, DCDC_RET_1_REG, DCDC_V18_CUR_LIM_RET, 0xA); REG_SETF(DCDC, DCDC_RET_1_REG, DCDC_V14_RET_CYCLES, 0x2); REG_SETF(DCDC, DCDC_RET_1_REG, DCDC_V14_CUR_LIM_RET, 0x6); REG_SETF(DCDC, DCDC_TRIM_REG, DCDC_P_COMP_MAN_TRIM, 0x0); REG_SETF(DCDC, DCDC_TRIM_REG, DCDC_P_COMP_TRIM, 0x0); REG_SETF(DCDC, DC...
{ -1184, 32, -312}, { -1336, 64, -240}, { -1224, 120, -200}, { -1056, 248, -112}, { -960, 368, -144}, { -896, 392, -184}, { -824, 328, -264}, { -776, 336, -288}, { -880, 528, -320}, // 5 seconds { -1144, 512, -336}, { -1680, 712, -304}, { -1688, 352, -192}, { -15...
{ 40, 1104, -344}, { 64, 984, -408}, { 96, 760, -304}, { 56, 688, -272}, { 88, 576, -240}, { 144, 512, -216}, { 208, 552, -216}, { 304, 592, -232}, { 320, 704, -216}, { 344, 880, -208}, { 304, 1248, -184}, { 368, 1408, -144}, { 200, 1560, -104}, { 144, 1120, -96},...
{ 176, 1032, -72}, { 80, 792, -120}, { 48, 560, -152}, { 56, 456, -192}, { 80, 336, -176}, // 13 seconds { 72, 240, -184}, { 24, 208, -184}, { -104, 256, -208}, { -480, 240, -200}, { -904, 176, -136}, { -1896, 40, -72}, { -2976, 176, 192}, { -3080, 1736, -288}, ...
ceManifest *manifest) { if (prv_read(entry, 0, manifest, sizeof(ResourceManifest)) != sizeof(ResourceManifest)) { *manifest = (ResourceManifest){0}; } } static bool prv_read_res_table_entry(ResTableEntry *res_entry, ResourceStoreEntry *entry, uint32_t index) { uint32_t ad...
prv_read_res_table_entry(&table_entry, entry, entry->id - 1)
ex == 9) { PBL_LOG(LOG_LEVEL_INFO, "Calling core_dump FreeRTOS ISR"); s_call_core_dump_from_isr = true; NVIC_InitTypeDef NVIC_InitStructure; NVIC_InitStructure.NVIC_IRQChannel = OTG_FS_WKUP_IRQn; // Lower values are higher priority - make this same or lower priority than a FreeRTOS ISR NVIC_In...
(data, 0, sizeof(TestTimersAppData))
; s_app_data = data; data->window = window_create(); if (data->window == NULL) { return; } window_init(data->window, ""); window_set_window_handlers(data->window, &(WindowHandlers) { .load = prv_window_load, .unload = prv_window_unload, }); app_window_stack_push(data->window, true /*animate...
lse; } cl_assert_equal_m(s_expected_send_data, data, length); s_sent_action = true; return true; } static void prv_support_sms_replies(void) { // Store the preference in our DB char *key = "com.apple.MobileSMS"; int key_len = strlen(key); const int flags = 0; const int num_attributes = 0; const in...
(response_action->attr_list.attributes[0].id, AttributeIdTitle)
; cl_assert_equal_s(response_action->attr_list.attributes[0].cstring, "Reply"); cl_assert_equal_i(response_action->attr_list.attributes[1].id, AttributeIdEmojiSupported); cl_assert_equal_i(response_action->attr_list.attributes[1].uint8, 1); ActionMenuItem menu_item = (ActionMenuItem) { .action_data = &noti...
by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "re...
{ FailRecognizerCtx ctx = { .triggered = manager->triggered, }; prv_process_all_recognizers(manager, prv_fail_recognizer, &ctx); return ctx.recognizers_active; }
actual frame of the icon layer is calculated in prv_set_dnd_icon_visible() layer_init(&data->dnd_icon_layer, &GRectZero); layer_set_update_proc(&data->dnd_icon_layer, prv_draw_dnd_icon); layer_add_child(root_layer, &data->dnd_icon_layer); prv_dnd_status_changed(do_not_disturb_is_active()); // set up the noti...
{ data->notifications_modified = true; }
} static void prv_handle_notification_added_common(Uuid *id, NotificationType type) { if (!alerts_should_notify_for_type(prv_alert_type_for_notification_type(type))) { return; } NotificationWindowData *data = &s_notification_window_data; // will fail and return early if already init'ed. prv_init_notif...
ad, PmicRegisters_FUSE_14 = 0xae, PmicRegisters_FUSE_15 = 0xaf, } PmicRegisters; // These are values for the reset_reason field of the ResetControl register. // None of these values should ever be changed, as conversions are done on // readings dont directly out of the ResetControl register. // See Figure 79 of th...
prv_write_register(PmicRegisters_GPIO2_CNTL, val)
; } PBL_ASSERT(success, "Failed to start PMIC 120Hz PWM"); } static bool prv_is_alive(void) { uint8_t chip_id; if (!prv_read_register(PmicRegisters_CHIP_ID, &chip_id)) { return false; } const bool found = (chip_id == AS3701B_CHIP_ID); if (found) { PBL_LOG(LOG_LEVEL_DEBUG, "Found the as3701b"); ...
/* * 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...
(CommSessionVoiceApiSupport)
) { PBL_LOG(LOG_LEVEL_INFO, "No phone connected or phone app does not support app-initiated " "dictation sessions"); return NULL; } DictationSession *session = applib_type_malloc(DictationSession); if (!session) { return NULL; } char *buffer = NULL; if (buffer_size > 0) { buffer = ...
e.h" #include "applib/connection_service.h" #include "applib/graphics/graphics.h" #include "applib/graphics/text.h" #include "applib/tick_timer_service.h" #include "applib/ui/animation_private.h" #include "applib/ui/app_window_click_glue.h" #include "applib/ui/ui.h" #include "applib/ui/window.h" #include "applib/ui/win...
if (low_power_is_active() || factory_reset_ongoing()) { PBL_LOG(LOG_LEVEL_DEBUG, "Forcekill disabled due to low-power or factory-reset"); return; }
PBL_LOG(LOG_LEVEL_DEBUG, "Force killing app."); app_manager_force_quit_to_launcher(); } static void back_button_force_quit_handler(void *data) { launcher_task_add_callback(launcher_force_quit_app, NULL); } static void launcher_handle_button_event(PebbleEvent* e) { ButtonId button_id = e->button.button_id; ...
ib/ui/kino/kino_reel/scale_segmented.h" #include "applib/ui/kino/kino_reel/transform.h" #include "applib/ui/kino/kino_reel/unfold.h" #include "kernel/pbl_malloc.h" #include "kernel/ui/kernel_ui.h" #include "services/common/evented_timer.h" #include "services/normal/timeline/notification_layout.h" #include "services/nor...
{ peek_layer_deinit(peek_layer); }
task_free(peek_layer); } void peek_layer_init(PeekLayer *peek_layer, const GRect *frame) { *peek_layer = (PeekLayer) { .icon_offset_y = PEEK_LAYER_ICON_OFFSET_Y, .subtitle_margin = PEEK_LAYER_SUBTITLE_MARGIN, .dot_diameter = 9, }; // peek layer layer_init(&peek_layer->layer, frame); layer_set...
/* * 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...
(72, 63, 26, 34)
, grect_inset_internal(rect, 2, 3)); } void test_gtypes__grect_inset_returns_zero_rect_for_large_insets(void) { GRect rect = GRect(10, 20, 30, 40); cl_assert_equal_grect(GRect(25, 20, 0, 40), grect_inset_internal(rect, 15, 0)); cl_assert_equal_grect(GRectZero, grect_inset_internal(rect, 16, 0)); cl_assert_equ...
_get_system_font(FONT_KEY_GOTHIC_24_BOLD); TextLayer *text_layer = &dialog->text_layer; text_layer_init_with_parameters(text_layer, &GRect(x, y, w, h), dialog->buffer, font, dialog->text_color, GColorClear, alignment, GTextOverflowModeWordWrap); ...
GRect( 0, frame.size.h - CONTENT_DOWN_ARROW_HEIGHT, PBL_IF_RECT_ELSE(frame.size.w - action_bar_offset, frame.size.w), CONTENT_DOWN_ARROW_HEIGHT)
); layer_add_child(&window->layer, &expandable_dialog->content_down_arrow_layer); content_indicator_configure_direction( indicator, ContentIndicatorDirectionDown, &(ContentIndicatorConfig) { .layer = &expandable_dialog->content_down_arrow_layer, .times_out = false...
, 296, -224}, { -392, 320, -232}, { -416, 296, -160}, { -440, 264, -72}, { -528, 328, -56}, { -592, 400, -80}, { -632, 424, -72}, { -808, 464, -120}, { -968, 504, -160}, { -1024, 416, -56}, { -1320, 528, -144}, { -1296, 680, -264}, { -1120, 608, -200}, { -1096, 552, -...
{ -544, 400, -48}, { -496, 440, -72}, { -528, 368, 8}, // 57 seconds { -680, 320, 56}, { -688, 368, 104}, { -760, 352, 80}, { -592, 424, 32}, { -680, 392, -8}, { -864, 376, -56}, { -824, 360, -144}, { -1264, 256, 64}, { -1408, 280, -16}, { -960, 544, -400}, { ...
{ -464, 240, 40}, { -544, 280, 32}, { -624, 328, 56}, { -648, 336, 96}, { -640, 368, 40}, { -920, 376, 32}, { -1008, 344, 0}, { -1176, 368, -56}, { -1064, 368, -144}, { -1232, 456, -232}, { -944, 576, -424}, { -816, 368, -272}, // 60 seconds // elapsed: 1 minutes...
/* * 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...
(request, NULL, 0)
; power_enter_hibernation(); } void hc_endpoint_ctl_handler(const HcProtocolMessage *request) { switch (request->command_id) { case HcMessageID_Ctl_Init: prv_handle_init(request); break; case HcMessageID_Ctl_Shutdown: prv_handle_shutdown(request); break; default: PBL_LO...
/* * 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 int16_t delta_0 = (int16_t) ((0 + 1) - value); const int16_t delta_b = (int16_t) ((bounds - 1) - value); const int16_t delta = ABS(delta_0) < ABS(delta_b) ? delta_0 : delta_b; return (int16_t) (value + delta * normalized / ANIMATION_NORMALIZED_MAX); }
/* * 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...
{ dst[dst_idx++] = src[src_idx]; code++; if (code == 0xff) { if (src_idx == length - 1) { // Special case: the final encoded block is 254 bytes long with no // zero after it. While it's technically a valid encoding if a // trailing zero is appended, it causes the ...
} dst[code_idx] = code; return dst_idx; }
{ 1744, 432, -472}, { 1344, 664, -504}, { 1088, 712, -432}, { 880, 1008, -320}, { 656, 1296, -336}, { 648, 936, -240}, { 1464, 1064, -152}, { 1400, 584, -200}, { 2040, 624, -112}, { 2752, 304, -32}, { 2304, 216, -8}, { 1952, 112, -96}, { 1640, 96, -168}, { 1376, 40...
{ 2544, 640, -32}, { 2528, 384, -40}, { 2184, 320, 24}, { 1800, -128, 40}, { 1592, -264, -32}, { 1088, -272, -128}, { 816, -144, -136}, // 50 seconds { 752, -192, -152}, { 544, -280, -64}, { 408, -256, -40}, { 968, -56, -104}, { 1016, 72, -192}, { 1712, 80, -192},...
} uint32_t get_available_pfs_space(void) { uint32_t allocated_space = 0; for (uint16_t pg = 0; pg < s_pfs_page_count; pg++) { uint8_t page_flags = prv_get_page_flags(pg); if ((IS_PAGE_TYPE(page_flags, PAGE_FLAG_START_PAGE)) || (IS_PAGE_TYPE(page_flags, PAGE_FLAG_CONT_PAGE))) { allocated_sp...
(display_buf, sizeof(display_buf), "\n---\n%d / %d pages in use " "(%"PRIu32" kB available)", pages_in_use, s_pfs_page_count, get_available_pfs_space() / 1024)
for (int16_t column_index = 0; column_index < num_dest_colors; column_index++) { const int16_t starting_x = column_index * hline_applying_test_column_width; for (int16_t x = starting_x; x < starting_x + hline_applying_test_column_width; x++) { ctx->draw_state.stroke_color = (GColor) { .argb = (ui...
GPoint(x, y)
); } } return mask; } typedef void (*VerticalClippingMaskApplyFunc)(GContext *ctx, int16_t x, int16_t y1, int16_t y2, GColor color); static void prv_mask_apply_vline_test_pattern(VerticalClippingMaskApplyFunc apply_func) { GContext *ctx = s_ctx; prv_prepare_...
ogle 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 in writing, software * ...
cl_assert_equal_b(s_is_outbox_message_pending, 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...
(!circular_cache_get(&s_test_cache, &s_test_item[1]))
; cl_assert(!circular_cache_get(&s_test_cache, &s_test_item[2])); circular_cache_push(&s_test_cache, &s_test_item[0]); circular_cache_push(&s_test_cache, &s_test_item[1]); cl_assert(!circular_cache_get(&s_test_cache, &s_test_item[2])); cl_assert_equal_p(circular_cache_get(&s_test_cache, &s_test_item[0]), &s...
&new_read_offset); if (bytes_read <= 0) { goto exit; } // Write to new file if (!prv_write_data(&new_storage, tmp_buf, bytes_read)) { goto exit; } // Consume out of old one now. if (dls_storage_consume(session, bytes_read) < 0) { goto exit; } ...
if (!session->data->buffer_storage) { goto exit; }
session->data->write_request_pending = false; int bytes_remaining = shared_circular_buffer_get_read_space_remaining( &session->data->buffer, &session->data->buffer_client); if (bytes_remaining == 0) { goto exit; } got_session_file = prv_get_session_file(session, bytes_remaining); if (!got_sessio...
prv_advance_time_hr(1 /*sec*/, 51 /*hr*/, HRMQuality_Good, true /*force_continuous*/); prv_advance_time_hr(8 /*sec*/, 120 /*hr*/, HRMQuality_Worst, true /*force_continuous*/); prv_minute_system_task_cb(NULL); activity_metrics_prv_get_median_hr_bpm(&median, &total_weight); cl_assert_equal_i(median, 51); // ...
static uint32_t s_num_hr_events; static PebbleHealthEvent s_last_hr_event; static void prv_fake_hr_event_handler(PebbleEvent *e) { s_num_hr_events++; s_last_hr_event = e->health_event; } // --------------------------------------------------------------------------------------- // Test that some HRM events aren't...
uint8_t left_aa_offset, uint8_t right_aa_offset, int16_t clip_box_min_x, int16_t clip_box_max_x, GColor color); static void prv_hline_pattern_apply_assign_horizontal_line_delta_raw(GContext *ctx, int16_t y, ...
test_graphics_context_mask_get_value_for_coordinate(ctx, mask, GPoint(x, y))
, expected_value); } } } void test_graphics_context_mask__basic_create(void) { GContext *ctx = s_ctx; // Should be safe to call create with NULL values cl_assert_equal_p(graphics_context_mask_create(NULL, NULL), NULL); GDrawMask *transparent_mask = graphics_context_mask_create(c...
equal_i(s_stroke_color.argb, GColorPurpleARGB8); cl_assert_equal_i(s_fill_color.argb, GColorClearARGB8); cl_assert_equal_i(s_stroke_width, 2); cl_assert_equal_i(s_path_num_points, 1); cl_assert_equal_b(s_radius, 0); cl_assert_equal_i(s_circle_fill_count, 0); cl_assert_equal_i(s_circle_stroke_count, 1); cl...
gdraw_command_list_draw(ctx, command_list)
; cl_assert_equal_i(s_path_stroke_count, 0); cl_assert_equal_i(s_path_fill_count, 0); cl_assert_equal_i(s_circle_stroke_count, 1); cl_assert_equal_i(s_circle_fill_count, 1); prv_reset(); gdraw_command_list_get_command(command_list, 1)->hidden = true; gdraw_command_list_draw(ctx, command_list); cl_asser...
/* * 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 ids[NumBlobDBs]; uint8_t num_ids; blob_db_get_dirty_dbs(ids, &num_ids); cl_assert_equal_i(num_ids, 0); cl_assert(blob_db_get_dirty_list(BlobDBIdTest) == NULL); // insert one char *key = "key"; char *value = "value"; cl_assert_equal_i(S_SUCCESS, blob_db_insert(BlobDBIdTest, ...
1); Uuid orig_id = s_last_timeline_id; // Advance to midnight and perform the midnight rollover logic rtc_set_time(rtc_get_time() + 15 * SECONDS_PER_MINUTE); // Puts us at midnight activity_insights_recalculate_stats(); // Process the midnight rollover logic // Advance to 7:05am and add a...
activity_insights_process_sleep_data(rtc_get_time())
; cl_assert_equal_i(s_data.pins_added, 2); } // --------------------------------------------------------------------------------------- // Make sure that when the watch resets, we retain state properly void test_activity_insights__sleep_summary_power_cycle(void) { prv_set_sleep_history_avg(); activity_insights_i...
PBL_LOG(LOG_LEVEL_ERROR, "No subscription found for ATT handle %u", att_handle); } goto unlock; } // Mask to mask out all tasks const PebbleTaskBitset task_mask_none = ~0; PebbleTaskBitset task_mask = task_mask_none; for (GAPLEClient c = 0; c < GAPLEClientNum; ++c) { if (UNLIKELY(subscription-...
{ if (subscription->pending_confirmation[c]) { subscription->pending_confirmation[c] = false; if (subscription->subscriptions[c] == BLESubscriptionNone) { // Client unsubscribed in the mean-time. Confirmation should already have been sent. continue; } if (has_error) { ...
if (task_mask != task_mask_none) { prv_send_subscription_event(subscription->characteristic, task_mask, type, error); } // In the error case, clean up the subscription data structure, if no longer used: if (has_error && prv_prevailing_subscription_type(subscription) == BLESubscriptionNone) { prv_remo...
/* * 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...
(rand_out)
(uint8_t*)&id, sizeof(id)); return (bytes_read == sizeof(id)) ? id : (uint32_t)RESOURCE_ID_INVALID; } static uint32_t prv_get_sys_resource_id(TimelineResourceId timeline_id, TimelineResourceSize size) { timeline_id &= ~SYSTEM_RESOURCE_FLAG; if (timeline_id >= NUM_TIMELINE_RESOURCES) { return RESOURCE_ID...
if (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(timeline_res, sizeof(*timeline_res)); syscall_assert_userspace_buffer(res_info, sizeof(*res_info)); }
if (!timeline_res || !res_info || (size >= TimelineResourceSizeCount)) { if (res_info) { *res_info = (AppResourceInfo) {0}; } return; } timeline_resources_get_id(timeline_res, size, res_info); }
KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "settings_activity_tracker.h" #include "settings_menu.h" #include "settings_window.h" #include "applib/app.h" #include "applib/app_timer.h" #include "applib/ui/kino/k...
{ // Undo the choice change that the OptionMenu does before we call select. We may decline // the change and therefore we don't want it to visually update yet. prv_worker_launch_handler // will update the choice if it fires. option_menu_set_choice(&data->option_menu, prv_get_chosen_row_index(dat...
/* * 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...
(GSize(64, 64), GBitmapFormat1Bit)
; uint32_t size_full = (DISP_COLS*DISP_ROWS)/8; #else s_gfx_rotated_bitmap_bitmap = gbitmap_create_blank(GSize(DISP_COLS, DISP_ROWS), GBitmapFormat8Bit); s_gfx_rotated_bitmap_64_bitmap = gbitmap_create_blank(GSize(64, 64), GBitmapFormat8Bit); uint32_t size_fu...
dow's SwapLayer so it will be updated with the content // in s_test_data swap_layer_reload_data(&s_notification_window_data.swap_layer); // Scroll down the specified number of times SwapLayer *swap_layer = &s_notification_window_data.swap_layer; for (int i = 0; i < num_down_scrolls; i++) { prv_attempt_sc...
{ s_test_data = (NotificationWindowTestData) { .icon_id = TIMELINE_RESOURCE_NOTIFICATION_FACEBOOK_MESSENGER, .title = "Henry Levak", .body = "Nu, Shara. Where are my designs, blat?", .show_notification_timestamp = true, .timestamp = "Just now", .background_color = GColorPictonBlue, }; cons...
void test_notification_window__title_subtitle_body(void) { s_test_data = (NotificationWindowTestData) { .icon_id = TIMELINE_RESOURCE_NOTIFICATION_GOOGLE_INBOX, .title = "Henry Levak", .subtitle = "Henry Levak sent you a 1-1 message", .body = "Good morning to you my friend!", .background_color = ...
} int accel_peek(AccelDriverSample *data) { return 0; } void accel_enable_shake_detection(bool on) { } bool accel_get_shake_detection_enabled(void) { return false; } void accel_enable_double_tap_detection(bool on) { } bool accel_get_double_tap_detection_enabled(void) { return false; } bool accel_run_selftest(vo...
printf("\n")
/* * 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...
(AlertReminder)
); cl_assert(alerts_should_notify_for_type(AlertPhoneCall)); // Should not allow invalid Notifications though cl_assert(!alerts_should_notify_for_type(AlertInvalid)); } void test_alerts__low_power(void) { cl_assert(alerts_get_mask() == AlertMaskAllOn); // Should not allow any notifications through while in...
/! It accesses the privileged contents of the timer from the client's unprivileged task. //! This call deletes the system timer and removes it from the timer list before returning unless //! it is a repeating timer. DEFINE_SYSCALL(void, sys_evented_timer_consume, TimerID timer_id, EventedTimerCallback* out_cb, ...
while (iter) { EventedTimer* timer = (EventedTimer*) iter; ListNode* next = list_get_next(iter); if (timer->target_task == task) { list_remove(iter, &s_timer_list_head, NULL); // The delete operation will stop it for us new_timer_delete(timer->sys_timer_id); kernel_free(timer); ...
mutex_unlock(s_mutex); } EventedTimerID evented_timer_register_or_reschedule(EventedTimerID timer_id, uint32_t timeout_ms, EventedTimerCallback callback, void *data) { if (timer_id != EVENTED_TIMER_INVALID_ID && evented_timer_reschedule(timer_id, timeout_ms)) { return timer_id; } return evented_timer...