Created get_commands for each api

This commit is contained in:
UpstreamData
2021-10-07 15:55:27 -06:00
parent 0d12adf375
commit 4778aa957b
2 changed files with 6 additions and 0 deletions

View File

@@ -22,6 +22,9 @@ class BaseMinerAPI:
self.port = port
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:
command = "+".join(commands)
return await self.send_command(command)

View File

@@ -1,9 +1,12 @@
from API.bosminer import BOSMinerAPI
from API.bmminer import BMMinerAPI
from network import MinerNetwork
import asyncio
async def main():
api = BMMinerAPI("192.168.1.1")
print(api.get_commands())
miner_network = MinerNetwork("192.168.1.1")
await miner_network.scan_network_for_miners()