/*
 * 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
 *
 *      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.
 */


#ifndef SW_DEVICE_LIB_TESTING_TEST_ROM_PUPPETEER_H_
#define SW_DEVICE_LIB_TESTING_TEST_ROM_PUPPETEER_H_
#include "sw/device/lib/testing/test_rom/puppeteer_utils/tiny_io.h"

struct Args;

// Puppeteer is a small, simple console interface to a microcontroller that
// requires only a byte-oriented IO port and provides methods to read and write
// any address in the address space and to upload and download blocks of memory
// as base64-encoded blobs.
//
// Usage:
// TinyIO io {
//   [](void* user) -> uint8_t { <get_byte lambda> },
//   [](void* user, uint8_t b) { <put_byte lambda> },
//   <user-provided pointer passed to lambdas above>
// };
//
// Puppeteer puppeteer(net_io);
// puppeteer.console_main();
//
struct Puppeteer {
  explicit Puppeteer(TinyIO io) : io(io) {}

  int on_help(Args args);
  int on_echo(Args args);
  int on_quit(Args args);
  int on_boot_internal(Args args, bool tock);
  int on_boot_ottf(Args args);
  int on_boot_tock(Args args);

  int on_peekb(Args args);
  int on_peekd(Args args);
  int on_pokeb(Args args);
  int on_poked(Args args);
  int on_hexb(Args args);
  int on_hexd(Args args);

  int on_dump(Args args);
  int on_write(Args args);
  int on_err(char* command);
  int on_test_hmac(Args args);

  int find_command(char* console_buf);
  void console_main();

  TinyIO io;
  bool echo = true;
  bool quit = false;
  char console_buf[257];

  typedef int (Puppeteer::*pc_handler)(Args args);

  struct Command {
    const char* name;
    pc_handler handler;
    const char* help;
  };
  static const int command_count = 14;
  static Command commands[command_count];
};

#endif  // SW_DEVICE_LIB_TESTING_TEST_ROM_PUPPETEER_H_
