#!/usr/bin/env python
#
# Copyright 2023 Google LLC
#
# 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
#
#     https://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.

import argparse
import sys
import serial
from pexpect_serial import SerialSpawn


def main():
    parser = argparse.ArgumentParser(description="Run commands on nexus MCU")
    parser.add_argument(
        "--nexus_id",
        action="store",
        required=True,
        help="Two digit numeric ID of the nexus board to control")
    parser.add_argument("command", action='store')
    args = parser.parse_args()

    fd = serial.Serial(f"/dev/Nexus-FTDI-{args.nexus_id}-MCU-UART", "115200")
    port = SerialSpawn(fd)
    # Redirect all port chatter to stdout buffer since it's in binary mode
    port.logfile = sys.stdout.buffer

    port.send(f"{args.command}\r\n")
    reply = port.expect([">", "Unrecognized command: .*\r\n>"])
    if reply:
        print(f"MCU did not recognize the command \"{args.command}\"")
        sys.exit(1)


if __name__ == "__main__":
    main()
