Thank you for your interest in contributing to the Hubble Device SDK.
This document outlines the contribution guidelines and processes for the Hubble Device SDK. Following these guidelines helps ensure consistency, quality, and maintainability across the codebase while facilitating collaboration among contributors.
This project and everyone participating in it is governed by our Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to support@hubble.com.
Before asking a question:
- Check the Hubble Device SDK Documentation
- Search existing Issues
- Review the codebase and examples in the
samples/directory
If you still have questions, please start a discussion in GitHub Discussions. When asking a question, please provide:
- Context about what you're trying to accomplish
- Platform and version information (target board, SDK version, RTOS version)
- Relevant code snippets or error messages
When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content, and that the content you contribute may be provided under the project license (Apache 2.0).
This project follows the Developer Certificate of Origin (DCO) process to ensure developers are following licensing criteria for their contributions. The DCO is a legally binding statement asserting that you are the creator of your contribution, or that you otherwise have the authority to distribute the contribution, and that you are intentionally making the contribution available under the Apache 2.0 license.
You agree to the DCO by including a Signed-off-by line at the end of your commit
message. If you are willing to agree to the DCO terms, add this line to every git
commit message:
Signed-off-by: Your Name <your.email@example.com>
You can sign your commit automatically with git commit -s if you have configured
your user.name and user.email in git.
The Hubble Device SDK uses the Apache 2.0 license. All contributions must be compatible with this license. Each source file must include the SPDX license identifier:
/*
* Copyright (c) 2025 Hubble Network, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/- Make sure you are using the latest supported version
- Check if there is already a bug report for your issue in the bug tracker
- Collect information about the bug:
- Stack trace or error messages
- Platform and version (Zephyr, ESP-IDF, FreeRTOS, board, SDK version)
- Steps to reproduce the issue
- Expected vs actual behavior
- Relevant code snippets or configuration
Security Issues: We take security very seriously. Please DO NOT publicly report security-related issues, vulnerabilities, or bugs. Instead, send your findings by email to security@hubble.com. We appreciate your research and will work with you to resolve the situation ASAP.
- Open a Bug Report
- Complete the Bug Report form with all relevant information
- Provide clear reproduction steps that someone else can follow
- Include a minimal test case if possible
- Tag the issue with appropriate labels (platform, component, etc.)
Enhancement suggestions include new features and improvements to existing functionality.
- Make sure you are using the latest version
- Read the documentation carefully
- Search existing Issues to see if the enhancement has already been suggested
- Consider whether your idea fits with the scope and aims of the project
- Think about whether the enhancement would be useful to the majority of users
- Open an Enhancement Request
- Use a clear and descriptive title
- Provide a step-by-step description of the suggested enhancement
- Describe the current behavior and explain the expected behavior
- Explain why this enhancement would be useful to SDK users
- Consider cross-platform compatibility (Zephyr, ESP-IDF, FreeRTOS)
Each commit message should follow this format:
- A short and descriptive subject line (max 72 characters) with a prefix that identifies the subsystem being changed, followed by a colon
- A blank line
- A body which explains the reason for the change ("why" the code is changed)
- A blank line
- A
Signed-off-by: <name> <email>line (automatic withgit commit -s)
<subsystem>: <component>: <brief description>
<Detailed explanation of why this change was made, what problem it solves,
and any relevant context. This should explain the "why" not just the "what".>
Signed-off-by: Your Name <your.email@example.com>
Common subsystem prefixes used in this project:
port:- Platform-specific port implementations (zephyr, esp-idf, freertos)src:- Core SDK source codeinclude:- Public API headersdocs:- Documentation changessamples:- Sample applicationstests:- Test codeci:- Continuous integration changestools:- Development tools
port: sys: Add timer API
Add support for periodic timer in the sys interface. This enables
applications to schedule periodic callbacks without requiring
platform-specific timer APIs, improving portability across ESP-IDF,
Zephyr, and FreeRTOS platforms.
Signed-off-by: Flavio Ceolin <flavio@hubble.com>
src: ble: Fix sequence counter overflow handling
The sequence counter was not properly wrapping when reaching the
maximum value, causing encryption failures. This fix ensures proper
modulo arithmetic to maintain the 10-bit counter range.
Fixes #123
Signed-off-by: John Contributor <john@example.com>
- Subject line should not exceed 72 characters
- Subject line should not end with a period
- Use imperative mood ("Add feature" not "Added feature")
- Body lines should wrap at 100 characters
- Do not include words like "WIP", "test", or "temp" in the subject
- If the change addresses an issue, include
Fixes #<issue_number>in the body
This project uses clang-format for C code formatting. The formatting rules are
defined in .clang-format. All code must be formatted according
to these rules before submission.
To check formatting:
clang-format --dry-run --Werror <file>To format code:
clang-format -i <file>Or format all changed files:
git clang-formatPython code (tooling, samples, and docs extensions) is linted and formatted with
ruff. The rules are defined in
.ruff.toml. All Python code must pass both ruff check and
ruff format before submission.
To check linting and formatting:
ruff check
ruff format --diffTo fix lint issues and format code:
ruff check --fix
ruff format- Use
lower_snake_casefor functions, variables, and file names - Use
UPPER_SNAKE_CASEfor constants, enum values, and macros - Use descriptive names; avoid cryptic abbreviations
- Prefix static functions with
_to distinguish from public APIs - Append units to variable names when relevant (e.g.,
timeout_ms,size_bytes)
- Indentation: Use tabs for indentation (as configured in
.clang-format) - Line Length: Maximum 100 characters
- Functions: Should generally be less than 80 lines
- Comments: Use
/* */style for block comments, explain "why" not "what" - Pointers: Pointers should hug the variable:
char *ptrnotchar* ptr - Braces: Use consistent brace style (as configured in
.clang-format)
Use this placement guide when adding functionality.
| If you are adding... | Put it in... |
|---|---|
| An application-facing declaration | include/hubble |
| Protocol, state, encoding, or algorithm logic | src |
| A private declaration shared by several common files | src/hubble_priv.h (only when more than one common file needs it) |
| A new platform service the common code depends on | a contract in include/hubble/port, implemented by each port |
| An RTOS service implementation | port/<rtos> |
| Board or SOC-specific radio details | port/<rtos>/boards |
| A sample application | samples/<rtos> |
| A test | tests, near the platform or behavior being verified |
The single rule behind every row is the same: keep dependencies flowing downward. Public APIs call common code, common code calls port contracts, and port contracts call RTOS and hardware implementations.
When adding platform-specific code:
- Place implementations in the appropriate
port/subdirectory:port/zephyr/for Zephyr RTOSport/esp-idf/for ESP-IDFport/freertos/for FreeRTOS
- Ensure all platforms implement the same API interface
- Test changes on at least one platform before submitting
- Document any platform-specific limitations or requirements
- Use
#ifndefguards - Include system headers with
<>and local headers with"" - Include headers in this order:
- System headers (
<stdio.h>,<stdint.h>, etc.) - Platform headers (
<zephyr/kernel.h>, etc.) - SDK headers (
<hubble/port/sys.h>, etc.) - Local headers (
"port_types.h", etc.)
- System headers (
- Check pointers for NULL before dereferencing
- Return appropriate error codes (negative errno values)
- Use consistent error handling patterns across the codebase
- Document error conditions in function documentation
- Use Doxygen-style comments for public APIs
- Document function parameters, return values, and error conditions
- Include usage examples for complex APIs
- Keep documentation up-to-date with code changes
- Add tests for new functionality when possible
- Ensure existing tests pass before submitting
- Test on multiple platforms when applicable
- Include test cases in
tests/directory - Update sample code if API changes affect usage
- Fork the repository and create a branch from
main - Make your changes following the code style guidelines
- Test your changes on at least one platform
- Format your code using
clang-format(C) andruff(Python) - Write clear commit messages following the commit guide
- Sign your commits with
git commit -s - Push to your fork and open a Pull Request
- Ensure CI passes - all checks must pass before merging
- Respond to feedback from reviewers promptly
- Code follows the style guidelines
- C code is formatted with
clang-format - Python code passes
ruff checkandruff format - Commit messages follow the commit guide
- All commits are signed-off (
Signed-off-by) - Tests pass (if applicable)
- Documentation is updated (if applicable)
- Changes are tested on at least one platform
- PR description explains the change and why it's needed
The project uses GitHub Actions for continuous integration. All pull requests must pass CI checks before merging. CI checks include:
- Code formatting (
clang-format) - Python linting and formatting (
ruff) - Commit message linting (
gitlint) - Build verification on multiple platforms
- Documentation builds
- Static analysis (where applicable)
- Documentation source is in the
docs/directory - Use reStructuredText (
.rst) format for Sphinx documentation - Keep API documentation synchronized with code changes
- Include code examples in documentation when helpful
- Update
README.mdif project structure or setup changes
If you have questions about contributing, please:
- Check existing GitHub Discussions
- Review the documentation
- Start a new discussion in GitHub Discussions
Thank you for contributing to the Hubble Device SDK! 🚀