prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
tTypeCount } BTLETestType; typedef enum { BTLETestStep_None = 0, BTLETestStep_BTStart, BTLETestStep_BTEnd, BTLETestStep_BTLETransmitStart, BTLETestStep_BTLEReceiverStart, BTLETestStep_BTLEStop, BTLETestStepCount } BTLETestStep; typedef enum { BTLEPayloadType_PRBS9 = 0, BTLEPayloadType_11110000, ...
bt_test_stop()
}, data); Animation *animation = animation_sequence_create(animation1, animation2, NULL); data->result_animation = animation; animation_schedule(animation); #else // Don't animate to a dot on old platforms, just finish immediately. static const bool success = true; prv_finished(data, success); #endif } s...
if (window->state == ProgressWindowState_Result) { // Ignore requests to change the result once we already have one return; }
window->state = ProgressWindowState_Result; prv_cancel_fake_progress_timer(window); prv_set_progress(window, MAX_PROGRESS_PERCENT); prv_schedule_progress_success_animation(window); } void progress_window_set_result_failure(ProgressWindow *window, uint32_t timeline_res, ...
cl_assert_equal_i(TRIG_MAX_ANGLE * 5 / 4, lc->fill_radial_precise.angle_end); EXECUTE_SCRIPT( "ctx.rockyFillRadial(30.5, 40.1, 30, 10, 0, 2 * Math.PI);\n" ); cl_assert_equal_i(3, s_graphics_fill_radial_precise_internal.call_count); cl_assert_equal_point_precise(PP(30, 39.625), lc->fill_radial_precise.cen...
(1, s_graphics_context_set_fill_color.call_count)
; cl_assert_equal_i(GColorRedARGB8, s_graphics_context_set_fill_color.last_call.color.argb); cl_assert_equal_i(1, s_graphics_context_set_stroke_color.call_count); cl_assert_equal_i(GColorWhiteARGB8, s_graphics_context_set_stroke_color.last_call.color.argb); // ignores invalid values EXECUTE_SCRIPT( "ctx....
draw_vertical_line_dotted(&ctx, GPoint(7, 0), 1); graphics_draw_vertical_line_dotted(&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_vertic...
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); graphics_draw_vertical_line_dotted(&ctx, GPoint(21, 0), MAX_NUM_ROWS - 1); graphics_draw_vertical_line_dotted(&ctx, GPoin...
on); if (!read_pbi(pbi_filename, &result)) { return NULL; } else { return &result; } } typedef GBitmap *(*CompositeTestGBitmapCreateFunc)(const char *filename); typedef struct CompositeTest { const char *test_name; GBitmapFormat expected_test_image_bitmap_format; CompositeTestGBitmapCreateFunc bi...
GPoint(COMPOSITE_TEST_OFFSET_X, COMPOSITE_TEST_OFFSET_Y)
); prv_composite_test_draw_bitmap(&s_ctx, bitmap, offset_point, compositing_mode); // Check the result char unit_test_result_image_file_base_name[PATH_STRING_LENGTH] = {0}; snprintf(unit_test_result_image_file_base_name, PATH_STRING_LENGTH, "%s_%s", unit_test_name, test_data->test_name); ...
/* * 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...
(sizeof(GContext))
; test_graphics_context_init(ctx, fb); framebuffer_clear(fb); graphics_context_set_antialiased(ctx, true); // Start by filling the framebuffer with green pixels to make things easier to see memset(ctx->dest_bitmap.addr, GColorGreenARGB8, FRAMEBUFFER_SIZE_BYTES); const bool transparent = true; GDrawMask...
/* * 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...
(i, firmware_length, NULL)
; } return true; } static bool prv_check_firmware_crc(FirmwareDescription* firmware_description) { dbgserial_print("Checksumming "); dbgserial_print_hex(firmware_description->firmware_length); dbgserial_putstr(" bytes"); void *system_flash_base = (void*)FIRMWARE_OLDWORLD_BASE; if (firmware_is_new_world...
.link_key = *link_key, .platform_bits = platform_bits }; strncpy(data->name, device_name, BT_DEVICE_NAME_BUFFER_SIZE); } static void prv_shared_prf_storage_store_bt_classic_pairing_data( BTDeviceAddress *addr, const char *device_name, SM128BitKey *link_key, uint8_t platform_bits) { if (link_key) ...
{ prv_update_and_cleanup_struct_async(&data->bt_classic_data, sizeof(BTClassicPairingData), offsetof(SharedPRFData, bt_classic_data)); }
else if (le_bonding_update) { prv_shared_prf_storage_store_ble_pairing_data(&data->ble_data); } memset(&s_pending_bondings, 0x00, sizeof(s_pending_bondings)); } prv_unlock_pending_bonding(); } static void prv_async_shared_prf_update_timer_cb(void *data) { system_task_add_callback(prv_system_task_...
/////////////////////////////////////////// // Consuming writes void test_app_inbox__multiple_writes_while_consuming(void) { prv_create_test_inbox_and_begin_write(); // Message 1: cl_assert_equal_b(true, app_inbox_service_write(AppInboxServiceTagUnitTest, s_test_data, 1)); cl_assert_equal_b(true, app_inbox_se...
cl_assert_equal_i(1, app_inbox_destroy_and_deregister(s_inbox))
), origin.y + (row * (COLOR_BAR_HEIGHT + 4)), COLOR_BAR_WIDTH, COLOR_BAR_HEIGHT); graphics_context_set_fill_color(ctx, color); graphics_fill_rect(ctx, &box); } } // Draw border if (compare) { const GRect box = GRect(origin.x + 4*color_index_matc...
graphics_context_set_fill_color(ctx, data->fg_color)
) list or the idle timers //! (manager->idle_timers) ListNode list_node; //! The tick value when this timer will expire (in ticks). If the timer isn't currently //! running (scheduled) this value will be zero. RtcTicks expire_time; RtcTicks period_ticks; TaskTimerID id; //<! ID assigned to t...
(manager->running_timers, &timer->list_node)
); list_remove(&timer->list_node, &manager->running_timers /* &head */, NULL /* &tail */); } else { PBL_ASSERTN(list_contains(manager->idle_timers, &timer->list_node)); list_remove(&timer->list_node, &manager->idle_timers /* &head */, NULL /* &tail */); } // Set timer variables timer->cb = cb; ti...
et_len = sizeof(GetBytesRspObjectInfo); } SendBuffer *sb; if (packet_len == 0 || !(sb = comm_session_send_buffer_begin_write(state->session, GET_BYTES_ENDPOINT_ID, packet_len, COMM_SESSION_DEFAULT_TIMEOUT))) { // If timeout, try again // MT: What if...
{ state->object_type = GetBytesObjectFlash; GetBytesFlashHeader *hdr = (GetBytesFlashHeader *)data; info.flash_start_addr = ntohl(hdr->start_addr); info.flash_len = ntohl(hdr->len); PBL_LOG(LOG_LEVEL_DEBUG, "Fetching %d bytes starting at %d", (int)info.flash_len, (int)info.fl...
#endif default: // NYI return false; } } void get_bytes_protocol_msg_callback(CommSession *session, const uint8_t* msg_data, uint32_t msg_len) { // at least have a cmd and a transaction_id if (msg_len < 2) { PBL_LOG(LOG_LEVEL_ERROR, "Invalid length %"PRIu3...
2(CRC32_INIT, &remote_status_in, sizeof(remote_status_in)); if (crc != CRC32_RESIDUE) { PBL_LOG(LOG_LEVEL_ERROR, "CRC32 failed on Status Exchange: 0x%"PRIu32 " vs 0x%"PRIu32, crc, (uint32_t)CRC32_RESIDUE); PBL_LOG(LOG_LEVEL_DEBUG, "->OUT"); PBL_HEXDUMP(LOG_LEVEL_DEBUG, (uint8_t *)&lo...
(s_ble_host_transport_wdog_id)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(DIALOG_SPI)
/* * 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(!alerts_should_notify_for_type(AlertInvalid))
; } void test_alerts__disabled(void) { cl_assert(alerts_get_mask() == AlertMaskAllOn); // Should not allow any notifications through alerts_set_mask(AlertMaskAllOff); cl_assert(!alerts_should_notify_for_type(AlertInvalid)); cl_assert(!alerts_should_notify_for_type(AlertMobile)); cl_assert(!alerts_should_...
/* * 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...
{ health_progress_bar_mark(ctx, &data->progress_bar, PROGRESS_TYPICAL_COLOR, typical_fill); }
#else health_progress_bar_mark(ctx, &data->progress_bar, PROGRESS_TYPICAL_COLOR, typical_fill); #endif // This needs to be done after drawing the progress bars or else the progress fill // overlaps the outline and things look weird health_progress_bar_outline(ctx, &data->progress_bar, PROGRESS_OUTLINE_COLOR);...
{ prv_app_fetch_failure(data, af_event->error_code); }
} // TODO: Use appropriate transitions to and from watchfaces or apps static void prv_click_handler(ClickRecognizerRef recognizer, Window *window) { AppFetchUIData *data = app_state_get_user_data(); if (data->failed) { app_window_stack_pop(true); } else { app_fetch_cancel(data->install_entry.install_id)...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ const ActionMenuItem *item = &level->items[i]; if (!item->is_leaf && item->next_level) { prv_cleanup_helper(item->next_level, each_cb, context); } if (each_cb) { each_cb(item, context); } }
applib_free((void *)level); } void action_menu_hierarchy_destroy(const ActionMenuLevel *root, ActionMenuEachItemCb each_cb, void *context) { if (root) { prv_cleanup_helper(root, each_cb, context); } }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_LOG(LOG_LEVEL_INFO, "Received %d bytes of data from watch", data_length)
/* * 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 (node == NULL) { return; } if (head && *head == node) { *head = node->next; } if (tail && *tail == node) { *tail = node->prev; } if (node->next) { node->next->prev = node->prev; } if (node->prev) { node->prev->next = node->next; } node->prev = NULL; node->next = NULL; }
ListNode* list_append(ListNode* node, ListNode* new_node) { return list_insert_after(list_get_tail(node), new_node); } ListNode* list_prepend(ListNode* node, ListNode* new_node) { return list_insert_before(list_get_head(node), new_node); } ListNode* list_get_next(ListNode* node) { if (node == NULL) { retu...
_create_undefined(); } return jerry_create_string_utf8_sz(str_p, strlen((const char *)str_p)); } jerry_value_t jerry_create_string_sz(const jerry_char_t *str_p, jerry_size_t str_size) { return jerry_create_string_utf8_sz(str_p, str_size); } jerry_value_t jerry_create_string_utf8(const jerry_char_t *str_p) { i...
EM_ASM_INT({ var obj = __jerryRefs.get($0); var to_set = __jerryRefs.get($2); obj[$1] = to_set; return __jerryRefs.ref(true); }, obj_val, index, value_to_set)
; } void jerry_init_property_descriptor_fields(jerry_property_descriptor_t *prop_desc_p) { *prop_desc_p = (jerry_property_descriptor_t) { .value = jerry_create_undefined(), .getter = jerry_create_undefined(), .setter = jerry_create_undefined(), }; } jerry_value_t jerry_define_own_property(const jerry_...
_MIN) { PBL_LOG(LOG_LEVEL_WARNING, "Invalid duration: %"PRIu16" ", session->length_min); return false; } // The flags must be valid if (session->reserved != 0) { PBL_LOG(LOG_LEVEL_WARNING, "Invalid flags: %d", (int)session->reserved); return false; } return true; } // ---------------------...
memset(&state->activity_sessions[found_session_idx], 0, sizeof(ActivitySession))
; } else { memmove(&state->activity_sessions[found_session_idx], &state->activity_sessions[found_session_idx + 1], num_to_move * sizeof(ActivitySession)); } state->activity_sessions_count--; } unlock: mutex_unlock_recursive(state->mutex); } // -----------------------...
x.h" #define I2C_IRQ_PRIORITY (0xc) #define I2C_NORMAL_MODE_CLOCK_SPEED_MAX (100000) #define I2C_FAST_MODE_CLOCK_SPEED_MAX (400000) #define I2C_FAST_MODE_PLUS_CLOCK_SPEED_MAX (1000000) #define TIMINGR_MASK_PRESC (0x0F) #define TIMINGR_MASK_SCLH (0xFF) #define TIMINGR_MASK_SCLL (0xFF) #define CR1_CLEA...
prv_i2c_init(bus->hal->i2c, timingr)
; } void i2c_hal_disable(I2CBus *bus) { periph_config_disable(bus->hal->i2c, bus->hal->clock_ctrl); prv_i2c_deinit(bus); } bool i2c_hal_is_busy(I2CBus *bus) { return ((bus->hal->i2c->ISR & I2C_ISR_BUSY) != 0); } static void prv_disable_all_interrupts(I2CBus *bus) { bus->hal->i2c->CR1 &= ~(I2C_CR1_TXIE | ...
_t radius, uint8_t stroke_width) { graphics_circle_quadrant_draw_stroked_non_aa(ctx, p, radius, stroke_width, GCornersAll); } // Lifted directly from: http://en.wikipedia.org/wiki/Midpoint_circle_algorithm void graphics_draw_circle(GContext* ctx, GPoint p, uint16_t r...
(ctx, GPoint(x0 - x, y0 - y), 2 * x + 1)
; prv_fill_horizontal_line(ctx, GPoint(x0 - y, y0 - x), 2 * y + 1); } } } MOCKABLE void graphics_circle_fill_non_aa(GContext* ctx, GPoint p, uint16_t radius) { prv_fill_horizontal_line(ctx, GPoint(p.x - radius, p.y), 2 * radius + 1); graphics_fill_half_circle(ctx, p.x, p.y, radius, GCornersAll); } #if...
2", actual=%"PRIu32, (uint32_t)command, (uint32_t)expected_length, (uint32_t)actual_length); } return has_invalid_length; } static bool prv_is_object_allowed(PutBytesObjectType type) { #ifdef RECOVERY_FW switch (type) { case ObjectFirmware: case ObjectSysResources: return true; defa...
if (!prv_parse_init_index(request, &index)) { goto exit; }
uint32_t append_offset = 0; if (s_pb_state.receiver.length > offsetof(InitRequest, extra_info)) { // We compute the offset this way because filename installs can be variable length. In the // future, if we used this feature for files, this would allow for the same struct construction // on the mobile ...
client->state == StateDisconnectedSubscribingData); if (error) { PBL_LOG(LOG_LEVEL_ERROR, "PPoGATT Client failed to subscribe to Data"); prv_delete_client(client, false /* is_disconnected */, DeleteReason_SubscribeFailure); goto unlock; } if (!is_subscribed) { // Unsubscribed due to ...
if (prv_is_client_valid(client)) { client->out.send_rx_ack_now = true; prv_send_next_packets_async(client); }
} bt_unlock(); } static const PPoGATTPacket * prv_prepare_next_packet(PPoGATTClient *client, PPoGATTPacket **heap_packet_in_out, uint16_t *payload_size_out) { if (client->out.reset_packet_byte != 0) { r...
st time_t start = item->header.timestamp; const time_t end = start + (item->header.duration * SECONDS_PER_MINUTE); if (now >= end) { return 0; } const uint32_t timeout_s = ((start > now) ? start : end) - now; return MIN(timeout_s, UINT32_MAX / MS_PER_SECOND) * MS_PER_SECOND; } static void prv_set_timer(u...
(prv_init, NULL)
; } void timeline_event_deinit(void) { mutex_lock(s_mutex); new_timer_delete(s_timer); s_timer = TIMER_INVALID_ID; mutex_unlock(s_mutex); mutex_destroy(s_mutex); s_mutex = NULL; } void timeline_event_handle_blobdb_event(void) { prv_update_status_async(); } void timeline_event_refresh(void) { prv_up...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(s_command_list_index, 1)
; cl_assert_equal_i(s_command_list[0].addr, 64 * 1024); cl_assert_equal_i(s_command_list[0].type, SectorEraseCommand); s_command_list_index = 0; // Erase one sectors 0x10000 - 0x20000 but allow us to erase more flash_region_erase_optimal_range(0, 64 * 1024, 2 * 64 * 1024, 3 * 64 * 1024); 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...
(s_last_args_for_mock.func, __func__, sizeof(s_last_args_for_mock.func))
; } void graphics_line_draw_stroked_aa(GContext* ctx, GPoint p0, GPoint p1, uint8_t stroke_width) { s_last_args_for_mock = (ArgsForMock){ .ctx = *ctx, .p0 = p0, .p1 = p1 }; strncpy(s_last_args_for_mock.func, __func__, sizeof(s_last_args_for_mock.func)); } void graphics_line_draw_stroked_non_aa(GCont...
//////////////////////////// extern uint32_t shared_prf_storage_get_valid_page_number(void); extern void shared_prf_storage_set_valid_page_number(uint32_t page_num); // Defines ////////////////////////////////////////////////////////// #define SPRF_REGION_SIZE (FLASH_REGION_SHARED_PRF_STORAGE_END - \ ...
for (uint32_t j = 0; j < page_idx[i]; j++) { SprfMagic inv_magic = SprfMagic_InvalidatedEntry; flash_write_bytes((uint8_t *) &inv_magic, SPRF_PAGE_FLASH_OFFSET(j), sizeof(inv_magic)); }
// Write the valid page flash_read_bytes((uint8_t *) &data, SPRF_PAGE_FLASH_OFFSET(page_idx[i]), sizeof(data)); data.magic = SprfMagic_ValidEntry; flash_write_bytes((uint8_t *) &data, SPRF_PAGE_FLASH_OFFSET(page_idx[i]), sizeof(data)); // Call init and see if it found the valid page shared_pr...
/* * 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...
{ // not allowed from workers syscall_failed(); }
/* * 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...
GPoint(70, 35)
prv_handle_animation_stop, data); } // shrink the progress bar from the left after animating the progress % to 100% static void prv_shrink_progress_bar(VoiceUiData *data) { animation_unschedule((Animation *)data->mic_window.progress_anim); uint16_t progress = data->mic_window.progress_bar.progress_layer.pr...
expandable_dialog_get_dialog((ExpandableDialog *)transcription_dialog)
; dialog_set_destroy_on_pop(dialog, false /* free_on_pop */); transcription_dialog_push(transcription_dialog, prv_get_window_stack()); sys_light_reset_to_timed_mode(); } else { prv_exit_and_send_result_event(data, DictationSessionStatusSuccess); } break; } defa...
ert(active == false); // Timer will go off at 01:00 on Sunday. (14.5 hours) cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 52200 * MS_PER_SECOND); do_not_disturb_set_schedule_enabled(WeekendSchedule, false); rtc_set_time(s_saturday_01_30); do_not_disturb_handle_clock_change(); active = do_no...
cl_assert(active == false)
; // Timer will go off at 01:00 on Sunday. (14 hours) cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 50400 * MS_PER_SECOND); rtc_set_time(s_sunday_23_30); do_not_disturb_handle_clock_change(); active = do_not_disturb_is_active(); cl_assert(active == false); // Timer will go off at 00:00 on...
istributed 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 "apps/watch/kickstart/kickstart.h" #include "popups/timeline/peek.h" #include "applib/ui/win...
(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE))
; } void test_kickstart__render_steps_below_typical(void) { prv_set_data(&s_data, 5543, 6500, 8000, 0); window_set_on_screen(&s_data.window, true, true); window_render(&s_data.window, &s_ctx); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_kickstart__render_steps_above_daily_avg(voi...
((const uint32_t [ACTIVITY_HISTORY_DAYS]){2 * SECONDS_PER_MINUTE, 0, 0, 0, 0, 0, 0})); ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricSleepRestfulSeconds, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){1 * SECONDS_PER_MINUTE, 0, 0, 0, 0, 0, 0})); // The actual resting calories must be in the range from min_resting_...
activity_prefs_get_gender()
; cl_assert_equal_i(gender, value); value = activity_prefs_get_age_years(); cl_assert_equal_i(age_years, value); // Reset settings activity_prefs_set_height_mm(ACTIVITY_DEFAULT_HEIGHT_MM); activity_prefs_set_weight_dag(ACTIVITY_DEFAULT_WEIGHT_DAG); activity_prefs_set_gender(ACTIVITY_DEFAULT_GENDER); ac...
token, "TEST_IN_DEEP_SLEEP_MAX") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.in_deep_sleep.max); } else if (strcmp(token, "TEST_FORCE_SHUT_DOWN_AT") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.force_shut_down_at); } else if (strcmp(token, "TEST...
(token, "TEST_ACTIVITY_TYPE_MAX")
== 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.activity_type.max); } else if (strcmp(token, "TEST_LEN") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.len.value); } else if (strcmp(token, "TEST_LEN_MIN") == 0) { sscanf(token + strlen(token) +...
LANCE_STRUCTURED_ICON_MAX_SIZE; if ((size.w > max_size.w) || (size.h > max_size.h)) { // The icon is too big kino_reel_destroy(icon); return NULL; } return icon; } static bool prv_app_resource_info_equal(const AppResourceInfo *a, const AppResourceInfo *b) { PBL_ASSERTN(a && b); return ((a ...
launcher_app_glance_structured_get_data(structured_glance)
; // Reset the timer generic_glance->slice_subtitle_template_string_reeval_timer = NULL; prv_cancel_subtitle_reeval_timer(generic_glance); // Notify the service that the glance changed launcher_app_glance_structured_notify_service_glance_changed(structured_glance); } static void prv_update_subtitle_templa...
selection) { case ATTRIBUTE_HUE: ++data->hue; if (data->hue >= HUE_COUNT) { data->hue = 0; } break; case ATTRIBUTE_PIXEL_BIT: ++data->pixel_bit; if (data->pixel_bit >= PIXEL_BIT_COUNT) { data->pixel_bit = 0; } break; case ATTRIBUTE_X: if ...
if (data->hue == HUE_GREEN) { g = 1; } else if (data->hue == HUE_BLUE) { b = 1; } else if (data->hue == HUE_WHITE) { r = 1; g = 1; b = 1; }
GColor line_color = GColorFromRGB(r * saturation, g * saturation, b * saturation); graphics_context_set_stroke_color(ctx, line_color); graphics_draw_line(ctx, GPoint(0, data->intersection.y), GPoint(bounds.size.w, data->intersection.y)); graphics_draw_li...
.g. 3rd party app vibes title = i18n_noop("System"); const VibeIntensity current_system_default_vibe_intensity = vibe_intensity_get(); subtitle = vibe_intensity_get_string_for_intensity(current_system_default_vibe_intensity); break; } default: { WTF; } } // We need to set...
vibes_cancel()
; } static Window *prv_init(void) { SettingsVibePatternsData *data = app_zalloc_check(sizeof(SettingsVibePatternsData)); data->callbacks = (SettingsCallbacks) { .deinit = prv_deinit_cb, .draw_row = prv_draw_row_cb, .selection_changed = prv_selection_changed_cb, .select_click = prv_select_click_cb,...
/* * 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...
granted_handler()
; cl_assert_equal_i(s_setup_complete_call_count, 1); granted_handler(); cl_assert_equal_i(s_setup_complete_call_count, 1); audio_endpoint_stop_transfer(s_session_id); } void test_audio_endpoint__dont_call_setup_complete_callback_if_session_stopped(void) { ResponsivenessGrantedHandler granted_handler = fa...
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 "clar.h" #include "services/normal/voice_endpoint_private.h" #include "fake_pebble_tasks....
(attr1->length, 16)
; offset = sizeof(GenericAttributeList) + sizeof(GenericAttribute); cl_assert_equal_p(attr1->data, &data2[offset]); attr2 = generic_attribute_find_attribute(attr_list2, VEAttributeIdTranscription, sizeof(data2)); cl_assert(attr2); cl_assert_equal_i(attr2->id, VEAttributeIdTranscription); cl_assert_equal_i(...
ude "stubs_analytics.h" #include "stubs_hexdump.h" #include "stubs_logging.h" #include "stubs_mutex.h" #include "stubs_passert.h" #include "stubs_prompt.h" #include "stubs_regular_timer.h" #include "stubs_sleep.h" #include "stubs_task_watchdog.h" extern TimerID get_reminder_timer_id(void); static TimelineItem item1 =...
cl_assert_equal_i(num_events_put, 4)
; cl_assert_equal_m(&item4.header.id, stub_new_timer_callback_data(get_reminder_timer_id()), sizeof(TimelineItemId)); cl_assert(stub_new_timer_timeout(get_reminder_timer_id()) == 1037 * 1000); now += 1037; stub_pebble_tasks_set_current(PebbleTask_NewTimers); cl_assert(stub_new_timer_fire(get_reminder_timer_i...
tatic void prv_enable_watchdog(HRMDevice *dev) { mutex_assert_held_by_curr_task(dev->state->lock, true); s_as7000_watchdog_timer = (RegularTimerInfo) { .cb = prv_watchdog_timer_cb, .cb_data = (void *)dev, }; s_missing_interrupt_count = 0; regular_timer_add_seconds_callback(&s_as7000_watchdog_timer); }...
IHEX_RECORD_LENGTH(MAX_HEX_DATA_BYTES)
]; ihex_encode(data_record, IHEX_TYPE_DATA, write_address, chunk, load_length); if (!prv_write_register_block(dev, ADDR_LOADER_STATUS, data_record, IHEX_RECORD_LENGTH(load_length))) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to write hex record"); ...
prv_cleanup_action_menu(action_menu)
; applib_free(timeline_action_menu); } ActionMenu *timeline_actions_push_action_menu(ActionMenuConfig *base_config, WindowStack *window_stack) { PBL_ASSERTN(base_config); TimelineActionMenu *timeline_action_menu = applib_zalloc(sizeof(TimelineActionMenu)); if (!tim...
um_characteristics]; // Test gatt_client_service_get_characteristics(): const uint8_t num_found_characteristics = gatt_client_service_get_characteristics(service_ref, characteristic_refs, num_characteristics); cl_assert_equal_i(num_characteristics, num_found_characteristics); fo...
(uuid_equal(&uuid, &bp_service->uuid))
; } void test_gatt_client_accessors__get_characteristics_matching_uuids(void) { BTDeviceInternal device = prv_connected_dummy_device(1); // Start discovery: cl_assert_equal_i(gatt_client_discovery_discover_all(&device), BTErrnoOK); prv_mock_put_service_discovery_events(); const Service *bp_service = fake_g...
"graphics_common_stubs.h" #include "stubs_applib_resource.h" static FrameBuffer *fb = NULL; // Setup void test_graphics_draw_circle_${BIT_DEPTH_NAME}__initialize(void) { fb = malloc(sizeof(FrameBuffer)); framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); } // Teardown void test_graphics_draw_circle_${BIT_DEP...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_origin_aa_r16_no_clip.${BIT_DEPTH_NAME}.pbi"))
; setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 1); graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_BIG); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_origin_aa_r16_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_C...
or_equal(context.draw_state.fill_color, GColorWhite)); // Compositing Mode graphics_context_set_compositing_mode(&context, GCompOpOr); cl_assert(context.draw_state.compositing_mode == GCompOpOr); // Text Color graphics_context_set_text_color(&context, GColorClear); cl_assert_equal_i(context.draw_state.tex...
GRect(20, 80, 40, 10)
, 4); ASSERT_CALLED(prv_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4)); } void test_graphics_context_${BIT_DEPTH_NAME}__draw_stroke_width_2(void) { // Stroke width 2, non-antialiased setup_test(&context, false, 2, GColorBlack, GColorBlack, false); graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10...
graphics_fill_rect__color.argb); cl_assert_equal_i(GColorJaegerGreenARGB8, s_context.draw_state.fill_color.argb); s_graphics_fill_rect = (MockCallRecordings){}; EXECUTE_SCRIPT( "ctx.fillRect(5, 6, 7, 8);\n" ); cl_assert_equal_i(1, s_graphics_fill_rect.call_count); cl_assert_equal_rect(GRect(5, 6, 7, 8...
PP(29.5, 39.5)
), lc->fill_radial_precise.center); cl_assert_equal_i(0, lc->fill_radial_precise.radius_inner.raw_value); cl_assert_equal_i(20 * 8, lc->fill_radial_precise.radius_outer.raw_value); // outer radius capped to >= 0 EXECUTE_SCRIPT( "ctx.rockyFillRadial(30, 40, -10, -20, 0, Math.PI);\n" ); cl_assert_equal_i...
interval_1_25ms = event->conn_params.interval_min, .slave_latency_events = event->conn_params.slave_latency, .supervision_timeout_10ms = event->conn_params.sup_timeout, }; connection_set_conn_params(conn, &params); pebble_pairing_service_handle_conn_params_change(conn, conn_idx); hc_endpoint_responsiven...
(connection, &e.new_device)
; hc_endpoint_gap_le_connect_send_address_and_irk_changed(&e); } static void prv_handle_pairing_completed(const ble_evt_gap_pair_completed_t *evt) { PBL_LOG(LOG_LEVEL_INFO, "Pairing completed. Bond=%u, MITM=%u, status=0x%"PRIx8, evt->bond, evt->mitm, evt->status); const uint16_t conn_idx = evt->conn_i...
16, -1000}, { 48, 16, -1000}, { 48, 16, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 16, -1008}, { 48, 8, -1000}, { 48, 24, -1000}, { 48, 8, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 56, 16, -1008}, { 48, 16, -1000}, { 48, 16, -1000}, { 48, 16, -1000}, ...
{ 48, 16, -1000}, { 48, 24, -1000}, { 56, 24, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 40, -1000}, { 48, 8, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 32, -1000}, { 48, 16, -1000}, { 48, 24,...
{ 48, 16, -992}, { 48, 24, -1000}, { 40, 24, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 16, -1008}, { 48, 16, -1000}, { 56, 16, -1000}, { 48, 24, -1008}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 16, -1008}, { 48, 24, -1000}, { 48, 16...
{ // The first frame is ANIMATION_NORMALIZED_MAX because the right flip animation is actually // played backwards compositor_round_flip_transitions_flip_animation_update(ctx, ANIMATION_NORMALIZED_MAX, CompositorTransitionDirectionRight, ...
void test_graphics_window_stack_animation__right_flip_first_frame_clipping(void) { prv_test_clipping_mask(prv_right_flip_first_frame_clipping, "right_flip_first_frame_clipping"); }; // This test records a clipping mask of the 1/4 progress frame of the right "round flip" compositor // transition animation and then ...
device_t *dev = find_device_by_conn_idx(conn_idx); if (dev) { dev->is_gateway = is_gateway; } storage_release(); BTDeviceInternal device; connection_get_address(connection, &device); hc_endpoint_pebble_pairing_service_found_gateway(&device); } static bool prv_is_bonded(uint16_t conn_idx) { storage_...
connection_set_should_pin_address(connection, req->should_pin_address)
; connection_set_should_auto_accept_re_pairing(connection, req->should_auto_accept_re_pairing); connection_set_reversed_ppogatt_enabled(connection, req->is_reversed_ppogatt_enabled); if (!req->no_slave_security_request) { PBL_LOG(LOG_LEVEL_INFO, "Trying to establish security %u", level); ble_error_t e = ...
return; } ReliablePacket *packet = raw_packet; if (packet->is_supervisory) { if (packet->s.kind != SupervisoryKind_ReceiveReady && packet->s.kind != SupervisoryKind_Reject) { PBL_LOG(LOG_LEVEL_DEBUG, "Received a command packet of type %" PRIu8 " which is not supported by this im...
(retransmit_sequence_number, s_tx_buffer->app_protocol, &s_tx_buffer->information[0], s_tx_buffer->length)
t no chance to clean things up or exit gracefully. The app must //! already be in a state where it's safe to exit. //! Note that the app may not have ever been successfully started when this is called, so check //! your null pointers! static void prv_app_cleanup(void) { // Back button may have been held down when thi...
(dialog, text)
; text_height = text_layer_get_content_size(ctx, text_layer).h; } #endif i18n_free_all(crash_dialog); PBL_LOG(LOG_LEVEL_DEBUG, "Watchface crashed, launching default."); crash_info = (AppCrashInfo) { 0 }; watchface_set_default_install_id(INSTALL_ID_INVALID); watchface_launch_default(NULL); #endif } ...
Nothing is stored, so no active gateways yet ret = bt_persistent_storage_get_active_gateway(&id_out, &type_out); cl_assert(!ret); ret = bt_persistent_storage_has_active_bt_classic_gateway_bonding(); cl_assert(!ret); ret = bt_persistent_storage_has_active_ble_gateway_bonding(); cl_assert(!ret); // Store ...
(type_out, BtPersistBondingTypeBTClassic)
; ret = bt_persistent_storage_has_active_bt_classic_gateway_bonding(); cl_assert(ret); ret = bt_persistent_storage_has_active_ble_gateway_bonding(); cl_assert(!ret); // Manually set the active gateway again (to the ble pairing) bt_persistent_storage_set_active_gateway(id_3); ret = bt_persistent_storage_...
/* * 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...
(window_layer)
; frame.origin = GPoint(0, 50); s_text_instructions = text_layer_create(frame); text_layer_set_text(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...
rting timeline resources .sdk_version = {TIMELINE_RESOURCE_PBW_SUPPORT_FIRST_SDK_VERSION_MAJOR, TIMELINE_RESOURCE_PBW_SUPPORT_FIRST_SDK_VERSION_MINOR - 1}, }, .resource_lut = s_app_lut, }, { .install_entry = { .install_id = TimelineResourceTestAppId_ValidApp, .uui...
( (TimelineResourceId)TimelineResourceTestTimelineId_AlarmClock, TimelineResourceSizeTiny, TimelineResourceTestAppId_AppWithInvalidLUT, &res_info)
); // Calling the function for an invalid resource (e.g. dimensions too large) should return false s_is_app_published_resource_invalid = true; cl_assert(!timeline_resources_get_id_system( (TimelineResourceId)TimelineResourceTestTimelineId_AlarmClock, TimelineResourceSizeTiny, TimelineResourceTestAppI...
0, 40, 10), 4, SW_ODD)); } void test_graphics_context_${BIT_DEPTH_NAME}__draw_antialiased_stroke_width_2(void) { // Stroke width = 2, antialiased setup_test(&context, true, 2, GColorBlack, GColorBlack, false); graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10)); #if PBL_COLOR ASSERT_CALLED(graphics_line...
GRect(20, 80, 40, 10)
, 4); #if PBL_COLOR ASSERT_CALLED(prv_draw_round_rect_aa_stroked(&context, &GRect(20, 80, 40, 10), 4, SW_ODD)); #else ASSERT_CALLED(prv_draw_round_rect_stroked(&context, &GRect(20, 80, 40, 10), 4, SW_ODD)); #endif } void test_graphics_context_${BIT_DEPTH_NAME}__fill(void) { // Fill shape, non-antialiased (Stroke...
last_response_cookie = ntohl(response_msg->cookie); if (response_msg->response == ResponseAck) { ++s_acks_received; } else if (response_msg->response == ResponseNack) { ++s_nacks_received; } } void test_put_bytes__initialize(void) { fake_pb_storage_mem_reset(); fake_pb_storage_mem_set_crc(EXPECTED_CR...
cl_assert_equal_i(event.put_bytes.total_size, VALID_OBJECT_SIZE)
; cl_assert_equal_i(event.put_bytes.progress_percent, 0); cl_assert_equal_b(event.put_bytes.failed, false); } void test_put_bytes__init_while_already_busy(void) { prv_receive_init(VALID_OBJECT_SIZE, ObjectFirmware); prv_receive_init(VALID_OBJECT_SIZE, ObjectFirmware); assert_nack_count(1); } void test_put_b...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (state->recv_state != QemuRecvState_WaitingHdrSignatureMSB && cur_time > state->start_recv_packet_time + QEMU_RECV_PACKET_TIMEOUT_SEC) { state->recv_state = QemuRecvState_WaitingHdrSignatureMSB; PBL_LOG(LOG_LEVEL_WARNING, "Resetting receive state - max packet time expired"); }
state->callback_pending = false; uint16_t bytes_avail = shared_circular_buffer_get_read_space_remaining(&state->isr_buffer, &state->isr_buffer_client); QEMU_LOG_DEBUG("prv_assemble_packet, state:%d, bytes:%d", state->recv_state, bytes_avail); // Log message if we detected any rec...
256, 304}, // 22 seconds { 1696, 424, 320}, { 1216, 200, 296}, { 1424, 104, 248}, { 1576, -88, 480}, { 1344, 8, 352}, { 1192, 80, 224}, { 1008, 64, 168}, { 808, 8, 128}, { 656, -64, 112}, { 552, -128, 64}, { 504, -144, 32}, { 576, -168, 0}, { 880, -64, -104}, ...
{ 1400, 184, 232}, { 1792, 280, 80}, { 1616, 192, 408}, { 1392, 80, 240}, { 1224, 16, 272}, { 1072, 16, 208}, // 28 seconds { 968, -24, 200}, { 808, -40, 120}, { 608, -184, 32}, { 520, -176, -56}, { 664, -56, -128}, { 1008, -80, 8}, { 1408, -16, 224}, { 1544, ...
{ 1056, -64, -8}, { 1488, -24, 272}, { 1504, 376, 296}, { 1144, 720, 0}, { 1240, 408, 96}, { 1336, 304, 336}, { 1216, 304, 416}, { 1104, 336, 352}, { 1040, 408, 296}, { 920, 416, 336}, { 824, 472, 240}, { 792, 512, 200}, // 31 seconds { 832, 600, 200}, { 1048...
/* * 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...
{ last_bar_fill = bar_fill; prv_set_parameter(bar_fill); prv_draw_scene(SCENE_UPDATE); }
} bool boot_display_show_error_code(uint32_t error_code) { prv_set_parameter(error_code); prv_draw_scene(SCENE_ERROR); if (prv_wait_busy()) { prv_screen_on(); return true; } else { return false; } } void boot_display_screen_off(void) { prv_screen_off(); prv_draw_scene(SCENE_BLACK); prv_wa...
eInternal device = prv_connected_dummy_device(1); // Start discovery: cl_assert_equal_i(gatt_client_discovery_discover_all(&device), BTErrnoOK); prv_mock_put_service_discovery_events(); const uint8_t num_services = 1; // Test gatt_client_copy_service_refs(): BLEService service_refs[num_services]; const...
gatt_client_service_get_uuid(service_refs_out[0])
; cl_assert(uuid_equal(&uuid, &bp_service->uuid)); // Thermo & Random 128 bit service should be part of the second gen refs_out = gatt_client_copy_service_refs_by_discovery_generation( &device, service_refs_out, 3, 1); cl_assert_equal_i(2, refs_out); const Uuid uuid1 = gatt_client_service_get_uuid(ser...
_range, uint16_t inset); static uint8_t *prv_bitmap_offset_for_steps(GBitmap *bmp, int sx, int sy, int steps_x, int steps_y) { sx += (steps_x - 1) / 2; sy += (steps_y - 1) / 2; int16_t step_w = bmp->bounds.size.w / steps_x;...
prv_prepare_fb_steps(GSize(DISP_COLS, 2 * DISP_ROWS))
; TextLayoutExtended layout = { .flow_data = { .perimeter.impl = &(GPerimeter){.callback=perimeter_for_display_round}, .perimeter.inset = 8, .paging.page_on_screen = { .origin_y = 25, .size_h = 100 }, // setting a page height != enables positioning }, }; render_step...
312, -48}, { 1032, 304, 88}, { 1616, 456, 8}, { 1376, 432, 168}, { 1184, 296, 200}, { 1080, 208, 200}, { 1000, 216, 184}, { 832, 184, 192}, { 760, 136, 168}, { 848, 112, 176}, { 800, 56, 264}, { 880, 48, 248}, { 968, 40, 280}, { 896, 88, 248}, { 1120, 120, 200}, ...
{ 864, 168, 40}, { 768, 16, 0}, { 752, 80, -16}, { 792, 168, -24}, { 880, 208, -24}, { 864, 208, -8}, { 1016, 216, 8}, { 1080, 224, 40}, { 1184, 248, 96}, { 1144, 312, 80}, { 1080, 352, 96}, { 848, 360, 56}, { 856, 328, 56}, { 928, 288, 112}, { 848, 200, 160},...
, { 1184, 32, -80}, { 1544, -104, -64}, { 1560, -32, 120}, { 1128, 336, -120}, { 1032, 384, -216}, { 864, 280, 32}, { 680, 128, 80}, { 752, 152, 112}, { 832, 216, 128}, // 25 seconds { 816, 352, 24}, { 784, 352, -24}, { 824, 400, -96}, { 968, 408, -176}, { 115...
{ 840, 352, -112}, { 936, 336, -128}, { 1208, 328, -128}, { 1240, 288, -64}, { 1760, 352, 0}, { 1432, 480, -16}, { 840, 400, 0}, { 960, 272, 80}, { 1064, 176, 144}, { 944, 168, 128}, { 832, 112, 128}, { 760, 96, 72}, // 31 seconds { 752, 96, 24}, { 752, 24, 48...
iber_event(recognizer); } if (!recognizer->handling_touch_event) { recognizer_manager_handle_state_change(recognizer->manager, recognizer); } } //////////////////////////////////////////////////////////////////////////////////////////////////// // Private interface void recognizer_handle_touch_event(Recogni...
if (!recognizer) { return; }
recognizer->subscriber.filter = filter_cb; } void recognizer_set_on_destroy(Recognizer *recognizer, RecognizerOnDestroyCb on_destroy_cb) { if (!recognizer) { return; } recognizer->subscriber.on_destroy = on_destroy_cb; } void recognizer_destroy(Recognizer *recognizer) { if (!recognizer || recognizer->i...
launcher_app_glance_generic_create(node, service->generic_glance_icon, service->generic_glance_icon_resource_id); } // If we successfully loaded a glance, set its service field if (glance) { glance->service = service; } return glance; } static LauncherApp...
if (!use_glance_cache) { launcher_app_glance_destroy(glance); }
} void launcher_app_glance_service_rewind_current_glance(LauncherAppGlanceService *service) { if (!service) { return; } kino_player_rewind(&service->glance_reel_player); } void launcher_app_glance_service_pause_current_glance(LauncherAppGlanceService *service) { if (!service) { return; } kino_pla...
workout_service_get_current_workout_hr_zone_time(hr_zone_time_s)); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone0], 0); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone1], 10); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone2], 10); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone3], 0); prv_inc_time(10); prv_put_bpm_...
cl_assert(workout_service_pause_workout(false))
; prv_put_bpm_event(180, HRMQuality_Good); prv_put_bpm_event(180, HRMQuality_Good); cl_assert(workout_service_get_avg_hr(&avg_hr)); cl_assert_equal_i(avg_hr, 160); } // --------------------------------------------------------------------------------------- // Open the app, start a workout, close app. // 55 mi...
TALL_ID_INVALID) || shell_sdk_last_installed_app_is_watchface()) { text = "Install an app to continue"; } else if ((rtc_get_time() / tip_delay_s) & 1) { // Show the launcher help on every odd set of five seconds since the epoch text = "Press Select to access Launcher"; } else { text = "Press Down to...
(&window->layer, &info_text_layer->layer)
; #if PBL_ROUND #if CAPABILITY_HAS_SDK_SHELL4 const uint8_t inset = 8; #else const uint8_t inset = 18; #endif text_layer_enable_screen_text_flow_and_paging(info_text_layer, inset); #endif app_state_set_user_data(data); #if CAPABILITY_HAS_SDK_SHELL4 window_set_background_color(window, PBL_IF_COLOR_ELSE(GCol...
/* * 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 (header.fpga_len != expected_fpga_header.fpga_len || header.fpga_len_complemented != expected_fpga_header.fpga_len_complemented) { PBL_LOG(LOG_LEVEL_DEBUG, "Boot FPGA length invalid, needs a rewrite"); // The length doesn't even match, we definitely need to update. return false; }
// Just because the length is the same that doesn't mean we don't need to update the FPGA // image. Compare CRCs to see if the new FPGA image is different. uint32_t expected_crc = crc32(CRC32_INIT, s_boot_fpga, sizeof(s_boot_fpga)); uint32_t stored_crc = flash_crc32( BOOT_FPGA_FLASH_ADDR + sizeof(BootFP...
/* * 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...
text_layer_set_text_alignment(s_text_layer, GTextAlignmentCenter)
; layer_add_child(window_layer, text_layer_get_layer(s_text_layer)); } static void prv_window_unload(Window *window) { text_layer_destroy(s_text_layer); } static void prv_init(void) { s_window = window_create(); window_set_click_config_provider(s_window, prv_click_config_provider); window_set_window_handler...
PebbleHRMEvent *hrm = &e->hrm; // Save HRMEventBPM data and send when we get the current into. static uint8_t bpm = 0; static uint8_t bpm_quality = 0; static uint16_t led_current = 0; if (hrm->event_type == HRMEvent_BPM) { snprintf(app_data->bpm_string, sizeof(app_data->bpm_string), "%"PRIu8...
if (status == AppStatus_Stopped) { text_layer_set_text(&app_data->bpm_text_layer, "Paused"); text_layer_set_text(&app_data->quality_text_layer, "Paused by mobile"); prv_disable_hrm(); } else { app_data->bpm_string[0] = '\0'; text_layer_set_text(&app_data->bpm_text_layer, app_data->bpm_string); ...
} static void prv_message_received_cb(DictionaryIterator *iterator, void *context) { Tuple *status_tuple = dict_find(iterator, AppMessageKey_Status); if (status_tuple) { prv_handle_mobile_status_request(status_tuple->value->uint8); } } static void prv_message_sent_cb(DictionaryIterator *iterator, void *co...
me_buf); // June 9th 2015, 12:59:59 (T+00:59:59) rtc_set_time(event_time + (59 * SECONDS_PER_MINUTE) + 59); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("59 MIN AGO", time_buf); // June 9th 2015, 13:00:00 (T+01:00:00) rtc_set_time(event_time...
(event_time + SECONDS_PER_HOUR + (59 * SECONDS_PER_MINUTE) + 59)
; clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("2 H AGO", time_buf); // June 9th 2015, 14:00:00 (T+02:00:00) rtc_set_time(event_time + (2 * SECONDS_PER_HOUR)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIV...
_context_set_fill_color(&context, color); #if PBL_COLOR cl_assert_equal_i(context.draw_state.fill_color.argb, GColorOrange.argb); #else cl_assert_equal_i(context.draw_state.fill_color.argb, GColorDarkGray.argb); #endif color.a = 2; graphics_context_set_fill_color(&context, color); #if PBL_COLOR cl_assert_equ...
(20, 80, 40, 10)
Node *) list_find(head, prv_find_subscription_by_att_handle, (void *)(uintptr_t) att_handle); if (UNLIKELY(!subscription)) { // MT: I suspect this can be hit when the remote remembers the CCCD subscription state across // disconnections (while we don't ...
(LOG_LEVEL_DEBUG, "No subscription and/or connection found for CCCD write response (%u)", error)
/* * 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, s_data.animation_sequence, distance_normalized, replace_color, stroke_color, s_data.outer_color /* overdraw color */, inner, NULL)
; } void prv_render_modal_if_necessary(void) { // Since modal windows don't have a framebuffer that we can use in the compositor animation, // draw the modal now (if one exists) so the modal compositor animations can draw on top of it, // revealing the relevant parts of the modal window throughout the animation ...
rviceTag tag, size_t required_free_length, void *writer) { if (!writer) { return false; } bool success = false; prv_lock(); { AppInboxNode *inbox = prv_find_inbox_by_tag_and_log_if_not_found(tag); if (!inbox) { goto unlock; } if (prv_is_inbox_being_written(inbox)) { ++inbox->nu...
prv_find_inbox_by_tag(tag)
; if (inbox) { num_failed = inbox->num_failed; } prv_unlock(); return num_failed; } uint32_t app_inbox_service_num_success_for_tag(AppInboxServiceTag tag) { uint32_t num_success = 0; prv_lock(); AppInboxNode *inbox = prv_find_inbox_by_tag(tag); if (inbox) { num_success = inbox->num_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...
mutex_lock_recursive(s_adv_mutex)
; } static void prv_unlock(void) { mutex_unlock_recursive(s_adv_mutex); } static gap_disc_mode_t prv_dialog_discoverable_type_for_flag(uint8_t flags) { if (flags & GAP_LE_AD_FLAGS_GEN_DISCOVERABLE_MASK) { return GAP_DISC_MODE_GEN_DISCOVERABLE; } else if (flags & GAP_LE_AD_FLAGS_LIM_DISCOVERABLE_MASK) { ...
id prv_adjust_value_boundaries(HealthValue *values, size_t num_values, const HealthServiceTimeRange *range); bool prv_activity_session_matches(const ActivitySession *session, HealthActivityMask mask, time_t time_start, time_t time_end); int64_t prv_se...
(*num_sessions, s_sys_activity_get_sessions_values.out.num_sessions)
ENGTH(stack), &current_stack, false); cl_assert_equal_p(b, actual); cl_assert_equal_i(0, current_stack); cl_assert_equal_p(b, stack[0]); // test limited stack size (go to sibling instead of child) stack[0] = a; current_stack = 0; actual = __layer_tree_traverse_next__test_accessor(stack, 1, &current_stac...
(&parent, &GPoint(9, 9))
, &child_a); cl_assert_equal_p(layer_find_layer_containing_point(&parent, &GPoint(6, 6)), &child_d); cl_assert_equal_p(layer_find_layer_containing_point(&parent, &GPoint(15, 15)), &child_e); } static bool prv_override_layer_contains_point(const Layer *layer, const GPoint *point) { return true; } void test_layer...
{ 968, 1032, -288}, { 1336, 728, -136}, { 1816, 896, -168}, { 2168, 720, -144}, { 2000, 480, -96}, { 1712, 424, -168}, // 60 seconds // elapsed: 1 minutes { 1488, 96, 40}, { 1528, 568, -168}, { 1296, 200, -104}, { 1264, 216, -72}, { 1040, -88, 56}, { 512, -376, 24}, ...
{ 1120, 32, -576}, { 1288, 224, -624}, { 1248, 248, -528}, { 944, 168, -392}, { 840, 352, -416}, { 920, 224, -496}, { 928, 136, -664}, { 1024, 248, -944}, { 1152, 528, -1312}, { 976, 488, -944}, { 1288, 720, -952}, { 1024, 448, -744}, { 1208, 568, -560}, { 1480, 4...
{ 1592, 328, -168}, { 1496, 240, -176}, { 1312, 152, -200}, { 712, -448, -16}, { 616, -224, -272}, { 656, -256, 16}, { 1080, 232, -256}, { 1352, 232, -352}, // 68 seconds { 1528, 368, -408}, { 1472, 264, -280}, { 1392, 448, -304}, { 1496, 648, -232}, { 1560, 744,...
aw or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "sync.h" #include "...
if (length < sizeof(BlobDBToken)) { return 0; }
return *(BlobDBToken*)data; } static void prv_handle_database_insert(CommSession *session, const uint8_t *data, uint32_t length) { if (length < MIN_INSERT_LENGTH) { prv_send_response(session, prv_try_read_token(data, length), BLOB_DB_INVALID_DATA); return; } const uint8_t *iter = data; BlobDBToken...
/* * 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...
text_layer_init(thumbsup_layer, &(GRect){{0, 1 * (size.h / 3)}, {size.w, 50}})
; text_layer_set_font(thumbsup_layer, fonts_get_system_font(FONT_KEY_GOTHIC_28)); text_layer_set_text_alignment(thumbsup_layer, GTextAlignmentCenter); layer_add_child(&window->layer, (Layer *)thumbsup_layer); TextLayer *text_layer = &data->text_layer; text_layer_init(text_layer, &(GRect){{0, 2 * (size.h / 3)...
month; test_cron.wday = s_cron_test_info[i].wday; time_t base = s_2015_nov12_123456_gmt; time_t advance = s_cron_test_info[i].dest_time - base; // DST off prv_basic_test(&s_timezone_gmt, &test_cron, base, advance, advance, 0); // DST on base -= SECONDS_PER_HOUR; prv_basic_test(&s_timezon...
CRON_JOB(10, CRON_HOUR_ANY, 1, CRON_MONTH_ANY, prv_cron_callback)
CRON_JOB(25, CRON_HOUR_ANY, CRON_MDAY_ANY, CRON_MONTH_ANY, prv_cron_callback) CRON_JOB(55, 1, CRON_MDAY_ANY, CRON_MONTH_ANY, prv_cron_callback) CRON_JOB(CRON_MINUTE_ANY, CRON_HOUR_ANY, 1, CRON_MONTH_ANY, prv_cron_callback) }; CronJob new_job = { .cb = prv_counting_cb, .cb_data = (void*)0, };...
size, resource, fallback_resource, app_id); if (!icon_reel) { return; } GSize icon_size = kino_reel_get_size(icon_reel); const GSize max_icon_size = timeline_resources_get_gsize(icon_res_size); if ((icon_size.w > max_icon_size.w) || (icon_size.h > max_icon_size.h)) { // The icon is too large, use the...
{ if (layout->layout_layer.mode == LayoutLayerModeCard && layout->impl->card_view_deinitializer) { layout->impl->card_view_deinitializer(layout); } graphics_text_node_destroy(layout->view_node); layout->view_node = NULL; }
static GTextNode *prv_create_all_day_text_node(const TimelineLayout *layout) { static const LayoutNodeTextBufferConfig s_all_day_config = { .text.extent.node.type = LayoutNodeType_TextBuffer, .str = i18n_noop("All day"), .use_i18n = true, .text.style = LayoutContentSizeDefault, .text.style_font ...
/* * 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_gpio_to_power_system_map[idx])
; } portEXIT_CRITICAL(); } void gpio_output_init(const OutputConfig *pin_config, GPIOOType_TypeDef otype, GPIOSpeed_TypeDef speed) { GPIO_InitTypeDef init = { .GPIO_Pin = pin_config->gpio_pin, .GPIO_Mode = GPIO_Mode_OUT, .GPIO_Speed = speed, .GPIO_OType = otype, .GPIO_Pu...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
mfg_info_get_rtc_freq()
, 4); char buffer[MFG_INFO_MODEL_STRING_LENGTH] = { 0 }; mfg_info_get_model(buffer); cl_assert_equal_s(buffer, ""); // Set color and make sure others don't change. mfg_info_set_watch_color(5); cl_assert_equal_i(mfg_info_get_watch_color(), 5); cl_assert_equal_i(mfg_info_get_rtc_freq(), 4); mfg_info_g...
_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); } // Read the interrupt status registers to clear pending bits. static void prv_clear_pending_interrupts(void) { uint8_t throwaw...
{ while (1) {} __builtin_unreachable(); }
return false; } void set_ldo3_power_state(bool enabled) { } void set_4V5_power_state(bool enabled) { } void set_6V6_power_state(bool enabled) { }
ipsis_clip_across_ny_descender); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_ellipsis_clip_across_ny_descender.${BIT_DEPTH_NAME}.pbi")); // Ellipsis tests test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_ellipsi...
(&ctx.dest_bitmap, "draw_text_single_line_wordwrap_clip_across_x.${BIT_DEPTH_NAME}.pbi")
); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_wordwrap_clip_outside_ny); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_wordwrap_clip_outside_ny.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb...
nt8_t *)&buf[0], sizeof(buf)), sizeof(buf)); } pfs_close(fd); fd = pfs_open("page_lookup", OP_FLAG_READ | OP_FLAG_USE_PAGE_CACHE, FILE_TYPE_STATIC, 0); cl_assert(fd >= 0); for (int i = 0; i < num_regions; i++) { cl_assert_equal_i(pfs_seek(fd, i * sizeof(buf), FSeekSet), i * sizeof(buf)); uint8_t read...
(fd, buf, rd_len)
; cl_assert(rv == E_INVALID_ARGUMENT); pfs_close(fd); fd = pfs_open("newfile", OP_FLAG_READ, 0, 0); rv = pfs_read(fd, buf, rd_len); cl_assert(rv == rd_len); rv = pfs_read(fd, buf, 1); cl_assert(rv == E_RANGE); rv = pfs_seek(fd, 0, FSeekSet); cl_assert(rv == 0); rv = pfs_read(fd, NULL, rd_len); cl...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_p(result, false)
; result = transcription_validate(validate_test, test_size - 1); cl_assert_equal_p(result, false); result = transcription_validate(validate_test, test_size + 1); cl_assert_equal_p(result, false); result = transcription_validate(validate_test, 0); cl_assert_equal_p(result, false); result = transcriptio...
unsigned int min_text_len = 3; const int max_text_height = 2 * fonts_get_font_height(text_layer->font) + 8; GContext *ctx = graphics_context_get_current_context(); int32_t text_height = text_layer_get_content_size(ctx, text_layer).h; // Until the text_height fits max_text_height or the app name is min_text_le...
{ prv_app_show_crash_ui(old_install_id); }
// Clear for next time. s_next_app = (NextApp) {}; return true; } // --------------------------------------------------------------------------------------------- void app_manager_start_first_app(void) { const PebbleProcessMd* app_md = system_app_state_machine_system_start(); PBL_ASSERTN(prv_app_start(ap...
/* * 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...
(a.layer, b.layer)
; cl_assert_equal_b(a.times_out, b.times_out); cl_assert(a.alignment == b.alignment); cl_assert(a.colors.foreground.argb == b.colors.foreground.argb); cl_assert(a.colors.background.argb == b.colors.background.argb); } // Setup ///////////////////////////////// void test_content_indicator__initialize(void) { ...
// Keep track of which children we added so we can restore them in case of error bool used_children[array_len]; memset(used_children, 0, sizeof(bool) * array_len); // Set the parent on each of the components uint32_t child_idx = 0; for (uint32_t i = 0; i < array_len; i++) { AnimationPrivate *componen...
applib_type_malloc(AnimationPrivate)
/* * 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 ((ProfilerNode *) b)->total - ((ProfilerNode *) a)->total; }
void prv_node_reset(ProfilerNode *node) { node->start = 0; node->end = 0; node->total = 0; node->count = 0; list_init(&node->list_node); } void profiler_init(void) { g_profiler.end = 0; g_profiler.start = 0; g_profiler.nodes = NULL; for (uint32_t i = 0; i < ARRAY_LENGTH(s_profiler_nodes); i++) { ...
rtical flipping void prv_assign_vertical_line_raw(GBitmap *framebuffer, int16_t x, Fixed_S16_3 y1, Fixed_S16_3 y2, GColor color); static void prv_vline_pattern_assign_vertical_line_raw(GContext *ctx, int16_t x, int16_t y1, int16_...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_core_plot_pixel")))
PBL_HEXDUMP(LOG_LEVEL_DEBUG, (const uint8_t *)&config->root_keys[SMRootKeyTypeIdentity], sizeof(config->root_keys[SMRootKeyTypeIdentity])); ble_dev_params_t *dev_params = ble_mgr_dev_params_acquire(); memcpy(&dev_params->irk, &config->root_keys[SMRootKeyTypeIdentity], sizeof(dev_params->irk)); ble...
prv_handle_pairing_request((const ble_evt_gap_pair_req_t *)hdr)
; break; case BLE_EVT_GAP_PAIR_COMPLETED: { ble_evt_gap_pair_completed_t *evt = (ble_evt_gap_pair_completed_t *)hdr; prv_handle_pairing_completed(evt); break; } case BLE_EVT_GAP_ADDRESS_RESOLVED: { const ble_evt_gap_address_resolved_t *evt = (co...
s_SDK_compatible(&entry)) { return true; } PBL_LOG(LOG_LEVEL_WARNING, "App requires support for SDK version (%"PRIu8".%"PRIu8"), " "we only support version (%"PRIu8".%"PRIu8").", entry.sdk_version.major, entry.sdk_version.minor, (uint8_t) PROCESS_INFO_CURRENT_SD...
app_install_entry_is_watchface(&entry)
) { // If the watchface is for an unsupported SDK version, we need to switch the default // watchface back to tictoc. Otherwise, we will be stuck in the launcher forever. watchface_set_default_install_id(INSTALL_ID_INVALID); watchface_launch_default(NULL); } // Not going to ...