Created get_commands for each api
This commit is contained in:
@@ -22,6 +22,9 @@ class BaseMinerAPI:
|
|||||||
self.port = port
|
self.port = port
|
||||||
self.ip = ipaddress.ip_address(ip)
|
self.ip = ipaddress.ip_address(ip)
|
||||||
|
|
||||||
|
def get_commands(self):
|
||||||
|
return [func for func in dir(self) if callable(getattr(self, func)) and not func.startswith("__") and func not in [func for func in dir(BaseMinerAPI) if callable(getattr(BaseMinerAPI, func))]]
|
||||||
|
|
||||||
async def multicommand(self, *commands: str) -> dict:
|
async def multicommand(self, *commands: str) -> dict:
|
||||||
command = "+".join(commands)
|
command = "+".join(commands)
|
||||||
return await self.send_command(command)
|
return await self.send_command(command)
|
||||||
|
|||||||
3
main.py
3
main.py
@@ -1,9 +1,12 @@
|
|||||||
from API.bosminer import BOSMinerAPI
|
from API.bosminer import BOSMinerAPI
|
||||||
|
from API.bmminer import BMMinerAPI
|
||||||
from network import MinerNetwork
|
from network import MinerNetwork
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
|
|
||||||
async def main():
|
async def main():
|
||||||
|
api = BMMinerAPI("192.168.1.1")
|
||||||
|
print(api.get_commands())
|
||||||
miner_network = MinerNetwork("192.168.1.1")
|
miner_network = MinerNetwork("192.168.1.1")
|
||||||
await miner_network.scan_network_for_miners()
|
await miner_network.scan_network_for_miners()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user