b9a766d909
* Added support for running applications from SD card (FAPs - Flipper Application Packages) * Added plugin_dist target for fbt to build FAPs * All apps of type FlipperAppType.EXTERNAL and FlipperAppType.PLUGIN are built as FAPs by default * Updated VSCode configuration for new fbt features - re-deploy stock configuration to use them * Added debugging support for FAPs with fbt debug & VSCode * Added public firmware API with automated versioning Co-authored-by: hedger <hedger@users.noreply.github.com> Co-authored-by: SG <who.just.the.doctor@gmail.com> Co-authored-by: あく <alleteam@gmail.com>
48 lines
961 B
C++
48 lines
961 B
C++
#pragma once
|
|
#include <core/record.h>
|
|
|
|
/**
|
|
* @brief Class for opening, casting, holding and closing records
|
|
*
|
|
* @tparam TRecordClass record class
|
|
*/
|
|
template <typename TRecordClass>
|
|
class RecordController {
|
|
public:
|
|
/**
|
|
* @brief Construct a new Record Controller object for record with record name
|
|
*
|
|
* @param record_name record name
|
|
*/
|
|
RecordController(const char* record_name) {
|
|
name = record_name;
|
|
value = static_cast<TRecordClass*>(furi_record_open(name));
|
|
};
|
|
|
|
~RecordController() {
|
|
furi_record_close(name);
|
|
}
|
|
|
|
/**
|
|
* @brief Record getter
|
|
*
|
|
* @return TRecordClass* record value
|
|
*/
|
|
TRecordClass* get() {
|
|
return value;
|
|
}
|
|
|
|
/**
|
|
* @brief Record getter (by cast)
|
|
*
|
|
* @return TRecordClass* record value
|
|
*/
|
|
operator TRecordClass*() const {
|
|
return value;
|
|
}
|
|
|
|
private:
|
|
const char* name;
|
|
TRecordClass* value;
|
|
};
|