Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: JPHutchins/smp
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3.1.2
Choose a base ref
...
head repository: JPHutchins/smp
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
  • 18 commits
  • 14 files changed
  • 5 contributors

Commits on Sep 28, 2024

  1. github: workflows: release: fix: contents write permission

    JPHutchins committed Sep 28, 2024
    Copy the full SHA
    11846bb View commit details

Commits on Oct 9, 2024

  1. feat: python 3.12-rc2 -> 3.13

    JPHutchins committed Oct 9, 2024
    Copy the full SHA
    54900ef View commit details
  2. poetry: update

    JPHutchins committed Oct 9, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    ebe522a View commit details
  3. Merge pull request #38 from JPHutchins/feature/add-python-3.13

    feat: python 3.12-rc2 -> 3.13
    JPHutchins authored Oct 9, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    43ee844 View commit details

Commits on Nov 9, 2024

  1. feat: Enumeration Management Group

    sgfeniex committed Nov 9, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    d830603 View commit details

Commits on Nov 13, 2024

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    ffea1a5 View commit details

Commits on Nov 18, 2024

  1. Merge pull request #1 from JPHutchins/group-id-field

    typing: add a GroupIdField type
    sgfeniex authored Nov 18, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    0f6b361 View commit details

Commits on Nov 25, 2024

  1. fix: support older python type annotations

    sgfeniex committed Nov 25, 2024
    Copy the full SHA
    fcca5aa View commit details

Commits on Nov 26, 2024

  1. Merge pull request #40 from sgfeniex/feature/add-enum-management-group

    feat: Enumeration Management Group
    JPHutchins authored Nov 26, 2024
    Copy the full SHA
    0645aab View commit details

Commits on Nov 27, 2024

  1. feat: allow empty GroupDetails request; docstrings

    JPHutchins committed Nov 27, 2024
    Copy the full SHA
    6e287dc View commit details
  2. Merge pull request #41 from JPHutchins/docs/enum-group

    feat: allow empty GroupDetails request; docstrings
    JPHutchins authored Nov 27, 2024
    Copy the full SHA
    b32db57 View commit details

Commits on Feb 11, 2025

  1. move GroupIdField to header.py

    Signed-off-by: Sam Friedman <[email protected]>
    sam-golioth committed Feb 11, 2025
    Copy the full SHA
    533eb5b View commit details
  2. Use GroupIdField in place of AnyGroupId

    Signed-off-by: Sam Friedman <[email protected]>
    sam-golioth committed Feb 11, 2025
    Copy the full SHA
    320a46d View commit details
  3. error: allow user and external group ids

    The V2 Error group field only accepted header.GroupId, which would lead to validation errors when smpclient received v2 error responses from SMP groups beyond the standard set. This change allows creating ErrorV2 instances for both User Groups defined in the tree (i.e. Intercreate) as well as for User Groups defined outside of the tree.
    sam-golioth committed Feb 11, 2025
    Copy the full SHA
    aa0a77c View commit details
  4. Merge pull request #42 from sam-golioth/patch-1

    error: allow user and external group ids
    JPHutchins authored Feb 11, 2025
    Copy the full SHA
    e50868b View commit details

Commits on Feb 12, 2025

  1. Copy the full SHA
    fb0abe4 View commit details
  2. github: workflows: release: update gh-action-sigstore-python to 3.0.0

    JPHutchins committed Feb 12, 2025
    Copy the full SHA
    acec85f View commit details
  3. Merge pull request #43 from JPHutchins/fix/lock-poetry-1.8.5-and-upda…

    …te-workflows
    
    Fix/lock poetry 1.8.5 and update workflows
    JPHutchins authored Feb 12, 2025
    Copy the full SHA
    085c8b1 View commit details
5 changes: 3 additions & 2 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -9,14 +9,15 @@ jobs:
lint:
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13.0-rc.2"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
run: pipx install poetry==1.8.5

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
19 changes: 6 additions & 13 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ jobs:

- run: git fetch --prune --unshallow --tags

- run: pipx install poetry
- run: pipx install poetry==1.8.5

- name: Set up Python
uses: actions/setup-python@v5
@@ -77,34 +77,27 @@ jobs:
name: python-package-distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/gh-action-sigstore-python@v2.1.1
uses: sigstore/gh-action-sigstore-python@v3.0.0
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'
publish-docs:
name: Publish documentation 📚 to GitHub Pages
needs:
- github-release
runs-on: ubuntu-latest

permissions:
contents: write # IMPORTANT: mandatory for deploying to GitHub Pages

steps:
- uses: actions/checkout@v4

- run: git fetch --prune --unshallow --tags

- run: pipx install poetry
- run: pipx install poetry==1.8.5

- name: Set up Python
uses: actions/setup-python@v5
2 changes: 1 addition & 1 deletion .github/workflows/test-docs.yaml
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v4

- name: Install poetry
run: pipx install poetry
run: pipx install poetry==1.8.5

