prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
ng_list_get_at(list_a, idx), string_list_get_at(list_b, idx) ); } break; } default: cl_assert(false); break; } } } static void compare_notifications(TimelineItem *a, TimelineItem *b) { cl_assert(uuid_equal(&a->header.id, &b->header.id)); cl...
uuid_generate(&i)
/* * 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...
(&card->menu_layer, MenuIndex(0, 2), MenuRowAlignCenter, 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...
(LOG_LEVEL_DEBUG, "CRCing recovery... done")
; return calculated_crc == firmware_description->checksum; }
tart_timer); } static void prv_transition_to(PPPControlProtocol *this, enum LinkState nextstate) { if (nextstate == LinkState_Initial || nextstate == LinkState_Starting || nextstate == LinkState_Closed || nextstate == LinkState_Stopped || nextstate == LinkState_O...
pulse_link_max_send_size()
<= last_week_midnight || timestamp_midnight >= next_week_midnight) { switch (style) { case FullStyleLower12h: case FullStyleCapital12h: if (with_fulltime) { time_fmt = i18n_noop("%b %e, %l:%M %p"); } else { time_fmt = i18n_noop("%B %e"); } break; ...
prv_format_time(buffer, buf_size, i18n_noop("%m/%d"), timestamp)
; } size_t clock_get_day_date(char *buffer, int buf_size, time_t timestamp) { return prv_format_time(buffer, buf_size, i18n_noop("%d"), timestamp); } static size_t prv_clock_get_month_named_date(char *buffer, size_t buffer_size, time_t timestamp, bool abbrev) { const c...
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 "crashed_ui.h" #include "services/common/light.h" #include "applib/ui/dialogs/d...
kernel_zalloc_check(sizeof(WorkerCrashDialogData))
/* * 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...
prompt_send_response("Unknown runlevel")
; return; } else if (runlevel == 0 && arg[0] != '0') { prompt_send_response("Invalid runlevel number. Choices:"); prv_list_runlevels(); return; } char response[80]; strcpy(response, "Switching to runlevel "); strcat(response, s_runlevel_debug_names[runlevel]); prompt_send_response(response)...
ote = (StoredRemote*) list_get_at(data->remote_list_head, row - 1); settings_remote_menu_push(data, remote); } static void prv_focus_handler(bool in_focus) { if (!in_focus) { return; } settings_menu_reload_data(SettingsMenuItemBluetooth); } static void prv_expand_cb(SettingsCallbacks *context) { Setting...
("Bluetooth")
, .init = prv_init, }; return &s_module_info; } #undef HEADER_BUFFER_SIZE
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
alarm_set_smart(data->alarm_id, !data->alarm_info.is_smart)
; if (data->alarm_editor_callback) { data->alarm_editor_callback(EDITED, data->alarm_id, data->callback_context); } } static void prv_edit_time_handler(ActionMenu *action_menu, const ActionMenuItem *item, void *context) { AlarmDetailData *data...
n Monday. (46.5 hours) cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 167400 * MS_PER_SECOND); rtc_set_time(s_thursday_00_00); do_not_disturb_handle_clock_change(); active = do_not_disturb_is_active(); cl_assert(active == true); // Timer will go off at 07:00 on Thursday. (7.0 hours) cl_ass...
get_dnd_timer_id()
), 1800 * MS_PER_SECOND); rtc_set_time(s_monday_10_30); do_not_disturb_handle_clock_change(); active = do_not_disturb_is_active(); cl_assert(active == false); // Timer will go off at 01:00 on Sunday. (12 hours) cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 43200 * MS_PER_SECOND); } void te...
_id %"PRIu8", items remaining %"PRIu32", crc 0x%"PRIx32", num_bytes %d", msg->session_id, msg->items_left_hereafter, msg->crc32, num_bytes); break; } default: PBL_LOG_D(LOG_DOMAIN_DATA_LOGGING, LOG_LEVEL_DEBUG, "Message type 0x%x not recognized", message[0]); } } bool dls_endpoint_open_se...
dls_list_find_by_session_id(session_id)
; if (session == NULL) { PBL_LOG_D(LOG_DOMAIN_DATA_LOGGING, LOG_LEVEL_WARNING, "Received ack for non-existent session id: %"PRIu8, session_id); return; } mutex_lock(s_endpoint_data.mutex); PBL_LOG_D(LOG_DOMAIN_DATA_LOGGING, LOG_LEVEL_DEBUG, "Received ACK for id: %"PRIu8" state: %u", session->comm.sess...
ib/graphics/gtypes.h" #include "applib/ui/property_animation.h" #include "applib/ui/status_bar_layer.h" #include "applib/ui/shadows.h" #include "applib/ui/window.h" #include "resource/resource_ids.auto.h" #include "services/normal/timeline/layout_layer.h" #include "services/normal/timeline/notification_layout.h" #inclu...
MAX(swap_layer->layer.frame.size.h, size.h)
, }); return layout; } return NULL; } static void prv_announce_layout_will_appear(SwapLayer *swap_layer, LayoutLayer *layout) { swap_layer->swap_in_progress = true; if (swap_layer->callbacks.layout_will_appear_handler) { return swap_layer->callbacks.layout_will_appear_handler(swap_layer, layout, ...
BUTTON_ID_DOWN, ActionBarLayerIconPressAnimationMoveDown); action_bar_layer_add_to_window(data->action_bar, data->window); data->status_layer = status_bar_layer_create(); // Change the status bar width to make space for the ...
text_layer_create(GRect(par_box_x_offset, par_label_y_offset, stroke_box_width, label_height))
heck = true; prv_deinit(); char *script = "var num_times = 0;" "var extra_arg = 0;" "var timer = setInterval(function(extra) {" "num_times++;" "extra_arg = extra;" "}, 1000, 5);"; for (int i = 0; i < 30; ++i) { prv_init(); TIMER_APIS.init(); EXECUTE_SCRIPT(script); p...
cl_assert_equal_i(99, (int32_t)jerry_get_number_value(prv_js_global_get_value("s2")))
; cl_assert_equal_i(150, (int32_t)jerry_get_number_value(prv_js_global_get_value("c1"))); cl_assert_equal_i(150, (int32_t)jerry_get_number_value(prv_js_global_get_value("c2"))); cl_assert_equal_i(100, jerry_get_int32_value(prv_js_global_get_value("s1"))); cl_assert_equal_i(100, jerry_get_int32_value(prv_js_glo...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
graphics_context_set_fill_color(ctx, (GColor) { .argb = (0b11000000 | color) })
; graphics_fill_rect(ctx, &rect); *row += num_pixels; } #if PBL_ROUND static void prv_draw_round_border(Layer *layer, GContext *ctx, uint8_t radial_padding_size) { for (int i = 0; i < layer->bounds.size.h / 2 - radial_padding_size; ++i) { const GBitmapDataRowInfoInternal *data_row_infos = g_gbitmap_spaldin...
ed in max encoded message size PBL_ASSERTN(max_msg_size <= PLOG_DLS_RECORD_SIZE); if (max_msg_size == 0) { max_msg_size = PLOG_DLS_RECORD_SIZE; } // Default transport if (!transport) { transport = prv_dls_transport; } // Create a buffer for the final fully-formed record. Since we send it out thr...
PBL_ASSERTN(session_ref != 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...
{ // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_pbl_25655_1 //> TEST_EXPECTED 100 //> TEST_EXPECTED_MIN 80 //> TEST_EXPECTED_MAX 120 //> TEST_WEIGHT 1.0 static AccelRawData samples[] = { // 0 seconds // elapsed: 0 minutes { -8, -424, -832}, { -8...
{ 496, 480, -824}, { 464, 544, -784}, { 440, 464, -728}, { 472, 376, -680}, { 496, 384, -656}, { 488, 376, -664}, { 472, 488, -640}, { 432, 408, -720}, { 440, 456, -672}, { 456, 448, -688}, { 480, 408, -720}, { 368, 600, -704}, { 552, 712, -936}, { 504, 960, -784...
valid(app_smartstrap_attribute_begin_write(NULL, NULL, NULL)); assert_result_invalid(app_smartstrap_attribute_begin_write(NULL, &buffer, NULL)); assert_result_invalid(app_smartstrap_attribute_begin_write(NULL, NULL, &buffer_len)); assert_result_invalid(app_smartstrap_attribute_begin_write(NULL, &buffer, &buffer_l...
(0x1111, 0x2222, 100)
; // start a write request stub_pebble_tasks_set_current(PebbleTask_App); uint8_t *write_buffer = NULL; size_t write_length = 0; assert_result_ok(app_smartstrap_attribute_begin_write(attr, &write_buffer, &write_length)); cl_assert(write_buffer == (uint8_t *)attr); cl_assert(write_length == 100); // at...
ations under the License. */ #include <stdint.h> #include <string.h> #include <limits.h> #include <math.h> #include "clar.h" // "Define" libc functions we're testing #include "pblibc_private.h" // I want real memset #undef memset /////////////////////////////////////////////////////////////////////////////////////...
(dstbuf, "-16,-8464,-1698898192,-1698898192")
; snprintf(dstbuf, 256, "%lld,%jd", hurf, hurf); cl_assert_equal_s(dstbuf, "1311768467463790320,1311768467463790320"); snprintf(dstbuf, 256, "%zd,%td", hurf, hurf); cl_assert_equal_s(dstbuf, "-1698898192,-1698898192"); } // Literally copy-paste from %d void test_sprintf__percent_i(void) { char dstbuf[256]; ...
/* * 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...
(config.window_name)
; prv_setup_dialog(simple_dialog_get_dialog(simple_dialog), &config, (void *)ctx); simple_dialog_set_icon_animated(simple_dialog, !ctx->config.impl->result_icon_static); simple_dialog_push(simple_dialog, prv_get_window_stack()); } static bool prv_call_get_state_callback(ActionToggleContext *ctx) { if (ctx->con...
econds: case ActivityMetricSleepRestfulSeconds: case ActivityMetricSleepEnterAtSeconds: case ActivityMetricSleepExitAtSeconds: // We only store minutes for these metrics. Convert before saving value /= SECONDS_PER_MINUTE; break; default: break; } ActivityMetricInfo m_info = ...
(state->mutex)
; } // -------------------------------------------------------------------------------------------- // Called from activity_get_metric() every time a client asks for a metric. Also called // periodically from the minute handler before we save current metrics to setting. static void prv_update_real_time_derived_metric...
UT_MS); if (result != SmartstrapResultOk) { mbuf_free(s_read_mbuf); s_read_mbuf = NULL; PBL_LOG(LOG_LEVEL_WARNING, "Sending of link control message failed: result=%d, type=%d", result, type); smartstrap_link_control_disconnect(); } } static void prv_fatal_error_strike(void) { s_strike...
((profile > SmartstrapProfileInvalid) && (profile < NumSmartstrapProfiles))
; return !!(s_profiles & (1 << profile)); } static bool prv_send_control(void) { static time_t s_last_connection_request_time = 0; static time_t s_last_status_check_time = 0; const time_t current_time = rtc_get_time(); if (!smartstrap_is_connected() && accessory_is_present() && (smartstrap_fsm_state_ge...
00; prv_clock_reset(0); rtc_set_time(jun10th_noon_2015); // Our test event is at June 9th 2015, 12:00:00 // Now - one day const int event_time = jun10th_noon_2015 - SECONDS_PER_DAY; // if the event is within 24 hours, then show the actual time instead of "X hours ago" const int MAX_RELATIVE_HRS = 24; ...
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS)
; cl_assert_equal_s("IN 2 MIN", time_buf); // June 10th 2015, 04:00:00 (T+12:00:00) rtc_set_time(event_time + (12 * SECONDS_PER_HOUR)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("Yesterday, 4:00 PM", time_buf); // June 9th 2015, 02:00:00...
}; } // Initialization for a firmware update could involve an erase of 8 flash // sectors. Worst case timing for an erase is ~5s, so let's set our timeout to // 40s to give us some headroom. #define FIRMWARE_TIMEOUT_MS (1000 * 40) static FirmwareUpdateStatus prv_firmware_update_start(PebbleSystemMessageEvent *event) ...
PBL_LOG(LOG_LEVEL_WARNING, "Timed out waiting for putbytes request from phone")
; prv_firmware_update_finish(true /* failed */); break; default: break; } }
; } return &cached->glyph_data; } // We missed the cache, so we need to build a new cache entry. LineCacheData *data = &font_cache->cache_data_scratch; data->is_bitmap_loaded = false; data->resource_offset = prv_get_glyph_data_offset(codepoint, font_cache, font_res); GlyphData *g = &data->glyph_dat...
if (resource_id != RESOURCE_ID_FONT_FALLBACK_INTERNAL && !sys_resource_is_valid(app_num, resource_id)) { if (!is_extended) { PBL_LOG(LOG_LEVEL_WARNING, "Invalid text resource id %"PRId32, resource_id); } return false; }
if (app_num == SYSTEM_APP && !sys_resource_get_and_cache(app_num, resource_id)) { return false; } PBL_LOG_D(LOG_DOMAIN_TEXT, LOG_LEVEL_DEBUG, "FMD read: bytes:%d", (int)sizeof(FontMetaDataV3)); FontMetaDataV3 header; SYS_PROFILER_NODE_START(text_render_flash); uint32_t bytes_read = sys_resource_load...
t animation_offset_px; Animation *first_anim; Animation *second_anim; } CompositorShutterTransitionData; static CompositorShutterTransitionData s_data; #define PATH_WEDGE_POINTS 3 #define PATH_QUAD_POINTS 4 static GPathInfo s_path_wedge = { .num_points = PATH_WEDGE_POINTS, .points = (GPoint[PATH_WEDGE_POINTS...
graphics_context_set_stroke_color(ctx, s_data.color)
; graphics_context_set_fill_color(ctx, s_data.color); for (int i = 0; i < PATH_WEDGE_POINTS; i++) { prv_gpoint_interpolate(&s_path_wedge.points[i], distance, &s_path_defs[s_data.direction].wedge_verts[i]); } gpath_init(&s_data.path, &s_path_wedge); gpath_draw_outline(ctx, &s_data.path); gpath_dra...
sizeof(scan_resp_data)); cl_assert(memcmp(&scan_resp_data_out, scan_resp_data, sizeof(scan_resp_data)) == 0); // Expect one regular timer to be running for advertisements: cl_assert_equal_i(regular_timer_seconds_count(), 1); // Unschedule callback should not have been called: cl_asser...
gap_le_get_scan_response_data(&scan_resp_data_out)
, sizeof(scan_resp_data)); cl_assert(memcmp(&scan_resp_data_out, scan_resp_data, sizeof(scan_resp_data)) == 0); // Expect one regular timer to be running for adverts: cl_assert_equal_i(regular_timer_seconds_count(), 1); // Unschedule callback should not have been called: ...
window_get_user_data(window)
; // re-enable the inactivity timer back in timeline view prv_inactive_timer_refresh(data); } static void prv_timeline_window_disappear(Window *window) { TimelineAppData *data = window_get_user_data(window); // disable the inactivity timer when the user leaves prv_cleanup_timer(&data->inactive_timer_id); }...
e the License for the specific language governing permissions and * limitations under the License. */ #include "ancs_filtering.h" #include "drivers/rtc.h" #include "kernel/pbl_malloc.h" #include "services/normal/notifications/alerts_preferences.h" #include "services/normal/timeline/attributes_actions.h" #include "...
{ // We don't change or add actions at this time TimelineItemActionGroup *new_action_group = NULL; if (app_notif_prefs) { new_action_group = &app_notif_prefs->action_group; } ios_notif_pref_db_store_prefs(app_id->value, app_id->length, &new_attr_list, new_act...
kernel_free(app_name_buff); attribute_list_destroy_list(&new_attr_list); } uint8_t ancs_filtering_get_mute_type(const iOSNotifPrefs *app_notif_prefs) { if (app_notif_prefs) { return attribute_get_uint8(&app_notif_prefs->attr_list, AttributeIdMuteDayOfWeek, ...
C_DOT_LAYER_SIZE ((GSize){ .w = MIC_DOT_LAYER_RADIUS * 2, .h = MIC_DOT_LAYER_RADIUS * 2}) #define MAX_MESSAGE_LEN (500) #define MAX_ERROR_COUNT (4) #define ERROR_DIALOG_TIMEOUT (5000) static const uint32_t UNFOLD_DURATION = 500; #define VOICE_LOG(fmt, args...) PBL_LOG_D(LOG_DOMAIN_VOICE, LOG_LEVEL_DEBUG, fmt, ##...
prv_exit_and_send_result_event(data, data->error_exit_status)
; } } static void prv_error_dialog_unload(void *context) { VoiceUiData *data = context; prv_handle_error_retries(data); } static void prv_init_dialog(VoiceUiData *data, Dialog *dialog, const char *text, uint32_t resource_id, bool has_timeout, GColor color) { dialog_set_callbacks(dialog, &(DialogCallbacks)...
t_is_connected(void) { return (s_transport.session != NULL); } // ----------------------------------------------------------------------------------------- void pulse_transport_set_connected(bool is_connected) { if (pulse_transport_is_connected() == is_connected) { return; } static const TransportImplemen...
prv_pulse_pp_send(PULSE_PP_OPCODE_UNKNOWN, &packet->opcode, sizeof(packet->opcode))
; break; } }
s_draw_vertical_line_dotted(&ctx, GPoint(col, 0), MAX_NUM_ROWS); } cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_vert_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, fals...
graphics_draw_vertical_line_dotted(&ctx, GPoint(131, 91), 10)
; graphics_draw_horizontal_line_dotted(&ctx, GPoint(131, 96), 5); 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 li...
bytes, PFS avail space: %"PRIu32"", to_free, pfs_space); app_cache_free_up_space(to_free); } } static void prv_delete_cache_callback(void *data) { app_cache_flush(); } static void prv_delete_cached_files(void) { pfs_remove_files(is_app_file_name); } static bool prv_is_in_list(AppInstallId id, const...
(BUTTON_ID_SELECT)
, quick_launch_get_app(BUTTON_ID_DOWN), quick_launch_get_app(BUTTON_ID_BACK), #endif watchface_get_default_install_id(), worker_preferences_get_default_worker(), }, }; settings_file_each(&file, prv_each_free_up_space, &evict_data); settings_file_close(&file); // r...
tmap, "fill_rect_origin_r7_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 8, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r8_no_clip.${BIT_DEPTH_NAME}.pbi")); ...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_aa_no_clip.${BIT_DEPTH_NAME}.pbi"))
r (int c = ANCSCharacteristicData; c >= ANCSCharacteristicNotification; --c) { const BTErrno e = gatt_client_subscriptions_subscribe(characteristics[c], BLESubscriptionNotifications, GAPLEClientKernel...
(ANALYTICS_DEVICE_METRIC_NOTIFICATION_BYTE_IN_COUNT, length, AnalyticsClient_System)
; if (s_ancs_client->state == ANCSClientStateRequestedApp) { prv_handle_app_attributes_response(data, length); } else if (s_ancs_client->state == ANCSClientStateRequestedNotification || s_ancs_client->state == ANCSClientStateReassemblingNotification) { prv_reassemble_ds_notification(length, da...
{ 32, 8, -992}, { 24, -16, -984}, { 32, -16, -1024}, { 32, -24, -984}, { 32, 0, -992}, { 32, -24, -984}, { 32, -8, -992}, { 32, -24, -992}, { 32, -32, -992}, { 32, 0, -984}, { 24, -8, -1000}, { 32, -16, -968}, { 32, -40, -976}, { 24, -80, -1008}, { 24, -48, -10...
ARRAY_LENGTH(samples)
; return samples; } // ---------------------------------------------------------------- // Sample captured: 2015-10-02 16:18:13 local AccelRawData *activity_sample_non_walk_pbl_25482_14(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME non_walk_pbl_25482_14 //> TE...
data_out = &buffer->buffer[client->read_index]; const uint16_t bytes_read = buffer->buffer_size - client->read_index; *length_out = MIN(bytes_read, length); return true; } // ------------------------------------------------------------------------------------------------- bool shared_circular_buffer_consume(S...
prv_get_data_length( buffer, &client->buffer_client)
; // Optimized case when no subsampling if (client->numerator == client->denominator) { num_items = MIN(num_items, bytes_available / item_size); uint16_t bytes_out; shared_circular_buffer_read_consume( buffer, &client->buffer_client, num_items * item_size, (uint8_t *)data, &bytes_out); ...
/* * 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 (animation->first_child) { prv_each(animation->first_child, callback, context); } if (animation->sibling) { prv_each(animation->sibling, callback, context); } callback(animation, context); }
static void prv_free(AnimationPrivate *animation, uintptr_t context) { list_remove(&animation->list_node, NULL, NULL); free(animation); } bool animation_destroy(Animation *animation) { prv_each((AnimationPrivate *)animation, prv_free, (uintptr_t)NULL); return true; } bool animation_set_implementation(Animat...
== memcmp(addr, &active_addr, sizeof(*addr)))) { remote->classic.connected = true; } else { remote->classic.connected = false; } add_remote(data, remote); } static void prv_add_bt_classic_remotes(SettingsBluetoothData *data) { bt_persistent_storage_for_each_bt_classic_pairing(prv_add_bt_classic_remo...
("%u Paired Phone", data)
less 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 License. */ ...
("var patch = _rocky.watchInfo.firmware.patch")
; ASSERT_JS_GLOBAL_EQUALS_I("patch", VERSION_PATCH); EXECUTE_SCRIPT("var suffix = _rocky.watchInfo.firmware.suffix"); ASSERT_JS_GLOBAL_EQUALS_S("suffix", VERSION_SUFFIX); }
/* * 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 (button == BUTTON_ID_UP) { if (data->select_index == SelectIndexPixels) { // Do inverse if (data->up_down_direction) { frame.origin.y--; } else { frame.origin.x--; } } else if (data->select_index == SelectIndexDirection) { data->up_down_direction = !(data->up_dow...
text_layer_set_text_color(&data->direction_layer, GColorBlack); text_layer_set_background_color(&data->direction_layer, GColorWhite); text_layer_set_text_color(&data->word_wrap_layer, GColorBlack); text_layer_set_background_color(&data->word_wrap_layer, GColorWhite); if (data->select_index == SelectIndexDi...
/* * 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...
(PowerSystemProfiling)
; RtcTicks log_record_time = rtc_get_ticks(); char buffer[32]; for (int i = 0; i<num_power_systems; ++i) { DiscreteSystemProfile *current_profile = &s_discrete_consumer_profiles[i]; if (current_profile->dirty) { RtcTicks total_ticks = current_profile->total_ticks; if (current_profile->start...
he License for the specific language governing permissions and * limitations under the License. */ #include "applib/applib_resource_private.h" #include "gdraw_command.h" #include "gdraw_command_private.h" #include "applib/applib_malloc.auto.h" #include "applib/graphics/gpath.h" #include "system/passert.h" #include ...
(ctx, command)
bounds) - 1, }; } } MOCKABLE GBitmapDataRowInfo gbitmap_get_data_row_info(const GBitmap *bitmap, uint16_t y) { return prv_gbitmap_get_data_row_info(bitmap, y); } void gbitmap_init_with_data(GBitmap *bitmap, const uint8_t *data) { BitmapData* bitmap_data = (BitmapData*) data; memset(bitmap, 0, prv_gbitmap...
{ if (!bitmap) { return false; } bitmap->row_size_bytes = gbitmap_format_get_row_size_bytes(size.w, format); bitmap->bounds.size.w = size.w; bitmap->bounds.size.h = size.h; prv_init_gbitmap_version(bitmap); bitmap->info.format = format; const size_t data_size = prv_gbitmap_size_for_data(size, form...
static GBitmap* prv_gbitmap_create_blank(GSize size, GBitmapFormat format) { GBitmap *bitmap = prv_allocate_gbitmap(); if (bitmap) { if (!prv_gbitmap_allocate_data_for_size(bitmap, size, format)) { applib_free(bitmap); return NULL; } #ifdef PLATFORM_SPALDING if (BITMAP_FORMAT_IS_CIRCULAR_...
_invoke_pending(); } // --------------------------------------------------------------------------------------- // Test that we correctly initialize the history upon startup based on stored settings void test_activity__init_history(void) { uint32_t exp_resting_kcalories[ACTIVITY_HISTORY_DAYS]; for (int i = 0; i <...
(ActivityMetricDistanceMeters, 1, &exp_distance)
; cl_assert(exp_distance > 0); // Read the active calories int32_t exp_active_kcalories; activity_get_metric(ActivityMetricActiveKCalories, 1, &exp_active_kcalories); cl_assert(exp_active_kcalories > 0); // If we init again, we should start out with the same metrics because we // would have retrieved t...
/* * 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...
{ syscall_internal_elevate_privilege(); syscall_assert_userspace_buffer(buffer, size); bad_syscall(buffer, size); good_syscall(buffer, size); }
void bad_nested_syscall(void * buffer, int size) { syscall_internal_elevate_privilege(); bad_syscall(buffer, size); } void hidden_bad_syscall(void * buffer, int size) { syscall_internal_elevate_privilege(); do_stuff(buffer, size); } void if_syscall(void * buffer, int size) { if (syscall_internal_elevate_p...
percent); // Then, when the voltage drops, the percentage should begin to decline - but should not reach the low value yet fake_battery_set_millivolts(low_mv); periodic_timer_trigger(1); int delta = high_percent - battery_get_charge_state().charge_percent; cl_assert(delta >= 0); cl_assert(delta < high_perc...
cl_assert(battery_monitor_critical_lockout())
lue to differentiate wakeup event bool repeating; //!< Enable event repetition uint16_t repeat_hours_offset; //!< repeat hour interval bool notify_if_missed; //!< Notify user if wakeup event has been missed time_t timestamp; //!< The time at which this entry will wake up at bool utc; //!< If timezone has been...
{ return; }
// If there is already a wakeup timer scheduled, cancel it. There will be a // new timer scheduled for the soonest wakeup that is registered. if (new_timer_scheduled(s_current_timer_id, NULL)) { new_timer_stop(s_current_timer_id); } mutex_lock(s_mutex); { // Find the next event to occur Setti...
k = mutex_create(); state->initialized = true; // Allocate buffer for received characters from the ISR uint32_t buffer_size = QEMU_ISR_RECV_BUFFER_SIZE; uint8_t *buffer_data = kernel_malloc_check(buffer_size); shared_circular_buffer_init(&state->isr_buffer, buffer_data, buffer_size); shared_circular_buffe...
ntohs(state->hdr.len)
; // Validity checking if (state->hdr.len > QEMU_MAX_DATA_LEN) { PBL_LOG(LOG_LEVEL_ERROR, "Invalid header data size %d", state->hdr.len); state->recv_state = QemuRecvState_WaitingHdrSignatureMSB; } else { QEMU_LOG_DEBUG("got header: protocol: %d, len: %d", state->h...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
window_get_user_data(window)
; kino_layer_deinit(&data->icon_layer); } static void prv_init(void) { MorphSquareDemoData *data = app_zalloc_check(sizeof(MorphSquareDemoData)); app_state_set_user_data(data); Window *window = &data->window; window_init(window, WINDOW_NAME("Morph Square Demo")); window_set_user_data(window, data); win...
h" #include "applib/ui/ui.h" #include "kernel/pbl_malloc.h" typedef struct { Window window; MenuLayer menu_layer; StatusBarLayer status_layer; const char *title; TimelineItemActionGroup *action_group; ActionChainingMenuSelectCb select_cb; ActionChainingMenuClosedCb closed_cb; void *select_cb_context;...
(&data->window.layer, menu_layer_get_layer(&data->menu_layer))
; #if PBL_RECT status_bar_layer_init(&data->status_layer); status_bar_layer_set_colors(&data->status_layer, PBL_IF_COLOR_ELSE(GColorWhite, GColorBlack), PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite)); status_bar_layer_set_title(&data->status_layer, data->title, ...
NYI: PBL-42081 // #define ROCKY_EVENT_MEMORYPRESSURE_LEVEL_LOW "low" // NYI: PBL-42081 #define HEADROOM_MIN_SIZE_BYTES (128) //! This struct should only be accessed from the app task, so no locking is required. typedef struct RockyMemoryAPIContext { //! Reserved headroom that will be made available just before ca...
prv_collect_all_garbage()
; prv_allocate_headroom_or_die(ctx); ctx->is_calling_memory_callback = false; } static void prv_memory_callback(jmem_free_unused_memory_severity_t severity, size_t requested_size_bytes, bool fatal_if_not_freed) { RockyMemoryAPIContext *ctx = app_s...
88, 120, -8}, { 1728, 464, -56}, { 1616, 704, 16}, { 1280, 480, -16}, { 1184, 288, -8}, { 1664, 216, 200}, { 1808, -56, 352}, { 1768, -232, 272}, { 1600, -200, 200}, { 1416, -168, 168}, // 29 seconds { 1320, -168, 184}, { 1288, -256, 128}, { 1136, -400, -48}, { 11...
{ 1688, -160, 112}, { 1520, -40, 200}, { 1352, -8, 152}, { 1320, 48, 72}, { 1536, -48, 72}, { 1744, 120, 96}, { 2064, 1648, -16}, { 1544, 432, 96}, { 2008, 240, 216}, { 1064, 504, -120}, { 1736, 64, 192}, { 1960, -192, 408}, { 1728, -320, 336}, { 1408, -192, 176},...
{ 768, -320, -168}, { 928, -392, -16}, { 744, -336, 48}, // 37 seconds { 1288, -184, 40}, { 1672, 24, -40}, { 1760, 160, 40}, { 1352, 296, 112}, { 1064, 304, 144}, { 944, 392, 144}, { 1032, 368, 32}, { 1080, 280, 40}, { 1440, 312, 80}, { 1656, 440, 40}, { 196...
/* * 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...
(menu_layer)
); } static void prv_window_unload(Window *window) { SettingsAppData *data = window_get_user_data(window); menu_layer_deinit(&data->menu_layer); app_free(data); } static void handle_init(void) { SettingsAppData *data = app_zalloc_check(sizeof(SettingsAppData)); Window *window = &data->window; window_init...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&char_iter, &char_iter_state, &text_box_params_single_byte, utf8_bounds_single_byte.start)
; cl_assert(!iter_next(&char_iter)); cl_assert(!iter_next(&char_iter)); cl_assert(!iter_next(&char_iter)); // Multi-byte char success = false; const Utf8Bounds utf8_bounds_multi_byte = utf8_get_bounds(&success, "\xc3\xb0"); cl_assert(success); const TextBoxParams text_box_params_multi_byte = (TextBox...
/* * 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 (!pb_encode_tag(stream, PB_WT_STRING, field->tag)) { return false; }
// Encode the size if (!pb_encode_varint(stream, packed_array_size)) { return false; } // if just being called to size it up, the stream callback will be NULL if (!stream->callback) { return pb_write(stream, NULL, packed_array_size); } // Write out each of the values for (unsigned i = 0; i <...
= 40, .priority = 8, .size = 23717 }, // priority rank 6 { .id = 41, .priority = 61, .size = 266668 }, // priority rank 49 { .id = 42, .priority = 58, .size = 61228 }, // priority rank 46 { .id = 43, .priority = 12, .size = 23513 }, // priority rank 7 { .id = 44, .priority = 60, .size = 267049 }, // priori...
(id, buffer, 10)
; int fd = pfs_open(buffer, OP_FLAG_READ, FILE_TYPE_STATIC, 0); if (fd < 0) { return false; } pfs_close(fd); return true; } static void prv_create_file_for_id(AppInstallId id) { char buffer[30]; itoa_int(id, buffer, 10); int fd = pfs_open(buffer, OP_FLAG_WRITE, FILE_TYPE_STATIC, 10); pfs_close(...
/* * 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...
(tz_p, sizeof(*tz_p))
; } time_t utc_now; time_ms(&utc_now, NULL); int32_t dstoffset = time_get_isdst(utc_now) ? time_get_dstoffset() : 0; tz_p->daylight_saving_time = dstoffset / 3600; tz_p->offset = -1 * time_get_gmtoffset() / 60; return 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...
menu_layer_set_selected_next(menu_layer, up, MenuRowAlignCenter, animated)
; } void menu_down_click_handler(ClickRecognizerRef recognizer, MenuLayer *menu_layer) { const bool up = false; const bool animated = true; menu_layer_set_selected_next(menu_layer, up, MenuRowAlignCenter, animated); } static void prv_menu_click_config_provider(MenuLayer *menu_layer) { // The config that gets ...
if (!next_info.found) { rv = S_NO_MORE_ITEMS; goto cleanup; }
*id_out = next_info.id; rv = S_SUCCESS; cleanup: mutex_unlock(storage->mutex); return rv; } bool timeline_item_storage_exists_with_parent(TimelineItemStorage *storage, const Uuid *parent_id) { mutex_lock(storage->mutex); FindChildrenInfo info = { .parent_id = *parent_id, .num_children = 0, ...
i(s_num_alarm_events_put, 2); cl_assert_equal_i(s_num_timeline_adds, 5); cl_assert_equal_i(s_num_timeline_removes, 3); cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); } void test_alarm__custom_alarm_everyday(void) { AlarmId id1; bool schedule_1[7] = {true, true, true, true, ...
(s_num_timeline_adds, 6)
8}, { -408, 224, -264}, { -496, 264, -208}, { -608, 224, -72}, { -752, 296, -88}, { -728, 336, -48}, { -744, 376, -96}, { -960, 528, -256}, { -1008, 424, -104}, { -1424, 456, -160}, { -1216, 632, -320}, { -1184, 480, -272}, { -1168, 616, -288}, { -1024, 432, -112}, ...
{ -816, 288, 136}, { -824, 248, 184}, // 55 seconds { -960, 232, 168}, { -1080, 208, 112}, { -1136, 224, 48}, { -1272, 216, 32}, { -952, 344, -168}, { -976, 424, -304}, { -960, 184, -184}, { -784, 200, -176}, { -528, 336, -272}, { -440, 408, -264}, { -480, 400, -1...
{ -1376, 416, -32}, { -960, 560, -240}, { -816, 512, -296}, { -768, 440, -224}, { -648, 280, -112}, { -520, 312, -184}, { -504, 216, -136}, { -456, 184, -120}, { -512, 248, -112}, { -672, 336, -176}, { -720, 352, -96}, { -760, 296, -88}, // 58 seconds { -1016, 37...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&ctx, &data, &should_store, &is_invalid)
; cl_assert(is_complete == false); cl_assert(should_store == false); cl_assert(is_invalid == false); data = HDLC_FLAG; is_complete = hdlc_streaming_decode(&ctx, &data, &should_store, &is_invalid); cl_assert(is_complete == true); cl_assert(should_store == false); cl_assert(is_invalid == true); } void te...
ed_circular_buffer_read(&buffer, &client1, 1, &out_buffer, &out_length)); cl_assert(!shared_circular_buffer_read(&buffer, &client2, 1, &out_buffer, &out_length)); // Fill with data cl_assert(shared_circular_buffer_write(&buffer, (uint8_t*) "123456", 6, false)); // Read different amounts from each client cl_...
shared_circular_buffer_get_read_space_remaining(&buffer, &client)
, 0); // Write 2 more cl_assert(shared_circular_buffer_write(&buffer, storage, 2, false)); cl_assert_equal_i(shared_circular_buffer_get_read_space_remaining(&buffer, &client), 2); // Consume it prv_read_and_consume(&buffer, &client, storage, 2); cl_assert_equal_i(shared_circular_buffer_get_read_space_rema...
------------------------------------------------------------ static bool prv_set_alarm_smart_op(AlarmId id, AlarmConfig *config, void *context) { config->is_smart = (uintptr_t)context; return true; } void alarm_set_smart(AlarmId id, bool smart) { prv_alarm_operation(id, prv_set_alarm_smart_op, (void *)(uintptr_t...
prv_reload_alarms(&file)
; prv_file_close_and_unlock(&file); } // ---------------------------------------------------------------------------------------------- bool alarm_get_enabled(AlarmId id) { SettingsFile file; if (!prv_file_open_and_lock(&file)) { return false; } bool is_enabled = false; AlarmConfig config; bool rv ...
_sampling(); } PBL_LOG(LOG_LEVEL_DEBUG, "subscribers %"PRIu8, s_compass_subscribers_count); } ////////////////////////////////////////////////////////////////////////////////// // Public API void ecompass_handle_battery_state_change_event(PreciseBatteryChargeState new_state) { if (new_state.is_plugged) { s_...
{ return; // only bubble up every 4th sample to app land with high samp rate }
if ((cal_status == MagCalStatusNewLockedSolutionAvail) || (cal_status == MagCalStatusSavedSampleMatch)) { if (s_high_freq_calib_active) { prv_calibration_time_expired_cb(NULL); } prv_save_calibration_values(s_active_corr); s_current_cal_status = CompassStatusCalibrated; ...
APP_NOT_RUNNING: return "APP_MSG_APP_NOT_RUNNING"; case APP_MSG_INVALID_ARGS: return "APP_MSG_INVALID_ARGS"; case APP_MSG_BUSY: return "APP_MSG_BUSY"; case APP_MSG_BUFFER_OVERFLOW: return "APP_MSG_BUFFER_OVERFLOW"; case APP_MSG_ALREADY_RELEASED: return "APP_MSG_ALREADY_RELEASED"; case APP_MSG_CALLBA...
(app_data->out_iter, AppMessageKey_HeartRate, bpm)
; dict_write_uint8(app_data->out_iter, AppMessageKey_Confidence, bpm_quality); } if (led_current) { dict_write_uint16(app_data->out_iter, AppMessageKey_Current, led_current); } if (hrm->debug->ppg_data.num_samples) { HRMPPGData *d = &hrm->debug->ppg_data; dict_w...
= NULL; } static bool prv_validate_entry(ResourceStoreEntry *entry, ResourceManifest *manifest, uint32_t resource_id) { if (entry->id > manifest->num_resources) { PBL_LOG(LOG_LEVEL_DEBUG, "Out of bound resource %"PRId32" vs %"PRId32, entry->id, manifest->num_resources); ...
{ app_file_name_make(name, buf_length, resource_bank, APP_RESOURCES_FILENAME_SUFFIX, strlen(APP_RESOURCES_FILENAME_SUFFIX)); }
uint32_t *new_read_offset) { prv_assert_valid_task(); int32_t read_bytes = 0; int32_t last_whole_items_read_bytes = 0; bool got_session_file = false; if (logging_session->storage.write_offset == 0) { // no data available for this session goto exit; } got_session_file = prv_get_session_f...
{ // End of valid data break; }
if (chunk_hdr.valid) { if (reset_read_offset) { // If we are only resetting the read offset, break out now. break; } if (chunk_hdr.num_bytes > num_bytes) { // Somehow the caller tried to consume less than they read? PBL_LOG(LOG_LEVEL_WARNING, "Read/consume out of ...
-88, -992}, { 48, -96, -992}, { 48, -96, -992}, { 48, -88, -992}, { 48, -80, -984}, { 48, -88, -1000}, { 48, -104, -992}, { 40, -88, -992}, { 48, -72, -1008}, { 40, -104, -976}, // 279 seconds { 40, -96, -984}, { 48, -96, -992}, { 48, -88, -984}, { 40, -96, -992},...
{ 48, -88, -984}, { 40, -80, -992}, { 40, -96, -992}, { 40, -96, -984}, { 48, -88, -984}, { 40, -96, -984}, { 40, -88, -984}, { 48, -64, -984}, { 40, -88, -992}, { 40, -120, -1000}, { 48, -96, -1000}, { 48, -88, -992}, { 40, -96, -992}, { 40, -96, -984}, { 48,...
{ 32, -144, -1000}, { 32, -152, -992}, { 24, -144, -976}, { 40, -144, -984}, { 32, -168, -968}, { 32, -176, -984}, { 16, -224, -992}, { 16, -216, -992}, { 16, -208, -992}, { 24, -208, -976}, { 24, -192, -992}, { 16, -208, -984}, { 24, -192, -984}, { 16, -200, -98...
PBL_ASSERT_TASK(PebbleTask_KernelMain); // Stop the framebuffer_prepare performance timer. This timer was started when the client // first posted the render event to the system. compositor_display_update(prv_handle_display_update_complete); } static void prv_send_did_focus_event(bool in_focus) { PebbleEvent ...
prv_compositor_flush()
; } static void prv_animation_update(Animation *animation, const AnimationProgress distance_normalized) { PBL_ASSERT_TASK(PebbleTask_KernelMain); // Since we might be running this animation update as part of a deferred render, we must // update the kernel animation state's .curre...
_measuring_timer); gbitmap_destroy(active_window->action_bar_start); gbitmap_destroy(active_window->action_bar_pause); gbitmap_destroy(active_window->action_bar_stop); gbitmap_destroy(active_window->action_bar_more); gbitmap_destroy(active_window->action_bar_next); gbitmap_destroy(active_window-...
// Three metrics. Two static metrics above a scrollable metric const int layer_height = 51; GRect top_metric_bounds = base_layer_bounds; top_metric_bounds.size.h = layer_height; layer_init(&active_window->top_metric_layer, &top_metric_bounds); layer_set_update_proc(&active_window->top_metric_lay...
FMT_RECURSE_I18N(time_locale->c_fmt)
; _fmt_recurse: if (!use_i18n && i18nstr) { cpystr = i18nstr; i18nstr = NULL; } if (i18nstr) { cpystr = i18n_get(i18nstr, dest_str); } length = localized_strftime(dest_str, left, cpystr, t, locale); if (i18nstr) { i18n_free(i18nstr,...
var name = __jerryRefs.get($13 /* prop_name_val */); var desc = {}; if ($0 /* is_value_defined */) { desc.value = __jerryRefs.get($9); } if ($1 /* is_get_defined */) { desc.get = __jerryRefs.get($10); } if ($2 /* is_set_defined */) { desc.set = __jerryRefs.get...
({ var str = __jerryRefs.ref(String(__jerryRefs.get($0))); return str; }, object)
g_box.origin.x; x2.integer += ctx->draw_state.drawing_box.origin.x; y += ctx->draw_state.drawing_box.origin.y; GBitmap *framebuffer = graphics_capture_frame_buffer(ctx); if (!framebuffer) { // Couldn't capture framebuffer return; } graphics_private_draw_horizontal_line_delta_prepared(ctx, framebuf...
{ const GBitmapDataRowInfo row_info = gbitmap_get_data_row_info(bitmap, y); const int16_t min_x = MAX(row_info.min_x, bitmap->bounds.origin.x); const int16_t max_x = MIN(row_info.max_x, grect_get_max_x(&bitmap->bounds) - 1); const int16_t num_pix_data_row = max_x - min_x + 1; const int16_t pixels_to...
if (patch_garbage) { memset(garbage_start, fill_byte, delta_bytes); } } if (delta_neg) { if (delta_bits) { const int rshift = delta_bits; const int lshift = 8 - rshift; for (int i = 0; i < bytes - 1; i++) { buf...
8_t hrm_status; uint8_t bpm; uint8_t sqi; } hrm_data_regs; prv_read_register_block(dev, ADDR_LED_CURRENT_MSB, &hrm_data_regs, sizeof(hrm_data_regs)); data->led_current_ua = ntohs(hrm_data_regs.led_current); data->hrm_status = hrm_data_regs.hrm_status; data->hrm_bpm = hrm_data_regs.bpm; if (data->...
("idx %-2"PRIu8" ppg %-6"PRIu16" tia %-6"PRIu16, data.ppg_data.indexes[i], data.ppg_data.ppg[i], data.ppg_data.tia[i])
; } hrm_manager_new_data_cb(&data); if (num_samples == 0 && should_expect_samples) { analytics_inc(ANALYTICS_DEVICE_METRIC_HRM_ACCEL_DATA_MISSING, AnalyticsClient_System); PBL_LOG(LOG_LEVEL_WARNING, "Falling behind: HRM got 0 accel samples"); } } static void prv_as7000_interrupt_handler(bool *should...
_scope_once(void) { const time_t now = rtc_get_time(); const time_t time_start = now - 2 * SECONDS_PER_HOUR; const time_t time_end = now; // ---------------------------------------------------------------- // Put in our minute history HealthServiceCache *cache = NULL; unsigned num_minutes_per_call = ARR...
prv_health_event_handler(&event, NULL)
; } // One alert on the way up cl_assert_equal_i(s_metric_alert_count, 1); for (int i = 70; i >= 60; i--) { s_sys_activity_get_metric_values.out.history[0] = i; PebbleEvent event = { .type = PEBBLE_HEALTH_SERVICE_EVENT, .health_event.type = HealthEventHeartRateUpdate, }; prv_health_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
EXECUTE_SCRIPT( "var 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( "var d = new Date();\n" "var s = d.toLocaleTimeString();\n" ); ASSERT_JS_GLOBAL_EQUALS_S("s", "12:04:05 AM"); } void test_rocky_api_datetime__locale_time_string_24h(void) { s_clock_is_24h_style = true...
) ? metric_margin_h_round_inner : metric_margin_h_round_page); metric_node->offset.y += metric_margin_h; metric_node->margin.h += metric_margin_h; } return metric_node; } //! Adds a metric node to a vertically and automatically adds a page brea...
kino_layer_set_alignment(icon_layer, config->align)
; kino_layer_set_reel(icon_layer, icon_reel, true /* take_ownership */); layer_add_child((void *)&layout->layer, &icon_layer->layer); GTextNodeCustom *custom = layout_node_create_kino_layer_wrapper(icon_layer); prv_set_text_node_extent(&custom->node, &config->extent); return &custom->node; } GTextNode *layou...
urn; } if (!info.num_success && !info.num_failed) { // Shouldn't ever happen, but better not PBL_ASSERTN on app task PBL_LOG(LOG_LEVEL_ERROR, "Got callback, but zero messages!?"); // fall-through } // These conditions are redundant, just for safety: while ((num_message_consumed < info.num_success...
(LOG_LEVEL_ERROR, "Dropping data, not enough space %"PRIu32" vs %"PRIu32, (uint32_t)required_free_length, (uint32_t)space_remaining)
; return false; } return true; } static void prv_send_event_if_needed(AppInboxNode *inbox) { if (!inbox || inbox->has_pending_event) { return; } PebbleEvent event = { .type = PEBBLE_CALLBACK_EVENT, .callback = { .callback = prv_callback_event_handler, .data = (void *)(uintptr_t) i...
pedef struct { ActualValue activity_type; ActualValue len; ActualValue start_at; float weighted_err; bool all_passed; } ActivityTestResults; typedef struct { KAlgActivityType activity; time_t start_utc; uint16_t len_minutes; bool ongoing; uint16_t steps; uint32_t resting_calories; uint32_t ac...
(names[i])
; } } cl_assert_equal_i(num_stats, s_stats_num_columns); // Create a new row of stats StatsRow *stats = malloc(sizeof(StatsRow)); memset(stats, 0, sizeof(*stats)); // Collect the stats and also print them out for (int i = 0; i < num_stats; i++) { printf("%s: %d, ", names[i], values[i]); sta...
nd = 0; char time_now_text[64]; struct tm *local_tm = localtime(&now); strftime(time_now_text, sizeof(time_now_text), "%F %r", local_tm); APP_LOG(APP_LOG_LEVEL_DEBUG, "Current time: %s", time_now_text); // Check for correct operation of health_service_any_activity_accessible() time_t t_24_hrs_ago = now ...
{ HealthMinuteData *m_data = &minute_data[i]; APP_LOG(APP_LOG_LEVEL_DEBUG, "%"PRId8", 0x%"PRIx8", %"PRIu16", %"PRId8" ", m_data->steps, m_data->orientation, m_data->vmc, m_data->light); }
} exit: free(minute_data); } // ----------------------------------------------------------------------------------------- static void prv_daily_metric_avg(HealthAPITestAppData *data, HealthMetric metric, const char *name) { strncpy(data->debug_card.dialog_text, name, sizeof(da...
essoryBaud14400, AccessoryBaud19200, AccessoryBaud28800, AccessoryBaud38400, AccessoryBaud57600, AccessoryBaud62500, AccessoryBaud115200, AccessoryBaud125000, AccessoryBaud230400, AccessoryBaud250000, AccessoryBaud460800 }; _Static_assert(ARRAY_LENGTH(BAUDS) - 1 == AccessoryBaud460800, "BAUDS doesn'...
if (s_profiles == 0) { PBL_LOG(LOG_LEVEL_WARNING, "No profiles specified"); smartstrap_link_control_disconnect(); success = false; } else { prv_do_send(LinkControlTypeStatus); }
} else { // length is invalid (should be an even multiple of the size of the profile value) PBL_LOG(LOG_LEVEL_WARNING, "Got invalid profiles length (%"PRIu32")", data_length); smartstrap_link_control_disconnect(); success = false; } } else if (header->type == LinkControlTypeBaud) { ...
GAPLEConnection)); *connection = (const GAPLEConnection) { .device = *device, .local_is_master = local_is_master, .conn_mgr_info = bt_conn_mgr_info_init(), .bonding_id = BT_BONDING_ID_INVALID, .ticks_since_connection = rtc_get_ticks(), .is_remote_device_managing_connection_parameters = false,...
{ return (list_find(&s_connections->node, prv_valid_conn_filter, (void *)conn) != NULL); }
//! @note !!! To access the returned context bt_lock MUST be held!!! GAPLEConnection *gap_le_connection_by_device(const BTDeviceInternal *device) { return prv_find_connection(device); } // ------------------------------------------------------------------------------------------------- //! @note !!! To access the...
d16", %"PRId16")", touch_idx, pos->x, pos->y); } else { prv_touch_queue_add(ctx, touch_idx, TouchEvent_Liftoff, pos, 0, time_ms); TOUCH_DEBUG("Touch %"PRIu8": Liftoff!", touch_idx); } update = true; } else if (touch_state == TouchState_FingerDown) { PBL_ASSERTN(pos); if (...
for (uint32_t i = 0; i < ARRAY_LENGTH(s_touch_ctx); i++) { TouchContext *ctx = &s_touch_ctx[i]; prv_touch_context_reset(ctx); ctx->update_pending = false; ctx->update_cancelled = false; }
mutex_unlock(s_touch_mutex); } #if UNITTEST TouchEvent *touch_event_queue_get_event(TouchIdx touch_idx, uint32_t queue_idx) { if ((touch_idx > ARRAY_LENGTH(s_touch_ctx)) || (queue_idx > ARRAY_LENGTH(s_touch_ctx[touch_idx].touch_queue.events)) || (queue_idx >= s_touch_ctx[touch_idx].touch_queue.count)...
or; } const ButtonId button_id = (ButtonId)button; uint32_t num_presses = 1; // If presses is NULL, default to 1; otherwise convert the char string to an integer if (presses) { char *end; num_presses = MAX(0, strtol(presses, &end, 10)); // Validate the num_presses value if (*end != '\0') { ...
factory_reset(false /* should_shutdown */)
; } void command_factory_reset_fast(void) { prompt_command_finish(); worker_manager_disable(); while (worker_manager_get_current_worker_md()) { // Wait for the worker to die psleep(3); } launcher_task_add_callback(factory_reset_fast, NULL); } static bool prv_serial_dump_chunk_callback(uint8_t* ms...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&new_attr_list, AttributeIdMuteDayOfWeek, MuteBitfield_None)
; list_dirty = true; } // Add / update the "last seen" timestamp Attribute *last_updated = NULL; if (app_notif_prefs) { last_updated = attribute_find(&app_notif_prefs->attr_list, AttributeIdLastUpdated); } uint32_t now = rtc_get_time(); // Only perform an update if there is no timestamp or the cu...
KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "mcu/interrupts.h" #include "os/assert.h" #include "os/malloc.h" #include "os/mutex.h" #include "os/tick.h" #include "FreeRTOS.h" #include "light_mutex.h" #include "ta...
milliseconds_to_ticks(timeout_ms)
; LightMutexHandle_t mutex = handle->common.freertos_mutex; if (xLightMutexLockRecursive(mutex, timeout_ticks) == pdTRUE) { LOG_LOCKED(handle->common.lr, myLR); return (true); } return (false); } bool mutex_lock_recursive_with_timeout(PebbleRecursiveMutex * handle, uint32_t timeout_ms) { uintptr_t ...
=================================== // Client-side Implementation // --------------------------------------------------------------------------------------- // Create a new timer TaskTimerID task_timer_create(TaskTimerManager *manager) { TaskTimer *timer = kernel_malloc(sizeof(TaskTimer)); if (!timer) { return...
mutex_lock(manager->mutex)
; // Find this timer in our list TaskTimer* timer = prv_find_timer(manager, timer_id); PBL_ASSERTN(!timer->defer_delete); // Move it to the idle list if it's currently running if (timer->expire_time) { PBL_ASSERTN(list_contains(manager->running_timers, &timer->list_node)); list_remove(&timer->list_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...
(clock_cmd)
) PERIPH_CONFIG_LOG("Enabling clock %s", prv_string_for_cmd(clock_cmd)); #endif portENTER_CRITICAL(); clock_cmd(rcc_bit, ENABLE); portEXIT_CRITICAL(); } void periph_config_disable(void *periph, uint32_t rcc_bit) { ClockCmd clock_cmd = prv_get_clock_cmd((uintptr_t)periph); #if PERIPH_CONFIG_DEBUG if (prv_...
1200, 232, -344}, { 1320, 216, -328}, { 1248, 200, -176}, // 34 seconds { 944, 248, -232}, { 752, 360, -280}, { 648, 424, -296}, { 688, 392, -264}, { 800, 424, -312}, { 864, 456, -344}, { 920, 504, -368}, { 1016, 568, -448}, { 968, 528, -392}, { 1280, 504, -368}, ...
{ 1168, 48, -88}, { 1328, 168, -136}, { 1232, 208, -352}, { 1344, 192, -376}, { 1216, 208, -240}, { 928, 288, -352}, { 760, 352, -376}, { 664, 368, -320}, { 640, 392, -328}, { 736, 432, -384}, { 856, 432, -392}, { 944, 368, -328}, { 968, 432, -384}, { 920, 400, -3...
{ 840, 464, -296}, { 960, 504, -296}, { 904, 504, -320}, { 832, 536, -360}, { 840, 528, -360}, { 864, 480, -304}, { 1000, 480, -216}, { 1352, 600, -288}, { 1072, 640, -168}, { 1344, 664, -80}, { 1504, 696, 24}, { 1200, 440, 96}, { 1152, 376, 48}, { 1136, 360, 48}...
dict_uid = ((GetNotificationAttributesMsg*)s_unknown_app_dict)->notification_uid; const uint32_t unknown_app_unique_title_dict_uid = ((GetNotificationAttributesMsg*)s_unknown_app_unique_title_dict)->notification_uid; const uint32_t mms_no_caption_dict_uid = ((GetNotificationAttributesMsg*)s_mms_no_caption_dict)->no...
(s_unknown_app_dict)
, (uint8_t *)s_unknown_app_dict); s_num_ds_notifications_received++; } else if (uid == unknown_app_unique_title_dict_uid) { prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_unknown_app_unique_title_dict), (uint8_t *)s_unknown_app_unique_title_dict); s_num_ds_notifications_received++; } else if (uid == ...
{ 1144, 592, -216}, { 1248, 488, -200}, { 1056, 320, -168}, { 896, 272, -168}, { 920, 288, -192}, { 1120, 232, -192}, { 1160, 176, -144}, { 1040, 128, -144}, { 1032, 176, -208}, { 896, 88, -184}, { 544, -96, -168}, { 864, -80, -104}, { 872, 16, -352}, { 1368, 200, ...
{ 1064, 184, -184}, { 680, -112, -256}, { 568, -40, -128}, { 664, 8, -464}, { 904, 168, -408}, { 1352, 240, -504}, { 1160, 224, -344}, { 968, 344, -272}, { 928, 352, -208}, { 1024, 520, -168}, { 1200, 536, -144}, { 1168, 704, -160}, // 28 seconds { 1024, 808, -256...
{ 1120, 880, -584}, { 848, 616, -440}, { 1024, 600, -392}, { 1296, 512, -312}, { 1272, 248, -168}, { 1080, 248, -184}, { 1056, 184, -184}, { 1136, 224, -136}, { 1360, 232, -120}, { 1416, 168, -112}, { 1248, 152, -208}, { 1144, 48, -232}, { 704, -176, -192}, { 784...
q", 2); } void test_shared_circular_buffer__subsampling_1of3(void) { SharedCircularBuffer buffer; uint16_t item_size = 2; uint8_t storage[12*item_size]; uint8_t out_buffer[12*item_size]; uint16_t items_read; // Init shared_circular_buffer_init(&buffer, storage, sizeof(storage)); SubsampledSharedCircu...
shared_circular_buffer_read_subsampled( &buffer, &client, item_size, out_buffer, 1)
, 1); cl_assert_equal_m(out_buffer, "6g", 2); }
code size savings. static NOINLINE void prv_enable_display_access(void) { prv_enable_display_spi_clock(); prv_enable_chip_select(); } static NOINLINE void prv_disable_display_access(void) { prv_disable_chip_select(); prv_disable_display_spi_clock(); } //! Write a single byte synchronously to the display. This...
(DISP_SPI, ENABLE)
; // +5V to 5V_EN pin GPIO_WriteBit(PWR_CTL_GPIO, PWR_CTL_PIN, Bit_RESET); // +5V to LCD pin (Set this pin low to turn off the display) GPIO_WriteBit(DISP_GPIO, DISP_PIN_LCD, Bit_SET); prv_setup_pulse_vcom(); // Don't need the GPIO peripheral clocks to be enabled anymore gpio_release(PWR_CTL_GPIO); ...
ubscribe); cl_assert_equal_i(event.bluetooth.le.gatt_client.subscription_type, subscription_type); cl_assert_equal_i(event.bluetooth.le.gatt_client.object_ref, characteristic); cl_assert_equal_i(event.bluetooth.le.gatt_client.gatt_error, error); PebbleTaskBitset task_mask = ~0; if (kernel) { task_mask &= ...
cl_assert_equal_i(num_copied, 1)
; // UUID for indicatable Pressure Measurement characteristic: Uuid characteristic_uuid = bt_uuid_expand_16bit(0x2a35); BLECharacteristic characteristic; num_copied = gatt_client_service_get_characteristics_matching_uuids(service, &characteristic, ...
00); // x, y, width, height to_r = GRect(1000, 2000, 100, 200); // x, y, width, height prop_h = property_animation_create_layer_frame(&layer, &from_r, &to_r); Animation *h = property_animation_get_animation(prop_h); void *context = &layer; animation_set_handlers(h, handlers, context); animation_set_dura...
prv_clear_handler_histories()
; animation_schedule(h); int max_loops = 20; uint64_t start_ms = prv_now_ms(); bool detected_reset_of_elapsed = false; bool reached_end_elapsed = false; uint64_t time_ms; while (s_stopped_handler_calls.num_calls < 2) { prv_fire_animation_timer(); time_ms = prv_now_ms(); DPRINTF("rescheduled...
void default_registers_restore(void) { DCDC->DCDC_CTRL_0_REG = 0x2f24; DCDC->DCDC_CTRL_1_REG = 0x5410; DCDC->DCDC_CTRL_2_REG = 0x882d; DCDC->DCDC_V14_0_REG = 0xa1a4; DCDC->DCDC_V14_1_REG = 0xd890; DCDC->DCDC_V18_0_REG = 0xe3e4; DCDC->DCDC_V18_1_REG = 0xbc90; DCDC->DCDC_VDD_0_REG = 0xc304; DCDC->DCDC_V...
(DCDC, DCDC_VDD_1_REG, DCDC_VDD_ENABLE_LV, 0x1)
; REG_SETF(DCDC, DCDC_VDD_1_REG, DCDC_VDD_CUR_LIM_MAX_LV, 0xB); REG_SETF(DCDC, DCDC_VDD_1_REG, DCDC_VDD_IDLE_HYST, 0x4); REG_SETF(DCDC, DCDC_VDD_1_REG, DCDC_VDD_IDLE_MIN, 0x10); REG_SETF(DCDC, DCDC_V18P_0_REG, DCDC_V18P_FAST_RAMPING, 0x1); REG_SETF(DCDC, DCDC_V18P_0_REG, DCDC_V18P_VOLTAGE, 0x18); REG_SETF(...
TEXT_COLOR, container); active_window->workout_controller->metric_to_string(metric_type, (char *) number_text_node->text, buffer_size, i18n_owner, ...
if (strlen(number_text_node->text) > 5) { // text is long so use smaller font number_text_node->font = prv_get_number_font(false); }
e_layout_init_info(TimelineLayoutInfo *info, TimelineItem *item, time_t current_day) { *info = (TimelineLayoutInfo) { .timestamp = item->header.timestamp, .duration_s = item->header.duration * SECONDS_PER_MINUTE, .current_day = current_day, .all_day = item->header.all_day, }; info->end_time = inf...
kino_layer_deinit(&layout->icon_layer)