BAOS SDK v2  1.2.1
An SDK providing access to IP-BAOS devices through BAOS binary protocol version 2.x
Loading...
Searching...
No Matches
Helper.h
1//
2// Copyright (c) 2002-2026 WEINZIERL ENGINEERING GmbH
3// All rights reserved.
4//
5// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
6// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
7// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
8// SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY,
9// WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
10// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
11//
12
13#include <string>
14#include <vector>
15
16namespace utility
17{
18
23{
24public:
25 CommandLineOptions() = default;
26
27 // Some samples are wait for indications until the user press a key to stop the sample
28 // This samples could also use a duration option.
29 void setDurationOptionSupported(bool supported);
30 void setSecureSampleOptionSupported(bool supported);
31
32 void parse(int argc, char** argv);
33 void parse(const std::vector<std::string>& arguments);
34
35 bool wasHelpdisplayed() const;
36 const std::string& getIpAddress() const;
37 const std::string& getPassword() const;
38
39 // If > 0, samples should terminate automatically after the given number of seconds.
40 // Default: 0 (interactive; wait for user).
41 unsigned int getDurationSeconds() const;
42 bool isInteractive() const;
43
44 void showUsage();
45
46public:
47 bool durationOptionSupported_ = false;
48 bool secureSampleOptionSupported_ = false;
49
50 std::string applicationName_;
51 bool wasHelpdisplayed_ = false;
52 std::string ipAddress_;
53 std::string password_;
54
55 // If set via "--duration <sec>":
56 // Samples can use this to stop automatically after a fixed time.
57 // Default is interactive behaviour (0).
58 unsigned int durationSeconds_ = 0;
59};
60
61} // end namespace utility
Definition Helper.h:23
bool wasHelpdisplayed_
Indicate that the help meesage was displayed and we should not continue.
Definition Helper.h:51
std::string applicationName_
contains the application name as given as first parameter from command line
Definition Helper.h:50
const std::string & getPassword() const
Get the password parse from command line.
Definition Helper.cpp:224
std::string ipAddress_
The ip v4 address as string in the form xxx.xxx.xxx.xxx.
Definition Helper.h:52
void showUsage()
Display the how to use message.
Definition Helper.cpp:239
void parse(int argc, char **argv)
Parse the command line options.
bool wasHelpdisplayed() const
returns true if the help show be displayed
Definition Helper.cpp:214
const std::string & getIpAddress() const
Get the ip address parse from command line.
Definition Helper.cpp:219
std::string password_
Password for secure samples (second positional argument)
Definition Helper.h:53