Skip to content

wifi.radio: provide "connected" and "access point is up" boolean properties #7377

Closed
@dhalbert

Description

@dhalbert

I have seen many people asking how to find out whether a wifi.Radio connection is up or not. The method usually described is to try to fetch the current IP address. If that fails, the connection is not up.

I think more straightforward boolean properties would be helpful in the API, even if they are bit redundant.

Station mode

Existing API

  • wifi.Radio.connect(): connects to a specified network as a Station.
  • wifi.Radio.start_station(): start running as a Station.
  • wifi.Radio.stop_station(): stop running as a Station.

Additional proposed API

  • wifi.Radio.connected: bool: True if up and running as a Station. Read-only
    OR
    - wifi.Radio.station_active: bool
    OR
  • wifi.Radio.station_up: bool

Access Point mode

Existing API

  • wifi.Radio.start_ap()
  • wifi.Radio.stop_ap()

Additional proposed API

  • wifi.radio.ap_active: bool
    OR
  • wifi.radio.ap_up: bool

Any comments on the idea and the names? In the current documentation, Station and Access Point are capitalized, not sure why.

This is quite simple to implement.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions