mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +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;
|
||||
|
||||
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
|
||||
typedef struct pika_hal_WIFI_config {
|
||||
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,27 +1,39 @@
|
||||
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:
|
||||
def __init__(self, interface_id:int):...
|
||||
def __init__(self, interface_id: int): ...
|
||||
|
||||
def active(self, is_active:int):...
|
||||
def active(self, is_active: int): ...
|
||||
|
||||
def checkActive(self) -> int:...
|
||||
def checkActive(self) -> int: ...
|
||||
|
||||
def connect(self, ssid:str, key:str):...
|
||||
|
||||
def connectWIthBssid(self, ssid:str, key:str, bssid:str):...
|
||||
def connect(self, ssid: str, key: str): ...
|
||||
|
||||
def disconnect(self):...
|
||||
def connectWIthBssid(self, ssid: str, key: str, bssid: str): ...
|
||||
|
||||
def status(self) -> int:...
|
||||
def disconnect(self): ...
|
||||
|
||||
def statusWithParam(self, param:str) -> int:...
|
||||
def status(self) -> int: ...
|
||||
|
||||
def isconnected(self) -> int:...
|
||||
def statusWithParam(self, param: str) -> int: ...
|
||||
|
||||
def config(self, **kwargs):...
|
||||
def isconnected(self) -> int: ...
|
||||
|
||||
def checkConfig(self, param:str) -> any:...
|
||||
def config(self, **kwargs): ...
|
||||
|
||||
def ifconfig(self, config:tuple):...
|
||||
def checkConfig(self, param: str) -> any: ...
|
||||
|
||||
def checkIfconfig(self) -> tuple:...
|
||||
def ifconfig(self, config: tuple): ...
|
||||
|
||||
def checkIfconfig(self) -> tuple: ...
|
||||
|
||||
|
||||
def __init__(): ...
|
||||
|
@ -1,14 +1,14 @@
|
||||
import _network
|
||||
|
||||
STA_IF = 0
|
||||
AP_IF = 1
|
||||
STA_IF = _network.STA_IF
|
||||
AP_IF = _network.AP_IF
|
||||
|
||||
STAT_IDLE = 0
|
||||
STAT_CONNECTING = 1
|
||||
STAT_WRONG_PASSWORD = 2
|
||||
STAT_NO_AP_FOUND = 3
|
||||
STAT_CONNECT_FAIL = 4
|
||||
STAT_GOT_IP = 5
|
||||
STAT_IDLE = _network.STAT_IDLE
|
||||
STAT_CONNECTING = _network.STAT_CONNECTING
|
||||
STAT_WRONG_PASSWORD = _network.STAT_WRONG_PASSWORD
|
||||
STAT_NO_AP_FOUND = _network.STAT_NO_AP_FOUND
|
||||
STAT_CONNECT_FAIL = _network.STAT_CONNECT_FAIL
|
||||
STAT_GOT_IP = _network.STAT_GOT_IP
|
||||
|
||||
class WLAN(_network.WLAN):
|
||||
def __init__(self, interface_id:int):
|
||||
|
@ -1,27 +1,39 @@
|
||||
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:
|
||||
def __init__(self, interface_id:int):...
|
||||
def __init__(self, interface_id: int): ...
|
||||
|
||||
def active(self, is_active:int):...
|
||||
def active(self, is_active: int): ...
|
||||
|
||||
def checkActive(self) -> int:...
|
||||
def checkActive(self) -> int: ...
|
||||
|
||||
def connect(self, ssid:str, key:str):...
|
||||
|
||||
def connectWIthBssid(self, ssid:str, key:str, bssid:str):...
|
||||
def connect(self, ssid: str, key: str): ...
|
||||
|
||||
def disconnect(self):...
|
||||
def connectWIthBssid(self, ssid: str, key: str, bssid: str): ...
|
||||
|
||||
def status(self) -> int:...
|
||||
def disconnect(self): ...
|
||||
|
||||
def statusWithParam(self, param:str) -> int:...
|
||||
def status(self) -> int: ...
|
||||
|
||||
def isconnected(self) -> int:...
|
||||
def statusWithParam(self, param: str) -> int: ...
|
||||
|
||||
def config(self, **kwargs):...
|
||||
def isconnected(self) -> int: ...
|
||||
|
||||
def checkConfig(self, param:str) -> any:...
|
||||
def config(self, **kwargs): ...
|
||||
|
||||
def ifconfig(self, config:tuple):...
|
||||
def checkConfig(self, param: str) -> any: ...
|
||||
|
||||
def checkIfconfig(self) -> tuple:...
|
||||
def ifconfig(self, config: tuple): ...
|
||||
|
||||
def checkIfconfig(self) -> tuple: ...
|
||||
|
||||
|
||||
def __init__(): ...
|
||||
|
@ -1,14 +1,14 @@
|
||||
import _network
|
||||
|
||||
STA_IF = 0
|
||||
AP_IF = 1
|
||||
STA_IF = _network.STA_IF
|
||||
AP_IF = _network.AP_IF
|
||||
|
||||
STAT_IDLE = 0
|
||||
STAT_CONNECTING = 1
|
||||
STAT_WRONG_PASSWORD = 2
|
||||
STAT_NO_AP_FOUND = 3
|
||||
STAT_CONNECT_FAIL = 4
|
||||
STAT_GOT_IP = 5
|
||||
STAT_IDLE = _network.STAT_IDLE
|
||||
STAT_CONNECTING = _network.STAT_CONNECTING
|
||||
STAT_WRONG_PASSWORD = _network.STAT_WRONG_PASSWORD
|
||||
STAT_NO_AP_FOUND = _network.STAT_NO_AP_FOUND
|
||||
STAT_CONNECT_FAIL = _network.STAT_CONNECT_FAIL
|
||||
STAT_GOT_IP = _network.STAT_GOT_IP
|
||||
|
||||
class WLAN(_network.WLAN):
|
||||
def __init__(self, interface_id:int):
|
||||
|
@ -383,6 +383,16 @@ typedef enum {
|
||||
PIKA_HAL_WIFI_MODE_AP,
|
||||
} 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
|
||||
typedef struct pika_hal_WIFI_config {
|
||||
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