mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-29 17:22:56 +08:00
add wifi.state enum
This commit is contained in:
parent
012022dea4
commit
835574e687
@ -383,6 +383,16 @@ typedef enum {
|
|||||||
PIKA_HAL_WIFI_MODE_AP,
|
PIKA_HAL_WIFI_MODE_AP,
|
||||||
} PIKA_HAL_WIFI_MODE;
|
} PIKA_HAL_WIFI_MODE;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
_PIKA_HAL_WIFI_STATUS_UNUSED = 0,
|
||||||
|
PIKA_HAL_WIFI_STATUS_IDLE,
|
||||||
|
PIKA_HAL_WIFI_STATUS_CONNECTING,
|
||||||
|
PIKA_HAL_WIFI_STATUS_WRONG_PASSWORD,
|
||||||
|
PIKA_HAL_WIFI_STATUS_NO_AP_FOUND,
|
||||||
|
PIKA_HAL_WIFI_STATUS_CONNECT_FAIL,
|
||||||
|
PIKA_HAL_WIFI_STATUS_GOT_IP,
|
||||||
|
} PIKA_HAL_WIFI_STATUS;
|
||||||
|
|
||||||
#define PIKA_HAL_WIFI_PARAM_MAX_LEN 32
|
#define PIKA_HAL_WIFI_PARAM_MAX_LEN 32
|
||||||
typedef struct pika_hal_WIFI_config {
|
typedef struct pika_hal_WIFI_config {
|
||||||
PIKA_HAL_WIFI_MODE mode;
|
PIKA_HAL_WIFI_MODE mode;
|
||||||
|
25
package/network/_network.c
Normal file
25
package/network/_network.c
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#include "_network.h"
|
||||||
|
#include "../pikascript-lib/PikaStdDevice/pika_hal.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
STA_IF: int
|
||||||
|
AP_IF: int
|
||||||
|
STAT_IDLE: int
|
||||||
|
STAT_CONNECTING: int
|
||||||
|
STAT_WRONG_PASSWORD: int
|
||||||
|
STAT_NO_AP_FOUND: int
|
||||||
|
STAT_CONNECT_FAIL: int
|
||||||
|
STAT_GOT_IP: int
|
||||||
|
*/
|
||||||
|
|
||||||
|
void _network___init__(PikaObj* self) {
|
||||||
|
obj_setInt(self, "STA_IF", PIKA_HAL_WIFI_MODE_STA);
|
||||||
|
obj_setInt(self, "AP_IF", PIKA_HAL_WIFI_MODE_AP);
|
||||||
|
obj_setInt(self, "STAT_IDLE", PIKA_HAL_WIFI_STATUS_IDLE);
|
||||||
|
obj_setInt(self, "STAT_CONNECTING", PIKA_HAL_WIFI_STATUS_CONNECTING);
|
||||||
|
obj_setInt(self, "STAT_WRONG_PASSWORD",
|
||||||
|
PIKA_HAL_WIFI_STATUS_WRONG_PASSWORD);
|
||||||
|
obj_setInt(self, "STAT_NO_AP_FOUND", PIKA_HAL_WIFI_STATUS_NO_AP_FOUND);
|
||||||
|
obj_setInt(self, "STAT_CONNECT_FAIL", PIKA_HAL_WIFI_STATUS_CONNECT_FAIL);
|
||||||
|
obj_setInt(self, "STAT_GOT_IP", PIKA_HAL_WIFI_STATUS_GOT_IP);
|
||||||
|
};
|
@ -1,3 +1,12 @@
|
|||||||
|
STA_IF: int
|
||||||
|
AP_IF: int
|
||||||
|
STAT_IDLE: int
|
||||||
|
STAT_CONNECTING: int
|
||||||
|
STAT_WRONG_PASSWORD: int
|
||||||
|
STAT_NO_AP_FOUND: int
|
||||||
|
STAT_CONNECT_FAIL: int
|
||||||
|
STAT_GOT_IP: int
|
||||||
|
|
||||||
|
|
||||||
class WLAN:
|
class WLAN:
|
||||||
def __init__(self, interface_id: int): ...
|
def __init__(self, interface_id: int): ...
|
||||||
@ -25,3 +34,6 @@ class WLAN:
|
|||||||
def ifconfig(self, config: tuple): ...
|
def ifconfig(self, config: tuple): ...
|
||||||
|
|
||||||
def checkIfconfig(self) -> tuple: ...
|
def checkIfconfig(self) -> tuple: ...
|
||||||
|
|
||||||
|
|
||||||
|
def __init__(): ...
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import _network
|
import _network
|
||||||
|
|
||||||
STA_IF = 0
|
STA_IF = _network.STA_IF
|
||||||
AP_IF = 1
|
AP_IF = _network.AP_IF
|
||||||
|
|
||||||
STAT_IDLE = 0
|
STAT_IDLE = _network.STAT_IDLE
|
||||||
STAT_CONNECTING = 1
|
STAT_CONNECTING = _network.STAT_CONNECTING
|
||||||
STAT_WRONG_PASSWORD = 2
|
STAT_WRONG_PASSWORD = _network.STAT_WRONG_PASSWORD
|
||||||
STAT_NO_AP_FOUND = 3
|
STAT_NO_AP_FOUND = _network.STAT_NO_AP_FOUND
|
||||||
STAT_CONNECT_FAIL = 4
|
STAT_CONNECT_FAIL = _network.STAT_CONNECT_FAIL
|
||||||
STAT_GOT_IP = 5
|
STAT_GOT_IP = _network.STAT_GOT_IP
|
||||||
|
|
||||||
class WLAN(_network.WLAN):
|
class WLAN(_network.WLAN):
|
||||||
def __init__(self, interface_id:int):
|
def __init__(self, interface_id:int):
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
STA_IF: int
|
||||||
|
AP_IF: int
|
||||||
|
STAT_IDLE: int
|
||||||
|
STAT_CONNECTING: int
|
||||||
|
STAT_WRONG_PASSWORD: int
|
||||||
|
STAT_NO_AP_FOUND: int
|
||||||
|
STAT_CONNECT_FAIL: int
|
||||||
|
STAT_GOT_IP: int
|
||||||
|
|
||||||
|
|
||||||
class WLAN:
|
class WLAN:
|
||||||
def __init__(self, interface_id: int): ...
|
def __init__(self, interface_id: int): ...
|
||||||
@ -25,3 +34,6 @@ class WLAN:
|
|||||||
def ifconfig(self, config: tuple): ...
|
def ifconfig(self, config: tuple): ...
|
||||||
|
|
||||||
def checkIfconfig(self) -> tuple: ...
|
def checkIfconfig(self) -> tuple: ...
|
||||||
|
|
||||||
|
|
||||||
|
def __init__(): ...
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import _network
|
import _network
|
||||||
|
|
||||||
STA_IF = 0
|
STA_IF = _network.STA_IF
|
||||||
AP_IF = 1
|
AP_IF = _network.AP_IF
|
||||||
|
|
||||||
STAT_IDLE = 0
|
STAT_IDLE = _network.STAT_IDLE
|
||||||
STAT_CONNECTING = 1
|
STAT_CONNECTING = _network.STAT_CONNECTING
|
||||||
STAT_WRONG_PASSWORD = 2
|
STAT_WRONG_PASSWORD = _network.STAT_WRONG_PASSWORD
|
||||||
STAT_NO_AP_FOUND = 3
|
STAT_NO_AP_FOUND = _network.STAT_NO_AP_FOUND
|
||||||
STAT_CONNECT_FAIL = 4
|
STAT_CONNECT_FAIL = _network.STAT_CONNECT_FAIL
|
||||||
STAT_GOT_IP = 5
|
STAT_GOT_IP = _network.STAT_GOT_IP
|
||||||
|
|
||||||
class WLAN(_network.WLAN):
|
class WLAN(_network.WLAN):
|
||||||
def __init__(self, interface_id:int):
|
def __init__(self, interface_id:int):
|
||||||
|
@ -383,6 +383,16 @@ typedef enum {
|
|||||||
PIKA_HAL_WIFI_MODE_AP,
|
PIKA_HAL_WIFI_MODE_AP,
|
||||||
} PIKA_HAL_WIFI_MODE;
|
} PIKA_HAL_WIFI_MODE;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
_PIKA_HAL_WIFI_STATUS_UNUSED = 0,
|
||||||
|
PIKA_HAL_WIFI_STATUS_IDLE,
|
||||||
|
PIKA_HAL_WIFI_STATUS_CONNECTING,
|
||||||
|
PIKA_HAL_WIFI_STATUS_WRONG_PASSWORD,
|
||||||
|
PIKA_HAL_WIFI_STATUS_NO_AP_FOUND,
|
||||||
|
PIKA_HAL_WIFI_STATUS_CONNECT_FAIL,
|
||||||
|
PIKA_HAL_WIFI_STATUS_GOT_IP,
|
||||||
|
} PIKA_HAL_WIFI_STATUS;
|
||||||
|
|
||||||
#define PIKA_HAL_WIFI_PARAM_MAX_LEN 32
|
#define PIKA_HAL_WIFI_PARAM_MAX_LEN 32
|
||||||
typedef struct pika_hal_WIFI_config {
|
typedef struct pika_hal_WIFI_config {
|
||||||
PIKA_HAL_WIFI_MODE mode;
|
PIKA_HAL_WIFI_MODE mode;
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
#include "_network.h"
|
||||||
|
#include "../pikascript-lib/PikaStdDevice/pika_hal.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
STA_IF: int
|
||||||
|
AP_IF: int
|
||||||
|
STAT_IDLE: int
|
||||||
|
STAT_CONNECTING: int
|
||||||
|
STAT_WRONG_PASSWORD: int
|
||||||
|
STAT_NO_AP_FOUND: int
|
||||||
|
STAT_CONNECT_FAIL: int
|
||||||
|
STAT_GOT_IP: int
|
||||||
|
*/
|
||||||
|
|
||||||
|
void _network___init__(PikaObj* self) {
|
||||||
|
obj_setInt(self, "STA_IF", PIKA_HAL_WIFI_MODE_STA);
|
||||||
|
obj_setInt(self, "AP_IF", PIKA_HAL_WIFI_MODE_AP);
|
||||||
|
obj_setInt(self, "STAT_IDLE", PIKA_HAL_WIFI_STATUS_IDLE);
|
||||||
|
obj_setInt(self, "STAT_CONNECTING", PIKA_HAL_WIFI_STATUS_CONNECTING);
|
||||||
|
obj_setInt(self, "STAT_WRONG_PASSWORD",
|
||||||
|
PIKA_HAL_WIFI_STATUS_WRONG_PASSWORD);
|
||||||
|
obj_setInt(self, "STAT_NO_AP_FOUND", PIKA_HAL_WIFI_STATUS_NO_AP_FOUND);
|
||||||
|
obj_setInt(self, "STAT_CONNECT_FAIL", PIKA_HAL_WIFI_STATUS_CONNECT_FAIL);
|
||||||
|
obj_setInt(self, "STAT_GOT_IP", PIKA_HAL_WIFI_STATUS_GOT_IP);
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user