- uses: actions/setup-python@v5
with:
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -9,14 +9,14 @@ jobs:
tests:
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13.0-rc.2"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- run: pipx install poetry
- run: pipx install poetry==1.8.5

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ An online version is generated and available [here](https://jphutchins.github.io

### Install Dependencies

- poetry: https://python-poetry.org/docs/#installation
- poetry==1.8.5: https://python-poetry.org/docs/#installation

### Create the venv

3 changes: 3 additions & 0 deletions docs/enumeration_management.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Enumeration Management

::: smp.enumeration_management
1 change: 1 addition & 0 deletions mkdocs.yaml
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@ nav:
- Settings Management: settings_management.md
- Shell Management: shell_management.md
- Statistics Management: statistics_management.md
- Enumeration Management: enumeration_management.md
- Zephyr Management: zephyr_management.md
- User Groups:
- Intercreate: user/intercreate.md
45 changes: 23 additions & 22 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -64,6 +64,7 @@ legacy_tox_ini = """
py310
py311
py312
py313
[testenv]
allowlist_externals =
159 changes: 159 additions & 0 deletions smp/enumeration_management.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
"""The Simple Management Protocol (SMP) Enumeration Management group."""

from __future__ import annotations

from enum import IntEnum, unique
from typing import Tuple

from pydantic import BaseModel, ConfigDict

import smp.error as smperr
import smp.header as smphdr
import smp.message as smpmsg


class GroupCountRequest(smpmsg.ReadRequest):
"""Read the number of SMP server groups.
Count of supported groups returns the total number of SMP command groups
that a device supports.
"""

_GROUP_ID = smphdr.GroupId.ENUM_MANAGEMENT
_COMMAND_ID = smphdr.CommandId.EnumManagement.GROUP_COUNT


class GroupCountResponse(smpmsg.ReadResponse):
"""SMP group count response."""

_GROUP_ID = smphdr.GroupId.ENUM_MANAGEMENT
_COMMAND_ID = smphdr.CommandId.EnumManagement.GROUP_COUNT

count: int
"""Contains the total number of supported SMP groups on the device."""


class ListOfGroupsRequest(smpmsg.ReadRequest):
"""List the available SMP groups."""

_GROUP_ID = smphdr.GroupId.ENUM_MANAGEMENT
_COMMAND_ID = smphdr.CommandId.EnumManagement.LIST_OF_GROUPS


class ListOfGroupsResponse(smpmsg.ReadResponse):
"""SMP group list response."""

_GROUP_ID = smphdr.GroupId.ENUM_MANAGEMENT
_COMMAND_ID = smphdr.CommandId.EnumManagement.LIST_OF_GROUPS

groups: Tuple[smphdr.GroupIdField, ...]
"""Contains a list of the supported SMP group IDs on the device."""


class GroupIdRequest(smpmsg.ReadRequest):
"""List a SMP group by index.
Fetch single group ID command allows listing the group IDs of supported SMP
groups on the device, one by one.
"""

_GROUP_ID = smphdr.GroupId.ENUM_MANAGEMENT
_COMMAND_ID = smphdr.CommandId.EnumManagement.GROUP_ID

index: int | None = None
"""Contains the (0-based) index of the group to return information on, can
be omitted to return the first group's details.
"""


class GroupIdResponse(smpmsg.ReadResponse):
"""SMP group at index response."""

_GROUP_ID = smphdr.GroupId.ENUM_MANAGEMENT
_COMMAND_ID = smphdr.CommandId.EnumManagement.GROUP_ID

group: smphdr.GroupIdField
"""The Group ID at the requested index."""
end: bool | None = None
"""Will be set to true if the listed group is the final supported group on
the device, otherwise will be omitted.
"""


class GroupDetailsRequest(smpmsg.ReadRequest):
"""Request the details of the supported SMP groups.
Details on supported groups command allows fetching details on each
supported SMP group, such as the name and number of handlers. A device can
specify an allow list of groups to return details on or details on all
groups can be returned.
This command is optional, it can be enabled using
`CONFIG_MCUMGR_GRP_ENUM_DETAILS`. The optional name and number of handlers
can be enabled/disabled with `CONFIG_MCUMGR_GRP_ENUM_DETAILS_NAME` and
`CONFIG_MCUMGR_GRP_ENUM_DETAILS_HANDLERS`.
"""

_GROUP_ID = smphdr.GroupId.ENUM_MANAGEMENT
_COMMAND_ID = smphdr.CommandId.EnumManagement.GROUP_DETAILS

groups: Tuple[smphdr.GroupIdField, ...] | None = None
"""Contains a list of the SMP group IDs to fetch details on.
If omitted, details on all supported groups will be returned.
"""


class GroupDetails(BaseModel):
"""Group Details"""

model_config = ConfigDict(extra="forbid", frozen=True)

id: smphdr.GroupIdField
"""The group ID of the SMP command group."""
name: str | None = None
"""The name of the SMP command group."""
handlers: int | None = None
"""The number of handlers that the SMP command group supports."""


class GroupDetailsResponse(smpmsg.ReadResponse):
"""SMP group details response."""

_GROUP_ID = smphdr.GroupId.ENUM_MANAGEMENT
_COMMAND_ID = smphdr.CommandId.EnumManagement.GROUP_DETAILS

groups: Tuple[GroupDetails, ...]
"""Contains a list of the requested SMP group details."""


@unique
class ENUM_MGMT_ERR(IntEnum):
"""Return codes for the enumeration management group."""

OK = 0
"""No error, this is implied if there is no ret value in the response."""

UNKNOWN = 1
"""Unknown error occurred."""

ERR_TOO_MANY_GROUP_ENTRIES = 2
"""Too many entries were provided."""

ERR_INSUFFICIENT_HEAP_FOR_ENTRIES = 3
"""Insufficient heap memory to store entry data."""

ENUM_MGMT_ERR_INDEX_TOO_LARGE = 4
"""Provided index is larger than the number of supported groups."""


class EnumManagementErrorV1(smperr.ErrorV1):
"""Error response to a enumeration management command."""

_GROUP_ID = smphdr.GroupId.ENUM_MANAGEMENT


class EnumManagementErrorV2(smperr.ErrorV2[ENUM_MGMT_ERR]):
"""Error response to a enumeration management command."""

_GROUP_ID = smphdr.GroupId.ENUM_MANAGEMENT
Loading