Skip to content

Add Cellular_Ping function and enhance AT read logging#5

Merged
robweiss merged 2 commits into
sitehive-mainfrom
feature/add-cellular-ping
May 1, 2026
Merged

Add Cellular_Ping function and enhance AT read logging#5
robweiss merged 2 commits into
sitehive-mainfrom
feature/add-cellular-ping

Conversation

@robweiss
Copy link
Copy Markdown

@robweiss robweiss commented May 1, 2026

Adds Cellular_Ping() to cellular_api.h — synchronous ping returning the raw modem result code from AT+QPING (0 = success, 565 = routing failure, 569 = timeout, -1 = URC not received). Uses the same queue/URC pattern as Cellular_GetHostByName.

Improves _Cellular_ReadLine debug logging to show actual data content (up to 50 bytes) rather than a pointer address, making AT traces readable in serial logs.

This pull request introduces a new API for sending ICMP pings from the modem and improves debug logging in the AT command read function. The most important changes are grouped by theme below.

New Feature: ICMP Ping API

  • Added a new function Cellular_Ping to cellular_api.h, which allows sending a single ICMP ping using the modem and returns the raw modem result code. This function provides details on parameters and return values in its documentation.

Logging Improvements

  • Enhanced debug logging in _Cellular_ReadLine in cellular_pktio.c to avoid printing excessively large data buffers. Now, if more than 50 bytes are read, only the first 50 bytes are logged, improving log readability and safety.

Description

Test Steps

Checklist:

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Adds Cellular_Ping() to cellular_api.h — synchronous ping returning the
raw modem result code from AT+QPING (0 = success, 565 = routing failure,
569 = timeout, -1 = URC not received). Uses the same queue/URC pattern
as Cellular_GetHostByName.

Improves _Cellular_ReadLine debug logging to show actual data content
(up to 50 bytes) rather than a pointer address, making AT traces readable
in serial logs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new public API declaration for modem ICMP pinging and updates packet I/O debug logging to print readable AT RX content (capped to 50 bytes) instead of a pointer value.

Changes:

  • Add Cellular_Ping() prototype and Doxygen documentation to the public API header.
  • Update _Cellular_ReadLine debug logging to print received content (first 50 bytes) rather than the buffer address.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
source/include/cellular_api.h Declares the new Cellular_Ping() API and documents expected return semantics.
source/cellular_pktio.c Improves AT read debug logging by printing buffer content up to a fixed limit.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread source/cellular_pktio.c Outdated
Comment thread source/cellular_pktio.c Outdated
Comment thread source/cellular_pktio.c Outdated
Comment thread source/include/cellular_api.h
The AT read debug logging changes in fe81a99 were inadvertently included
and are not part of the Cellular_Ping work. Restoring the original
LogDebug call so this PR only adds the new API declaration.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@robweiss robweiss merged commit ff8d101 into sitehive-main May 1, 2026
7 of 10 checks passed
@robweiss robweiss deleted the feature/add-cellular-ping branch May 1, 2026 02:17
robweiss added a commit that referenced this pull request May 1, 2026
* feat: Add Cellular_Ping and improve AT read logging

Adds Cellular_Ping() to cellular_api.h — synchronous ping returning the
raw modem result code from AT+QPING (0 = success, 565 = routing failure,
569 = timeout, -1 = URC not received). Uses the same queue/URC pattern
as Cellular_GetHostByName.

Improves _Cellular_ReadLine debug logging to show actual data content
(up to 50 bytes) rather than a pointer address, making AT traces readable
in serial logs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* revert: drop unintended cellular_pktio.c logging changes

The AT read debug logging changes in fe81a99 were inadvertently included
and are not part of the Cellular_Ping work. Restoring the original
LogDebug call so this PR only adds the new API declaration.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants