Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
List.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020, Cascoda Ltd.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * 3. Neither the name of the copyright holder nor the
13  * names of its contributors may be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  * POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef POSIX_APP_CHILICTL_LIST_LIST_HPP_
30 #define POSIX_APP_CHILICTL_LIST_LIST_HPP_
31 
32 #include "ca821x_error.h"
33 
34 #include "common/Args.hpp"
35 #include "common/Command.hpp"
36 #include "common/DeviceList.hpp"
37 
38 namespace ca {
39 
40 class List : public Command
41 {
42 public:
43  List();
44 
48  ca_error Process(int argc, const char *argv[]);
49 
50 private:
51  Args mArgParser;
52  ArgOpt mHelpArg;
53  ArgOpt mAvailableArg;
54  ArgOpt mExtFlashAvailableArg;
55  ArgOpt mSerialArg;
56  ArgOpt mMinVersionArg;
57  ArgOpt mEnumerateUartDevicesArg;
58  DeviceList mDeviceList;
59  DeviceListFilter mDeviceListFilter;
60 
61  bool mExitBeforeWork;
62 
63  void print_info(const DeviceInfo &aDeviceInfo);
64 
65  ca_error print_help_string(const char *aArg);
66  ca_error set_available(const char *aArg);
67  ca_error set_extflash_available(const char *aArg);
68  ca_error set_serialno_filter(const char *aArg);
69  ca_error set_versionno_filter(const char *aArg);
70 };
71 
72 } /* namespace ca */
73 
74 #endif /* POSIX_APP_CHILICTL_LIST_LIST_HPP_ */
Global error declarations for use across the Cascoda SDK.
Structure for holding the definition of potential options to pass on the command line.
Definition: Args.hpp:45
Class for parsing and handling options passed as command line arguments.
Definition: Args.hpp:133
Abstract class for handling command positional arguments, to be implemented by the command classes.
Definition: Command.hpp:40
C++ wrapper for the C ca_device_info struct, which owns its own memory.
Definition: DeviceInfo.hpp:40
Definition: DeviceList.hpp:40
Class to assist in obtaining a list of connected ca821x devices, filtering as required.
Definition: DeviceList.hpp:121
Definition: List.hpp:41
ca_error Process(int argc, const char *argv[])
Run the command, processing the arguments passed in argv.
Definition: List.cpp:88
List()
Definition: List.cpp:38
ca_error
Cascoda error type.
Definition: ca821x_error.h:51
Definition: Args.cpp:34