prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ cl_assert_equal_p(context, &s_context); return (value > 0); }
void test_stats__filtered_count(void) { const int32_t data[] = { 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0 }; const size_t num_data = ARRAY_LENGTH(data); const StatsBasicOp op = StatsBasicOp_Count; int32_t result; stats_calculate_basic(op, data, num_data, prv_filter, &s_context, &result)...
prv_enable_system_task_cb, context); } void hrm_init(HRMDevice *dev) { PBL_ASSERTN(dev->state->enabled_state == HRMEnabledState_Uninitialized); dev->state->lock = mutex_create(); dev->state->timer = new_timer_create(); dev->state->enabled_state = HRMEnabledState_Disabled; // Boot up the HRM so that we can ...
gpio_output_set(&dev->en_gpio, false)
; } void hrm_enable(HRMDevice *dev) { if (!dev->state->lock) { PBL_LOG(LOG_LEVEL_DEBUG, "Not an HRM Device."); return; } mutex_lock(dev->state->lock); prv_enable(dev); mutex_unlock(dev->state->lock); } void hrm_disable(HRMDevice *dev) { if (!dev->state->lock) { PBL_LOG(LOG_LEVEL_DEBUG, "Not a...
me); ancs_app_destroy_buffer(&app_data_out); } void test_ancs_app_storage__overwrite(void) { ANCSAppData app_data = { .bundle_id = "com.getpebble.PebbleApp", .display_name = "Pebble", .flags = ANCSAppIsBlocked, }; app_data.is_meta_changed = true; ancs_app_storage_save(&app_data); app_data.dis...
(apps[i].bundle_id, app_data_out.bundle_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...
kernel_free(*buf)
; *buf = NULL; } s_last_pebble_event = (PebbleEvent) {}; } void fake_event_reset_count(void) { s_fake_event_count = 0; } uint32_t fake_event_get_count(void) { return s_fake_event_count; } void fake_event_set_callback(FakeEventCallback cb) { s_fake_event_cb = cb; }
conds_until_daily_time(&time, 0, 0); seconds_until_update = MIN(seconds_until_update, seconds_until_midnight); } } if (s_data.is_in_schedule_period == is_enable_next) { // Coming out of scheduled DND with manual DND on, turning it off if (is_enable_next && do_not_disturb_is_manually_enabled()) { ...
(type, !alerts_preferences_dnd_is_schedule_enabled(type))
; prv_try_update_schedule_mode_callback(true); } void do_not_disturb_init(void) { s_data = (DoNotDisturbData) { .update_timer_id = new_timer_create(), .was_active = false, }; prv_try_update_schedule_mode((void*) true); } void do_not_disturb_handle_clock_change(void) { prv_try_update_schedule_mode_ca...
/* * 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_snprintf(str, STR_SIZE, "%d %td%s", 4, 42, "b")
; cl_assert_equal_s(str, "4 42b"); //---------------------------------------------------- pbl_snprintf(str, STR_SIZE, "ab%%c % E zz", 1.0); cl_assert_equal_s(str, fp_msg); pbl_snprintf(str, STR_SIZE, "ab%%c % d zz", 42); cl_assert_equal_s(str, "ab%c 42 zz"); //------------------------------------------...
xQueueSendFromISR(s_work_queue, &work, &should_context_switch)
; // Wake up the thread to process the work item we just added. // Reuse the previous bool since we don't actually care about the above result. No one blocks // on the above queue, only this semaphore. xSemaphoreGiveFromISR(s_wake_srv_loop, &should_context_switch); return (should_context_switch == pdTRUE); ...
(*session)); *session = (const CommSession) { .transport = transport, .transport_imp = implementation, .destination = destination, .max_out_payload_length = COMM_MAX_OUTBOUND_PAYLOAD_SIZE, }; const size_t max_pp_msg_size = session->max_out_payload_length + sizeof(PebbleProtocolHeader); // If th...
(session->temp_write_buffer + session->bytes_written, data, length)
; session->bytes_written += length; return true; } void comm_session_send_buffer_end_write(SendBuffer *sb) { CommSession *session = (CommSession *) sb; cl_assert(session); cl_assert(session->temp_write_buffer); const PebbleProtocolHeader pp_header = { .length = session->bytes_written, .endpoint_id...
t Recognizer *recognizer, const TouchEvent *touch_event) { bool *allow = recognizer_get_user_data(recognizer); return *allow; } void test_recognizer__handle_touch_events_filter_cb(void) { RecognizerState new_state; bool updated = false; TouchEvent last_touch_event = { .type = TouchEvent_Liftoff }; s_test_i...
recognizer_list_iterate(&list, prv_list_iterator, &end)
; cl_assert_equal_i(s_list_idx, 2); }
/* * 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 GetBytesObjectCoredump: return GetBytesStorageTypeCoredump; case GetBytesObjectFile: return GetBytesStorageTypeFile; case GetBytesObjectFlash: return GetBytesStorageTypeFlash; default: WTF; return GetBytesStorageTypeUnknown; }
} bool gb_storage_setup(GetBytesStorage *storage, GetBytesObjectType object_type, GetBytesStorageInfo *info) { for (unsigned int i = 0; i < ARRAY_LENGTH(s_get_bytes_impls); i++) { if (s_get_bytes_impls[i].type == prv_get_storage_type_for_object(object_type)) { storage->impl = &s_get_b...
/* * 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 to; }
uint32_t interpolate_moook_duration() { return 0; } int64_t interpolate_moook_soft(int32_t normalized, int64_t from, int64_t to, int32_t num_frames_mid) { return to; } uint32_t interpolate_moook_soft_duration(int32_t num_frames_mid) { return 0; } // Fakes ///////////////////// ...
== APP_MSG_OK) { s_sent_callback(&s_outbox_iterator, context); } else { s_failed_callback(&s_outbox_iterator, result, context); } } static void prv_app_message_setup(void) { s_inbox_size = 0; s_outbox_size = 0; s_outbox_buffer = NULL; s_app_message_outbox_send_call_count = 0; s_is_outbox_message...
ARRAY_LENGTH(tuplets)
, \ buffer, &buffer_size); \ cl_assert_equal_i(DICT_OK, result); \ for (Tuple *expected_t = dict_read_first(&expected_it); expected_t != NULL; \ expected_t = dict_read_next(&expected_it)) { \ Tuple *found_t = dict_find(&s_outbox_iterator, expecte...
456_gmt, advance, advance, 1); } void test_cron__dst_simple_from(void) { // Dec 21st, 01:00:00 local CronJob test_cron = { .cb = prv_cron_callback, .cb_data = (void*)0, .minute = 0, .hour = 1, .mday = 20, .month = 11, .may_be_instant = true, }; // 2015 Dec 21, 01:00:00 GMT const...
(cron_service_get_job_count(), ARRAY_LENGTH(jobs) + 1)
; fake_rtc_increment_time(0); cron_service_wakeup(); cl_assert_equal_i((uintptr_t)jobs[0].cb_data, 1); cl_assert_equal_i((uintptr_t)new_job.cb_data, 2); cl_assert_equal_i(cron_service_get_job_count(), 6); fake_rtc_increment_time(SECONDS_PER_DAY * 60); cron_service_wakeup(); cl_assert_equal_i(cron_ser...
/* * 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 false; }
const uint8_t arg = (instr & 0xff); printf("\nbkpt %"PRIu8"! no dbgr?\n\n", arg); return true; } void HardFault_HandlerC(uint32_t *fault_args) { // Save the fault_args pointer for later g_stacked_regs = fault_args; bool is_bkpt = prv_handle_hardfault_due_to_bkpt(); uint32_t stacked_lr = g_stacked_reg...
rage_get_active_gateway(&id_out, &type_out); cl_assert(!ret); ret = bt_persistent_storage_has_active_bt_classic_gateway_bonding(); cl_assert(!ret); ret = bt_persistent_storage_has_active_ble_gateway_bonding(); cl_assert(!ret); // Manually set the active gateway bt_persistent_storage_set_active_gateway(id...
cl_assert(ret)
check_atan2(int16_t x, int16_t y) { int32_t ours = atan2_lookup(y, x) * 180 / TRIG_PI; double theirs = atan2(y, x) / 3.14159 * 180; // atan2 returns in range [-pi, +pi], but we have [0,2pi]. if (theirs < 0) theirs += 360; cl_assert(abs(ours - (int) theirs) < 3); // Allow 3 degrees difference max } static do...
(4, min, max)
ltiple_terms_silence_and_loop_around(void) { BLEAdData *ad = create_ad("yo", NULL); GAPLEAdvertisingJobTerm advert_terms[] = { { .min_interval_slots = 160, .max_interval_slots = 240, .duration_secs = 1, }, { .min_interval_slots = 320, .max_interval_slots = 480, .du...
regular_timer_fire_seconds(1)
; } } cl_assert(!gap_le_is_advertising_enabled()); cl_assert_equal_i(s_unscheduled_cb_count, 1); cl_assert_equal_p(s_unscheduled_job, job); // Expect no advertisement timer cl_assert_equal_i(regular_timer_seconds_count(), 0); free(ad); } void test_gap_le_advert__job_round_robin(void) { GAPLEAdve...
oid *packet, size_t length) { Command *command = packet; if (length) { switch (command->opcode) { case IMAGING_CMD_ERASE: prv_handle_erase(command, length); return; case IMAGING_CMD_WRITE: prv_handle_write(command, length); return; case IMAGING_CMD_CRC: ...
{ prv_respond_malformed_command(cmd, length, NULL); return; }
typedef struct PACKED CrcAck { uint8_t opcode; uint32_t address; uint32_t length; uint32_t crc; } CrcAck; uint32_t crc = flash_calculate_legacy_defective_checksum(cmd->crc.address, cmd->crc.length); CrcAck *ack = pulse_best_effort_send_begin(PULSE_PROTOCOL_FLASH_IMAGING); *ack = (CrcAck) {...
/* * 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_BKP_BOOTBIT_DR)
rted: action_bar_set_highlighted(action_bar, index, is_highlighted); } static void action_bar_raw_up_handler(ClickRecognizerRef recognizer, void *context) { ActionBarLayer *action_bar = (ActionBarLayer *)context; action_bar_raw_up_down_handler(recognizer, action_bar, false); } static void action_bar_raw_down_ha...
{ return; }
action_bar->background_color = background_color; layer_mark_dirty(&(action_bar->layer)); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
app_manager_get_current_app_md()
->uuid, NOT_RUNNING); } CommSession *comm_session_get_system_session(void) { return s_session; } void launcher_app_message_send_app_state_deprecated(const Uuid *uuid, bool running) { s_launcher_deprecated_messages++; cl_assert(running == (s_app_state == RUNNING ? true : false)); } bool comm_session_send_data(C...
t_compositing_mode(ctx, GCompOpSet); const int16_t margin = 8; const GRect bounds = grect_inset_internal(layer->bounds, margin, margin); GRect box = arrow_bitmap->bounds; grect_align(&box, &bounds, alignment, true); graphics_draw_bitmap_in_rect(ctx, arrow_bitmap, &box); } static void prv_draw_arrows(Layer *l...
(bitmap->info.format == GBitmapFormat2BitPalette)
; unsigned int palette_size = gbitmap_get_palette_size(bitmap->info.format); GColor *palette = task_zalloc_check(sizeof(GColor) * palette_size); for (unsigned int i = 0; i < palette_size; i++) { palette[i].argb = (bitmap->palette[i].argb & 0xc0) | (GColorCyan.argb & 0x3f); } gbitmap_set_palette(bitmap, pa...
/* * 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...
mfg_info_get_model(buffer)
; cl_assert_equal_s(buffer, ""); mfg_info_set_model("test_model"); mfg_info_get_model(buffer); cl_assert_equal_s(buffer, "test_model"); { char long_string[] = "01234567890123456789"; mfg_info_set_model(long_string); // We only expect to see the first 15 (MFG_INFO_MODEL_STRING_LENGTH - 1) chara...
/* * 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...
system_flash_erase(FLASH_BASE, 48 KiB, NULL, NULL)
); cl_assert_equal_i(BITS_BETWEEN(0, 2), erased_sector); cl_assert(flash_locked); } void callback_is_called_cb(uint32_t num, uint32_t den, void *context) { callback_called = true; cl_assert_equal_i(8675309, (uintptr_t)context); } void test_system_flash__callback_is_called(void) { cl_assert(system_flash_eras...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_p(text_node->overflow, overflow_mode)
; cl_assert_equal_p(text_node->alignment, alignment); TextLayoutExtended *layout = (TextLayoutExtended *)layout_ref; cl_assert_equal_p(text_node->line_spacing_delta, layout->line_spacing_delta); layout->max_used_size = s_data.max_used_size; } GSize graphics_text_layout_get_max_used_size(GContext *ctx, const ...
type(AlertMobile)); cl_assert(alerts_should_notify_for_type(AlertReminder)); cl_assert(!alerts_should_vibrate_for_type(AlertReminder)); alerts_set_notification_vibe_timestamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS); cl_assert(!alerts_should_enable_backlight_for_type(AlertRemi...
(AlertReminder)
{ 928, 472, -384}, { 976, 456, -368}, { 1112, 464, -392}, { 1232, 536, -424}, { 1040, 536, -464}, { 1232, 544, -360}, { 1512, 392, -152}, { 1320, 352, -216}, { 1152, 360, -288}, { 1096, 280, -208}, { 1008, 208, -152}, // 122 seconds { 896, 160, -200}, { 736, 208,...
{ 72, -264, -928}, { 64, -256, -952}, { 80, -232, -960}, { 80, -240, -952}, { 48, -264, -936}, { 56, -264, -920}, { 64, -256, -928}, { 80, -248, -960}, { 88, -248, -960}, { 88, -248, -952}, { 112, -256, -960}, { 72, -280, -960}, { 72, -256, -952}, { 72, -272, -960...
{ 64, -272, -952}, { 64, -272, -952}, { 40, -280, -952}, { 56, -272, -944}, { 56, -272, -952}, { 40, -280, -936}, { 56, -264, -936}, // 130 seconds { 32, -272, -920}, { 40, -272, -920}, { 48, -272, -944}, { 48, -272, -936}, { 40, -280, -936}, { 40, -280, -936}, ...
{ // Time-out the packet over and over until (max - 1) is reached: for (int i = 0; i < PPOGATT_TIMEOUT_TICKS; ++i) { regular_timer_fire_seconds(PPOGATT_TIMEOUT_TICK_INTERVAL_SECS); } fake_comm_session_process_send_next(); prv_assert_sent_data(s_characteristics[0][PPoGATTCharacteristicData], sn...
// The last straw: for (int i = 0; i < PPOGATT_TIMEOUT_TICKS; ++i) { regular_timer_fire_seconds(PPOGATT_TIMEOUT_TICK_INTERVAL_SECS); } prv_assert_sent_reset_request(s_characteristics[0][PPoGATTCharacteristicData]); } void test_ppogatt__make_sure_timeout_reset_after_data_ack(void) { test_ppogatt__open_s...
ut!!"); __disable_irq(); RTC_ITConfig(RTC_IT_WUT, DISABLE); RTC_WakeUpCmd(DISABLE); // disable all IRQn_Type >= 0 interrupts for (size_t i = 0; i < ARRAY_LENGTH(NVIC->ISER); i++) { NVIC->ICER[i] = NVIC->ISER[i]; } // disable SysTick SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk; enter_stop_mode(); ...
{ prompt_send_response("You must run \"bt test stop\" to conduct sleep test!"); return; }
prv_clock_reset(0); rtc_set_time(jun10th_noon_2015); // Our test event is at June 10th 2015, 14:00:00 // Now + two hours const int event_time = jun10th_noon_2015 + (2 * SECONDS_PER_HOUR); // if the event is in 1+ hours, then show the actual time instead of "In X hours" const int MAX_RELATIVE_HRS = 1; /...
(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS)
; cl_assert_equal_s("IN 30 MIN", time_buf); // June 10th 2015, 13:30:29 (T-00:29:31) rtc_set_time(event_time - (30 * SECONDS_PER_MINUTE) + 29); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("IN 30 MIN", time_buf); // June 10th 2015, 13:30:30 ...
sizeof(incomplete_put_msg)); assert_ack_count(0); assert_nack_count(1); } void test_put_bytes__commit_message_sent_while_previous_put_was_not_acked_yet(void) { uint8_t max_put_ops = prv_put_bytes_get_max_batched_pb_ops(); prv_receive_init(VALID_OBJECT_SIZE * max_put_ops, ObjectFirmware); prv_process_a...
assert_ack_count(0)
; assert_nack_count(1); } void test_put_bytes__install_message_prf_boot_bit_set(void) { prv_receive_init_put_commit_and_install(ObjectRecovery); assert_ack_count(1); assert_nack_count(0); cl_assert_equal_i((s_boot_bits_orred & BOOT_BIT_NEW_PRF_AVAILABLE), BOOT_BIT_NEW_PRF_AVAILABLE); } void test_put_bytes__...
E_DOES_NOT_EXIST) && ((op_flags & OP_FLAG_WRITE) != 0))) { res = pfs_open_handle_create_request(fd, file_type, start_size); } else if ((op_flags & OP_FLAG_READ) != 0) { res = pfs_open_handle_read_request(fd, page); } else { // unexpected situation res = E_INTERNAL; } cleanup: if (res < S_SUCCESS) ...
pfs_seek(fd, 0, FSeekSet)
; pfs_read(fd, &gcdata, sizeof(gcdata)); if (!GCDATA_VALID(gcdata.flags)) { // we never completed setting up the migration goto done; } // at this point we can erase the block prv_handle_sector_erase(gcdata.gc_start_page, false); copy_or_recover_gc_data(fd, &gcdata, false); done: pfs_close_and...
TES_COUNT, analytics_write_bytes_count, AnalyticsClient_Worker); } analytics_read_count = 0; analytics_read_bytes_count = 0; analytics_write_bytes_count = 0; } struct FlashState { bool enabled; bool sleep_when_idle; bool deep_sleep; PebbleMutex * mutex; SemaphoreHandle_t dma_semaphore; } s_flash_sta...
flash_start_cmd()
; flash_send_and_receive_byte(FLASH_CMD_WAKE); flash_end_cmd(); // wait a sufficient amount of time to enter standby mode // It appears violating these timing conditions can lead to // random bit corruptions on flash writes! delay_us(100); s_flash_state.deep_sleep = false; } } void handl...
// TODO: check reason and act upon it const OutboxMsgType sent_msg_type = s_state.out.msg_type; s_state.out.msg_type = OutboxMsgTypeNone; const bool is_sent_successfully = (reason == APP_MSG_OK); // Process the (N)ACK: switch (sent_msg_type) { case OutboxMsgTypeControl: { if (is_sent_successfu...
{ DBG("No handler registered for %s", event_type); }
_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornerBottomRight); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_bottomright.${BIT_DEPTH_NAME}.pbi")); } void test_graphics_fill_rect_${BIT_DEPTH_NAME}__origin_aa_corners(void) { GContext ctx; test_graphics_cont...
GSize(4, 10)
, GCornersAll, 4), 2); cl_assert_equal_i(prv_clamp_corner_radius(GSize(5, 10), GCornersAll, 4), 2); cl_assert_equal_i(prv_clamp_corner_radius(GSize(6, 10), GCornersAll, 4), 3); cl_assert_equal_i(prv_clamp_corner_radius(GSize(7, 10), GCornersAll, 4), 3); cl_assert_equal_i(prv_clamp_corner_radius(GSize(8, 10), GC...
fo, ARRAY_LENGTH(sg_info)); } static void prv_read_modify_write(uint8_t reg, uint8_t value, uint8_t mask) { uint8_t new_val = bmi160_read_reg(reg); new_val &= ~mask; new_val |= value; prv_write_reg(reg, new_val); } static void prv_run_command(uint8_t command) { prv_write_reg(BMI160_REG_CMD, command); if (...
(sensor_timestamp_after)
; uint32_t sample_time_bit = prv_get_sample_collection_bit(); // see if the upper bits oveflowed uint32_t upper_bits_mask = ~((0x1 << sample_time_bit) - 1); start_time &= upper_bits_mask; end_time &= upper_bits_mask; return (start_time != end_time); } // Converts the sensor time from the BMI160 captured...
char *pace_string; char *custom_label_string; char *custom_value_string; } SportsData; static SportsData s_sports_data; static bool prv_is_sports_paused(void) { return false; } static bool prv_sports_pause(bool should_be_paused) { return false; } static void prv_metric_to_string(WorkoutMetricType type, char *buff...
health_util_get_pace(84, 1234)
(attr->uint32_list->num_values)
; default: // The rest of the types fit within the Attribute struct return 0; } } static bool prv_deep_copy_attribute(Attribute *dest, const Attribute *src, uint8_t **buffer, uint8_t *const buffer_end) { const size_t attribute_length = prv_get_attribute_length(sr...
} static void prv_app_focus_handler(PebbleEvent *e, void *context) { DictationSession *session = context; if (e->app_focus.in_focus) { event_service_client_subscribe(&session->dictation_result_sub); voice_window_regain_focus(session->voice_window); } else { event_service_client_unsubscribe(&session->...
{ return result; }
ue, color); simple_dialog_push(simple_dialog, prv_get_window_stack()); } static void prv_push_long_error_dialog(VoiceUiData *data, const char* header, const char *text, uint32_t resource_id) { prv_set_mic_window_state(data, StateError); ExpandableDialog *long_error_dialog = &data->long_error_dialog; expan...
VOICE_LOG("Handling ready event")
ess_manager_send_callback_event_to_process(PebbleTask task, void (*callback)(void *data), void *data) { callback(data); } void accessory_imaging_enable(bool enable) { } // Tests /////////////////////////////////////////////////////////////////////////////// stati...
cl_assert(timer)
ing from token + 1 to skip the '*' at the front strncpy(state->test_entry.name, token + 1, sizeof(state->test_entry.name)); printf("\nParsing function samples: %s", state->test_entry.name); continue; } // Look for and parse the expected values if (strcmp(token, "//>") == 0) { token ...
strcmp(token, "TEST_DEEP")
} *sum = *sum + *D; } // API Functions //////////////////////////////////////////////////////////////////////////////////////////////////// HealthData *health_data_create(void) { return (HealthData *)app_zalloc_check(sizeof(HealthData)); } void health_data_destroy(HealthData *health_data) { app_free(health_d...
{ health_data->step_data[0] = new_steps; health_data_update_step_derived_metrics(health_data); }
void health_data_update_sleep(HealthData *health_data, uint32_t new_sleep, uint32_t new_deep_sleep) { health_data->sleep_data[0] = new_sleep; health_data->deep_sleep = new_deep_sleep; } void health_data_update_current_bpm(HealthData *health_data) { health_data->resting_hr_bpm = ac...
_free(dump); } void test_window_stack__pop_all_modals(void) { Window *windows[NumModalPriorities]; WindowStack *window_stacks[NumModalPriorities]; for (ModalPriority idx = ModalPriorityMin; idx < NumModalPriorities; idx++) { window_stacks[idx] = modal_manager_get_window_stack(idx); windows[idx] = window...
(window_stack_count(stack), 2)
; cl_assert_equal_i(prv_get_load_unload_count(), 2); cl_assert_equal_i(prv_get_appear_disappear_count(), 1); window_stack_pop_all(stack, true); cl_assert_equal_i(window_stack_count(stack), 2); cl_assert_equal_i(prv_get_load_unload_count(), 2); cl_assert_equal_i(prv_get_appear_disappear_count(), 2); cl_a...
mmap_buffer[i], (int)want); break; } } } // clean up flash_erase_sector_blocking(TEST_ADDR); if (!flash_sector_is_erased(TEST_ADDR)) { prompt_send_response("FAIL: sector not erased"); return; } prompt_send_response("OK"); } //! Some flash chips have an accelerated method of che...
{ while(1); }
void stuck_timer_cb(void* data) { while(1); } #include "services/common/new_timer/new_timer.h" void command_stuck_timer(void) { TimerID timer = new_timer_create(); new_timer_start(timer, 10, stuck_timer_cb, NULL, 0 /*flags*/); } #include "drivers/rtc.h" void command_assert_fail(void) { prompt_command_finis...
pairing_info_out->is_remote_identity_info_valid = ble_data->is_remote_identity_info_valid; pairing_info_out->is_remote_signing_info_valid = ble_data->is_remote_signing_info_valid; } if (name_out) { strncpy(name_out, data.ble_data.name, BT_DEVICE_NAME_BUFFER_SIZE); } if (requires_address_pinning_out) { ...
{ *link_key_out = data.bt_classic_data.link_key; }
/* * 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...
{ flash_erase_sector_blocking(i); }
// Erase the trailing subsectors for (int32_t i = sector_end; i < subsector_end; i += SUBSECTOR_SIZE_BYTES) { flash_erase_subsector_blocking(i); } } else { // Can't erase any full sectors, just erase subsectors the whole way. for (int32_t i = subsector_start; i < subsector_end; i += SUBSEC...
active_window->workout_data); #if PBL_RECT /// MI/KM units string const char *units_string = active_window->workout_controller->get_distance_string( i18n_noop("MI"), i18n_noop("KM")); GTextNodeText *units_text_node = health_util_create_text_node_with_text( i18n_ge...
active_window->workout_controller->get_distance_string(i18n_noop("MPH"), i18n_noop("KM/H"))
; GTextNodeText *units_text_node = health_util_create_text_node_with_text( i18n_get(units_string, i18n_owner), units_font, TEXT_COLOR, container); units_text_node->node.offset.y = units_offset_y; #endif break; } // don't have default here so when we have a new type, we don't forget t...
MusicCommandPlay: return 0x00; case MusicCommandPause: return 0x01; case MusicCommandTogglePlayPause: return 0x02; case MusicCommandNextTrack: return 0x03; case MusicCommandPreviousTrack: return 0x04; case MusicCommandVolumeUp: return 0x05; case MusicCommandVo...
cl_assert_equal_i(s_conn_mgr_states[BtConsumerMusicServiceIndefinite].state, ResponseTimeMax)
; } void test_ams__music_request_low_latency_for_period(void) { prv_connect_ams(); const uint32_t period_s = 1234; music_request_low_latency_for_period(period_s * 1000); cl_assert_equal_i(s_conn_mgr_states[BtConsumerMusicServiceMomentary].state, ResponseTimeMin); cl_assert_equal_i(s_conn...
/* * 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...
(USART1, &USART_InitStructure)
; /* Enable USART */ USART_Cmd(USART1, ENABLE); } static void prv_putchar(uint8_t c) { while (USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET) continue; USART_SendData(USART1, c); while (USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET) continue; } void dbgserial_print(const char* str) { for (; *s...
nvert from 8 bits in a byte, taking care to round up to the next whole byte. const uint32_t required_row_size_bytes = (required_row_size_bits + 7) / 8; if (data_size != required_total_size_bytes || required_row_size_bytes > bitmap->row_size_bytes) { PBL_LOG(LOG_LEVEL_WARNING, "Bitmap metadata is inconsis...
PBL_ASSERTN(!process_manager_compiled_with_legacy2_sdk())
; if (bitmap && palette) { if (gbitmap_get_info(bitmap).is_palette_heap_allocated) { applib_free(bitmap->palette); } bitmap->palette = palette; bitmap->info.is_palette_heap_allocated = free_on_destroy; } } GRect gbitmap_get_bounds(const GBitmap *bitmap) { if (!bitmap) { return GRectZero...
{ 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->or...
{ case GAlignCenter: { rect->origin.x = ((inside_rect->size.w - rect->size.w) / 2) + inside_rect->origin.x; rect->origin.y = ((inside_rect->size.h - rect->size.h) / 2) + inside_rect->origin.y; return; } case GAlignTopLeft: { rect->origin.x = inside_rect->origin.x; rect->origin....
rect->origin.x = inside_rect->origin.x; rect->origin.y = (inside_rect->size.h - rect->size.h) + inside_rect->origin.y; return; } } } GRect grect_crop(GRect rect, const int32_t crop_size_px) { int16_t cropped_width = rect.size.w - 2 * crop_size_px; int16_t cropped_height = rect.size.h - 2 *...
ailure message. The phone will retry later. return E_BUSY; } } //! SettingsFileEachCallback function is used to iterate over all keys and find the largest //! AppInstallId currently being using. static bool prv_each_inspect_ids(SettingsFile *file, SettingsRecordInfo *info, void *context) { // check entry is va...
info->get_val(file, (uint8_t *)cb_data->entry_buf, info->val_len)
; // check return value cb_data->cb(id, cb_data->entry_buf, cb_data->data); return true; // continue iteration } void app_db_enumerate_entries(AppDBEnumerateCb cb, void *data) { status_t rv = prv_lock_mutex_and_open_file(); if (rv != S_SUCCESS) { return; } AppDBEntry *db_entry = kernel_malloc_chec...
/* * 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...
check_atan2(-6, -310)
; check_atan2(15000, -19); check_atan2(34, -3200); check_atan2(-1508, 299); check_atan2(1020, 1002); } void test_math__ceil_log_two(void) { check_ceil_log_two(4); check_ceil_log_two(5); check_ceil_log_two(100); check_ceil_log_two(256); check_ceil_log_two(123456); } void test_math__sign_extend(void) ...
lock, true); regular_timer_remove_callback(&s_as7000_watchdog_timer); s_missing_interrupt_count = 0; } static bool prv_start_loader(HRMDevice *dev) { // check if the loader is already running if (!prv_is_app_running(dev, AS7000AppId_Loader)) { PBL_LOG(LOG_LEVEL_DEBUG, "Switching to loader"); // we need...
chunk, load_length); if (!prv_write_register_block(dev, ADDR_LOADER_STATUS, data_record, IHEX_RECORD_LENGTH(load_length))) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to write hex record"); return false; } // Wait for the loader to be ready...
// Write the EOF record, telling the loader that the image has been // fully written. uint8_t eof_record[IHEX_RECORD_LENGTH(0)]; ihex_encode(eof_record, IHEX_TYPE_EOF, 0, NULL, 0); if (!prv_write_register_block(dev, ADDR_LOADER_STATUS, eof_record, IHEX_RECORD_LENGTH(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...
(true /* should_shutdown */)
s.entries[0].fired_time_ms - start_ms <= 1); cl_assert(s_started_handler_calls.entries[0].context == context); cl_assert_equal_i(s_stopped_handler_calls.num_calls, 1);; cl_assert(s_stopped_handler_calls.entries[0].fired_time_ms - start_ms >= duration); cl_assert(s_stopped_handler_calls.entries[0].context == co...
(s_teardown_handler_calls.entries[0].fired_time_ms - start_ms >= duration)
_set(ANALYTICS_APP_METRIC_FLASH_READ_COUNT, s_analytics_read_count, AnalyticsClient_Worker); analytics_set(ANALYTICS_APP_METRIC_FLASH_READ_BYTES_COUNT, s_analytics_read_bytes_count, AnalyticsClient_Worker); analytics_set(ANALYTICS_APP_METRIC_FLASH_WRITE_BYTES_COUNT, ...
{ if (s_erase.suspended) { status_t status = flash_impl_erase_resume(s_erase.address); PBL_ASSERT(PASSED(status), "Erase resume failure: %" PRId32, status); s_erase.suspended = false; } }
static void prv_erase_suspend_timer_cb(void *unused) { mutex_lock(s_flash_lock); prv_erase_resume(); mutex_unlock(s_flash_lock); } void flash_read_bytes(uint8_t* buffer, uint32_t start_addr, uint32_t buffer_size) { mutex_lock(s_flash_lock); s_analytics_read_count++; s_analytics_read...
/* * 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...
(strrchr(testbuf, '\0'), testbuf+7)
; }
/* * 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_command_list[0].type, SectorEraseCommand)
; s_command_list_index = 0; // Erase two sectors 0x10000 - 0x30000 but allow us to erase more flash_region_erase_optimal_range(0, 64 * 1024, 3 * 64 * 1024, 4 * 64 * 1024); cl_assert_equal_i(s_command_list_index, 2); cl_assert_equal_i(s_command_list[0].addr, 64 * 1024); cl_assert_equal_i(s_command_list[0...
Not advertising for reconnection ReconnectType_Plain, // Advertising for reconnection with empty payload ReconnectType_BleHrm // Advertising for reconnection with HRM payload } ReconnectType; // ----------------------------------------------------------------------------- //! Static, internal helper functions sta...
bt_unlock()
; } // ----------------------------------------------------------------------------- void gap_le_slave_reconnect_start(void) { #if RECOVERY_FW return; // Only use discoverable packet for PRF #endif bt_lock(); { if (prv_is_advertising_for_reconnection()) { // Already advertising for reconnection... ...
break; case MusicEndpointPlaybackStatePlaying: player_state_update.playback_state = MusicPlayStatePlaying; break; case MusicEndpointPlaybackStateRewinding: player_state_update.playback_state = MusicPlayStateRewinding; break; case MusicEndpointPlaybackStateForwarding: playe...
{ return; }
prv_send_music_command_to_handset(pp_command); } static MusicServerCapability prv_music_get_capability_bitset(void) { if (comm_session_has_capability(comm_session_get_system_session(), CommSessionExtendedMusicService)) { if (s_progress_reporting_supported) { return (Mu...
terator)); #endif cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[1].header.id)); cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[0].header.id)); cl_assert(iter_prev(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[1].header.id)); #if ...
uuid_equal(&first_all_day_event, &state.pin.header.id)
EBBLE_APP_KILL_EVENT // to expedite exiting the application event_reset_from_process_queue(task); event_put_from_process(task, &event); } // --------------------------------------------------------------------------------------------- //! Init the context variables for a task. void process_manager_init_context...
{ if (!process_manager_check_SDK_compatible(id)) { return; } // This is a third party flash 3.0 app install if (prv_needs_fetch(id, &md, is_worker)) { PBL_LOG(LOG_LEVEL_DEBUG, "Cache entry did not exist on launch attempt"); // Freed in app_fetch_ui.c AppFetchUIArgs *fetch...
#endif // we either came here if PRF or if we didn't start a fetch // md is either already initialized, or we took a code path that didn't try if (!md) { md = app_install_get_md(id, is_worker); } if (!md) { PBL_LOG(LOG_LEVEL_ERROR, "Tried to launch non-existant app!"); return; } #if !RECOVERY...
1464820884 (Wed, 1 June 2016 22:41:26 GMT) }; static const uint8_t s_app_glance_with_invalid_slice_total_sizes[] = { // Version APP_GLANCE_DB_CURRENT_VERSION, // Creation time 0x14, 0x13, 0x4E, 0x57, // 1464734484 (Tue, 31 May 2016 22:41:24 GMT) // Slice 1 (valid) 0x0B, 0x00, ...
app_glance_db_read((uint8_t *)&APP_GLANCE_TEST_UUID, UUID_SIZE, invalid_glance_out, glance_size)
, E_INVALID_ARGUMENT); } void test_app_glance_db__basic_glance_blob_delete(void) { // Call the basic glance blob insert test to insert the basic glance blob test_app_glance_db__basic_glance_blob_insert_and_read(); // Delete the basic glance blob cl_assert_equal_i(app_glance_db_delete((uint...
n_config_large, }; static const TimeSelectionSizeConfig *prv_selection_config(void) { const PreferredContentSize runtime_platform_default_size = system_theme_get_default_content_size_for_runtime_platform(); return s_time_selection_configs[runtime_platform_default_size]; } // FROM selection layer callbacks s...
(from_selection_layer, color)
; selection_layer_set_inactive_bg_color(from_selection_layer, GColorDarkGray); selection_layer_set_callbacks(from_selection_layer, time_range_selection_window, (SelectionLayerCallbacks) { .get_cell_text = prv_handle_from_get_text, .complete = prv_handle_from_complete, .increment = prv_handle_from_...
by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "gat...
(&char_dest->uuid, uuid_str)
; PBL_LOG(LOG_LEVEL_DEBUG, " Found Characteristic %s Handle 0x%"PRIx16, uuid_str, item->c.value_handle); } else if (item->type == GATTC_ITEM_TYPE_DESCRIPTOR) { if (char_dest == NULL) { PBL_LOG(LOG_LEVEL_ERROR, "No characteristic found for descriptor! handle=0x%x", ...
/* * 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...
(build_id_string)
; char *log_build_id = &buf[tot_len - id_len]; bool log_contains_build_id = (memcmp(log_build_id, build_id_string, id_len) == 0); cl_assert(log_contains_build_id); } return true; } bool s_completed = false; bool s_completed_success = false; static void prv_flash_log_dump_completed_cb(bool suc...
event_payload(void *buffer) { static TestPLParsedMsg s_parsed_msg; static pebble_pipeline_Event events[10]; static Uuid event_uuids[10]; static ActivitySession event_sessions[10]; s_parsed_msg = (TestPLParsedMsg) { .events = { .num_events = ARRAY_LENGTH(events), .events = events, .uuid...
(a->msrmt.values, b->msrmt.values, b->msrmt.num_values * sizeof(uint32_t))
; } else if (a->type == ProtobufLogType_Events) { cl_assert_equal_i(a->events.num_events, b->events.num_events); cl_assert_equal_i(a->events.num_sessions, b->events.num_sessions); for (int i = 0; i < a->events.num_events; i++) { const pebble_pipeline_Event *a_event = &a->events.events[i]; cons...
/* * 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 (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(event_blob, sizeof(*event_blob)); }
if (!prv_is_event_allowed(event_blob)) { syscall_failed(); } analytics_logging_log_event(event_blob); } DEFINE_SYSCALL(void, sys_analytics_max, AnalyticsMetric metric, int64_t val, AnalyticsClient client) { analytics_max(metric, val, client); }
}, { 0, 0x8b, 0, 155, 0}, { 0, 0x8b, 0, 155, 0}, { 0, 0x8b, 0, 155, 0}, { 0, 0x8b, 0, 155, 0}, { 0, 0x8b, 0, 154, 0}, { 0, 0x8b, 0, 155, 0}, { 0, 0x8b, 0, 155, 0}, { 0, 0x8b, 0, 162, 0}, { 0, 0x8b, 0, 163, 0}, { 0, 0x8b, 0, 162, 0}, // 135: Local time: 08:26:00 PM { 0, 0x...
{ 0, 0x71, 0, 149, 0}, { 0, 0x71, 0, 149, 0}, { 0, 0x71, 0, 149, 0}, { 0, 0x71, 0, 147, 0}, // 240: Local time: 10:11:00 PM { 0, 0x71, 0, 149, 0}, { 0, 0x71, 0, 149, 0}, { 0, 0x71, 0, 149, 0}, { 0, 0x71, 0, 149, 0}, { 0, 0x71, 0, 151, 0}, { 0, 0x71, 0, 150, 0}, { 0, 0x71,...
{ 0, 0x71, 0, 151, 0}, { 0, 0x71, 0, 150, 0}, { 0, 0x70, 1157, 166, 0}, { 27, 0x33, 2564, 191, 0}, { 16, 0x26, 5309, 149, 0}, { 0, 0x45, 63, 146, 0}, { 0, 0x36, 221, 149, 0}, { 0, 0x36, 0, 149, 0}, { 0, 0x36, 0, 149, 0}, { 0, 0x36, 0, 149, 0}, { 0, 0x36, 0, 148, 0}, // 3...
tem.app_uuid); // Get s_tx_window_size packets in flight: uint8_t secs_passed = 0; for (sn = 0; sn < s_tx_window_size; ++sn) { cl_assert_equal_b(fake_comm_session_send_buffer_write_raw_by_transport(transport, s_short_data_fragment, ...
prv_assert_sent_data(s_characteristics[0][PPoGATTCharacteristicData], sn, s_short_data_fragment, sizeof(s_short_data_fragment) - sn)
; for (int j = 0; j < PPOGATT_TIMEOUT_COUNT_MAX - 1; ++j) { // Time-out the packet over and over until (max - 1) is reached: for (int i = 0; i < PPOGATT_TIMEOUT_TICKS; ++i) { regular_timer_fire_seconds(PPOGATT_TIMEOUT_TICK_INTERVAL_SECS); } fake_comm_session_process_send_next(); prv_assert_...
" 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 <stdint.h> #include <stdbool.h> #include <stdlib.h> #include <string.h> #include <sys/time.h> #include "applib/ui/a...
{ if (!animation) { return false; } ((AnimationPrivate*)animation)->scheduled = false; return true; }
*action_result = e->sys_notification.action_result; if (action_result == NULL || (data->response.ignore_failures && action_result->type != ActionResultTypeSuccess)) { const bool success = false; prv_cleanup_action_result(data, success); return; } char uuid_string[UUID_STRING_BUFFER_LENGTH]; ...
(data, ignore_failures)
rl_reg = mode & ~MODE_MASK; fifo_ctrl_reg |= (MODE_BYPASS & MODE_MASK); if (!prv_write_register(LIS3DH_FIFO_CTRL_REG, fifo_ctrl_reg)) { return; } if (!prv_write_register(LIS3DH_FIFO_CTRL_REG, mode)) { return; } } } static void prv_reset(void) { lis3dh_lock(); if (i2c_bitbang_reco...
{ PBL_ASSERTN(s_initialized); if (s_running) { disable_accel_interrupts(); clear_accel_interrupts(); i2c_release(I2C_LIS3DH); enable_accel_interrupts(); s_running = false; } }
of changing the interval in the handler. recognizer->hold_timer = app_timer_register(recognizer->config.click.repeat_interval_ms, (AppTimerCallback)prv_auto_repeat_single_click, recognizer); recognizer->is_repeating = true; // Fire right once: const bool needs_reset = false; prv_dispatch_event(recogn...
if (recognizer->config.multi_click.last_click_only && (recognizer->number_of_clicks_counted >= prv_multi_click_get_min(recognizer)) && (recognizer->number_of_clicks_counted <= prv_multi_click_get_max(recognizer))) { const bool needs_reset = true; prv_dispatch_event(recognizer, ClickHandlerOffsetMult...
} void command_put_button_event(const char* button_index, const char* click_type) { int button = atoi(button_index); const bool needs_reset = false; ClickHandlerOffset offset; if ((button < 0 || button > NUM_BUTTONS)) { return; } switch(*click_type) { case 's': offset = ClickHandlerOffset...
ree(tmp); tmp = next; } if (connection->ppogatt_wa_state) { ppogatt_destroy_state(connection->ppogatt_wa_state); } kernel_free(connection); } } prv_unlock(); } bool connection_is_valid(Connection *connection) { bool rv; prv_lock(); { rv = list_contains((ListN...
{ Connection *connection = connection_by_idx(conn_idx); if (connection) { rv = connection->last_pairing_result; } }
char buf[sz + 1]; memset(buf, 0, sz + 1); jerry_string_to_utf8_char_buffer(value, (jerry_char_t *)buf, sz); rv = strtoul(buf, NULL, 0); } return rv; } int32_t jerry_get_int32_value(jerry_value_t value) { return (int32_t)(round(jerry_get_number_value(value))); } int32_t jerry_get_angle_value(jer...
{ return rocky_add_function(jerry_create_undefined(), name, handler); }
jerry_value_t rocky_add_constructor(char *name, jerry_external_handler_t handler) { JS_VAR prototype = jerry_create_object(); JS_VAR rocky_object = rocky_get_rocky_singleton(); JS_VAR constructor = rocky_get_or_create_object(rocky_object, name, prv_create_functi...
/* * 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...
{ gbitmap_sequence_restart(sequence_reel->sequence); }
return gbitmap_sequence_update_bitmap_by_elapsed(sequence_reel->sequence, sequence_reel->render_bitmap, sequence_reel->elapsed_ms); } static uint32_t prv_duration_getter(KinoReel *reel) { KinoReelImplGBitmapSequ...
ine TINTIN_MODEL(model_str) NULL #endif // PLATFORM_TINTIN #if PLATFORM_SNOWY # define SNOWY_MODEL(model_str) model_str #else # define SNOWY_MODEL(model_str) NULL #endif // PLATFORM_SNOWY #if PLATFORM_SPALDING # define SPALDING_MODEL(model_str) model_str #else # define SPALDING_MODEL(model_str) NULL #endif // PLA...
("pebble_time_2_black")
; break; case WATCH_INFO_COLOR_PEBBLE_TIME_2_SILVER: model_name = ROBERT_MODEL("pebble_time_2_silver"); break; case WATCH_INFO_COLOR_PEBBLE_TIME_2_GOLD: model_name = ROBERT_MODEL("pebble_time_2_gold"); break; case WATCH_INFO_COLOR_UNKNOWN: case WATCH_INFO_...
nt) / 2; uint8_t buffer[buf_size]; CircularBuffer cb; circular_buffer_init(&cb, buffer, buf_size); PebbleHRMEvent event[NUM_TEST_EVENTS] = { { .event_type = HRMEvent_BPM, .bpm = { .bpm = 65, .quality = 5 } }, { .event_type = HRMEvent_LEDCurrent, .led = { .current_ua = 243 } }, }; { // These events...
stub_new_timer_fire(prv_get_timer_id())
; fake_system_task_callbacks_invoke_pending(); cl_assert_equal_b(hrm_is_enabled(HRM), true); // Send the next data, should be disabled again after that for (num_updates = 0; num_updates < 1000 && hrm_is_enabled(HRM); num_updates++) { prv_fake_send_new_data(); fake_system_task_callbacks_invoke_pending(...
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 in writing, softw...
("a", string_list_get_at(list, 0))
; cl_assert_equal_s("bc", string_list_get_at(list, 1)); // add a string to an empty string list list->serialized_byte_length = 0; string_list_add_string(list, 20, "hello", 10); cl_assert_equal_i(5, list->serialized_byte_length); cl_assert_equal_i(1, string_list_count(list)); cl_assert_equal_s("hello", st...
0, 0x20, 0x20, }, }; char name_2[BT_DEVICE_NAME_BUFFER_SIZE] = "Device 2"; uint8_t platform_bits_2 = 0x22; BTBondingID id_2 = bt_persistent_storage_store_bt_classic_pairing(&addr_2, &link_key_2, name_2, &platform_bits_2); prv_fire_writeback_timer...
cl_assert(id != BT_BONDING_ID_INVALID)
fle(watchface_order, num_entries); prv_test_new_order_with_filter_callback(watchface_order, num_entries, watchface_filter_callback); } } void test_app_menu_data_source__last_app_not_in_order_file(void) { // settings has to be at the beginning. The app_menu_data_sourc...
app_menu_data_source_get_node_at_index(&data_source, i)
; cl_assert_equal_i(node->install_id, desired_order[i]); } app_menu_data_source_deinit(&data_source); } void test_app_menu_data_source__complete_sorted_order(void) { // Apps are sorted in the order of Quick Launch only, Override apps, Storage (smallest first), // Record (smallest first), and finally Insta...
e 4: boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE); boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_TWO); boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_THREE); break; case 5: boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE); break; case 6: boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE); boot_bit_se...
system_hard_reset()
; } periph_config_disable(RCC_APB1PeriphClockCmd, RCC_APB1Periph_PWR); } void boot_main(void) { check_and_handle_resuming_from_standby(); dbgserial_init(); dbgserial_putstr(""); dbgserial_putstr(" ____ __"); dbgserial_putstr("/\\ _`\\ /'__`\\"); dbgserial_putstr("\\ \\,\\L\\_...
/* * 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...
touch_reset()
tall_id); if (app) { app->last_activity = cur_time; app->can_expire = can_expire; } else { RecentApp app = { .id = install_id, .last_activity = cur_time, .can_expire = can_expire, }; circular_cache_push(&s_recent_apps.cache, &app); } } mutex_unlock_r...
app_install_get_entry_for_install_id(APP_RECORDS[i].id, entry)
) { // if a false is returned from the function, then stop iterating. if (cb(entry, data) == false) { kernel_free(entry); return; } } } // Iterate over AppDB applications EnumerateData cb_data = { .cb = cb, .data = data, .entry_buf = entry, }; app_db_enumerat...
_p(s_seconds_callbacks.next, NULL); cl_assert_equal_p(s_minutes_callbacks.next, NULL); } #define TEST_DEVICE_NAME "iPhone Martijn" static GAPLEConnection s_conn_a; static GAPLEConnection s_conn_b; static const BTDeviceInternal *s_device_a; static const BTDeviceInternal *s_device_b; void test_ble_hrm__initialize(vo...
cl_assert_equal_b(false, ble_hrm_is_sharing_to_connection(&s_conn_a))
; prv_assert_event_service_subscribed(true); cl_assert_equal_i(s_hrm_manager_subscribe_with_callback_call_count, 1); cl_assert_equal_i(s_sys_hrm_manager_unsubscribe_call_count, 0); // Device B unsubscribes, expect to be unsubscribed from HRM manager, because there are no more // devices subscribed to the BLE...
57). // Reading the SYNC-byte causes the AS7000 to release the handshake-signal // and allows deep-sleep mode (if the AS7000 is configured for this). // This step must be the last read for this handshake-pulse. static void prv_handle_handshake_pulse(void *unused_data) { PPG_DBG("Handshake handle"); ...
(LOG_LEVEL_DEBUG, " - PRV")
; } if (app_ids & AS7000AppId_GSR) { PBL_LOG(LOG_LEVEL_DEBUG, " - GSR"); } if (app_ids & AS7000AppId_NTC) { PBL_LOG(LOG_LEVEL_DEBUG, " - NTC"); } } } static bool prv_get_and_log_device_info(HRMDevice *dev, AS7000InfoRecord *info, bool log_versio...
03}, { 0, 0x8c, 0, 202}, { 0, 0x8c, 0, 202}, { 0, 0x8c, 0, 201}, { 0, 0x8c, 0, 201}, // 30: Local time: 11:36:00 AM { 0, 0x8c, 0, 201}, { 0, 0x8c, 0, 201}, { 0, 0x8c, 0, 200}, { 0, 0x8c, 0, 200}, { 0, 0x8c, 0, 200}, { 0, 0x8c, 0, 201}, { 0, 0x8c, 0, 201}, { 0, 0x8c, 0...
{ 0, 0x8c, 0, 207}, { 0, 0x8c, 0, 206}, { 0, 0x8c, 0, 212}, { 0, 0x8c, 0, 213}, { 0, 0x8c, 0, 210}, { 0, 0x8c, 0, 210}, { 0, 0x8c, 0, 207}, { 0, 0x8c, 0, 210}, { 0, 0x8c, 0, 208}, { 0, 0x8c, 0, 206}, { 0, 0x8c, 0, 205}, { 0, 0x8c, 0, 207}, { 0, 0x8c, 13, 206}, { 0...
{ 0, 0x8c, 0, 202}, { 0, 0x8c, 0, 202}, { 0, 0x8c, 0, 202}, { 0, 0x8c, 0, 203}, { 0, 0x8c, 0, 204}, { 0, 0x8c, 0, 204}, { 0, 0x7c, 195, 205}, { 0, 0x7c, 0, 206}, { 0, 0x7c, 0, 206}, { 0, 0x7c, 0, 206}, { 0, 0x7c, 0, 206}, { 0, 0x7c, 0, 207}, { 0, 0x7c, 0, 207}, {...
efaults (connected to HSI at 16 Mhz), // and there are no prescalers on any of the buses. Since the display // can handle a max of 2 Mhz, we want to divide by 8 #define DISPLAY_PERIPH_PRESCALER (SPI_BaudRatePrescaler_8) static void prv_enable_display_spi_clock() { periph_config_enable(RCC_APB1PeriphClockCmd, DISPLAY...
gpio_use(PWR_CTL_GPIO)
; // Connect PB13 to SPI2_SCK GPIO_PinAFConfig(DISP_GPIO, GPIO_PinSource13, GPIO_AF_SPI2); // Connect PB15 to SPI2_MOSI GPIO_PinAFConfig(DISP_GPIO, GPIO_PinSource15, GPIO_AF_SPI2); GPIO_Init(DISP_GPIO, &s_disp_gpio_init); s_disp_gpio_init.GPIO_Mode = GPIO_Mode_OUT; s_disp_gpio_init.GPIO_OType = GPIO_...
/* * 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_test_backing_data(2, 2)
; prv_push(0); prv_test_backing_data(0, 3); prv_test_backing_data(1, 0); prv_test_backing_data(2, 2); prv_push(1); prv_test_backing_data(0, 3); prv_test_backing_data(1, 0); prv_test_backing_data(2, 1); } void test_circular_cache__get(void) { prv_test_get_miss(0); prv_test_get_miss(1); prv_test_...
sion_type == VoiceEndpointSessionTypeNLP) { data->timestamp = event->data->timestamp; } if (!data->message) { VOICE_LOG("Empty sentence received"); return false; } VOICE_LOG("New sentence: %s", data->message); return true; } static void prv_handle_dictation_error(VoiceUiData *data, VoiceStatus ...
prv_handle_ready_event(data, event)
, { 1424, -304, 256}, { 1152, 176, 16}, { 1480, 3312, -1088}, { 872, 4000, -1592}, { -584, 3816, -1448}, { -656, 304, -728}, { -976, 1424, 88}, { -944, -432, -656}, { -1784, -648, 736}, { -1712, 1112, -520}, { -1296, 208, 0}, { -1136, 1776, -744}, { -920, 4000, -2024}...
{ 1256, 528, -32}, { 1304, 240, -136}, { 872, 232, 144}, { 584, 192, 136}, { 1176, 2696, -1520}, { 576, 4000, -2184}, { -600, 2968, -1360}, { -632, 1376, -504}, { -728, 480, -160}, { -728, -200, 0}, { -1632, -600, -408}, // 28 seconds { -1048, -352, -400}, { -1224...
{ -664, 1584, -832}, { -920, 576, -304}, { -856, -112, -288}, { -1496, -344, 232}, { -1328, -192, -48}, { -1080, 184, 280}, { -912, 384, 160}, { -1656, 4000, -1992}, { -568, 4000, -2440}, { 520, 2288, -1008}, { 584, 1000, -152}, { 1248, 376, -136}, { 1624, -160, -176...
"After compaction: size: %d, num_bytes: %d, write_offset:%d", (int)new_size, (int)session->storage.num_bytes, (int)session->storage.write_offset); success = true; exit: kernel_free(tmp_buf); if (new_storage.fd != DLS_INVALID_FILE) { pfs_close_and_remove(new_storage.fd); } if (!success...
prv_write_data(&session->storage, read_ptr, bytes_read)
; if (!success) { goto exit; } shared_circular_buffer_consume(&session->data->buffer, &session->data->buffer_client, bytes_read); bytes_remaining -= bytes_read; } exit: if (got_session_file) { prv_release_session_file(session); } if (!success) { ...
count = MAX(0, rect.size.w - clipped_rect.size.w - left_cropped_columns_count); if (top_cropped_rows_count) { // Skip over rows for each one that's cropped off the top. corner_insets_left >>= 4 * MIN(top_cropped_rows_count, 8); corner_insets_right >>= 4 *...
if (corner_mask & GCornerBottomRight) { circle_func(ctx, GPoint(rect->origin.x + rect->size.w - radius - 1, rect->origin.y + rect->size.h - radius - 1), radius, GCornerBottomRight); bottom_rect_size_w -= radius; }
// Top Rect prv_fill_rect_legacy2(ctx, GRect(top_rect_origin_x, rect->origin.y, top_rect_size_w, radius), 0, GCornerNone, fill_color); // Middle Rect prv_fill_rect_legacy2(ctx, GRect(rect->origin.x, rect->origin.y + radius, rect->size.w, ...
alue > 0); } void test_stats__filtered_count(void) { const int32_t data[] = { 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0 }; const size_t num_data = ARRAY_LENGTH(data); const StatsBasicOp op = StatsBasicOp_Count; int32_t result; stats_calculate_basic(op, data, num_data, prv_filter, &s_conte...
(result.avg, 0)
; cl_assert_equal_i(result.min, INT32_MAX); cl_assert_equal_i(result.max, INT32_MIN); cl_assert_equal_i(result.count, 0); cl_assert_equal_i(result.max_streak, 0); cl_assert_equal_i(result.first_streak, 0); cl_assert_equal_i(result.median, 0); } void test_stats__all_basic_one_value(void) { const int32_t d...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ const HcProtocolMessagePairingCompletePayload *request = (const HcProtocolMessagePairingCompletePayload *)msg->payload; pairing_confirm_handle_complete(&request->device, request->status); break; }
break; } } if (test == NULL) { clar_print_onabort("No test named '%s'.\n", argument); exit(-1); } _clar.active_suite = suite->name; _clar.suite_errors = 0; _clar.active_test = test->name; clar_run_test(test, &suite->initialize, &suite->cleanup...
if (d1 != d2) { char buf[128]; snprint_eq(buf, 128, "%f != %f", d1, d2); clar__assert(0, file, line, err, buf, should_abort); }
} void clar__assert_within( int n, int min, int max, const char *file, int line, const char *err, int should_abort) { if (!CL_WITHIN(n, min, max)) { char buf[256]; snprint_eq(buf, 256, "%d not within [%d, %d]", n, min, max); clar__assert(0, file, line, err, buf, should_abort); } } void ...
did_draw`. // // In order to visualize this algorithm, imagine these lines below overlaid on the major control // statements below: // // for ___ Ascent loop caused by the "if container". With nested containers, the algorithm // \ \ / will keep ascending by branching into the if and hitting th...
prv_draw_text_node_tree(node, ctx, box, config, render, size_out)