prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
h1", }, { 2147483646LL, 19, "27C57H31", }, { 2147483646LL, 19, "27c57h31", }, { -2147483647LL, 19, "-27C57H32", }, { -2147483647LL, 19, "-27c57h32", }, { 2147483646LL, 20, "1DB1F926", }, { 2147483646LL, 20, "1db1f926", }, { -2147483647LL, 20, "-1DB1F927", }, { -2147483647LL, 20, "-1db1f927", }, { 2147...
cl_assert_equal_i('\0', *end)
; s = "123a"; strtol(s, &end, 10); cl_assert_equal_p(s+3, end); cl_assert_equal_i('a', *end); s = "a123"; strtol(s, &end, 10); cl_assert_equal_p(s, end); cl_assert_equal_i('a', *end); }
ere where some children are already scheduled and some have // already completed. // // Here's a graph of what we are doing // // 0 10 310 320 330 500 680 730 850 950 1080 1300 // | | | | | | | | | | | | // --------------...
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, d), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, spawn), 1); #endif }
void prv_update_unschedule_all_handler(Animation *animation, const AnimationProgress distance) { prv_add_handler_entry(&s_update_handler_calls, animation, false, (void *)(uintptr_t)distance /*context*/); DPRINTF("%"PRIu64" ms: Executing update handler for %d, distance: %d\n", prv_now_ms(),...
es_init_font(0, gothic_18_handle, 0, &s_font_info)); test_graphics_context_init(&ctx, fb); // Test when clipping/drawing and text bounds are all at (0, 0) setup_test_aa_sw(&ctx, fb, RECT_TEXT_0_0, RECT_TEXT_0_0, false, 1); graphics_context_set_text_color(&ctx, GColorBlack); graphics_draw_text(&ctx, "jja", &...
graphics_draw_text(&ctx, "jja", &s_font_info, RECT_NEG, GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL)
ASSERT_JS_GLOBAL_EQUALS_S("s", "20"); EXECUTE_SCRIPT("s = d.toLocaleTimeString(undefined, {});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "20:04:05"); EXECUTE_SCRIPT("s = d.toLocaleTimeString(undefined, " "{hour: undefined, minute: undefined, second: undefined});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "...
ASSERT_JS_GLOBAL_EQUALS_S("s", "25")
; EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {day: '2-digit'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "25"); EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {day: 'short'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "Mon"); EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {day: 'long'});"); ASSERT_JS_GL...
/* * 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...
battery_set_charge_enable(false)
; } data->pass_count++; } else { data->pass_count = 0; } break; case RuninStatePass: case RuninStateFail: default: break; } if (data->countdown_running) { --data->seconds_remaining; if (data->seconds_remaining == 0) { // Time's up! nex...
cy_for_le_conn(hdl); unlock: bt_unlock(); } static void prv_bt_le_gateway_response_latency_watchdog_cb(void *data) { // offload handling onto KernelBG so we don't stall the timer thread // trying to get the bt lock system_task_add_callback(prv_bt_le_gateway_response_latency_watchdog_handler, data); } static ...
list_remove(curr_request, NULL, NULL)
; kernel_free(curr_request); curr_request = temp; } kernel_free(*info); *info = NULL; } void command_change_le_mode(char *mode) { // assume we only have one connection for debug GAPLEConnection *conn_hdl = gap_le_connection_any(); ResponseTimeState state = atoi(mode); conn_mgr_set_ble_conn_resp...
{ 48, 24, -1000}, { 48, 24, -1000}, { 56, 32, -1000}, { 56, 24, -1008}, { 56, 24, -1000}, { 56, 24, -1000}, { 48, 24, -1000}, { 56, 32, -1000}, { 48, 24, -992}, { 48, 24, -992}, { 48, 24, -1000}, { 56, 24, -1000}, { 48, 24, -992}, { 48, 24, -1000}, { 48, 24, -100...
{ 48, 16, -1000}, { 56, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 32, -1000}, { 48, 24, -1008}, { 48, 32, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 56, 32, -1000}, { 48, 32, -1008}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 32...
{ 56, 16, -1000}, { 48, 24, -992}, { 56, 24, -992}, { 48, 24, -1000}, { 48, 24, -1000}, { 56, 24, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 56, 24, -1008}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 56, 24, -1000}, { 48, 32, -1008}, { 48, 16,...
TF("rescheduled count: %d\n", s_stopped_handler_calls.num_calls); DPRINTF("%"PRIu64": frame at: %d, %d, %d %d\n", time_ms - start_ms, layer.frame.origin.x, layer.frame.origin.y, layer.frame.size.w, layer.frame.size.h); if (layer.frame.origin.x == to_r.origin.x && layer.frame.origin.y ==...
{ reached_end_elapsed = true; }
if (reached_end_elapsed && s_stopped_handler_calls.num_calls == 1 && layer.frame.origin.x < to_r.origin.x) { detected_reset_of_elapsed = true; } cl_assert(max_loops > 0); max_loops--; } // Make sure we detected a reset of the elapsed after rescheduling cl_assert(s_stopped_handler_...
/* * 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 from + ((normalized * (to - from)) / ANIMATION_NORMALIZED_MAX); }
void property_animation_legacy2_update_int16(PropertyAnimationLegacy2 *property_animation, const uint32_t distance_normalized) { int16_t result = distance_interpolate(distance_normalized, property_animation->values.from.int16, ...
Check to make sure stress test has at least 1 iteration or its another test case status = run_flash_test_case(test_case_num, iterations); } char buffer[80]; if (status == 0) { prompt_send_response_fmt(buffer, sizeof(buffer), "PASS: TEST CASE %"PRId32, test_case_num); } else { prompt_send_response_f...
prompt_send_response_fmt(buffer, sizeof(buffer), "(Sub)Sector at addr: 0x%"PRIX32" not really erased. is_subsector: %d", addr, is_subsector)
; goto done; } } } } done: return erased; } // ARG: // 0 - Only show sectors // 1 - Show subsectors too if sector is not erased void command_flash_show_erased_sectors(const char *arg) { const bool show_subsectors = (atoi(arg) == 1); char buffer[64]; uint32_t addr = 0; while (a...
enu_layer->callbacks.select_long_click) { menu_layer->callbacks.select_long_click(menu_layer, &menu_layer->selection.index, menu_layer->callback_context); } } void menu_up_click_handler(ClickRecognizerRef recognizer, MenuLayer *menu_layer) { const bool up = true; const bool animated = true; menu_la...
{ // Save current drawing state: GDrawState prev_state = graphics_context_get_drawing_state(ctx); GRect prev_bounds = cell_layer->bounds; GRect new_bounds = prev_bounds; // Translate the drawing_box to the bounds of the layer: ctx->draw_state.drawing_box.origin.y += y; ctx->draw_state.drawi...
== SmartstrapStateReadReady)) { PBL_ASSERT_TASK(PebbleTask_KernelBackground); } else { // all other transitions are invalid WTF; } } bool smartstrap_fsm_state_test_and_set(SmartstrapState expected_state, SmartstrapState next_state) { const bool did_set = __atomic_compare_exchange_n(&s_fsm_state, &exp...
{ mutex_unlock(s_state_lock); }
void smartstrap_state_assert_locked_by_current_task(void) { mutex_assert_held_by_curr_task(s_state_lock, true); }
o 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 <inttypes.h> #include <stdbool.h>...
PBL_LOG(LOG_LEVEL_DEBUG, "Connected, idx=%d!", (int)evt->conn_idx)
; prv_log_conn_params(&evt->conn_params); if (!evt->is_master) { // To be compliant with BT Core Spec section 7.8.9, stop advertising when the chip gets // connected to. (The host expectes advertisements to have stopped in this scenario (see // gap_le_advert_handle_connect_as_slave)) Ideally we would h...
ItemTypeNotification, .layout_id = LayoutIdNotification, .icon_id = TIMELINE_RESOURCE_GENERIC_EMAIL, .bg_color = GColorVividCeruleanARGB8, .title = "Henry Levak", .subtitle = "Henry sent you a 1-1 message", .body = "What is an alternative", .time_offset = -MINUTES(5) }, { .type = Tim...
swap_layer_get_layer(swap_layer)
); // configure status layer StatusBarLayer *status_layer = &data->status_layer; status_bar_layer_init(status_layer); status_bar_layer_set_colors(status_layer, GColorClear, GColorBlack); status_bar_layer_set_separator_mode(status_layer, StatusBarLayerSeparatorModeNone); layer_add_child(root, (Layer *)statu...
/* * 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...
{ Layer *window_layer = window_get_root_layer(window); layer_set_update_proc(window_layer, prv_update_proc); }
static void init(void) { __profiler_init(); window = window_create(); window_set_window_handlers(window, (WindowHandlers) { .load = window_load, }); window_stack_push(window, true); } static void deinit(void) { window_destroy(window); } int main(void) { init(); app_event_loop(); deinit(); }
nses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitation...
{ analytics_event_stationary_state_change(rtc_get_time(), StationaryAnalyticsExitCharging); }
prv_update_stationary_enabled(NULL); } //! A movement of the watch will make the watch wake up. In this state, the watch //! will have a low tap threshold, so it will be sensitive to motion static void prv_accel_tap_handler(AccelAxisType axis, int32_t direction) { prv_handle_action(StationaryActionWakeUp); } sta...
uintptr_t saved_lr = lr; Heap *heap = task_heap_get_for_current_task(); void *mem = heap_calloc(heap, count, size, saved_lr); const size_t bytes = count * size; if (!mem && bytes != 0) { PBL_CROAK_OOM(bytes, saved_lr, heap); } return mem; } char *task_strdup(const char *s) { register uintptr_t lr ...
PBL_CROAK_OOM(bytes, saved_lr, heap)
; } return mem; } void kernel_free(void *ptr) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; heap_free(kernel_heap_get(), ptr, saved_lr); } char *kernel_strdup(const char *s) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; return prv_strdup(kernel_heap_get(), s, saved_lr...
is_valid(connection)) { PBL_LOG(LOG_LEVEL_DEBUG, "Changing connection flag: %c=%u", prv_debug_char_for_flag(flag), enabled); if (enabled) { connection->flags |= (1 << flag); } else { connection->flags &= ~(1 << flag); } } } prv_unlock(); } void connection_s...
{ bool rv = true; prv_lock(); { GattOperation *tmp_tail = (GattOperation *)list_get_tail((ListNode *)connection->gatt_op_list); if (!tmp_tail) { PBL_LOG(LOG_LEVEL_WARNING, "Gatt: Attempted to pop recent op when list empty"); PBL_ASSERTN(0); } connection->gatt_op_list = (GattOperation ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(ctx, GPoint(5, -30), GPoint(45, 30))
; } void test_graphics_draw_line__origin_layer(void) { GContext ctx; Layer layer; test_graphics_context_init(&ctx, fb); layer_init(&layer, &GRect(0, 0, 60, 60)); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, ...
t_equal_i(sys_wakeup_query(early_wakeup_id), E_DOES_NOT_EXIST); cl_assert_equal_i(sys_wakeup_query(late_wakeup_id), late_event); // Make sure that the next scheduled timer is now the late wakeup id. cl_assert_equal_i(late_wakeup_id, wakeup_get_next_scheduled()); // Set time 10 minutes into the future, late_ev...
sys_wakeup_query(first_wakeup_id)
, first_event); TimerID first_timer = wakeup_get_current(); // Jump 30 seconds in the future uint32_t initial_timeout = stub_new_timer_timeout(first_timer); uint32_t time_jump_seconds = 30; rtc_set_time(sys_get_time() + time_jump_seconds); // Notify clock change and record change in new timer wakeu...
/* * 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(pstring_equal(ps1, ps4))
; cl_assert(!pstring_equal(ps1, ps2)); cl_assert(!pstring_equal(ps1, ps3)); cl_assert(!pstring_equal(ps2, ps3)); cl_assert(!pstring_equal(ps1, NULL)); cl_assert(!pstring_equal(NULL, NULL)); } void test_pstring__equal_cstring(void) { const char *str1 = "Phil"; uint8_t ps1_buf[128]; PascalString16 *ps1 =...
((void*) true)
; } void do_not_disturb_handle_clock_change(void) { prv_try_update_schedule_mode_callback(false); } void do_not_disturb_handle_calendar_event(PebbleCalendarEvent *e) { prv_do_update(); } void do_not_disturb_manual_toggle_with_dialog(void) { do_not_disturb_toggle_push(ActionTogglePrompt_Auto, false /* set_exit_...
/* * 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_last_battery_state.voltage - BATTERY_FULL_FUDGE_AMOUNT)
; } static void battery_state_put_change_event(PreciseBatteryChargeState state) { PebbleEvent e = { .type = PEBBLE_BATTERY_STATE_CHANGE_EVENT, .battery_state = { .new_state = state, }, }; event_put(&e); } void battery_state_reset_filter(void) { s_last_battery_state.voltage = battery_get_mill...
, MAX_NUM_COLS + 4); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 5), 0); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 7), 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 9), 2); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 11), 3); graphics_draw_horizontal_line_dotted(&ctx, G...
(&ctx, GPoint(9, 0), 2)
; graphics_draw_vertical_line_dotted(&ctx, GPoint(11, 0), 3); graphics_draw_vertical_line_dotted(&ctx, GPoint(13, 0), 4); graphics_draw_vertical_line_dotted(&ctx, GPoint(15, 0), 20); graphics_draw_vertical_line_dotted(&ctx, GPoint(17, 0), 21); graphics_draw_vertical_line_dotted(&ctx, GPoint(19, 0), 22); gra...
avoid division by zero GPointPrecise point; point.x.raw_value = (*p0).x.raw_value; point.y.raw_value = (*p0).y.raw_value; (*far_top) = point; (*far_bottom) = point; (*far_left) = point; (*far_right) = point; return false; } // Orthogonal vector for offset points GPointPrecise v1...
(&p0, &p1, radius, &far_top, &far_bottom, &far_left, &far_right)
; // To compensate for rounding errors we need to add half of the precision in specific places // - we add on top if line is leaning backward // - we add on bottom if line is leaning forward // - for lines with perfect horizontal or vertical lines this fix doesnt matter // same applies to same st...
ion_visible(); } const bool is_modal_unfocused = (update.properties & ModalProperty_Unfocused); const bool was_modal_unfocused = (last_properties & ModalProperty_Unfocused); if (was_modal_unfocused && !is_modal_unfocused) { // We now have a modal window focused when we didn't have one before, start the tra...
window_set_on_screen(window, true /* new on screen */, true /* call handlers */)
; } // Setting on-screen can configure the click, but if this is a window below a transparent // window that just disappeared, it was already on screen and may need its click configured. const bool is_focused = (iter->current_idx == iter->first_focus_idx); if (!window->is_click_configured && is_focused) { ...
s(const char *name, const char *pfs_name) { char res_path[strlen(CLAR_FIXTURE_PATH) + strlen(APP_REGISTRY_FIXTURE_PATH) + strlen(name) + 3]; sprintf(res_path, "%s/%s/%s", CLAR_FIXTURE_PATH, APP_REGISTRY_FIXTURE_PATH, name); // Check that file exists and fits in buffer struct stat st; cl_assert(stat(res_path, ...
(&tictoc_uuid)
we've read the subsecond register // To eliminate these possibilities, we read the time register both before and after // we read the date and subsecond registers and only exit this method if we are in the same // second both before and after. int max_loops = 4; // If we loop more than this many times, some...
(wakeup_counter < 65536)
cl_assert_equal_b(reset, true); cl_assert_equal_b(cancelled, true); } void test_recognizer__cancel(void) { bool cancelled = false; s_test_impl_data.cancelled = &cancelled; RecognizerEvent rec_event = -1; NEW_RECOGNIZER(r) = test_recognizer_create(&s_test_impl_data, &rec_event); recognizer_cancel(r); c...
(&s_test_impl_data, &rec_event)
; NEW_RECOGNIZER(fail) = test_recognizer_create(&s_test_impl_data, NULL); recognizer_set_fail_after(r, fail); new_state = RecognizerState_Completed; recognizer_handle_touch_event(r, &(TouchEvent) { .type = TouchEvent_Touchdown }); cl_assert_equal_i(last_touch_event.type, TouchEvent_Liftoff); cl_assert_equa...
ler(e->object_ref, e->gatt_error); } } static void prv_handle_characteristic_subscribe(const PebbleBLEGATTClientEvent *e) { PBL_LOG(LOG_LEVEL_DEBUG, "TODO: GATT Client Event, subtype=%u", e->subtype); } static void prv_handle_descriptor_read(const PebbleBLEGATTClientEvent *e) { BLEAppState *ble_app_state = app_...
prv_set_handler(handler, offset)
; } BTErrno ble_client_set_buffer_empty_handler(BLEClientBufferEmptyHandler empty_handler) { // TODO return BTErrnoOther; } BTErrno ble_client_set_descriptor_write_handler(BLEClientWriteDescriptorHandler handler) { const off_t offset = offsetof(BLEAppState, gatt_descriptor_write_handler); return prv_set_handl...
window_unload_handler(Window *window); extern void prv_set_unobstructed_area_height(int16_t height); extern void prv_set_data(KickstartData *data, int32_t current_steps, int32_t typical_steps, int32_t daily_steps_avg, int32_t current_bpm); // Fakes ///////////////////// #include "fake_pbl_std...
(&s_data.window, &s_ctx)
; cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_kickstart__render_hr_bpm(void) { #if (PLATFORM_SILK || PLATFORM_ROBERT) prv_set_data(&s_data, 10323, 7500, 13000, 82); window_set_on_screen(&s_data.window, true, true); window_render(&s_data.window, &s_ctx); cl_check(gbitmap_pbi_eq(&...
/* * 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...
(value, NULL)
; buffer = NULL; } *write = (const Write) { .characteristic = characteristic, .client = client, .is_response_required = is_response_required, .value = buffer, .value_length = value_length, }; if (s_write_head) { list_append((ListNode *)s_write_head, &write->node); } else { s_wr...
bool activity_algorithm_minute_file_info(bool compact_first, uint32_t *num_records, uint32_t *data_bytes, uint32_t *minutes) { *num_records = 0; *data_bytes = 0; *minutes = 0; return true; } bool activity_algorithm_test_fill_minute_file(void) { return true; } // We s...
if ((utc_secs % 60) == 0) { fake_cron_job_fire(); fake_system_task_callbacks_invoke_pending(); }
raw_rect_offset_aa_sw2_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 2); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw2_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ct...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw1_no_clip.${BIT_DEPTH_NAME}.pbi"))
{ return JERRY_VALUE_HAS_TYPE(value, 'undefined'); }
//////////////////////////////////////////////////////////////////////////////// // Jerry Value Getter Functions //////////////////////////////////////////////////////////////////////////////// bool jerry_get_boolean_value(const jerry_value_t value) { if (!jerry_value_is_boolean(value)) { return false; } r...
This can be optimized in future // to do larger burst sizes and/or unrolling larger transfer sizes into 32-bit // reads. status_t flash_impl_read_sync(void *buffer_ptr, FlashAddress start_addr, size_t buffer_size) { uint8_t *buffer = buffer_ptr; flash_impl_use(); uint32_t flash_dat...
prv_issue_command(sector_addr, S29VSCommand_WriteBufferLoad)
; prv_issue_command_argument(sector_addr, num_shorts - 1); // We're now ready to write the words. Subsequent writes to the sector will // actually write the data through to the write buffer. __IO uint16_t *flash_write_dest = (__IO uint16_t*) (FMC_BANK_1_BASE_ADDRESS + (start_addr & ~0x1)); uint32_t by...
/* * 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...
{ rv = prv_set_mode_and_data(); if (rv != BLE_STATUS_OK) { return rv; } }
rv = ble_gap_adv_start(GAP_CONN_MODE_UNDIRECTED); if (rv != BLE_STATUS_OK) { PBL_LOG(LOG_LEVEL_ERROR, "ble_gap_adv_start: status = 0x%x", rv); } else { PBL_LOG(LOG_LEVEL_DEBUG, "Adverts (re)started"); } return rv; } static ble_error_t prv_advert_disable(void) { ble_error_t rv = ble_gap_adv_stop()...
/* * 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...
bt_persistent_storage_get_root_key(SMRootKeyTypeEncryption, enc_key)
) { is_existing = true; goto finally; } prv_generate_root_keys(keys_out); finally: #ifndef RELEASE PBL_LOG(LOG_LEVEL_INFO, "BLE Root Keys (existing=%u):", is_existing); PBL_HEXDUMP(LOG_LEVEL_INFO, (const uint8_t *)keys_out, 2 * sizeof(SM128BitKey)); #endif if (!is_existing) { bt_persistent_stora...
cl_assert(memcmp(out_buffer, "1234", 4) == 0); cl_assert_equal_i(circular_buffer_get_write_space_remaining(&buffer), 2); cl_assert(circular_buffer_consume(&buffer, 4)); cl_assert_equal_i(circular_buffer_get_write_space_remaining(&buffer), 6); // Now there's just 56 in the buffer. Fill it to the brim cl_asse...
cl_assert_equal_b(circular_buffer_write(&buffer, (uint8_t *)"456789", 6), true)
; cl_assert_equal_i(circular_buffer_copy_offset(&buffer, 2 /* start_offset */, data_out, data_out_size), 6); cl_assert(memcmp("456789", data_out, 6) == 0); } void test_circular_buffer__direct_write(void) { CircularBuffer buffer; uint8_t storage[8]; circular_buf...
_data_work) { s_accel_outstanding_data_work = true; accel_offload_work_from_isr(prv_handle_data, should_context_switch); } else { BMI160_DBG("%s", "We fell behind on data handling"); } } // in order to actually enter 'low power' mode, we have to set up accel to do // undersampling. The more samples we ...
for (unsigned int i = 0; i < ARRAY_LENGTH(accel_test_axis); ++i) { accel_test_axis[i].negative_value = bmi160_read_16bit_reg(accel_test_axis[i].register_address); PBL_LOG(LOG_LEVEL_DEBUG, "- %c: %"PRId16, accel_test_axis[i].axis_name, accel_test_axis[i].negative_value); }
PBL_LOG(LOG_LEVEL_DEBUG, "Self Test: Positive offset"); // Flip sign bit from negative to positive while leaving self test mode on at high amplitude prv_write_reg(BMI160_REG_SELF_TEST, 0x8 | 0x4 | 0b01); psleep(50); // Collect data with the positive offset applied for (unsigned int i = 0; i < ARRAY_LEN...
Request request = (SmartstrapRequest) { .service_id = attr->service_id, .attribute_id = attr->attribute_id, .write_mbuf = (attr->request_type == SmartstrapRequestTypeRead) ? NULL : &write_mbuf, .read_mbuf = (attr->request_type == SmartstrapRequestTypeWrite) ? NULL : &attr->mbuf, .timeout_ms = attr->...
PBL_LOG(LOG_LEVEL_ERROR, "Attribute length of %"PRIu32" is too long", (uint32_t)buffer_length)
; return false; } mutex_lock(s_attr_list_lock); const bool exists = (prv_find_by_ids(service_id, attribute_id) || prv_find_by_buffer(buffer)); mutex_unlock(s_attr_list_lock); if (exists) { PBL_LOG(LOG_LEVEL_ERROR, "Attribute already exists (0x%x,0x%x)", service_id, attribute_id); return false; ...
strlen(SOME_EMPTY_STRING) + 1); const uint32_t surplus = 16; // allocate more than needed, see comment with the `final_size` test uint8_t buffer[size + surplus]; // Write: DictionaryIterator iter; DictionaryResult result; result = dict_write_begin(&iter, buffer, sizeof(buffer...
(string_found)
; cl_assert(uint8_found); cl_assert(uint16_found); cl_assert(uint32_found); cl_assert(int8_found); cl_assert(int16_found); cl_assert(int32_found); cl_assert(null_cstring_found); cl_assert(empty_cstring_found); } void test_dict__out_of_storage(void) { uint8_t buffer[1]; DictionaryIterator iter; Di...
---------------------------- // Sample captured: 2015-10-15 20:19:58 local AccelRawData *activity_sample_non_walk_pbl_27713_1(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME non_walk_pbl_27713_1 //> TEST_EXPECTED 0 //> TEST_EXPECTED_MIN 0 //> TEST_EXPECTED_MAX 200...
{ -1968, 1368, -1992}, { -16, 704, -616}, { -744, 400, -496}, { -968, 296, -312}, { -912, 472, -320}, { -856, 472, -264}, // 5 seconds { -800, 536, -224}, { -784, 472, -272}, { -736, 376, -208}, { -648, 616, -440}, { -800, 584, -232}, { -936, 784, -576}, { -568, 5...
r_elevated(), false); activity_get_metric(ActivityMetricHeartRateZone1Minutes, 1, &zone1_minutes); cl_assert_equal_i(zone1_minutes, 2); activity_get_metric(ActivityMetricHeartRateZone2Minutes, 1, &zone2_minutes); cl_assert_equal_i(zone2_minutes, 2); activity_get_metric(ActivityMetricHeartRateZone3Minutes, 1, ...
(&activity_private_state()->activity_sessions[i], &activity, sizeof(ActivitySession))
; } for (int i = 0; i < ACTIVITY_MAX_ACTIVITY_SESSIONS_COUNT; i++) { ActivitySession activity = walk_activity; activity.start_utc = i; ActivitySession next_activity = activity; next_activity.start_utc = i + 1; activity_sessions_prv_delete_activity_session(&activity); cl_assert_equal_i(act...
r->comm.session_id == session_id) { mutex_unlock_recursive(s_list_mutex); return (iter); } iter = iter->next; } mutex_unlock_recursive(s_list_mutex); return (NULL); } DataLoggingSession *dls_list_find_active_session(uint32_t tag, const Uuid *app_uuid) { mutex_lock_recursive(s_list_mutex); ...
kernel_malloc_check(sizeof(DataLoggingSession))
; *logging_session = (DataLoggingSession){ .status = status, .app_uuid = *app_uuid, .tag = tag, .task = pebble_task_get_current(), .item_type = type, .item_size = size, .session_created_timestamp = timestamp, .storage.fd = DLS_INVALID_FILE }; if (status == DataLoggingStatusActive...
zer_manager_handle_state_change(&manager, r[0]); cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersActive); cl_assert_equal_p(manager.active_layer, &layer_a); prv_compare_recognizers_processed(NULL, 0, &s_recognizers_reset); r[1]->state = RecognizerState_Failed; recognizer_manager_handle_sta...
recognizer_manager_handle_state_change(&manager, r[1])
; cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersTriggered); cl_assert_equal_p(manager.triggered, r[0]); cl_assert_equal_p(manager.active_layer, &layer_a); prv_compare_recognizers_processed(NULL, 0, &s_recognizers_reset); cl_assert_equal_i(r[0]->state, RecognizerState_Started); cl_assert...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(written_hw_version2_long)
; hw_version = mfg_get_hw_version(); cl_assert_equal_s(written_hw_version1, hw_version); // Write second time const char* written_hw_version2 = "HIJKLMN"; command_hwver_write(written_hw_version2); hw_version = mfg_get_hw_version(); cl_assert_equal_s(written_hw_version2, hw_version); // Write third tim...
on 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, software * distributed under the License is distributed on an "AS ...
if (iter == NULL) { return result; }
for (unsigned int i = 0; i < count; ++i) { dict_write_tuplet(iter, &updated_keys_and_values[i]); } dict_write_end(iter); return app_message_outbox_send(); } const Tuple * app_sync_get(const AppSync *s, const uint32_t key) { return dict_find(&s->current_iter, key); }
d up being compiled out void power_tracking_init(void) { } void power_tracking_start(PowerSystem system) { // sanitize all uses of this function when you implement it (void) system; } void power_tracking_stop(PowerSystem system) { // sanitize all uses of this function when you implement it (void) system; } #...
(buffer, sizeof(buffer), ">>>PWR:%"PRIu64",%s,%"PRIu64"<", log_record_time, current_profile->name, total_ticks)
; } } } power_tracking_stop(PowerSystemProfiling); } void power_tracking_init(void) { regular_timer_add_multisecond_callback(&s_power_profile_timer, power_tracking_integration_period_s); char buffer[32]; dbgserial_putstr_fmt(buffer, sizeof(buffer), ">>>PWR:%"PRIu64",START,%"PRIu16, rtc_get_ticks(),...
-------------------------------------------------------- void process_manager_put_kill_process_event(PebbleTask task, bool gracefully) { PebbleEvent event = { .type = PEBBLE_PROCESS_KILL_EVENT, .kill = { .gracefully = gracefully, .task = task, }, }; // When we have decided to exit the app...
PBL_LOG(LOG_LEVEL_DEBUG, "Invalid ID")
data starts with expected Rocky header const size_t header_size = sizeof(ROCKY_EXPECTED_SNAPSHOT_HEADER); cl_assert_equal_i(8, header_size); // NOTE: the snapshot header in this unit test is fixed to // CAPABILITY_JAVASCRIPT_BYTECODE_VERSION=1 only use the resulting binary // if the true JS versi...
cl_assert(jerry_value_is_string(global_date))
; cl_assert(date_builtin != global_date); jerry_release_value(global_date); jerry_release_value(global_object); jerry_release_value(date_builtin); } void test_js__capture_mem_stats_upon_exiting_event_loop(void) { prv_deinit(); s_app_event_loop_callback = NULL; const char *source = ";"; cl_assert_equa...
------------------------------------------------------------------ static void prv_delete_client(PPoGATTClient *client, bool is_disconnected, DeleteReason reason) { // Unsubscribe from Data characteristic: if (client->state > StateDisconnectedSubscribingData && !is_disconnected) { gatt_client_subscriptions_sub...
prv_client_supports_enhanced_throughput_features(client)
) { // Set our desired window sizes // // Note: as of PBL-38806 (which is in Android 4.0), the Android app will negotiate the MTU size // before starting up a PPoG session so we can use this info to dynamically change the window // size. The iOS app has no control over when the MTU size is negotiate...
/* * 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...
min(bounds.size.w / 2, bounds.size.h / 2)
; uint16_t inset_thickness = 1; // 360 degrees, filled in __profiler_start(); for (int i = 0; i < ITERATIONS; ++i) { graphics_fill_radial(ctx, bounds, GOvalScaleModeFitCircle, radius, 0, TRIG_MAX_ANGLE); } __profiler_stop(); APP_LOG(APP_LOG_LEVEL_INFO, "360 filled"); __profiler_print_stats(); //...
stor) { prv_cancel_layer_tree_recognizers(manager, NULL, new_active_layer); } } else { // We cancelled all the triggered recognizers, time to reset everything manager->active_layer = new_active_layer; prv_reset_all_recognizers(manager); manager->stat...
(recognizer)
; recognizer_set_manager(recognizer, NULL); } void recognizer_manager_handle_state_change(RecognizerManager *manager, Recognizer *changed) { PBL_ASSERTN(manager); PBL_ASSERTN(changed); PBL_ASSERTN(recognizer_get_manager(changed) == manager); Recognizer *triggered = recognizer_has_triggered(changed) ? change...
InputConfig in_sda = { .gpio = slave->bus->sda_gpio.gpio, .gpio_pin = slave->bus->sda_gpio.gpio_pin, }; gpio_input_init(&in_sda); OutputConfig out_scl = { .gpio = slave->bus->scl_gpio.gpio, .gpio_pin = slave->bus->scl_gpio.gpio_pin, .active_high = true }; gpio_output_init(&out_scl, GP...
delay_ms(2)
; } else { // Too many NACKs received, abort transfer i2c_hal_abort_transfer(bus); complete = true; PBL_LOG(LOG_LEVEL_ERROR, "I2C Error: too many NACKs received on bus %s", bus->name); break; } } else { // Timeout, abort transfer i2c_hal_abort_transf...
/* * 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 (node_b->timestamp - node_a->timestamp); }
} static bool prv_filter(ListNode *found_node, void *data) { TimelineNode *node = (TimelineNode *)found_node; Uuid *uuid = (Uuid *)data; return uuid_equal(&node->id, uuid); } static TimelineNode *prv_find_by_uuid(TimelineNode *head, Uuid *uuid) { TimelineNode *node = (TimelineNode *)list_find((ListNode *)hea...
ction_bar_icon_check; GBitmap *action_bar_icon_x; } ConfirmUIData; //! Wipe registry + Reboot static void start_factory_reset(void *data) { factory_reset(false /* should_shutdown */); } static void prv_lockout_back_button(Window *window) { window_set_overrides_back_button(window, true); window_set_click_confi...
GPoint(x_margin_px, forget_text_y_offset_px)
, .size = GSize(width - (2 * x_margin_px), root_layer_bounds->size.h - forget_text_y_offset_px) }; text_layer_init_with_parameters(forget_text_layer, &forget_text_frame, i18n_get(BT_FORGET_PAIRING_STR, data), fonts_get_system_font(FONT_KEY_GOT...
e "applib/graphics/text_layout_private.h" #include "applib/graphics/graphics.h" #include "applib/graphics/framebuffer.h" #include "clar.h" /////////////////////////////////////////////////////////// // Stubs #include "stubs_logging.h" #include "stubs_passert.h" #include "stubs_hexdump.h" #include "stubs_heap.h" #in...
(layout.max_used_size.w, 4 * HORIZ_ADVANCE_PX)
}, { .filename_part = "quads_right", .mask = GCornersRight, }, { .filename_part = "quads_left", .mask = GCornersLeft, }, }; // note: not the prettiest, fast a quick way to render all the scenarios Nitin was interested in for (int i = 0; i < ARRAY_...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_r0_swX_color.8bit.pbi"))
/* * 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.last_will_change_final_area = final_area; cl_assert_equal_p(context, s_data.context); s_data.num_will_change_calls++; }
static void prv_change(AnimationProgress progress, void *context) { s_data.last_change_progress = progress; cl_assert_equal_p(context, s_data.context); s_data.num_change_calls++; } static void prv_did_change(void *context) { cl_assert_equal_p(context, s_data.context); s_data.num_did_change_calls++; } // T...
main body rectangle * Hardcoded approach since this is faster than extra logic for edge cases * * Example case: * * . far_top * \ * /\ * / ' far_right * far_left . / * \/ * \ * ...
(p0.y.raw_value, p1.y.raw_value)
- radius.raw_value; const int16_t bottom_point = MAX(p0.y.raw_value, p1.y.raw_value) + radius.raw_value; const int8_t fraction_for_top = top_point & fraction_mask; const int8_t fraction_for_bottom = bottom_point & fraction_mask; // Drawing loop: Iterates over horizontal lines // As part of optimi...
E / 4); break; } } } if (!(quadrant & radius_quadrants[0])) { for (int i=QUADRANTS_NUM - 1; i >= 0; i--) { if (quadrant & radius_quadrants[i]) { angle_end = ((i + 1) % 4) * (TRIG_MAX_ANGLE / 4); break; } } } else { for (int i=1; ...
angle_start, angle_end); if (half_stroke_width.integer >= 1) { GPointPrecise starting_point = prv_get_rotated_precise_point(center, radius.raw_value, angle_start); GPointPrecise ending_point = prv_get_rotated_precise_point(center, radius.raw_value, angle_en...
void graphics_draw_arc_internal(GContext *ctx, GPoint center, uint16_t radius, int32_t angle_start, int32_t angle_end) { // We're just casting this to precise points GPointPrecise fixed_center; // GPointPreciseFromGPoint doesnt work for unit tests (!!!) fixed_center.x.integer ...
/* * 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()
; if (uuid_equal(&md->uuid, &app_process->uuid)) { return APP_WORKER_RESULT_ALREADY_RUNNING; } // We have to get confirmation first that it is OK to launch the new worker launcher_task_add_callback(prv_switch_worker, (void *) install_id); return APP_WORKER_RESULT_ASKING_CONFIRMATION; } w...
t_ticks = rtc_get_ticks(); dls_list_for_each_session(check_ack_timeout_for_session, &current_ticks); reschedule_ack_timeout(); } static void ack_timer_cb(void *cb_data) { mutex_lock(s_endpoint_data.mutex); check_ack_timeout(); mutex_unlock(s_endpoint_data.mutex); } static bool find_soonest_ack_timeout_c...
(session, ENDPOINT_ID_DATA_LOGGING, (uint8_t *)&msg, sizeof(DataLoggingCloseSessionMessage), COMM_SESSION_DEFAULT_TIMEOUT)
; } bool dls_endpoint_send_data(DataLoggingSession *logging_session, const uint8_t *data, unsigned int num_bytes) { if (num_bytes < 1) { // not sending anything return true; } CommSession *session = comm_session_get_system_session(); if (!session) { return false; } ...
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 "rocky.h" #include "jmem-heap.h" #include "applib/rockyjs/api/rocky_api.h" #include "applib/rockyjs/api/rocky_api_u...
if (script) { // TODO: PBL-40010 clean this up // hotfix: we're either dealing with mmap, which is 8 byte aligned already // or malloc`ed buffer which has 7 additional bytes at the end. // We're are moving over the bytes so that they are 8-byte aligned // and pass that pointer to rocky instead c...
return rv; #else return false; #endif } bool rocky_event_loop_with_system_resource(uint32_t resource_id) { return prv_rocky_event_loop_with_resource(SYSTEM_APP, resource_id); } bool rocky_event_loop_with_resource(uint32_t resource_id) { return prv_rocky_event_loop_with_resource(sys_get_current_resource_num(...
/* * 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...
(&buffer, storage, sizeof(storage))
; const uint8_t* out_buffer; uint16_t out_length; // We should start out empty cl_assert(!circular_buffer_read(&buffer, 1, &out_buffer, &out_length)); cl_assert(circular_buffer_write(&buffer, (uint8_t*) "123", 3)); cl_assert_equal_i(circular_buffer_get_write_space_remaining(&buffer), 5); cl_assert(circ...
/* * 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...
snprintf(snooze_buf, sizeof(snooze_buf), i18n_get(snooze_text, dialog), alarm_get_snooze_delay())
; i18n_free(snooze_text, dialog); dialog_set_text(dialog, snooze_buf); dialog_set_icon(dialog, RESOURCE_ID_GENERIC_CONFIRMATION_LARGE); dialog_set_background_color(dialog, GColorJaegerGreen); dialog_set_timeout(dialog, DIALOG_TIMEOUT_DEFAULT); return simple_dialog; } static void prv_edit_snooze_delay(Actio...
0] = e->health_event.data.movement_update.steps; } } state->event_handler(e->health_event.type, state->context); // If we crossed an alert threshold, generate a metric alert event if (state->cache) { prv_check_and_generate_metric_alert(state, HealthMetricHeartRateBPM, ...
IS_WEEKDAY(positive_modulo(tm_weekday - index, DAYS_PER_WEEK))
); } bool health_service_private_weekend_filter(int index, int32_t value, void *tm_weekday_ref) { const int tm_weekday = (int)(uintptr_t)tm_weekday_ref; return (health_service_private_non_zero_filter(index, value, NULL) && IS_WEEKEND(positive_modulo(tm_weekday - index, DAYS_PER_WEEK))); } bool health_service_...
/* * 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 i18n_get_length(string); }
// Tests //////////////////////////////////// // (SU) = Single UNIX Specification extension // (GNU)= glibc extension // (TZ) = Olson's timezone package extension? // (C99)= C99 extension // We support them all~ #define EXTENSION_SU 1 #define EXTENSION_GNU 1 #define EXTENSION_TZ 1 #define EXTENSION_C99 1 // Our c...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
delay_us(10)
; #endif gpio_output_set(&ICE40LP->creset, true); // CRESET -> HIGH #if !defined(TARGET_QEMU) PBL_ASSERT(!gpio_input_read(&ICE40LP->cdone), "CDONE not low after reset"); // Wait until CRESET goes high again. It's open-drain (and someone with // tweezers might be grounding it) so it may take some time. PBL_...
tch_app_prefs_db_read, .del = watch_app_prefs_db_delete, .flush = watch_app_prefs_db_flush, #else // Disabled on tintin for code savings .disabled = true, #endif }, [BlobDBIdHealth] = { #if CAPABILITY_HAS_HEALTH_TRACKING .init = health_db_init, .insert = health_db_insert, .get_len = heal...
if (db->mark_synced) { status_t rv = db->mark_synced(key, key_len); // TODO event? return rv; }
return E_INVALID_OPERATION; }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
strlen(key)
- 1; // Set initial value backlight_set_timeout_ms(set_value + 1); // Insert and check the length cl_assert_equal_i(prefs_db_insert((uint8_t *)key, key_len, (uint8_t *)&set_value, sizeof(set_value)), 0); cl_assert_equal_i(prefs_db_get_len((uint8_t *)key, key_len), size...
_t start_ms = prv_now_ms(); animation_schedule(a); prv_advance_to_ms_with_timers(start_ms + duration + 2 * MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 1); // Make sure no anim...
(&s_stopped_handler_calls, b)
, 0); cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, seq), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, seq), 0); // Just before A completes prv_advance_to_ms_with_timers(start_m...
e_recognizers_processed((int[]) {4, 0, 1}, 3, &s_recognizers_handled); prv_compare_recognizers_processed(NULL, 0, &s_recognizers_reset); cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersActive); cl_assert_equal_i(recognizers[0]->state, RecognizerState_Possible); cl_assert_equal_i(recognizers[1...
(r[0], &manager)
; recognizer_set_manager(r[1], &manager); r[0]->state = RecognizerState_Failed; recognizer_manager_handle_state_change(&manager, r[0]); cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersActive); cl_assert_equal_p(manager.active_layer, &layer_a); prv_compare_recognizers_processed(NULL, 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...
analytics_external_collect_app_cpu_stats()
; analytics_external_collect_app_flash_read_stats(); analytics_external_collect_cpu_stats(); analytics_external_collect_stop_inhibitor_stats(rtc_get_ticks()); analytics_external_collect_chip_specific_parameters(); analytics_external_collect_bt_pairing_info(); analytics_external_collect_ble_parameters(); a...
ate(), MusicPlayStateUnknown); uint32_t track_pos_ms; uint32_t track_duration_ms; music_get_pos(&track_pos_ms, &track_duration_ms); cl_assert_equal_i(track_pos_ms, 0); cl_assert_equal_i(track_duration_ms, 0); cl_assert_equal_i(music_get_playback_rate_percent(), 0); } void test_ams__receive_non_numeric_pl...
cl_assert_equal_b(music_is_volume_reporting_supported(), true)
; cl_assert_equal_b(music_needs_user_to_start_playback_on_phone(), true); for (MusicCommand cmd = 0; cmd < NumMusicCommand; ++cmd) { cl_assert_equal_b(music_is_command_supported(cmd), true); } cl_assert_equal_b(music_is_command_supported(NumMusicCommand), false); } // Tests: Create & Destroy /////////////...
LEConnectionClient; //! Data structure to hold cached bonding info typedef struct { BTBondingID id; BTDeviceInternal device; // containing identity address, not connection address SMIdentityResolvingKey irk; } GAPLEConnectionIntentBonding; //! Intent to connect. //! Each intent is "owned" by one or more client...
{ event.bluetooth.connection.state = PebbleBluetoothConnectionEventStateDisconnected; }
f(*s_event_services[type])); s_event_services[type]->add_subscriber_callback = add_subscriber_callback; s_event_services[type]->remove_subscriber_callback = remove_subscriber_callback; } bool event_service_is_running(PebbleEventType event_type) { if (s_event_services[event_type] == NULL) { return (false); ...
{ esb->intents_pending |= CLAIMED_BIT; return esb; }
nizerState_Completed)); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Started)); r->state = RecognizerState_Possible; cl_assert_passert(recognizer_transition_state(r, RecognizerState_Possible)); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Updated)); cl_assert_passert(r...
recognizer_set_failed(r)
); r->state = RecognizerState_Completed; cl_assert_passert(recognizer_set_failed(r)); } static void prv_sub_destroy(const Recognizer *r) { bool *destroyed = recognizer_get_user_data(r); *destroyed = true; } void test_recognizer__destroy(void) { bool impl_destroyed = false; s_test_impl_data.destroyed = &i...
ight, timeline_iter_state->direction, timeline_iter_state->show_all_day_events) || !timeline_exists(&timeline_iter_state->node->id)); timeline_item_free_allocated_buffer(&timeline_iter_state->pin); timeline_iter_state->pin = (TimelineItem){}; status_t rv = pin_db_get(&timeline_iter_state->node->id, ...
if (item->header.all_day) { time_t today_midnight = time_util_get_midnight_of(now); if (today_midnight > item->header.timestamp || prv_should_show_all_day_events(timeline, now, today_midnight, TimelineIterDirectionPast)) { return TimelineIterDirectionPast; } else { return TimelineIterDir...
} bool timeline_nodes_equal(TimelineNode *a, TimelineNode *b) { if (a == NULL || b == NULL) { return (a == b); } return (uuid_equal(&a->id, &b->id) && (a->timestamp == b->timestamp)); } bool timeline_get_originator_id(const TimelineItem *item, Uuid *uuid) { TimelineItem pin = {}; const TimelineItem *pi...
onnected now. prv_mutate_whitelist(&event->peer_address, false /* remove */); } if (local_is_master && prv_is_intent_requiring_encryption(intent)) { // TODO: kick off pairing } } intent = next; } if (!local_is_master) { // At the moment...
{ PBL_LOG(LOG_LEVEL_ERROR, "Disconnection Complete Event status: 0x%x", event->status); break; }
} bt_unlock(); } // ------------------------------------------------------------------------------------------------- //! Convenience function to apply a function to each intent matching or resolving to a device //! bt_lock is assumed to be taken before calling this function. static void prv_apply_fuction_to_inte...
nter/exit time and total time strings static void prv_generate_sleep_pin_strings(int32_t sleep_enter_seconds, int32_t sleep_exit_seconds, int32_t sleep_total_seconds) { SLEEP_SUMMARY_PIN_CONFIG.detail_text[0] = '\0'; prv_strcat_fo...
(start_time, TIME_STRING_TIME_LENGTH, session->start_utc)
; clock_copy_time_string_timestamp(end_time, TIME_STRING_TIME_LENGTH, session->start_utc + duration_s); snprintf(time_range, max_attr_length, time_range_fmt, start_time, end_time); attribute_list_add_cstring(&pin_attr_list, PBL_IF_RECT_ELSE(Attribute...
46, 739, 193}, { 0, 0x56, 1894, 196}, { 0, 0x56, 617, 206}, { 0, 0x57, 2479, 197}, { 0, 0x56, 504, 198}, { 0, 0x46, 2446, 172}, { 0, 0x56, 2947, 194}, { 0, 0x67, 1414, 193}, { 0, 0x67, 1256, 198}, { 0, 0x68, 1121, 193}, { 0, 0x77, 328, 189}, // 525: Local time: 04:15:00 PM ...
{ 0, 0x26, 404, 151}, { 0, 0x17, 153, 146}, { 0, 0x19, 0, 146}, { 0, 0x19, 20, 152}, { 0, 0x37, 2643, 159}, { 0, 0x38, 762, 153}, { 0, 0x48, 29, 155}, { 0, 0x48, 10, 149}, { 0, 0x48, 63, 152}, { 0, 0x48, 37, 151}, { 0, 0x37, 1295, 152}, { 0, 0x48, 803, 147}, { 0, 0x27...
{ 0, 0x49, 1233, 161}, { 0, 0x49, 536, 164}, { 0, 0x59, 1364, 149}, { 15, 0x59, 1856, 144}, // 690: Local time: 07:01:00 PM { 32, 0x69, 1622, 158}, { 0, 0x48, 1786, 155}, { 0, 0x57, 5033, 147}, { 56, 0x42, 5692, 146}, { 119, 0x40, 6225, 142}, { 74, 0x41, 4778, 144}, { 26...
aler; tim_config.TIM_CounterMode = TIM_CounterMode_Up; TIM_TimeBaseInit(TIM2, &tim_config); TIM_ITConfig(TIM2, TIM_IT_Update, ENABLE); TIM_Cmd(TIM2, ENABLE); // Setup another unused interrupt vector to handle our low priority interrupts. When we need to do higher // level functions (like PBL_LOG), we trig...
{ // All tasks have checked in, feed the actual watchdog and clear any state. s_watchdog_bits = 0; watchdog_feed(); s_ticks_since_successful_feed = 0; if (s_last_warning_message_tick_time) { // We logged a warning message, clear this state as we apparently recoved. reboot_reason_clear...
// If we haven't fed the watchdog in the last 5 seconds and we haven't // spammed the log in the last 1/2 second, set the reboot reason - we are // about to go down... if (s_ticks_since_successful_feed >= WATCHDOG_WARN_TICK_CNT && ((s_ticks_since_successful_feed - s_last_warning_message_tick_time) > 0)...
PP_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_pend...
dict_serialize_tuplets_to_buffer_with_iter(&expected_it, tuplets, 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, expected_t->key); \ cl_assert(found_t); \ cl_assert_equal_i(found_t->ty...
i_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax1_aa_clip_xy.${BIT_DEPTH_NAME}.pbi")); // Should draw same as rmax1 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) + 1, GCornersAll); cl_ch...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_right.${BIT_DEPTH_NAME}.pbi"))
; setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornerTopLeft); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_topleft.${BIT_DEPTH_NAME}.pbi")); setup_test_a...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
voice_window_create(buffer, buffer_size, VoiceEndpointSessionTypeDictation)
; if (!voice_window) { applib_free(buffer); applib_free(session); return NULL; } *session = (DictationSession) { .callback = callback, .context = context, .voice_window = voice_window, .dictation_result_sub = (EventServiceInfo) { .type = PEBBLE_DICTATION_EVENT, .handler = ...
in this // section and will attempt to boot that. dbgserial_putstr("Old World firmware base"); erase_length += FW_WORLD_DIFFERENCE; } return system_flash_erase(system_flash_base, erase_length, prv_display_erase_progress, 0); } // Fills in the last 50% of the progress bar static void prv_display_write...
boot_bit_test(BOOT_BIT_NEW_FW_AVAILABLE)
) { return; } if (boot_bit_test(BOOT_BIT_NEW_FW_UPDATE_IN_PROGRESS)) { dbgserial_putstr("Our previous firmware update failed, aborting update."); // Pretend like the new firmware bit wasn't set afterall. We'll just run the // previous code, whether that was normal firmware or the recovery firmware...
an 13 13:11:02 PST 2015 .duration = 4, .type = TimelineItemTypePin, .flags = 0, .layout = LayoutIdTest, }, .attr_list = { .num_attributes = 0, .attributes = NULL, }, .action_group = { .num_actions = 0, .actions = NULL, }, .allocated...
cl_assert_equal_i(new_idx, 5)
; cl_assert_equal_i(timeline_model_get_num_items(), 2); cl_assert(uuid_equal(&s_items[s_correct_order[3]].header.id, &timeline_model_get_iter_state(-1)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[4]].header.id, &timeline_model_get_iter_state(0)->pin.header.id)); cl_assert(uuid_eq...
l_value(ActivityMetricDistanceMeters, Monday, &val_out)); } void test_health_db__sleep_data(void) { const char *key = "monday_sleepData"; cl_assert_equal_i(health_db_insert((uint8_t *)key, strlen(key), (uint8_t *)s_sleep_data, sizeof(s_sleep_data)), S_SUCCES...
(entries[i].val)
), S_SUCCESS); ActivityMetricAverages averages; health_db_get_typical_step_averages(i, &averages); int idx = i * 10; uint16_t val_expected = ((uint16_t *)entries[i].val)[idx]; cl_assert_equal_i(averages.average[idx], val_expected); } } void test_health_db__monthly_averages...
/* * 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_get_system_locale()
on(data, false /* open */); animation_set_duration(sidebar_slide, duration); animation_set_handlers(sidebar_slide, (AnimationHandlers) { .started = prv_intro_or_exit_anim_started, .stopped = prv_exit_anim_stopped, }, data); Animation *peek_anim = prv_create_peek_exit_anim(data, prev_state, duration); ...
(data, &state->pin.header.id)
) { timeline_pin_window_set_item(&data->pin_window, &state->pin, state->current_day); } } ///////////////////////////////////// // Timeline Controller ///////////////////////////////////// T_STATIC void prv_setup_no_events_peek(TimelineAppData *data); static void prv_update_timeline_layer(TimelineAppData *data...
egister_block(dev, ADDR_INFO_START, info, sizeof(AS7000InfoRecord))) { return false; } if (log_version) { // print out the version information PBL_LOG(LOG_LEVEL_INFO, "AS7000 enabled! Protocol v%" PRIu8 ".%" PRIu8 ", SW v%" PRIu8 ".%" PRIu8 ".%" PRIu8 ", HW Rev %" PRIu8, info->protoco...
if (dev->state->enabled_state == HRMEnabledState_Uninitialized) { PBL_LOG(LOG_LEVEL_ERROR, "Trying to enable HRM before initialization."); } else if (dev->state->enabled_state == HRMEnabledState_Disabled) { led_enable(LEDEnablerHRM); analytics_stopwatch_start(ANALYTICS_DEVICE_METRIC_HRM_ON_TIME, Analytic...
} // This system task callback is triggered by the watchdog interrupt handler when we detect // a frozen sensor static void prv_watchdog_timer_system_cb(void *data) { HRMDevice *dev = (HRMDevice *)data; mutex_lock(dev->state->lock); if (dev->state->enabled_state != HRMEnabledState_Enabled) { goto exit; } ...
ED { uint8_t sample_idx; net16 accel_x; net16 accel_y; net16 accel_z; } sample_data = { .sample_idx = sample_idx, .accel_x = hton16(data->x * 2), // Accel service supplies mGs, AS7000 expects lsb = 0.5 mG .accel_y = hton16(data->y * 2), .accel_z = hton16(data->z * 2) }; prv_write_r...
(HRM, average_handshake_interval_ms)
; } // Read the SYNC byte to release handshake signal and enter deep sleep mode. uint8_t unused; prv_read_register(HRM, ADDR_SYNC, &unused); PPG_DBG("Handshake handle done"); HRM->state->handshake_count++; PROFILER_NODE_STOP(hrm_handling); mutex_unlock(HRM->state->lock); // PPG_DBG log out each...
iter_state(1)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[4]].header.id, &timeline_model_get_iter_state(2)->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...
{ 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); for (int i = 0; i < ARRAY_LENGTH(s_items); i++) { timeline_model_remove(&s_items[i].header.id); } c...
prv_get_korea_kcc_id(), info_text_font, GColorBlack, GColorClear, GTextAlignmentCenter, GTextOverflowModeTrailingEllipsis); layer_add_child(window_layer, text_layer_get_layer(&data->info_text)); } static void prv_kcc_w...
stationary_set_enabled(!stationary_get_enabled())
; break; case SystemMenuItemShutDown: if (prv_shutdown_enabled()) { launcher_task_add_callback(prv_shutdown_cb, 0); } break; case SystemMenuItemFactoryReset: settings_factory_reset_window_push(); break; default: WTF; } settings_menu_reload_data(SettingsM...
000}, { 56, 24, -1000}, { 56, 16, -1000}, { 56, 16, -1000}, { 56, 24, -1000}, { 56, 16, -1000}, { 56, 24, -1000}, { 56, 16, -1000}, { 64, 24, -1000}, { 56, 16, -1000}, { 56, 16, -1000}, { 56, 16, -1000}, { 56, 16, -1000}, { 64, 16, -1000}, { 56, 16, -1000}, { ...
{ 56, 16, -1000}, { 64, 16, -1000}, { 56, 16, -1000}, { 64, 24, -1000}, { 56, 24, -992}, { 64, 8, -1000}, { 56, 24, -1000}, { 56, 16, -1000}, { 56, 16, -1000}, { 56, 24, -1000}, { 56, 16, -1000}, { 56, 24, -1000}, { 48, 16, -1000}, { 56, 24, -1000}, { 56, 16, ...
{ 56, 8, -1000}, { 56, 24, -1000}, { 56, 16, -1000}, { 56, 16, -1000}, { 56, 24, -1000}, { 56, 16, -1000}, { 56, 24, -1000}, { 56, 16, -1000}, { 56, 16, -1000}, { 56, 16, -1000}, { 64, 16, -1000}, { 56, 16, -1000}, { 64, 16, -1000}, { 56, 16, -1000}, { 56, 16...
, -356); check_atan2(-78, 268); check_atan2(-247, 37); check_atan2(-119, 33); check_atan2(234, -253); check_atan2(355, -193); check_atan2(-6, -310); check_atan2(15, -19); check_atan2(34, -32); check_atan2(-158, 299); check_atan2(120, 102); check_atan2(0, 0); check_atan2(0, 10); check_atan2(10,...
(min, min, max)
normal_run_distance_m, 4500, 5500); // Running for 25 minutes again, but this time faster steps = (running_cadence_spm * 1.15) * run_time; time_ms = run_time * SECONDS_PER_MINUTE * MS_PER_SECOND; int fast_run_distance_m = activity_private_compute_distance_mm(steps, time_ms) / MM_PER_METER; cl_assert_within(f...
(long_time_m)
/ ACTIVITY_CALORIES_PER_KCAL); cl_assert_equal_i(4, activity_private_compute_resting_calories(short_time_m) / ACTIVITY_CALORIES_PER_KCAL); prv_set_user(Human_TallMale); cl_assert_equal_i(1796, activity_private_compute_resting_calories(long_time_m)/ ACTIVITY_CALORIES_PER_KCAL); cl_assert_equal_i(6, activity_p...
s(layer, &unobstructed_bounds); #if UNITTEST unobstructed_bounds.size.h = bounds.size.h - s_unobstructed_area_height; #endif const bool screen_is_obstructed = (unobstructed_bounds.size.h != bounds.size.h); bounds.size.h = unobstructed_bounds.size.h; #if SNOWY_SCREEN_RES const int16_t fill_thickness = screen...
time_start_of_today()
+ SECONDS_PER_DAY, HealthServiceTimeScopeWeekly); } static void prv_update_hrm_bpm(KickstartData *data) { data->current_bpm = health_service_peek_current_value(HealthMetricHeartRateBPM); } static void prv_normalize_data(KickstartData *data) { // If the user's dai...