updated cli tools cq and ping

This commit is contained in:
DJ2LS 2022-12-19 15:05:04 +01:00
parent 242b4adc5f
commit e069be45ba

View file

@ -17,6 +17,8 @@ parser.add_argument('--port', dest="socket_port", default=3000, help="Set socket
parser.add_argument('--host', dest="socket_host", default='localhost', help="Set the host, the socket is listening on.", type=str)
parser.add_argument('--dxcallsign', dest="dxcallsign", default='AA0AA', help="Select the destination callsign", type=str)
parser.add_argument('--mycallsign', dest="mycallsign", default='AA0AA', help="Select the own callsign", type=str)
parser.add_argument('--ping', dest="ping", action="store_true", help="Send PING", type=str)
parser.add_argument('--cq', dest="cq", action="store_true", help="Send CQ", type=str)
args = parser.parse_args()
@ -25,12 +27,17 @@ dxcallsign = args.dxcallsign
mycallsign = args.mycallsign
# our command we are going to send
command = {"type": "ping",
"command": "ping",
"dxcallsign": dxcallsign,
"mycallsign": mycallsign,
}
if args.ping:
command = {"type": "ping",
"command": "ping",
"dxcallsign": dxcallsign,
"mycallsign": mycallsign,
}
if args.cq:
command = {"type": "broadcast",
"command": "cqcqcq",
"mycallsign": mycallsign,
}
command = json.dumps(command)
command = bytes(command + "\n", 'utf-8')
# Create a socket (SOCK_STREAM means a TCP socket)