Skip to content

Commit

Permalink
Add RFMan command (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdlambert authored Mar 23, 2020
1 parent 538c44d commit 33d32c5
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
1 change: 1 addition & 0 deletions bond/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"reset",
"wifi",
"upgrade",
"rfman",
]


Expand Down
37 changes: 37 additions & 0 deletions bond/commands/rfman.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from .base_command import BaseCommand
from bond.database import BondDatabase
import bond.proto


class RFManCommand(BaseCommand):
subcmd = "rfman"
help = "Configure the RF Manager [Bridge Only]"
arguments = {
"--silence-tx": {
"help": "Stop all transmissions from the Bond Bridge (for debugging purposes)",
"action": "store_true",
},
"--log-signals": {
"help": "Log all signals transmitted by the Bond on BPUP and MQTT transports",
"action": "store_true",
},
}

def run(self, args):
bondid = BondDatabase.get_assert_selected_bondid()
rsp = bond.proto.patch(
bondid,
topic="debug/rfman",
body={"log_signals": args.log_signals, "silence_tx": args.silence_tx},
)
body = rsp.get("b", {})
print(
"RF Manager settings: Log Signals (%s) | Silence Transmission (%s)"
% (body.get("log_signals"), body.get("silence_tx"))
)
if rsp["s"] > 299:
print("HTTP %d %s" % (rsp["s"], rsp["b"]["_error_msg"]))


def register():
RFManCommand()
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name='bond-cli',
version='0.0.5',
version='0.0.6',
author='Olibra',
packages=find_packages(),
scripts=['bond/bond'],
Expand Down

0 comments on commit 33d32c5

Please sign in to comment.