IDS peak genericC++  v1.4.0
peak_firmware_update_information.hpp
Go to the documentation of this file.
1 
11 #pragma once
12 
13 
15 #include <peak/dll_interface/peak_dll_interface_util.hpp>
16 
17 #include <string>
18 
19 
20 namespace peak
21 {
22 namespace core
23 {
24 
29 {
30  None,
31  Full
32 };
33 
41 {
47  Dotted,
51  Semantic
52 };
53 
63 {
64 public:
65  FirmwareUpdateInformation() = delete;
66  ~FirmwareUpdateInformation() = default;
68  FirmwareUpdateInformation& operator=(const FirmwareUpdateInformation& other) = delete;
70  FirmwareUpdateInformation& operator=(FirmwareUpdateInformation&& other) = delete;
71 
82  bool IsValid() const;
92  std::string FileName() const;
102  std::string Description() const;
112  std::string Version() const;
125  std::string VersionExtractionPattern() const;
138  FirmwareUpdateVersionStyle VersionStyle() const;
148  std::string ReleaseNotes() const;
160  std::string ReleaseNotesURL() const;
170  FirmwareUpdatePersistence UserSetPersistence() const;
180  FirmwareUpdatePersistence SequencerSetPersistence() const;
181 
182 private:
183  friend ClassCreator<FirmwareUpdateInformation>;
184  explicit FirmwareUpdateInformation(PEAK_FIRMWARE_UPDATE_INFORMATION_HANDLE firmwareUpdateInformationHandle);
186 
187  friend class FirmwareUpdater;
188 };
189 
190 } /* namespace core */
191 } /* namespace peak */
192 
193 /* Implementation */
194 namespace peak
195 {
196 namespace core
197 {
198 
200  PEAK_FIRMWARE_UPDATE_INFORMATION_HANDLE firmwareUpdateInformationHandle)
201  : m_backendHandle(firmwareUpdateInformationHandle)
202 {}
203 
205 {
206  return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](PEAK_BOOL8* isValid) {
207  return PEAK_C_ABI_PREFIX PEAK_FirmwareUpdateInformation_GetIsValid(m_backendHandle, isValid);
208  }) > 0;
209 }
210 
211 inline std::string FirmwareUpdateInformation::FileName() const
212 {
213  return QueryStringFromCInterfaceFunction([&](char* fileName, size_t* fileNameSize) {
215  m_backendHandle, fileName, fileNameSize);
216  });
217 }
218 
219 inline std::string FirmwareUpdateInformation::Description() const
220 {
221  return QueryStringFromCInterfaceFunction([&](char* description, size_t* descriptionSize) {
223  m_backendHandle, description, descriptionSize);
224  });
225 }
226 
227 inline std::string FirmwareUpdateInformation::Version() const
228 {
229  return QueryStringFromCInterfaceFunction([&](char* version, size_t* versionSize) {
230  return PEAK_C_ABI_PREFIX PEAK_FirmwareUpdateInformation_GetVersion(m_backendHandle, version, versionSize);
231  });
232 }
233 
235 {
236  return QueryStringFromCInterfaceFunction([&](char* versionExtractionPattern, size_t* versionExtractionPatternSize) {
238  m_backendHandle, versionExtractionPattern, versionExtractionPatternSize);
239  });
240 }
241 
243 {
244  return static_cast<FirmwareUpdateVersionStyle>(
245  QueryNumericFromCInterfaceFunction<PEAK_FIRMWARE_UPDATE_VERSION_STYLE>(
246  [&](PEAK_FIRMWARE_UPDATE_VERSION_STYLE* versionStyle) {
248  m_backendHandle, versionStyle);
249  }));
250 }
251 
252 inline std::string FirmwareUpdateInformation::ReleaseNotes() const
253 {
254  return QueryStringFromCInterfaceFunction([&](char* releaseNotes, size_t* releaseNotesSize) {
256  m_backendHandle, releaseNotes, releaseNotesSize);
257  });
258 }
259 
261 {
262  return QueryStringFromCInterfaceFunction([&](char* releaseNotesUrl, size_t* releaseNotesUrlSize) {
264  m_backendHandle, releaseNotesUrl, releaseNotesUrlSize);
265  });
266 }
267 
269 {
270  return static_cast<FirmwareUpdatePersistence>(
271  QueryNumericFromCInterfaceFunction<PEAK_FIRMWARE_UPDATE_PERSISTENCE>(
272  [&](PEAK_FIRMWARE_UPDATE_PERSISTENCE* userSetPersistence) {
274  m_backendHandle, userSetPersistence);
275  }));
276 }
277 
279 {
280  return static_cast<FirmwareUpdatePersistence>(
281  QueryNumericFromCInterfaceFunction<PEAK_FIRMWARE_UPDATE_PERSISTENCE>(
282  [&](PEAK_FIRMWARE_UPDATE_PERSISTENCE* sequencerSetPersistence) {
284  m_backendHandle, sequencerSetPersistence);
285  }));
286 }
287 
288 inline std::string ToString(FirmwareUpdatePersistence entry)
289 {
290  std::string entryString;
291 
292  if (entry == FirmwareUpdatePersistence::None)
293  {
294  entryString = "None";
295  }
296  else if (entry == FirmwareUpdatePersistence::Full)
297  {
298  entryString = "Full";
299  }
300 
301  return entryString;
302 }
303 
304 inline std::string ToString(FirmwareUpdateVersionStyle entry)
305 {
306  std::string entryString;
307 
309  {
310  entryString = "Dotted";
311  }
312  else if (entry == FirmwareUpdateVersionStyle::Semantic)
313  {
314  entryString = "Semantic";
315  }
316 
317  return entryString;
318 }
319 
320 } /* namespace core */
321 } /* namespace peak */
int8_t PEAK_BOOL8
Definition: peak_backend.h:26
PEAK_C_API PEAK_FirmwareUpdateInformation_GetVersionStyle(PEAK_FIRMWARE_UPDATE_INFORMATION_HANDLE firmwareUpdateInformationHandle, PEAK_FIRMWARE_UPDATE_VERSION_STYLE *versionStyle)
Asks the given firmware update information for its version style.
The "peak" namespace directly contains convenience functionality like the DeviceManager as well as th...
Definition: peak_dynamic_loader.h:32
FirmwareUpdatePersistence
Specifies if the device persists user sets and/or sequencer sets during the update.
Definition: peak_firmware_update_information.hpp:28
The device guarantees, that all sets are persisted during the update.
std::string ToString(BufferPayloadType entry)
Definition: peak_buffer.hpp:472
std::string FileName() const
Returns the file name of the package this firmware update information belongs to. ...
Definition: peak_firmware_update_information.hpp:211
All sets are reset to default values during the update.
PEAK_C_API PEAK_FirmwareUpdateInformation_GetReleaseNotes(PEAK_FIRMWARE_UPDATE_INFORMATION_HANDLE firmwareUpdateInformationHandle, char *releaseNotes, size_t *releaseNotesSize)
Asks the given firmware update information for its release notes.
Represents a single firmware update information.
Definition: peak_firmware_update_information.hpp:62
PEAK_C_API PEAK_FirmwareUpdateInformation_GetDescription(PEAK_FIRMWARE_UPDATE_INFORMATION_HANDLE firmwareUpdateInformationHandle, char *description, size_t *descriptionSize)
Asks the given firmware update information for its description.
std::string ReleaseNotesURL() const
A link to a webpage with more release notes.
Definition: peak_firmware_update_information.hpp:260
Allows to update the firmware of a device.
Definition: peak_firmware_updater.hpp:45
PEAK_C_API PEAK_FirmwareUpdateInformation_GetFileName(PEAK_FIRMWARE_UPDATE_INFORMATION_HANDLE firmwareUpdateInformationHandle, char *fileName, size_t *fileNameSize)
Asks the given firmware update information for its file name.
PEAK_C_API PEAK_FirmwareUpdateInformation_GetVersionExtractionPattern(PEAK_FIRMWARE_UPDATE_INFORMATION_HANDLE firmwareUpdateInformationHandle, char *versionExtractionPattern, size_t *versionExtractionPatternSize)
Asks the given firmware update information for its version extraction pattern.
PEAK_C_API PEAK_FirmwareUpdateInformation_GetIsValid(PEAK_FIRMWARE_UPDATE_INFORMATION_HANDLE firmwareUpdateInformationHandle, PEAK_BOOL8 *isValid)
Asks the given firmware update information whether it is valid.
FirmwareUpdatePersistence UserSetPersistence() const
Specifies if the device persists user sets during the update.
Definition: peak_firmware_update_information.hpp:268
FirmwareUpdateVersionStyle
The style of the version value.
Definition: peak_firmware_update_information.hpp:40
std::string ReleaseNotes() const
Release notes of the firmware update.
Definition: peak_firmware_update_information.hpp:252
bool IsValid() const
Checks whether the information held are valid.
Definition: peak_firmware_update_information.hpp:204
PEAK_C_API PEAK_FirmwareUpdateInformation_GetReleaseNotesURL(PEAK_FIRMWARE_UPDATE_INFORMATION_HANDLE firmwareUpdateInformationHandle, char *releaseNotesUrl, size_t *releaseNotesUrlSize)
Asks the given firmware update information for its release notes URL.
PEAK_C_API PEAK_FirmwareUpdateInformation_GetUserSetPersistence(PEAK_FIRMWARE_UPDATE_INFORMATION_HANDLE firmwareUpdateInformationHandle, PEAK_FIRMWARE_UPDATE_PERSISTENCE *userSetPersistence)
Asks the given firmware update information for its user set persistence.
FirmwareUpdateVersionStyle VersionStyle() const
The style of the Version() value.
Definition: peak_firmware_update_information.hpp:242
std::string Version() const
Returns the version of the firmware update.
Definition: peak_firmware_update_information.hpp:227
#define PEAK_C_ABI_PREFIX
Definition: peak_dll_defines.h:16
int32_t PEAK_FIRMWARE_UPDATE_PERSISTENCE
Definition: peak_backend.h:176
struct PEAK_FIRMWARE_UPDATE_INFORMATION * PEAK_FIRMWARE_UPDATE_INFORMATION_HANDLE
Definition: peak_backend.h:473
PEAK_C_API PEAK_FirmwareUpdateInformation_GetSequencerSetPersistence(PEAK_FIRMWARE_UPDATE_INFORMATION_HANDLE firmwareUpdateInformationHandle, PEAK_FIRMWARE_UPDATE_PERSISTENCE *sequencerSetPersistence)
Asks the given firmware update information for its sequencer set persistence.
FirmwareUpdatePersistence SequencerSetPersistence() const
Specifies if the device persists sequencer sets during the update.
Definition: peak_firmware_update_information.hpp:278
std::string VersionExtractionPattern() const
Regular expression to extract the device version from the DeviceFirmwareVersion node.
Definition: peak_firmware_update_information.hpp:234
std::string Description() const
Returns the description of the firmware update.
Definition: peak_firmware_update_information.hpp:219
int32_t PEAK_FIRMWARE_UPDATE_VERSION_STYLE
Definition: peak_backend.h:197
PEAK_C_API PEAK_FirmwareUpdateInformation_GetVersion(PEAK_FIRMWARE_UPDATE_INFORMATION_HANDLE firmwareUpdateInformationHandle, char *version, size_t *versionSize)
Asks the given firmware update information for its version.