29 #ifndef POSIX_APP_CHILICTL_COMMON_DEVICELIST_HPP_
30 #define POSIX_APP_CHILICTL_COMMON_DEVICELIST_HPP_
49 , mExtFlashAvailableFilter()
51 , mAvailableFilterEnabled()
52 , mExtFlashAvailableFilterEnabled()
62 mAvailableFilter = aTarget;
63 mAvailableFilterEnabled =
true;
72 mExtFlashAvailableFilter = aTarget;
73 mExtFlashAvailableFilterEnabled =
true;
86 void AddSerialNo(
const char *aSerialNo) { mSerialNoFilter.push_back(aSerialNo); }
92 void SetAppName(
const char *aAppName) { mAppNameFilter = aAppName; }
94 void SetMinVersion(
const char *aMinVersion) { mMinVersionFilter = aMinVersion; }
104 bool mAvailableFilter;
105 bool mExtFlashAvailableFilter;
106 std::vector<std::string> mSerialNoFilter;
107 std::string mAppNameFilter;
108 std::string mMinVersionFilter;
110 bool mAvailableFilterEnabled;
111 bool mExtFlashAvailableFilterEnabled;
112 bool mEnumerateUartDevicesEnabled;
140 const std::vector<DeviceInfo> &
Get() {
return mDevices; }
143 std::vector<DeviceInfo> mDevices;
C++ wrapper for the C ca_device_info struct, which owns its own memory.
Definition: DeviceInfo.hpp:40
Definition: DeviceList.hpp:40
void SetAppName(const char *aAppName)
Set the app name filter.
Definition: DeviceList.hpp:92
DeviceListFilter()
Default constructor.
Definition: DeviceList.hpp:47
void SetExtFlashAvailable(bool aTarget)
Enable the 'ext-flash-available' filter and set the parameters.
Definition: DeviceList.hpp:70
void SetMinVersion(const char *aMinVersion)
Definition: DeviceList.hpp:94
void ClearAvailable()
Disable the available filter.
Definition: DeviceList.hpp:79
void SetAvailable(bool aTarget)
Enable the 'available' filter and set the parameters.
Definition: DeviceList.hpp:60
bool IsFilterPass(const DeviceInfo &aDeviceInfo) const
Run the filter on the given DeviceInfo.
Definition: DeviceList.cpp:36
void AddSerialNo(const char *aSerialNo)
Add serial number to filter.
Definition: DeviceList.hpp:86
Class to assist in obtaining a list of connected ca821x devices, filtering as required.
Definition: DeviceList.hpp:121
void Refresh(const DeviceListFilter &aFilter=DeviceListFilter::sEmpty, bool enumerate_uart=false)
Refresh the internal list of devices.
Definition: DeviceList.cpp:71
DeviceList()
Default constructor.
Definition: DeviceList.hpp:126
const std::vector< DeviceInfo > & Get()
Get the list of discovered devices as a vector.
Definition: DeviceList.hpp:140