prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
{ 736, 376, -320}, { 912, 416, -352}, { 944, 480, -480}, { 984, 464, -504}, { 1016, 336, -384}, { 1232, 344, -304}, { 1312, 528, -416}, { 1296, 552, -472}, { 1320, 392, -288}, { 1440, 296, -256}, // 21 seconds { 1216, 240, -248}, { 896, 248, -224}, { 760, 240, -224}, ...
{ 1224, 48, -192}, { 888, 152, -328}, { 696, 256, -376}, { 640, 176, -304}, { 608, 136, -336}, { 752, 248, -384}, { 904, 408, -440}, { 872, 352, -416}, { 816, 432, -424}, { 872, 440, -344}, { 920, 504, -184}, { 1208, 696, -176}, { 1232, 896, -312}, { 1504, 896, -2...
{ 152, -424, -880}, { 184, -400, -968}, { 160, -392, -1040}, { 136, -336, -1200}, { 160, -32, -1280}, { 96, 80, -1192}, { 200, 56, -1176}, // 29 seconds { 232, -48, -1032}, { 152, -128, -824}, { 104, -200, -696}, { 112, -216, -632}, { 168, -240, -648}, { 240, -23...
/* * 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 (window->click_config_provider) { window_call_click_config_provider(window, context); }
}
PmicRegisters_GPIO4_CNTL = 0x0c, PmicRegisters_GPIO5_CNTL = 0x0d, PmicRegisters_GPIO_SIG_OUT = 0x20, PmicRegisters_GPIO_SIG_IN = 0x21, PmicRegisters_REG1_VOLTAGE = 0x22, PmicRegisters_REG2_VOLTAGE = 0x23, PmicRegisters_REG_CNTL = 0x24, PmicRegisters_GPIO_CNTL1 = 0x25, PmicRegisters_GPIO_CNTL2 = 0x2...
(I2C_DEVICE_AS3701B, AS3701B_WRITE_ADDR, register_address, value)
; i2c_release(I2C_DEVICE_AS3701B); return rv; } static bool prv_register_set_bit(uint8_t register_address, uint8_t bit) { uint8_t val; if (!prv_read_register(register_address, &val)) { return false; } val |= (1 << bit); return prv_write_register(register_address, val); } static bool prv_register_cl...
ctx->draw_state.stroke_color = tmp_color; // We're done here return; } else */ if (radius_outer.raw_value - radius_inner.raw_value < FIXED_S16_3_ONE.raw_value) { // Abort, abort! return; } prv_fill_oval_precise(ctx, center, radius_outer, radius_outer, radius_inner, radi...
{ GPointPrecise center; Fixed_S16_3 radius; grect_polar_calc_values(rect, scale_mode, &center, &radius); return gpoint_from_polar_precise(&center, radius.raw_value, angle); }
GPoint gpoint_from_polar(GRect rect, GOvalScaleMode scale_mode, int32_t angle) { const GPointPrecise result = prv_gpointprecise_from_polar(&rect, scale_mode, angle); return GPointFromGPointPrecise(result); } GRect grect_centered_internal(const GPointPrecise *center, GSize size) { size.w = ABS(size.w); size.h...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
callback(window)
; } bool window_manager_is_window_visible(Window *window) { return prv_is_app_or_modal_predicate(modal_manager_is_window_visible, window); } bool window_manager_is_window_focused(Window *window) { return prv_is_app_or_modal_predicate(modal_manager_is_window_focused, window); } Window *window_manager_get_top_wind...
/* * 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_add(b, &b1, sizeof(uint8_t))
; buffer_add(b, &b2, sizeof(uint8_t)); buffer_add(b, &b3, sizeof(uint8_t)); buffer_add(b, &b4, sizeof(uint8_t)); // handles out of bounds cases cl_assert_passert(buffer_remove(b, 0, 5)); cl_assert_passert(buffer_remove(b, 1, 4)); cl_assert_equal_i(4, b->bytes_written); cl_assert_equal_i(b->data[0], b1...
tifications_received++; } else if (uid == attribute_at_end_uid) { prv_fake_receiving_ds_notification(ARRAY_LENGTH(memory_with_attribute_id_at_end.attribute_data), (uint8_t*) memory_with_attribute_id_at_end.attribute_data); prv_fake_receiving_ds_notification(ARRAY_LENGTH(memory_with_attribute_id_at_end_p2), (u...
regular_timer_seconds_count()
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
APP_LOG(APP_LOG_LEVEL_DEBUG, "Executing teardown handler for %d", (int)animation)
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 IS...
list_find(s_data_subscribers, prv_session_ref_list_filter, (void*)session)
nst char *title = NULL; switch (row) { case NotificationsItemFilter: title = i18n_noop("Filter"); subtitle = prv_alert_mask_to_label(alerts_get_mask()); break; #if !CAPABILITY_HAS_VIBE_SCORES case NotificationsItemVibration: title = i18n_noop("Vibration"); if (battery_is_usb_con...
vibe_intensity_get()
); analytics_set(ANALYTICS_DEVICE_METRIC_SETTING_VIBRATION_STRENGTH, strength, AnalyticsClient_System); }
alformed_payload, sizeof(malformed_payload))); // Expect Error: const PostMessageUnsupportedErrorPayload expected_error = { .error_code = PostMessageErrorMalformedResetComplete, }; EXPECT_OUTBOX_MESSAGE_PENDING(TupletBytes(PostMessageKeyUnsupportedError, (const u...
{ prv_init_and_goto_session_open(); EXECUTE_SCRIPT("var isCalled = false;" "_rocky.on('postmessagedisconnected', function() { isCalled = true; });"); ASSERT_JS_GLOBAL_EQUALS_B("isCalled", false); RCV_RESET_COMPLETE(); cl_assert_equal_i(rocky_api_app_message_get_state(), ...
//////////////////////////////////////////////////////////////////////////////// // postmessageconnected / postmessagedisconnected //////////////////////////////////////////////////////////////////////////////// static void prv_postmessageconnected_postmessagedisconnected_init(bool start_connected) { prv_init_api(...
C = 0x02; //! Which file we're writing to this boot. [0 - DEBUG_DB_NUM_FILES) static int s_current_file_index; //! The id we're using for the current file. static uint8_t s_current_file_id; static int generation_to_index(int file_generation) { int index = s_current_file_index - file_generation; if (index < 0) { ...
(generation_to_index(file_generation))
+ SECTION_HEADER_SIZE_BYTES; } void debug_db_reformat_header_section(void) { flash_erase_subsector_blocking(get_current_file_address()); FirmwareMetadata md; bool result = version_copy_running_fw_metadata(&md); PBL_ASSERTN(result); FileHeader file_header = { .basic = { .magic = VALID_FILE_HEADER...
et_calendar_ongoing()); TimerID timer_id = stub_new_timer_get_next(); cl_assert(timer_id != TIMER_INVALID_ID); cl_assert(stub_new_timer_is_scheduled(timer_id)); cl_assert_equal_i(5*60, stub_new_timer_timeout(timer_id) / 1000); } void test_calendar_handle__ongoing_event_added_and_removed(void) { rtc_set_time(...
cl_assert_equal_i(10*60, stub_new_timer_timeout(timer_id) / 1000)
; rtc_set_time(110 * 60); cl_assert(stub_new_timer_fire(timer_id)); cl_assert_equal_i(fake_event_get_count(), 6); cl_assert(!prv_get_calendar_ongoing()); cl_assert(!stub_new_timer_is_scheduled(timer_id)); } void test_calendar__handle_non_calendar_pins(void) { // Insert a random pin (non calendar event) ...
nse at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific langu...
bma255_write_register(BMA255Register_EXTENDED_MEMORY_MAP, BMA255_EXTENDED_MEMORY_MAP_CLOSE)
; exti_configure_pin(BOARD_CONFIG_ACCEL.accel_ints[0], ExtiTrigger_Rising, prv_bma255_IRQ1_handler); exti_configure_pin(BOARD_CONFIG_ACCEL.accel_ints[1], ExtiTrigger_Rising, prv_bma255_IRQ2_handler); } bool bma255_query_whoami(void) { const uint8_t chip_id = bma255_read_register(BMA255Register_BGW_CHIP_ID); P...
_empty("white_over_black", ctx.parent_framebuffer, GColorWhite)); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_pixel_inside_origin_layer.${BIT_DEPTH_NAME}.pbi")); layer_set...
test_graphics_context_reset(ctx, fb)
; setup_test_aa_sw(ctx, fb, CLIP_RECT_CLIP_BOX, CLIP_RECT_DRAW_BOX, aa, sw); graphics_context_set_stroke_color(ctx, GColorBlack); // Left boundary graphics_draw_pixel(ctx, GPoint(-1, 5)); graphics_draw_pixel(ctx, GPoint(0, 10)); graphics_draw_pixel(ctx, GPoint(1, 15)); // Right boundary graphics_draw_...
w_line(ctx, top_l, top_r); // top graphics_draw_line(ctx, bottom_l, bottom_r); // bottom graphics_draw_line(ctx, left_t, left_b); // left graphics_draw_line(ctx, right_t, right_b); // right // Draw quadrants const GPoint tl = GPoint(origin.x + radius, origin.y + radius); const GPoint tr = gpoin...
{ PBL_ASSERTN(context); PBL_ASSERTN(framebuffer); *context = (GContext) { // For apps, this is run before the app has a chance to run, so there's no concern here of the // app changing its framebuffer size. .dest_bitmap = framebuffer_get_as_bitmap(framebuffer, &framebuffer->size), .parent_framebu...
void graphics_context_set_default_drawing_state(GContext *ctx, GContextInitializationMode init_mode) { PBL_ASSERTN(ctx); GBitmap* bitmap = graphics_context_get_bitmap(ctx); ctx->draw_state = (GDrawState) { .stroke_color = GColorBlack, .fill_color = GColor...
s are stuck at high. If they are, then the previous write to // address 0 would have trashed the data at one of the other addresses uint8_t base_addr_pos = 0; uint8_t bitpos; bool stuck_at_high = false; for (bit_offset = 1, bitpos = 0; bit_offset & addr_mask; bit_offset <<= 1, bitpos++) { if (bit_offset >...
{ test_addr = test_offset; }
else { test_addr = base_addr + test_offset; } if (test_addr >= FLASH_TEST_ADDR_END) { break; } // Skip base address if (test_addr == base_addr) { continue; } PBL_LOG(LOG_LEVEL_DEBUG, ">> Testing Stuck at Low at Addr 0x%"PRIx32, test_addr); // After we write test_pat...
st do nothing. if (bitmap_supports_transparency && (png_decoder_data->last_dispose_op == APNG_DISPOSE_OP_BACKGROUND)) { const uint32_t y_origin = bitmap->bounds.origin.y + png_decoder_data->previous_yoffset; for (uint32_t y = y_origin; y < y_origin + png_decoder_data->previous_height; y++) { const...
{ const uint16_t corrected_y = fctl.y_offset + y + bitmap->bounds.origin.y; const GBitmapDataRowInfo row_info = gbitmap_get_data_row_info(bitmap, corrected_y); // delta_x is the first bit of data in this frame relative to the bitmap's coordinate system const int16_t delta_x = fctl.x_offset + bi...
} // Successfully updated gbitmap from sequence retval = true; cleanup: if (!retval) { APP_LOG(APP_LOG_LEVEL_ERROR, APNG_UPDATE_ERROR); applib_free(buffer); } return retval; } // total elapsed from start of animation bool gbitmap_sequence_update_bitmap_by_elapsed(GBitmapSequence *bitmap_sequenc...
ion, void *data) { RtcTicks *soonest_ack_timeout = (RtcTicks*) data; if (session->comm.ack_timeout != 0 && (session->comm.ack_timeout < *soonest_ack_timeout || *soonest_ack_timeout == 0)) { *soonest_ack_timeout = session->comm.ack_timeout; } return true; } static void reschedule_ack_timeout(void) { ...
comm_session_get_system_session()
; if (!session) { return false; } mutex_lock(s_endpoint_data.mutex); if (logging_session->comm.state != DataLoggingSessionCommStateIdle) { mutex_unlock(s_endpoint_data.mutex); // logging_session is waiting for an ack, we'll send next time around // don't return a failure, this is pretty innocuo...
ror codes and update Pebble Pairing Service's Conn Status characteristic: const uint8_t smp_status = SMP_GET_PAIR_FAIL_REASON(evt->status); connection_set_last_pairing_result(conn_idx, smp_status); pebble_pairing_service_handle_status_change(conn, conn_idx); } static void prv_handle_gatt_mtu_changed(const ble_ev...
local_addr_init()
; // Do all the things that clear the ATT table before registering the local services: prv_configure_local_device_properties(init_info->config); gatt_local_services_init(init_info->config); gatt_local_services_register(); PBL_LOG(LOG_LEVEL_DEBUG, "start the loop"); #if TEST_HCI_ROM_PASSTHROUGH test_hci_...
esc_p = (jerry_property_descriptor_t) { .value = jerry_create_undefined(), .getter = jerry_create_undefined(), .setter = jerry_create_undefined(), }; } jerry_value_t jerry_define_own_property(const jerry_value_t obj_val, const jerry_value_t prop_name_val, ...
getValue($1 + i*4, 'i32')
)); } // Call the constructor with new object as `this` var bindArgs = [null].concat(args); var boundConstructor = func_obj.bind.apply(func_obj, bindArgs); var rv = new boundConstructor(); return __jerryRefs.ref(rv); }, func_obj_val, args_p, args_count); } jerry_size...
age) + offsetof(PageHeader, erase_count)); prv_flash_read((uint8_t *)&hdr->last_written, sizeof(hdr->last_written), prv_page_to_flash_offset(page) + offsetof(PageHeader, last_written)); // feed watchdog since erases can take a while & give lower priority tasks // a little time in case we are calling this f...
{ return (erase_region * PFS_PAGES_PER_ERASE_SECTOR); }
} return (-1); } static status_t garbage_collect_sector(uint16_t *free_page, uint16_t sector_start_page, uint32_t sectors_active); //! Updates the last written page to point to next_page static NOINLINE void prv_update_last_written_page(uint16_t next_page) { PageHeader hdr = { 0 }; uint16_t prev_writte...
child(&url_text_layer->layer, &name_text_layer->layer); data->is_showing_version = false; prv_update_background_image_and_url_text(data); prv_update_name_text(data); } static void prv_push_window(struct RecoveryFUAppData* data) { Window* window = &data->launch_app_window; window_init(window, WINDOW_NAME("F...
{ RecoveryFUAppData *data = app_state_get_user_data(); getting_started_button_combo_deinit(&data->button_combo_state); kino_layer_deinit(&data->kino_layer); event_service_client_unsubscribe(&data->pebble_mobile_app_event_info); event_service_client_unsubscribe(&data->bt_connection_event_info); event_serv...
s_out_failed_call_count = 0; s_ack_sent_is_called = false; s_nack_sent_is_called = false; s_in_received_is_called = false; s_in_dropped_is_called = false; s_ack_received_for_id_1 = false; s_nack_received_for_id_2 = false; s_remote_receive_handler = NULL; s_dropped_reason = APP_MSG_OK; s_failure_resu...
app_message_ack_timer_id()
); prv_process_sent_data(); cl_assert_equal_i(s_out_sent_call_count, 0); cl_assert_equal_i(s_out_failed_call_count, 1); cl_assert_equal_i(s_failure_result, APP_MSG_SEND_TIMEOUT); // Check the state is reset properly cl_assert_equal_b(app_message_is_accepting_outbound(), true); } void test_app_message__se...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_LOG(LOG_LEVEL_ERROR, "No connection found for pairing complete")
; return; } const bool success = (status == HciStatusCode_Success); if (!success) { bluetooth_analytics_handle_ble_pairing_error(status); PBL_LOG(LOG_LEVEL_ERROR, "Pairing failed w/ status: 0x%x", status); } bt_driver_cb_pairing_confirm_handle_completed(ctx, success); }
/* * 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, CENTER_OF_ORIGIN_RECT_NXNY, RADIUS_MEDIUM)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_origin_aa_r8_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // Small circles setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, STROKE_SMALL); graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_SMALL); cl_check(gbitmap_pbi_eq(&ctx....
/* * 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...
RCC_GetClocksFreq(&RCC_ClocksStatus)
; uint64_t scaled_apbclock = DIV_PRECISION; if ((dev->periph == USART1) || (dev->periph == USART6)) { scaled_apbclock *= RCC_ClocksStatus.PCLK2_Frequency; } else { scaled_apbclock *= RCC_ClocksStatus.PCLK1_Frequency; } if (dev->periph->CR1 & USART_CR1_OVER8) { scaled_apbclock <<= 1; } // cal...
tells us when the phone stops ringing //! - The watch can pickup / decline a call using ANCS actions //! - We don't show the ongoing call UI because we must continue to poll so that we know when the //! call ends, which consumes a lot of battery especially for longer calls. On iOS 9, we only //! know when the phon...
(event->caller, prv_can_answer(), prv_should_show_ongoing_call_ui(), s_call_source)
; analytics_inc(ANALYTICS_DEVICE_METRIC_PHONE_CALL_INCOMING_COUNT, AnalyticsClient_System); analytics_stopwatch_start(ANALYTICS_DEVICE_METRIC_PHONE_CALL_TIME, AnalyticsClient_System); } static void prv_handle_outgoing_call(PebblePhoneEvent *event) { // Only 1 call at a time is supported if (!s_call_in_progress...
imprecise_center_point = (GPoint) { .x = bounds->size.w * 3 / 4 - 5, .y = bounds->size.h / 2, }; case CLOCK_LOCATION_BOTTOM: imprecise_center_point = (GPoint) { .x = bounds->size.w / 2, .y = bounds->size.h * 3 / 4 + 6, }; case CLOCK_LOCATION_LEFT: impreci...
app_zalloc_check(sizeof(*data))
; app_state_set_user_data(data); data->text_font = fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD); window_init(&data->window, "TicToc"); window_set_window_handlers(&data->window, &(WindowHandlers) { .load = prv_window_load, .unload = prv_window_unload, }); const bool animated = true; app_window_...
{ *buffer = flash_read_next_byte(); buffer++; } } else { enable_flash_dma_clock(); setup_dma_read(buffer, buffer_size); do_dma_transfer(); disable_flash_dma_clock(); } flash_end_cmd(); disable_flash_spi_clock(); power_tracking_stop(PowerSystemFlashRead); flash_unlock(); }...
if (enable == s_flash_state.sleep_when_idle) { return; }
flash_lock(); if (!s_flash_state.enabled) { flash_unlock(); return; } enable_flash_spi_clock(); s_flash_state.sleep_when_idle = enable; if (enable) { if (!s_flash_state.deep_sleep) { flash_deep_sleep_enter(); } } else { if (s_flash_state.deep_sleep) { flash_deep_sleep...
*ctx, GBitmap *buffer) { PBL_ASSERTN(ctx); ctx->lock = false; framebuffer_dirty_all(ctx->parent_framebuffer); return true; } void test_simple_dialog__initialize(void) { fb = malloc(sizeof(FrameBuffer)); framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); test_graphics_context_init(&s_ctx, fb); frame...
(s_dest_bitmap, TEST_PBI_FILE)
); } void test_simple_dialog__alarm_deleted(void) { SimpleDialog *simple_dialog = simple_dialog_create("Alarm Deleted"); Dialog *dialog = simple_dialog_get_dialog(simple_dialog); dialog_set_text(dialog, "Alarm Deleted"); dialog_set_icon(dialog, RESOURCE_ID_RESULT_SHREDDED_LARGE); dialog_set_background_color(...
/* * 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...
{ // In MFG mode, disable low power mode above but don't close the app. if (mfg_is_mfg_mode()) { return; } app_manager_close_current_app(true); }
#endif } void low_power_standby(void) { analytics_stopwatch_stop(ANALYTICS_DEVICE_METRIC_WATCH_ONLY_TIME); enter_standby(RebootReasonCode_LowBattery); } void low_power_enter(void) { #if RECOVERY_FW if (mfg_is_mfg_mode()) { return; } #endif prv_low_power_transition(true); } void low_power_exit(void) { ...
_peek_in_5_minutes(void) { prv_render_timeline_peek(&(TimelinePeekItemConfig) { .timestamp = rtc_get_time() + (5 * SECONDS_PER_MINUTE), .title = "Stock for party 🍺", .subtitle = "Pebble Pad on Park", .icon = TIMELINE_RESOURCE_NOTIFICATION_REMINDER, .num_concurrent = 2, }); cl_check(gbitmap_pb...
(layer->frame.origin.y < DISP_ROWS)
; timeline_item_destroy(item); } void test_timeline_peek__peek_visible_leaving_and_entering_watchface(void) { TimelineItem *item = prv_set_timeline_item(&(TimelinePeekItemConfig) { .title = "CoreUX Design x Eng", .subtitle = "ConfRM-Missile Command", .icon = TIMELINE_RESOURCE_TIMELINE_CALENDAR, .nu...
ngs_raw_iter_read_val(&file->iter, val_out, val_out_len); return S_SUCCESS; } status_t settings_file_set_byte(SettingsFile *file, const void *key, size_t key_len, size_t offset, uint8_t byte) { if (key_len > SETTINGS_KEY_MAX_LEN) { return E_RANGE; } // Find the record set...
settings_raw_iter_write_header(&file->iter, &file->iter.hdr)
; return S_SUCCESS; } return E_DOES_NOT_EXIST; } status_t settings_file_delete(SettingsFile *file, const void *key, size_t key_len) { return settings_file_set(file, key, key_len, NULL, 0); } static void prv_get_key(SettingsFile *file, void *key, size_t key_len) { PBL_ASSERTN...
(void) { // Allocate mutable types Iterator word_iter = (Iterator) { 0 }; WordIterState word_iter_state = (WordIterState) { 0 }; Line line = (Line) { 0 }; // Allocate immutable types bool success = false; const char *sentence = NIHAO_JOINED NIHAO NIHAOMA_JOINED NIHAO_JOINED NIHAO_JOINED; const Utf8Bou...
cl_assert(*word_iter_state.current.end == ' ')
; cl_assert(word_iter_state.current.width_px == HORIZ_ADVANCE_PX * 3); line_reset(&line, utf8_bounds.start); cl_assert(line_add_words(&line, &word_iter, NULL)); cl_assert(line.height_px == 10); cl_assert(line.width_px == HORIZ_ADVANCE_PX * 3); cl_assert(line.origin.x == 0); cl_assert(line.origin.y == 0);...
_time(event_time - (2 * SECONDS_PER_HOUR)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("IN 2 H", time_buf); // June 9th 2015, 15:59:00 (T-00:01:00) rtc_set_time(event_time - (1 * SECONDS_PER_MINUTE)); clock_get_until_time_capitalized(time_buf...
(event_time + (12 * SECONDS_PER_HOUR))
; clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("Yesterday, 16:00", time_buf); // June 9th 2015, 02:00:00 (T-14:00:00) rtc_set_time(event_time - (14 * SECONDS_PER_HOUR)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, M...
/* * 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_theme_get_font(TextStyleFont_Header)
i18n_get("%d Min", headings), zone_2_minutes); string_list_add_string(headings, headings_buf_size, i18n_get("Endurance", headings), headings_buf_size); string_list_add_string(values, values_buf_size, hr_str, values_buf_size); } const int zone_3_minutes = ROUND(hr_zone_ti...
i18n_free_all(body)
; i18n_free_all(headings); i18n_free_all(values); kernel_free(body); kernel_free(headings); kernel_free(values); } // ------------------------------------------------------------------------------------------------ static void prv_do_activity_session(time_t now_utc, ActivitySession *session) { if (!activit...
{ 1376, 512, -344}, { 1248, 840, -392}, { 1424, 920, -776}, { 1080, 776, -464}, // 36 seconds { 1320, 624, -280}, { 1232, 648, -456}, { 1096, 536, -472}, { 1240, 456, -328}, { 1384, 344, -272}, { 1296, 272, -232}, { 1184, 208, -272}, { 1224, 208, -256}, { 1264, 224, ...
{ 1112, 528, -360}, { 1208, 480, -360}, { 1088, 352, -176}, { 1072, 312, -152}, { 1296, 256, -224}, { 1360, 208, -160}, { 1264, 168, -176}, { 1312, 176, -288}, { 1136, 88, -344}, { 848, -40, -304}, { 1064, -96, -160}, { 984, -32, -184}, { 1072, 88, -328}, { 1152, ...
{ 848, 192, -296}, { 960, 264, -312}, { 1168, 272, -352}, { 1240, 344, -352}, // 44 seconds { 1408, 552, -536}, { 1328, 944, -712}, { 1184, 224, -528}, { 1288, 624, -560}, { 1096, 448, -456}, { 1136, 376, -392}, { 1224, 312, -344}, { 1120, 240, -288}, { 1024, 184...
ices/normal/blob_db/sync.h" #include "util/size.h" // Writebacks counter //////////////////////// static int s_num_writebacks; static int s_num_until_timeout; void blob_db_endpoint_send_sync_done(BlobDBId db_id) { return; } static void prv_handle_response_from_phone(void *data) { s_num_writebacks++; BlobDBSy...
(list_find(&dirty_list->node, prv_list_key_comparator, keys[i]) != NULL)
; } blob_db_util_free_dirty_list(dirty_list); // mark one as synced and re-check for (int synced_idx = 1; synced_idx < ARRAY_LENGTH(keys); ++synced_idx) { blob_db_mark_synced(BlobDBIdTest, (uint8_t *)keys[synced_idx - 1], key_len); dirty_list = blob_db_get_dirty_list(BlobDBIdTest); cl_assert_equal...
/* * 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...
transition_context->implementation->render(transition_context, ctx)
; } } *app_state_get_framebuffer_render_pending() = true; PebbleEvent event = { .type = PEBBLE_RENDER_READY_EVENT, }; sys_send_pebble_event_to_kernel(&event); } static bool prv_window_is_render_scheduled(Window *window) { return window && window->is_render_scheduled; } static bool prv_app_is_ren...
/* * 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_Unlock()
/* * 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...
(CTRL_REG1, 0x00)
(file_name), "file%d", i); cl_assert(pfs_remove(file_name) == S_SUCCESS); } cl_assert(pfs_active_in_region(0, pfs_get_size())); // continuation page on region and make sure pfs is active pfs_format(true); int fd = pfs_open("testfile", OP_FLAG_WRITE, FILE_TYPE_STATIC, 68000); cl_assert(fd >= 0); cl_as...
(memcmp(rbuf, buf, len) == 0)
; cl_assert(fd >= 0); cl_assert(pfs_close(fd) == S_SUCCESS); } } static uint32_t s_watch_file_callback_called_count = 0; static void prv_file_changed_callback(void *data) { s_watch_file_callback_called_count++; } void test_pfs__watch_file_callbacks(void) { const char* file_name = "newfile"; PFSCallba...
/* * 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...
task_free(ptr)
; #endif }
/* * 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...
(&pwm->output, false /* force low */)
; } const FunctionalState state = (enable) ? ENABLE : DISABLE; TIM_Cmd(pwm->timer.peripheral, state); }
l_b(s_dls_private_handle_disconnect_called, true); cl_assert_equal_b(s_comm_session_event_put, true); } void test_session__get_type_app(void) { Transport *transport = (Transport *) TransportID1; CommSession *session = comm_session_open(transport, &s_transport_imp, Trans...
(comm_session_deinit())
CallStates } PhoneCallState; enum PhoneCmd { PhoneCmdAnswer = 0x01, PhoneCmdHangup = 0x02, PhoneCmdGetStateRequest = 0x03, PhoneCmdGetStateResponse = 0x83, PhoneCmdIncoming = 0x04, PhoneCmdOutgoing = 0x05, PhoneCmdMissed = 0x06, PhoneCmdRing = ...
{ return false; }
bool result = get_call_info_from_msg(iter, length, &call_info); if (!result) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to read caller information from 'Incoming' phone event"); return false; } #ifndef RELEASE print_call_info(&call_info); #endif type = PhoneEventType_Incoming; ...
FLASH_Lock()
; return true; } bool system_flash_write( uint32_t address, const void *data, size_t length, SystemFlashProgressCb progress_callback, void *progress_context) { FLASH_Unlock(); FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | FLASH_FLAG_PGPE...
rk_dirty.last_call.layer); } void test_rocky_api_graphics__provides_draw_event(void) { rocky_global_init(s_graphics_api); cl_assert_equal_b(false, rocky_global_has_event_handlers("draw")); EXECUTE_SCRIPT("_rocky.on('draw', function() {});"); cl_assert_equal_b(true, rocky_global_has_event_handlers("draw")); } ...
PP(29.5, 39.5)
if (!system_resource_is_valid()) { return false; }
// Do stuff that needs to happen when stack starts, i.e. bootstrap, load FW, ... if (!dialog_bootrom_load_second_stage_bootloader()) { // Failed to load BT bootloader. Shutdown if we haven't tried this already. PBL_LOG(LOG_LEVEL_ERROR, "Failed to load BLE Second Stage Bootloader - shutting down"); if ...
/* * 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_current_flush_line = 0; framebuffer_reset_dirty(compositor_get_framebuffer()); if (s_update_complete_handler) { s_update_complete_handler(); } }
void compositor_display_update(void (*handle_update_complete_cb)(void)) { if (!framebuffer_is_dirty(compositor_get_framebuffer())) { return; } s_update_complete_handler = handle_update_complete_cb; s_current_flush_line = 0; display_update(&prv_flush_get_next_line_cb, &prv_flush_complete_cb); } bool co...
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 IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ...
window_get_user_data(window)
; Dialog *dialog = &expandable_dialog->dialog; GRect frame = window->layer.bounds; static const uint16_t ICON_TOP_MARGIN_PX = 16; static const uint16_t BOTTOM_MARGIN_PX = 6; static const uint16_t CONTENT_DOWN_ARROW_HEIGHT = PBL_IF_RECT_ELSE(16, 10); // Small margin is shown when we have an action bar to f...
bs_hexdump.h" #include "stubs_passert.h" // Fakes /////////////////////////////////////////////////////////// static TimerID s_debounce_timer; static bool s_default_connection_state; static unsigned int s_event_count = 0; static PebbleEvent s_cached_event; static Transport *s_transport; static CommSession *s_session...
{ //! Currently connected init(true /* connected */); check_connected(); //! Get disconnected event prv_send_connection_event(false); check_waiting_to_send_disconnect(); // No event put cl_assert_equal_i(s_event_count, 0); //! Get connected event before timer fires prv_send_connection_event(true...
!ble_ad_includes_service(s_ad_data, &missing_uuid)); // Test ble_ad_copy_service_uuids, destination array sized larged enough: const uint8_t count = 4; Uuid copied_uuids[count]; uint8_t found = ble_ad_copy_service_uuids(s_ad_data, copied_uuids, count); cl_assert_equal_i(found, 1); // Test ble_ad_copy_serv...
ble_ad_create()
; cl_assert_equal_b(ble_ad_set_service_uuids(ad, uuid, 2), true); cl_assert_equal_i(memcmp(expected_ad_data, ad->data, sizeof(expected_ad_data)), 0); cl_assert_equal_i(ad->ad_data_length, sizeof(expected_ad_data)); cl_assert_equal_i(ad->scan_resp_data_length, 0); ble_ad_destroy(ad);...
/* * 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 GBitmapDataRowInfoInternal *data_row_infos = g_gbitmap_spalding_data_row_infos; const uint8_t mask = data_row_infos[i].min_x + radial_padding_size; const int offset = i + radial_padding_size; // Draw both row-wise and column-wise to fill in any discontinuities // in the border circle. /...
/* * 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...
alerts_get_mask()
== AlertMaskAllOn); alerts_set_mask(AlertMaskPhoneCalls); // Should allow a phone call notification cl_assert(alerts_should_notify_for_type(AlertPhoneCall)); // Should not allow any other notifications through cl_assert(!alerts_should_notify_for_type(AlertInvalid)); cl_assert(!alerts_should_notify_for_t...
st_node == state->scheduled_head); if (has_new_head) { // Only reschedule the timer if the previous head animation wasn't running yet: if (old_head_is_animating == false) { prv_reschedule_timer(state, 0); } } ANIMATION_LOG_DEBUG("scheduled %d (%p) to run at (%d). delay:%d, duration:%d", ...
serial_distance32(child_start_time, earliest_start_time)
> 0) { // computes (earliest_start_time - child->abs_start_time_ms) earliest_start_time = child_start_time; } child_end_time = child_start_time + child_duration; } else { child_end_time = now + animation->delay_ms + add_delay_ms + child_duration; } if (seri...
p_running(AppInstallId id) { return app_manager_get_task_context()->install_id == id; } bool app_install_is_worker_running(AppInstallId id) { return worker_manager_get_task_context()->install_id == id; } void app_install_notify_app_closed(void) { PBL_ASSERT_TASK(PebbleTask_KernelMain); // If we've previously ...
for (uint8_t *b = &uuid->byte0; b <= &uuid->byte15; b++) { uuid_byte_sum += *b; }
s = NULL, }, .action_group = { .num_actions = 0, .actions = NULL, }, .allocated_buffer = NULL, }, { .header = { // [1] .id = {0x6b, 0xf6, 0x21, 0x5b, 0xc9, 0x7f, 0x40, 0x9e, 0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb2}, .parent_id = {0}, ...
uuid_equal(&s_items[s_correct_order[1]].header.id, &timeline_model_get_iter_state(1)->pin.header.id)
); cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(0)); cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(1)); int new_idx; bool has_next; cl_assert(timeline_model_iter_next(&new_idx, &has_next)); cl_assert(has_next);...
config)) { rv = true; break; } } prv_file_close_and_unlock(&file); return rv; } // ---------------------------------------------------------------------------------------------- void alarm_handle_clock_change(void) { SettingsFile file; if (!prv_file_open_and_lock(&file)) { return; } ...
("Custom")
; break; default: alarm_day_text = ""; break; } return alarm_day_text; } void alarm_get_string_for_custom(bool scheduled_days[DAYS_PER_WEEK], char *alarm_day_text) { // 4 chars per day, 3 for letters and 1 for comma // max length = 7 days in a week * 4 chars per day = 28 static const 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...
(app_state_get_framebuffer())
}; grect_clip(area_out, &display_frame); } //! Currently, the unobstructed area is derived from the origin of the obstruction. //! This is equivalent to the height of the unobstructed area. static void prv_origin_y_to_area(int16_t origin_y, GRect *area_out) { PBL_ASSERTN(area_out); *area_out = (GRect) { .si...
pfs_format(true /* write erase headers */); load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false /* is_next */); resource_init(); // Setup content indicator ContentIndicatorsBuffer *buffer = content_indicator_get_current_buffer(); conte...
(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE))
; } void test_health_detail_card__render_bg_and_zone_colors(void) { HealthDetailCardConfig config = { .num_headings = 1, .headings = &(HealthDetailHeading) { .primary_label = "LABEL1", .primary_value = "value1", .fill_color = GColorWhite, #if PBL_BW .outline_color = GColorBlack, #endi...
/* * 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_add_child(window_layer, text_layer_get_layer(text_heap_info))
; } static void deinit(void) { // Don't free anything } int main(void) { init(); app_event_loop(); deinit(); }
h_power_down_stop_mode(true /* power_down */); periph_config_disable(PWR, RCC_APB1Periph_PWR); vTaskStartScheduler(); for(;;); } static void watchdog_timer_callback(void* data) { task_watchdog_bit_set(PebbleTask_NewTimers); } static void vcom_timer_callback(void* data) { display_pulse_vcom(); } static voi...
regular_timer_init()
; clock_init(); task_watchdog_init(); analytics_init(); register_system_timers(); system_task_timer_init(); init_drivers(); #if defined(IS_BIGBOARD) // Program a random S/N into the Bigboard in case it's not been done yet: mfg_write_bigboard_serial_number(); #endif #if defined(MANUFACTURING_FW) mfg...
_dialog); } static void prv_transcription_dialog_load(void *context) { TranscriptionDialog *transcription_dialog = context; transcription_dialog->was_pushed = true; if (transcription_dialog->buffer_len > 0) { Dialog *dialog = expandable_dialog_get_dialog((ExpandableDialog *)transcription_dialog); transcr...
expandable_dialog_get_dialog((ExpandableDialog *)transcription_dialog)
; dialog_set_callbacks(dialog, &(DialogCallbacks) { .unload = prv_transcription_dialog_unload, .load = prv_transcription_dialog_load }, transcription_dialog); dialog_show_status_bar_layer(dialog, true /* show status bar */); dialog_set_timeout(dialog, DIALOG_TIMEOUT_INFINITE); status_bar_...
/* * 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...
malloc(sizeof(FrameBuffer))
Event_PebbleProtocolAppSessionEnd); event_blob.pp_common_session_close.close_reason = reason; event_blob.pp_common_session_close.duration_minutes = session_duration_mins; if (!is_system_session && optional_app_uuid) { memcpy(&event_blob.pp_app_session_close.app_uuid, optional_app_uuid, sizeof(Uuid)); } #i...
(&event_blob)
; } // ------------------------------------------------------------------------------------------ // Log a health insight response event. void analytics_event_health_insight_response(time_t timestamp, ActivityInsightType insight_type, ActivitySessionType activity_type, ...
/* * 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_text_instructions, "Press select to start 5s wakeup")
; layer_add_child(window_layer, text_layer_get_layer(s_text_instructions)); } static void window_unload(Window *window) { text_layer_destroy(s_text_launch_reason); text_layer_destroy(s_text_instructions); } static void init(void) { window = window_create(); window_set_click_config_provider(window, click_con...
ILE_CHARGING once arbitrary prefixes land #if PLATFORM_TINTIN || PLATFORM_SILK [BatteryShutdownCharging] = { .enter = prv_shutdown } #else [BatteryShutdownCharging] = { .enter = prv_enter_shutdown_charging } #endif }; static BatteryUIStateID s_state = BatteryGood; static BatteryUIWarningLevel s_warning_points_inde...
ARRAY_LENGTH(ui_states[s_state].next_state)
PRIORITY // from executing and from waking the processor. // See: http://infocenter.arm.com/help/topic/com.arm.doc.dui0552a/BABGGICD.html#BGBHDHAI __disable_irq(); power_tracking_stop(PowerSystemMcuCoreRun); if (eTaskConfirmSleepModeStatus() != eAbortSleep) { if (xExpectedIdleTime < MIN_STOP_TICKS || !s...
kernel_free(pv)
; } #undef pvPortMalloc void* pvPortMalloc(size_t xSize) { return kernel_malloc(xSize); } // Called from the SysTick handler ISR to adjust ticks for situations where the CPU might // occasionally fall behind and miss some tick interrupts (like when running under emulation). bool vPortCorrectTicks(void) { static u...
int selection, void *context) { system_theme_set_content_size(settings_content_size_to_preferred_size(selection)); app_window_stack_remove(&option_menu->window, true /* animated */); } static void prv_text_size_menu_push(SettingsNotificationsData *data) { const OptionMenuCallbacks callbacks = { .select = pr...
{ SettingsNotificationsData *data = ((SettingsOptionMenuData *)context)->context; const char *subtitle = NULL; const char *title = NULL; switch (row) { case NotificationsItemFilter: title = i18n_noop("Filter"); subtitle = prv_alert_mask_to_label(alerts_get_mask()); break; #if !CAPABILITY_...
static void prv_deinit_cb(SettingsCallbacks *context) { SettingsNotificationsData *data = (SettingsNotificationsData *)context; i18n_free_all(data); app_free(data); } static void prv_select_click_cb(SettingsCallbacks *context, uint16_t row) { SettingsNotificationsData *data = (SettingsNotificationsData *) co...
Feature_BPM); } } } static void prv_enable_hrm(void) { AppData *app_data = app_state_get_user_data(); app_data->hrm_event_info = (EventServiceInfo) { .type = PEBBLE_HRM_EVENT, .handler = prv_handle_hrm_data, }; event_service_client_subscribe(&app_data->hrm_event_info); // TODO: Let the mobile...
(window, true)
; } static void prv_deinit(void) { AppData *app_data = app_state_get_user_data(); sys_hrm_manager_unsubscribe(app_data->session); } static void prv_main(void) { prv_init(); app_event_loop(); prv_deinit(); } const PebbleProcessMd* hrm_demo_get_app_info(void) { static const PebbleProcessMdSystem s_hrm_demo...
/* * 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 0; }
return notification_storage_get_len((Uuid *)key); } status_t notif_db_read(const uint8_t *key, int key_len, uint8_t *val_out, int val_out_len) { // NYI return S_SUCCESS; } status_t notif_db_delete(const uint8_t *key, int key_len) { if (key_len != UUID_SIZE) { return E_INVALID_ARGUMENT; } notificati...
ert_float_parse(" ", 3, false, 0); } void test_ams_util__float_string_parse_no_fraction(void) { // "42" * 3 assert_float_parse("42", 3, true, 42 * 3); } void test_ams_util__float_string_parse_separator_but_no_fraction(void) { // "21." * 3 assert_float_parse("21.", 3, true, 21 * 3); } void test_ams_util__floa...
(count, 1)
; assert_result(0, "A", 1); } void test_ams_util__csv_null_in_the_middle(void) { const char null_middle_value[] = "A\x00 BCD,1234"; cl_assert(sizeof(null_middle_value) > 2); const uint8_t count = ams_util_csv_parse(null_middle_value, sizeof(null_middle_value), NULL, p...
/* * 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...
dcache_line_size()
; if (line_size > min) { return line_size - 1; } #endif return min - 1; } MOCKABLE void icache_invalidate_all(void) { #if __ICACHE_PRESENT __DSB(); __ISB(); SCB->ICIALLU = 0; __DSB(); __ISB(); #endif } MOCKABLE void icache_invalidate(void *addr, size_t size) { #if __ICACHE_PRESENT prv_cache_oper...
376, 832, -520}, { -360, 656, -584}, { -232, 872, -656}, { -232, 856, -624}, { -160, 1296, -800}, { -344, 384, -1544}, { 176, 160, -1232}, // 308 seconds { -456, -264, -224}, { 24, 616, -1368}, { 144, 424, -688}, { -24, 864, -880}, { 24, 856, -776}, { 72, 600, -864}, ...
{ 48, 616, -856}, { 48, 616, -848}, { 40, 608, -856}, { 48, 616, -848}, { 40, 616, -856}, { 48, 600, -848}, { 40, 600, -864}, { 48, 592, -864}, { 40, 600, -864}, { 40, 600, -864}, { 40, 600, -856}, { 40, 608, -856}, { 48, 608, -856}, // 314 seconds { 40, 608, ...
{ 40, 584, -864}, { 40, 592, -872}, { 48, 584, -864}, { 40, 584, -880}, { 40, 592, -872}, { 40, 592, -864}, { 40, 592, -864}, { 40, 592, -872}, { 40, 584, -864}, { 48, 592, -872}, { 40, 592, -864}, { 40, 592, -864}, { 40, 592, -864}, { 40, 592, -864}, { 40, 5...
/* * 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...
grect_shortest_side(GRect(0, 0, -20, 10))
); } void test_gtypes__grect_inset(void) { GRect rect = GRect(10, 20, 30, 40); cl_assert_equal_grect(GRect(12, 23, 26, 34), grect_inset_internal(rect, 2, 3)); cl_assert_equal_grect(GRect(7, 18, 36, 44), grect_inset_internal(rect, -3, -2)); } void test_gtypes__grect_inset_standardizes(void) { GRect rect = GRe...
xQueue, const void * const pvItemToQueue, TickType_t xTicksToWait, portBASE_TYPE xCopyPosition) { cl_assert_equal_i((intptr_t) xQueue, (intptr_t) FAKE_APP_QUEUE); if (s_event_count < ARRAY_LENGTH(s_events_received)) { s_events_received[s_event_count] = *((PebbleEvent *)pvI...
cl_assert(sys_hrm_manager_get_subscription_info(session_ref, &ret_app_id, &ret_update_interval_s, &ret_expire_s, &ret_features))
; cl_assert(ret_app_id == app_id); cl_assert(ret_update_interval_s == update_interval_s); cl_assert(ret_expire_s == expire_s); cl_assert(ret_features == features); sys_hrm_manager_unsubscribe(session_ref); fake_system_task_callbacks_invoke_pending(); cl_assert(prv_get_subscriber_state_from_ref(session_re...
void pulse2_reliable_retransmit_timer_expired_handler( uint8_t retransmit_sequence_number) { if (s_send_variable != retransmit_sequence_number) { // ACK was received and processed between the time that the // retransmit timer expired and this callback ran. return; } if (++s_retransmit_count < MAX_...
(PULSE2_TRAINCP, packet, length)
; } // Shared events // ============= void pulse2_reliable_on_link_up(void) { ppp_control_protocol_lower_layer_is_up(PULSE2_TRAINCP); } void pulse2_reliable_on_link_down(void) { ppp_control_protocol_lower_layer_is_down(PULSE2_TRAINCP); } void pulse2_reliable_init(void) { ppp_control_protocol_init(PULSE2_TRAINC...
382400,"37","07"},{1189468800,"37","07"},{1189555200,"37","07"},{1189641600,"37","07"},{1189728000,"37","07"}, {1189814400,"37","07"},{1189900800,"37","07"},{1189987200,"38","07"},{1190073600,"38","07"},{1190160000,"38","07"},{1190246400,"38","07"},{1190332800,"38","07"}, {1190419200,"38","07"},{1190505600,"38","07...
{ char tmbuf[512]; struct tm jan_2_2015__13_00_00 = { .tm_hour = 13, .tm_min = 0, .tm_sec = 0, // 13:00:00 .tm_year = 2015 - 1900, .tm_mon = 0, .tm_mday = 2, // 2015/01/02 .tm_wday = 5, .tm_yday = 1, // Friday, 2nd day of the year .tm_gmtoff = 0, .tm_isdst = 0, .tm_zone = "UTC", // No DST, UTC+0 ...
#else // BUG!! cl_assert_equal_s(tmbuf, "+0001"); #endif jan_2_2015__13_00_00.tm_gmtoff = -600; tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%z", &jan_2_2015__13_00_00); #if !OUR_STRFTIME_BUGS cl_assert_equal_s(tmbuf, "-0010"); #else // BUG!! cl_assert_equal_s(tmbuf, "+0010"); #endif jan_2_2015__13...
= { .start = 0x3001, .end = 0x4000 }; cl_assert_equal_b(fake_gatt_is_service_discovery_running(), false); // start a discovery job, pretend nothing is found gatt_client_discovery_discover_range(connection, &range); cl_assert_equal_b(fake_gatt_is_service_discovery_running(), true); // pend up anot...
cl_assert_equal_b(uuid_equal(&service->uuid, &bp_service->uuid), true)
; cl_assert_equal_i(service->num_att_handles_included_services, bp_service->num_included_services); cl_assert_equal_i(service->num_characteristics, bp_service->num_characteristics); const GATTCharacteristic *characteristic_one = service->characteristics; const Characteristic *expected_characteristic1 = &bp_ser...
y_dnd_schedule; SET_PREF_ALREADY_OPEN(s_dnd_schedule_keys[WeekendSchedule].schedule_pref_key, &s_dnd_schedule[WeekendSchedule].schedule); s_dnd_schedule[WeekendSchedule].enabled = s_legacy_dnd_schedule_enabled; SET_PREF_ALREADY_OPEN(s_dnd_schedule_keys[WeekendSchedule].enabled_pref...
settings_file_exists(file, PREF_KEY_VIBE_INTENSITY, strlen(PREF_KEY_VIBE_INTENSITY))
) { prv_set_vibe_scores_based_on_legacy_intensity(s_vibe_intensity); } else if (rtc_is_timezone_set()) { // Otherwise, if the timezone has been set, then we assume this is a user on 3.10 and lower // that has not touched their vibe intensity preferences. // rtc_is_timezone_set() was chosen b...
t if we were to use PPoG V1 on iOS it's something we should check if (prv_get_max_payload_size(client) < GATT_MTU_MINIMUM) { // If a device does not support large a large MTU/payload size, its throughput is severely // limited by the window size leading. This prevents us from handling throughput sensit...
(LOG_LEVEL_INFO, "Ignoring reset request because remote server already requested.")
case LinkState_Closing: prv_transition_to(this, LinkState_Closed); break; default: break; } } mutex_unlock(this->state->lock); } static bool prv_handle_configure_request(PPPControlProtocol *this, struct LCPPacket *packet) { if (nto...
PBL_LOG(LOG_LEVEL_WARNING, "Unexpected Configure-Nak/Rej received after Ack")
; prv_handle_nak_or_reject(this, packet); prv_transition_to(this, LinkState_RequestSent); break; case LinkState_AckSent: prv_handle_nak_or_reject(this, packet); break; default: break; } } static void prv_on_terminate_request(PPPControlProtocol *this, ...
_read_info.checksum) { // If this is a notification, we shouldn't have a read consumer set. PBL_ASSERTN(!is_notify || (s_read_consumer.profile == SmartstrapProfileInvalid)); // this frame is valid - transition the FSM and queue up processing of it smartstrap_fsm_state_set(SmartstrapStateReadComplete); ...
mbuf_iterator_get_current_mbuf(iter)
; uint8_t read_data; PBL_ASSERTN(mbuf_iterator_read_byte(iter, &read_data)); if (mbuf_is_flag_set(mbuf, MBUF_FLAG_IS_FRAMING)) { result = prv_send_byte_and_check(read_data); } else { result = prv_send_byte(read_data); } if (mbuf_iterator_is_finished(iter)) { // we just sent the last byte if...
/* * 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_TIMEZONE_DST_START)
; raw[4] = RTC_ReadBackupRegister(RTC_TIMEZONE_DST_END); } void rtc_timezone_clear(void) { RTC_WriteBackupRegister(RTC_TIMEZONE_ABBR_START, 0); RTC_WriteBackupRegister(RTC_TIMEZONE_ABBR_END_TZID_DSTID, 0); RTC_WriteBackupRegister(RTC_TIMEZONE_GMTOFFSET, 0); RTC_WriteBackupRegister(RTC_TIMEZONE_DST_START, 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...
qspi_use(dev->qspi)
; bool result = prv_check_whoami(dev); qspi_release(dev->qspi); return result; } static void prv_set_fast_read_ddr_enabled(QSPIFlash *dev, bool enabled) { // If we're supposed to use DDR for fast read, make sure the part can support it PBL_ASSERTN(!enabled || dev->state->part->supports_fast_read_ddr); dev-...
_assert_equal_i(1, s_context.draw_state.fill_color.argb); EXECUTE_SCRIPT("ctx.restore()\n"); // no-op cl_assert_equal_i(1, s_context.draw_state.fill_color.argb); } static const int16_t large_int = 10000; void test_rocky_api_graphics__fill_text(void) { prv_global_init_and_set_ctx(); // we do this in C and no...
ASSERT_JS_GLOBAL_EQUALS_S("a", "right")
; EXECUTE_SCRIPT("ctx.textAlign = 'center';\nvar a = ctx.textAlign;\n"); cl_assert_equal_i(GTextAlignmentCenter, s_rocky_text_state.alignment); ASSERT_JS_GLOBAL_EQUALS_S("a", "center"); // we only support LTR EXECUTE_SCRIPT("ctx.textAlign = 'start';\nvar a = ctx.textAlign;\n"); cl_assert_equal_i(GTextAlig...
y(a, 0x09) ^ Multiply(b, 0x0e) ^ Multiply(c, 0x0b) ^ Multiply(d, 0x0d); (*state)[i][2] = Multiply(a, 0x0d) ^ Multiply(b, 0x09) ^ Multiply(c, 0x0e) ^ Multiply(d, 0x0b); (*state)[i][3] = Multiply(a, 0x0b) ^ Multiply(b, 0x0d) ^ Multiply(c, 0x09) ^ Multiply(d, 0x0e); } } // The SubBytes Function Substitutes the...
{ XorWithIv(input); BlockCopy(output, input); state = (state_t*)output; Cipher(); Iv = output; input += KEYLEN; output += KEYLEN; }
if(remainders) { BlockCopy(output, input); memset(output + remainders, 0, KEYLEN - remainders); /* add 0-padding */ state = (state_t*)output; Cipher(); } } void AES128_CBC_decrypt_buffer(uint8_t* output, uint8_t* input, uint32_t length, const uint8_t* key, const uint8_t* iv) { uintptr_t i; ...
respond(true /* is_granted */); // Device B subscribes: bt_driver_cb_hrm_service_update_subscription(s_device_b, true); // Expect permissions UI to be presented: prv_assert_permissions_ui_and_respond(true /* is_granted */); ble_hrm_revoke_all(); cl_assert_equal_b(false, ble_hrm_is_sharing_to_connection(...
prv_assert_permissions_ui_and_respond(true /* is_granted */)
; // Don't grant permission to device B: bt_driver_cb_hrm_service_update_subscription(s_device_b, true); prv_assert_permissions_ui_and_respond(false /* is_granted */); prv_put_and_assert_hrm_event(HRMEvent_BPM, 80, HRMQuality_Excellent, true /* expect bt driver cb */, true /* ex...
}, { 608, -16, 120}, { 704, -8, 80}, { 960, 16, -16}, { 1176, -32, 32}, { 1840, -136, 336}, { 1640, 208, 176}, { 1448, 600, -264}, { 1064, 464, -48}, { 840, 184, 112}, { 808, 160, 120}, { 840, 256, 80}, { 824, 336, 32}, { 720, 392, -80}, { 768, 336, -24}, { 96...
{ 800, 256, 48}, { 848, 272, 112}, { 856, 352, 88}, { 800, 280, 88}, { 880, 432, -88}, { 936, 368, -152}, { 1144, 328, -160}, { 1304, 272, -96}, { 1936, 304, 16}, { 1504, 536, -96}, { 1040, 200, -72}, { 1160, 104, 120}, { 1232, 96, 176}, { 1024, 8, 144}, { 856...
{ 768, 0, 128}, { 696, -32, 112}, { 656, -48, 88}, { 744, -96, 40}, // 47 seconds { 944, -104, -56}, { 1184, -240, 32}, { 1632, -288, 256}, { 1552, 176, 48}, { 1544, 376, -192}, { 1304, 560, -24}, { 832, 304, 80}, { 848, 216, 136}, { 856, 224, 96}, { 824, 272...
/* * 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...
{ handle_init(); app_event_loop(); handle_deinit(); }
const PebbleProcessMd* event_service_app_get_info() { static const PebbleProcessMdSystem event_service_app_info = { .common.main_func = &s_main, .name = "Event Service App", }; return (const PebbleProcessMd*) &event_service_app_info; }
scriber_state_from_ref(HRM_INVALID_SESSION_REF) == NULL); cl_assert(prv_get_subscriber_state_from_app_id(PebbleTask_App, INSTALL_ID_INVALID) == NULL); // Unsubscribe, HRM should be disabled after for (int i = 0; i < num_refs; ++i) { sys_hrm_manager_unsubscribe(session_refs[i]); cl_assert(prv_get_subscrib...
cl_assert_equal_i(prv_num_system_task_events_queued(), 1)
{ .x = bounds->size.w * 3 / 4 - 5, .y = bounds->size.h / 2, }; case CLOCK_LOCATION_BOTTOM: imprecise_center_point = (GPoint) { .x = bounds->size.w / 2, .y = bounds->size.h * 3 / 4 + 6, }; case CLOCK_LOCATION_LEFT: imprecise_center_point = (GPoint) { ...
app_state_set_user_data(data)
; data->text_font = fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD); window_init(&data->window, "TicToc"); window_set_window_handlers(&data->window, &(WindowHandlers) { .load = prv_window_load, .unload = prv_window_unload, }); const bool animated = true; app_window_stack_push(&data->window, animate...
)); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &outside_ny_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("outside_ny_offset_layer", ctx.parent_framebuffer, GColorWhite)); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer,...
graphics_draw_pixel(ctx, GPoint(p.x + 5, p.y + 3))
; graphics_draw_pixel(ctx, GPoint(p.x + 6, p.y + 3)); graphics_draw_pixel(ctx, GPoint(p.x + 7, p.y + 3)); } // Draws two columns of colors (first 32 colors in first column, second 32 colors in second column) // Offsets the two color columns based on input transparency static void prv_draw_boxes(GContext *ctx, uint...
char *phrase, size_t *size_out) { PascalString16List pstring16_list; PascalString16 *location_name; PascalString16 *short_phrase; size_t data_size; location_name = pstring_create_pstring16_from_string(location); short_phrase = pstring_create_pstring16_from_string(phrase); data_size = strlen(location) +...
pstring_project_list_on_serialized_array(&pstring16_list, &to_check->pstring16s)
; cl_assert_equal_i(pstring16_list.count, 2); PascalString16 *pstring; pstring = pstring_get_pstring16_from_list(&pstring16_list, 0); int index = weather_shared_data_get_index_of_key(key); if (index == -1) { cl_fail("key not found!"); } cl_assert_equal_i(pstring->str_length, strlen(s_entry_names[i...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ cl_assert_(false, "No gatt_client_subscriptions_subscribe() has happened at all"); }
s_subscribe_head = (Subscribe *) list_pop_head(&s_subscribe_head->node); }
/* * 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...
{ // "-" * 3 assert_float_parse("-", 3, false, 0); }
void test_ams_util__float_string_parse_negative_number_nothing_before_separator(void) { // "-.1" * 30 assert_float_parse("-.1", 30, true, -3); } void test_ams_util__float_string_parse_multiple_minusses(void) { // "--.1" * 30 assert_float_parse("--.1", 30, false, 0); } void test_ams_util__float_string_parse_...
tions[0].type, TimelineItemActionTypeGeneric); cl_assert_equal_i(item->action_group.actions[0].attr_list.num_attributes, 1); cl_assert_equal_i(item->action_group.actions[0].attr_list.attributes[0].id, AttributeIdTitle); cl_assert_equal_s(item->action_group.actions[0].attr_list.attributes[0].cstring, "Dismiss"); ...
string_list_get_at(list, 1)
); // 3 strings (last two are is empty) list->serialized_byte_length = 4; list->data[0] = 'a'; list->data[1] = 'b'; list->data[2] = '\0'; list->data[3] = '\0'; // end of data list->data[4] = '\0'; cl_assert_equal_i(3, string_list_count(list)); cl_assert_equal_s("ab", string_list_get_at(list, 0)); c...