diff --git a/FETCH_HEAD b/FETCH_HEAD new file mode 100644 index 0000000..e69de29 diff --git a/feature_branch b/feature_branch new file mode 100644 index 0000000..e69de29 diff --git a/quecpython_stubs/Qth.pyi b/quecpython_stubs/Qth.pyi new file mode 100644 index 0000000..e7f2bb4 --- /dev/null +++ b/quecpython_stubs/Qth.pyi @@ -0,0 +1,150 @@ +""" +Function: +QthSDK API + +Descriptions taken from: +https://iot-docs.acceleronix.io/deviceDevelop/DeviceAccessPlan/cellular/QuecPython/api/quecpython-api-01.html +""" + + +#Product configuration API + +def setProductInfo(pk,ps) -> bool: + """Set product info + + pk: ProductKey generated when you create the product on Developer Center. + ps: ProductSecret generated when you create the product on Developer Center. + + :return:True: Successful execution,False: Failed execution + """ + +def setServer(url) -> bool: + """Set server address + + url: Server address + + :return:True: Successful execution,False: Failed execution + """ + +def setLifetime(lifetime) -> bool: + """Set the lifetime of the product + + lifetime: Lifetime of the product + + :return:True: Successful execution,False: Failed execution + """ +def setEventCb(eventlist)-> int: + """Set the callback function for the event + + eventlist: Event list + + :return:1: Successful execution,rest: Failed execution + """ + +def setMcuVer(comp_no, version, infoCB, resultCB) -> bool: + """Set the MCU version + + comp_no: Component number + version: MCU version + infoCB: Callback function for information + resultCB: Callback function for result + + :return:True: Successful execution,False: Failed execution + """ +def setAppVer(version, resultCB): + """Set the application version + + version: App component version. + resultCB: Callback function of the App upgrade results. + """ + +#Network Configuration API +def setApn(apn, username, password): + """Set APN + + apn: APN + username: APN username + password: APN password + + return: NULL + """ + +#Device Connection API +def init() -> bool: + """Initialize the device connection + + return: True if initialization is successful, False otherwise + """ + +def start() -> bool: + """Start the device connection + + return: True if the device is connected, False otherwise + """ + +def stop(): + """Stop the device connection""" + +def state() -> bool: + """Get the device connection state + + return: True if the device is connected, False otherwise + """ + +def reset(): + """Reset the device connection""" + +#Data Interaction API +def sendTrans(mode, value) -> bool: + """Send a transaction to the device + + mode: Transaction mode + value: Transaction value + + return: True if the transaction was sent, False otherwise + """ + +def sendTsl(mode, value) -> bool: + """Send a TSL command to the device + + mode: TSL command mode + value: TSL command value + + return: True if the command was sent, False otherwise + """ + +def ackTsl(mode, value, pkgId) -> bool: + """Send an ACK to the device + + mode: ACK mode + value: ACK value + pkgId: Package ID + + return: True if the ACK was sent, False otherwise + """ + +def ackTslServer(mode, serverId, value, pkgId) -> bool: + """Send an ACK to the server + + mode: ACK mode + serverId: Server ID + value: ACK value + pkgId: Package ID + + return: True if the ACK was sent, False otherwise + """ + +#OTA upgrade API +def otaRequest() -> bool: + """Request an OTA upgrade + + return: True if the request was sent, False otherwise + """ + +def otaAction(otaAction) -> bool: + """Send an OTA action + + otaAction: OTA action + + return: True if the action was sent, False otherwise + """ \ No newline at end of file diff --git a/quecpython_stubs/WDT.pyi b/quecpython_stubs/WDT.pyi new file mode 100644 index 0000000..b06402f --- /dev/null +++ b/quecpython_stubs/WDT.pyi @@ -0,0 +1,26 @@ +""" +Function: +This class provides a system restart operation when an APP +application fails to execute due to an exception. +Applicable modules: All modules supporting WDT functionality. + +Descriptions taken from: +https://developer.quectel.com/doc/quecpython/API_reference/en/peripherals/machine.WDT.html?highlight=WDT +""" + + +from machine import WDT + +def feed() -> int: + """This method is used for feeding dogs. + + :return: `0` - Successful execution; `-1` - Failed execution + """ + ... + +def stop() -> int: + """This method is used to disable the soft dog function. + + :return: `0` - Successful execution; `-1` - Failed execution + """ + ... \ No newline at end of file diff --git a/quecpython_stubs/_thread.pyi b/quecpython_stubs/_thread.pyi index 02dfe89..166e448 100644 --- a/quecpython_stubs/_thread.pyi +++ b/quecpython_stubs/_thread.pyi @@ -3,7 +3,7 @@ Function: _thread module contains features related to thread operations, and provides methods for creating and deleting threads, and interfaces related to mutex and semaphore. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/stdlib/_thread.html +https://python.quectel.com/doc/quecpython/API_reference/en/stdlib/_thread.html """ diff --git a/quecpython_stubs/app_fota.pyi b/quecpython_stubs/app_fota.pyi index 42d3b1a..890a5c1 100644 --- a/quecpython_stubs/app_fota.pyi +++ b/quecpython_stubs/app_fota.pyi @@ -3,7 +3,7 @@ Function: The app_fota module is used for user file upgrades. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/syslib/app_fota.html +https://python.quectel.com/doc/quecpython/API_reference/en/syslib/app_fota.html """ diff --git a/quecpython_stubs/app_fota_download.pyi b/quecpython_stubs/app_fota_download.pyi new file mode 100644 index 0000000..d02f246 --- /dev/null +++ b/quecpython_stubs/app_fota_download.pyi @@ -0,0 +1,191 @@ +""" +FOTA (Firmware Over-The-Air) Update Module +Type definitions for firmware update functionality. + +Note: All paths are dynamically generated at runtime based on the FOTA mount point. +""" +from typing import Optional, Dict, List, Any, Union, Tuple +import request +import uos + +name, platform = uos.uname()[1].split("=",1) + +# Path management functions +def get_updater_dir() -> str: + """Get the absolute path to the updater directory + Format: /usr/.updater + """ + +def get_download_stat_file() -> str: + """Get the absolute path to the download status file + Format: /usr/.updater/download.stat + """ + +def get_update_flag_file() -> str: + """Get the absolute path to the update flag file + Format: /usr/.updater/update.flag + """ + +updater_dir = get_updater_dir() +download_stat_file = get_download_stat_file() +update_flag_file = get_update_flag_file() + +# File status operations +def _get_download_stat_by_file(file_name: str) -> Optional[Dict[str, Any]]: + """Internal: Get download status for a specific file + + Args: + file_name: Target filename (case-insensitive match) + + Returns: + Dictionary containing: + - url: str - Download source URL + - name: str - File name + - total_size: int - Expected file size + - dl_location: str - Storage path + None if file not found or error occurred + """ + +def _get_download_stat() -> Optional[List[Dict[str, Any]]]: + """Internal: Get complete download status list + + Returns: + List of status dictionaries (same format as _get_download_stat_by_file) + None if status file not found or invalid + """ + +def get_download_stat() -> Optional[List[Dict[str, Any]]]: + """Get current download status for all files + (Wrapper around _get_download_stat) + """ + +# Download operations +def _fetch( + url: str, + fetched_size: int, + headers: Optional[Dict[str, str]] = None, + ipvtype: int = 0, + username: Optional[str] = None, + password: Optional[str] = None +) -> request.Response: + """Internal: Perform HTTP request with range header + + Args: + url: Download URL + fetched_size: Bytes already downloaded (for Range header) + headers: Optional HTTP headers + ipvtype: 0=IPv4, 1=IPv6 + username: HTTP auth username + password: HTTP auth password + + Returns: + request.Response object + """ + +def _update_download_stat( + url: str, + file_name: str, + total_size: Union[int, str], + download_file_name: Optional[str] = None +) -> None: + """Internal: Update download status file + + Args: + url: Source URL + file_name: Target filename + total_size: Expected file size (int) or "unknown" + download_file_name: Actual storage path + """ + +def update_download_stat( + url: str, + file_name: str, + total_size: Union[int, str] +) -> None: + """Update download status (public wrapper) + (Calls _update_download_stat with None for download_file_name) + """ + +def delete_update_file(file_name: str) -> None: + """Remove file entry from download status + + Args: + file_name: Filename to remove from tracking + """ + +# Main download function +def download( + url: str, + file_name: str, + headers: Optional[Dict[str, str]] = None, + ipvtype: int = 0, + username: Optional[str] = None, + password: Optional[str] = None, + ext_enable: bool = False, + spi_port: Optional[int] = None, + spi_clk: Optional[int] = None, + dl_location: Optional[str] = None +) -> int: + """Download a file for FOTA update + + Args: + url: Download source URL + file_name: Destination filename (relative path) + headers: Optional HTTP headers + ipvtype: IP version (0=IPv4) + username: HTTP auth username + password: HTTP auth password + ext_enable: Enable external storage + spi_port: SPI port number (required if ext_enable) + spi_clk: SPI clock speed (required if ext_enable) + dl_location: Custom storage path + + Returns: + 0: Success + -1: Failure + """ + +# Platform-specific implementations +if platform == "FCM362K": + def download_forFCM362K( + url: str, + headers: Optional[Dict[str, str]] = None + ) -> int: + """Special download handler for FCM362K platform + + Args: + url: Firmware download URL + headers: Optional HTTP headers + + Returns: + 0: Success (will trigger automatic reboot) + -1: Failure + """ + +# Batch operations +def bulk_download( + info: Optional[List[Dict[str, Any]]] = None, + headers: Optional[Dict[str, str]] = None +) -> Optional[List[Dict[str, Any]]]: + """Batch download multiple files + + Args: + info: List of download items, each containing: + - url: str + - file_name: str + - spi_port: Optional[int] + - spi_clk: Optional[int] + - ext_enable: bool + - dl_location: Optional[str] + headers: Common HTTP headers for all requests + + Returns: + List of failed items (same format as input) + None if all succeeded + """ + +# Update control +def set_update_flag() -> None: + """Create the update flag file + (Triggers update process on next reboot) + """ \ No newline at end of file diff --git a/quecpython_stubs/app_fota_mount.pyi b/quecpython_stubs/app_fota_mount.pyi new file mode 100644 index 0000000..77f8a07 --- /dev/null +++ b/quecpython_stubs/app_fota_mount.pyi @@ -0,0 +1,55 @@ +""" +FOTA Package Mount Controller (Singleton) +Handles mounting/unmounting of FOTA update packages +""" +import uos +from typing import Optional, Any + +class AppFotaPkgMount: + __instance: Optional['AppFotaPkgMount'] = None + __mount_state: bool + __can_mount: bool + __fota_dir: str + + def __new__(cls, *args: Any, **kwargs: Any) -> 'AppFotaPkgMount': + """Singleton instance getter + Returns: + Existing instance if available, otherwise creates new instance + """ + + def __init__(self) -> None: + """Initialize FOTA mount point (default: /fota)""" + + @property + def mount_state(self) -> bool: + """Current mount status (read-only) + Returns: + True if FOTA package is currently mounted + """ + + @property + def can_mount(self) -> bool: + """Mount capability flag (read-only) + Returns: + True if system supports FOTA mounting + """ + + @property + def fota_dir(self) -> str: + """FOTA mount directory path (read-only) + Format: "/fota" or custom mounted path + """ + + def umount_disk(self) -> None: + """Unmount FOTA package if mounted + Side Effects: + Updates mount_state flag + """ + + def get_fota_file_name(self, path: str) -> str: + """Get absolute path within FOTA mount + Args: + path: Relative path (e.g. "/usr/package.bin") + Returns: + Absolute path (e.g. "/fota/usr/package.bin") + """ \ No newline at end of file diff --git a/quecpython_stubs/atcmd.pyi b/quecpython_stubs/atcmd.pyi index 23797e4..e367a86 100644 --- a/quecpython_stubs/atcmd.pyi +++ b/quecpython_stubs/atcmd.pyi @@ -3,7 +3,7 @@ Function: This module provides a method for sending AT commands, allowing the QuecPython module to send AT commands through Python code. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/syslib/atcmd.html +https://python.quectel.com/doc/quecpython/API_reference/en/syslib/atcmd.html """ diff --git a/quecpython_stubs/audio.pyi b/quecpython_stubs/audio.pyi index 17a94da..998c961 100644 --- a/quecpython_stubs/audio.pyi +++ b/quecpython_stubs/audio.pyi @@ -3,7 +3,7 @@ Function: The module contains various audio features, including audio playback, TTS (text-to-speech) playback, recording and so on. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/medialib/audio.html +https://python.quectel.com/doc/quecpython/API_reference/en/medialib/audio.html """ @@ -11,7 +11,7 @@ class Audio(object): """Class feature: Audio playback. Currently supported modules:EC600N Series, EC800N Series, EC600M-CN(LA/LE), EC800M-CN(LA/LE/GA), EC600U Series, EC200U Series, EG912U, EG915U and EG915N-EUAG. - Description: https://python.quectel.com/doc/API_reference/en/medialib/audio.Audio.html + Description: https://python.quectel.com/doc/quecpython/API_reference/en/medialib/audio.Audio.html """ def __init__(self, device): @@ -143,7 +143,7 @@ class Record(object): """Class feature: Recording. Currently supported models: EC600N Series, EC800N Series, EC600M-CN(LA/LE), EC800M-CN(LA/LE/GA), EC600U Series, EC200U Series, EG912U, EG915U and EG915N-EUAG. - Description: https://python.quectel.com/doc/API_reference/en/medialib/audio.Record.html + Description: https://python.quectel.com/doc/quecpython/API_reference/en/medialib/audio.Record.html """ def __init__(self, device): @@ -309,3 +309,133 @@ class Record(object): """ AMRNB: int = ... # AMR format. + +class TTS(object): + """Class Text-to-speech playback. + + Currently supported models: EC600N series, EC800N series, EC600M-CN (LA, LE), EC800M-CN (LA, LE, GA), EG810MCN_GA, EC600U series, EC200U series, EG912U, EG915U, EG915N-EUAG. + Description: https://developer.quectel.com/doc/quecpython/API_reference/en/medialib/audio.TTS.html + """ + + def __init__(self, device): + """Creates an TTS object. + + :param device: Integer type. The output channel. 0 indicates earpiece, 1 indicates headphone, and 2 indicates speaker. See the table below for the specific channels supported by each module. + Channels Supported by the Module: + Module Earpiece Headphone Speaker + EC200N/EC600N/EC800N Supported Unsupported Unsupported + EC600M-CN(LA/LE) Supported Unsupported Unsupported + EC800M-CN(LA/LE/GA) Supported Unsupported Unsupported + EG810M Supported Unsupported Unsupported + EG915N/EG912N Supported Unsupported Unsupported + EG912U Supported Unsupported Unsupported + EC200U Unsupported Unsupported Supported + EC600U Supported Supported Supported + EG915U Supported Supported Unsupported + EC600S Supported Unsupported Unsupported + EC600K/EC800K Supported Unsupported Unsupported + EC800G-CN(GA/TT/LA) Supported Supported Supported + EC600G-CN(LA) Supported Supported Supported + """ + + def close(self): + """This method disables the TTS function. + + :return: 0 - Successful execution; -1 - Failed execution. + """ + + def play(self, priority, breakin, mode, str): + """This method starts TTS playback. For usage examples, click here. + + The playback task scheduling follows priority and break-in rules: + - Higher priority tasks (0-4, 4=highest) can interrupt lower priority ones + - Each priority group supports up to 10 queued tasks + - Break-in mode determines if current playback can be interrupted + + :param priority: Integer type. Play priority (0-4). Higher value = higher priority. + :param breakin: Integer type. Break-in mode. 0: not allowed to break in; 1: allowed to break in. + :param mode: Integer type. Play mode (lower 4 bits: encoding mode; higher 4 bits: WTTS mode). See TTS mode table. + :param str: String type. The string to be played. + :return: Returns an integer value. + 0 - Playback started successfully + -1 - Playback failed + 1 - Added to playback queue (cannot play immediately) + -2 - Priority group queue full (not added) + """ + + def stop(self): + """This method stops TTS playback. + + :return: 0 indicates success, -1 indicates failure. + """ + + def stopAll(self): + """This method stops the entire playback queue. + + If TTS or audio is currently playing and there are other contents in the queue, + calling this method will not only stop the current playback but also clear the queue. + If currently playing and the playback queue is empty, this method has the same effect as stop(). + + :return: 0 indicates success, -1 indicates failure. + """ + + def setCallback(self, cb): + """This method registers a user callback function to notify TTS playback status. + + Do not perform time-consuming or blocking operations in the callback function. + It is recommended to only perform simple and short operations. + + :param cb: User callback function, function type. Function prototype: + def cb(event): + pass + + Callback function parameter description: + event - Playback status, int type: + 2 - Playback started + 3 - Playback stopped + 4 - Playback completed + + :return: 0 indicates success, -1 indicates failure. + """ + + def getVolume(self): + """This method gets the current playback volume level. + + Volume value range [0 ~ 9], where 0 indicates mute (default is 4). + + :return: Integer volume value on success, -1 on failure. + """ + + def setVolume(self, vol): + """This method sets the playback volume level. + + Volume value should be in the range [0 ~ 9], where 0 indicates mute. + + :param vol: Volume level, int type, range [0 ~ 9]. + :return: 0 indicates success, -1 indicates failure. + """ + + def getSpeed(self): + """This method gets the current playback speed. + + Speed value range [0 ~ 9], higher values indicate faster speed (default is 4). + + :return: Integer speed value on success, -1 on failure. + """ + + def setSpeed(self, speed): + """This method sets the TTS playback speed. + + Speed value should be in the range [0 ~ 9]. + + :param speed: Speed value, int type, range [0 ~ 9]. + :return: 0 indicates success, -1 indicates failure. + """ + + def getState(self): + """This method gets the TTS status. + + :return: + 0 - No TTS playback currently + -1 - TTS is currently playing + """ \ No newline at end of file diff --git a/quecpython_stubs/backup_restore.pyi b/quecpython_stubs/backup_restore.pyi new file mode 100644 index 0000000..dbcad58 --- /dev/null +++ b/quecpython_stubs/backup_restore.pyi @@ -0,0 +1,83 @@ +""" +Backup and Restore Module +Provides secure backup and restore functionality with CRC32 checksum verification. + +Descriptions taken from: +Not yet. +""" + +class _checkError(Exception): + """Custom exception for backup check failures""" + + def __init__(self, value: str): + """ + :param value: Error description + """ + def __str__(self) -> str: + """Returns string representation of the error + + :return: Error description string + """ + +def bak_update(file: str, data: any) -> int: + """Updates or creates a backup file with checksum verification + + :param file: File path to update (auto-prefixed with '/' if needed) + :param data: Data to store (dict for new files, any type for existing) + :return: + 0 - Success + -1 - Invalid input or file exists + -2 - Flag check failed + -3 - Backup disabled + -5 - Operation failed + + Process: + 1. Mounts secure backup filesystem + 2. Creates primary file if missing + 3. Copies file to backup location + 4. Updates checksums for both files + """ + +def bak_file(file: str) -> any: + """Retrieves a file from backup storage + + :param file: File path to retrieve (auto-prefixed with '/' if needed) + :return: + File content on success + -1 - File not found + -2 - Flag check failed + -3 - Backup disabled + -4 - Checksum mismatch + -5 - Operation failed + -6 - Copy failed + + Process: + 1. Mounts secure backup filesystem + 2. Copies backup file to primary location + 3. Verifies checksums + """ + +def main() -> None: + """Main backup restore procedure + + Automatically performs: + 1. Checks backup restore flag + 2. Compares CRC32 checksums + 3. Restores mismatched files from backup + 4. Updates checksum database + + Note: Runs automatically on module import + """ + +def _get_backup_restore_flag() -> bool: + """Internal: Gets backup enable flag (not for direct use) + + :return: True if backup enabled, False otherwise + """ + +def _check() -> str: + """Internal: Validates backup flag file (not for direct use) + + :return: JSON content of flag file + :raises _checkError: If file missing or empty + """ \ No newline at end of file diff --git a/quecpython_stubs/bak_util.pyi b/quecpython_stubs/bak_util.pyi new file mode 100644 index 0000000..a21f8c5 --- /dev/null +++ b/quecpython_stubs/bak_util.pyi @@ -0,0 +1,57 @@ +""" +Secure Storage Module +Provides secure storage functionality for configuration data and files with backup support. + +Descriptions taken from: +Not yet. +""" +from backup_restore import bak_update, bak_file +import uos, ujson, ql_fs + +class SecureStorage: + """Secure storage class for configuration data and file backup""" + + @classmethod + def write(cls, data: dict) -> int: + """Writes configuration data to secure storage + + :param data: Configuration data in dictionary format + :return: + 0 - Success + -1 - Invalid input (not a dictionary) + -2 - Write operation failed + -3 - Backup file already exists + + Note: Automatically creates backup if none exists + """ + + @classmethod + def read(cls) -> dict: + """Reads configuration data from secure storage + + :return: Configuration data dictionary or None if not found + + Note: Automatically restores from backup if primary file is missing + """ + + @classmethod + def add(cls, file: str, data: any) -> int: + """Adds or updates a file in secure storage + + :param file: File path to add/update + :param data: Data to store in the file + :return: 0 if successful, error code otherwise + + Uses bak_update function for the operation + """ + + @classmethod + def file(cls, file: str) -> any: + """Retrieves a file from secure storage + + :param file: File path to retrieve + :return: File content or None if not found + + Uses bak_file function for the operation + """ +JsonFile = SecureStorage diff --git a/quecpython_stubs/ble.pyi b/quecpython_stubs/ble.pyi index 290f5d7..05f1f10 100644 --- a/quecpython_stubs/ble.pyi +++ b/quecpython_stubs/ble.pyi @@ -3,7 +3,7 @@ Function: The ble module provides BLE GATT Server (slave) and BLE GATT Client (master) features based on the BLE 4.2 protocol. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/btlib/ble.html +https://python.quectel.com/doc/quecpython/API_reference/en/btlib/ble.html """ @@ -546,3 +546,104 @@ def writeCharaDesc(connect_id, handle, data): :param data:Bytearray type. Characteristic description data. :return:0- Successful execution; -1- Failed execution. """ + + +def exchangeMtu(self, connect_id, mtu_size): + """Send MTU exchange request. + + The MTU exchange request should be initiated by the client side. + + :param connect_id: Connection ID, obtained when establishing the connection, integer type. + :param mtu_size: MTU size. + :return: 0 on success, -1 on failure. + """ + +def smpSetConfig(self, io_cap, auth_req, passkey, timeout): + """Configure pairing capabilities. + + Pairing method selection process: + There are two modes for BLE SMP pairing: Legacy Pairing and Secure Connections Pairing. + The specific pairing method is determined through negotiation between the two parties after + exchanging their IO capabilities. + + :param io_cap: Device input/output capability, integer type, default 3. + Value Meaning + 0 Display only, can display PIN code + 1 Display only, can only display Yes/No, cannot display PIN code + 2 Input only, can input PIN code + 3 No input/output capability (default) + 4 Both input and output capabilities + :param auth_req: Authentication request parameter, integer type, default 9. + Bit0 Bit1 Bit2 Bit3 + 0 No binding after pairing Reserved Disable MITM Use Legacy Pairing + 1 Bind after pairing Reserved Enable MITM Use Secure Connections Pairing + :param passkey: PIN code to display during pairing, integer type, default 123456. + :param timeout: Pairing timeout, in units of 100ms, integer type, default 160. + :return: 0 on success, -1 on failure. + """ + +def smpGetConfig(self): + """Query pairing capabilities. + + :return: On success, returns a tuple (io_cap, auth_req, passkey, timeout). + On failure, returns -1. + + io_cap - Device input/output capability, integer type, default 3. + Value Meaning + 0 Display only, can display PIN code + 1 Display only, can only display Yes/No, cannot display PIN code + 2 Input only, can input PIN code + 3 No input/output capability + 4 Both input and output capabilities + auth_req - Authentication request parameter, integer type, default 9. + Bit0 Bit1 Bit2 Bit3 + 0 No binding after pairing Reserved Disable MITM Use Legacy Pairing + 1 Bind after pairing Reserved Enable MITM Use Secure Connections Pairing + passkey - PIN code to display during pairing, integer type, default 123456. + timeout - Pairing timeout, in units of 100ms, integer type, default 160. + """ + +def smpStartPair(self, connect_id): + """Start the BLE SMP pairing process. + + SMP pairing is initiated by the client, but the server can also use this interface + to notify the client to initiate an SMP pairing request. + + :param connect_id: Connection ID, obtained when establishing the connection, integer type. + :return: 0 on success, -1 on failure. + """ + +def smpUserConfirm(self, connect_id, pair_operation, pin): + """Confirm pairing. + + After receiving a pairing request, confirm whether to accept the pairing. + + :param connect_id: Connection ID, obtained when establishing the connection, integer type. + :param pair_operation: Pairing operation type, integer type. + Value Meaning + 0 Cancel pairing (only available during pairing process; will disconnect the BLE connection) + 1 Confirm pairing without PIN (for Just Work or Numeric Comparison modes) + 2 Confirm pairing with PIN (for Passkey mode) + :param pin: PIN code, integer type. + :return: 0 on success, -1 on failure. + """ + +def smpGetPairedDevInfo(self): + """Get information about paired devices. + + :return: On success, returns a list of bytearray objects representing BLE addresses of paired devices. + On failure, returns -1. + """ + +def smpRemovePairedDev(self, addr): + """Delete information for a specified paired device. + + :param addr: BLE address of the device to be deleted, bytearray type (6 bytes). + :return: 0 on success, -1 on failure. + """ + +def smpCleanPairedDev(self): + """Delete information for all paired devices. + + :return: 0 on success, -1 on failure. + """ diff --git a/quecpython_stubs/bt.pyi b/quecpython_stubs/bt.pyi index 9753977..d5256c7 100644 --- a/quecpython_stubs/bt.pyi +++ b/quecpython_stubs/bt.pyi @@ -5,7 +5,7 @@ The bt module provides Classic Bluetooth related features, including HFP, A2DP, Currently, only EC200U/EC600U/EG915U/EG912U series module supports bt feature. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/btlib/bt.html +https://python.quectel.com/doc/quecpython/API_reference/en/btlib/bt.html """ diff --git a/quecpython_stubs/camera.pyi b/quecpython_stubs/camera.pyi index d0f70b3..0eaad1f 100644 --- a/quecpython_stubs/camera.pyi +++ b/quecpython_stubs/camera.pyi @@ -6,7 +6,7 @@ Note: If the preview feature is needed, please initialize the LCD object first b Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/medialib/camera.html +https://python.quectel.com/doc/quecpython/API_reference/en/medialib/camera.html """ @@ -15,7 +15,7 @@ class CamPreview(object): Class feature: Camera previewing. Note: Please initialize the LCD before using this feature. - Descriptions: https://python.quectel.com/doc/API_reference/en/medialib/camera.CamPreview.html + Descriptions: https://python.quectel.com/doc/quecpython/API_reference/en/medialib/camera.CamPreview.html """ def __init__(self, model, cam_w, cam_h, lcd_w, lcd_h, perview_level): @@ -50,7 +50,7 @@ class CamDecoder(object): """Camera code scanning. Note: Please initialize the LCD before enabling preview feature. - Descriptions: https://python.quectel.com/doc/API_reference/en/medialib/camera.CamDecoder.html + Descriptions: https://python.quectel.com/doc/quecpython/API_reference/en/medialib/camera.CamDecoder.html """ def __init__(self, model, decode_level, cam_w, cam_h, perview_level, lcd_w, lcd_h): @@ -121,7 +121,7 @@ class CamCapture(object): Class feature: Camera capturing and saving. Note: Please initialize the LCD before using this feature. - Descriptions: https://python.quectel.com/doc/API_reference/en/medialib/camera.CamCapture.html + Descriptions: https://python.quectel.com/doc/quecpython/API_reference/en/medialib/camera.CamCapture.html """ def __init__(self, model, cam_w, cam_h, perview_level, lcd_w, lcd_h): diff --git a/quecpython_stubs/cellLocator.pyi b/quecpython_stubs/cellLocator.pyi index 966007a..188539d 100644 --- a/quecpython_stubs/cellLocator.pyi +++ b/quecpython_stubs/cellLocator.pyi @@ -4,7 +4,7 @@ This module provides base station location feature and gets the latitude and lon Currently, only EC600S/EC600N/EC800N/EC200U/EC600U/EG912U/EG915U series module supports this feature. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/gnsslib/cellLocator.html +https://python.quectel.com/doc/quecpython/API_reference/en/gnsslib/cellLocator.html """ diff --git a/quecpython_stubs/checkNet.pyi b/quecpython_stubs/checkNet.pyi index c71ff62..4946047 100644 --- a/quecpython_stubs/checkNet.pyi +++ b/quecpython_stubs/checkNet.pyi @@ -3,7 +3,7 @@ Function: The checkNet module provides methods to detect whether the QuecPython module's network is ready, while also providing troubleshooting methods and steps for network exceptions. Descriptions taken from: -https://python.quectel.com/doc/API_reference/zh/iotlib/checkNet.html +https://python.quectel.com/doc/quecpython/API_reference/en/iotlib/checkNet.html """ diff --git a/quecpython_stubs/dataCall.pyi b/quecpython_stubs/dataCall.pyi index dcecf15..ae101de 100644 --- a/quecpython_stubs/dataCall.pyi +++ b/quecpython_stubs/dataCall.pyi @@ -9,9 +9,9 @@ Failure to configure or incorrect configuration may result in the module's failu For information on configuring the APN, refer to the dataCall.setPDPContext method. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/iotlib/dataCall.html +https://python.quectel.com/doc/quecpython/API_reference/en/iotlib/dataCall.html """ - +from typing import Optional, Union, Any def setPDPContext(profileID, ipType, apn, username, password, authType): """Configures the relevant information of the PDP context, and saves the configuration information when power is off. When establishing the channel, use the parameters configured by this method to activate the PDP context. @@ -160,3 +160,39 @@ def getInfo(profileID, ipType): Modules that support this method: EC100Y/EC200N/EC600N/EC600S/EC800N/EG912N/EG915N/EC600M/EC800M/EG810M/EC200A/EC200U/EC600U/EG912U/EG915U/EC600G/EC800G/EC600E/EC800E/BG95/BC25/BC95 series module. Since it should be compatible with the old version of dataCall.getInfo, the maximum value of the actual profileID is greater than 3, and the actual profileID that can be queried shall prevail. """ + +def start( + profileidx: int, + iptype: int = 0, + apn: str = "", + username: str = "", + password: str = "", + authtype: int = 0, + cur_simid: Optional[int] = None +) -> Union[int, Any]: # 根据dial.start实际返回值确定 + """Activate PDP context + + :param profileidx: PDP profile index (required) + :param iptype: IP type (default 0) + :param apn: Access Point Name (default "") + :param username: Authentication username (default "") + :param password: Authentication password (default "") + :param authtype: Authentication type (default 0) + :param cur_simid: Optional SIM ID (default None) + :return: + int - 0 on success, -1 on failure + Any - dial.start() may return other types + """ + +def stop( + profileidx: int, + iptype: int, + cur_simid: Optional[int] = None +) -> int: + """Deactivate PDP context + + :param profileidx: PDP profile index (required) + :param iptype: IP type (required) + :param cur_simid: Optional SIM ID (default None) + :return: dial.stop() return value (assumed int) + """ \ No newline at end of file diff --git a/quecpython_stubs/dlms.pyi b/quecpython_stubs/dlms.pyi new file mode 100644 index 0000000..2844b1d --- /dev/null +++ b/quecpython_stubs/dlms.pyi @@ -0,0 +1,446 @@ +""" +Function: +This feature provides DLMS (Device Language Message Specification) server functionality +for smart metering applications. +The following interfaces are implemented in the LPA method and require users and card vendors to confirm whether the eSIM card supports LPA functionality. +Applicable modules: All modules supporting DLMS functionality. +""" + +from typing import Optional + +def run() -> int: + """Starts the DLMS server. + + :return: `0` - Successful execution; `-1` - Failed execution + """ + ... + +def stop() -> int: + """Stops the DLMS server. + + :return: `0` - Successful execution + """ + ... + +def handle_request( + recv_buff: bytes, + recv_buff_len: int +) -> bytearray: + """Handles a DLMS request message received from UART or TCP. + + :param recv_buff: Request message bytes from UART or TCP + :param recv_buff_len: Length of request message + :return: Response message (processed DLMS data) if successful; empty bytes if failed + """ + ... + +class Data: + """ + DLMS Data object. Holds a value (int, bytes, str, bool, or None) and logical_name. + + Attributes: + logical_name (bytes): DLMS logical name (OBIS code) as bytes. + value (int | bytes | str | bool | None): Data value. + + Example: + data = Data("1.0.1.8.0.255") + data.value = 42 + data.value = b"\x01\x02" + data.value = "hello" + data.value = True + data.value = None + """ + logical_name: bytes + value: int | bytes | str | bool | None + def __init__(self, logical_name: str): ... + + +class Register: + """ + DLMS Register object. + + Attributes: + logical_name (bytes): DLMS logical name (OBIS code) as bytes. + value (int): Current register value. + unit (int): Unit code (see Unit enum). + scaler (int): Scaler for value (default 1). + + Methods: + reset(): Resets value to default_value. + + Example: + reg = Register("1.0.1.8.0.255", 0, unit=Unit.KWH, scaler=1) + reg.value = 42 + reg.unit = Unit.VOLTAGE + reg.scaler = 10 + reg.reset() + """ + logical_name: bytes + value: int + unit: int + scaler: int + def __init__(self, logical_name: str, default_value: int, unit: Optional[int] = None, scaler: int = 1): ... + def reset(self) -> None: ... + + +class SecuritySetup: + """ + DLMS SecuritySetup object. + + Attributes: + logical_name (bytes): DLMS logical name (OBIS code) as bytes. + security_policy (int): Security policy (see SecurityPolicy enum). + security_suite (int): Security suite version (0, 1, 2). + min_invocation_counter (int): Minimum invocation counter. + + Example: + sec = SecuritySetup("0.0.43.0.1.255") + sec.security_policy = SecurityPolicy.AUTHENTICATED_ENCRYPTED + sec.security_suite = 1 + sec.min_invocation_counter = 1000 + """ + logical_name: bytes + security_policy: int + security_suite: int + min_invocation_counter: int + def __init__(self, logical_name: str): ... + +class AssociationLogicalName: + """ + DLMS AssociationLogicalName object. + + Attributes: + logical_name (bytes): DLMS logical name (OBIS code) as bytes. + app_context_name (bytes | None): Application context name (optional, bytes). + secret (bytes | None): Secret for authentication (optional, bytes). + auth_mechanism (str): Authentication mechanism ('None', 'Low', 'High'). + objects (list): List of DLMS objects (Register, Data, etc.). + clientSAP (int): Client SAP (Service Access Point). + security_setup (SecuritySetup | None): Security setup object. + context (DLMSContext): DLMS context info (session/configuration). + + Example: + assoc = AssociationLogicalName("0.0.43.0.1.255") + assoc.app_context_name = b"..." + assoc.secret = b"password" + assoc.auth_mechanism = "High" + assoc.objects = [reg, data] + assoc.clientSAP = 1 + assoc.security_setup = sec + assoc.context = DLMSContext(dlmsVersionNumber=6) + """ + logical_name: bytes + app_context_name: bytes | None + secret: bytes | None + auth_mechanism: str + objects: list + clientSAP: int + security_setup: 'SecuritySetup | None' + context: 'DLMSContext' + def __init__(self, logical_name: str): ... + +class Conformance: + """ + DLMS Conformance enum. Use as Conformance.READ, Conformance.WRITE, etc. + + Example: + ctx.conformance = Conformance.READ | Conformance.WRITE + """ + NONE: int = 0 + RESERVED_ZERO: int = 1 + GENERAL_PROTECTION: int = 2 + GENERAL_BLOCK_TRANSFER: int = 4 + READ: int = 8 + WRITE: int = 16 + UN_CONFIRMED_WRITE: int = 32 + DELTA_VALUE_ENCODING: int = 64 + RESERVED_SEVEN: int = 128 + ATTRIBUTE_0_SUPPORTED_WITH_SET: int = 256 + PRIORITY_MGMT_SUPPORTED: int = 512 + ATTRIBUTE_0_SUPPORTED_WITH_GET: int = 1024 + BLOCK_TRANSFER_WITH_GET_OR_READ: int = 2048 + BLOCK_TRANSFER_WITH_SET_OR_WRITE: int = 4096 + BLOCK_TRANSFER_WITH_ACTION: int = 8192 + MULTIPLE_REFERENCES: int = 16384 + INFORMATION_REPORT: int = 32768 + DATA_NOTIFICATION: int = 65536 + ACCESS: int = 131072 + PARAMETERIZED_ACCESS: int = 262144 + GET: int = 524288 + SET: int = 1048576 + SELECTIVE_ACCESS: int = 2097152 + EVENT_NOTIFICATION: int = 4194304 + ACTION: int = 8388608 + +class DLMSContext: + """ + DLMSContext object for session and configuration management. + + Attributes: + conformance (int): Conformance flags (see Conformance enum). + maxReceivePduSize (int): Maximum receive PDU size. + maxSendPduSize (int): Maximum send PDU size. + dlmsVersionNumber (int): DLMS version number. + qualityOfService (int): Quality of service. + + Example: + ctx = DLMSContext(conformance=Conformance.READ | Conformance.WRITE, maxReceivePduSize=1024) + """ + conformance: int + maxReceivePduSize: int + maxSendPduSize: int + dlmsVersionNumber: int + qualityOfService: int + def __init__(self, **kwargs): ... + + +class Unit: + """ + DLMS Unit enum. Use as Unit.KWH, Unit.VOLTAGE, etc. + + Example: + reg.unit = Unit.KWH + reg.unit = Unit.VOLTAGE + """ + NONE: int = 0 + YEAR: int = 1 + MONTH: int = 2 + WEEK: int = 3 + DAY: int = 4 + HOUR: int = 5 + MINUTE: int = 6 + SECOND: int = 7 + PHASE_ANGLE_DEGREE: int = 8 + TEMPERATURE: int = 9 + LOCAL_CURRENCY: int = 10 + LENGTH: int = 11 + SPEED: int = 12 + VOLUME_CUBIC_METER: int = 13 + CORRECTED_VOLUME: int = 14 + VOLUME_FLUX_HOUR: int = 15 + CORRECTED_VOLUME_FLUX_HOUR: int = 16 + VOLUME_FLUX_DAY: int = 17 + CORRECTED_VOLUME_FLUX_DAY: int = 18 + VOLUME_LITER: int = 19 + MASS_KG: int = 20 + FORCE: int = 21 + ENERGY: int = 22 + PRESSURE_PASCAL: int = 23 + PRESSURE_BAR: int = 24 + ENERGY_JOULE: int = 25 + THERMAL_POWER: int = 26 + ACTIVE_POWER: int = 27 + APPARENT_POWER: int = 28 + REACTIVE_POWER: int = 29 + ACTIVE_ENERGY: int = 30 + APPARENT_ENERGY: int = 31 + REACTIVE_ENERGY: int = 32 + CURRENT: int = 33 + ELECTRICAL_CHARGE: int = 34 + VOLTAGE: int = 35 + ELECTRICAL_FIELD_STRENGTH: int = 36 + CAPACITY: int = 37 + RESISTANCE: int = 38 + RESISTIVITY: int = 39 + MAGNETIC_FLUX: int = 40 + INDUCTION: int = 41 + MAGNETIC: int = 42 + INDUCTIVITY: int = 43 + FREQUENCY: int = 44 + ACTIVE: int = 45 + REACTIVE: int = 46 + APPARENT: int = 47 + V260: int = 48 + A260: int = 49 + MASS_KG_PER_SECOND: int = 50 + CONDUCTANCE: int = 51 + KELVIN: int = 52 + RU2H: int = 53 + RI2H: int = 54 + CUBIC_METER_RV: int = 55 + PERCENTAGE: int = 56 + AMPERE_HOURS: int = 57 + ENERGY_PER_VOLUME: int = 60 + WOBBE: int = 61 + MOLE_PERCENT: int = 62 + MASS_DENSITY: int = 63 + PASCAL_SECOND: int = 64 + JOULE_KILOGRAM: int = 65 + PRESSURE_GRAM_PER_SQUARE_CENTIMETER: int = 66 + PRESSURE_ATMOSPHERE: int = 67 + SIGNAL_STRENGTH_MILLI_WATT: int = 70 + SIGNAL_STRENGTH_MICRO_VOLT: int = 71 + DB: int = 72 + INCH: int = 128 + FOOT: int = 129 + POUND: int = 130 + FAHRENHEIT: int = 131 + RANKINE: int = 132 + SQUARE_INCH: int = 133 + SQUARE_FOOT: int = 134 + ACRE: int = 135 + CUBIC_INCH: int = 136 + CUBIC_FOOT: int = 137 + OTHER: int = 254 + NO_UNIT: int = 255 + + +class SecurityPolicy: + """ + DLMS SecurityPolicy enum. Use as SecurityPolicy.AUTHENTICATED, etc. + + Example: + sec.security_policy = SecurityPolicy.AUTHENTICATED_ENCRYPTED + """ + NOTHING: int = 0 + AUTHENTICATED: int = 1 + ENCRYPTED: int = 2 + AUTHENTICATED_ENCRYPTED: int = 3 + AUTHENTICATED_REQUEST: int = 4 + ENCRYPTED_REQUEST: int = 8 + DIGITALLY_SIGNED_REQUEST: int = 16 + AUTHENTICATED_RESPONSE: int = 32 + ENCRYPTED_RESPONSE: int = 64 + DIGITALLY_SIGNED_RESPONSE: int = 128 + +def get_all_objects() -> list: + """Returns a list of all DLMS objects currently registered. Use for debug purposes only.""" + ... + +def print_all_objects() -> None: + """Prints all DLMS objects to the console/log.""" + ... + +def set_default_clock(clock: Clock) -> None: + """Sets the default DLMS clock object.""" + ... + +def set_serial_number(serial: int) -> None: + """Sets the DLMS device serial number.""" + ... + +def get_serial_number() -> int: + """Gets the DLMS device serial number.""" + ... + +def set_flag_id(flag_id: str) -> None: + """Sets the DLMS flag ID.""" + ... + +def get_flag_id() -> str: + """Gets the DLMS flag ID.""" + ... + +def set_hdlc(cfg: IecHdlcSetup) -> None: + """Configures IEC HDLC settings for DLMS communications.""" + ... + +def uart_open(port: Optional[int] = None) -> int: + """Opens UART port for DLMS communications. + + :param port: UART port number, defaults to `UART2` if not specified + :return: `0` - Successful execution; `-1` - Failed execution + :raise ValueError: If invalid port number provided + """ + ... + +def uart_close() -> int: + """Closes the UART port used for DLMS communications. + + :return: `0` - Successful execution + """ + ... + +class IecHdlcSetup: + """ + DLMS IEC HDLC Setup object. + + Attributes: + logical_name (bytes): DLMS logical name (OBIS code) as bytes. + commSpeed (int): Communication speed (baud rate, e.g. 9600). + windowSizeRx (int): Receive window size. + windowSizeTx (int): Transmit window size. + maxInfoLenTx (int): Maximum info length for transmit. + maxInfoLenRx (int): Maximum info length for receive. + timeout (int): Inactivity timeout (seconds). + deviceAddr (int): Device address (default 0x10). + + Example: + hdlc = IecHdlcSetup("0.0.22.0.0.255", commSpeed=9600, windowSizeRx=1, windowSizeTx=1, + maxInfoLenTx=128, maxInfoLenRx=128, timeout=120, deviceAddr=0x10) + hdlc.commSpeed = 19200 + hdlc.windowSizeRx = 2 + hdlc.deviceAddr = 0x20 + """ + logical_name: bytes + commSpeed: int + windowSizeRx: int + windowSizeTx: int + maxInfoLenTx: int + maxInfoLenRx: int + timeout: int + deviceAddr: int + def __init__( + self, + logical_name: str, + commSpeed: int = 9600, + windowSizeRx: int = 1, + windowSizeTx: int = 1, + maxInfoLenTx: int = 128, + maxInfoLenRx: int = 128, + timeout: int = 120, + deviceAddr: int = 0x10 + ): ... + +class Clock: + """ + DLMS Clock object. + + Attributes: + logical_name (bytes): DLMS logical name (OBIS code) as bytes. + time (tuple): Current time as (year, month, day, hour, minute, second). + begin (tuple): Begin time as (year, month, day, hour, minute, second). + end (tuple): End time as (year, month, day, hour, minute, second). + time_zone (int): Time zone offset. + deviation (int): Deviation (minutes). + base (int): Clock base (see Clock.BASE_* enum). + status (int): Status flags. + enabled (bool): Whether clock is enabled. + + Enum values: + BASE_NONE: int = 0 + BASE_CRYSTAL: int = 1 + BASE_FREQUENCY_50: int = 2 + BASE_FREQUENCY_60: int = 3 + BASE_GPS: int = 4 + BASE_RADIO: int = 5 + + Example: + clk = Clock("0.0.1.0.0.255", time_zone=0, deviation=60, base=Clock.BASE_FREQUENCY_50) + clk.time = (2025, 8, 8, 12, 0, 0) + clk.enabled = True + """ + logical_name: bytes + time: tuple + begin: tuple + end: tuple + time_zone: int + deviation: int + base: int + status: int + enabled: bool + BASE_NONE: int = 0 + BASE_CRYSTAL: int = 1 + BASE_FREQUENCY_50: int = 2 + BASE_FREQUENCY_60: int = 3 + BASE_GPS: int = 4 + BASE_RADIO: int = 5 + def __init__( + self, + logical_name: str, + begin: tuple = (...), + end: tuple = (...), + time_zone: int = 0, + deviation: int = 60, + base: int = BASE_FREQUENCY_50 + ): ... \ No newline at end of file diff --git a/quecpython_stubs/ethernet.pyi b/quecpython_stubs/ethernet.pyi index 9c92d2a..83a54f2 100644 --- a/quecpython_stubs/ethernet.pyi +++ b/quecpython_stubs/ethernet.pyi @@ -8,7 +8,7 @@ The following example is only for NIC application configuration on the module. E Some NICs are not applicable to the following examples. Please use NICs according to the corresponding instructions for different NIC drivers. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/peripherals/ethernet.html +https://python.quectel.com/doc/quecpython/API_reference/en/peripherals/ethernet.html """ @@ -18,7 +18,7 @@ class W5500(object): This class controls Ethernet NIC devices of W5500. Currently, only EC600N and EC600U module series support this feature. - Descriptions: https://python.quectel.com/doc/API_reference/en/peripherals/ethernet.W5500.html + Descriptions: https://python.quectel.com/doc/quecpython/API_reference/en/peripherals/ethernet.W5500.html """ def __init__(self, mac, ip='', subnet='', gateway='', spi_port=-1, spi_cs_pin=-1, extint_pin=-1, reset_pin=-1, work_mode=0): @@ -92,7 +92,7 @@ class DM9051(object): This class controls Ethernet NIC devices of DM9051. Currently, only EC600N module series support this feature. - Descriptions: https://python.quectel.com/doc/API_reference/en/peripherals/ethernet.DM9051.html + Descriptions: https://python.quectel.com/doc/quecpython/API_reference/en/peripherals/ethernet.DM9051.html """ def __init__(self, mac, ip='', subnet='', gateway='', spi_port=-1,spi_cs_pin=-1): @@ -156,7 +156,7 @@ class CH395(object): This class controls Ethernet NIC devices of CH395. Currently, only EC600N module series support this feature. - Descriptions: https://python.quectel.com/doc/API_reference/en/peripherals/ethernet.CH395.html + Descriptions: https://python.quectel.com/doc/quecpython/API_reference/en/peripherals/ethernet.CH395.html """ def __init__(self, mac, ip='', subnet='', gateway='', spi_port=-1, spi_cs_pin=-1, extint_pin=-1, reset_pin=-1, work_mode=0): @@ -241,7 +241,7 @@ class YT8512H(object): This class controls Ethernet NIC devices of YT8512H and SZ18201. Currently, only EC600A module series support this feature. - Descriptions: https://python.quectel.com/doc/API_reference/en/peripherals/ethernet.YT8512H.html + Descriptions: https://python.quectel.com/doc/quecpython/API_reference/en/peripherals/ethernet.YT8512H.html """ def __init__(self, mac, ip='', subnet='', gateway=''): @@ -315,3 +315,23 @@ class YT8512H(object): active bool Whether NIC is activated. True and False respectively indicate enable and disable, which correspond to set_up and set_down. link bool Whether the network cable of NIC is connected. True and False respectively indicate the network cable is connected and is not connected. """ + + + def speed(self): + """Get the current upstream and downstream speed of the network interface. + + :return: A tuple containing two integers: (tx_speed, rx_speed) + Parameter Type Description + tx int Current data transmission rate in bits per second (bps) + rx int Current data reception rate in bits per second (bps) + """ + + def node(self): + """Get the list of currently connected terminals to the network interface. + + :return: A list of tuples, each containing information about a connected terminal. + Parameter Type Description + mac bytearray MAC address of the terminal (6 bytes) + ip str IP address of the terminal (in string format) + time int Connection duration in seconds + """ \ No newline at end of file diff --git a/quecpython_stubs/example.pyi b/quecpython_stubs/example.pyi index 60f869a..583db77 100644 --- a/quecpython_stubs/example.pyi +++ b/quecpython_stubs/example.pyi @@ -3,7 +3,7 @@ Function: This document introduces how to execute Python scripts on the command line or in the code. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/syslib/example.html +https://python.quectel.com/doc/quecpython/API_reference/en/syslib/example.html """ diff --git a/quecpython_stubs/fota.pyi b/quecpython_stubs/fota.pyi index 8723349..f9e107e 100644 --- a/quecpython_stubs/fota.pyi +++ b/quecpython_stubs/fota.pyi @@ -3,7 +3,7 @@ Function: fota provides the feature of firmware upgrade. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/syslib/fota.html +https://python.quectel.com/doc/quecpython/API_reference/en/syslib/fota.html """ diff --git a/quecpython_stubs/gc.pyi b/quecpython_stubs/gc.pyi index 9730e75..44e8565 100644 --- a/quecpython_stubs/gc.pyi +++ b/quecpython_stubs/gc.pyi @@ -4,7 +4,7 @@ gc module realizes the garbage collection of the memory, and subsets of the corr See CPython file gc for more detailed information: https://docs.python.org/3.5/library/gc.html#module-gc Descriptions taken from: -https://python.quectel.com/doc/API_reference/zh/stdlib/gc.html +https://python.quectel.com/doc/quecpython/API_reference/en/stdlib/gc.html """ diff --git a/quecpython_stubs/gnss.pyi b/quecpython_stubs/gnss.pyi index 1801d92..6034b6f 100644 --- a/quecpython_stubs/gnss.pyi +++ b/quecpython_stubs/gnss.pyi @@ -7,7 +7,7 @@ Currently, for L76K module, the data got through the interface provided by this Note: Currently, only EC600S/EC600N/EC800N/EC200U/EC600U/EC600M/EC800M series module supports this method. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/gnsslib/gnss.html +https://python.quectel.com/doc/quecpython/API_reference/en/gnsslib/gnss.html """ diff --git a/quecpython_stubs/log.pyi b/quecpython_stubs/log.pyi index c4c1f82..1fa61ac 100644 --- a/quecpython_stubs/log.pyi +++ b/quecpython_stubs/log.pyi @@ -3,7 +3,7 @@ Function: A log is a tool used to record the runtime state of an application in program development, as well as help developers diagnose and troubleshoot problems. Developers can quickly identify the root causes of problems and better understand the behaviors and performance of applications by viewing logs. log feature can output different log levels, including the DEBUG level, WARNING level, and ERROR level. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/syslib/log.html +https://python.quectel.com/doc/quecpython/API_reference/en/syslib/log.html """ diff --git a/quecpython_stubs/machine.pyi b/quecpython_stubs/machine.pyi index 3ba6c98..9d6bff8 100644 --- a/quecpython_stubs/machine.pyi +++ b/quecpython_stubs/machine.pyi @@ -4,14 +4,14 @@ This module contains features related to the hardware on a particular circuit bo Most of the features in this module allow direct and unrestricted access to and control of the hardware on the system. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/peripherals/machine.html +https://python.quectel.com/doc/quecpython/API_reference/en/peripherals/machine.html """ class Pin(object): """Pin - Descriptions: https://python.quectel.com/doc/API_reference/en/peripherals/machine.Pin.html) + Descriptions: https://python.quectel.com/doc/quecpython/API_reference/en/peripherals/machine.Pin.html) Description of GPIO corresponding pin numbers: GPIO pin numbers provided in the document correspond to external pin numbers of the module. For example, for EC100Y-CN module, GPIO1 corresponds to pin22, which is an external pin number of the module. @@ -112,7 +112,7 @@ class Pin(object): class UART(object): """UART - Descriptions: https://python.quectel.com/doc/API_reference/en/peripherals/machine.UART.html + Descriptions: https://python.quectel.com/doc/quecpython/API_reference/en/peripherals/machine.UART.html This class transmits data through the UART. When UART1 of EC600M/EC800M/EG912N series module is in flowctl=1 state, modules only map UART1 to different pins but flow control is not enabled. @@ -192,7 +192,7 @@ class UART(object): class Timer(object): """Control Hardware Timers - Descriptions: https://python.quectel.com/doc/API_reference/en/peripherals/machine.Timer.html + Descriptions: https://python.quectel.com/doc/quecpython/API_reference/en/peripherals/machine.Timer.html This class provides the method of controlling hardware timer. Note: For Timer0 to Timer3, each of them can only execute one task at the same time and multiple objects cannot use the same timer. @@ -231,7 +231,7 @@ class Timer(object): class ExtInt(object): """This class configures I/O pins to interrupt when external events occur. - Descriptions: https://python.quectel.com/doc/API_reference/zh/peripherals/machine.ExtInt.html + Descriptions: https://python.quectel.com/doc/quecpython/API_reference/en/peripherals/machine.ExtInt.html """ def __init__(self, GPIOn, mode, pull, callback): @@ -290,7 +290,7 @@ class ExtInt(object): class RTC(object): """This class provides methods of getting and setting RTC. - Descriptions: https://python.quectel.com/doc/API_reference/zh/peripherals/machine.RTC.html + Descriptions: https://python.quectel.com/doc/quecpython/API_reference/en/peripherals/machine.RTC.html For BC25PA series module, it provides the feature of waking up modules from deep sleep and software power-off state. Only EC600U and EC200U series modules support automatic power-on. It means that if you power off the module after RTC alarm is set, the module will power on automatically when the alarm time expires. @@ -349,7 +349,7 @@ class RTC(object): class I2C(object): """Two-wire Serial Protocol - Descriptions: https://python.quectel.com/doc/API_reference/zh/peripherals/machine.I2C.html + Descriptions: https://python.quectel.com/doc/quecpython/API_reference/en/peripherals/machine.I2C.html This class is designed for the two-wire serial protocol for communication between devices. """ @@ -398,7 +398,7 @@ class I2C(object): class I2C_simulation(object): """This class is designed for GPIO simulating standard I2C protocol. - Descriptions: https://python.quectel.com/doc/API_reference/zh/peripherals/machine.I2C_simulation.html + Descriptions: https://python.quectel.com/doc/quecpython/API_reference/en/peripherals/machine.I2C_simulation.html Except for creating the object, all other operations (read and write) are consistent with I2C communication. """ @@ -437,7 +437,7 @@ class I2C_simulation(object): class SPI(object): """Serial Peripheral Interface Bus Protocol - Descriptions: https://python.quectel.com/doc/API_reference/zh/peripherals/machine.SPI.html + Descriptions: https://python.quectel.com/doc/quecpython/API_reference/en/peripherals/machine.SPI.html This class provides bus protocol of serial peripheral interface (SPI) . """ @@ -506,7 +506,7 @@ class SPI(object): class SoftSPI(object): """Software Implementation of SPI Bus Protocol. - Descriptions: https://python.quectel.com/doc/API_reference/zh/peripherals/machine.SoftSPI.html + Descriptions: https://python.quectel.com/doc/quecpython/API_reference/en/peripherals/machine.SoftSPI.html This class provides bus protocol of Serial Peripheral Interface (SPI). EC600E/EC800E module supports this feature. @@ -575,7 +575,7 @@ class SoftSPI(object): class LCD(object): """LCD Driver - Descriptions: https://python.quectel.com/doc/API_reference/zh/peripherals/machine.LCD.html + Descriptions: https://python.quectel.com/doc/quecpython/API_reference/en/peripherals/machine.LCD.html This class controls LCD. Supported module models are as follows: @@ -759,7 +759,8 @@ class LCD(object): def lcd_show(self, file_name, start_x, start_y, width, hight): """This method displays images by reading files. - + Modules that support this method: EC600K/EC800K/EG800P series module. + This file is a bin file generated by Image2Lcd. If the image header file is checked, you needn’t to enter width and height. :param file_name: String type. Image name to be displayed. @@ -772,6 +773,7 @@ class LCD(object): def lcd_show_jpg(self, file_name, start_x, start_y): """This method displays JPEG images by reading files. + Modules that support this method: EC600K/EC800K/EG800P series module. :param file_name: String type. Image name needs to be displayed. :param start_x: Integer type. The start x coordinate. @@ -783,7 +785,7 @@ class LCD(object): class WDT(object): """Watchdog Timer - Descriptions: https://python.quectel.com/doc/API_reference/zh/peripherals/machine.WDT.html + Descriptions: https://python.quectel.com/doc/quecpython/API_reference/en/peripherals/machine.WDT.html This class provides system restart operation when application program exception occurs. """ @@ -810,7 +812,7 @@ class WDT(object): class KeyPad(object): """Matrix Keyboard - Descriptions: https://python.quectel.com/doc/API_reference/zh/peripherals/machine.KeyPad.html + Descriptions: https://python.quectel.com/doc/quecpython/API_reference/en/peripherals/machine.KeyPad.html This class provides the matrix keyboard interface. EC600SCN_LB, EC800NCN_LA, EC600NCN_LC, EC200UCN_LB, EC600UCN_LB, EC600MCN_LA, EC800MCN_LA, EC800MCN_GA, EG912NEN_AA series module is supported this feature. @@ -849,3 +851,42 @@ class KeyPad(object): :return: 0 - Successful execution; -1 - Failed execution """ + + +class OneWire(object): + """Single-Wire Bus Communication + + https://developer.quectel.com/doc/quecpython/API_reference/en/peripherals/machine.OneWire.html + + This class provides single-wire (1-Wire) communication functionality. + Currently only supported on EC200U/EC600U/EG912U/EG915U series modules. + """ + + def __init__(self, GPIO): + """ + Create a OneWire object. + + :param GPIO: int type. The GPIO pin number to use (e.g., OneWire.GPIO19). + """ + + def reset(self): + """Reset the bus and check device response + + Usage note: This method must be called before any read/write operations. + + :return: Integer value. 0 indicates proper response from device, -1 indicates no response. + """ + + def read(self, len): + """Read data from the bus + + :param len: int type. Length of data to read. + :return: bytes object containing the read data. + """ + + def write(self, data): + """Write data to the bus + + :param data: bytes type. Data to be written. + :return: Integer value 0. + """ \ No newline at end of file diff --git a/quecpython_stubs/math.pyi b/quecpython_stubs/math.pyi index 2643730..86b115f 100644 --- a/quecpython_stubs/math.pyi +++ b/quecpython_stubs/math.pyi @@ -4,7 +4,7 @@ Math module provides mathematical operation functions, and realizes subsets of t See CPython file math for more detailed information: https://docs.python.org/3.5/library/math.html#module-math Descriptions taken from: -https://python.quectel.com/doc/API_reference/zh/stdlib/math.html +https://python.quectel.com/doc/quecpython/API_reference/en/stdlib/math.html """ def pow(x, y): diff --git a/quecpython_stubs/misc/Power.pyi b/quecpython_stubs/misc/Power.pyi index 8973994..ef6a6e8 100644 --- a/quecpython_stubs/misc/Power.pyi +++ b/quecpython_stubs/misc/Power.pyi @@ -3,7 +3,7 @@ Function: Module features: power off, reboot software, get the power-on reason, get the last power-off reason and get battery voltage. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/peripherals/misc.Power.html +https://python.quectel.com/doc/quecpython/API_reference/en/peripherals/misc.Power.html """ def powerDown(): diff --git a/quecpython_stubs/misc/USBNET.pyi b/quecpython_stubs/misc/USBNET.pyi index 55e4661..b02880f 100644 --- a/quecpython_stubs/misc/USBNET.pyi +++ b/quecpython_stubs/misc/USBNET.pyi @@ -5,7 +5,7 @@ Module feature: USB network card. Note: EC600S, EC600N, EC800N, EC200U, EC600U and EC600M series modules support this feature. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/peripherals/misc.USBNET.html +https://python.quectel.com/doc/quecpython/API_reference/en/peripherals/misc.USBNET.html """ diff --git a/quecpython_stubs/misc/__init__.py b/quecpython_stubs/misc/__init__.py index 6b3485a..cfb7733 100644 --- a/quecpython_stubs/misc/__init__.py +++ b/quecpython_stubs/misc/__init__.py @@ -3,7 +3,7 @@ Miscellaneous Features, Module feature: shutdown, software restart, PWM and ADC. Descriptions taken from: -https://python.quectel.com/doc/API_reference/zh/peripherals/misc.html +https://python.quectel.com/doc/quecpython/API_reference/en/peripherals/misc.html """ @@ -18,7 +18,7 @@ def antennaSecRXOffCtrl(*args): class PowerKey(object): """PowerKey Callback and Registration. - Descriptions: https://python.quectel.com/doc/API_reference/en/peripherals/misc.PowerKey.html + Descriptions: https://python.quectel.com/doc/quecpython/API_reference/en/peripherals/misc.PowerKey.html This class provides the feature of triggering the callback function when registering the powerkey event. """ @@ -36,7 +36,7 @@ def powerKeyEventRegister(self, usrFun): class PWM(object): """Pulse Width Modulation. - Descriptions: https://python.quectel.com/doc/API_reference/en/peripherals/misc.PWM.html + Descriptions: https://python.quectel.com/doc/quecpython/API_reference/en/peripherals/misc.PWM.html This class provides the feature of PWM output. Note: BC25 series module does not support this feature. @@ -86,7 +86,7 @@ def close(self): class ADC(object): """Voltage Collection. - Descriptions: https://python.quectel.com/doc/API_reference/en/peripherals/misc.ADC.html + Descriptions: https://python.quectel.com/doc/quecpython/API_reference/en/peripherals/misc.ADC.html This class collects voltage signals. """ @@ -118,7 +118,7 @@ def close(self): class USB(object): """USB Plug-in/Out Detection - Descriptions: https://python.quectel.com/doc/API_reference/en/peripherals/misc.USB.html + Descriptions: https://python.quectel.com/doc/quecpython/API_reference/en/peripherals/misc.USB.html This class provides USB plug-in/out detection. Note: EC600S, EC600N, EC800N, EG912N, EC200U, EC600U, EG915U, EC600M, EC800M, EC200A series modules support this feature. diff --git a/quecpython_stubs/modem.pyi b/quecpython_stubs/modem.pyi index ae9976e..5412caa 100644 --- a/quecpython_stubs/modem.pyi +++ b/quecpython_stubs/modem.pyi @@ -3,7 +3,7 @@ Function: The modem module provides the method of reading device information. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/syslib/modem.html +https://python.quectel.com/doc/quecpython/API_reference/en/syslib/modem.html """ @@ -40,3 +40,13 @@ def getDevProductId(): :return: If successful, it returns the device manufacture ID in string type. If failed, it returns the integer value -1. """ + +def getDevMAC(): + """Get Device MAC Address + + This method retrieves the device's MAC address. + Currently only supported on FCM360W modules. + + :return: On success - Returns the device MAC address as a string (format: "XX:XX:XX:XX:XX:XX") + On failure - Returns integer -1 + """ \ No newline at end of file diff --git a/quecpython_stubs/net.pyi b/quecpython_stubs/net.pyi index a29fdf1..4525cde 100644 --- a/quecpython_stubs/net.pyi +++ b/quecpython_stubs/net.pyi @@ -5,9 +5,9 @@ Note: It is recommended that you should configure the APN information of the cor See dataCall.setPDPContext for methods of how to configure the APN information. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/iotlib/net.html +https://python.quectel.com/doc/quecpython/API_reference/en/iotlib/net.html """ - +from typing import Union def csqQueryPoll(): """This method gets the signal strength. @@ -67,6 +67,12 @@ def getCellInfo(): Currently, it is meaningful to get this parameter only for BC25/BG95/EC600E/EC800E series module. This parameter is meaningless for other modules. """ +def currentCellInfo(): + return getCellInfo() + """ + The customer wants to use it in this way, so it was encapsulated. + """ + def getConfig(): """This method gets the current network mode and roaming configuration. @@ -312,3 +318,89 @@ def bandRst(): :return: 0 - Successful execution; -1 - Failed execution. """ + +def setCallback(handler: callable) -> int: + """Register a network event callback function + + :param handler: Python callable object + + :return: 0 - Successful execution; -1 - Failed execution. + """ + + +""" +Network Timer and Status Configuration +AT command interface for network parameters. +""" + +def getT3402() -> Union[str, int]: + """Get T3402 timer value + + :return: + str - Timer value string on success + -1 - Error occurred + """ + +def getT3412() -> Union[str, int]: + """Get T3412 timer value + + :return: + str - Timer value string on success + -1 - Error occurred + """ + +def getT3324() -> Union[str, int]: + """Get T3324 timer value + + :return: + str - Timer value string on success + -1 - Error occurred + """ + +def getTeDRX() -> Union[str, int]: + """Get eDRX configuration + + :return: + str - Configuration string on success + -1 - Error occurred + """ + +def getTPTW() -> Union[str, int]: + """Get Paging Time Window value + + :return: + str - Paging window string on success + -1 - Error occurred + """ + +def getqRxlevMin(flag: int = None) -> Union[str, int, tuple]: + """Get qRxlevMin parameters + + :param flag: Optional flag (0 or 1) + When 1, returns tuple of three values + :return: + str - Single value when flag=None or 0 + tuple - (qRxlevMin, qRxlevMinCE, qRxlevMinCE1) when flag=1 + -1 - Error occurred + :raises ValueError: If flag is not 0 or 1 + """ + +def getRejectCause() -> Union[str, int]: + """Get network reject cause value + + :return: + str - Reject cause string on success + -1 - Error occurred + """ + +def causeInfo(mode: int = None) -> int: + """Get or set cause info configuration + + :param mode: Optional configuration mode (0 or 1) + When omitted, returns current mode + :return: + Current mode (0 or 1) when getting + 0 if success when setting + -1 if error occurred + :raises ValueError: If mode is not 0 or 1 when setting + """ \ No newline at end of file diff --git a/quecpython_stubs/ntptime.pyi b/quecpython_stubs/ntptime.pyi index 278d573..f31e722 100644 --- a/quecpython_stubs/ntptime.pyi +++ b/quecpython_stubs/ntptime.pyi @@ -5,7 +5,7 @@ This feature is used for time synchronization. Note: You need to confirm with the carrier whether the current SIM card supports this feature. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/networklib/ntptime.html +https://python.quectel.com/doc/quecpython/API_reference/en/networklib/ntptime.html """ diff --git a/quecpython_stubs/osTimer.pyi b/quecpython_stubs/osTimer.pyi index 971219e..acfe569 100644 --- a/quecpython_stubs/osTimer.pyi +++ b/quecpython_stubs/osTimer.pyi @@ -3,7 +3,7 @@ Function: The module provides a timer interface for the underlying OS. The OS timer timeout will trigger the bound callback function. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/syslib/osTimer.html +https://python.quectel.com/doc/quecpython/API_reference/en/syslib/osTimer.html """ diff --git a/quecpython_stubs/pm.pyi b/quecpython_stubs/pm.pyi index 9099d98..f24a428 100644 --- a/quecpython_stubs/pm.pyi +++ b/quecpython_stubs/pm.pyi @@ -4,9 +4,10 @@ Power Management When there is no service being processed, the system is in the sleep status and enters a low-power mode. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/syslib/pm.html +https://python.quectel.com/doc/quecpython/API_reference/en/syslib/pm.html """ +from typing import Tuple, Union def create_wakelock(lock_name, name_size): """Creates a wakelock. @@ -117,3 +118,18 @@ def get_psm_time(): list[3] int ACT unit list[4] int Periodic value of ACT """ + +def get_psm_netinfo() -> Union[Tuple[int, int, int], int]: + """Retrieves current network Power Saving Mode configuration + + :return: + Success: Returns tuple of (psm_mode, tau, active_time) where: + psm_mode: int - Power Saving Mode status (0: disabled, 1: enabled) + tau: int - Tracking Area Update timer value (seconds) + active_time: int - Active time duration (seconds) + Failure: Returns -1 (only possible error value) + + Behavior strictly matches: + mp_obj_new_list(3, [...] -> Tuple[int,int,int] + mp_obj_new_int(-1) -> int + """ \ No newline at end of file diff --git a/quecpython_stubs/ql_fs.pyi b/quecpython_stubs/ql_fs.pyi index c8ec167..b403d2c 100644 --- a/quecpython_stubs/ql_fs.pyi +++ b/quecpython_stubs/ql_fs.pyi @@ -3,7 +3,7 @@ Function: This feature is used for advanced operations of files. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/syslib/ql_fs.html +https://python.quectel.com/doc/quecpython/API_reference/en/syslib/ql_fs.html """ diff --git a/quecpython_stubs/qrcode.pyi b/quecpython_stubs/qrcode.pyi index 63fde06..7cb134f 100644 --- a/quecpython_stubs/qrcode.pyi +++ b/quecpython_stubs/qrcode.pyi @@ -4,7 +4,7 @@ QR Code Display Feature introduction: generate a corresponding QR code according to the input content. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/medialib/qrcode.html#Display-QR-Code +https://python.quectel.com/doc/quecpython/API_reference/en/medialib/qrcode.html#Display-QR-Code """ diff --git a/quecpython_stubs/qth_bus.pyi b/quecpython_stubs/qth_bus.pyi new file mode 100644 index 0000000..2024433 --- /dev/null +++ b/quecpython_stubs/qth_bus.pyi @@ -0,0 +1,104 @@ +"""qth_bus.pyi""" + + +def sendTrans(mode, value) -> bool: + """Send a transaction to the device + + mode: Transaction mode + value: Transaction value + + return: True if the transaction was sent, False otherwise + """ + ... + + +def sendTsl(mode, value) -> bool: + """Send a TSL command to the device + + mode: TSL command mode + value: TSL command value + + return: True if the command was sent, False otherwise + """ + ... + + +def ackTsl(mode, value, pkgId) -> bool: + """Send an ACK to the device + + mode: ACK mode + value: ACK value + pkgId: Package ID + + return: True if the ACK was sent, False otherwise + """ + ... + + +def ackTslServer(mode, serverId, value, pkgId) -> bool: + """Send an ACK to the server + + mode: ACK mode + serverId: Server ID + value: ACK value + pkgId: Package ID + + return: True if the ACK was sent, False otherwise + """ + ... + + +def sendOutsideLocation(location): + """sendOutsideLocation location + + location: Location to send + """ + ... + + +def getDevInfo(idList): + """get device information + + idList: List of device IDs + """ + ... + +def ackDevInfo(idList, pkgId): + """ack devivce information + + idList: List of device IDs + pkgId: Package ID + """ + ... + + +def sendDevInfo(idList): + """send device information + + idList: List of device IDs + """ + ... + +def getDevStatus(idList): + """get device status + + idList: List of device IDs + """ + ... + + +def ackDevStatus(idList, pkgId): + """ack device status + + idList: List of device IDs + pkgId: Package ID + """ + ... + + +def sendDevStatus(idList): + """send device status + + idList: List of device IDs + """ + ... diff --git a/quecpython_stubs/qth_config.pyi b/quecpython_stubs/qth_config.pyi new file mode 100644 index 0000000..5c3cec4 --- /dev/null +++ b/quecpython_stubs/qth_config.pyi @@ -0,0 +1,125 @@ + +def save(): + """save configure to file""" + ... + + +def init(): + """init configure""" + ... + + +def setProductInfo(pk,ps) -> bool: + """Set product info + + pk: ProductKey generated when you create the product on Developer Center. + ps: ProductSecret generated when you create the product on Developer Center. + + :return:True: Successful execution,False: Failed execution + """ + ... + + +def setDevSecret(ds): + """set device secret + + ds: device secret + """ + ... + + +def setServer(url): + """set server url + + url: server url + """ + ... + + +def saveBootstrap(url, mcc): + """save bootstrap + + url: bootstrap url + mcc: mcc + """ + ... + + +def setLifetime(lifetime): + """set lifetime + + lifetime: lifetime + """ + ... + + +def setEventCb(eventlist)-> int: + """Set the callback function for the event + + eventlist: Event list + + :return:1: Successful execution,rest: Failed execution + """ + ... + + +def setMcuVer(comp_no, version, infoCB, resultCB) -> bool: + """Set the MCU version + + comp_no: Component number + version: MCU version + infoCB: Callback function for information + resultCB: Callback function for result + + :return:True: Successful execution,False: Failed execution + """ + ... + + +def setAppVer(version, resultCB): + """Set the application version + + version: App component version. + resultCB: Callback function of the App upgrade results. + """ + ... + + +def setOtaInfo(comp_no, version, comp_type): + """set ota information + + comp_no: component number + version: component version + comp_type: component type + """ + ... + + +def setBsEt(type): + """set broker security type + + type: tcp, psk, tls, cer + """ + ... + + +def getBsEt(): + """get broker ethernet type""" + ... + + +def getMqttCert(): + """get mqtt certificate""" + ... + + +def setOtaKey(key): + """set ota key + + key: ota key + """ + ... + +def getOtaKey(): + """get ota key""" + ... diff --git a/quecpython_stubs/qth_dmp.pyi b/quecpython_stubs/qth_dmp.pyi new file mode 100644 index 0000000..823ddcb --- /dev/null +++ b/quecpython_stubs/qth_dmp.pyi @@ -0,0 +1,66 @@ + +def bootstrap(et, pk, dk, mcc): + """bootstrap + + :param et: et + :param pk: pk + :param dk: dk + :param mcc: mcc + :return: + """ + ... + + +def state(): + """get state""" + ... + + +def register(url, lifetime, pk, ps, dk): + """mqtt register + + url: mqtt url + lifetime: lifetime + pk: pk + ps: ps + dk: dk + """ + ... + + +def login(url, lifetime, pk, ps, dk, ds): + """mqtt login + + url: mqtt url + lifetime: lifetime + pk: pk + ps: ps + dk: dk + ds: ds + """ + ... + + +def reset(url, lifetime, pk, ps, dk, ds): + """mqtt reset + + url: mqtt url + lifetime: lifetime + pk: pk + ps: ps + dk: dk + ds: ds + """ + ... + + +def send(topic_type, cmd, payload, pkgId=0, qos=0): + """mqtt send + + topic_type: topic_type + cmd: cmd + payload: payload + pkgId: pkgId + qos: qos + """ + ... diff --git a/quecpython_stubs/qth_file.pyi b/quecpython_stubs/qth_file.pyi new file mode 100644 index 0000000..620beca --- /dev/null +++ b/quecpython_stubs/qth_file.pyi @@ -0,0 +1,16 @@ + +def read_file(filename): + """read file + + :param filename: file name + """ + ... + + +def write_file(filename, file_json): + """write file + + :param filename: file name + :param file_json: file json + """ + ... diff --git a/quecpython_stubs/qth_init.pyi b/quecpython_stubs/qth_init.pyi new file mode 100644 index 0000000..2ae8392 --- /dev/null +++ b/quecpython_stubs/qth_init.pyi @@ -0,0 +1,20 @@ + + +def init(): + """QuecThing init""" + ... + + +def start(): + """QuecThing start""" + ... + + +def stop(): + """QuecThing stop""" + ... + + +def reset(): + """QuecThing reset""" + ... diff --git a/quecpython_stubs/qth_ota.pyi b/quecpython_stubs/qth_ota.pyi new file mode 100644 index 0000000..89b6de6 --- /dev/null +++ b/quecpython_stubs/qth_ota.pyi @@ -0,0 +1,62 @@ + + +def notify(val): + """QuecThing Ota notify + + val: notify value + """ + ... + + +def result(args): + """QuecThing Ota result + + args: result args + """ + ... + + +def fwInfo(val): + """firmware info + + val: firmware info + """ + ... + + +def otaRequest(): + """ota request""" + ... + + +def report(comp_type, comp_no, status_code): + """ota report + + comp_type: component type + comp_no: component no + status_code: status code + """ + ... + + +def otaAction(action): + """ota action + + action: ota action + """ + ... + + +def check(): + """ota check""" + ... + + +def appota(compo_type, compo_no, url): + """app ota + + compo_type: component type + compo_no: component no + url: url + """ + ... diff --git a/quecpython_stubs/qth_protocol.pyi b/quecpython_stubs/qth_protocol.pyi new file mode 100644 index 0000000..8599a69 --- /dev/null +++ b/quecpython_stubs/qth_protocol.pyi @@ -0,0 +1,37 @@ + + +def getPkgId(): + """get package id""" + ... + + +def format(pid, cmd, byte): + """format protocol + + pid: package id + cmd: command + byte: byte array + """ + ... + +def unformat(byte): + """unformat protocol + + byte: byte array + """ + ... + +def ttlv_format(dicts): + """ttlv format + + :param dicts: ttlv dicts + """ + ... + + +def ttlv_unformat(byte): + """ttlv unformat + + :param byte: ttlv byte + """ + ... diff --git a/quecpython_stubs/qth_tlsCert.pyi b/quecpython_stubs/qth_tlsCert.pyi new file mode 100644 index 0000000..d6517fc --- /dev/null +++ b/quecpython_stubs/qth_tlsCert.pyi @@ -0,0 +1,6 @@ + + +def getMqttCert(): + """get mqtt certificate""" + ... + diff --git a/quecpython_stubs/quecgnss.pyi b/quecpython_stubs/quecgnss.pyi index 71f8d80..dfdc4b6 100644 --- a/quecpython_stubs/quecgnss.pyi +++ b/quecpython_stubs/quecgnss.pyi @@ -4,7 +4,7 @@ This feature provides the APIs of the built-in GNSS feature. Only EC200UCNAA/EC200UCNLA/EC200UEUAA/EC800MCNGA/EC800GCNGA series module supports this feature. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/gnsslib/quecgnss.html +https://python.quectel.com/doc/quecpython/API_reference/en/gnsslib/quecgnss.html """ @@ -41,3 +41,130 @@ def read(size): size - Size of the data read. data - GNSS location data. """ + +def setPriority(Priority): + """Sets the priority between GNSS and LTE for radio resource usage. + + :param Priority: int. The priority value to set. Meaning: + Priority BG95M1/M3 + 0 GNSS > LTE + 1 LTE > GNSS + :return: int. 0 for success, -1 for failure. + """ + +def getPriority(): + """Gets the current priority between GNSS and LTE for radio resource usage. + + Priority BG95M1/M3 + 0 GNSS > LTE + 1 LTE > GNSS + :return: int. The current priority value. Meaning: + """ + +def configSet(config_type, config_value): + """Sets GNSS configuration parameters. + + :param config_type: int. Configuration option type: + Value Description + 0 Configure satellite system + 1 Configure output NMEA sentence type + 2 Configure AGPS enable status + 3 Configure APFLASH enable status + 4 Configure GNSS backup power status + + :param config_value: int. Configuration value based on config_type: + + For config_type = 0 (satellite system): + Value Description + 0 GPS + 1 GPS + BeiDou + 3 GPS + GLONASS + Galileo + 4 GPS + GLONASS + 5 GPS + BeiDou + Galileo + 6 GPS + Galileo + 7 BeiDou + + For config_type = 1 (NMEA sentence type - bitmap): + Value (decimal) Binary Description + 0 000000 Disable all + 1 000001 GGA + 2 000010 RMC + 4 000100 GSV + 8 001000 GSA + 16 010000 VTG + 32 100000 GLL + 63 111111 All output + + For config_type = 2 (AGPS enable): + Value Description + 0 Disable + 1 Enable + + For config_type = 3 (APFLASH enable): + Value Description + 0 Disable + 1 Enable + + For config_type = 4 (Backup power - EC800M GB/GD series only): + Value Description + 0 Disable + 1 Enable + + :return: int. 0 for success, non-zero for failure. + """ + +def configGet(config_type): + """Gets current GNSS configuration parameters. + + :param config_type: int. Configuration option type: + Value Description + 0 Satellite system + 1 Output NMEA sentence type + 2 AGPS enable status + 3 APFLASH enable status + 4 GNSS backup power status + + :return: int. Current configuration value. Meaning: + + For config_type = 0 (satellite system): + Value Description + 0 GPS + 1 GPS + BeiDou + 3 GPS + GLONASS + Galileo + 4 GPS + GLONASS + 5 GPS + BeiDou + Galileo + 6 GPS + Galileo + 7 BeiDou + -1 Failure + + For config_type = 1 (NMEA sentence type): + Value Description + 0 Disabled + 1 GGA + 2 RMC + 4 GSV + 8 GSA + 16 VTG + 32 GLL + 63 All enabled + Other Bitwise combination of enabled sentences + -1 Failure + + For config_type = 2 (AGPS status): + Value Description + 0 Disabled + 1 Enabled + -1 Failure + + For config_type = 3 (APFLASH status): + Value Description + 0 Disabled + 1 Enabled + -1 Failure + + For config_type = 4 (Backup power status): + Value Description + 0 Disabled + 1 Enabled + -1 Failure + """ \ No newline at end of file diff --git a/quecpython_stubs/queue.pyi b/quecpython_stubs/queue.pyi index ea8ce5d..92e3c3c 100644 --- a/quecpython_stubs/queue.pyi +++ b/quecpython_stubs/queue.pyi @@ -3,7 +3,7 @@ Function: This feature is used for inter-thread communication. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/syslib/Queue.html +https://python.quectel.com/doc/quecpython/API_reference/en/syslib/Queue.html """ diff --git a/quecpython_stubs/request.pyi b/quecpython_stubs/request.pyi index 7b9a15e..443438b 100644 --- a/quecpython_stubs/request.pyi +++ b/quecpython_stubs/request.pyi @@ -3,7 +3,7 @@ Function: The request feature is used for sending an HTTP request to a server, fetching data from a server, or submitting data to a server. Multiple request methods, including GET, POST, and PUT are supported. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/networklib/request.html +https://python.quectel.com/doc/quecpython/API_reference/en/networklib/request.html """ diff --git a/quecpython_stubs/securedata.pyi b/quecpython_stubs/securedata.pyi index 5f55678..6426b09 100644 --- a/quecpython_stubs/securedata.pyi +++ b/quecpython_stubs/securedata.pyi @@ -5,7 +5,7 @@ The module provides a bare flash area and a dedicated read/write interface for y Besides, the module also provides a storage and read interface but deletion interface is not provided. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/syslib/securedata.html +https://python.quectel.com/doc/quecpython/API_reference/en/syslib/securedata.html """ diff --git a/quecpython_stubs/sim.pyi b/quecpython_stubs/sim.pyi index e7d4310..63429eb 100644 --- a/quecpython_stubs/sim.pyi +++ b/quecpython_stubs/sim.pyi @@ -4,7 +4,7 @@ This feature provides you with the SIM Card APIs, such as the methods of getting The IMSI, ICCID, and phone number can be gotten only when the SIM card status is 1. You can call sim.getstatus() to get the current SIM card status. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/iotlib/sim.html +https://python.quectel.com/doc/quecpython/API_reference/en/iotlib/sim.html """ def genericAccess(simId, cmd): @@ -259,3 +259,48 @@ def setSwitchcardCallback(usrFun): 8 - Failed switch :return: 0 - Successful execution; -1 - Failed execution """ + +class esim: + + def getEid() -> int: + """Set the ICCID of the eSIM card. + + :return: `ICCID` - Successful execution + """ + + def setCallback(usrFun:int) -> None: + """Notify the application layer of the results of downloading and installing the Profile. + + :return: `None` + """ + + def getProfileInfo(mode:int) -> list[dict]: + """Query the current SIM card configuration file + + :return: `list[dict]` - Successful execution + """ + + def profileOTA(activationCode, confirmationCode) -> int: + """Download and install the Operator Profile + + :param result: Result of OTA profile download. + :type result: Integer, 0: success, 1: failure + """ + + def profileHandle(profile_tag:int, iccid:str) -> int: + """Control the current SIM card configuration file + + :return: `0` - Successful execution; `-1` - Failed execution + """ + + def getProfileDelNotification() -> list[dict]: + """Obtain the configuration file to be deleted + + return:'The list of configuration files to be deleted' + """ + + def reportProfileDelNotification(iccid:str) -> list[dict]: + """Report the configuration file to be deleted + + return:'The list of configuration files to be deleted' + """ \ No newline at end of file diff --git a/quecpython_stubs/sms.pyi b/quecpython_stubs/sms.pyi index 56bd03b..baa8ac1 100644 Binary files a/quecpython_stubs/sms.pyi and b/quecpython_stubs/sms.pyi differ diff --git a/quecpython_stubs/sys.pyi b/quecpython_stubs/sys.pyi index 0a87590..39049fb 100644 --- a/quecpython_stubs/sys.pyi +++ b/quecpython_stubs/sys.pyi @@ -3,7 +3,7 @@ Function: System Related Features. Descriptions taken from: -https://python.quectel.com/doc/API_reference/zh/stdlib/sys.html +https://python.quectel.com/doc/quecpython/API_reference/en/stdlib/sys.html """ diff --git a/quecpython_stubs/sys_bus.pyi b/quecpython_stubs/sys_bus.pyi index c310d80..b97b8c8 100644 --- a/quecpython_stubs/sys_bus.pyi +++ b/quecpython_stubs/sys_bus.pyi @@ -3,7 +3,7 @@ Function: This feature subscribes to messages and publishes one-to-many broadcasts with multithreading, similar to an internal MQTT protocol. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/syslib/sys_bus.html +https://python.quectel.com/doc/quecpython/API_reference/en/syslib/sys_bus.html """ diff --git a/quecpython_stubs/system.pyi b/quecpython_stubs/system.pyi index de06562..2339637 100644 --- a/quecpython_stubs/system.pyi +++ b/quecpython_stubs/system.pyi @@ -4,7 +4,7 @@ This feature is used to configure the system parameter and features. Applicable modules: EC100Y(V0009) and above; EC600S(V0002) and above. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/syslib/system.html +https://python.quectel.com/doc/quecpython/API_reference/en/syslib/system.html """ diff --git a/quecpython_stubs/uasyncio.pyi b/quecpython_stubs/uasyncio.pyi index 565e5f8..52425d2 100644 --- a/quecpython_stubs/uasyncio.pyi +++ b/quecpython_stubs/uasyncio.pyi @@ -4,7 +4,7 @@ uasyncio is an asynchronous I/O library in MicroPython, also a lightweight subse uasyncio , with a small code size and low memory footprint, is suitable for embedded systems and resource–constrained devices. It provides a set of APIs and tools to create and manage coroutines, network and protocol–related classes that support asynchronous I/O. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/componentlib/uasyncio.html +https://python.quectel.com/doc/quecpython/API_reference/en/componentlib/uasyncio.html """ diff --git a/quecpython_stubs/ubinascii.pyi b/quecpython_stubs/ubinascii.pyi index 52bebe3..796d80c 100644 --- a/quecpython_stubs/ubinascii.pyi +++ b/quecpython_stubs/ubinascii.pyi @@ -4,7 +4,7 @@ The module realizes the conversion between binary data and various ASCII encodin See CPython file binascii for more detailed information: https://docs.python.org/3.5/library/binascii.html#module-binascii Descriptions taken from: -https://python.quectel.com/doc/API_reference/zh/stdlib/ubinascii.html +https://python.quectel.com/doc/quecpython/API_reference/en/stdlib/ubinascii.html """ diff --git a/quecpython_stubs/ucollections.pyi b/quecpython_stubs/ucollections.pyi index 70f97d6..74be406 100644 --- a/quecpython_stubs/ucollections.pyi +++ b/quecpython_stubs/ucollections.pyi @@ -5,7 +5,7 @@ This module realizes subsets of the corresponding CPython module. See CPython file collections for more detailed information: https://docs.python.org/3/library/collections.html Descriptions taken from: -https://python.quectel.com/doc/API_reference/zh/stdlib/ucollections.html +https://python.quectel.com/doc/quecpython/API_reference/en/stdlib/ucollections.html """ diff --git a/quecpython_stubs/uhashlib.pyi b/quecpython_stubs/uhashlib.pyi new file mode 100644 index 0000000..c7c5dda --- /dev/null +++ b/quecpython_stubs/uhashlib.pyi @@ -0,0 +1,53 @@ +""" +Function: +This module realizes the hash algorithm of the binary data. + +Descriptions taken from: +https://developer.quectel.com/doc/quecpython/API_reference/zh/stdlib/uhashlib.html +""" + +class SHA1: + """SHA1 hash algorithm. + :params bytes: Bytes data can be passed when creating a SHA1 hash object or via hash_obj.update(). + """ + def __init__(self,bytes): + """Initialize the SHA1 hash algorithm.""" + + def update(self, bytes): + """Update the hash algorithm with the data. + :params bytes: Bytes data can be passed when creating a SHA256 hash object or via hash_obj.update(). + """ + + def digest(self): + """Return the digest of the hash algorithm.""" + + +class SHA256: + """SHA256 hash algorithm. + :params bytes: Bytes data can be passed when creating a SHA256 hash object or via hash_obj.update(). + """ + + def __init__(self): + """Initialize the SHA256 hash algorithm.""" + + def update(self, bytes): + """Update the hash algorithm with the data.""" + + def digest(self): + """Return the digest of the hash algorithm.""" + +class MD5: + """MD5 hash algorithm. + :params bytes: Bytes data can be passed when creating a MD5 hash object or via hash_obj.update(). + """ + + def __init__(self): + """Initialize the MD5 hash algorithm.""" + + def update(self, bytes): + """Update the hash algorithm with the data.""" + + def digest(self): + """Return the digest of the hash algorithm.""" + +md5 = MD5 \ No newline at end of file diff --git a/quecpython_stubs/uio.pyi b/quecpython_stubs/uio.pyi index 07f8447..70e52de 100644 --- a/quecpython_stubs/uio.pyi +++ b/quecpython_stubs/uio.pyi @@ -4,7 +4,7 @@ uio contains additional types of stream (file-like) objects and helper functions For more information, refer to the original CPython documentation: https://docs.python.org/3.5/library/io.html#module-io. Descriptions taken from: -https://python.quectel.com/doc/API_reference/zh/stdlib/uio.html +https://python.quectel.com/doc/quecpython/API_reference/en/stdlib/uio.html """ @@ -21,3 +21,9 @@ def open(name, mode='r', **kwarg): :return:uio object – Successful execution :raise: OSError - Failed execution """ + + +def close(): + """Close the opened file. + + """ \ No newline at end of file diff --git a/quecpython_stubs/ujson.pyi b/quecpython_stubs/ujson.pyi index adaa715..ed355ee 100644 --- a/quecpython_stubs/ujson.pyi +++ b/quecpython_stubs/ujson.pyi @@ -4,7 +4,7 @@ ujson module realizes the convertion between the Python data object and the JSON See CPython file json for more detailed information: https://docs.python.org/3.5/library/json.html#module-json. Descriptions taken from: -https://python.quectel.com/doc/API_reference/zh/stdlib/ujson.html +https://python.quectel.com/doc/quecpython/API_reference/en/stdlib/ujson.html """ diff --git a/quecpython_stubs/umqtt.pyi b/quecpython_stubs/umqtt.pyi index c3e55a6..477748f 100644 --- a/quecpython_stubs/umqtt.pyi +++ b/quecpython_stubs/umqtt.pyi @@ -3,7 +3,7 @@ Function: This feature is used to create MQTT clients to publish and subscribe to topics. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/networklib/umqtt.html +https://python.quectel.com/doc/quecpython/API_reference/en/networklib/umqtt.html """ diff --git a/quecpython_stubs/uos.pyi b/quecpython_stubs/uos.pyi index 6c0fe45..4a77ceb 100644 --- a/quecpython_stubs/uos.pyi +++ b/quecpython_stubs/uos.pyi @@ -3,7 +3,7 @@ Function: uos module contains file system access and mounting building, and realizes subsets of the corresponding CPython module. See CPython file os for more detailed information. Descriptions taken from: -https://python.quectel.com/doc/API_reference/zh/stdlib/uos.html +https://python.quectel.com/doc/quecpython/API_reference/en/stdlib/uos.html """ from typing import Callable @@ -200,9 +200,22 @@ def VfsLfs1(readsize: int, progsize: int, lookahead: int, pname: str, spi_port: :return: VfsLfs1 object - Successful execution; OSError 19 - Failed execution. """ + +def VfsEmmc(reserved: str): + """Initializes EMMC storage using SDIO communication + + This method initializes EMMC storage for virtual file system (VFS) integration. + Currently only supported on EC200ACNLA platform. + + :param reserved: str type. Reserved parameter (not currently used). + :return: vfs object representing the EMMC storage. + :raises Exception: If initialization fails (e.g., unsupported platform or hardware error) + """ + def mount(vfs_obj, path: str): """Mounts the file system in substantial form (such as littleFS or FATFS) to the virtual file system(VFS). :param vfs_obj: vfs object. The object of the file system. :param path: String type. The root directory of the file system. """ + diff --git a/quecpython_stubs/uping.pyi b/quecpython_stubs/uping.pyi index 7bfffa9..b476f51 100644 --- a/quecpython_stubs/uping.pyi +++ b/quecpython_stubs/uping.pyi @@ -4,7 +4,7 @@ This class pings IPv4 request packages. Note: 1. It may occur that the socket cannot be set up at the host address, causing a connection error. 2. Determine the ping period by initializing COUNT and INTERVAL. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/networklib/uping.html +https://python.quectel.com/doc/quecpython/API_reference/en/networklib/uping.html """ diff --git a/quecpython_stubs/urandom.pyi b/quecpython_stubs/urandom.pyi index c823f2a..cfa9ef7 100644 --- a/quecpython_stubs/urandom.pyi +++ b/quecpython_stubs/urandom.pyi @@ -3,7 +3,7 @@ Function: urandom module provides the tool for random number generation. Descriptions taken from: -https://python.quectel.com/doc/API_reference/zh/stdlib/urandom.html +https://python.quectel.com/doc/quecpython/API_reference/en/stdlib/urandom.html """ diff --git a/quecpython_stubs/ure.pyi b/quecpython_stubs/ure.pyi new file mode 100644 index 0000000..8831097 --- /dev/null +++ b/quecpython_stubs/ure.pyi @@ -0,0 +1,80 @@ +""" +Function: Regular Expression +The ure module provides regular expression matching operations. + +Supported operators: + '.' - Match any character + '[]' - Match set of characters (individual characters and ranges) + '^' - Match the start of the string + '$' - Match the end of the string + '?' - Match zero or one of the previous sub-pattern + '*' - Match zero or more of the previous sub-pattern + '+' - Match one or more of the previous sub-pattern + '??' - Non-greedy version of ? (match zero or one) + '*?' - Non-greedy version of * (match zero or more) + '+?' - Non-greedy version of + (match one or more) + '|' - Match either the left-hand side or the right-hand side + '\d' - Match digit + '\D' - Match non-digit + '\s' - Match whitespace + '\S' - Match non-whitespace + '\w' - Match "word characters" (ASCII only) + '\W' - Match non-"word characters" (ASCII only) + +Not supported operators: + '{m,n}' - Counted repetitions + '(?P...)' - Named groups + '(?:...)' - Non-capturing groups + '\b' - Word boundary assertions + '\B' - Non-word boundary assertions + '\r' - Carriage return (use Python's escaping instead) + '\n' - Newline (use Python's escaping instead) + +Descriptions taken from: +https://developer.quectel.com/doc/quecpython/API_reference/en/stdlib/ure.html +""" + +class error(Exception): + """Exception raised for invalid regular expressions.""" + pass + +def compile(regex): + """ + Compiles a regular expression and generates a regular-expression object + + :param regex: Regular expression string + :return: Compiled regex object + """ + + +def match(regex, string): + """ + Matches the compiled regular expression against string from the start + + :param regex: Regular expression string or compiled object + :param string: The string to be matched + :return: Match object if successful, otherwise None + """ + + +def search(regex, string): + """ + Searches for the compiled regular expression in string + + :param regex: Regular expression string or compiled object + :param string: The string to search in + :return: Match object if found, otherwise None + """ + + +class Match: + """Match object returned by successful match/search""" + + def group(self, index=0): + """ + Returns the string captured by the group + + :param index: Group index (0 = entire match) + :return: Captured substring + :raises: Error when group does not exist + """ \ No newline at end of file diff --git a/quecpython_stubs/usocket.pyi b/quecpython_stubs/usocket.pyi index 6707b20..c69bd40 100644 --- a/quecpython_stubs/usocket.pyi +++ b/quecpython_stubs/usocket.pyi @@ -4,7 +4,7 @@ This module provides access to the BSD socket interface, and realizes subsets of See CPython file socket for more detailed information: https://docs.python.org/3.5/library/socket.html#module-socket Descriptions taken from: -https://python.quectel.com/doc/API_reference/zh/stdlib/usocket.html +https://python.quectel.com/doc/quecpython/API_reference/en/stdlib/usocket.html """ diff --git a/quecpython_stubs/ussl.pyi b/quecpython_stubs/ussl.pyi index 47126cf..d4bc8fe 100644 --- a/quecpython_stubs/ussl.pyi +++ b/quecpython_stubs/ussl.pyi @@ -3,7 +3,7 @@ Function: ussl realizes the encrypted communication using TLS/SSL protocol, mainly for unidirectional and bidirectional authentication. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/networklib/ussl.html +https://python.quectel.com/doc/quecpython/API_reference/en/networklib/ussl.html """ from usocket import socket diff --git a/quecpython_stubs/ustruct.pyi b/quecpython_stubs/ustruct.pyi index 2d7a4b7..55a82bb 100644 --- a/quecpython_stubs/ustruct.pyi +++ b/quecpython_stubs/ustruct.pyi @@ -4,7 +4,7 @@ Module feature: ustruct module realizes subsets of the corresponding CPython mod See CPython file struct for detailed information: https://docs.python.org/3.5/library/struct.html#module-struct Descriptions taken from: -https://python.quectel.com/doc/API_reference/zh/stdlib/ustruct.html +https://python.quectel.com/doc/quecpython/API_reference/en/stdlib/ustruct.html The format string is the mechanism used to specify the expected layout when packing and unpacking data. Format strings are built through the format character of the specified data type that to be packed or unpacked. diff --git a/quecpython_stubs/usys.pyi b/quecpython_stubs/usys.pyi new file mode 100644 index 0000000..39049fb --- /dev/null +++ b/quecpython_stubs/usys.pyi @@ -0,0 +1,45 @@ +""" +Function: +System Related Features. + +Descriptions taken from: +https://python.quectel.com/doc/quecpython/API_reference/en/stdlib/sys.html +""" + + +argv: list = ... # The list of variable parameters of enabling the current program. +byteorder: str = ... # Byte order (‘little’ - little-endian, ‘big’ - big-endian). + +# Returns the current version information of MicroPython. MicroPython has the following attributes: +# 对于MicroPython,它具有以下属性: +# name: Character string“ micropython” +# version: Tuple (major, minor, micro), such as (1, 7, 0) +# _mpy: The version information of mpy file. The parse method is below. mpy_cross needs to adapt to this version information when generating mpy. +implementation: object = ... + +# The maximum value of QuecPython module integers which can retain on the current platform. +# If it is less than the maximum value in the platform, it is the maximum value represented by the MicroPython integer (this is the case for MicroPython ports that do not support the long integer). +maxsize: int = ... + +modules: dict = ... # Returns the imported modules in the current Python in dictionary form. +platform: str = ... # MicroPython Operation Platform. +stdin = ... # Standard Input (Default: USB virtual serial port. Other serial ports are optional). +stdout = ... # Standard Output (Default: USB virtual serial port. Other serial ports are optional). +version: str = ... # String type. MicroPython version. +version_info: tuple = ... # Integer tuple type. MicroPython version. + +def exit(retval: int = 0): + """Exits the current program with the given parameters. + + :param retval: Integer type. Exiting parameter. + :raise: This function triggers a SystemExit exit. If a parameter is given, its value is assigned as a parameter to SystemExit. + """ + +def print_exception(exc, file=stdout): + """Prints the exception information to the file object. + + The generated file is sys.stdout by default, which is the standard output of the exception information. + + :param exc: Exception object. + :param file: The specified output file. The generated file is sys.stdout by default. + """ diff --git a/quecpython_stubs/utime.pyi b/quecpython_stubs/utime.pyi index 0554639..3c6483c 100644 --- a/quecpython_stubs/utime.pyi +++ b/quecpython_stubs/utime.pyi @@ -4,7 +4,7 @@ utime module gets the current time, measures the time interval and provides the See CPython file time for more detailed information: https://docs.python.org/3.5/library/time.html#module-time Descriptions taken from: -https://python.quectel.com/doc/API_reference/zh/stdlib/utime.html +https://python.quectel.com/doc/quecpython/API_reference/en/stdlib/utime.html """ diff --git a/quecpython_stubs/uwebsocket.pyi b/quecpython_stubs/uwebsocket.pyi index 9964551..17e3036 100644 --- a/quecpython_stubs/uwebsocket.pyi +++ b/quecpython_stubs/uwebsocket.pyi @@ -3,7 +3,7 @@ Function: This feature establishes a WebSocket connection. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/networklib/uwebsocket.html +https://python.quectel.com/doc/quecpython/API_reference/en/networklib/uwebsocket.html """ diff --git a/quecpython_stubs/uzlib.pyi b/quecpython_stubs/uzlib.pyi new file mode 100644 index 0000000..e071944 --- /dev/null +++ b/quecpython_stubs/uzlib.pyi @@ -0,0 +1,26 @@ +""" +Function: +The module uses the binary data compressed by DEFLATE Algorithm to decompress (generally used in the zlib library and the gzip archiver). +This module realizes subsets of the corresponding CPython module. See CPython file zlib for more detailed information. + +See CPython file struct for detailed information: https://docs.python.org/3.5/library/zlib.html#module-zlib + +Descriptions taken from: +https://developer.quectel.com/doc/quecpython/API_reference/zh/stdlib/uzlib.html +""" + +def decompress(data, wbits=0, bufsize=0): + """Returns the compressed bytes object. + :param data: data is assumed to be the zlib stream (with the zlib header) + :param wbits: wbits is the window size of DEFLATE dictionary when decompressing. (8–15, the dictionary size is the power of 2 of wbits value). + :param bufsize: bufsize is for compatibility with CPython and will be ignored. + :return: decompressed bytes object + """ + +def DecompIO(stream, wbits=0, bufsize=1): + """Creates a stream decorator that allows data to be transparently compressed in another stream + :param stream: stream to be compressed + :param wbits: wbits is the window size of DEFLATE dictionary when DecompIO. + + + """ \ No newline at end of file diff --git a/quecpython_stubs/voiceCall.pyi b/quecpython_stubs/voiceCall.pyi index 5e68810..3a16aec 100644 --- a/quecpython_stubs/voiceCall.pyi +++ b/quecpython_stubs/voiceCall.pyi @@ -17,7 +17,7 @@ BC25/EC600G/EC800G/BG95 series module does not support voice call. For other modules, a custom version is required to support voice call. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/iotlib/voiceCall.html +https://python.quectel.com/doc/quecpython/API_reference/en/iotlib/voiceCall.html """ def setAutoAnswer(seconds): diff --git a/quecpython_stubs/wakeup.pyi b/quecpython_stubs/wakeup.pyi new file mode 100644 index 0000000..98f50fd --- /dev/null +++ b/quecpython_stubs/wakeup.pyi @@ -0,0 +1,66 @@ +""" +Function: +Module feature: WakeUp interrupt for enabling edge-triggered interrupts and module wake-up from sleep state. +Currently supported modules: EC600E Series, EC800E Series, EC800Z Series. +Note: WakeUp provides interrupt capabilities not available on standard GPIOs, including dual-edge triggering and wake-up from sleep mode. + +Descriptions taken from: +https://developer.quectel.com/doc/quecpython/API_reference/en/pm/WakeUp.html +""" +class WakeUp(object): + """WakeUp Interrupt + + Class feature: Provides edge-triggered interrupts and wake-up capability from sleep mode. + Note: Standard GPIOs on EC600/EC800E series don't support dual-edge interrupts or wake-up from sleep. + Descriptions: https://developer.quectel.com/doc/quecpython/API_reference/en/pm/WakeUp.html + + WakeUp Pin Mapping: + | Module | WAKEUP0 | WAKEUP2 | WAKEUP3 | WAKEUP4 | WAKEUP5 | + |----------|---------|---------|---------|---------|---------| + | EC800E | - | Pin79 | Pin109* | Pin108* | Pin19 | + | EC600E | - | Pin9 | Pin51 | Pin50 | Pin39 | + | EC800Z | Pin87 | Pin79 | Pin109 | Pin108 | Pin19 | + * Not available on EC800ECN_LE/LQ/LC variants + """ + + def __init__(self, WakeupID, pull, edge=IRQ_RISING_FALLING): + """Creates a WakeUp interrupt object. + + :param WakeupID: Integer type. WakeUp pin identifier. Use class constants: WAKEUP0, WAKEUP2, WAKEUP3, WAKEUP4, WAKEUP5. + :param pull: Integer type. Pull mode configuration. Use class constants: PULL_DISABLE, PULL_PU, PULL_PD. + :param edge: Integer type. Edge trigger configuration (EC800Z only). Default: dual-edge. Use class constants: IRQ_RISING, IRQ_FALLING, IRQ_RISING_FALLING. + """ + + def enable(self): + """Enables the WakeUp interrupt. + + When enabled, edge detection will trigger the registered callback function. + + :return: Integer. 0 - Success, -1 - Failure. + """ + + def disable(self): + """Disables the WakeUp interrupt. + + :return: Integer. 0 - Success, -1 - Failure. + """ + + def read(self): + """Reads current pin level. + + :return: Integer. 0 - Low level, 1 - High level. + """ + + def deinit(self): + """Deinitializes and disables WakeUp functionality. + + :return: Integer. 0 - Success, -1 - Failure. + """ + + def set_callback(self, fun): + """Sets the interrupt callback function. + + :param fun: Callback function. Function prototype: fun(level) + Callback Parameter: + level: Integer. 0 = Low level, 1 = High level + """ \ No newline at end of file diff --git a/quecpython_stubs/wifiScan.pyi b/quecpython_stubs/wifiScan.pyi index bc9af49..0889675 100644 --- a/quecpython_stubs/wifiScan.pyi +++ b/quecpython_stubs/wifiScan.pyi @@ -11,7 +11,7 @@ In EG912U series module: EG912UGL_AA support the wifiScan feature. In EG915U series module: EG915UEU_AB/EG915ULA_AB support the wifiScan feature. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/gnsslib/wifiScan.html +https://python.quectel.com/doc/quecpython/API_reference/en/gnsslib/wifiScan.html """ @@ -84,4 +84,6 @@ def start(): wifiNums Integer The number of scanned Wi-Fi hotspots. mac String MAC address of the Wi-Fi hotspots. rssi Integer Signal strength of the Wi-Fi hotspots. + """ + diff --git a/quecpython_stubs/wifilocator.pyi b/quecpython_stubs/wifilocator.pyi index fa1be73..ffabd43 100644 --- a/quecpython_stubs/wifilocator.pyi +++ b/quecpython_stubs/wifilocator.pyi @@ -4,7 +4,7 @@ This module provides the class of Wi-Fi positioning and gets the module longitud Currently, only EC600S/EC600N/EC800N/EC200U/EC600U/EG912U/EG915U series module supports this feature. Descriptions taken from: -https://python.quectel.com/doc/API_reference/en/gnsslib/wifilocator.html +https://python.quectel.com/doc/quecpython/API_reference/en/gnsslib/wifilocator.html """