#include "ikvm_args.hpp"

#include <getopt.h>
#include <rfb/rfb.h>
#include <stdio.h>
#include <stdlib.h>

namespace ikvm
{

Args::Args(int argc, char* argv[]) :
    frameRate(30), subsampling(0), calcFrameCRC{false}, commandLine(argc, argv)
{
    int option;
    const char* opts = "f:s:h:k:p:u:v:c";
    struct option lopts[] = {{"frameRate", 1, 0, 'f'},
                             {"subsampling", 1, 0, 's'},
                             {"help", 0, 0, 'h'},
                             {"keyboard", 1, 0, 'k'},
                             {"mouse", 1, 0, 'p'},
                             {"udcName", 1, 0, 'u'},
                             {"videoDevice", 1, 0, 'v'},
                             {"calcCRC", 0, 0, 'c'},
                             {0, 0, 0, 0}};

    while ((option = getopt_long(argc, argv, opts, lopts, NULL)) != -1)
    {
        switch (option)
        {
            case 'f':
                frameRate = (int)strtol(optarg, NULL, 0);
                if (frameRate < 0 || frameRate > 60)
                    frameRate = 30;
                break;
            case 's':
                subsampling = (int)strtol(optarg, NULL, 0);
                if (subsampling < 0 || subsampling > 1)
                    subsampling = 0;
                break;
            case 'h':
                printUsage();
                exit(0);
            case 'k':
                keyboardPath = std::string(optarg);
                break;
            case 'p':
                pointerPath = std::string(optarg);
                break;
            case 'u':
                udcName = std::string(optarg);
                break;
            case 'v':
                videoPath = std::string(optarg);
                break;
            case 'c':
                calcFrameCRC = true;
                break;
        }
    }
}

void Args::printUsage()
{
    // use fprintf(stderr to match rfbUsage()
    fprintf(stderr, "OpenBMC IKVM daemon\n");
    fprintf(stderr, "Usage: obmc-ikvm [options]\n");
    fprintf(stderr, "-f frame rate          try this frame rate\n");
    fprintf(stderr, "-s subsampling         try this subsampling\n");
    fprintf(stderr, "-h, --help             show this message and exit\n");
    fprintf(stderr, "-k device              HID keyboard gadget device\n");
    fprintf(stderr, "-p device              HID mouse gadget device\n");
    fprintf(stderr,
            "-u udc name            UDC that HID gadget will connect to\n");
    fprintf(stderr, "-v device              V4L2 device\n");
    fprintf(
        stderr,
        "-c, --calcCRC          Calculate CRC for each frame to save bandwidth\n");
    rfbUsage();
}

} // namespace ikvm
