1 #pragma once 2 3 #include <string> 4 5 namespace ikvm 6 { 7 8 /* 9 * @class Args 10 * @brief Command line argument parser and storage 11 */ 12 class Args 13 { 14 public: 15 /* 16 * @struct CommandLine 17 * @brief Stores the original command line arguments for later use 18 */ 19 struct CommandLine 20 { 21 /* 22 * @brief Constructs CommandLine object 23 * 24 * @param[in] c - Number of arguments 25 * @param[in] v - Array of arguments 26 */ 27 CommandLine(int c, char** v) : argc(c), argv(v) 28 {} 29 ~CommandLine() = default; 30 CommandLine(const CommandLine&) = default; 31 CommandLine& operator=(const CommandLine&) = default; 32 CommandLine(CommandLine&&) = default; 33 CommandLine& operator=(CommandLine&&) = default; 34 35 int argc; 36 char** argv; 37 }; 38 39 /* 40 * @brief Constructs Args object 41 * 42 * @param[in] argc - The number of arguments in the command line call 43 * @param[in] argv - The array of arguments from the command line 44 */ 45 Args(int argc, char* argv[]); 46 ~Args() = default; 47 Args(const Args&) = default; 48 Args& operator=(const Args&) = default; 49 Args(Args&&) = default; 50 Args& operator=(Args&&) = default; 51 52 /* 53 * @brief Get the original command line arguments 54 * 55 * @return Reference to the CommandLine structure storing the original 56 * command line arguments 57 */ 58 inline const CommandLine& getCommandLine() const 59 { 60 return commandLine; 61 } 62 63 /* 64 * @brief Get the desired video frame rate 65 * 66 * @return Value of the desired frame rate in frames per second 67 */ 68 inline int getFrameRate() const 69 { 70 return frameRate; 71 } 72 73 /* 74 * @brief Get the video subsampling 75 * 76 * @return Value of the video subsampling 77 */ 78 inline int getSubsampling() const 79 { 80 return subsampling; 81 } 82 83 /* 84 * @brief Get the path to the USB keyboard device 85 * 86 * @return Reference to the string storing the path to the keyboard device 87 */ 88 inline const std::string& getKeyboardPath() const 89 { 90 return keyboardPath; 91 } 92 93 /* 94 * @brief Get the path to the USB mouse device 95 * 96 * @return Reference to the string storing the path to the mouse device 97 */ 98 inline const std::string& getPointerPath() const 99 { 100 return pointerPath; 101 } 102 103 /* 104 * @brief Get the name of UDC 105 * 106 * @return Reference to the string storing the name of UDC 107 */ 108 inline const std::string& getUdcName() const 109 { 110 return udcName; 111 } 112 113 /* 114 * @brief Get the path to the V4L2 video device 115 * 116 * @return Reference to the string storing the path to the video device 117 */ 118 inline const std::string& getVideoPath() const 119 { 120 return videoPath; 121 } 122 123 /* 124 * @brief Get the identical frames detection setting 125 * 126 * @return True if identical frames detection is enabled 127 */ 128 inline bool getCalcFrameCRC() const 129 { 130 return calcFrameCRC; 131 } 132 133 private: 134 /* @brief Prints the application usage to stderr */ 135 void printUsage(); 136 137 /* 138 * @brief Desired frame rate (in frames per second) of the video 139 * stream 140 */ 141 int frameRate; 142 /* @brief Desired subsampling (0: 444, 1: 420) */ 143 int subsampling; 144 /* @brief Path to the USB keyboard device */ 145 std::string keyboardPath; 146 /* @brief Path to the USB mouse device */ 147 std::string pointerPath; 148 /* @brief Name of UDC */ 149 std::string udcName; 150 /* @brief Path to the V4L2 video device */ 151 std::string videoPath; 152 /* @brief Identical frames detection */ 153 bool calcFrameCRC; 154 /* @brief Original command line arguments passed to the application */ 155 CommandLine commandLine; 156 }; 157 158 } // namespace ikvm 159