pyasic
BFGMinerRPCAPI
Bases: CGMinerRPCAPI
An abstraction of the BFGMiner API.
Each method corresponds to an API command in BFGMiner.
This class abstracts use of the BFGMiner API, as well as the methods for sending commands to it. The self.send_command() function handles sending a command to the miner asynchronously, and as such is the base for many of the functions in this class, which rely on it to send the command for them.
Source code in pyasic/rpc/bfgminer.py
class BFGMinerRPCAPI(CGMinerRPCAPI):
"""An abstraction of the BFGMiner API.
Each method corresponds to an API command in BFGMiner.
[BFGMiner API documentation](https://github.com/luke-jr/bfgminer/blob/bfgminer/README.RPC)
This class abstracts use of the BFGMiner API, as well as the
methods for sending commands to it. The self.send_command()
function handles sending a command to the miner asynchronously, and
as such is the base for many of the functions in this class, which
rely on it to send the command for them.
"""
async def procs(self) -> dict:
"""Get data on each processor with their details.
<details>
<summary>Expand</summary>
Returns:
Data on each processor with their details.
</details>
"""
return await self.send_command("procs")
async def devscan(self, info: str = "") -> dict:
"""Get data on each processor with their details.
<details>
<summary>Expand</summary>
Parameters:
info: Info to scan for device by.
Returns:
Data on each processor with their details.
</details>
"""
return await self.send_command("devscan", parameters=info)
async def proc(self, n: int = 0) -> dict:
"""Get data processor n.
<details>
<summary>Expand</summary>
Parameters:
n: The processor to get data on.
Returns:
Data on processor n.
</details>
"""
return await self.send_command("proc", parameters=n)
async def proccount(self) -> dict:
"""Get data fon all processors.
<details>
<summary>Expand</summary>
Returns:
Data on the processors connected.
</details>
"""
return await self.send_command("proccount")
async def pgarestart(self, n: int) -> dict:
"""Restart PGA n.
<details>
<summary>Expand</summary>
Parameters:
n: The PGA to restart.
Returns:
A confirmation of restarting PGA n.
</details>
"""
return await self.send_command("pgadisable", parameters=n)
async def procenable(self, n: int) -> dict:
"""Enable processor n.
<details>
<summary>Expand</summary>
Parameters:
n: The processor to enable.
Returns:
A confirmation of enabling processor n.
</details>
"""
return await self.send_command("procenable", parameters=n)
async def procdisable(self, n: int) -> dict:
"""Disable processor n.
<details>
<summary>Expand</summary>
Parameters:
n: The processor to disable.
Returns:
A confirmation of disabling processor n.
</details>
"""
return await self.send_command("procdisable", parameters=n)
async def procrestart(self, n: int) -> dict:
"""Restart processor n.
<details>
<summary>Expand</summary>
Parameters:
n: The processor to restart.
Returns:
A confirmation of restarting processor n.
</details>
"""
return await self.send_command("procdisable", parameters=n)
async def procidentify(self, n: int) -> dict:
"""Identify processor n.
<details>
<summary>Expand</summary>
Parameters:
n: The processor to identify.
Returns:
A confirmation of identifying processor n.
</details>
"""
return await self.send_command("procidentify", parameters=n)
async def procset(self, n: int, opt: str, val: int = None) -> dict:
"""Set processor option opt to val on processor n.
<details>
<summary>Expand</summary>
Options:
```
MMQ -
opt: clock
val: 2 - 250 (multiple of 2)
XBS -
opt: clock
val: 2 - 250 (multiple of 2)
```
Parameters:
n: The processor to set the options on.
opt: The option to set. Setting this to 'help' returns a help message.
val: The value to set the option to.
Returns:
Confirmation of setting processor n with opt[,val].
</details>
"""
if val:
return await self.send_command("procset", parameters=f"{n},{opt},{val}")
else:
return await self.send_command("procset", parameters=f"{n},{opt}")
devscan(info='')
async
Get data on each processor with their details.
Expand
Parameters:
Name | Type | Description | Default |
---|---|---|---|
info |
str
|
Info to scan for device by. |
''
|
Returns:
Type | Description |
---|---|
dict
|
Data on each processor with their details. |
Source code in pyasic/rpc/bfgminer.py
async def devscan(self, info: str = "") -> dict:
"""Get data on each processor with their details.
<details>
<summary>Expand</summary>
Parameters:
info: Info to scan for device by.
Returns:
Data on each processor with their details.
</details>
"""
return await self.send_command("devscan", parameters=info)
pgarestart(n)
async
Restart PGA n.
Expand
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n |
int
|
The PGA to restart. |
required |
Returns:
Type | Description |
---|---|
dict
|
A confirmation of restarting PGA n. |
Source code in pyasic/rpc/bfgminer.py
async def pgarestart(self, n: int) -> dict:
"""Restart PGA n.
<details>
<summary>Expand</summary>
Parameters:
n: The PGA to restart.
Returns:
A confirmation of restarting PGA n.
</details>
"""
return await self.send_command("pgadisable", parameters=n)
proc(n=0)
async
Get data processor n.
Expand
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n |
int
|
The processor to get data on. |
0
|
Returns:
Type | Description |
---|---|
dict
|
Data on processor n. |
Source code in pyasic/rpc/bfgminer.py
async def proc(self, n: int = 0) -> dict:
"""Get data processor n.
<details>
<summary>Expand</summary>
Parameters:
n: The processor to get data on.
Returns:
Data on processor n.
</details>
"""
return await self.send_command("proc", parameters=n)
proccount()
async
Get data fon all processors.
Expand
Returns:
Type | Description |
---|---|
dict
|
Data on the processors connected. |
Source code in pyasic/rpc/bfgminer.py
async def proccount(self) -> dict:
"""Get data fon all processors.
<details>
<summary>Expand</summary>
Returns:
Data on the processors connected.
</details>
"""
return await self.send_command("proccount")
procdisable(n)
async
Disable processor n.
Expand
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n |
int
|
The processor to disable. |
required |
Returns:
Type | Description |
---|---|
dict
|
A confirmation of disabling processor n. |
Source code in pyasic/rpc/bfgminer.py
async def procdisable(self, n: int) -> dict:
"""Disable processor n.
<details>
<summary>Expand</summary>
Parameters:
n: The processor to disable.
Returns:
A confirmation of disabling processor n.
</details>
"""
return await self.send_command("procdisable", parameters=n)
procenable(n)
async
Enable processor n.
Expand
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n |
int
|
The processor to enable. |
required |
Returns:
Type | Description |
---|---|
dict
|
A confirmation of enabling processor n. |
Source code in pyasic/rpc/bfgminer.py
async def procenable(self, n: int) -> dict:
"""Enable processor n.
<details>
<summary>Expand</summary>
Parameters:
n: The processor to enable.
Returns:
A confirmation of enabling processor n.
</details>
"""
return await self.send_command("procenable", parameters=n)
procidentify(n)
async
Identify processor n.
Expand
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n |
int
|
The processor to identify. |
required |
Returns:
Type | Description |
---|---|
dict
|
A confirmation of identifying processor n. |
Source code in pyasic/rpc/bfgminer.py
async def procidentify(self, n: int) -> dict:
"""Identify processor n.
<details>
<summary>Expand</summary>
Parameters:
n: The processor to identify.
Returns:
A confirmation of identifying processor n.
</details>
"""
return await self.send_command("procidentify", parameters=n)
procrestart(n)
async
Restart processor n.
Expand
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n |
int
|
The processor to restart. |
required |
Returns:
Type | Description |
---|---|
dict
|
A confirmation of restarting processor n. |
Source code in pyasic/rpc/bfgminer.py
async def procrestart(self, n: int) -> dict:
"""Restart processor n.
<details>
<summary>Expand</summary>
Parameters:
n: The processor to restart.
Returns:
A confirmation of restarting processor n.
</details>
"""
return await self.send_command("procdisable", parameters=n)
procs()
async
Get data on each processor with their details.
Expand
Returns:
Type | Description |
---|---|
dict
|
Data on each processor with their details. |
Source code in pyasic/rpc/bfgminer.py
async def procs(self) -> dict:
"""Get data on each processor with their details.
<details>
<summary>Expand</summary>
Returns:
Data on each processor with their details.
</details>
"""
return await self.send_command("procs")
procset(n, opt, val=None)
async
Set processor option opt to val on processor n.
Expand
Options: MMQ -
opt: clock
val: 2 - 250 (multiple of 2)
XBS -
opt: clock
val: 2 - 250 (multiple of 2)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n |
int
|
The processor to set the options on. |
required |
opt |
str
|
The option to set. Setting this to 'help' returns a help message. |
required |
val |
int
|
The value to set the option to. |
None
|
Returns:
Type | Description |
---|---|
dict
|
Confirmation of setting processor n with opt[,val]. |
Source code in pyasic/rpc/bfgminer.py
async def procset(self, n: int, opt: str, val: int = None) -> dict:
"""Set processor option opt to val on processor n.
<details>
<summary>Expand</summary>
Options:
```
MMQ -
opt: clock
val: 2 - 250 (multiple of 2)
XBS -
opt: clock
val: 2 - 250 (multiple of 2)
```
Parameters:
n: The processor to set the options on.
opt: The option to set. Setting this to 'help' returns a help message.
val: The value to set the option to.
Returns:
Confirmation of setting processor n with opt[,val].
</details>
"""
if val:
return await self.send_command("procset", parameters=f"{n},{opt},{val}")
else:
return await self.send_command("procset", parameters=f"{n},{opt}")