prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
ession; } // ------------------------------------------------------------------------------------- // We use NOINLINE to reduce the stack requirements during the minute handler (see PBL-38130) static void NOINLINE prv_set_dls_minute_record_entry(AlgMinuteDLSRecord *dls_record, ...
(file_record, &cbuf_record->data, i, cbuf_record->utc_sec, was_sleeping)
; // Handle writing the record out to data logging } else { prv_set_dls_minute_record_entry(dls_record, &cbuf_record->data, i, cbuf_record->utc_sec, was_sleeping); } } return true; } // --------------------------------------------------------------------...
ption_menu_default_cell_height(option_menu->content_type, is_selected); } } static int32_t prv_draw_selection_icon(const OptionMenu *option_menu, GContext *ctx, const GRect *cell_layer_bounds, bool is_chosen) { const int32_t left_icon_spacing = PBL_IF_RECT_ELSE(0, 14); cons...
menu_layer_get_layer(&option_menu->menu_layer)
); } static void prv_window_unload(Window *window) { OptionMenu *option_menu = window_get_user_data(window); if (option_menu->callbacks.unload) { option_menu->callbacks.unload(option_menu, option_menu->context); } } void option_menu_set_status_colors(OptionMenu *option_menu, GColor background, GColor foregr...
_image_draw(&ctx, l, GPoint(0, 48)); l = weather_app_resource_create_sun(); gdraw_command_image_attract_to_square(l, t += dt); gdraw_command_image_draw(&ctx, l, GPoint(48, 48)); l = weather_app_resource_create_sun(); gdraw_command_image_attract_to_square(l, t += dt); gdraw_command_image_draw(&ctx, l, GPoi...
GPoint(0, 48)
); l = weather_app_resource_create_sun(); gdraw_command_image_scale_segmented_to(l, from, to, t += dt, interp, index_lookup, f, false); gdraw_command_image_draw(&ctx, l, GPoint(0, 96)); l = weather_app_resource_create_sun(); gdraw_command_image_scale_segmented_to(l, from, to, t += dt, interp, index_lookup, ...
void timeline_layout_transition_pin_to_card(TimelineLayout *pin_timeline_layout, TimelineLayout *card_timeline_layout) { KinoReel *from_reel = kino_reel_create_with_resource_system( pin_timeline_layout->icon_res_info.res_app_num, pin_timeline_layout->icon_res_in...
if (prev_reel) { GRect frame = ((Layer *)&layout->icon_layer)->frame; GRect global_frame; layer_get_global_frame((Layer *)&layout->icon_layer, &global_frame); GRect icon_to = kino_reel_transform_get_to_frame(prev_reel); frame.origin = gpoint_add(frame.origin, gpoint_sub(icon_to.origin, global_frame....
KinoReel *new_reel = kino_reel_create_with_resource_system(layout->icon_res_info.res_app_num, layout->icon_res_info.res_id); prv_change_reel(layout, new_reel); if (!layout->is_being_destroyed) { // PBL-20111: Continue where we left off until kino ...
12, 448, 16}, { 1320, 440, 0}, // 97 seconds { 1424, 400, 16}, { 1392, 304, 88}, { 1328, 224, 120}, { 1296, 208, 56}, { 1216, 200, 56}, { 976, 208, 48}, { 832, 184, 24}, { 1000, 224, 0}, { 1048, 240, -88}, { 904, 192, -24}, { 1168, 152, -40}, { 1096, 152, 48}, ...
{ 1696, 448, 120}, { 1328, 608, 208}, { 1320, 936, 56}, { 976, 1416, 120}, { 864, 912, -200}, { 688, 552, -120}, { 912, 624, -8}, { 1392, 560, 96}, { 1432, 392, 72}, { 1400, 328, 16}, { 1528, 304, 40}, { 1608, 344, 64}, // 103 seconds { 1544, 320, 88}, { 1312,...
{ 64, -120, -848}, { 32, -128, -776}, { 32, -184, -800}, { 16, -200, -792}, { 0, -224, -736}, { -8, -368, -608}, { 88, -416, -480}, { 280, -472, -384}, { 720, -352, -80}, { 1368, 232, 384}, { 2408, 952, 712}, { 2552, 1536, 424}, { 2040, 1336, -112}, { 1344, 544, ...
01, 0x00, 0x69, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x20, 0x4d, 0x61, 0x72, 0x74, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xf9, 0x92, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x75, 0x36, 0x9c, 0x6e, 0x1a, 0x1b, 0xeb, 0x5f, 0xfb, 0x89, 0xdb, 0x0b, 0xec, 0xa5, 0x95, 0x7a, 0x44, 0xf6, 0x1c, 0x47...
cl_assert_equal_i(data_len, data_size)
; cl_assert_equal_m(expected_raw_data, data, sizeof(expected_raw_data)); } void test_bluetooth_persistent_storage__v1_bt_classic(void) { #if UNITTEST_BT_PERSISTENT_STORAGE_VERSION != 1 // We only care about BT Classic in v1. return; #endif BTDeviceAddress address = { .octets = {0x5, 0x1b, 0x85, 0xe3, 0xb8...
used within the settings // app. static void prv_init_status_bar(StatusBarLayer *status_layer, Window *window, const char *text) { status_bar_layer_init(status_layer); status_bar_layer_set_title(status_layer, text, false, false); status_bar_layer_set_separator_mode(status_layer, OPTION_MENU_STATUS_SEPARATOR_MODE)...
{ window_single_click_subscribe(BUTTON_ID_UP, prv_coredump_confirm_cb); window_single_click_subscribe(BUTTON_ID_DOWN, prv_confirm_pop); window_single_click_subscribe(BUTTON_ID_BACK, prv_confirm_pop); }
static void prv_coredump_reset_confirm_cb(ClickRecognizerRef recognizer, void *context) { ExpandableDialog *s_dialog = expandable_dialog_create("Core Dump Reset"); Dialog *dialog = expandable_dialog_get_dialog(s_dialog); dialog_set_text(dialog, i18n_get("The core dump was created successfully. " "Please ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(APP_LOG_LEVEL_INFO, "got phone connection update")
if the connection ends up being unused. PBL_LOG(LOG_LEVEL_INFO, "No intent for connection"); bluetooth_analytics_handle_no_intent_for_connection(); } #if RECOVERY_FW // In PRF, stick to shortest connection interval indefinitely: conn_mgr_set_ble_conn_response_time(connection, BtConsu...
(intent, connection)
) { fp(intent, data); } intent = next; } } // ------------------------------------------------------------------------------------------------- //! Helper for prv_handle_encryption_change static void prv_send_clients_encrypted_event(GAPLEConnectionIntent *intent, void *unused_data) { prv_update_clie...
on *animation_h, const AnimationImplementation *implementation) { AnimationPrivate *animation = (AnimationPrivate *)animation_h; if (!animation) { return false; } animation->implementation = implementation; return true; } bool animation_is_scheduled(Animation *animation_...
while (iter) { ListNode *current = iter; iter = iter->next; free(current); }
s_animations = NULL; } void fake_animation_complete(Animation *animation) { animation_schedule(animation); const uint32_t duration = animation_get_duration(animation, false /* delay */, true /* play_count */); animation_set_elapsed(animation, duration); animation_unschedule(animation); }
thServiceCache *cache = NULL; unsigned num_minutes_per_call = ARRAY_LENGTH(cache->minute_data); s_sys_activity_get_minute_history_values = (sys_activity_get_minute_history_values) { .out[0] = { .num_records = num_minutes_per_call, .result = true, .utc_start = time_start, }, .out[1] = {...
{ s_sys_activity_get_metric_values.out.history[0] = i; PebbleEvent event = { .type = PEBBLE_HEALTH_SERVICE_EVENT, .health_event.type = HealthEventHeartRateUpdate, }; prv_health_event_handler(&event, NULL); }
// One alert on the way down cl_assert_equal_i(s_metric_alert_count, 2); // Remove the alert s_metric_alert_count = 0; health_service_cancel_metric_alert(alert); for (int i = 60; i < 70; i++) { s_sys_activity_get_metric_values.out.history[0] = i; prv_health_event_handler(&event, NULL); } // S...
timeline_layer_create_bounce_back_animation(&data->timeline_layer, GPoint(1, 0)); data->current_animation = layer_bounce; animation_schedule(layer_bounce); } ///////////////////////////////////// // Public API ////////////////////////////////...
if (!timeline_model_iter_next(NULL, NULL)) { // for some reason we can't find the pin we were asked to launch into char uuid_buffer[UUID_STRING_BUFFER_LENGTH]; uuid_to_string(&args->pin_id, uuid_buffer); PBL_LOG(LOG_LEVEL_ERROR, "Asked to launch into pin but can't find it %s", uuid_buffe...
} } Window *window = &data->timeline_window; window_init(window, WINDOW_NAME("Timeline")); window_set_user_data(window, data); window_set_window_handlers(window, &(WindowHandlers) { .load = prv_timeline_window_load, .appear = prv_timeline_window_appear, .disappear = prv_timeline_window_disap...
ognizer, &s_dummy_impl); prv_store_recognizer_idx(recognizer, &s_recognizers_handled); if ((s_idx_to_change >= 0) && (*idx == s_idx_to_change)) { recognizer_transition_state(recognizer, s_next_state); s_idx_to_change = -1; s_next_state = RecognizerStateCount; } } static void prv_reset_test(Recognizer...
((int[]) {4, 0, 3}, 3, &s_recognizers_handled)
; cl_assert_equal_p(manager.active_layer, &layer_c); cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersTriggered); cl_assert_equal_i(recognizers[0]->state, RecognizerState_Failed); cl_assert_equal_i(recognizers[1]->state, RecognizerState_Failed); cl_assert_equal_i(recognizers[3]->state, Recog...
.num_actions = 0, .actions = NULL, }, .allocated_buffer = NULL, }, { .header = { // [3] .id = {0x6b, 0xf6, 0x21, 0x5b, 0xc9, 0x7f, 0x40, 0x9e, 0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb4}, .parent_id = {0}, .timestamp = 1421183642, // Tue Jan 13 13:14:0...
cl_assert_equal_i(timeline_model_get_num_items(), 2)
; cl_assert(uuid_equal(&s_items[s_correct_order[1]].header.id, &timeline_model_get_iter_state(-1)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[2]].header.id, &timeline_model_get_iter_state(0)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[3]].header.id, &timel...
ast_whole_items_read_bytes = -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.n...
PBL_LOG(LOG_LEVEL_ERROR, "Nuking storage for session %d", logging_session->comm.session_id)
/* * 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...
{ curved = animation_timing_curve(normalized, AnimationCurveEaseInOut); }
else if (normalized < ANIMATION_NORMALIZED_MAX / 2) { curved = animation_timing_curve(2 * normalized, AnimationCurveEaseInOut); } else { curved = animation_timing_curve(2 * (ANIMATION_NORMALIZED_MAX - normalized), AnimationCurveEaseInOut); } gdraw_command_list_attract...
e = *utc_start; for (num_records_returned = 0; num_records_returned < num_records_requested; num_records_returned++, record_start_time += SECONDS_PER_MINUTE) { if (record_start_time + SECONDS_PER_MINUTE > last_second_available) { // This record not available yet. break; } minute_data[n...
(configTICK_RATE_HZ * SECONDS_PER_DAY)
/* * 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...
(session, &kernel_nack_endpoint, header_bytes_remaining)
/* * 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 persist_service_lock_and_get_store( &sys_process_manager_get_current_process_md()->uuid); }
static void prv_unlock(SettingsFile **store) { persist_service_unlock_store(*store); } #define LOCK_AND_GET_STORE(name) \ SettingsFile *name __attribute__((cleanup(prv_unlock))) \ = prv_lock_and_get_store() DEFINE_SYSCALL(bool, persist_exists, const uint32_t key) { LOCK_AND_GET_STORE(store); return s...
16_t corner_radius, GCornerMask corner_mask) {} static MockCallRecordings s_layer_mark_dirty; void layer_mark_dirty(Layer *layer) { record_mock_call(s_layer_mark_dirty){ .layer = layer }; } static MockCallRecordings s_fonts_get_system_font; GFont s_fonts_get_system_font__...
cl_assert_equal_i(1, s_fonts_get_system_font.call_count)
; cl_assert_equal_i(0, s_graphics_text_attributes_destroy.call_count); s_rocky_text_state.text_attributes = (GTextAttributes *)123; rocky_global_deinit(); cl_assert_equal_i(1, s_fonts_get_system_font.call_count); cl_assert_equal_i(1, s_graphics_text_attributes_destroy.call_count); } void test_rocky_api_grap...
at & mask) == 0) { // skip option values that are irrelevant continue; } if (rocky_str_equal(option_values[i].field, option_values[i].value)) { result = option_values[i].format; found_options++; } if (found_options > 1) { // today, we don't support combinations of several o...
(format, is_24h_style)
; if (strip_leading_char) { memmove(buffer, buffer + 1, str_len); } return str_len; } static jerry_value_t prv_to_locale_time_or_date_string(jerry_value_t this_val, jerry_length_t argc, const jerry_v...
ot of not being able to support wake from standby on VUSB if (BOARD_CONFIG_POWER.wake_on_usb_power) { if (!otp_is_locked(OTP_HWVER)) { dbgserial_putstr("No HW Version in OTP"); // let's be optimistic return true; } const char* hw_ver = otp_get_slot(OTP_HWVER); #if defined(BOARD_BB2) ...
{ rtc_slow_down(); // Set wakeup events for the board // If the WKUP pin is high when we enable wakeup, an additional // wakeup event is registered (4.4.2 "PWR power control/status register"), // which will cause the board to wake up immediately after entering standby. Therefore we // wait until the button...
bool should_leave_standby_mode(void) { if (RTC_GetFlagStatus(RTC_FLAG_TSF)) { // we were woken by the USB power being plugged in dbgserial_putstr("USB wakeup"); return true; } // Make sure a button is held down before waking up for (int i = 0; i < 100000; ++i) { if (button_get_state_bits() ==...
/* * 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...
backlight_get_intensity()
awn, NULL); animation_set_play_count(seq, repeat_count); // Now, clone it Animation *clone = animation_clone(seq); // Destroy the original animation_destroy(seq); prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); animation_schedule(clone); // Start A prv_advance_to_ms_with_timer...
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a2), 1)
; cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a2), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a3), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a3), 1); // None of the b's should finish yet cl_assert_equal_i(prv_count_handl...
name_out, &platform_bits_out); cl_assert(ret); cl_assert_equal_m(&addr_1, &addr_out, sizeof(addr_out)); cl_assert_equal_m(&link_key_1, &link_key_out, sizeof(link_key_out)); cl_assert_equal_s(name_1, name_out); cl_assert_equal_i(platform_bits_1, platform_bits_ou...
bt_persistent_storage_store_bt_classic_pairing(&addr_in, &link_key_in, name_in, &platform_bits_in)
; cl_assert(id != BT_BONDING_ID_INVALID); // Read it back BTBondingID id_out = bt_persistent_storage_get_bt_classic_pairing_by_addr(&addr_in, &link_key_out, name_out, &platform_bits_out); cl_assert_equal_i(id, id_out); cl_assert_equal_m(&li...
, .identifier = id, .length = hton16(LCP_HEADER_LEN), }; pulse_link_send(request, LCP_HEADER_LEN); } static void prv_send_configure_ack(PPPControlProtocol *this, struct LCPPacket *triggering_packet) { if (ntoh16(triggering_packet->length) > pulse_link_max_send_size()) {...
(this->state->lock)
; } static bool prv_handle_configure_request(PPPControlProtocol *this, struct LCPPacket *packet) { if (ntoh16(packet->length) == LCP_HEADER_LEN) { // The request has no options prv_send_configure_ack(this, packet); return true; } else { // Packet has options bu...
(bytes_read, expected_bytes_incl_pebble_protocol_header)
; cl_assert_equal_i(comm_session_send_queue_get_length(s_valid_session), 0); prv_cleanup_send_buffer(write_sb); }
/* * 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...
access(path, W_OK)
out_iter, AppMessageKey_AccelData, (uint8_t *)d->data, d->num_samples * sizeof(d->data[0])); } PBL_LOG(LOG_LEVEL_DEBUG, "Sending message - bpm:%u quality:%u current:%u " "ppg_readings:%u accel_readings %"PRIu32, bpm, bpm_qualit...
text_layer_set_text(quality_tl, "Loading...")
; layer_add_child(&window->layer, &quality_tl->layer); const uint32_t inbox_size = 64; const uint32_t outbox_size = 256; AppMessageResult result = app_message_open(inbox_size, outbox_size); if (result != APP_MSG_OK) { PBL_LOG(LOG_LEVEL_ERROR, "Unable to open app message! %i %s", result, prv_t...
ef recognizer, void *context) { Dialog *dialog = context; dialog_set_text(dialog, "The text has changed!"); layer_mark_dirty(&dialog->text_layer.layer); } static void prv_custom_action_bar_config_provider(void *context) { window_single_click_subscribe(BUTTON_ID_UP, prv_custom_action_bar_click_up); } static vo...
(expandable_dialog)
init_worker_okay_while_not_in_fw_update_mode(void) { s_firmware_update_is_in_progress = false; prv_receive_init_cookie(VALID_OBJECT_SIZE, ObjectWatchWorker, EXPECTED_COOKIE); assert_ack_count(1); assert_nack_count(0); cl_assert_equal_i(EXPECTED_COOKIE, put_bytes_get_index()); } void test_put_bytes__init_nac...
fake_pb_storage_mem_assert_contents_written(chunk, sizeof(chunk))
ve_data(s_session, buffer, sizeof(buffer)); } static void prv_receive_put(uint32_t cookie, const uint8_t *payload, uint32_t payload_size) { uint8_t buffer[sizeof(PutRequest) + payload_size]; PutRequest *put_msg = (PutRequest *)buffer; *put_msg = (PutRequest) { .cmd = CmdPut, .cookie = htonl(cookie), ...
if (response_msg->response == ResponseNack) { ++s_nacks_received; }
} void test_put_bytes__initialize(void) { fake_pb_storage_mem_reset(); fake_pb_storage_mem_set_crc(EXPECTED_CRC); fake_comm_session_init(); fake_event_reset_count(); Transport *transport = fake_transport_create(TransportDestinationSystem, NULL, prv_system_msg_...
_alarm_cron); PBL_LOG(LOG_LEVEL_INFO, "Scheduling alarm %u to go off at %d:%d (%ld) (smart:%d)", alarm->id, alarm->config.hour, alarm->config.minute, s_next_alarm_time, alarm->config.is_smart); } // ---------------------------------------------------------------------------------------------- //!...
if (trigger) { prv_put_alarm_event(); // Alarm events are triggered for both the initial alarm time and subsequent user snoozes // Ensure that we only record the first alarm time if (!s_most_recent_alarm_recorded) { s_most_recent_alarm_recorded = true; // Read from flash since the in-memory ...
walk_line(ctx, line, text_box_params, (CharVisitorCallback) update_dimensions_char_visitor_cb)
; last_visited = (last_visited == NULL) ? (word->start) : last_visited; // Trim the word int suffix_width_px = prv_codepoint_get_horizontal_advance(&ctx->font_cache, text_box_params->font, HYPHEN_CODEPOINT); int truncated_word_length_px = (line->width_px - suffix_width_px); PBL_ASSERTN(word...
16_3_HALF.raw_value; cl_assert_equal_grect(GRect(-6, -6, 2, 2), grect_centered_internal(&p4, GSize(2, 2))); } #define cl_assert_fixedS16_3(v, f) \ cl_assert_equal_i((v).raw_value, (int)((f) * FIXED_S16_3_ONE.raw_value)) #define cl_assert_gpoint_precise(p, px, py) \ do { \ cl_assert_fixedS16_3(p.x, px); \ ...
{ s_center = center; s_radius = radius; }
void test_graphics_circle__draw_arc(void) { cl_assert_gpoint_precise(s_center, 0, 0); cl_assert_fixedS16_3(s_radius, 0); graphics_draw_arc(NULL, GRect(0, 0, 10, 12), GOvalScaleModeFitCircle, 0, 0); cl_assert_gpoint_precise(s_center, 4.5, 5.5); cl_assert_fixedS16_3(s_radius, 4.5); } void test_graphics_circ...
l_line_dotted(&ctx, GPoint(20, 0), MAX_NUM_ROWS - 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(22, 0), MAX_NUM_ROWS + 1 ); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_vert_dotted_line_even_offset_even_cols_no_clip"))); // Odd cols of different lengths setup_test_aa_sw(&c...
TEST_NAMED_PBI_FILE("draw_vert_dotted_line_odd_offset_even_cols_no_clip")
)); // Odd cols of different lengths setup_test_aa_sw(&ctx, fb, OFFSET_RECT_ODD, OFFSET_RECT_ODD, false, 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(1, 0), MAX_NUM_ROWS); graphics_draw_vertical_line_dotted(&ctx, GPoint(3, 0), MAX_NUM_ROWS + 4); graphics_draw_vertical_line_dotted(&ctx, GPoint(5, 0), 0...
_semaphore = xSemaphoreCreateBinary(); // Open up our settings file so that we can init our state SettingsFile *file = activity_private_settings_open(); if (!file) { return false; } // Perform migration now if necessary uint16_t written_version; file = prv_settings_migrate(file, &written_version);...
(s_activity_state.mutex)
; { s_activity_state.enabled_run_level = enable; } mutex_unlock_recursive(s_activity_state.mutex); prv_handle_activity_enabled_change(); } // ------------------------------------------------------------------------------------------------ bool activity_get_sessions(uint32_t *session_entries, ActivitySessi...
fs.get($2); obj[$1] = to_set; return __jerryRefs.ref(true); }, obj_val, index, value_to_set); } void jerry_init_property_descriptor_fields(jerry_property_descriptor_t *prop_desc_p) { *prop_desc_p = (jerry_property_descriptor_t) { .value = jerry_create_undefined(), .getter = jerry_create_undef...
{ return TYPE_ERROR_ARG; }
return (jerry_value_t)EM_ASM_INT({ var func_obj = __jerryRefs.get($0); var args = []; for (var i = 0; i < $2; ++i) { args.push(__jerryRefs.get(getValue($1 + i*4, 'i32'))); } // Call the constructor with new object as `this` var bindArgs = [null].concat(args);...
// After ending the write, expect num_failed to be incremented by one: app_inbox_service_end(AppInboxServiceTagUnitTest); cl_assert_equal_i(1, app_inbox_service_num_failed_for_tag(AppInboxServiceTagUnitTest)); cl_assert_equal_i(0, app_inbox_service_num_success_for_tag(AppInboxServiceTagUnitTest)); prv_proces...
cl_assert_equal_b(true, app_inbox_service_write(AppInboxServiceTagUnitTest, s_test_data + 1, BUFFER_SIZE - 1)); cl_assert_equal_b(true, app_inbox_service_end(AppInboxServiceTagUnitTest)); // One callback event scheduled: assert_num_callback_events(1); prv_pr...
void test_app_inbox__multiple_writes_consume_from_message_handler(void) { prv_create_test_inbox_and_begin_write(); // Message 1: cl_assert_equal_b(true, app_inbox_service_write(AppInboxServiceTagUnitTest, s_test_data, 1)); cl_assert_equal_b(true, app_inbox_service_end(AppInboxServiceTagUnitTest)); // Mes...
firm CRC. cmd->crc32 = crc32(CRC32_INIT, cmd, sizeof(CoreDumpSPICmd) - sizeof(cmd->crc32)); if (!prv_spi_send_and_receive_dma((uint8_t *)cmd, NULL, sizeof(CoreDumpSPICmd))) { return false; } if (length) { if (!prv_spi_send_and_receive_dma(NULL, buffer, length) || !prv_spi_send_and_receive_dma...
{ // TODO goto spi_failed; -- don't download the active controller SPI loop variables! }
flash_write_bytes(s_rx_buffer, flash_addr, rx_len); flash_addr += rx_len; curr_rx_offset += rx_len; rx_len_remaining -= rx_len; } } // Read the Thread Info chunk_hdr.key = CORE_DUMP_CHUNK_KEY_THREAD; chunk_hdr.size = sizeof(CoreDumpThreadInfo); if (flash_addr_max < (flash_addr ...
/* * 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->type, PEBBLE_APP_OUTBOX_SENT_EVENT)
; cl_assert(e->app_outbox_sent.sent_handler); e->app_outbox_sent.sent_handler(e->app_outbox_sent.status, e->app_outbox_sent.cb_ctx); ++s_num_app_outbox_events_sent; return true; } void app_message_outbox_handle_app_outbox_message_sent(AppOutboxStatus status, void *cb_ctx) { } ...
eck(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r0_aa_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); #endif setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 11); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 1); // TODO: Fix offset calculation and reenable this: - PBL-1...
MIN(RECT_WIDTH, RECT_HEIGHT)
) / 2)); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax1_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")); // Should not draw anything setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEI...
/* * 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 (rect->size.w < 0) { rect->origin.x += rect->size.w; rect->size.w = -rect->size.w; } if (rect->size.h < 0) { rect->origin.y += rect->size.h; rect->size.h = -rect->size.h; } }
void grect_clip(GRect *rect_to_clip, const GRect * const rect_clipper) { int16_t overflow; if (rect_to_clip->origin.x < rect_clipper->origin.x) { overflow = rect_clipper->origin.x - rect_to_clip->origin.x; if (overflow > rect_to_clip->size.w) { rect_to_clip->size.w = 0; } else { rect_to_cl...
ful way to handle this #ifndef RECOVERY_FW system_task_add_callback(dls_private_handle_disconnect, NULL); #endif } prv_put_comm_session_event(false, is_system); if (is_system && (session->destination == TransportDestinationHybrid)) { prv_put_comm_session_event(true, false); } // Cleanup: comm_ses...
if (!sb) { PBL_LOG(LOG_LEVEL_WARNING, "Could not acquire send buffer for %x", endpoint_id); return false; }
set.h" #include "kernel/util/sleep.h" #include "kernel/util/stop.h" #include "mfg/mfg_apps/mfg_flash_test.h" #include "process_management/app_manager.h" #include "process_management/worker_manager.h" #include "prompt.h" #include "resource/resource_storage_flash.h" #include "services/common/compositor/compositor.h" #inc...
if (address == -1) { prompt_send_response("Invalid address"); return; }
int length = atoi(length_str); if (length == 0) { prompt_send_response("Invalid length"); return; } // Allocate a 1KB buffer to read data in segments uint8_t *buffer = (uint8_t *) kernel_malloc(MIN(MAX_READ_FLASH_SIZE,length)); if (buffer == 0) { prompt_send_response("Unable to allocate read ...
{ 736, -40, -224}, { 1064, -32, -128}, { 1224, -32, -80}, { 1128, -16, -88}, { 1056, -40, -64}, { 872, 8, -80}, { 864, 16, -224}, { 904, -16, -152}, { 944, -48, -192}, { 1032, -88, -152}, { 992, -120, -152}, { 1040, -136, -144}, { 1032, -152, -128}, // 80 seconds...
// 85 seconds { 1064, 152, 96}, { 1080, 88, 104}, { 1112, 24, 72}, { 1120, 8, 24}, { 1040, -32, 56}, { 1384, -80, 128}, { 1504, -16, 72}, { 1176, 8, -56}, { 856, -48, -128}, { 824, -208, 48}, { 1200, -200, 136}, { 1312, -136, 120}, { 1112, -112, 24}, { 1000, -...
{ 1240, -160, -32}, { 1024, -144, -16}, { 968, -80, -56}, { 920, -40, -72}, { 896, -32, -48}, { 880, -8, -96}, { 840, 24, -128}, { 840, 48, -192}, // 88 seconds { 896, 48, -200}, { 944, 24, -176}, { 1008, 24, -168}, { 1064, 16, -168}, { 1144, 0, -160}, { 1336...
and_finish(); PBL_CROAK("You asked for this!"); } typedef void (*KaboomCallback)(void); void command_hardfault(void) { prompt_command_finish(); KaboomCallback kaboom = 0; kaboom(); } void command_boot_bit_set(const char* bit, const char* value) { int len = strlen(bit); int bit_number = 0; for (int i...
(0, strtol(presses, &end, 10))
), ", i, s_iso8601_data[i].stamp, wrk.tm_yday,wrk.tm_year,wrk.tm_mon,wrk.tm_mday); tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%V", &wrk); cl_assert_equal_s(tmbuf, s_iso8601_data[i].str_V); printf("%s, ", tmbuf); tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%g", &wrk); cl_assert_equ...
(tmbuf, "52")
; tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%U", &jan_2_2015__13_00_00); cl_assert_equal_s(tmbuf, "00"); tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%U", &jan_1_2016__13_00_00); cl_assert_equal_s(tmbuf, "00"); } // Test the zero flag void test_strftime__zeroflag(void) { char tmbuf[512]; ...
(BOARD_CONFIG_ACCEL.accel_ints[0], ExtiTrigger_Rising, lis3dh_IRQ1_handler)
; exti_configure_pin(BOARD_CONFIG_ACCEL.accel_ints[1], ExtiTrigger_Rising, lis3dh_IRQ2_handler); } static void disable_accel_interrupts(void) { for (unsigned int i = 0; i < ARRAY_LENGTH(BOARD_CONFIG_ACCEL.accel_ints); i++) { exti_disable(BOARD_CONFIG_ACCEL.accel_ints[i]); } } static void enable_accel_interr...
/* * 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...
(address_out)
; }
}, { 1152, 352, -280}, { 1184, 360, -296}, { 1272, 408, -312}, { 1048, 352, -320}, { 1008, 344, -272}, { 1216, 344, -216}, { 1176, 312, -136}, { 992, 280, -112}, { 800, 232, -144}, { 656, 176, -96}, { 608, 176, -88}, { 632, 184, -88}, { 736, 200, -72}, { 944, 176,...
{ 1224, 232, -216}, { 1064, 272, -256}, { 768, 240, -248}, { 528, 208, -216}, { 416, 216, -160}, { 448, 208, -160}, // 21 seconds { 592, 272, -152}, { 768, 280, -224}, { 968, 368, -248}, { 1064, 376, -312}, { 1056, 392, -304}, { 1152, 392, -312}, { 1144, 416, -280...
{ 936, 280, -232}, { 1112, 360, -304}, { 1088, 408, -272}, { 1224, 424, -256}, { 1256, 480, -248}, { 1072, 448, -208}, { 1184, 408, -200}, { 1224, 360, -152}, { 1104, 336, -96}, { 872, 216, -56}, { 696, 184, -128}, { 640, 176, -72}, { 720, 168, -72}, { 744, 160, ...
result = settings_file_get(file, key, info->key_len, val, info->val_len); cl_assert_equal_i(result, S_SUCCESS); int val_i = atoi((char*)val + 1); cl_assert_equal_i(key_i, val_i); return true; } void test_settings_file__each(void) { printf("\nTesting if we can use each...\n"); SettingsFile file; cl_mus...
settings_file_close(&file)
; cl_must_pass(settings_file_open(&file, "test_file_reallocate_larger", k_larger_size)); int new_fd_size = pfs_get_file_size(file.iter.fd); cl_assert(new_fd_size > orig_fd_size); verify(&file, key, key_len, val, val_len); } // Test that we can start searching beginning at the record we previously found in a r...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(DISP_GPIO, DISP_PIN_CRESET, Bit_SET)
; return prv_wait_programmed(); } static bool prv_reset_fpga(void) { #ifdef BLANK_FPGA return display_program(s_fpga_bitstream, sizeof(s_fpga_bitstream)); #endif const struct FlashBitstream *bitstream = (void *)FPGA_BITSTREAM_FLASH_ADDR; // Work around GCC bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3834...
event_service_client_unsubscribe(&s_app_data->blobdb_event_info)
; timeline_layer_deinit(&s_app_data->timeline_layer); timeline_model_deinit(); app_free(s_app_data); } static void prv_main(void) { prv_init(); app_event_loop(); prv_deinit(); } const PebbleProcessMd *timeline_get_app_info() { static const PebbleProcessMdSystem s_app_md = { .common = { .mai...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert(!s_times_callback_executed)
; // Fire the timer on "the timer task" stub_new_timer_fire(sys_timer_id); // We know have an event to run on "the app task" cl_assert_equal_i(s_last_event.type, PEBBLE_CALLBACK_EVENT); cl_assert(!s_times_callback_executed); // Run the code on "the app task" s_last_event.callback.callback(s_last_event....
/* * 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...
rtc_get_time()
; // Only perform an update if there is no timestamp or the current timestamp is more than a day old if (!last_updated || (last_updated && now > (last_updated->uint32 + SECONDS_PER_DAY))) { attribute_list_add_uint32(&new_attr_list, AttributeIdLastUpdated, now); list_dirty = true; PBL_LOG(LOG_LEVEL...
ta), NULL, NULL)); s_test_impl.handle_touch_event = NULL; cl_assert_passert(recognizer_create_with_data(&s_test_impl, &s_test_impl_data, sizeof(s_test_impl_data), dummy, NULL)); s_test_impl.handle_touch_event = dummy; ...
(r, RecognizerState_Cancelled)
); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Completed)); r->state = RecognizerState_Updated; recognizer_transition_state(r, RecognizerState_Cancelled); cl_assert_equal_i(event_type, RecognizerEvent_Cancelled); cl_assert_equal_i(r->state, RecognizerState_Cancelled); cl_assert(!s_mana...
? backlight_low_power_intensity : backlight_get_intensity(); } static void prv_change_brightness(int32_t new_brightness) { const uint16_t HALF_BRIGHTNESS = (prv_backlight_get_intensity() - BACKLIGHT_BRIGHTNESS_OFF) / 2; // update the debug stats if (new_brightness > HALF_BRIGHTNESS && s_current_brightness <= HA...
{ PBL_LOG(LOG_LEVEL_ERROR, "More buttons were released than have been pressed."); s_num_buttons_down = 0; }
if (s_num_buttons_down == 0 && s_light_state == LIGHT_STATE_ON && !s_user_controlled_state) { // no more buttons pressed: wait for a bit and then start the fade-out timer prv_change_state(LIGHT_STATE_ON_TIMED); } mutex_unlock(s_mutex); } void light_enable_interaction(void) { mutex_lock(s...
/* * 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...
(strlen(testbuf), 2)
; } void test_strlen__weird(void) { char testbuf[9] = "hi\0five"; cl_assert_equal_i(strlen(testbuf), 2); }
&file, "test_file_used_space_tracking", 4096)); uint8_t key[5]; int key_len = 4; uint8_t val[5]; int val_len = 4; // First, fill half the file up with random keys and values. This reduces // our usable space to slightly less than 2048 bytes. for (int i = 0; i < 128; i++) { snprintf((char *)key, sizeo...
set_and_verify(&file_original, key, key_len, new_value, new_value_length)
; printf("(never hit limit)\n"); return RecordResultEnd; } void test_settings_file__atomic(void) { printf("\nTesting if we really are atomic...\n"); bool have_hit_old_value = false; bool have_hit_new_value = false; bool have_hit_end = false; for (int i = 1; i < 50; i++) { printf("Iteration %3d... ",...
/* * 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...
{ case WordStateStart: if (codepoint == NEWLINE_CODEPOINT) { new_state = WordStateEnd; } else if (codepoint_is_ideograph(codepoint)) { new_state = WordStateIdeograph; } else { new_state = WordStateGrowing; } break; case WordStateIdeograph: if (codepoin...
w_text_single_line_wordwrap_clip_across_nx(Layer* me, GContext* ctx) { graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(-44, 4, 72, 32), GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL); } void draw_text_single_line_wordwrap_cl...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_ellipsis_clip_across_x.${BIT_DEPTH_NAME}.pbi")
); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_ellipsis_clip_outside_ny); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_ellipsis_clip_outside_ny.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb...
CS_DS_COUNT, AnalyticsClient_System); if (length < 1) { PBL_LOG(LOG_LEVEL_ERROR, "Received ANCS DS notification of length 0"); return; } analytics_add(ANALYTICS_DEVICE_METRIC_NOTIFICATION_BYTE_IN_COUNT, length, AnalyticsClient_System); if (s_ancs_client->state == ANCSClientStateRequestedApp) { pr...
pebble_task_get_current()
== PebbleTask_KernelMain); // Avoid heap allocation when directly calling prv_serialize_action: PerformNotificationActionMsg action_msg; PerformNotificationActionMsg *action_msg_ptr = is_kernel_main ? &action_msg : kernel_malloc_check(sizeof(PerformNotificationActionMsg)); *action_msg_ptr = (const PerformNot...
t(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornerTopLeft); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_topleft.${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_D...
(GSize(0, 0), GCornerNone, 0)
, 0); cl_assert_equal_i(prv_clamp_corner_radius(GSize(0, 0), GCornerNone, 2), 0); cl_assert_equal_i(prv_clamp_corner_radius(GSize(0, 0), GCornersAll, 0), 0); cl_assert_equal_i(prv_clamp_corner_radius(GSize(0, 0), GCornersAll, 8), 0); cl_assert_equal_i(prv_clamp_corner_radius(GSize(0, 5), GCornersAll, 8), 0); ...
o do erases, it will take longer becauses this //! operation can take seconds to complete on certain flash parts //! //! @param file_size - The amount of file space to erase //! @param max_elapsed_ticks - The max amount of time to spend attempting to //! find / create the free space. If 0, then there is no timeout ...
prv_flash_write((uint8_t *)&pg_hdr.page_flags, sizeof(pg_hdr.page_flags), prv_page_to_flash_offset(curr_page) + offsetof(PageHeader, page_flags))
; if (pgs_needed > 0) { // do we need to find a free page if ((rv = find_free_page(&next_page, use_gc_allocator, true)) != S_SUCCESS) { unlink_flash_file(start_page); // on failure, unallocate return (rv); } pg_hdr.next_page_crc = crc8_next_page(next_page); pg_hdr.next_page ...
test_num = (int32_t)((float)-0.375 * (1 << FIXED_S16_3_PRECISION)); num = (Fixed_S16_3){ .raw_value = test_num }; cl_assert(num.integer == -1); cl_assert(num.fraction == 5); test_num = (int32_t)((float)-0.250 * (1 << FIXED_S16_3_PRECISION)); num = (Fixed_S16_3){ .raw_value = test_num }; cl_assert(num.in...
(Fixed_S16_3(8))
); cl_assert_equal_i(2, Fixed_S16_3_rounded_int(Fixed_S16_3(12))); cl_assert_equal_i(0, Fixed_S16_3_rounded_int(Fixed_S16_3(-3))); cl_assert_equal_i(-1, Fixed_S16_3_rounded_int(Fixed_S16_3(-4))); cl_assert_equal_i(-1, Fixed_S16_3_rounded_int(Fixed_S16_3(-5))); cl_assert_equal_i(-1, Fixed_S16_3_rounded_int(Fix...
ervices]; uint8_t num_found_services = gatt_client_copy_service_refs(&device, service_refs, num_services); cl_assert_equal_i(num_found_services, num_services); for (uint8_t s = 0; s < num_found_services; ++s) { BLEService service_ref = service_refs[s]; const Service *expected_service = services[s]; ...
prv_connected_dummy_device(1)
; // Start discovery: cl_assert_equal_i(gatt_client_discovery_discover_all(&device), BTErrnoOK); prv_mock_put_service_discovery_events(); const uint8_t num_services = 1; // Test gatt_client_copy_service_refs(): BLEService service_refs[num_services]; const Service *bp_service = fake_gatt_get_blood_press...
ndow_stack->removed_list_head); } WindowTransitioningContext *context = &window_stack->transition_context; for (unsigned int i = 0; i < num_items; ++i) { // The update routine for the transition_to animation relies on the // window_to being present. If we are unloading the window we should really //...
PBL_ASSERTN(window_stack_to)
; WindowStack *window_stack_from = window->parent_window_stack; Window *window_from = window_manager_get_top_window(); // Assign the new stack for the window window->parent_window_stack = window_stack_to; if (!window_from) { // We do not animate the first window, but instead let the compositor animate. ...
{ c = 'a' + (digit - 0xa); }
else { c = ' '; } *buffer++ = c; } *buffer = '\0'; } static int8_t ascii_hex_to_int(const uint8_t c) { if (isdigit(c)) return c - '0'; if (isupper(c)) return (c - 'A') + 10; if (islower(c)) return (c - 'a') + 10; return -1; } static uint8_t ascii_hex_to_uint(const uint8_t msb, const uint8...
system_cb, NULL); } unlock: mutex_unlock_recursive(s_manager_state.lock); } void hrm_manager_handle_prefs_changed(void) { system_task_add_callback(prv_update_hrm_enable_system_cb, NULL); } void hrm_manager_init(void) { s_hrm_present = mfg_info_is_hrm_present(); s_manager_state = (struct HRMManagerState) { ...
mutex_lock_recursive(s_manager_state.lock)
; HRMSessionRef ref = HRM_INVALID_SESSION_REF; HRMSubscriberState *state = prv_get_subscriber_state_from_app_id(pebble_task_get_current(), app_id); if (state) { ref = state->session_ref; } mutex_unlock_recursive(s_manager_state.lock); re...
tion may be called from an ISR prv_lock(); PBL_ASSERTN(s_input_enabled); s_input_enabled = false; s_send_history.has_data = false; s_bus_contention_detected = false; prv_unlock(); } void accessory_enable_input(void) { // NOTE: This function may be called from an ISR if (s_input_enabled) { return; ...
s_stream_cb(s_stream_context)
) { // the callback MUST send a byte in order for this interrupt to trigger again PBL_ASSERTN(s_did_send_byte); } else { // we're done sending portBASE_TYPE was_higher_task_woken = pdFALSE; xSemaphoreGiveFromISR(s_send_semaphore, &was_higher_task_woken); should_context_switch = (...
/////////////////////////////////////////// // Spinner Logic static void prv_pop_spinner(void *not_used) { if (s_fu_app_data && s_fu_app_data->spinner_should_close) { app_window_stack_pop(false /* animated */); s_fu_app_data->spinner_is_visible = false; s_fu_app_data->spinner_should_close = false; } } ...
("Couldn't create kino reel")
; } // Position the icon kino_area = GRect(icon_x_offset, icon_y_offset, data->launch_app_window.layer.bounds.size.w, data->launch_app_window.layer.bounds.size.h); layer_set_frame((Layer *) &data->kino_layer, &kino_area); kino_layer_set_alignment(&data->kino_layer, GAlignTopLeft); windo...
x5b, 0xc9, 0x7f, 0x40, 0x9e, 0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0x01}, .timestamp = 1, .duration = 0, .type = TimelineItemTypePin, .layout = LayoutIdTest, // don't care about the rest } }; static TimelineItem item2 = { .header = { .id = {0x55, 0xcb, 0x7c, 0x75, 0x8a, 0x3...
cl_must_pass(pin_db_read_item_header(&item, &item1.header.id))
; cl_assert_equal_i(item.header.status, 0); cl_must_pass(pin_db_set_status_bits(&item1.header.id, TimelineItemStatusDismissed)); cl_must_pass(pin_db_read_item_header(&item, &item1.header.id)); cl_assert_equal_i(item.header.status, TimelineItemStatusDismissed); }
ed" reason: prv_assert_event(&device, BTErrnoServiceDiscoveryDisconnected); } void test_gatt_client_discovery__complete_error(void) { BTDeviceInternal device = prv_connected_dummy_device(1); // Start discovery: cl_assert_equal_i(gatt_client_discovery_discover_all(&device), BTErrnoOK); // Simulate getting on...
(&device, BTErrnoServiceDiscoveryDisconnected)
ntPrecise center, Fixed_S16_3 radius, int32_t angle_start, int32_t angle_end) {} void graphics_draw_rect_precise(GContext *ctx, const GRectPrecise *rect) {} void graphics_fill_radial_precise_internal(GContext *ctx, GPointPrecise center, ...
prv_deinit()
; } prv_init(); } static char *prv_load_js(char *suffix) { char path[512] = {0}; snprintf(path, sizeof(path), "%s/js/tictoc~rect~%s.js", CLAR_FIXTURE_PATH, suffix); FILE *f = fopen(path, "r"); cl_assert(f); fseek(f, 0, SEEK_END); size_t length = (size_t)ftell(f); fseek (f, 0, SEEK_SET); char *buff...
(state->steps_per_minute >= ACTIVITY_ACTIVE_MINUTE_MIN_STEPS) { state->step_data.step_minutes++; ACTIVITY_LOG_DEBUG("new step minutes: %"PRIu16"", state->step_data.step_minutes); // The prior minute was the most recent active one state->last_active_minute = time_util_minute_of_day_adjust(minut...
(hr_median)
; if (new_hr_zone != HRZone_Zone0 && state->hr.num_samples < ACTIVITY_MIN_NUM_SAMPLES_FOR_HR_ZONE) { // There wasn't enough data in the past minute to give us confidence that // the new HR zone will represents that minute, default to Zone0 new_hr_zone = HRZone_Zone0; } bool new_hr_elevated = hr_util...
idth; } /////////////////////////////////////////////////////////// // Drawing functions /////////////////////////////////////////////////////////// static int prv_get_scroll_delta(TimelineLayer *timeline_layer) { return (timeline_layer->scroll_direction == TimelineScrollDirectionUp ? -1 : 1); } static int prv_get...
prv_get_style()
; *frame = (GRect) { .origin = gpoint_add(bounds->origin, style->day_sep_offset), .size.w = bounds->size.w - style->sidebar_width, .size.h = bounds->size.h, }; } static void prv_create_layout(TimelineLayer *layer, TimelineIterState *state, int index) { TimelineItem *item = &state->pin; TimelineLayo...
/* * 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...
(round(-0.5), -1.0)
; cl_assert_equal_d(round(-1.0), -1.0); cl_assert_equal_d(round(1.7976931348623157e+308), 1.7976931348623157e+308); cl_assert_equal_d(round(2.2250738585072014e-308), -0.0); }
ations under the License. */ #include "movable_line.h" #include "applib/app.h" #include "applib/graphics/graphics.h" #include "applib/graphics/gtypes.h" #include "applib/graphics/text.h" #include "applib/ui/app_window_stack.h" #include "applib/ui/text_layer.h" #include "applib/ui/window.h" #include "kernel/pbl_mallo...
window_get_user_data(s_window)
; GRect bounds = layer->bounds; // Fill background graphics_context_set_fill_color(ctx, GColorBlack); graphics_fill_rect(ctx, &bounds); // Draw UI draw_ui_element(ctx, GRect(30, 80, 20, 20), "R", data->hue == HUE_RED, data->selection == ATTRIBUTE_HUE); draw_ui_element(ctx, GRect(50, 80...
void test_persist__cleanup(void) { persist_service_client_close(&test_uuid_a); } void test_persist__int(void) { const uint32_t key = 0; const uint32_t value = ~0; cl_assert_equal_i(persist_read_int(key), 0); cl_assert_equal_i(persist_write_int(key, value), sizeof(int)); cl_assert_equal_i(persist_get_size...
persist_read_int(key)
levels_layer->frame.origin.x + levels_layer->bounds.origin.x; ctx->draw_state.drawing_box.origin.y += levels_layer->frame.origin.y + levels_layer->bounds.origin.y; ctx->draw_state.drawing_box.size = levels_layer->bounds.size; } if (!grect_is_empty(&ctx->draw_state.clip_box)) { ...
{ return layer->window; }
return NULL; } void layer_remove_from_parent(Layer *child) { if (!child || child->parent == NULL) { return; } if (child->parent->window) { window_schedule_render(child->parent->window); } Layer *node = child->parent->first_child; if (node == child) { child->parent->first_child = node->next_s...
uint32_t now, bool do_update) { bool blocked_on_children_complete = false; // Play count of 0 should have never been scheduled. PBL_ASSERTN(animation->play_count != 0); // If this is the animation's first frame, call the 'started' handler: if (animation->handlers.started && !animation->started) { anima...
list_contains(state->scheduled_head, &animation->list_node)
); #endif const int32_t rel_ms_running = serial_distance32(animation->abs_start_time_ms, now); if (rel_ms_running < 0) { // Animations are ordered by abs_start_time_ms. // We've reached an animation that should not start yet, so // everything after and including this animation sho...
applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "appli...
settings_file_open(file, ALG_MINUTE_DATA_FILE_NAME, ALG_MINUTE_DATA_FILE_LEN)
!= S_SUCCESS) { PBL_LOG(LOG_LEVEL_ERROR, "No minute data file"); return NULL; } return file; } // ------------------------------------------------------------------------------------------------ // Close the settings file and free the file struct static void prv_minute_data_file_close(SettingsFile *file)...
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 the specific language governing permission...
prv_modal_transition_fill_update(ctx, distance_normalized, false /* fill outer */)
; } else { // For the second half of the animation where the app is the destination, draw the "expand to // app" frame and fill its inner ring with the app's frame buffer // Switch to the "expand to app" animation if necessary if (!s_data.expanding) { prv_modal_transition_animation_init_sequence...
ssage_buffer, ((char*) buf) + LOG_METADATA_LENGTH, message_length); s_log_message_buffer[message_length] = '\0'; } bool pulse_is_started(void) { return true; } void rtc_get_time_ms(time_t* out_seconds, uint16_t* out_ms) { *out_seconds = 0; *out_ms = 0; } void vPortEnterCritical(void) { } void vPortExitCrit...
pulse_logging_log(LOG_LEVEL_DEBUG, "", 0, "TestTestTestTestTestTestTestTestTestTestA")
; cl_assert_equal_i(s_num_event_puts, 1); cl_assert_equal_i(s_num_packets_sent, 0); pulse_logging_log(LOG_LEVEL_DEBUG, "", 0, "TestTestTestTestTestTestTestTestTestTestB"); cl_assert_equal_i(s_num_event_puts, 1); cl_assert_equal_i(s_num_packets_sent, 0); pulse_logging_log(LOG_LEVEL_DEBUG, "", 0, "TestTestT...
vent lock inversion with crc lock mutex_lock_recursive(s_pfs_mutex); // go to offset pfs_seek(fd, offset, FSeekSet); const unsigned int chunk_size = 128; uint8_t buffer[chunk_size]; while (num_bytes > chunk_size) { pfs_read(fd, buffer, chunk_size); legacy_defective_checksum_update(&checksum, buffe...
atoi(num_chars)
; pfs_debug_dump(fd, num_bytes); pfs_close(fd); } void pfs_command_crc(const char *filename) { int fd = pfs_open(filename, OP_FLAG_READ, 0, 0); char buffer[32]; if (fd < 0) { prompt_send_response_fmt(buffer, sizeof(buffer), "fd open err: %d", fd); return; } size_t num_bytes = pfs_get_file_size(fd...
us_idx = idx; } if (prv_has_opaque_window(context) && (iter.first_opaque_idx == ModalPriorityInvalid)) { iter.first_opaque_idx = idx; } } if (iter.first_visible_idx != ModalPriorityInvalid) { for (ModalPriority idx = ModalPriorityMin; idx < NumModalPriorities; idx++) { ModalContext *moda...
(prv_render_modal_stack_callback, ctx)
; } typedef struct VisibleContext { Window *window; bool visible; } VisibleContext; static bool prv_is_window_visible_callback(ModalContext *modal, IterContext *iter, void *data) { if (iter->current_idx < iter->first_opaque_idx) { return true; } VisibleContext *ctx = data; ctx->visible = (ctx->window...
k_data.install_type == APP_DB_CLEARED) && (app_install_id_from_app_db(cur_app_id)))) { PBL_LOG(LOG_LEVEL_DEBUG, "close and delay callbacks for app closing"); s_install_callback_data.callback_paused_for_app = true; s_pending_app_deletion = cur_app_id; app_manager_close_curre...
{ return worker_manager_get_task_context()->install_id == id; }
void app_install_notify_app_closed(void) { PBL_ASSERT_TASK(PebbleTask_KernelMain); // If we've previously paused doing app callbacks to wait for the app to close, resume them // now if the worker is also done if (s_install_callback_data.callback_paused_for_app) { if (!s_install_callback_data.callback_paus...
{ 888, 0, 152}, { 752, -8, 120}, { 648, -40, 104}, { 560, -72, 40}, { 608, -32, -48}, { 912, 40, -152}, { 1552, -216, 136}, { 1808, -48, 328}, // 110 seconds { 1632, 424, -24}, { 1576, 504, -216}, { 1312, 384, 192}, { 1080, 360, 256}, { 1048, 216, 312}, { 960...
{ // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_200_pbl_25532_11 //> TEST_EXPECTED 200 //> TEST_EXPECTED_MIN 165 //> TEST_EXPECTED_MAX 230 //> TEST_WEIGHT 1.0 static AccelRawData samples[] = { // 0 seconds // elapsed: 0 minutes { -528, 32, -776}, { ...
{ 608, 728, 320}, { 496, 496, 448}, { 760, 776, 400}, { 584, 776, 352}, { 600, 536, 328}, { 568, 416, 328}, { 792, 432, 264}, { 1040, 440, 256}, { 1272, 296, 368}, { 1296, 240, 416}, { 1080, 456, 240}, { 672, 496, 48}, { 720, 136, 216}, { 872, 8, 296}, { 840,...
language governing permissions and * limitations under the License. */ #include "applib/graphics/framebuffer.h" #include "applib/graphics/graphics.h" #include "applib/ui/time_range_selection_window.h" #include "applib/ui/time_selection_window.h" #include "applib/ui/app_window_stack.h" #include "apps/system_apps/sett...
GSize(bitmap_width, bitmap_height)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
graphics_context_set_stroke_color(ctx, GColorBlack)
; graphics_draw_pixel(ctx, GPoint(5, 15)); } void outside_ny_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_pixel(ctx, GPoint(5, -5)); } void outside_x_y_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ct...
shared PRF if (bt_persistent_storage_get_root_key(SMRootKeyTypeEncryption, &keys[SMRootKeyTypeEncryption]) && bt_persistent_storage_get_root_key(SMRootKeyTypeIdentity, &keys[SMRootKeyTypeIdentity])) { PBL_LOG(LOG_LEVEL_ERROR, "Storing Root Keys to PRF storage"); shared_prf_storage_set_root_keys(keys); ...
if (!bt_persistent_storage_get_active_gateway(&bonding, &type)) { return false; }
if (bonding == BT_BONDING_ID_INVALID || type != desired_type) { return false; } return true; } static void prv_update_active_gateway_if_needed(BTBondingID bonding, BtPersistBondingOp op) { // Invalidate the active gateway if it is getting deleted if (op == BtPersistBondingOpWillDelete) { BTBonding...
ten(SettingsRecordHeader *hdr) { return !flag_is_set(hdr, SETTINGS_FLAG_WRITE_COMPLETE); } static bool partially_overwritten(SettingsRecordHeader *hdr) { return flag_is_set(hdr, SETTINGS_FLAG_OVERWRITE_STARTED) && !flag_is_set(hdr, SETTINGS_FLAG_OVERWRITE_COMPLETE); } static bool overwritten(SettingsRecordHea...
(file, name, OP_FLAG_READ | OP_FLAG_WRITE, file->max_used_space)
; kernel_free(name); return status; } T_STATIC status_t settings_file_compact(SettingsFile *file) { return settings_file_rewrite_filtered(file, NULL, NULL); } static bool key_matches(SettingsRawIter *iter, const uint8_t *key, int key_len) { SettingsRecordHeader *hdr = &iter->hdr; if (key_len != hdr->key_len...
_passert.h" // Fakes /////////////////////////////////////////////////////////// static TimerID s_debounce_timer; static bool s_default_connection_state; static unsigned int s_event_count = 0; static PebbleEvent s_cached_event; static Transport *s_transport; static CommSession *s_session; bool remote_is_connected(v...
(s_event_count, 0)
nimation_update_int16, .accessors.setter.int16 = prv_curr_rel_bar_setter, .accessors.getter.int16 = prv_curr_rel_bar_getter, }; if (layer->relbar_layer.curr_rel_bar.rel_bar_type == RelationshipBarTypeOverlap) { curr_from_rel_bar_value = REL_BAR_CURR_OVERLAP_START_OFFSET; curr_to_rel_bar_value = prv...
(ctx, &line)
; // Top Notch for Bar 2 // Filled rect used to draw line of REL_BAR_LINE_WIDTH stroke width line2.origin.x = line.origin.x - REL_BAR_LINE_NOTCH_HORIZ_OFFSET + 1; line2.origin.y = line.origin.y; line2.size.w = REL_BAR_LINE_CHECK_LENGTH + REL_BAR_LINE_WIDTH; line2.size.h = REL_BAR_LINE_WIDTH; graphics_fil...
nt_handler_entries(&s_update_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, c), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, c), 0); // ------------------------------------------------------------------------------------- // Execute ab...
(prv_last_update_distance(b), ANIMATION_NORMALIZED_MAX)
; cl_assert_equal_i(prv_last_update_distance(c), ANIMATION_NORMALIZED_MAX); // Make sure each animation got to the end AnimTestHandlerEntry *entry; entry = prv_last_handler_entry(&s_update_handler_calls, c); cl_assert_equal_i((uint32_t)entry->context, ANIMATION_NORMALIZED_MAX); #endif } // -------------...
firmware_description->firmware_length); dbgserial_print("Checksum - wanted "); dbgserial_print_hex(firmware_description->checksum); dbgserial_print(" got "); dbgserial_print_hex(calculated_crc); dbgserial_newline(); return calculated_crc == firmware_description->checksum; } typedef enum UpdateFir...
(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_TWO)
; boot_bit_set(BOOT_BIT_RECOVERY_START_IN_PROGRESS); break; case UPDATE_FW_ERROR_MICRO_FLASH_UNTOUCHED: case UPDATE_FW_ERROR_MICRO_FLASH_MANGLED: // Keep us booting into recovery firmware. boot_bit_set(BOOT_BIT_FW_START_FAIL_STRIKE_ONE); boot_bit_set(BOOT_BIT_FW_START_FAIL_STRIKE_TWO); if (...
'->child_b->child_c->child_a // layer_insert_above_sibling(&child_c, &child_b); cl_assert(parent.first_child == &child_b); cl_assert(child_b.next_sibling == &child_c); cl_assert(child_c.parent == &parent); cl_assert(child_c.next_sibling == &child_a); cl_assert(child_a.next_sibling == NULL); } void test...
(&child_c, &child_a)
); layer_add_child(&child_a, &child_c); cl_assert(layer_is_descendant(&child_c, &child_a)); cl_assert(layer_is_descendant(&child_c, &parent)); cl_assert(!layer_is_descendant(&child_c, &child_b)); } void test_layer__find_layer_contains_point(void) { Layer parent, child_a, child_b, child_c, child_d, child_e, ...
e_out, sizeof(SerializedAppGlanceHeader)), E_DOES_NOT_EXIST); } void test_app_glance_db__glance_blob_with_slice_missing_expiration_time_gets_default_value(void) { const uint8_t app_glance_with_slice_missing_expiration_time[] = { // Version APP_GLANCE_DB_CURRENT_VERSION, // Creat...
(app_glance_db_insert_glance(&APP_GLANCE_TEST_UUID, &glance_with_too_many_slices), E_INVALID_ARGUMENT)
; // Glance containing a slice with an invalid type fails const AppGlance glance_containing_slice_with_invalid_type = (AppGlance) { .num_slices = 1, .slices = { { .expiration_time = 1464734484, // (Tue, 31 May 2016 22:41:24 GMT) .type = (AppGlanceSliceType)200, }, }, }; ...
) { prv_transition_to(this, LinkState_RequestSent); } else if (this->state->link_state == LinkState_Opened) { this->state->restart_count = 0; prv_start_timer(this); prv_transition_to(this, LinkState_Stopping); } prv_send_terminate_ack(this, packet->identifier); } static void prv_on_terminate_ack(...
if (state == LinkState_Initial || state == LinkState_Closed) { return; }
psleep(2); } } } void ppp_control_protocol_handle_incoming_packet( PPPControlProtocol *this, void *raw_packet, size_t length) { mutex_lock(this->state->lock); if (this->state->link_state == LinkState_Initial || this->state->link_state == LinkState_Starting) { // No packets should be rece...