Merge pull request #7265 from jepler/wifi-monitor-docs

Fix documentation of wifi.Monitor
This commit is contained in:
Scott Shawcroft 2022-11-28 16:23:40 -08:00 committed by GitHub
commit 81afe05811
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 26 deletions

View File

@ -36,15 +36,14 @@
//| """For monitoring WiFi packets.""" //| """For monitoring WiFi packets."""
//| //|
//| def __init__(self, channel: Optional[int] = 1, queue: Optional[int] = 128) -> None: //| def __init__(self, channel: Optional[int] = 1, queue: Optional[int] = 128) -> None:
//| """Initialize `wifi.Monitor` singleton. //| """Initialize `wifi.Monitor` singleton.
//| //|
//| :param int channel: The WiFi channel to scan. //| :param int channel: The WiFi channel to scan.
//| :param int queue: The queue size for buffering the packet. //| :param int queue: The queue size for buffering the packet.
//|
//| """
//| ...
//| //|
//| """
//| ...
STATIC mp_obj_t wifi_monitor_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { STATIC mp_obj_t wifi_monitor_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
enum { ARG_channel, ARG_queue }; enum { ARG_channel, ARG_queue };
static const mp_arg_t allowed_args[] = { static const mp_arg_t allowed_args[] = {
@ -69,8 +68,8 @@ STATIC mp_obj_t wifi_monitor_make_new(const mp_obj_type_t *type, size_t n_args,
return MP_OBJ_FROM_PTR(self); return MP_OBJ_FROM_PTR(self);
} }
//| channel: int //| channel: int
//| """The WiFi channel to scan.""" //| """The WiFi channel to scan."""
STATIC mp_obj_t wifi_monitor_obj_get_channel(mp_obj_t self_in) { STATIC mp_obj_t wifi_monitor_obj_get_channel(mp_obj_t self_in) {
return common_hal_wifi_monitor_get_channel(self_in); return common_hal_wifi_monitor_get_channel(self_in);
} }
@ -90,8 +89,8 @@ MP_PROPERTY_GETSET(wifi_monitor_channel_obj,
(mp_obj_t)&wifi_monitor_get_channel_obj, (mp_obj_t)&wifi_monitor_get_channel_obj,
(mp_obj_t)&wifi_monitor_set_channel_obj); (mp_obj_t)&wifi_monitor_set_channel_obj);
//| queue: int //| queue: int
//| """The queue size for buffering the packet.""" //| """The queue size for buffering the packet."""
STATIC mp_obj_t wifi_monitor_obj_get_queue(mp_obj_t self_in) { STATIC mp_obj_t wifi_monitor_obj_get_queue(mp_obj_t self_in) {
return common_hal_wifi_monitor_get_queue(self_in); return common_hal_wifi_monitor_get_queue(self_in);
} }
@ -100,29 +99,26 @@ MP_DEFINE_CONST_FUN_OBJ_1(wifi_monitor_get_queue_obj, wifi_monitor_obj_get_queue
MP_PROPERTY_GETTER(wifi_monitor_queue_obj, MP_PROPERTY_GETTER(wifi_monitor_queue_obj,
(mp_obj_t)&wifi_monitor_get_queue_obj); (mp_obj_t)&wifi_monitor_get_queue_obj);
//| def deinit(self) -> None: //| def deinit(self) -> None:
//| """De-initialize `wifi.Monitor` singleton.""" //| """De-initialize `wifi.Monitor` singleton."""
//| ... //| ...
//|
STATIC mp_obj_t wifi_monitor_obj_deinit(mp_obj_t self_in) { STATIC mp_obj_t wifi_monitor_obj_deinit(mp_obj_t self_in) {
common_hal_wifi_monitor_deinit(self_in); common_hal_wifi_monitor_deinit(self_in);
return mp_const_none; return mp_const_none;
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_1(wifi_monitor_deinit_obj, wifi_monitor_obj_deinit); STATIC MP_DEFINE_CONST_FUN_OBJ_1(wifi_monitor_deinit_obj, wifi_monitor_obj_deinit);
//| def lost(self) -> int: //| def lost(self) -> int:
//| """Returns the packet loss count. The counter resets after each poll.""" //| """Returns the packet loss count. The counter resets after each poll."""
//| ... //| ...
//|
STATIC mp_obj_t wifi_monitor_obj_get_lost(mp_obj_t self_in) { STATIC mp_obj_t wifi_monitor_obj_get_lost(mp_obj_t self_in) {
return common_hal_wifi_monitor_get_lost(self_in); return common_hal_wifi_monitor_get_lost(self_in);
} }
MP_DEFINE_CONST_FUN_OBJ_1(wifi_monitor_lost_obj, wifi_monitor_obj_get_lost); MP_DEFINE_CONST_FUN_OBJ_1(wifi_monitor_lost_obj, wifi_monitor_obj_get_lost);
//| def queued(self) -> int: //| def queued(self) -> int:
//| """Returns the packet queued count.""" //| """Returns the packet queued count."""
//| ... //| ...
//|
STATIC mp_obj_t wifi_monitor_obj_get_queued(mp_obj_t self_in) { STATIC mp_obj_t wifi_monitor_obj_get_queued(mp_obj_t self_in) {
if (common_hal_wifi_monitor_deinited()) { if (common_hal_wifi_monitor_deinited()) {
return mp_obj_new_int_from_uint(0); return mp_obj_new_int_from_uint(0);
@ -131,9 +127,9 @@ STATIC mp_obj_t wifi_monitor_obj_get_queued(mp_obj_t self_in) {
} }
MP_DEFINE_CONST_FUN_OBJ_1(wifi_monitor_queued_obj, wifi_monitor_obj_get_queued); MP_DEFINE_CONST_FUN_OBJ_1(wifi_monitor_queued_obj, wifi_monitor_obj_get_queued);
//| def packet(self) -> dict: //| def packet(self) -> dict:
//| """Returns the monitor packet.""" //| """Returns the monitor packet."""
//| ... //| ...
//| //|
STATIC mp_obj_t wifi_monitor_obj_get_packet(mp_obj_t self_in) { STATIC mp_obj_t wifi_monitor_obj_get_packet(mp_obj_t self_in) {
if (common_hal_wifi_monitor_deinited()) { if (common_hal_wifi_monitor_deinited()) {