summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm/ikvm_args.hpp
blob: f877d32e9446c167f8026dc1ca09a6d0b1a5b1ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#pragma once

#include <string>

namespace ikvm
{

/*
 * @class Args
 * @brief Command line argument parser and storage
 */
class Args
{
  public:
    /*
     * @struct CommandLine
     * @brief Stores the original command line arguments for later use
     */
    struct CommandLine
    {
        /*
         * @brief Constructs CommandLine object
         *
         * @param[in] c - Number of arguments
         * @param[in] v - Array of arguments
         */
        CommandLine(int c, char** v) : argc(c), argv(v)
        {
        }
        ~CommandLine() = default;
        CommandLine(const CommandLine&) = default;
        CommandLine& operator=(const CommandLine&) = default;
        CommandLine(CommandLine&&) = default;
        CommandLine& operator=(CommandLine&&) = default;

        int argc;
        char** argv;
    };

    /*
     * @brief Constructs Args object
     *
     * @param[in] argc - The number of arguments in the command line call
     * @param[in] argv - The array of arguments from the command line
     */
    Args(int argc, char* argv[]);
    ~Args() = default;
    Args(const Args&) = default;
    Args& operator=(const Args&) = default;
    Args(Args&&) = default;
    Args& operator=(Args&&) = default;

    /*
     * @brief Get the original command line arguments
     *
     * @return Reference to the CommandLine structure storing the original
     *         command line arguments
     */
    inline const CommandLine& getCommandLine() const
    {
        return commandLine;
    }

    /*
     * @brief Get the desired video frame rate
     *
     * @return Value of the desired frame rate in frames per second
     */
    inline int getFrameRate() const
    {
        return frameRate;
    }

    /*
     * @brief Get the path to the USB keyboard device
     *
     * @return Reference to the string storing the path to the keyboard device
     */
    inline const std::string& getKeyboardPath() const
    {
        return keyboardPath;
    }

    /*
     * @brief Get the path to the USB mouse device
     *
     * @return Reference to the string storing the path to the mouse device
     */
    inline const std::string& getPointerPath() const
    {
        return pointerPath;
    }

    /*
     * @brief Get the path to the V4L2 video device
     *
     * @return Reference to the string storing the path to the video device
     */
    inline const std::string& getVideoPath() const
    {
        return videoPath;
    }

  private:
    /* @brief Prints the application usage to stderr */
    void printUsage();

    /*
     * @brief Desired frame rate (in frames per second) of the video
     *        stream
     */
    int frameRate;
    /* @brief Path to the USB keyboard device */
    std::string keyboardPath;
    /* @brief Path to the USB mouse device */
    std::string pointerPath;
    /* @brief Path to the V4L2 video device */
    std::string videoPath;
    /* @brief Original command line arguments passed to the application */
    CommandLine commandLine;
};

} // namespace ikvm