feat: python 接口适配 AsstRunning 接口

This commit is contained in:
MistEO
2022-08-28 15:42:24 +08:00
parent ade71cc670
commit d460f52633
2 changed files with 18 additions and 5 deletions

View File

@@ -112,10 +112,16 @@ class Asst:
:return: 是否成功
"""
Asst.__lib.AsstStop.restype = ctypes.c_bool
Asst.__lib.AsstStop.argtypes = (ctypes.c_void_p,)
return Asst.__lib.AsstStop(self.__ptr)
def running(self) -> bool:
"""
是否正在运行
:return: 是否正在运行
"""
return Asst.__lib.AsstRunning(self.__ptr)
@staticmethod
def log(level: str, message: str) -> None:
'''
@@ -132,7 +138,7 @@ class Asst:
"""
获取DLL版本号
:return: 版本号
: return: 版本号
"""
return Asst.__lib.AsstGetVersion().decode('utf-8')
@@ -166,6 +172,12 @@ class Asst:
Asst.__lib.AsstStart.restype = ctypes.c_bool
Asst.__lib.AsstStart.argtypes = (ctypes.c_void_p,)
Asst.__lib.AsstStop.restype = ctypes.c_bool
Asst.__lib.AsstStop.argtypes = (ctypes.c_void_p,)
Asst.__lib.AsstRunning.restype = ctypes.c_bool
Asst.__lib.AsstRunning.argtypes = (ctypes.c_void_p,)
Asst.__lib.AsstGetVersion.restype = ctypes.c_char_p
Asst.__lib.AsstLog.restype = None

View File

@@ -1,5 +1,6 @@
import json
import pathlib
import asyncio
from asst import Asst, Message
@@ -64,5 +65,5 @@ if __name__ == "__main__":
asst.start()
while True:
input('>')
while asst.running():
asyncio.sleep(0)