prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
/* * 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...
OS_ASSERT(freertos_mutex != NULL)
; PebbleRecursiveMutex * mutex = (PebbleRecursiveMutex *)create_pebble_mutex(freertos_mutex); return mutex; } void mutex_lock_recursive(PebbleRecursiveMutex * handle) { uintptr_t myLR = (uintptr_t) __builtin_return_address(0); OS_ASSERT(!mcu_state_is_isr()); xLightMutexLockRecursive(handle->common.freertos_...
or_init_buffer(buffer); } void test_timeline_layouts__cleanup(void) { free(fb); } // Helpers ////////////////////// void prv_handle_down_click(ClickRecognizerRef recognizer, void *context); static void prv_render_layout(LayoutId layout_id, const AttributeList *attr_list, size_t num_d...
(&config, 1)
59 * SECONDS_PER_MINUTE) + 59); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("59 MIN AGO", time_buf); // June 9th 2015, 13:00:00 (T+01:00:00) rtc_set_time(event_time + SECONDS_PER_HOUR); clock_get_until_time_capitalized(time_buf, sizeof(time_bu...
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(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("2 H AGO", time_buf); // June 9th 2015, 23:59:59 (T+11:59:59) ...
thm_metrics_changed_notification(); // Register our minutes callback cron_job_schedule(&s_activity_job); s_activity_state.started = true; PBL_LOG(LOG_LEVEL_INFO, "Activity tracking started"); PebbleEvent event = { .type = PEBBLE_ACTIVITY_EVENT, .activity_event = { .type = Pebbl...
{ // This call blocks on KernelBG, so it should only be called from an app or worker PebbleTask task = pebble_task_get_current(); PBL_ASSERTN(task == PebbleTask_App || task == PebbleTask_Worker); // Enqueue it for KernelBG to process bool success = system_task_add_callback(cb, context); if (!success) { ...
/* * 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...
grect_get_max_y(&(GRect){.origin.y = 1, .size.h = INT16_MAX})
< 0); text_layer.layer.frame.origin.y = 1; layer_add_child(&window.layer, &text_layer.layer); GPoint origin; GRect page; cl_assert(text_layer_calc_text_flow_paging_values(&text_layer, &origin, &page)); cl_assert_equal_i(page.origin.y, text_layer.layer.frame.origin.y); // must not overflow cl_assert(...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
memset(&s_font_info, 0, sizeof(s_font_info))
quired 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. */ #inclu...
(&action_result->attr_list, &action_result->action_group, &buffer, num_attributes, num_actions, attributes_per_action)
LEVEL_DEBUG, "Error with \"B\": %s", buf); } r = strftime(buf, buf_size, "%c", &good_data); if (r == 0 || strncmp(buf, "Tue May 5 11:04:49 2015", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"c\": %s", buf); } r = strftime(buf, buf_size, "%d", &good_data); if (r == 0 || strncmp(buf, "0...
strncmp(buf, "05/05/15", buf_size)
!= 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"x\": %s", buf); } r = strftime(buf, buf_size, "%X", &good_data); if (r == 0 || strncmp(buf, "11:04:49", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"X\": %s", buf); } r = strftime(buf, buf_size, "%y", &good_data); if (r == 0 || st...
12, 784, 456}, { 320, 784, 448}, { 304, 728, 448}, { 304, 760, 440}, { 328, 760, 424}, { 312, 736, 440}, { 296, 712, 448}, { 288, 720, 432}, { 312, 776, 432}, { 320, 760, 448}, { 312, 744, 464}, { 320, 736, 416}, { 296, 744, 456}, { 328, 744, 448}, // 474 seconds ...
{ 184, -400, -936}, { 216, -400, -944}, { 192, -400, -936}, { 184, -400, -936}, { 184, -392, -944}, { 184, -408, -936}, { 240, -416, -944}, { 224, -480, -952}, { 272, -720, -992}, { 376, -880, -776}, { 576, 8, -640}, { 488, 168, -632}, { 288, 624, 40}, { 40, 992, ...
{ 184, 888, 144}, { 152, 888, 216}, { 144, 904, 184}, { 136, 904, 80}, { 128, 976, 80}, { 64, 1088, 64}, // 482 seconds { -8, 1232, 0}, { -24, 1240, -128}, { -48, 1208, -96}, { -32, 896, -208}, { 40, 632, -288}, { 80, 40, -432}, { 184, -104, -824}, { 248, -14...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
text_layer_set_text(&data->text, data->text_buffer)
; toggle_color(window); } static void select_single_click_handler(ClickRecognizerRef recognizer, Window *window) { ClickAppData *data = window_get_user_data(window); const uint16_t count = click_number_of_clicks_counted(recognizer); sniprintf(data->text_buffer, TEXT_BUFFER_SIZE, "Single Click! (%u)", count); ...
e; for (unsigned int i = 0; i < ARRAY_LENGTH(accel_test_axis); ++i) { int axis_delta = accel_test_axis[i].positive_value - accel_test_axis[i].negative_value; axis_delta = abs(axis_delta); if (axis_delta < accel_test_axis[i].pass_threshold) { PBL_LOG(LOG_LEVEL_WARNING, "Self test failed for axis %c:...
{ sample_rate = BMI160SampleRate_50_HZ; }
/* * 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...
strncpy(buffer + avg_len, EN_DASH, buffer_size - avg_len)
#define MULTIMEDIA_INDICATOR_LENGTH 64 #define MULTIMEDIA_EMOJI "🎁" // AttributeIdTitle + AttributeIdAncsAction. See prv_fill_native_ancs_action static const int NUM_NATIVE_ANCS_ACTION_ATTRS = 2; static const char s_utf8_ellipsis[] = UTF8_ELLIPSIS_STRING; static int prv_add_ellipsis(char *buffer, int length) { //...
(buffer, length, "%s%s", i18n_get("sent an attachment", __FILE__), emoji_str)
; } //! @param buffer Pointer to a buffer large enough to hold all attribute strings required by //! the action. If buffer points to null, a new buffer will be allocated //! @return Pointer to the end of the buffer (*buffer + size of strings) static uint8_t *prv_fill_native_ancs_action(uint8_t **buffer, ...
1); info->get_key(file, key, info->key_len); info->get_val(file, val, info->val_len); key[info->key_len] = '\0'; val[info->val_len] = '\0'; printf("Read key of %s %d and val of %s %d\n", key, info->key_len, val, info->val_len); int key_i = atoi((char*)key + 1); cl_assert(key_i >= 0 && key_i < 255); ui...
(&file, "test_file_reallocate_larger", k_initial_size)
); int orig_fd_size = pfs_get_file_size(file.iter.fd); uint8_t key[4]; int key_len = sizeof(key) - 1; memcpy(key, "key", sizeof(key)); uint8_t val[4]; int val_len = sizeof(val) - 1; memcpy(val, "val", sizeof(val)); set_and_verify(&file, key, key_len, val, val_len); // Now close the file and re-open...
xSemaphoreGive(s_pb_semaphore); } static void prv_cleanup_async(void) { system_task_add_callback(prv_cleanup_from_system_task, NULL); } static void prv_fail(uint32_t token) { prv_cleanup_async(); prv_add_nack_system_callback(token); } static void prv_timer_callback(void* data) { PBL_LOG(LOG_LEVEL_WARNING, "...
boot_bit_set(BOOT_BIT_NEW_SYSTEM_RESOURCES_AVAILABLE)
{ printf("\nTesting setting and retreiving a key several times...\n"); SettingsFile file; cl_must_pass(settings_file_open(&file, "test_file_set_get_one_many_times", 4096)); uint8_t key[4]; int key_len = sizeof(key) - 1; memcpy(key, "key", sizeof(key)); uint8_t val[7]; int val_len = 6; printf("Setting ...
static bool prv_each_check_all_values(SettingsFile *file, SettingsRecordInfo *info, void *context) { uint32_t desired_value = *(uint32_t *)context; uint32_t key; uint32_t value; info->get_key(file, (uint8_t *)&key, sizeof(uint32_t)); info->get_val(file, (uint8_t *)&value, sizeof(uint32_t)); cl_assert(val...
ol prv_call_data_callback(AccelSubscriberState *state) { switch (state->task) { case PebbleTask_App: case PebbleTask_Worker: case PebbleTask_KernelMain: { PebbleEvent event = { .type = PEBBLE_CALLBACK_EVENT, .callback = { .callback = state->data_cb_handler, .data ...
{ uint32_t result = 0; mutex_lock_recursive(s_mutex); { AccelSubscriberState* state = prv_subscriber_state(session); if (!state) { PBL_LOG(LOG_LEVEL_WARNING, "not subscribed"); goto unlock; } result = state->num_samples; *timestamp_ms = state->timestamp_ms; } unlock: mutex_unlo...
/* * 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...
(100, log_data, 0)
; app_event_loop(); }
/* * 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 SCREEN_COLOR_DEPTH_BITS == 8 src_color.a = (uint8_t)(factor * 3 / (FIXED_S16_3_ONE.raw_value - 1)); const GColor blended_color = gcolor_alpha_blend(src_color, *dst_color); #if CAPABILITY_HAS_MASKING const GDrawMask *mask = ctx->draw_state.draw_mask; graphics_private_raw_mask_apply(dst_color, mask, data_o...
static ALWAYS_INLINE void prv_set_color(const GContext *ctx, GColor *dst_color, unsigned int data_row_offset, int x, int width, GColor src_color) { #if CAPABILITY_HAS_MASKING const GDrawMask *mask = ctx->draw_state.draw_mask; graphics...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return "FAIL"; }
ActivitySettingsKey key; // settings key used to store last UTC time for this activity class time_t *exit_utc; // pointer to last UTC time in our globals bool modified; // true if we need to update it. } ActivityClassParams; ActivityClassParams class_settings[ActivityClassCount] = { ...
{ return; }
// Scan to see how many valid activities we have. ActivitySession *session = state->activity_sessions; ActivitySession null_session = {}; for (unsigned i = 0; i < ARRAY_LENGTH(state->activity_sessions); i++, session++) { if (!memcmp(session, &null_session, sizeof(null_session))) { // Empty session d...
192, -928}, { -408, 192, -936}, { -408, 192, -936}, { -408, 192, -936}, { -408, 200, -928}, { -408, 192, -936}, { -408, 200, -936}, { -416, 200, -936}, { -408, 200, -928}, { -408, 192, -928}, { -416, 200, -928}, { -416, 192, -936}, { -416, 200, -928}, // 115 seconds ...
{ -392, 104, -960}, { -384, 104, -960}, { -384, 104, -960}, // 120 seconds // elapsed: 2 minutes { -384, 112, -960}, { -384, 112, -960}, { -384, 128, -968}, { -392, 120, -960}, { -392, 112, -960}, { -392, 120, -960}, { -384, 112, -960}, { -392, 120, -960}, { -392,...
o p q r s t u v w x y z"; char *texts[] = { first_page_one_line, second_page_one_line, second_page_two_lines, second_page_full, third_page_one_line, third_page_two_lines, third_page_full, fourth_page_one_line, }; const int16_t num_steps = ARRAY_LENGTH(texts); const GSize size = GSize(144, 300); ...
(s_dest_bitmap, namecat(namecat(__func__, "__with_orphan"), ".pbi"))
); } void test_graphics_draw_text_flow__max_used_size_draw_text_doom(void) { cl_assert(text_resources_init_font(0, RESOURCE_ID_GOTHIC_24_BOLD, 0, &s_font_info)); TextLayoutExtended layout = { .flow_data = { .perimeter.impl = &(GPerimeter){.callback = prv_perimeter_for_display_round}, .perimeter.in...
}, (GSize) { 7 * HORIZ_ADVANCE_PX + 1, FONT_HEIGHT - 1 } }, .font = (GFont) { 0 }, .overflow_mode = GTextOverflowModeWordWrap, .alignment = GTextAlignmentLeft, .max_used_size = (GSize) { 0, 0 } }; graphics_text_layout_get_max_used_size(&gcontext, "JR Whopper", font, box, GTextOverflowModeFill, GTe...
cl_assert_equal_i(layout.box.size.w, box.size.w)
; cl_assert_equal_i(layout.max_used_size.w, 4 * HORIZ_ADVANCE_PX); // Includes Whop - as it may be partially rendered at the bottom of the box cl_assert_equal_i(layout.max_used_size.h, 3 * FONT_HEIGHT); // The blank line before Whop is still being layed out, however, so it is still included in the height graphi...
e session. int num_bytes = DLS_MAX_DATA_BYTES/2; int num_items = num_bytes / item_size; cl_assert(num_bytes > 0); prv_log_consume_random(logging_session, item_size, num_items); } // ---------------------------------------------------------------------------------------- void test_data_logging__interleave(void...
(session, data, ARRAY_LENGTH(data))
, DATA_LOGGING_INVALID_PARAMS); // Finish the session again without a crash. data_logging_finish(0); } // ---------------------------------------------------------------------------------------- //! Try passing invalid params to data_logging_log void test_data_logging__invalid_params(void) { ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_send_result(session, APP_ORDER_RES_FAILURE)
e); if (!property_animation) { return NULL; } memset(property_animation, 0, sizeof(*property_animation)); uint8_t *dst = (uint8_t *)property_animation; uint8_t *src = (uint8_t *)from; uint32_t offset = sizeof(AnimationPrivate); // Skip the base class fields uint32_t size = sizeof(PropertyAnimati...
(result, &value)
; return result; } // ----------------------------------------------------------------------------------------- static void property_animation_update_mark_dirty(Animation* animation, const AnimationProgress normalized) { PropertyAnimation *prop_anim = (PropertyAn...
rr_rel_bar.anim_offset = prv_get_overlap_line_length(layer, NULL, NULL); } else if ((layer->relbar_layer.curr_rel_bar.rel_bar_type == RelationshipBarTypeBackToBack) || (layer->relbar_layer.curr_rel_bar.rel_bar_type == RelationshipBarTypeFreeTime)) { layer->relbar_layer.curr_rel_bar.anim_offset = REL_...
animation_set_handlers(rel_bar_anim, (AnimationHandlers) { .stopped = prv_rel_bar_stopped, }, layer)
; } return rel_bar_anim; } void timeline_relbar_layer_reset(TimelineLayer *layer) { prv_update_rel_bars(layer); if (layer->relbar_layer.curr_rel_bar.rel_bar_type == RelationshipBarTypeOverlap) { layer->relbar_layer.curr_rel_bar.anim_offset = prv_get_overlap_line_length(layer, NULL, NULL); } else if ((la...
est_app_glance_db__reading_glance_with_invalid_arguments_fails(void) { // NULL UUID fails AppGlance glance_out = {}; cl_assert_equal_i(app_glance_db_read_glance(NULL, &glance_out), E_INVALID_ARGUMENT); // NULL glance_out fails cl_assert_equal_i(app_glance_db_read_glance(&APP_GLANCE_TEST_UUID, NULL), E_INVALI...
(e.type, PEBBLE_APP_FETCH_REQUEST_EVENT)
; cl_assert(!e.app_fetch_request.with_ui); cl_assert_equal_i(e.app_fetch_request.id, 10); } void test_app_glance_db__insert_app_in_cache(void) { cl_assert_equal_i(app_glance_db_insert((uint8_t *)&APP_GLANCE_TEST_UUID, UUID_SIZE, s_app_glance_basic, sizeof(s_app_glance_basic)), S_SUCCESS); cl_assert_equal...
ing right in the middle of a flash erase, etc. Therefore, // dispatch to a lower priority task system_task_add_callback(prv_update_state, data); // Reschedule ourselves again so we create a loop prv_schedule_update(BATTERY_SAMPLE_RATE_MS, false); } static void prv_schedule_update(uint32_t delay, bool force_up...
(ANALYTICS_DEVICE_METRIC_BATTERY_VOLTAGE, battery_mv, AnalyticsClient_System)
; analytics_set(ANALYTICS_DEVICE_METRIC_BATTERY_VOLTAGE_DELTA, d_mv, AnalyticsClient_System); int scaling_factor = INT32_MAX / 100; // we want to cover -100 to 100 percent // Note: we assume that the watch was not charging during the hour. int32_t start_percent = battery_curve_lookup_percent_with_scaling_facto...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
gdraw_command_image_destroy(dci_reel->image)
; } applib_free(dci_reel); } static void prv_draw_processed_func(KinoReel *reel, GContext *ctx, GPoint offset, KinoReelProcessor *processor) { KinoReelImplPDCI *dci_reel = (KinoReelImplPDCI *)reel; gdraw_command_image_draw_processed( ctx, dci_reel->image, offset, NULL_...
mfg_serials.h" #include "resource/resource_ids.auto.h" #include "services/common/bluetooth/local_id.h" #include "services/common/i18n/i18n.h" #include "services/common/status_led.h" #include "services/common/system_task.h" #include "services/normal/stationary.h" #include "shell/normal/battery_ui.h" #include "shell/pref...
layer_add_child(&window->layer, status_bar_layer_get_layer(status_layer))
/* * 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...
i18n_noop("10 Min Before")
, /// Shows up in the Timeline settings as a "Timing" subtitle and submenu option. i18n_noop("15 Min Before"), /// Shows up in the Timeline settings as a "Timing" subtitle and submenu option. i18n_noop("30 Min Before"), }; static uint16_t s_before_time_values[PeekBeforeTimingMenuIndexCount] = { 0, 5, 10, 15,...
torage info session->storage = (DataLoggingSessionStorage) { .fd = DLS_INVALID_FILE, }; } // ----------------------------------------------------------------------------------------- // Write data directly to flash. Called from dls_log() when the session is // unbuffered. Assumes the caller has already locked...
(logging_session, 0)
; if (!got_session_file) { last_whole_items_read_bytes = -1; // error goto exit; } uint32_t read_offset = logging_session->storage.read_offset; while (!buffer || read_bytes < num_bytes) { DLSChunkHeader chunk_hdr; // Reached the end of the file? // NOTE: we don't do this check if we ar...
d) { s_last_phone_ui_event = PhoneEventType_Missed; } void phone_ui_handle_call_start(bool can_decline) { s_last_phone_ui_event = PhoneEventType_Start; } void phone_ui_handle_call_end(bool call_accepted, bool disconnected) { s_last_phone_ui_event = PhoneEventType_End; } void phone_ui_handle_call_hide(void) { ...
(PhoneEventType_Invalid)
)); // this frame is valid - transition the FSM and queue up processing of it smartstrap_fsm_state_set(SmartstrapStateReadComplete); ReadCompleteContext context = { .success = true, .is_notify = is_notify }; system_task_add_callback_from_isr(prv_read_complete_system_task_cb, context.cont...
if (mbuf_is_flag_set(mbuf, MBUF_FLAG_IS_FRAMING)) { result = prv_send_byte_and_check(read_data); } else { result = prv_send_byte(read_data); }
f (evt->handle == s_pps_ctx.att_hdl.trigger_pairing) { const PairingTriggerRequestData request = { .should_pin_address = false, .no_slave_security_request = false, }; prv_handle_trigger_pairing(evt->conn_idx, &request); } else if (evt->handle == s_pps_ctx.att_hdl.conn_status_cccd || ...
ble_gattc_exchange_mtu(evt->conn_idx)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ delay_us(1000); }
}
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (*state->position == '\0') { state->error->status = TemplateStringErrorStatus_InvalidEscapeCharacter; }
{ 1560, 792, -176}, { 1408, 976, -136}, { 1216, 576, 56}, { 1168, 392, 16}, { 880, 224, 24}, { 736, 224, 8}, { 664, 240, 8}, { 704, 328, -80}, { 808, 392, -104}, { 896, 368, -96}, { 1064, 384, -120}, { 1168, 336, -128}, { 1144, 240, -64}, { 1424, 200, -24}, { ...
// 5 seconds { 872, 112, -400}, { 808, 160, -256}, { 768, 104, -48}, { 824, 224, -48}, { 912, 216, -136}, { 1040, 176, -176}, { 1248, 384, -104}, { 1320, 320, -8}, { 1728, 304, -88}, { 1608, 496, -224}, { 1088, 384, -88}, { 1192, 280, -64}, { 1248, 192, -64}, ...
-1; goto exit; } read_bytes += chunk_hdr.num_bytes; buffer += chunk_hdr.num_bytes; } else { // Just scanning for the last written byte read_bytes += chunk_hdr.num_bytes; } } read_offset += sizeof(chunk_hdr) + chunk_hdr.num_bytes; // Did we rea...
{ PBL_LOG(LOG_LEVEL_ERROR, "Nuking storage for session %d", logging_session->comm.session_id); dls_storage_delete_logging_storage(logging_session); }
return consumed_bytes; } // ----------------------------------------------------------------------------------------- // Called from dls_init() during boot time to scan for existing DLS storage files in the file // system and recreate sessions from them. void dls_storage_rebuild(void) { char name[DLS_FILE_NAME_M...
{ PBL_ASSERTN(ctx); ctx->draw_state = draw_state; } void graphics_context_move_draw_box(GContext* ctx, GPoint offset) { PBL_ASSERTN(ctx); ctx->draw_state.drawing_box.origin = gpoint_add(ctx->draw_state.drawing_box.origin, offset); } void graphics_context_set_stroke_color(GContext* ctx, GColor color) { PBL_A...
{ ctx->lock = false; }
return result; } GBitmap* graphics_capture_frame_buffer_2bit(GContext *ctx) { return graphics_capture_frame_buffer_format(ctx, GBitmapFormat1Bit); } MOCKABLE GBitmap *graphics_capture_frame_buffer(GContext *ctx) { PBL_ASSERTN(ctx); return graphics_capture_frame_buffer_format(ctx, GBITMAP_NATIVE_FORMAT); } ...
plicable 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 "drivers/...
{ while (QSPI_GetFlagStatus(QSPI_FLAG_TC) == RESET) { } }
/* * 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...
("s4", "Mon Jul 25 2005 20:04:05 GMT-03:00")
; } void test_rocky_api_datetime__locale_time_string_12h(void) { s_clock_is_24h_style = false; rocky_global_init(s_api); EXECUTE_SCRIPT( "var d = new Date();\n" "var s = d.toLocaleTimeString();\n" ); ASSERT_JS_GLOBAL_EQUALS_S("s", "8:04:05 PM"); s_time += 4 * SECONDS_PER_HOUR; EXECUTE_SCRIPT( ...
1:40:51 2016 UTC // Thu Mar 17 14:40:51 2016 PDT const uint16_t cur_millis = 123; fake_time_init(cur_time, cur_millis); jerry_value_t now = rocky_util_create_date(NULL); jerry_value_t getSeconds = jerry_get_object_field(now, "getSeconds"); jerry_value_t getMinutes = jer...
jerry_get_number_value(result_minutes)
ith all the exported functions in it. extern const void* const g_pbl_system_tbl[]; // ---------------------------------------------------------------------------------------------- static bool prv_verify_checksum(const PebbleProcessInfo* app_info, const uint8_t* data) { const uint8_t header_size = sizeof(PebbleProce...
PBL_LOG(LOG_LEVEL_ERROR, "Process read failed for process %s, fd = %d", process_name, fd)
; pfs_close(fd); return (false); } pfs_close(fd); return prv_intialize_sdk_process(task, &info, destination); } // ---------------------------------------------------------------------------------------------- static bool prv_load_from_resource(const PebbleProcessMdResource *app_md, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
launcher_menu_layer_get_layer(launcher_menu_layer)
); // If we have a saved launcher selection state, restore it if (s_launcher_app_persisted_data.valid) { launcher_menu_layer_set_selection_state(launcher_menu_layer, &s_launcher_app_persisted_data.selection_state); } app_focus_service_subscribe_handlers((AppFocu...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(" is outside system flash")
; return -1; } for (size_t i=0; i < ARRAY_LENGTH(s_sector_addresses)-1; ++i) { if (s_sector_addresses[i] <= address && address < s_sector_addresses[i+1]) { return i; } } return ARRAY_LENGTH(s_sector_addresses)-1; } bool system_flash_erase(uint32_t address, size_t length, SystemFlashPr...
graphics_context_set_antialiased(ctx, false); graphics_draw_circle(ctx, GPoint(14, 14), 12); } void white_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorWhite); graphics_context_set_antialiased(ctx, false); graphics_draw_circle(ctx, GPoint(14, 14), 12); } void...
(&ctx.dest_bitmap, "draw_circle_origin_aa_r16_clip_nxny.${BIT_DEPTH_NAME}.pbi")
); // Medium circles setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_origin_aa_r8_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_C...
periph_config_enable(RCC_AHB1PeriphClockCmd, RCC_AHB1Periph_CRC)
; } static void disable_crc_clock(void) { // save the state so that if stop mode interrupts things, we resume cleanly s_clock_running = false; periph_config_disable(RCC_AHB1PeriphClockCmd, RCC_AHB1Periph_CRC); } void crc_init(void) { if (s_initialized) { return; } s_initialized = true; } void crc_c...
-------- static void results_window_load(Window *window) { HealthAPITestAppData *data = window_get_user_data(window); Layer *window_layer = window_get_root_layer(window); GRect root_bounds = layer_get_bounds(window_layer); data->results_card.text_layer = text_layer_create(root_bounds); text_layer_set_text_al...
(data->hr_card.text_layer, GTextAlignmentCenter)
; text_layer_set_background_color(data->hr_card.text_layer, GColorClear); text_layer_set_font(data->hr_card.text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD)); text_layer_set_text_color(data->hr_card.text_layer, GColorWhite); layer_add_child(window_layer, text_layer_get_layer(data...
urning this off on another client. static bool prv_update_rail_state(PmicRail rail, bool enable); static void prv_mon_config_lock(void) { mutex_lock(s_mon_config_mutex); } static void prv_mon_config_unlock(void) { mutex_unlock(s_mon_config_mutex); } static bool prv_read_register(uint8_t register_address, uint8_t...
if (BOARD_CONFIG.mfi_reset_pin.gpio) { // We have access to the reset pin on the MFi. Need to hold it low before powering the 2V5 // rail in order to get the MFi into a working state. // In the future if the MFi becomes janky again we can use this to later pull the power. gpio_use(BOARD_CONFIG.mfi_reset...
advert_terms_a[1].max_interval_slots); // Expect silence. B's third (silent) is 2 secs, so one more to go and A's third term is silent. regular_timer_fire_seconds(1); cl_assert_equal_b(gap_le_is_advertising_enabled(), false); // Expect B's fourth term now. regular_timer_fire_seconds(1); cl_assert_equa...
cl_assert_equal_i(s_unscheduled_cb_count, 1)
; cl_assert_equal_p(s_unscheduled_job, job); cl_assert_equal_b(s_unscheduled_completed, true); free(ad); } void test_gap_le_advert__invalid_params(void) { GAPLEAdvertisingJobRef job; BLEAdData *ad = create_ad(NULL, NULL); GAPLEAdvertisingJobTerm advert_term = { .min_interval_slots = 31, .max_inte...
copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for t...
{ AppMessageCtx *app_message_ctx = app_state_get_app_message_ctx(); AppMessageInboxDropped retval = app_message_ctx->inbox.dropped_callback; app_message_ctx->inbox.dropped_callback = dropped_callback; return retval; }
AppMessageOutboxSent app_message_register_outbox_sent(AppMessageOutboxSent sent_callback) { AppMessageOutboxSent retval = app_state_get_app_message_ctx()->outbox.sent_callback; app_state_get_app_message_ctx()->outbox.sent_callback = sent_callback; return retval; } AppMessageOutboxFailed app_message_register_ou...
ert_equal_p(text_node->font, font); cl_assert_equal_p(text_node->overflow, overflow_mode); cl_assert_equal_p(text_node->alignment, alignment); TextLayoutExtended *layout = (TextLayoutExtended *)layout_ref; cl_assert_equal_p(text_node->line_spacing_delta, layout->line_spacing_delta); layout->max_used_size = ...
graphics_text_node_create_text(strlen(str_a) + 1)
; cl_assert(text_a->node.free_on_destroy); strcpy((char *)text_a->text, str_a); const char *str_b = task_strdup("B"); GTextNodeText *text_b = graphics_text_node_create_text(0); cl_assert(text_b->node.free_on_destroy); text_b->text = (char *)str_b; const char *str_c = "C"; GTextNodeText text_c = { ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
resource_storage_builtin_bytes_are_readonly(bytes)
; } #endif // CAPABILITY_HAS_MAPPABLE_FLASH
/* * 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 (!info->flash_len || (info->flash_start_addr + info->flash_len) > BOARD_NOR_FLASH_SIZE) { return false; } storage->impl_data = kernel_zalloc_check(sizeof(*info)); memcpy(storage->impl_data, info, sizeof(*info)); return true; }
GetBytesInfoErrorCode gb_storage_flash_get_size(GetBytesStorage *storage, uint32_t *size) { *size = ((GetBytesStorageInfo *)storage->impl_data)->flash_len; return GET_BYTES_OK; } bool gb_storage_flash_read_next_chunk(GetBytesStorage *storage, uint8_t *buffer, uint32_t len) { uint32_t start_offset = ((GetBytes...
ime(tmbuf, sizeof(tmbuf), "%02D %04e", &jan_2_10015__13_00_00); cl_assert_equal_s(tmbuf, "01/02/15 0002"); tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%05n %03r", &jan_2_10015__13_00_00); cl_assert_equal_s(tmbuf, "\n 01:00:00 PM"); tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%02R %06t %04T", &ja...
(tmbuf, sizeof(tmbuf), "%c", &jan_2_2015__13_00_00, i18n_get_locale())
rator word_iter = (Iterator) { 0 }; WordIterState word_iter_state = (WordIterState) { 0 }; // Allocate immutable types bool success = false; const Utf8Bounds utf8_bounds = utf8_get_bounds(&success, ""); cl_assert(success); const TextBoxParams text_box_params = (TextBoxParams) { .utf8_bounds = &utf8_bo...
(&success, "\nIn\nout\n")
; cl_assert(success); const TextBoxParams text_box_params = (TextBoxParams) { .utf8_bounds = &utf8_bounds, }; // Init mutable types word_iter_init(&word_iter, &word_iter_state, &s_ctx, &text_box_params, utf8_bounds.start); // Tests cl_assert(*word_iter_state.current.start == '\n'); cl_assert(*wor...
ct lower_rect = GRect(x, y_lower, WIDTH, 1); const GRect lower_left_legend_rect = GRect(0, y_lower, 3, 1); const GRect lower_right_legend_rect = GRect(offset_x, y_lower, 3, 1); bitblt_bitmap_into_bitmap_tiled(&dest_bitmap, &src_bmp, lower_rect, GPointZero, GCompOpAssign, ...
(src_bitmap)
; } // Test horizontal wrapping when dest_rect wider than src_bitmap. // Setup: // - Source 15 x 10, each row has the folling pattern: // - 2px Red // - 13px Black // - Dest Green 50x50 // - Dest rect (17, 10) at (0, 0) // Result: // - 2px Red // - 13px Black // - 2px Red // - Rest Blue vo...
/* * 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...
{ // No LED present, do nothing! }
#endif // CAPABILITY_HAS_LED
Qn; nvic_config.NVIC_IRQChannelPreemptionPriority = 0x0f; nvic_config.NVIC_IRQChannelSubPriority = 0x00; nvic_config.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&nvic_config); DMA_ITConfig(FLASH_DMA_STREAM, DMA_IT_TC, ENABLE); // enable the DMA stream to start the transfer SPI_I2S_DMACmd(FLASH_SPI, SPI_I2S_D...
if (buffer_size < 1) { return; }
/* * 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_data.log_layer, "Done logging. Select to close.")
{ if (workout_glance->icon_resource_id == new_icon_resource_id) { // Nothing to do, bail out return false; } // Destroy the existing icon kino_reel_destroy(workout_glance->icon); // Set the new icon and record its resource ID workout_glance->icon = kino_reel_create_with_resource(new_icon_resource_...
static uint32_t prv_get_workout_icon_resource_id_for_type(ActivitySessionType type) { switch (type) { case ActivitySessionType_Open: return RESOURCE_ID_WORKOUT_APP_HEART; case ActivitySessionType_Walk: return RESOURCE_ID_WORKOUT_APP_WALK_TINY; case ActivitySessionType_Run: return RESOU...
de "applib/ui/animation_timing.h" #include "applib/ui/kino/kino_reel.h" #include "applib/ui/kino/kino_reel_pdci.h" #include "applib/ui/kino/kino_reel_custom.h" #include "applib/applib_malloc.auto.h" #include "syscall/syscall.h" #include "util/math.h" #include "util/net.h" #include "util/struct.h" typedef struct { GR...
(data->from_reel, elapsed)
) { changed = true; } if (data->to_reel && kino_reel_set_elapsed(data->to_reel, elapsed)) { changed = true; } const int32_t normalized = animation_timing_clip( scale_int32(elapsed, data->duration, ANIMATION_NORMALIZED_MAX)); if (data->normalized == normalized) { return changed; } data-...
me_util_update_timezone(&tz); fake_pbl_malloc_clear_tracking(); for (unsigned int i = 0; i < ARRAY_LENGTH(s_items); ++i) { cl_assert_equal_i(pin_db_insert_item(&s_items[i]), 0); } cl_assert_equal_i(fake_pbl_malloc_num_net_allocs(), 0); } void test_timeline_model__cleanup(void) { } // Tests ///////////////...
&timeline_model_get_iter_state(-1)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[4]].header.id, &timeline_model_get_iter_state(0)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[5]].header.id, &timeline_model_get_iter_state(1)->pin.header.id)); cl_assert(timelin...
void test_timeline_model__and_back(void) { TimelineModel model = {0}; model.direction = TimelineIterDirectionFuture; time_t first_time = 1421178000; // Note: 1421178000 = Tue Jan 13 11:40:00 PST 2015 timeline_model_init(first_time, &model); cl_assert(timeline_model_iter_next(NULL, NULL)); cl_assert(tim...
) { const InputConfig input_config = { .gpio = dev->tx_gpio.gpio, .gpio_pin = dev->tx_gpio.gpio_pin }; gpio_input_init(&input_config); } if (dev->rx_gpio.gpio) { const InputConfig input_config = { .gpio = dev->rx_gpio.gpio, .gpio_pin = dev->rx_gpio.gpio_pin }; gpio_in...
{ dev->state->tx_int_enabled = true; dev->periph->CR1 |= USART_CR1_TXEIE; prv_set_interrupt_enabled(dev, true); }
else { // disable interrupt if RX is also disabled prv_set_interrupt_enabled(dev, dev->state->rx_int_enabled); dev->periph->CR1 &= ~USART_CR1_TXEIE; dev->state->tx_int_enabled = false; } } void uart_irq_handler(UARTDevice *dev) { PBL_ASSERTN(dev->state->initialized); bool should_context_switch =...
rent row to black, and the left-most bezel pixels of the next row to // black. int corner_width = prv_get_rounded_corner_width(0, app_height); for (int app_row = 0; app_row < app_height; ++app_row) { const int row_width = app_width - corner_width * 2; // Copy the row of the app framebuffer (adva...
{ // Huzzah, the app sent us the first frame! if (s_animation_state.animation) { // We have an animation to run, run it. s_state = CompositorState_Transitioning; animation_schedule(s_animation_state.animation); // Don't release the app framebuffer yet, we'll do this once the transition ...
// Draw the app framebuffer if in the App state if (s_state == CompositorState_App || s_state == CompositorState_AppAndModal) { // compositor_render_app also renders modals if the CompositorState_AppAndModal as that state // indicates that there are transparent modals that allow the app framebuffer to sho...
} else if (rtc_is_timezone_set()) { // Otherwise, if the timezone has been set, then we assume this is a user on 3.10 and lower // that has not touched their vibe intensity preferences. // rtc_is_timezone_set() was chosen because it is a setting that gets written when the user // connects their...
(AlertMaskAllOn)
/* * 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...
(&e->bluetooth.pair)
; return; case PEBBLE_APP_WILL_CHANGE_FOCUS_EVENT: if (e->app_focus.in_focus) { app_idle_timeout_resume(); } else { app_idle_timeout_pause(); } return; case PEBBLE_SYS_NOTIFICATION_EVENT: // This handles incoming Notifications and actions on Notifications an...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
strncmp((const char *) note->data, expected_name, expected_name_length)
== 0); }
/8_bit/framebuffer.c" #elif SCREEN_COLOR_DEPTH_BITS == 1 #include "applib/graphics/1_bit/framebuffer.c" #endif // Fakes //////////////////////////////////// #include "fake_resource_syscalls.h" #include "fake_app_timer.h" // Stubs //////////////////////////////////// #include "stubs_applib_resource.h" #include "stubs_...
{ #if PLATFORM_SPALDING bool status = false; uint32_t resource_id = sys_resource_load_file_as_resource(TEST_IMAGES_PATH, GET_APNG_NAME); cl_assert(resource_id != UINT32_MAX); GBitmapSequence *bitmap_sequence = gbitmap_sequence_create_with_resource(resource_id); cl_assert(bitmap_sequence); GBitmap *bitmap ...
USA = 0x02, PmicRegisters_STATUSB = 0x03, PmicRegisters_INTA = 0x05, PmicRegisters_INTB = 0x06, PmicRegisters_INT_MASK_A = 0x07, PmicRegisters_INT_MASK_B = 0x08, PmicRegisters_CHG_CNTL_A = 0x0A, PmicRegisters_BUCK1_CONFIG = 0x0D, PmicRegisters_BUCK2_CONFIG = 0x0F, PmicRegisters_LDO1_CONFIG = 0x12, P...
{ // Set the register byte to XXXXX00X to disable the rail, just mask register_value = (register_value & ~0x06); success = prv_write_register(rail_control_reg, register_value); if (success) { // We disabled the rail! *ref_count = 0; return true; } return fal...
else { (*ref_count)--; return true; } } } bool pmic_power_off(void) { bool ret = prv_write_register(PmicRegisters_PWR_CFG, 0xB2); if (ret) { // Goodbye cruel world. The PMIC should be removing our power at any time now. while (1) {} __builtin_unreachable(); } return 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...
(&firmware_description)
) { memset(out_metadata, 0, sizeof(FirmwareMetadata)); return false; } // The FirmwareMetadata is stored at the end of the binary: uint32_t offset = firmware_description.description_length + firmware_description.firmware_length - sizeof(FirmwareMetadata); flash_read_bytes((uint8_t*)out_metadata, flash_a...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
clock_get_until_time_without_fulltime(buffer, config->buffer_size, layout->info->timestamp, max_relative_hours)
; } T_STATIC void prv_get_subtitle_from_attributes(AttributeList *attributes, char *buffer, size_t buffer_size, const void *i18n_owner) { const char *subtitle_string = NULL; // We only all-caps the subtitle in the card view on rectangular displays bool all_caps_desi...
(stats_buf)
) { stats_buf->num_conn_events = serial_distance32(orig_stats->num_conn_events, stats_buf->num_conn_events); stats_buf->num_sync_errors = serial_distance32(orig_stats->num_sync_errors, stats_buf->num_sync_errors); stats_buf->num_conn_events_skipped = serial_distance32(orig_stats->num...
{ PBL_ASSERTN(slave); PBL_ASSERTN(result_buffer); // Do transfer locks the bus bool result = prv_do_transfer(slave->bus, Read, slave->address, register_address_start, read_size, result_buffer, SendRegisterAddress); if (!result) { PBL_LOG(LOG_LEVEL_ERROR, "Read failed on bu...
bool i2c_read_block(I2CSlavePort *slave, uint32_t read_size, uint8_t* result_buffer) { PBL_ASSERTN(slave); PBL_ASSERTN(result_buffer); bool result = prv_do_transfer(slave->bus, Read, slave->address, 0, read_size, result_buffer, NoRegisterAddress); if (!result) { PBL_LOG(LOG_L...
melineItemActionTypeRemoteRemove: { // remote action, send it to the phone const bool do_async = false; prv_do_remote_action(&item->header.id, action->type, action->id, attributes, do_async); break; } case TimelineItemActionTypeRemove: prv_remove_pin_...
analytics_set(ANALYTICS_DEVICE_METRIC_TIMELINE_PINS_HOURLY_OTHER_COUNT, analytics_info.hourly_count.other, AnalyticsClient_System)
; }
.size = GSize(max_text_container_frame.size.w, title_frame.size.h + instruction_frame.size.h) }; const bool clips = true; grect_align(&text_container_frame, &max_text_container_frame, GAlignCenter, clips); grect_align(&title_frame, &text_container_frame, GAlignTop, clips); grect_align(&instruction_frame, &...
(data->offset)
; analytics_inc(ANALYTICS_DEVICE_METRIC_DISPLAY_OFFSET_MODIFIED_COUNT, AnalyticsClient_System); window_stack_remove(&data->window, true /* animated */); return; } data->state++; layer_mark_dirty(&data->window.layer); } static void prv_back_click_handler(ClickRecognizerRef recognizer, void *context) ...
_WriteBit(BOARD_CONFIG_POWER.chg_fast.gpio, BOARD_CONFIG_POWER.chg_fast.gpio_pin, fast_charge_enabled?Bit_RESET:Bit_SET); gpio_release(BOARD_CONFIG_POWER.chg_fast.gpio); PBL_LOG(LOG_LEVEL_DEBUG, "Fastcharge %s", fast_charge_enabled?"enabled":"disabled"); } } void battery_init(void) { s_debounce_timer_hand...
(prv_start_timer_sys_task_callback, NULL, should_context_switch)
; } int battery_get_millivolts(void) { ADCVoltageMonitorReading info = battery_read_voltage_monitor(); // Apologies for the madness numbers. // The previous implementation had some approximations in it. The battery voltage is scaled // down by a pair of resistors (750k at the top, 470k at the bottom), resulti...
_takeover_activity_session(void) { int32_t steps, duration_s, distance_m, bpm, active_kcalories; HRZone hr_zone; // We have a session that started at utc=10 and length_min of 10. Increment the time // so that makes sense prv_inc_time(610); // Start a new session ActivitySession session = { .start_ut...
prv_inc_time(10)
; prv_inc_steps_and_put_event(10); prv_put_bpm_event(190, HRMQuality_Good); cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone)); cl_assert_equal_i(steps, 10); cl_assert_equal_i(duration_s, 10); cl_assert_e...
upported(rc)) { // Don't send an error here! The initiating side is supposed have detected the version // incompatibility and not sent the ResetComplete (and send an Error message), but apparently // we did get the ResetComplete somehow? prv_awaiting_reset_request__enter(); return; } ...
{ const AppMessageInboxReceived inbox_rcv = s_app_message_handlers[s_state.state].inbox_received; if (inbox_rcv) { inbox_rcv(it, context); } else { DBG_VERBOSE("No inbox_received handler for state %d", s_state.state); } }
(manager.state, RecognizerManagerState_RecognizersTriggered); cl_assert_equal_i(r2->state, RecognizerState_Started); cl_assert(!recognizer_get_manager(r1)); } void test_recognizer_manager__handle_state_change(void) { const int k_rec_count = 2; s_dummy_impl.handle_touch_event = prv_handle_touch_event_test; s_...
((int []) { 0, 1 }, 2, &s_recognizers_reset)
; recognizer_set_simultaneous_with(r[0], prv_simultaneous_with_cb); r[0]->state = RecognizerState_Started; r[1]->state = RecognizerState_Completed; manager.active_layer = &layer_a; manager.state = RecognizerManagerState_RecognizersTriggered; manager.triggered = r[0]; recognizer_manager_handle_state_chang...
ineResourceTestAppData *data = &s_test_apps[i]; if (uuid_equal(uuid, &data->install_entry.uuid)) { return data; } } return NULL; } // Fakes ///////////////////////// bool prv_validate_lut(ResAppNum res_app_num) { // Just check if the .resource_lut pointer for the provided res_app_num is non-NULL ...
( (TimelineResourceId)TimelineResourceTestTimelineId_AlarmClock, TimelineResourceSizeTiny, TimelineResourceTestAppId_ValidApp, NULL)
); // Calling the function with a valid system TimelineResourceId should return true and set res_info cl_assert(timeline_resources_get_id_system(TIMELINE_RESOURCE_AUDIO_CASSETTE, TimelineResourceSizeSmall, SYSTEM_APP, &res_info)); cl_assert_equal_i(res_info.res_app_nu...
; data_row_info = gbitmap_get_data_row_info(framebuffer, y1.integer); output = (GColor8 *)(data_row_info.data + x); } // last pixel with blending (don't render first *and* last pixel if line length is 1) if (y2.fraction != 0) { // Only draw the pixel if its within the bitmap data row range if (WI...
{ PBL_ASSERTN(ctx); GBitmap *framebuffer = &ctx->dest_bitmap; PBL_ASSERTN(framebuffer->bounds.origin.x == 0 && framebuffer->bounds.origin.y == 0); // Clip the clip box to the bitmap data row's range const GBitmapDataRowInfo data_row_info = gbitmap_get_data_row_info(framebuffer, y); clip_box_min_x = MAX(cli...
for (int i = 0; i < left_aa_offset; i++) { // To preserve gradient with clipping: if (x1.integer < clip_box_min_x) { output++; x1.integer++; continue; } if (x1.integer > clip_box_max_x) { break; } graphics_private_raw_blend_color_factor(ctx, outpu...
uint32_t array_len) { PBL_ASSERTN(!animation_private_using_legacy_2(NULL)); return prv_complex_init(parent, animation_array, array_len, AnimationTypeSequence); } // ------------------------------------------------------------------------------------------- Animation *...
{ prv_dump_animations(state->scheduled_head, true, buffer, buffer_size); prv_dump_animations(state->unscheduled_head, false, buffer, buffer_size); }
.full_quadrants = GCornersRight, .end_quadrant = (EllipsisPartDrawConfig){TO_TRIG(180),GCornerBottomLeft} })); cl_assert_equal_edc(prv_calc_draw_config_ellipsis(TO_TRIG(180), TO_TRIG(360)), ((EllipsisDrawConfig){ .start_quadrant = (EllipsisPartDrawConfig){TO_TRIG(180),GCornerBottomLeft}, .full_quadran...
(prv_calc_draw_config_ellipsis(TO_TRIG(360 + 45), TO_TRIG(360 + 270 + 45)), ((EllipsisDrawConfig){ .start_quadrant = (EllipsisPartDrawConfig){TO_TRIG(45),GCornerTopRight}, .full_quadrants = GCornersBottom, .end_quadrant = (EllipsisPartDrawConfig){TO_TRIG(270 + 45),GCornerTopLeft} }))
; // Ending quadrant filling up and starting quadrant finishing cl_assert_equal_edc(prv_calc_draw_config_ellipsis(TO_TRIG(360 + 90 + 45), TO_TRIG(360 + 360 + 45)), ((EllipsisDrawConfig){ .start_quadrant = (EllipsisPartDrawConfig){TO_TRIG(90 + 45),GCornerBottomRight}, .full_quadrants = GCornersLeft, .en...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ PBL_LOG(LOG_LEVEL_WARNING, "Filesystem: Uh oh, we somehow added regions in the wrong order, %"PRIu32" %"PRIu32, region_start, region_end); return; }
// erase if asked to if (erase_new_region) { flash_region_erase_optimal_range_no_watchdog(region_start, region_start, region_end, region_end); } s_ftl_size += (region_end - region_start); // call back to PFS to make sure it realizes there is more space ...
------ static void prv_debug_cmd_sleep_file_compact(int index, void *context) { ActivityDemoAppData *data = context; // Get sleep file info uint32_t num_records; uint32_t data_bytes; uint32_t minutes; activity_test_minute_file_info(true /*compact_first*/, &num_records, &data_bytes, &minutes); snprintf(da...
for (uint32_t i = 0; i < num_sessions; i++, session++) { char *prefix = ""; bool deep_sleep = false; switch (session->type) { case ActivitySessionType_Sleep: prefix = "s"; break; case ActivitySessionType_Nap: prefix = "n"; break; case ActivitySessionType_Res...
exit: // Free session info memory app_free(sessions); prv_display_alert(data->debug_card.dialog_text); } // ----------------------------------------------------------------------------------------- static void prv_debug_cmd_step_sessions(int index, void *context) { ActivityDemoAppData *data = context; //...
///////////////////////////////////////////////////// #define DISALLOWED_ENDPOINT_ID (9000) // GetBytes #define ALLOWED_ENDPOINT_ID (APP_MESSAGE_ENDPOINT_ID) static const uint8_t TEST_PAYLOAD[] = {0xaa, 0xbb, 0xcc, 0xdd}; static uint8_t TEST_EXPECTED_PP_MSG[sizeof(PebbleProtocolHeader) + sizeof(TEST_PAYLOAD)]; void...
(s_app_session_ptr)
; assert_not_consumed(); prv_process_send_queue(s_system_session_ptr); assert_consumed(AppMessageSenderErrorSuccess, 1); app_free(outbox_data); } void test_app_message_sender__system_session_and_js_app(void) { s_process_md.allow_js = true; AppMessageAppOutboxData *outbox_data = prv_create_and_send_...
event_null = prv_js_global_get_value("event"); cl_assert_equal_b(true, jerry_value_is_null(event_null)); // Get 3x the same message in a row: for (int j = 0; j < 3; ++j) { // Chunks for: {"x":123} const struct { uint8_t byte_array[8]; size_t length; } chunk_msg_defs[] = { { ...
prv_postmessageconnected_postmessagedisconnected_negotiate_to_open_session()
; // Timer for the 3rd should be cancelled now: cl_assert(EVENTED_TIMER_INVALID_ID == rocky_api_app_message_get_session_closed_object_queue_timer()); prv_assert_simple_test_object_pending(); }
/ ------------------------------------------------------------------------------------------------ static void prv_do_activity_session(time_t now_utc, ActivitySession *session) { if (!activity_prefs_activity_insights_are_enabled()) { return; } if (!s_activity_session_settings.enabled) { return; } if...
("Reloading insights settings")
; if (s_pfs_cb_handle) { activity_insights_settings_unwatch(s_pfs_cb_handle); } if (!activity_insights_settings_read(ACTIVITY_INSIGHTS_SETTINGS_ACTIVITY_REWARD, &s_activity_reward_settings)) { s_activity_reward_settings.enabled = false; // worst-case, we disable th...
, bool should_erase) { SharedPRFData data; prv_fetch_struct(&data); uint8_t *unmodified_data_patch_start = ((uint8_t *)&data) + offset; // Struct is packed, so it's OK to use memcmp: if (memcmp(unmodified_data_patch_start, patch, size) != 0) { // There is new data present, so perform a write! memcpy(...
prv_fetch_struct(&data)
; const BLEPairingData *ble_data = &data.ble_data; bool result = false; if (!ble_data->is_local_encryption_info_valid && !ble_data->is_remote_encryption_info_valid && !ble_data->is_remote_identity_info_valid && !ble_data->is_remote_signing_info_valid) { goto done; } if (pairing_info_o...
l sys_hrm_manager_get_subscription_info(HRMSessionRef session, AppInstallId *app_id, uint32_t *update_interval_s, uint16_t *expire_s, HRMFeature *features) { return false; } typedef struct { struct { ActivityMetric metric; ...
(averages, &s_sys_activity_get_step_averages_values_weekday.out.averages, sizeof(*averages))
; return s_sys_activity_get_step_averages_values_weekday.out.result; } } typedef struct { HealthActivity activity; time_t time_start; time_t time_end; void *context; } HealthActivityCBData; static HealthActivityCBData s_prv_activity_cb__args[100]; static uint32_t s_prv_activity_cb__call_count; static ui...
ActivitySession){ .type = ActivitySessionType_Walk, .start_utc = now - (65 * SECONDS_PER_MINUTE), .length_min = 15, // end = -50 }; s_sys_activity_get_sessions_values.out.sessions[3] = (ActivitySession){ .type = ActivitySessionType_Sleep, .start_utc = now - (50 * SECONDS_PER_MINUTE), .length...
cl_assert_equal_i(s_prv_activity_cb__args[0].time_start, s_sys_activity_get_sessions_values.out.sessions[1].start_utc)
; cl_assert_equal_i(s_prv_activity_cb__args[3].time_start, s_sys_activity_get_sessions_values.out.sessions[2].start_utc); // order direction future s_prv_activity_cb__call_count = 0; health_service_activities_iterate(HealthActivityMaskAll, now - (200 * SECONDS_PER_MINUTE), now, ...
----------------------------------------------------------------------------------------- // Log a health insight response event. void analytics_event_health_insight_response(time_t timestamp, ActivityInsightType insight_type, ActivitySessionType activity_type, ...
analytics_logging_log_event(&event_blob)
; } // ------------------------------------------------------------------------------------------ #if !PLATFORM_TINTIN void analytics_event_vibe_access(VibePatternFeature vibe_feature, VibeScoreId pattern_id) { AnalyticsEventBlob event_blob = { .event = AnalyticsEvent_VibeAccess, . vibe_access_data = { ...
G_LEVEL_INFO, "Test not supported for parallel flash"); return (false); #endif } static void menu_select_callback(int index, void *data) { struct Region region = s_flash_regions[index]; PBL_LOG(LOG_LEVEL_INFO, ">>>> Erase %s", region.name); flash_region_erase_optimal_range(region.begin, region.begin, region.en...
(&data->menu_section, data->menu_items)
; Layer *root_layer = window_get_root_layer(window); const GRect *bounds = &root_layer->bounds; simple_menu_layer_init(&data->menu_layer, bounds, window, &data->menu_section, 1, NULL); layer_add_child(root_layer, simple_menu_layer_get_layer(&data->menu_layer)); } static void push_window(FlashDiagAppData *data)...
pFormat8Bit); cl_assert(NULL != bmp); cl_assert(NULL == bmp->data_row_infos); bmp = gbitmap_create_blank(s10, GBitmapFormat1BitPalette); cl_assert(NULL != bmp); cl_assert(g_gbitmap_spalding_data_row_infos != bmp->data_row_infos); // union with .palette bmp = gbitmap_create_blank(s10, GBitmapFormat2BitPale...
gbitmap_create_blank_with_palette(s10, GBitmapFormat1BitPalette, p, true)
; cl_assert(NULL != bmp); cl_assert(p == gbitmap_get_palette(bmp)); bmp = gbitmap_create_blank_with_palette(s10, GBitmapFormat2BitPalette, p, true); cl_assert(NULL != bmp); cl_assert(p == gbitmap_get_palette(bmp)); bmp = gbitmap_create_blank_with_palette(s10, GBitmapFormat4BitPalette, p, true); cl_asser...
ror_dialog(data, i18n_noop("No internet connection"), RESOURCE_ID_CHECK_INTERNET_CONNECTION_LARGE, dialog_bg_color); data->error_exit_status = DictationSessionStatusFailureConnectivityError; } else { prv_exit_and_send_result_event(data, DictationSessionStatusFailureConnectivityError)...
{ // If buffer size is set to 0, the buffer was allocated when the last transcription was received applib_free(data->message); data->message = NULL; }
/* * 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...
(&num, &test_num, sizeof(Fixed_S16_3))