Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions .github/workflows/doxygen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# .github/workflows/doxygen.yml
name: Doxygen Docs

# ───────────────────────────────
# ➊ Run on every push (any branch / tag) and on every PR
# ───────────────────────────────
on:
push:
branches: ["**"] # “**” means *all* branches & tags
pull_request: # keeps lint / warnings visible in PRs

# ───────────────────────────────
# ➋ The workflow needs to push to gh-pages
# so we grant the default token “contents: write”
# ───────────────────────────────
permissions:
contents: write # required by peaceiris/actions-gh-pages

jobs:
docs:
runs-on: ubuntu-latest

steps:
# ───────────────────────────
# Check out the current commit
# ───────────────────────────
- name: Checkout source
uses: actions/checkout@v4

# ───────────────────────────
# Install Doxygen + Graphviz
# ───────────────────────────
- name: Install Doxygen & Graphviz
run: |
sudo apt-get update -y
sudo apt-get install -y doxygen graphviz

# ───────────────────────────
# Build the manual – assumes your “Doxyfile” puts
# everything inside docs/html/
# ───────────────────────────
- name: Generate documentation
run: doxygen Doxyfile

# ───────────────────────────
# Turn the branch / tag name into something
# safe for file-systems (slash → underscore)
# ───────────────────────────
- name: Compute safe name
id: ref
run: echo "SAFE_NAME=${GITHUB_REF_NAME//\//_}" >> "$GITHUB_OUTPUT"

# ───────────────────────────
# Upload the HTML as a workflow artefact
# (handy for PRs – click “Artifacts”)
# ───────────────────────────
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: docs-${{ steps.ref.outputs.SAFE_NAME }}
path: docs/html
retention-days: 14 # keep for two weeks (optional)

# ───────────────────────────
# Deploy **only on pushes** (not on PR builds)
# to gh-pages/<branch-or-tag-name>/
# ───────────────────────────
- name: Deploy to GitHub Pages
if: github.event_name == 'push'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: docs/html
destination_dir: ${{ steps.ref.outputs.SAFE_NAME }}
26 changes: 26 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Ceedling Unit Tests

on:
push:
branches: ['**'] # Match all branches
pull_request:
branches: ['**'] # Match PRs from any source branch

jobs:
ceedling-test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1

- name: Install Ceedling
run: gem install ceedling

- name: Run Tests
run: ceedling test:all
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,9 @@ Thumbs.db

#Ignore object files
*.o

#Ignore build files
build/

#Ignore docs
docs/
15 changes: 15 additions & 0 deletions Doxyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# --- output location ----------------------------------------
OUTPUT_DIRECTORY = docs # <repo>/docs
HTML_OUTPUT = html # final HTML will be docs/html

# --- what to document ---------------------------------------
INPUT = src include examples
RECURSIVE = YES # descend into sub-folders
FILE_PATTERNS = *.c *.h # default is usually fine

# --- optionally skip stuff ----------------------------------
EXCLUDE = build test

# --- project meta -------------------------------------------
PROJECT_NAME = "XBee C Library"
EXTRACT_ALL = YES
38 changes: 33 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This library provides a framework for interfacing with XBee modules using an XBe

### Currently Supported XBees
- XBee LR (LoRaWAN)
- More coming soon..
- XBee 3 Cellular (LTE-M/NB-IoT)

### Library Structure
- **src**: Contains the core source files implementing XBee classes and APIs.
Expand Down Expand Up @@ -51,7 +51,7 @@ This section provides an overview of the key methods available in the XBee class
- `XBeeInit()`: Initializes the XBee module.
- `XBeeConnect()`: Connects the XBee module to a network.
- `XBeeDisconnect()`: Disconnects the XBee module from the network.
- `XBeeSendData()`: Sends data through the XBee module.
- `XBeeSendPacket()`: Sends data through the XBee module.
- `XBeeSoftReset()`: Performs a soft reset on the XBee module.
- `XBeeHardReset()`: Performs a hard reset on the XBee module.
- `XBeeProcess()`: Processes incoming and outgoing data for the XBee module.
Expand All @@ -60,6 +60,34 @@ This section provides an overview of the key methods available in the XBee class
- `XBeeApplyChanges()`: Applies changes to the configuration of the XBee module.
- `XBeeLRSetApiOptions()`: Sets API options for long-range communication.

---

## XBee 3 Cellular Specific Methods

The following methods are specific to the XBee 3 Cellular subclass and are **not inherited** from the parent `XBee` class:

- `XBeeCellularCreate()`: Allocates and initializes an `XBeeCellular` instance with user-defined hardware and callback tables.
- `XBeeCellularDestroy()`: Frees memory associated with an `XBeeCellular` instance.
- `XBeeCellularConfigure()`: Applies APN, SIM PIN, and carrier profile settings to configure cellular behavior.
- `XBeeCellularSocketCreate()`: Sends a SOCKET_CREATE frame to open a new socket.
- `XBeeCellularSocketConnect()`: Connects a socket to a given remote address using DNS or IP.
- `XBeeCellularSocketSend()`: Transmits binary data over a connected socket.
- `XBeeCellularSocketSetOption()`: Configures socket parameters such as port binding or listen mode.
- `XBeeCellularSocketClose()`: Closes a previously created socket by sending a SOCKET_CLOSE frame.
- `XBeeCellularHandleRxPacket()`: Handles frame type `0xCD` (Socket Receive) and delivers received packets via the registered receive callback.

---

## XBee LR (LoRaWAN) Specific Methods

The following methods are specific to the XBee LR (LoRaWAN) subclass and are **not inherited** from the parent `XBee` class:

- `XBeeLRGetDevEUI()`: Reads and returns the LoRaWAN device EUI from the XBee module.
- `XBeeLRSetAppEUI()`: Configures the Application EUI used for OTAA join.
- `XBeeLRSetAppKey()`: Sets the AppKey for LoRaWAN OTAA authentication.
- `XBeeLRSetNwkKey()`: Sets the Network Key used for network traffic encryption.
- `XBeeLRSendPacket()`: Sends a LoRaWAN uplink packet using the LR frame interface.

Each of these methods provides essential functionality for managing and communicating with XBee devices within a network. Ensure that you refer to these methods when developing applications that involve XBee modules.

## Usage Example: XBee LR Example
Expand Down Expand Up @@ -142,7 +170,7 @@ After creating the XBee LR instance, initialize the XBee LR module, configure th

### Sending Data

To send data over the XBee LR network, use the `XBeeLRSendData` method. Here's an example of preparing and sending a payload:
To send data over the XBee LR network, use the `XBeeLRSendPacket` method. Here's an example of preparing and sending a payload:

```c
// XBeeLR payload to send
Expand All @@ -155,7 +183,7 @@ XBeeLRPacket_t packet = {
.ack = 0,
};

if (!XBeeSendData(myXbeeLr, &packet)) {
if (!XBeeSendPacket(myXbeeLr, &packet)) {
printf("Failed to send data.");
} else {
printf("Data sent successfully.");
Expand Down Expand Up @@ -279,7 +307,7 @@ int main() {
.ack = 0,
};

if (!XBeeSendData(myXbeeLr, &packet)) {
if (!XBeeSendPacket(myXbeeLr, &packet)) {
printf("Failed to send data.");
} else {
printf("Data sent successfully.");
Expand Down
Loading
Loading