Skip to content

Commit 070fad6

Browse files
committed
update pyi
1 parent 86e6f48 commit 070fad6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+6112
-5532
lines changed

thonnycontrib/quecpython/backend/bare_metal_backend.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,11 +1115,11 @@ def _cmd_get_fs_info(self, cmd):
11151115

11161116
def _cmd_upload(self, cmd):
11171117
self._check_sync_time()
1118-
return super(BareMetalMicroPythonBackend, self)._cmd_upload(cmd)
1118+
return super(BareMetalQuecPythonBackend, self)._cmd_upload(cmd)
11191119

11201120
def _cmd_write_file(self, cmd):
11211121
self._check_sync_time()
1122-
return super(BareMetalMicroPythonBackend, self)._cmd_write_file(cmd)
1122+
return super(BareMetalQuecPythonBackend, self)._cmd_write_file(cmd)
11231123

11241124
def _cmd_prepare_disconnect(self, cmd):
11251125
logger.info("Preparing disconnect")
@@ -1709,7 +1709,7 @@ def _report_internal_exception(self, msg: str) -> None:
17091709
)
17101710

17111711

1712-
class GenericBareMetalMicroPythonBackend(BareMetalQuecPythonBackend):
1712+
class GenericBareMetalQuecPythonBackend(BareMetalQuecPythonBackend):
17131713
def _get_sys_path_for_analysis(self) -> Optional[List[str]]:
17141714
return [
17151715
os.path.join(os.path.dirname(__file__), "generic_api_stubs"),
@@ -1758,4 +1758,4 @@ def launch_bare_metal_backend(backend_class: Callable[..., BareMetalQuecPythonBa
17581758

17591759

17601760
if __name__ == "__main__":
1761-
launch_bare_metal_backend(GenericBareMetalMicroPythonBackend)
1761+
launch_bare_metal_backend(GenericBareMetalQuecPythonBackend)

thonnycontrib/quecpython/backend/base_api_stubs/__init__.pyi

Whitespace-only changes.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import win32api
2+
import win32con
3+
from pathlib import Path
4+
5+
6+
def load():
7+
# 获取QuecPython的环境变量
8+
QUECPYTHON_PATH = str(Path(__file__).parent)
9+
# 打开环境变量键
10+
key = win32api.RegOpenKeyEx(
11+
win32con.HKEY_LOCAL_MACHINE,
12+
'SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment',
13+
0,
14+
win32con.KEY_ALL_ACCESS
15+
)
16+
# 更新环境变量值
17+
win32api.RegSetValueEx(key, 'PYTHONPATH', 0, 2, QUECPYTHON_PATH)
18+
# 关闭键
19+
win32api.RegCloseKey(key)
20+
21+
22+
if __name__ == '__main__':
23+
load()
Lines changed: 102 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,110 @@
11
"""
2-
multithreading support.
2+
Function:
3+
_thread module contains features related to thread operations, and provides methods for creating and deleting threads, and interfaces related to mutex and semaphore.
34
45
Descriptions taken from:
5-
https://raw.githubusercontent.com/micropython/micropython/master/docs/library/_thread.rst.
6-
========================================
6+
https://python.quectel.com/doc/API_reference/en/stdlib/_thread.html
7+
"""
78

8-
.. module:: _thread
9-
:synopsis: multithreading support
109

11-
|see_cpython_module| :mod:`python:_thread`.
10+
def get_ident():
11+
"""Requires the current thread number.
1212
13-
This module implements multithreading support.
13+
@return: Returns the current thread number.
14+
"""
1415

15-
This module is highly experimental and its API is not yet fully settled
16-
and not yet described in this documentation.
17-
"""
16+
def stack_size(size):
17+
""" set thread stack size
18+
Setting or getting the stack size which is used to create a thread (Unit: byte) depends on whether size is provided. The stack size is 8448 bytes by default, with a minimum of 8192 bytes.
19+
20+
@param size: Sets the stack size which is used to create a thread when size is provided.
21+
@return: Returns the stack size which is used to create a thread when size is not provided.
22+
"""
23+
24+
def start_new_thread(function, args):
25+
"""create new thread.
26+
Creates a thread to receive the executing function and the parameter of the executed function, and passes an empty tuple if function has no parameters.
27+
28+
@param function: The executing function of the thread.
29+
@param args: The parameter of the executing function of the thread, which passes an empty tuple when the function has no parameters.
30+
@return: Returns the ID of the created thread.
31+
"""
32+
33+
def threadIsRunning(thread_id):
34+
"""check if thread is running or not according to `thread_id`.
35+
36+
:param thread_id: thread ident, a int type.
37+
:return: True or False
38+
"""
39+
40+
def stop_thread(thread_id):
41+
"""Deletes a thread. The main thread cannot be deleted.
42+
43+
@param thread_id: The returned ID when the thread is created. If the value is 0, the current thread is deleted.
44+
@return: None
45+
"""
46+
47+
def get_heap_size():
48+
"""Gets the remaining size of heap in the system.
49+
50+
@return: Returns the remaining size of heap in the system. (Unit: byte)
51+
"""
52+
53+
class Lock(object):
54+
55+
def acquire(self):
56+
"""Acquires the lock.
57+
58+
@return: True-Successful execution; False-Failed execution.
59+
"""
60+
61+
def release(self):
62+
"""Releases the lock."""
63+
64+
def locked(self):
65+
"""Returns the status of the lock.
66+
67+
@return: True indicates the status of the lock has been required by some thread; False indicates the status of the lock has not been required by the thread.
68+
"""
69+
70+
def allocate_lock() -> Lock:
71+
"""Creates a mutex object.
72+
73+
@return: Returns the created mutex object.
74+
"""
75+
76+
def delete_lock(lock):
77+
"""Deletes the created mutex.
78+
79+
@param lock: The returned mutex object when the mutex is created.
80+
@return: None
81+
"""
82+
83+
class Semphore(object):
84+
85+
86+
def acquire(self):
87+
"""Acquires the semphore."""
88+
89+
def release(self):
90+
"""Releases the semphore."""
91+
92+
def getCnt(self):
93+
"""Gets the maximum value of the semaphore count and the current remaining count value.
94+
95+
@return: (maxCnt, curCnt)-tuple: maxCnt is the maximum count value, and curCnt is the current remaining count value.
96+
"""
97+
98+
def allocate_semphore(initcount) -> Semphore:
99+
"""Creates a semphore object.
100+
101+
@param initcount: The initial count value and also the maximum value of the semaphore.
102+
@return: Returns the created semphore object.
103+
"""
104+
105+
def delete_semphore(semphore):
106+
"""Deletes the created semphore.
18107
19-
__author__ = "Howard C Lovatt"
20-
__copyright__ = "Howard C Lovatt, 2020 onwards."
21-
__license__ = "MIT https://opensource.org/licenses/MIT (as used by MicroPython)."
22-
__version__ = "7.3.9" # Version set by https://github.com/hlovatt/tag2ver
108+
@param semphore: The returned semphore object when the semphore is created.
109+
@return: None
110+
"""
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
"""
2+
Function:
3+
The app_fota module is used for user file upgrades.
4+
5+
Descriptions taken from:
6+
https://python.quectel.com/doc/API_reference/en/syslib/app_fota.html
7+
"""
8+
9+
10+
class new(object):
11+
12+
def __init__(self):
13+
"""Creates an app_fota object."""
14+
15+
def download(self, url, file_name):
16+
"""Downloads a single file.
17+
18+
:param url: String type. The URL of the file to be downloaded.
19+
:param file_name: String type. The absolute path of the local file to be upgraded.
20+
:return: 0-Successful execution; -1-Failed execution.
21+
"""
22+
23+
def bulk_download(self, info):
24+
"""Downloads bulk files.
25+
26+
:param info: List type. The bulk download lists. Each element of the list is a dictionary containing url and file_name.
27+
:return: Returns the list of failed downloads in list type when the download fails.Returns NULL when the download succeeds.
28+
"""
29+
30+
def set_update_flag(self):
31+
"""Sets the upgrade flag.
32+
33+
fter the upgrade flag is set, call the restart interface to restart the module.
34+
After that, the upgrade process can be started.
35+
You can enter the application once the upgrade completes.
36+
"""
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"""
2+
Function:
3+
This module provides a method for sending AT commands, allowing the QuecPython module to send AT commands through Python code.
4+
5+
Descriptions taken from:
6+
https://python.quectel.com/doc/API_reference/en/syslib/atcmd.html
7+
"""
8+
9+
10+
def sendSync(atcmd, resp, include_str, timeout):
11+
"""Sends an AT command to the module.
12+
13+
:param atcmd: String type. The AT command to be sent, and '\r\n' should be included.
14+
:param resp: String type. The string content returned by the AT command.
15+
:param include_str: String type. Keyword. The specific values are shown in the table below
16+
Value Description
17+
Empty string Gets all data returned by the AT command (excluding result data such as 'OK') and puts the data into the resp parameter.
18+
None-empty string Filter data containing the keyword and puts the data into the resp parameter.
19+
:param timeout: Integer type. Timeout. Unit: second.
20+
:return: Returns an integer value. 0 indicates successful execution and other values indicate failed execution.
21+
"""

0 commit comments

Comments
 (0)