IDS peak genericC++  v1.7.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;
83 
93  std::string FileName() const;
94 
104  std::string Description() const;
105 
115  std::string Version() const;
116 
129  std::string VersionExtractionPattern() const;
130 
143  FirmwareUpdateVersionStyle VersionStyle() const;
144 
154  std::string ReleaseNotes() const;
155 
167  std::string ReleaseNotesURL() const;
168 
178  FirmwareUpdatePersistence UserSetPersistence() const;
179 
189  FirmwareUpdatePersistence SequencerSetPersistence() const;
190 
191 private:
192  friend ClassCreator<FirmwareUpdateInformation>;
193  explicit FirmwareUpdateInformation(PEAK_FIRMWARE_UPDATE_INFORMATION_HANDLE firmwareUpdateInformationHandle);
195 
196  friend class FirmwareUpdater;
197 };
198 
199 } /* namespace core */
200 } /* namespace peak */
201 
202 /* Implementation */
203 namespace peak
204 {
205 namespace core
206 {
207 
209  PEAK_FIRMWARE_UPDATE_INFORMATION_HANDLE firmwareUpdateInformationHandle)
210  : m_backendHandle(firmwareUpdateInformationHandle)
211 {}
212 
214 {
215  return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](PEAK_BOOL8* isValid) {
216  return PEAK_C_ABI_PREFIX PEAK_FirmwareUpdateInformation_GetIsValid(m_backendHandle, isValid);
217  }) > 0;
218 }
219 
220 inline std::string FirmwareUpdateInformation::FileName() const
221 {
222  return QueryStringFromCInterfaceFunction([&](char* fileName, size_t* fileNameSize) {
224  m_backendHandle, fileName, fileNameSize);
225  });
226 }
227 
228 inline std::string FirmwareUpdateInformation::Description() const
229 {
230  return QueryStringFromCInterfaceFunction([&](char* description, size_t* descriptionSize) {
232  m_backendHandle, description, descriptionSize);
233  });
234 }
235 
236 inline std::string FirmwareUpdateInformation::Version() const
237 {
238  return QueryStringFromCInterfaceFunction([&](char* version, size_t* versionSize) {
239  return PEAK_C_ABI_PREFIX PEAK_FirmwareUpdateInformation_GetVersion(m_backendHandle, version, versionSize);
240  });
241 }
242 
244 {
245  return QueryStringFromCInterfaceFunction([&](char* versionExtractionPattern, size_t* versionExtractionPatternSize) {
247  m_backendHandle, versionExtractionPattern, versionExtractionPatternSize);
248  });
249 }
250 
252 {
253  return static_cast<FirmwareUpdateVersionStyle>(
254  QueryNumericFromCInterfaceFunction<PEAK_FIRMWARE_UPDATE_VERSION_STYLE>(
255  [&](PEAK_FIRMWARE_UPDATE_VERSION_STYLE* versionStyle) {
257  m_backendHandle, versionStyle);
258  }));
259 }
260 
261 inline std::string FirmwareUpdateInformation::ReleaseNotes() const
262 {
263  return QueryStringFromCInterfaceFunction([&](char* releaseNotes, size_t* releaseNotesSize) {
265  m_backendHandle, releaseNotes, releaseNotesSize);
266  });
267 }
268 
270 {
271  return QueryStringFromCInterfaceFunction([&](char* releaseNotesUrl, size_t* releaseNotesUrlSize) {
273  m_backendHandle, releaseNotesUrl, releaseNotesUrlSize);
274  });
275 }
276 
278 {
279  return static_cast<FirmwareUpdatePersistence>(
280  QueryNumericFromCInterfaceFunction<PEAK_FIRMWARE_UPDATE_PERSISTENCE>(
281  [&](PEAK_FIRMWARE_UPDATE_PERSISTENCE* userSetPersistence) {
283  m_backendHandle, userSetPersistence);
284  }));
285 }
286 
288 {
289  return static_cast<FirmwareUpdatePersistence>(
290  QueryNumericFromCInterfaceFunction<PEAK_FIRMWARE_UPDATE_PERSISTENCE>(
291  [&](PEAK_FIRMWARE_UPDATE_PERSISTENCE* sequencerSetPersistence) {
293  m_backendHandle, sequencerSetPersistence);
294  }));
295 }
296 
297 inline std::string ToString(FirmwareUpdatePersistence entry)
298 {
299  std::string entryString;
300 
301  if (entry == FirmwareUpdatePersistence::None)
302  {
303  entryString = "None";
304  }
305  else if (entry == FirmwareUpdatePersistence::Full)
306  {
307  entryString = "Full";
308  }
309 
310  return entryString;
311 }
312 
313 inline std::string ToString(FirmwareUpdateVersionStyle entry)
314 {
315  std::string entryString;
316 
318  {
319  entryString = "Dotted";
320  }
321  else if (entry == FirmwareUpdateVersionStyle::Semantic)
322  {
323  entryString = "Semantic";
324  }
325 
326  return entryString;
327 }
328 
329 } /* namespace core */
330 } /* 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:505
std::string FileName() const
Returns the file name of the package this firmware update information belongs to. ...
Definition: peak_firmware_update_information.hpp:220
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:269
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:277
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:261
bool IsValid() const
Checks whether the information held are valid.
Definition: peak_firmware_update_information.hpp:213
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:251
std::string Version() const
Returns the version of the firmware update.
Definition: peak_firmware_update_information.hpp:236
#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:475
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:287
std::string VersionExtractionPattern() const
Regular expression to extract the device version from the DeviceFirmwareVersion node.
Definition: peak_firmware_update_information.hpp:243
std::string Description() const
Returns the description of the firmware update.
Definition: peak_firmware_update_information.hpp:228
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.