feature: add basic auradine miner framework.
This commit is contained in:
32
pyasic/miners/backends/auradine.py
Normal file
32
pyasic/miners/backends/auradine.py
Normal file
@@ -0,0 +1,32 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
# Copyright 2022 Upstream Data Inc -
|
||||
# -
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); -
|
||||
# you may not use this file except in compliance with the License. -
|
||||
# You may obtain a copy of the License at -
|
||||
# -
|
||||
# http://www.apache.org/licenses/LICENSE-2.0 -
|
||||
# -
|
||||
# Unless required by applicable law or agreed to in writing, software -
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, -
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
from pyasic.miners.base import BaseMiner, DataLocations
|
||||
from pyasic.rpc.gcminer import GCMinerRPCAPI
|
||||
from pyasic.web.auradine import FluxWebAPI
|
||||
|
||||
AURADINE_DATA_LOC = DataLocations(**{})
|
||||
|
||||
|
||||
class Auradine(BaseMiner):
|
||||
"""Base handler for Auradine miners"""
|
||||
|
||||
_api_cls = GCMinerRPCAPI
|
||||
api: GCMinerRPCAPI
|
||||
_web_cls = FluxWebAPI
|
||||
web: FluxWebAPI
|
||||
|
||||
data_locations = AURADINE_DATA_LOC
|
||||
@@ -38,6 +38,7 @@ from pyasic.miners.backends import (
|
||||
VNish,
|
||||
ePIC,
|
||||
)
|
||||
from pyasic.miners.backends.auradine import Auradine
|
||||
from pyasic.miners.backends.innosilicon import Innosilicon
|
||||
from pyasic.miners.base import AnyMiner
|
||||
from pyasic.miners.goldshell import *
|
||||
@@ -57,6 +58,7 @@ class MinerTypes(enum.Enum):
|
||||
HIVEON = 7
|
||||
LUX_OS = 8
|
||||
EPIC = 9
|
||||
AURADINE = 10
|
||||
|
||||
|
||||
MINER_CLASSES = {
|
||||
@@ -392,6 +394,16 @@ MINER_CLASSES = {
|
||||
None: LUXMiner,
|
||||
"ANTMINER S9": LUXMinerS9,
|
||||
},
|
||||
MinerTypes.AURADINE: {
|
||||
None: Auradine,
|
||||
# "AT1500": None,
|
||||
# "AT2860": None,
|
||||
# "AT2880": None,
|
||||
# "AI2500": None,
|
||||
# "AI3680": None,
|
||||
# "AD2500": None,
|
||||
# "AD3500": None,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -660,6 +672,8 @@ class MinerFactory:
|
||||
return MinerTypes.GOLDSHELL
|
||||
if "AVALON" in upper_data:
|
||||
return MinerTypes.AVALONMINER
|
||||
if "GCMINER" in upper_data or "FLUXOS" in upper_data:
|
||||
return MinerTypes.AURADINE
|
||||
|
||||
async def send_web_command(
|
||||
self,
|
||||
@@ -948,5 +962,12 @@ class MinerFactory:
|
||||
except (TypeError, LookupError):
|
||||
pass
|
||||
|
||||
async def get_miner_model_auradine(self, ip: str):
|
||||
web_json_data = await self.send_web_command(ip, ":8080/ipreport")
|
||||
try:
|
||||
return web_json_data["IPReport"][0]["model"]
|
||||
except (TypeError, LookupError):
|
||||
pass
|
||||
|
||||
|
||||
miner_factory = MinerFactory()
|
||||
|
||||
Reference in New Issue
Block a user