prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
loat_string_parse_null_in_the_middle(void) { uint8_t buffer[] = {'1', 0, '2'}; assert_float_parse(buffer, 3, true, 3); } void test_ams_util__float_string_parse_empty_string(void) { // "" * 3 assert_float_parse("", 3, false, 0); } void test_ams_util__float_string_parse_not_a_number(void) { // "hello" * 3 a...
assert_result(1, "B", 1)
; assert_result(2, "C", 1); } void test_ams_util__csv_stop_after_one_value(void) { const char multi_values[] = "A,B,C"; s_max_results_count = 1; const uint8_t count = ams_util_csv_parse(multi_values, sizeof(multi_values), NULL, prv_result_callback); cl_assert_equal_...
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 "applib/app_smartstrap.h" #include "drivers/accessory.h" #include "kernel/events.h" #include "kernel/pebble_tasks.h" #include "...
PBL_ASSERT_TASK(PebbleTask_KernelBackground)
; ReadCompleteContext context = { .context_ptr = context_ptr }; smartstrap_state_lock(); if (smartstrap_fsm_state_get() != SmartstrapStateReadComplete) { // We could not be in a ReadComplete state if we got disconnected or if we got a complete frame // while the timeout was scheduled. mbuf_clear_next...
nizers(RecognizerManager *manager) { FailRecognizerCtx ctx = { .triggered = manager->triggered, }; prv_process_all_recognizers(manager, prv_fail_recognizer, &ctx); return ctx.recognizers_active; } static bool prv_is_active_and_triggered(Recognizer *recognizer, void *context) { Recognizer **triggered = co...
{ // Reset recognizers on tree below currently active layer (may be in a cancelled or failed // state) prv_reset_layer_tree_recognizers(manager, manager->active_layer, new_active_layer); }
} else { // Cancel all active layer recognizers if: // - we can't find a new active layer (i.e. point is off screen or not attached to any child // layers of the window) // - we're in a different layer which is not a child of the previous active layer and there // are recogniz...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (s_read_header_mbuf) { // already a read in progress return SmartstrapResultBusy; }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_disable_debugger_with_delay()
is_updating_existing = false; SMPairingInfo existing_pairing_info; if (shared_prf_storage_get_ble_pairing_data(&existing_pairing_info, NULL, NULL, NULL)) { if (sm_is_pairing_info_equal_identity(new_pairing_info, &existing_pairing_info)) { // Treat re-pairing an existing device as an "update" instead of de...
bt_persistent_storage_get_ble_pairing_by_id(BLE_BONDING_ID, NULL, NULL, NULL)
rt_handle_disconnect_as_slave(); prv_put_legacy_connection_event(&event->peer_address, false /* disconnected */); } GAPLEConnectionIntent *intent = s_intents; while (intent) { GAPLEConnectionIntent *next = (GAPLEConnectionIntent *) intent->node.next; if (prv_intent_matches_co...
(LOG_LEVEL_WARNING, "Watch driven BLE connection unimplemented")
; #else if (s_has_pending_create_connection) { PBL_LOG(LOG_LEVEL_ERROR, "Already connecting..."); return; } BLE_GAP_LOG_DEBUG("Starting connecting.."); unsigned int stack_id = bt_stack_id(); // See Bluetooth Spec 4.0, Volume 2, Part E, Chapter 7.8.12: const GAP_LE_Address_Type_t local_addr_type = B...
_TIMELINE_CALENDAR, .num_concurrent = 0, }, false /* animated */); // Peek should now be on-screen. cl_assert(layer->frame.origin.y < DISP_ROWS); // Peek service hides the peek UI. Not animated for this unit test. prv_set_timeline_item(NULL, false /* animated */); // Peek should now be off-screen. cl...
timeline_peek_set_visible(true, false /* animated */)
; // Peek should be visible again and on-screen. cl_assert(layer->frame.origin.y < DISP_ROWS); timeline_item_destroy(item); } void test_timeline_peek__peek_hidden_leaving_and_entering_watchface(void) { prv_set_timeline_item(NULL, true /* animated */); TimelinePeek *peek = timeline_peek_get_peek(); const La...
y); const bool is_orphan = (line_is_first_line_page && prev_line_word.start && !is_text_remaining); if (is_orphan) { *current_word_ref = prev_line_word; prv_apply_orphan_state(&orphan_state, line); avoiding_orphans = false; // prevent infinte loops goto...
{ case GTextAlignmentCenter: line->origin.x = line->origin.x + (horiz_px_remaining / 2); break; case GTextAlignmentRight: line->origin.x = line->origin.x + horiz_px_remaining; break; case GTextAlignmentLeft: break; }
} //! @return is_text_remaining bool line_add_words(Line* line, Iterator* word_iter, LastLineCallback last_line_cb) { WordIterState* word_iter_state = (WordIterState*) word_iter->state; line->start = word_iter_state->current.start; bool is_text_remaining = (line->start != NULL); // PBL-22083 : max_width_p...
pdate_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_inside_origin_layer.${BIT_DEPTH_NAME}.pbi")); layer_set_update_proc(&layer, &clear_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("cl...
(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw5_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 5); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw5_clip_xy.$...
/* * 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; }
// Data ///////////////////////// static TimelineItem s_items[] = { { .header = { // [0] .id = {0x6b, 0xf6, 0x21, 0x5b, 0xc9, 0x7f, 0x40, 0x9e, 0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb1}, .parent_id = {0}, .timestamp = 1421178061, // Tue Jan 13 11:41:01 2015 PST ...
pe); } xSemaphoreGive(s_pb_semaphore); } // Only used by unit test void put_bytes_deinit(void) { vSemaphoreDelete(s_pb_semaphore); if (s_pb_state.timer_id != TIMER_INVALID_ID) { new_timer_delete(s_pb_state.timer_id); } pb_storage_deinit(&s_pb_state.storage, false); prv_deinit_put_job_queue(); s_...
prv_add_nack_no_token_system_callback()
; return NULL; } // This is just symbolic, It just has to be non-NULL, really. // Since there is just once instance, we statically refer to it everywhere. return (Receiver *)&s_pb_state.receiver; } static void prv_validate_and_preack_request_if_needed(const uint8_t *rcvd_data, uint8_t length) { if (prv_...
2, 23, 56); prv_assert_alarm_config(id2, 23, 56, false, ALARM_KIND_WEEKDAYS, s_weekday_schedule); alarm_set_time(id1, 15, 16); prv_assert_alarm_config(id1, 15, 16, false, ALARM_KIND_EVERYDAY, s_every_day_schedule); alarm_set_time(id2, 23, 46); prv_assert_alarm_config(id2, 23, 46, false, ALARM_KIND_WEEKDAYS,...
{ AlarmId id1, id2; bool schedule_1[7] = {true, false, false, false, false, false, true}; bool verify_schedule_1[7] = {false, false, false, false, false, false, false}; id1 = alarm_create(&(AlarmInfo) { .hour = 3, .minute = 14, .kind = ALARM_KIND_CUSTOM, .scheduled_days = &schedule_1 }); prv_assert_alarm_con...
void test_alarm__alarm_get_string_for_custom(void) { bool schedule_1[7] = {true, false, false, false, false, false, true}; char alarm_day_text_1[32] = {0}; alarm_get_string_for_custom(schedule_1, alarm_day_text_1); cl_assert_equal_s(alarm_day_text_1, "Sat,Sun"); bool schedule_2[7] = {true, true, true, 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...
dbgserial_putstr("Stuck button register is invalid, clearing.")
; dbgserial_print_hex(button_counter_register); RTC_WriteBackupRegister(STUCK_BUTTON_REGISTER, 0); return false; } button_counter[button_id] += 1; if (button_counter[button_id] >= STUCK_BUTTON_THRESHOLD) { dbgserial_print("Button id "); dbgserial_print_hex(button_id); ...
], s_app_list); s_active_layer = &layer_c; TouchEvent e = { .type = TouchEvent_PositionUpdate }; // No active recognizers because manager is waiting for a touchdown event recognizer_manager_handle_touch_event(&e, &manager); prv_compare_recognizers_processed(NULL, 0, &s_recognizers_handled); // Touchdown ...
cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersTriggered)
; cl_assert_equal_i(recognizers[3]->state, RecognizerState_Updated); // Layer A recognizer's gesture completes and all recognizers are reset e.type = TouchEvent_Liftoff; s_next_state = RecognizerState_Completed; s_idx_to_change = 3; recognizer_manager_handle_touch_event(&e, &manager); prv_compare_recogni...
TROLLER_DA14681 if (pps_params_in->slave_latency_events != 0) { # if RECOVERY_FW PBL_LOG(LOG_LEVEL_DEBUG, "Overriding requested slave latency with 0 because PRF"); # else PBL_LOG(LOG_LEVEL_DEBUG, "Overriding requested slave latency with 0 because Dialog"); # endif } params_out->slave_latency_events = 0...
PBL_LOG(LOG_LEVEL_ERROR, "Unknown write_cmd %d", conn_params->cmd)
; break; } } unlock: bt_unlock(); } void bt_driver_cb_pebble_pairing_service_handle_ios_app_termination_detected(void) { app_launch_trigger(); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(s_data.order_mutex)
8, -248, -976}, { -96, -160, -936}, { 96, -208, -992}, { 200, -216, -928}, { -8, -184, -984}, { 96, -256, -960}, { 24, -200, -952}, { 24, -192, -952}, { 72, -288, -920}, { 168, -280, -800}, { 168, -256, -864}, { 104, -280, -704}, { 120, -368, -512}, { 280, -304, -352}...
{ 1080, 296, -120}, { 1136, 336, -112}, { 1152, 280, -64}, { 1008, 272, 8}, { 792, 200, -24}, { 688, 208, -24}, { 688, 200, -8}, { 760, 160, 24}, { 848, 184, 48}, // 32 seconds { 984, 144, 40}, { 1048, 152, 0}, { 1016, 88, 0}, { 1152, 112, -56}, { 1160, 104, -...
{ 1040, 120, -64}, { 1104, 104, -48}, { 1072, 80, -88}, { 1160, 88, -120}, { 1176, 112, -64}, { 1088, 152, -80}, { 1240, 168, -104}, { 1288, 192, -112}, { 1096, 248, -160}, { 744, 224, -160}, { 512, 184, -168}, { 440, 152, -128}, { 504, 176, -104}, { 696, 192, -1...
ate_read(uint16_t conn_idx, uint8_t response_buf[READ_RESPONSE_BUFFER_SIZE]) { PebblePairingServiceConnectivityStatus status = {}; prv_get_connectivity_status(conn_idx, &status); memcpy(response_buf, &status, sizeof(status)); return sizeof(status); } static uint8...
if (value_handle == s_pps_ctx.att_hdl.conn_status) { *response_length_out = prv_handle_connection_state_read(conn_idx, response); } else if (value_handle == s_pps_ctx.att_hdl.gatt_mtu) { *response_length_out = prv_handle_gatt_mtu_read(conn_idx, response); } else if (value_handle == s_pps_ctx.att_hdl.conn_pa...
return true; } static void prv_pps_handle_read_request(ble_service_t *svc, const ble_evt_gatts_read_req_t *evt) { uint8_t response[READ_RESPONSE_BUFFER_SIZE] = {}; size_t response_length = 0; att_error_t response_status = ATT_ERROR_OK; if (evt->handle == s_pps_ctx.att_hdl.trigger_pairing) { const Pairi...
d that's formed in msg_buffer. uint32_t max_data_size = max_msg_size - payload_hdr_size - sizeof(PLogMessageHdr); PROTOBUF_LOG_DEBUG("Max data buffer size: %"PRIu32, max_data_size); uint8_t *data_buffer = kernel_zalloc(max_data_size); if (!data_buffer) { kernel_free(msg_buffer); return NULL; } // E...
(session, pebble_pipeline_MeasurementSet_measurements_tag, pebble_pipeline_Measurement_fields, &msg)
; return success; } bool protobuf_log_session_add_event(ProtobufLogRef session_ref, pebble_pipeline_Event *event) { PBL_ASSERTN(session_ref != NULL); PLogSession *session = (PLogSession *)session_ref; PBL_ASSERTN(session->config.type == ProtobufLogType_Events); // Generate a new UUID Uuid uuid; uuid_ge...
///////////// #include "test_graphics.h" #include "../graphics/util.h" #if (SCREEN_COLOR_DEPTH_BITS == 1) #include "1bit/test_framebuffer.h" #elif (SCREEN_COLOR_DEPTH_BITS == 8) #include "8bit/test_framebuffer.h" #else #error "Unrecognized SCREEN_COLOR_DEPTH_BITS" #endif // Stubs ///////////////////////////////////...
(png_data, file_size)
("Battery change period: %"PRId64"\n", value)
; // 1024 ticks === 1000 ms cl_assert(value == 1000); } static bool dls_log_called = false; static int64_t expected_value = 254307546; void test_analytics__minimal_logging_test(void) { analytics_set(ANALYTICS_DEVICE_METRIC_BATTERY_CHARGE_TIME, expected_value, AnalyticsClient_System); // After...
Client_System); } } void analytics_external_collect_accel_samples_received(void) { mutex_lock_recursive(s_accel_manager_mutex); uint32_t samps_collected = s_accel_samples_collected_count; s_accel_samples_collected_count = 0; mutex_unlock_recursive(s_accel_manager_mutex); analytics_set(ANALYTICS_DEVICE_MET...
{ event_outstanding = state->event_posted; // Remove this subscriber and free up its state variables shared_circular_buffer_remove_subsampled_client( &s_buffer, &state->buffer_client); list_remove(&state->list_node, &s_data_subscribers /* &head */, NULL /* &tail */); kernel_free(state); ...
mutex_unlock_recursive(s_accel_manager_mutex); return event_outstanding; } DEFINE_SYSCALL(int, sys_accel_manager_set_sampling_rate, AccelManagerState *state, AccelSamplingRate rate) { // Make sure the rate is one of our externally supported fixed rates switch (rate) { case ACCEL_SAMPLING_1...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
printf("}")
2, 56}, { 504, -272, -184}, { 496, -72, -328}, { 688, -72, -120}, { 1368, -184, 216}, { 2256, 88, 352}, { 2416, 512, 152}, { 1888, 560, -136}, { 1496, 488, -352}, // 16 seconds { 1208, 288, 80}, { 1224, 208, 216}, { 1144, 200, 24}, { 848, 240, -256}, { 904, 488, -...
{ 1288, 40, -40}, { 1328, 256, -336}, { 1264, 152, -168}, { 1232, -32, -16}, { 944, -8, -40}, { 856, 96, -104}, { 920, 208, -24}, { 992, 264, 112}, { 952, 320, 16}, { 960, 320, -160}, { 1304, 352, -104}, { 1576, 552, -16}, { 896, 688, 48}, { 1120, 376, 0}, { 1...
{ 1016, 464, -16}, { 864, 392, -8}, { 1000, 432, 8}, { 1200, 408, 128}, { 1576, 336, 224}, { 1632, 176, 168}, { 1424, 72, 128}, { 1296, 24, 128}, { 1184, 40, 32}, { 976, 80, 0}, { 808, 88, -16}, { 664, 64, -8}, { 704, 48, -56}, { 960, 56, -168}, { 864, 184, -...
][1]->is_click_configured, false); cl_assert_equal_i(windows[2][0]->on_screen, false); cl_assert_equal_i(windows[2][0]->is_click_configured, false); cl_assert_equal_p(s_last_click_configured_window, windows[2][0]); // Add priority 3 opaque window 0 cl_assert(NumModalPriorities > 3); window_stack_push(windo...
modal_manager_get_properties()
" #include "applib/ui/vibes.h" #include "applib/ui/window.h" #include "console/prompt.h" #include "kernel/event_loop.h" #include "kernel/pbl_malloc.h" #include "mfg/mfg_mode/mfg_factory_mode.h" #include "mfg/results_ui.h" #include "process_management/app_manager.h" #include "process_management/pebble_process_md.h" #inc...
{ graphics_context_set_fill_color(ctx, GColorBlack); graphics_fill_rect(ctx, &layer->bounds); // Draw crosshair graphics_context_set_stroke_color(ctx, GColorWhite); graphics_draw_line( ctx, GPoint(layer->bounds.size.w / 2, radial_padding_size), GPoint(layer->bounds.size.w / 2, layer->bounds.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...
pebble_task_get_current()
); } // -------------------------------------------------------------------------------------------------- // This timer callback gets called if the process doesn't finish it's deinit within the required timeout (currently // 3 seconds). static void prv_graceful_close_timer_callback(void* data) { PBL_LOG(LOG_LEVEL_...
the lengths from the message so we know how to break it up. const uint8_t* read_iter = msg; const char* artist_ptr; size_t artist_length; read_iter = prv_read_ptr_and_length_from_buffer(read_iter, msg + length, &artist_ptr, &artist_length); if (!read_iter) {...
(player_name_ptr, player_name_length)
ummy_cycles, void *buffer, uint32_t length, bool is_ddr) { prv_indirect_read(dev, instruction, addr, dummy_cycles, buffer, length, is_ddr); } void qspi_indirect_read_dma(QSPIPort *dev, uint8_t instruction, uint32_t start_addr, uint8_t dummy_cycles, void *buffer, ui...
prv_set_comm_config(modes_bitset, 0)
; prv_wait_for_transfer_complete(); QSPI_ClearFlag(QSPI_FLAG_TC); prv_wait_for_not_busy(); } bool qspi_poll_bit(QSPIPort *dev, uint8_t instruction, uint8_t bit_mask, bool should_be_set, uint32_t timeout_us) { prv_set_num_data_bytes(1); // Set autopolling on the register QSPI_AutoPollin...
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 permissions and * limitations under the L...
if (data->now_bpm == 0) { health_util_create_text_node_with_text( EM_DASH, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD), TEXT_COLOR, container); } else { const size_t bpm_size = sizeof("000"); GTextNodeText *number_text_node = health_util_create_text_node(bpm_size, data->bpm_font, TEXT_...
const int offset_y = PBL_IF_RECT_ELSE(101, 109); graphics_text_node_draw(&container->node, ctx, &GRect(0, offset_y, base_layer->bounds.size.w, fonts_get_font_height(data->bpm_font)), NULL, NULL); graphics_text_node_destroy(&container->node); } static void prv_render_timstamp(GContext *ctx, ...
inite log dumping" CommSession *session = s_bt_dump_chunk_callback_data.comm_session; if (!success && comm_session_has_capability(session, CommSessionInfiniteLogDumping)) { header.command = 0x82; comm_session_send_data(s_bt_dump_chunk_callback_data.comm_session, ENDPOINT_ID, (uint...
app_storage_get_process_info(&last_launched_app, build_id, (AppInstallId)last_launched_app_slot, PebbleTask_App)
; if (result == GET_APP_INFO_SUCCESS) { DEBUG_LOG(LOG_LEVEL_INFO, "Last launched app: %s", last_launched_app.name); PBL_HEXDUMP(LOG_LEVEL_INFO, build_id, sizeof(build_id)); } } }
, { 1312, 192, -48}, { 1456, 200, -280}, { 1080, -112, -216}, { 832, -496, 176}, { 1104, -152, -56}, { 1264, 264, -384}, { 1208, 152, -136}, { 1704, 128, -144}, // 5 seconds { 1584, 280, -256}, { 1360, 344, -192}, { 1112, 416, -96}, { 1064, 432, -144}, { 1176, 248...
{ 1040, 280, -240}, { 880, 296, -200}, { 848, 320, -112}, { 952, 344, -80}, { 1008, 328, -128}, { 1224, 416, -32}, { 1576, 616, 8}, { 976, 736, 48}, { 1272, 736, -120}, { 1256, 592, -128}, { 936, 496, -104}, { 1208, 512, -24}, { 1568, 416, 32}, { 1512, 120, 80}, ...
// 13 seconds { 1176, 40, 40}, { 1096, 64, 16}, { 1064, 176, -8}, { 992, 184, -64}, { 968, 152, -8}, { 1272, 144, -56}, { 1144, 176, -144}, { 1240, 96, -176}, { 1168, 64, -136}, { 1200, 112, -200}, { 1088, 128, -264}, { 1272, 184, -304}, { 1200, 200, -288}, {...
l(void) { } void vPortExitCritical(void) { } void test_interval_timer__initialize(void) { fake_rtc_init(0, 0); } void test_interval_timer__simple(void) { IntervalTimer timer; interval_timer_init(&timer, 0, UINT32_MAX, 2); uint32_t num_intervals; uint32_t average_ms; num_intervals = interval_timer_get(&...
fake_rtc_increment_time_ms(1020)
tx", ctx); return ctx; } void test_rocky_api_graphics__drawing_rects(void) { prv_global_init_and_set_ctx(); s_context.draw_state.fill_color = GColorJaegerGreen; EXECUTE_SCRIPT( "ctx.clearRect(1, 2, 3, 4);\n" ); cl_assert_equal_i(1, s_graphics_fill_rect.call_count); cl_assert_equal_rect(GRect(1, 2...
((PP(29.5, 39.5)), lc->fill_radial_precise.center)
ment/process_manager.h" #include "services/common/system_task.h" #include "system/logging.h" #include "system/passert.h" #include "util/uuid.h" #include <inttypes.h> #include <stdlib.h> #include <string.h> static DataLoggingSession *s_logging_sessions; static PebbleRecursiveMutex * s_list_mutex; // ----------------...
if (session->data->inactivate_pending && session->data->open_count == 0) { session->status = DataLoggingStatusInactive; mutex_unlock_recursive(s_list_mutex); prv_free_storage_buffer(session); mutex_unlock(session->data->mutex); mutex_destroy(session->data->mutex); kernel_free(session->data); ...
} // --------------------------------------------------------------------------------------- // Return session status DataLoggingStatus dls_get_session_status(DataLoggingSession *session) { mutex_lock_recursive(s_list_mutex); DataLoggingStatus status = session->status; mutex_unlock_recursive(s_list_mutex); re...
er_set_frame((Layer *)&layer->day_separator, &day_sep_frame); layer_set_hidden((Layer *)&layer->day_separator, false); } static void prv_place_end_of_timeline(TimelineLayer *timeline_layer) { const bool was_hidden = layer_get_hidden((Layer *)&timeline_layer->end_of_timeline); const bool is_hidden = (timeline_lay...
(ctx, &(GRect) { .size = bounds->size })
; AnimationProgress progress; if (timeline_layer->animating_intro_or_exit && animation_get_progress(timeline_layer->animation, &progress)) { const GPoint offset = { PEEK_ANIMATIONS_SPEED_LINES_OFFSET_X, interpolate_int64_linear(progress, 0, -DISP_ROWS) }; graphics_context_...
meline_model_get_iter_state(1)->pin.header.id)); cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(2)); cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(3)); cl_assert(timeline_model_iter_next(&new_idx, &has_next)); cl_ass...
(&new_idx, NULL)
); cl_assert_equal_i(new_idx, 2); cl_assert_equal_i(timeline_model_get_num_items(), 2); cl_assert(uuid_equal(&s_items[s_correct_order[2]].header.id, &timeline_model_get_iter_state(0)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[3]].header.id, &timeline_model_get_iter_state(1)->pin...
/* * 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...
framebuffer_init(&s_fb, &(GSize) {DISP_COLS, DISP_ROWS})
; framebuffer_clear(&s_fb); graphics_context_init(&s_ctx, &s_fb, GContextInitializationMode_App); s_app_state_get_graphics_context = &s_ctx; // Setup resources fake_spi_flash_init(0 /* offset */, 0x1000000 /* length */); pfs_init(false /* run filesystem check */); pfs_format(true /* write erase headers *...
ide find layer function so we don't have to muck around with points and layer bounds (also // this process can change and this test will keep on working) Layer *layer_find_layer_containing_point(const Layer *node, const GPoint *point) { return s_active_layer; } typedef struct RecognizerHandled { ListNode node; i...
(&manager)
; // ensure this runs without crashing even if there are no recognizer lists prv_process_all_recognizers(&manager, prv_handle_dummy_touch_event, NULL); RecognizerList app_list = {}; s_app_list = &app_list; Window window = {}; layer_init(&window.layer, &GRectZero); manager.window = &window; Layer laye...
heart rate HealthValue now_bpm = health_service_peek_current_value(HealthMetricHeartRateBPM); HealthValue resting_bpm = health_service_peek_current_value(HealthMetricRestingHeartRateBPM); APP_LOG(APP_LOG_LEVEL_DEBUG, "Got HR data. Now: %"PRIi32", Resting: %"PRIi32"", now_bpm, resting_bpm); data->cur_...
if ((s_data->awake_time_utc == 0) || (time_end > s_data->awake_time_utc)) { s_data->awake_time_utc = time_end; }
} char time_start_text[64]; struct tm *local_tm = localtime(&time_start); strftime(time_start_text, sizeof(time_start_text), "%F %r", local_tm); char time_end_text[64]; local_tm = localtime(&time_end); strftime(time_end_text, sizeof(time_end_text), "%F %r", local_tm); APP_LOG(APP_LOG_LEVEL_DEBUG, ...
w_size, client->out.rx_window_size); } // ------------------------------------------------------------------------------------------------- static void prv_handle_ack(PPoGATTClient *client, uint32_t sn) { if (prv_is_packet_with_sn_awaiting_ack(client, sn)) { client->out.timeouts_counter = 0; client->out.ack...
{ prv_handle_data(client, packet, value_length - sizeof(PPoGATTPacket)); }
else if (LIKELY(packet->type == PPoGATTPacketTypeAck)) { prv_handle_ack(client, packet->sn); } else if (UNLIKELY(packet->type == PPoGATTPacketTypeResetComplete)) { PBL_LOG(LOG_LEVEL_ERROR, "Got reset complete while open!?"); } } else if (client->state == StateConnectedClosedAwaitingResetCompleteS...
app(&(AppLaunchConfig) { .md = app_fetch_ui_get_app_info(), .common.args = fetch_args, .common.transition = fetch_args->common.transition, .forcefully = fetch_args->forcefully, }); } // ----------------------------------------------------------------------------------------- static AppInstallId prv_g...
if (!s_app_task_context.app_md) { // No app has been started yet, so just use the default system size *size = GSize(DISP_COLS, DISP_ROWS); return; }
// Platform matches current platform const PlatformType sdk_platform = process_metadata_get_app_sdk_platform(s_app_task_context.app_md); if (sdk_platform == PBL_PLATFORM_TYPE_CURRENT) { *size = GSize(DISP_COLS, DISP_ROWS); return; } // We cannot use the SDK type for this compatibility check bu...
workout_service_frontend_closed(); cl_assert_equal_b(s_hrm_subscribed, false); cl_assert_equal_i(s_hrm_expiration, 0); } // --------------------------------------------------------------------------------------- void test_workout_service__heart_rate_zone_time(void) { const int ZONE_0_HR = 100; const int ZONE...
(hr_zone_time_s)
); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone0], 10); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone1], 20); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone2], 20); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone3], 20); cl_assert(!workout_service_get_current_workout_hr_zone_time(NULL)); cl_assert(workout_servic...
/* * 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...
list_append(g_profiler.nodes, (ListNode *) node)
; } static int prv_node_compare(void *a, void *b) { return ((ProfilerNode *) b)->total - ((ProfilerNode *) a)->total; } void prv_node_reset(ProfilerNode *node) { node->start = 0; node->end = 0; node->total = 0; node->count = 0; list_init(&node->list_node); } void profiler_init(void) { g_profiler.end = ...
_idx; cl_assert(timeline_model_iter_prev(&new_idx, NULL)); cl_assert_equal_i(new_idx, 4); cl_assert_equal_i(timeline_model_get_num_items(), 2); cl_assert(uuid_equal(&s_items[s_correct_order[4]].header.id, &timeline_model_get_iter_state(0)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[5...
timeline_model_remove(&s_items[s_correct_order[1]].header.id)
; cl_assert_equal_i(timeline_model_get_num_items(), 2); cl_assert(uuid_equal(&s_items[s_correct_order[0]].header.id, &timeline_model_get_iter_state(0)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[2]].header.id, &timeline_model_get_iter_state(1)->pin.header.id)); cl_assert(timeline...
//////////// T_STATIC void prv_handle_connection(void) { if (s_state.state != PostMessageStateDisconnected) { // Handle the race. See comment in prv_init_apis(). return; } DBG("Transport Connected"); prv_awaiting_reset_request__enter(); } T_STATIC void prv_handle_disconnection(void) { if (s_state.st...
memcpy(next_chunk->chunk_data, &obj->data_buffer[obj->offset_bytes], payload_size)
; // Move the cursor just like a dict_write_data() call would. // app_message_outbox_send() is expecting this! it->cursor = (Tuple *)((uint8_t *)it->cursor + sizeof(Tuple) + tuple_data_length); PBL_ASSERTN(s_state.out.msg_type == OutboxMsgTypeNone); s_state.out.msg_type = OutboxMsgTypeChunk; DBG("Sending...
/* * 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...
(AppWorkerResult, sys_app_worker_kill, void)
{ const PebbleProcessMd *md = worker_manager_get_current_worker_md(); if (md == NULL) { return APP_WORKER_RESULT_NOT_RUNNING; } if (!uuid_equal(&md->uuid, &app_manager_get_current_app_md()->uuid)) { return APP_WORKER_RESULT_DIFFERENT_APP; } process_manager_put_kill_process_event(PebbleTask_Worker...
te_proc(NULL, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled_right_clipped_aa.${BIT_DEPTH_NAME}.pbi")); } // Additional test to check AA on edges - works only on 8bit void test_graphics_gpath_8bit__filled_bolt_aa(void) { // NOTE: Those tests are being performed only in 8bits due to differen...
test_graphics_context_init(&ctx, fb)
string_alloc_size_out, attributes_per_actions_out); } size_t attributes_actions_get_required_buffer_size(uint8_t num_attributes, uint8_t num_actions, uint8_t *attrib...
{ const size_t actions_size = sizeof(TimelineItemAction) * source->num_actions; if (buffer + actions_size > buffer_end) { return false; } dest->num_actions = source->num_actions; dest->actions = (TimelineItemAction*) buffer; memcpy(dest->actions, source->actions, actions_size); size_t offset = actio...
bool attributes_actions_deep_copy(AttributeList *src_attr_list, AttributeList *dest_attr_list, TimelineItemActionGroup *src_action_group, TimelineItemActionGroup *dest_action_group, ...
_parsed_msg = (TestPLParsedMsg) { .events = { .num_events = ARRAY_LENGTH(events), .events = events, .uuids = event_uuids, .num_sessions = ARRAY_LENGTH(event_sessions), .sessions = event_sessions, }, }; // Get the message size and pointer to encoded data PLogMessageHdr *hdr =...
cl_assert_equal_i(a->events.num_sessions, b->events.num_sessions)
ng permissions and * limitations under the License. */ #include "timeline_pins_demo.h" #include "applib/app.h" #include "applib/ui/app_window_stack.h" #include "applib/ui/option_menu_window.h" #include "apps/system_app_ids.h" #include "apps/system_apps/timeline/timeline.h" #include "process_management/app_manager.h...
if (!has_timestamp) { attribute_list_add_uint8(&list, AttributeIdDisplayTime, WeatherTimeType_None); }
if (has_short_title) { attribute_list_add_cstring(&list, AttributeIdShortTitle, "Sunrise"); } if (has_short_subtitle) { attribute_list_add_cstring(&list, AttributeIdShortSubtitle, "Cloudy with rain and snow"); } TimelineItem *item = timeline_item_create_with_attributes(now + delta_time_s, 0, ...
ervices/normal/settings/settings_file.h" #include "services/normal/settings/settings_file.h" #include "shell/normal/quick_launch.h" #include "shell/normal/watchface.h" #include "shell/prefs.h" #include "system/logging.h" #include "system/passert.h" #include "util/attributes.h" #include "util/list.h" #include "util/math...
get_available_pfs_space()
; if (pfs_space < APP_SPACE_BUFFER) { const uint32_t to_free = (APP_SPACE_BUFFER - pfs_space); PBL_LOG(LOG_LEVEL_DEBUG, "Cache OOS: Need to free %"PRIu32" bytes, PFS avail space: %"PRIu32"", to_free, pfs_space); app_cache_free_up_space(to_free); } } static void prv_delete_cache_callback(void *...
Ref recognizer, void *context) { MusicAppData *data = context; data->action_bar_revert_timer = app_timer_register(ACTION_BAR_TIMEOUT_MS, prv_action_bar_revert, data); prv_set_action_bar_state(data, ActionBarStateVolume); } static void prv_toggle_playing(void) ...
text_layer_deinit(&music_window->text_layer)
; i18n_free_all(music_window); } static void prv_handle_no_music_back(ClickRecognizerRef recognizer, void *context) { app_window_stack_pop_all(true); } static void prv_no_music_window_click_config(void *context) { window_single_click_subscribe(BUTTON_ID_BACK, prv_handle_no_music_back); } static MusicNoMusicWin...
t_mutex)); } // --------------------------------------------------------------------------------------- // Lock a session (if active). If session was active, locks it and returns true. // If session is not active, does no locking and returns false. // // Note regarding the list_mutex and the session->data-mutex: // ...
(s_list_mutex)
; return status; } DataLoggingSession *dls_list_find_by_session_id(uint8_t session_id) { mutex_lock_recursive(s_list_mutex); DataLoggingSession *iter = s_logging_sessions; while (iter != NULL) { if (iter->comm.session_id > session_id) { break; } if (iter->comm.session_id == session_id) { ...
GColorBlack)) #define CURRENT_TEXT_COLOR (PBL_IF_COLOR_ELSE(GColorVividCerulean, GColorBlack)) #define TYPICAL_TEXT_COLOR (PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite)) #define NO_DATA_TEXT_COLOR (PBL_IF_COLOR_ELSE(GColorWhite, GColorBlack)) #define CARD_BACKGROUND_COLOR (PBL_IF_COLOR_ELSE(GColorOxfordBlue, GColorWhit...
(ctx, &data->progress_bar, PROGRESS_TYPICAL_COLOR, typical_end)
; #endif } } static void prv_render_progress_bar(GContext *ctx, Layer *base_layer) { HealthSleepSummaryCardData *data = layer_get_data(base_layer); // Renders the background health_progress_bar_fill(ctx, &data->progress_bar, PROGRESS_BACKGROUND_COLOR, 0, HEALTH_PROGRESS_BAR_MAX_VALU...
new event if the prior one has been picked up. This prevents us from flooding the KernelMain // queue if (!s_pending_accel_event) { s_pending_accel_event = true; PebbleEvent e = { .type = PEBBLE_CALLBACK_EVENT, .callback = { .callback = prv_read_samples, .data = NULL } ...
{ uint32_t delta = prv_compute_delta_pos(&accel_data, &s_last_analytics_position); s_is_idle = (delta < ACCEL_MAX_IDLE_DELTA); s_last_analytics_position = accel_data; analytics_set(ANALYTICS_DEVICE_METRIC_ACCEL_XYZ_DELTA, delta, AnalyticsClient_System); }
} // Self Test ////////////////////////////////////////////////////////////////////// bool accel_self_test(void) { AccelRawData data; AccelRawData data_st; if (!accel_start()) { PBL_LOG(LOG_LEVEL_ERROR, "Self test failed, could not start accel"); return false; } psleep(10); accel_get_data(&da...
{ 0, 0x48, 0, 0x0}, { 0, 0x48, 0, 0x0}, { 0, 0x48, 0, 0x0}, { 0, 0x48, 0, 0x0}, { 0, 0x48, 0, 0x0}, { 0, 0x48, 0, 0x0}, { 0, 0x48, 0, 0x0}, { 0, 0x48, 0, 0x0}, { 0, 0x48, 0, 0x0}, { 0, 0x48, 0, 0x0}, { 0, 0x48, 0, 0x0}, { 0, 0x48, 0, 0x0}, { 0, 0x48, 0, 0x0}, { 0,...
{ 0, 0x7f, 0, 0x0}, { 0, 0x7f, 17, 0x0}, { 0, 0x7f, 0, 0x0}, { 0, 0x7f, 0, 0x0}, { 0, 0x7f, 0, 0x0}, { 0, 0x7f, 0, 0x0}, { 0, 0x7f, 0, 0x0}, { 0, 0x7f, 0, 0x0}, { 0, 0x7f, 0, 0x0}, { 0, 0x7f, 0, 0x0}, { 0, 0x7f, 0, 0x0}, { 0, 0x7f, 0, 0x0}, { 0, 0x7f, 0, 0x0}, { ...
ual_s(dstbuf, "There are 4 lights, -4"); // Left-align, Space padded minimum character output snprintf(dstbuf, 256, "There are %-2i lights, %-2i", 4, -4); cl_assert_equal_s(dstbuf, "There are 4 lights, -4"); // Space for positive signed snprintf(dstbuf, 256, "There are % i lights, the absolute value of % ...
cl_assert_equal_s(dstbuf, "zero1")
; // Minimum digits output (non-zero digits outputting zero) snprintf(dstbuf, 256, "%.1uzero%.1u", 0, 1); cl_assert_equal_s(dstbuf, "0zero1"); // Variable length character output snprintf(dstbuf, 256, "There are %*u lights", 3, 4); cl_assert_equal_s(dstbuf, "There are 4 lights"); // Variable length d...
x); return result; } // --------------------------------------------------------------------------------------------- DEFINE_SYSCALL(bool, sys_accel_manager_consume_samples, AccelSessionRef session, uint32_t samples) { bool success = true; mutex_lock_recursive(s_mutex); { AccelSubscriberState* state = prv...
accel_running()
/* * 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 (task == DialogTaskList[index]) { return index; }
_alarms(bool enable) { s_alarms_enabled = enable; } // ---------------------------------------------------------------------------------------------- const char *alarm_get_string_for_kind(AlarmKind kind, bool all_caps) { const char *alarm_day_text = NULL; switch (kind) { case ALARM_KIND_EVERYDAY: alar...
{ num_days_scheduled++; latest_day_scheduled = i % 7; const char *day_string = i18n_get(day_strings[i % 7], day_strings); strcat(alarm_day_text, day_string); strcat(alarm_day_text, ","); i18n_free(day_strings[i % 7], day_strings); // copied in by strcat. We can free it }
} if (num_days_scheduled == 1) { // Write the full day string const char *full_day_string = i18n_get(full_day_strings[latest_day_scheduled], full_day_strings); strcpy(alarm_day_text, full_day_string); i18n_free(full_day_strings[latest_day_scheduled], full_...
connection_event_callback; static unsigned long s_le_adv_connection_callback_param; static uint16_t s_min_advertising_interval_slots; static uint16_t s_max_advertising_interval_slots; void gap_le_set_advertising_disabled(void) { s_is_le_advertising_enabled = false; s_min_advertising_interval_slots = 0; s_max_ad...
cl_assert(s_le_create_connection_event_callback != NULL)
; s_le_create_connection_event_callback(1, event, s_le_create_connection_callback_param); } void prv_fake_gap_le_adv_connection_event_put(GAP_LE_Event_Data_t *event) { cl_assert(s_le_adv_connection_event_callback != NULL); s_le_adv_connection_event_callback(1, event, s_le_adv_connection_callback_param); } void ...
KinoReelProcessor *processor) { KinoReelTransformData *data = kino_reel_custom_get_data(reel); if (data->normalized == 0) { prv_draw_processed_at_rect(data, ctx, offset, data->from, processor); return; } if (data->normalized == ANIMATION_NORMALIZED_MAX) { prv_draw_processed_at_rect(data, ct...
if (data) { data->global = global; }
} void kino_reel_transform_set_transform_duration(KinoReel *reel, uint32_t duration) { KinoReelTransformData *data = kino_reel_custom_get_data(reel); if (data) { data->duration = duration; } }
/* * 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...
enter_standby(RebootReasonCode_LowBattery)
; } void low_power_enter(void) { #if RECOVERY_FW if (mfg_is_mfg_mode()) { return; } #endif prv_low_power_transition(true); } void low_power_exit(void) { prv_low_power_transition(false); } bool low_power_is_active(void) { return s_low_power_active; }
("var a = (_rocky.on === _rocky.addEventListener);")
; ASSERT_JS_GLOBAL_EQUALS_B("a", true); } void test_rocky_api_global__calls_init_and_notifies_about_apis(void) { static const RockyGlobalAPI api = { .init = prv_api_init, .add_handler = prv_api_add, }; static const RockyGlobalAPI *apis[] = { &api, NULL, }; rocky_global_init(apis); cl_asse...
k_subscribe(BUTTON_ID_SELECT, 1, 2, 25, true, (ClickHandler)select_click_handler); } static GRect prv_get_text_frame(Layer *window_layer) { const int16_t x_margin = 5; const int16_t label_y_offset = PBL_IF_ROUND_ELSE(40, 16); const GEdgeInsets insets = PBL_IF_ROUND_ELSE(GEdgeInsets(ACTION_BAR_WIDTH + x_margin), ...
(&nw->window, &(WindowHandlers) { .load = (WindowHandler) number_window_load, })
; layer_set_update_proc(&nw->window.layer, prv_update_proc); ActionBarLayer *action_bar = &nw->action_bar; action_bar_layer_init(action_bar); } NumberWindow* number_window_create(const char *label, NumberWindowCallbacks callbacks, void *callback_context) { NumberWindow* window = applib_type_malloc(NumberWindo...
/* * 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 S_SUCCESS; }
PulseBulkIODomainHandler pulse_bulkio_domain_external_flash = { .id = PulseBulkIODomainType_ExternalFlash, .open_proc = external_flash_domain_open, .close_proc = external_flash_domain_close, .read_proc = external_flash_domain_read, .write_proc = external_flash_domain_write, .stat_proc = external_flash_dom...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ strncpy(destination, full_name, length); destination[length - 1] = '\0'; return; }
// Copy the first name to the destination, as long as it fits. size_t pos = MIN((size_t)(space - full_name), length - 1); strncpy(destination, full_name, pos); // Then keep adding the character after the space until we run out of spaces. do { space++; // Abort if it is impossible for us to fit a spac...
_start = time_util_get_seconds_until_daily_time( &time, curr_schedule.from_hour, curr_schedule.from_minute); const time_t seconds_until_end = time_util_get_seconds_until_daily_time( &time, curr_schedule.to_hour, curr_schedule.to_minute); seconds_until_update = MIN(seconds_until_start, seconds_un...
alerts_preferences_dnd_set_schedule(type, schedule)
; prv_try_update_schedule_mode_callback(true); } bool do_not_disturb_is_schedule_enabled(DoNotDisturbScheduleType type) { return alerts_preferences_dnd_is_schedule_enabled(type); } void do_not_disturb_set_schedule_enabled(DoNotDisturbScheduleType type, bool scheduled) { alerts_preferences_dnd_set_schedule_enabl...
result(&item->header.id, i18n_get("Dismissed", &i18n_key), TIMELINE_RESOURCE_RESULT_DISMISSED, ActionResultTypeSuccess); } static void prv_perform_ancs_negative_action(const TimelineItem *item, const TimelineItemAction *action) { uint8...
(window_stack, true /* animated */)
; } event_service_client_unsubscribe(&ctx->event_info); kernel_free(ctx); } void timeline_invoke_action(const TimelineItem *item, const TimelineItemAction *action, const AttributeList *attributes) { char uuid_buffer[UUID_STRING_BUFFER_LENGTH]; uuid_to_string(&item->header.parent_...
c bool prv_gbitmap_sequence_restart(GBitmapSequence *bitmap_sequence, bool reset_elapsed) { if (bitmap_sequence == NULL) { return false; } // can start seeking after SIG + IHDR int32_t metadata_bytes = png_seek_chunk_in_resource(bitmap_sequence->resource_id, ...
if (png_format >= UPNG_INDEXED1 && png_format <= UPNG_INDEXED8) { bitmap_sequence->png_decoder_data.palette_entries = gbitmap_png_load_palette(upng, &bitmap_sequence->png_decoder_data.palette); if (bitmap_sequence->png_decoder_data.palette_entries == 0) { APP_LOG(APP_LOG_LEVEL_ERROR, "Failed to lo...
bitmap_sequence->header_loaded = true; cleanup: applib_free(frame_data_buffer); // Free compressed image buffer if (!bitmap_sequence || !bitmap_sequence->header_loaded) { APP_LOG(APP_LOG_LEVEL_ERROR, APNG_LOAD_ERROR); gbitmap_sequence_destroy(bitmap_sequence); } return bitmap_sequence; } bool g...
ssert_not_consumed(); prv_process_send_queue(s_system_session_ptr); assert_consumed(AppMessageSenderErrorSuccess, 1); app_free(outbox_data); } void test_app_message_sender__system_session_and_js_app(void) { s_process_md.allow_js = true; AppMessageAppOutboxData *outbox_data = prv_create_and_send_outbo...
(bytes_out, TEST_EXPECTED_PP_MSG + o + c, length_to_copy)
); } comm_session_send_queue_consume(s_app_session_ptr, 1 /* length */); } assert_consumed(AppMessageSenderErrorSuccess, 1); cl_assert_equal_i(s_app_install_timestamp_update_count, 1); app_free(outbox_data); } // Tests that deal with the edge case of app outbox messages getting cancelled, // because ...
/* * 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 NULL; }
// setup and teardown void test_gdraw_command_sequence__initialize(void) { } void test_gdraw_command_sequence__cleanup(void) { } size_t prv_create_test_sequence(GDrawCommandSequence **sequence_ptr) { size_t size = sizeof(GDrawCommandSequence) + (sizeof(GDrawCommandFrame) * 2) + (sizeof(GDrawCommand) * 4)...
} const GBitmapDataRowInfo src_row_info = gbitmap_get_data_row_info(src_bitmap, src_y); const uint8_t *src = src_row_info.data; // This is the initial position that takes into account destination delta shift const int16_t src_initial_x = src_bitmap->bounds.origin.x + dest_delta_begi...
if (compositing_mode == GCompOpTintLuminance) { actual_color = gcolor_perform_lookup_using_color_luminance_and_multiply_alpha( src_color, tint_luminance_lookup_table); }
dest[dest_x] = gcolor_alpha_blend(actual_color, (GColor8)dest[dest_x]).argb; } } break; } } } void bitblt_bitmap_into_bitmap_tiled_1bit_to_8bit(GBitmap* dest_bitmap, const GBitmap* src_bitmap, ...
it static void prv_bus_enable(I2CBus *bus) { // Don't power up rail if the bus is already in use (enable can be called to reset bus) if (bus->state->user_count == 0) { prv_bus_rail_power_up(bus); } prv_bus_pins_cfg_i2c(bus); i2c_hal_enable(bus); } //! De-initialize and gate the clock to the peripheral...
if (gpio_input_read(&in_sda)) { recovered = true; break; }
} if (recovered) { PBL_LOG(LOG_LEVEL_DEBUG, "I2C Bus %s recovered", slave->bus->name); } else { PBL_LOG(LOG_LEVEL_ERROR, "I2C Bus %s still hung after bitbang reset", slave->bus->name); } prv_bus_pins_cfg_i2c(slave->bus); prv_bus_reset(slave->bus); mutex_unlock(slave->bus->state->bus_mutex); ...
nable_all(size_t, const struct clar_suite *); static void clar_category_print_enabled(const char *prefix); /* Event callback overrides */ ${clar_event_overrides} /* Autogenerated test data by clar */ ${clar_callbacks} ${clar_categories} static const struct clar_suite _clar_suites[] = { ${clar_suites} }; static s...
{ /* given suite number, name, or prefix */ int num = 0, offset = (argument[2] == '=') ? 3 : 2; int len = 0, is_num = 1, has_colon = 0, j; for (argument += offset; *argument; ++argument) { len++; if (*argument >= '0' && *argument <= '9') num = (num * 10) + (*argument - '0');...
/* * 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...
(icache_line_size, 1)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
strcmp(cursor, last_cursor)
== 0) { data->continent_end[continent_index] = i + 1; continue; } // If the new continent is filtered out, don't create a new continent or update the last // continent pointer. if (strcmp(cursor, "Etc") == 0) { // Filter out 'Etc' fake-continent continue; } // Set pointer for ...
btain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licens...
{ const BTDeviceAddress address = bt_device_get_address(device); char uuid_buffer[UUID_STRING_BUFFER_LENGTH]; for (unsigned int i = 0; i < num_services; ++i) { Uuid service_uuid = ble_service_get_uuid(services[i]); uuid_to_string(&service_uuid, uuid_buffer); APP_LOG(APP_LOG_LEVEL_INFO, ...
ble_client_write(characteristics[c], (const uint8_t *) value, strlen(value) + 1); } const Uuid hrm_uuid = bt_uuid_expand_16bit(0x2A37); if (uuid_equal(&hrm_uuid, &characteristic_uuid)) { ble_client_subscribe(characteristics[c], BLESubscriptionNotifications); } // BLEDescr...
prv_to_locale_time_or_date_string(this_val, argc, argv, ToStringFormatLocaleDate, ToStringFormatEmpty)
; } JERRY_FUNCTION(prv_to_locale_string) { jerry_value_t error = jerry_create_undefined(); char buffer[BUFFER_LEN_DATETIME] = {0}; // we allow users to pick from any option to here const size_t total_len = prv_to_locale_buffer(this_val, argc, argv, ToStringForma...
->header.duration * SECONDS_PER_MINUTE; CHECK_EVENT( .count = 4, .item_id = item->header.id, .num_concurrent = 0, .timeout_ms = timeout_s * MS_PER_SECOND, .time_type = TimelinePeekTimeType_ShowStarted, .is_first_event = true ); prv_invoke_timer(timeout_s); CHECK_NO_EVENTS( .count = 5...
prv_invoke_timer(timeout_s)
; item = &s_back_to_back_calendar_item2; CHECK_EVENT( .count = 6, .item_id = item->header.id, .num_concurrent = 0, .timeout_ms = timeout_s * MS_PER_SECOND, .time_type = TimelinePeekTimeType_SomeTimeNext ); } void test_timeline_peek_event__one_persistent_event_lifecycle(void) { Timel...
_rect = prv_artist_rect(); const GRect title_rect = prv_title_rect(); const GRect time_rect = prv_time_rect(); const GRect cassette_rect = prv_cassette_rect(); const GRect track_rect = prv_track_rect(); prv_configure_music_text_layer(&data->artist_text_layer, data->artist_buffer, ...
prv_update_track_progress(data)
; prv_update_ui_state(data, false); } static void prv_push_window(MusicAppData *data) { Window *window = &data->window; window_init(window, WINDOW_NAME("Music")); window_set_user_data(window, data); window_set_status_bar_icon(window, (GBitmap*)&s_status_icon_music_bitmap); const bool animated = true; ap...
48, -856}, { -280, 616, -968}, { -376, 648, -872}, { -352, 584, -656}, { -344, 216, -552}, { -48, 664, -792}, { -16, 472, -752}, { 288, 224, -1040}, { 176, 24, -1080}, { 128, -64, -936}, { 144, -176, -816}, { 192, -40, -904}, { 264, -200, -1024}, { 392, -552, -1088}, ...
{ -200, 64, -936}, { -312, 368, -848}, { -664, 336, -544}, { -296, 232, -592}, { -112, 120, -736}, { 8, -104, -1248}, // 59 seconds { 96, 208, -1184}, { 56, -96, -1040}, { -40, -96, -1120}, { -48, 40, -920}, { 120, 208, -1280}, { 112, 112, -1112}, { 192, -16, -960...
{ 0, 904, 64}, { -24, 936, 128}, { -32, 944, 152}, { -32, 1024, 88}, { -24, 1016, -40}, { -72, 808, -144}, { -88, 688, -192}, { -168, 680, -160}, { -120, 640, -128}, { 24, 680, -368}, { 248, 808, -632}, { 328, 552, -880}, { 416, 600, -1016}, { 528, 592, -1072}, ...
/* * 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...
(&data->progress_layer.layer, true)
; uint32_t res_id; uint32_t end_screen_timeout; if (success) { res_id = RESOURCE_ID_GENERIC_CONFIRMATION_LARGE; end_screen_timeout = COMPLETE_SCREEN_VISIBLE_DURATION_MS; dialog_set_background_color(simple_dialog_get_dialog(&data->finished_dialog), GColorGreen); simple_dialog_set_buttons_enabled(&...
/* * 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_fill_rect(ctx, &layer->bounds)
; graphics_context_set_drawing_state(ctx, prev_state); } } //! helper struct to move displacement logic out of window_render() typedef struct { GPoint drawing_box_origin; GRect clip_box; } DrawingStateOrigins; static void prv_adjust_drawing_state_for_legacy2_apps(DrawingStateOrigins *saved_state, ...
_get_watchdog_timer_id(); stub_new_timer_fire(watchdog_timer); // Stopping did not fail, but restarting did. In this case we need to generate an event that // the discovery process failed. The error from GATT_Start_Service_Discovery is expected to be // passed in the event. prv_assert_event(&device, BTErrnoW...
(TEST_GATT_CONNECTION_ID)
; // start another job, should be pended gatt_client_discovery_discover_range(connection, &range); fake_gatt_put_discovery_complete_event(GATT_SERVICE_DISCOVERY_STATUS_SUCCESS, TEST_GATT_CONNECTION_ID); // Since we are restarting discovery over the same range and discov...
); cl_assert_equal_i(timeline_model_get_num_items(), 2); cl_assert(uuid_equal(&s_items[s_correct_order[0]].header.id, &timeline_model_get_iter_state(-1)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[1]].header.id, &timeline_model_get_iter_state(0)->pin.header.id)); cl_assert(uuid_e...
{ TimelineModel model = {0}; model.direction = TimelineIterDirectionFuture; time_t first_time = 1421178000; // Note: 1421178000 = Tue Jan 13 11:40:00 PST 2015 timeline_model_init(first_time, &model); cl_assert(timeline_model_iter_next(NULL, NULL)); cl_assert(timeline_model_iter_next(NULL, NULL)); cl_as...
cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(3)); cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(4)); cl_assert(timeline_model_get_iter_state(2) == timeline_model_get_iter_state_with_timeline_idx(5)); cl_assert(tim...
BT_RX_BOOTROM_UART != BT_TX_BOOTROM_UART); } static void prv_init_dialog_bootrom_interface(void) { periph_config_acquire_lock(); if (prv_platform_uses_two_uart_peripherals()) { uart_init_rx_only(BT_RX_BOOTROM_UART); uart_init_tx_only(BT_TX_BOOTROM_UART); uart_set_baud_rate(BT_RX_BOOTROM_UART, DIALOG_B...
PBL_LOG(LOG_LEVEL_ERROR, "CRC mismatch! expected=0x%"PRIx8" vs recv'd=0x%"PRIx8, running_xor, c)
; return false; } static bool prv_send_header(uint16_t bootloader_size) { // Send the header prv_send_char(0x01); // Start of Header: 0x01 prv_send_char(bootloader_size & 0xff); // LEN_LSB prv_send_char((bootloader_size >> 8) & 0xff); // LEN_MSB char c; if (!prv_bootrom_wait_for_char(&c)) { PBL_LOG(...
sBasicOp_ConsecutiveFirst); for (size_t i = 0; i < num_data; i++) { const int32_t value = data[i]; if (filter && !filter(i, value, context)) { if (op & StatsBasicOp_Consecutive) { if (consecutive_current > consecutive_max) { consecutive_max = consecutive_current; } con...
{ // This is a `tie` rv = (values[k].value + values[k + 1].value) / 2; break; }
else if (tmp_sum <= (S_x100 / 2)) { // If we are not *exactly* equal (implied by the if above), but less than or equal, // stop and record this value. rv = values[k].value; break; } k++; } task_free(values); return rv; }
b, RECT_NULL, RECT_NULL, false, 1); graphics_context_set_text_color(&ctx, GColorBlack); graphics_draw_text(&ctx, "jja", &s_font_info, RECT_TEXT_0_0, GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL); cl_check(framebuffer_is_empty("draw_text_null_null", fb, GColorWhite)); setup_t...
graphics_draw_text(&ctx, "blue100", &s_font_info, GRect(10, 10, 100, 30), GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL); ctx.draw_state.text_color.a = 2; graphics_draw_text(&ctx, "blue66", &s_font_info, GRect(10, 40, 100, 30), GTextOverflowModeTrailingEllip...
void test_graphics_draw_text_8bit__data_row_offsets(void) { GContext ctx; // Setup resources fake_spi_flash_init(0, 0x1000000); pfs_init(false); pfs_format(true /* write erase headers */); load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false /* is_next */); resou...
--------------------------------------- bool worker_manager_launch_new_worker_with_args(const PebbleProcessMd *app_md, const void *args) { PBL_ASSERT_TASK(PebbleTask_KernelMain); // Don't launch workers in recovery mode to reduce the chance of crashes #ifdef RECOVERY_FW return false; #endif // If workers are ...
(worker_heap, (HeapLockImpl) { .lock_function = prv_heap_lock, })
; process_heap_set_exception_handlers(worker_heap, app_md); // Init services required for this process before it starts to execute process_manager_process_setup(PebbleTask_Worker); char task_name[configMAX_TASK_NAME_LEN]; snprintf(task_name, sizeof(task_name), "Worker <%s>", process_metadata_get_name(s_work...
BRIGHTNESS_OFF and BACKLIGHT_BRIGHTNESS_ON static int32_t s_current_brightness; //! Timer to count down from the LIGHT_STATE_ON_TIMED state. static TimerID s_timer_id; //! Refcount of the number of buttons that are currently pushed static int s_num_buttons_down; //! The current app is forcing the light on and off, d...
{ if (!s_backlight_allowed) { return false; } if (backlight_is_enabled()) { if (backlight_is_ambient_sensor_enabled()) { // If the light is off and it's bright outside, don't allow the light to turn on // (we don't need it!). Grab the mutex here so that the timer state machine doesn't chang...
void light_init(void) { s_light_state = LIGHT_STATE_OFF; s_current_brightness = BACKLIGHT_BRIGHTNESS_OFF; s_timer_id = new_timer_create(); s_num_buttons_down = 0; s_user_controlled_state = false; s_mutex = mutex_create(); } void light_button_pressed(void) { mutex_lock(s_mutex); s_num_buttons_down++;...
OG_LEVEL_ERROR, "Invalid UUID"); goto handle_error; } #if RECOVERY_FW if (!uuid_is_system(&meta->app_uuid)) { PBL_LOG(LOG_LEVEL_ERROR, "Found PPoGATT server from non-Pebble app, not connecting in PRF.."); goto handle_error; } #endif // Use the highest version that both ends support: client->versi...
if (client != NULL) { meta = client->characteristics.meta; data = client->characteristics.data; }
BLECharacteristic char1 = num_characteristics > 0 ? characteristics[0] : 0; BLECharacteristic char2 = num_characteristics > 1 ? characteristics[1] : 0; PBL_LOG(LOG_LEVEL_WARNING, "No ppog client removed? 0x%x 0x%x vs 0x%x 0x%x", (int)meta, (int)data, (int)char1, (int)char2); } }...
resources_get_glyph_horiz_advance(&s_font_cache, 'a', &s_font_info)); cl_assert_equal_i(horiz_advance, text_resources_get_glyph_horiz_advance(&s_font_cache, 'a', &s_font_info)); } void test_text_resources__horiz_advance_multiple(void) { uint32_t gothic_18_handle = RESOURCE_ID_GOTHIC_18; cl_assert(text_reso...
cl_assert(horiz_advance != 0)
; cl_assert_equal_i(horiz_advance, text_resources_get_glyph_horiz_advance(&s_font_cache, WILDCARD_CODEPOINT, &s_font_info)); const GlyphData *glyph = text_resources_get_glyph(&s_font_cache, WILDCARD_CODEPOINT, ...
uted 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 "comm/ble/gatt_client_discovery.h" #include "comm/ble/gatt_service...
gatt_client_discovery_discover_all(&device)
, BTErrnoInvalidParameter); cl_assert_equal_b(fake_gatt_is_service_discovery_running(), false); } void test_gatt_client_discovery__already_in_progress(void) { BTDeviceInternal device = prv_connected_dummy_device(1); // Start discovery for device: cl_assert_equal_i(gatt_client_discovery_dis...
/* * 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...
{ // Ensure that write protection is enabled on the mx25u if (qspi_flash_write_protection_enable(QSPI_FLASH) == S_SUCCESS) { // after flash protection is enabled, full array is locked. Unlock it. qspi_flash_unlock_all(QSPI_FLASH); } }
} status_t flash_impl_write_protect(FlashAddress start_sector, FlashAddress end_sector) { if (!s_flash_protection_supported) { return S_SUCCESS; // If not supported, pretend protection succeeded. } FlashAddress block_addr = start_sector; while (block_addr <= end_sector) { uint32_t block_size; if ...
.h" #include "applib/graphics/utf8.h" #include "applib/graphics/text_layout_private.h" #include "clar.h" #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> /////////////////////////////////////////////////////////// // Stubs #include "stubs_logging.h" #include "stubs_passert.h" #include...
cl_assert(iter_next(&word_iter))
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ OS_TASK_NOTIFY(DialogTaskList[DialogTask_HostTrans], 0, eNoAction); }
} static void prv_reenable_spi_cs_wakeup_interrupt_handling(void) { hw_wkup_reset_interrupt(); HW_WKUP_REG_SETF(CTRL, WKUP_ENABLE_IRQ, 1); } static void prv_sample_spi_cs_and_unblock_loop_if_needed(void) { // Sample CS, to handle case where the edge was missed: bool is_cs_asserted = !hw_gpio_get_pin_status(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...
{ PBL_LOG(LOG_LEVEL_INFO, "Boot FPGA bitstream already in flash."); }
else { PBL_LOG(LOG_LEVEL_INFO, "Writing boot FPGA bitstream to flash..."); mfg_info_write_boot_fpga_bitstream(); } }