Skip to content

feat: add wireless state get and request API#885

Open
shaoboon wants to merge 1 commit intomainfrom
sb_wifistate_api
Open

feat: add wireless state get and request API#885
shaoboon wants to merge 1 commit intomainfrom
sb_wifistate_api

Conversation

@shaoboon
Copy link
Copy Markdown
Contributor

@shaoboon shaoboon commented Apr 15, 2026

Changes

  • added networkSettings/wireless/state API route
    • GET wireless state
    • POST request for state change
  • added devices GetWirelessState and RequestWirelessStateChange methods
  • added CIM_WiFiPort Enumerate and Pull devices wsman interface to get the EnabledState
  • modified devices wsman WiFiRequestStateChange to take in requestedState argument and request for the requestedState
  • added unit tests to cover 100% of the code changes

CIM_WiFiPort class ref: link

NOTE:

This PR is to fulfill the API part of issue #836 , the UI part will be designed together with other network settings configuration issues.

Testing

# Read current state
{"state":3}
HTTP_STATUS:200
# Get amtinfo
---Wireless Adapter---
Link Status             : down
AMT IP Address          : 0.0.0.0
# Request for 32769 (WiFi is enabled in S0 + Sx/AC) state
{"state":32769}
HTTP_STATUS:200

# Read current state
{"state":32769}
HTTP_STATUS:200
# Get amtinfo
---Wireless Adapter---
Link Status             : up
AMT IP Address          : <IP available>
# Request for 3 (WiFi is disabled) state
{"state":3}
HTTP_STATUS:200

# Read current state
{"state":3}
HTTP_STATUS:200
# Get amtinfo
---Wireless Adapter---
Link Status             : down
AMT IP Address          : 0.0.0.0
# Request for 32768 (WiFi is enabled in S0) state
{"state":32768}
HTTP_STATUS:200

# Read current state
{"state":32768}
HTTP_STATUS:200
# Get amtinfo
---Wireless Adapter---
Link Status             : up
AMT IP Address          : <IP available>
# Request for 32769 (WiFi is enabled in S0 + Sx/AC) state
{"state":32769}
HTTP_STATUS:200

# Read current state
{"state":32769}
HTTP_STATUS:200
# Get amtinfo
---Wireless Adapter---
Link Status             : up
AMT IP Address          : <IP available>

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 15, 2026

Codecov Report

❌ Patch coverage is 45.57823% with 80 lines in your changes missing coverage. Please review.
✅ Project coverage is 40.79%. Comparing base (92f6575) to head (08b3660).

Files with missing lines Patch % Lines
internal/mocks/devicemanagement_mocks.go 0.00% 27 Missing ⚠️
internal/mocks/wsv1_mocks.go 0.00% 27 Missing ⚠️
internal/mocks/wsman_mocks.go 0.00% 26 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #885      +/-   ##
==========================================
+ Coverage   40.66%   40.79%   +0.13%     
==========================================
  Files         115      117       +2     
  Lines       10885    11014     +129     
==========================================
+ Hits         4426     4493      +67     
- Misses       6065     6127      +62     
  Partials      394      394              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@shaoboon shaoboon force-pushed the sb_wifistate_api branch 2 times, most recently from 8c906c7 to 4a875b1 Compare April 16, 2026 10:27
@shaoboon shaoboon changed the title feat: Add Wireless state get and request API feat: add wireless state get and request API Apr 16, 2026
@shaoboon shaoboon requested a review from Copilot April 16, 2026 10:58
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 “wireless state” feature that exposes Intel AMT WiFi enabled/disabled state via HTTP and wires it through the devices usecase to WSMAN CIM_WiFiPort (Enumerate/Pull + RequestStateChange).

Changes:

  • Added HTTP API route networkSettings/wireless/state with GET (read state) and POST (request state change).
  • Added devices usecase methods to read/request wireless state via WSMAN CIM_WiFiPort Enumerate/Pull and RequestStateChange.
  • Added DTOs and regenerated mocks + unit tests for the new behavior.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
internal/usecase/devices/wsman/message.go Adds WiFiPort Enumerate/Pull helpers and makes WiFiRequestStateChange accept a requestedState argument.
internal/usecase/devices/wsman/interfaces.go Extends WSMAN Management interface with WiFiPort Enumerate/Pull and WiFiRequestStateChange(requestedState).
internal/usecase/devices/wifistate.go New usecase logic for requesting wireless state changes and reading current wireless state.
internal/usecase/devices/wifistate_test.go New unit tests covering the new usecase methods and error paths.
internal/usecase/devices/interfaces.go Extends devices Feature interface with RequestWirelessStateChange and GetWirelessState.
internal/entity/dto/v1/wifistate.go New DTOs/constants for wireless requested states and responses.
internal/controller/httpapi/v1/wifistate.go New HTTP handlers for GET/POST wireless state.
internal/controller/httpapi/v1/wifistate_test.go New HTTP handler tests for wireless state endpoints.
internal/controller/httpapi/v1/devicemanagement.go Registers the new wireless state routes under /amt/networkSettings/wireless/state/:guid.
internal/controller/ws/v1/interface.go Extends WS feature interface to include wireless state methods.
internal/mocks/wsman_mocks.go Regenerated mocks to include new WSMAN interface methods.
internal/mocks/wsv1_mocks.go Regenerated mocks to include new WS feature methods.
internal/mocks/devicemanagement_mocks.go Regenerated mocks to include new devices Feature methods.

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

Comment thread internal/controller/httpapi/v1/wifistate.go
Comment thread internal/usecase/devices/wifistate.go Outdated
Comment thread internal/entity/dto/v1/wifistate.go Outdated
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

Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.


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

Comment thread internal/usecase/devices/wifistate.go Outdated
Comment thread internal/usecase/devices/wifistate_test.go Outdated
Comment thread internal/usecase/devices/wifistate.go
Comment thread internal/controller/httpapi/v1/wifistate.go Outdated
Comment thread internal/mocks/wsman_mocks.go
@shaoboon shaoboon marked this pull request as ready for review April 17, 2026 10:16
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