[FL-2627] Flipper applications: SDK, build and debug system (#1387)

* 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>
This commit is contained in:
SG
2022-09-15 02:11:38 +10:00
committed by Aleksandr Kutuzov
parent 0f6f9ad52e
commit b9a766d909
895 changed files with 8862 additions and 1465 deletions

View File

@@ -1,4 +1,5 @@
template <typename TApp> class GenericScene {
template <typename TApp>
class GenericScene {
public:
virtual void on_enter(TApp* app, bool need_restore) = 0;
virtual bool on_event(TApp* app, typename TApp::Event* event) = 0;

View File

@@ -6,7 +6,8 @@
*
* @tparam TRecordClass record class
*/
template <typename TRecordClass> class RecordController {
template <typename TRecordClass>
class RecordController {
public:
/**
* @brief Construct a new Record Controller object for record with record name

View File

@@ -11,7 +11,8 @@
* @tparam TScene generic scene class
* @tparam TApp application class
*/
template <typename TScene, typename TApp> class SceneController {
template <typename TScene, typename TApp>
class SceneController {
public:
/**
* @brief Add scene to scene container

View File

@@ -33,12 +33,14 @@ namespace ext {
/**
* Dummy type for tag-dispatching.
*/
template <typename T> struct tag_type {};
template <typename T>
struct tag_type {};
/**
* A value of tag_type<T>.
*/
template <typename T> constexpr tag_type<T> tag{};
template <typename T>
constexpr tag_type<T> tag{};
/**
* A type_index implementation without RTTI.
@@ -47,7 +49,8 @@ struct type_index {
/**
* Creates a type_index object for the specified type.
*/
template <typename T> type_index(tag_type<T>) noexcept : hash_code_{index<T>} {
template <typename T>
type_index(tag_type<T>) noexcept : hash_code_{index<T>} {
}
/**
@@ -61,7 +64,8 @@ private:
/**
* Unique integral index associated to template type argument.
*/
template <typename T> static std::size_t const index;
template <typename T>
static std::size_t const index;
/**
* Global counter for generating index values.
@@ -75,14 +79,16 @@ private:
std::size_t hash_code_;
};
template <typename> std::size_t const type_index::index = type_index::counter()++;
template <typename>
std::size_t const type_index::index = type_index::counter()++;
/**
* Creates a type_index object for the specified type.
*
* Equivalent to `ext::type_index{ext::tag<T>}`.
*/
template <typename T> type_index make_type_index() noexcept {
template <typename T>
type_index make_type_index() noexcept {
return tag<T>;
}
@@ -111,7 +117,8 @@ inline bool operator>=(type_index const& a, type_index const& b) noexcept {
}
}
template <> struct std::hash<ext::type_index> {
template <>
struct std::hash<ext::type_index> {
using argument_type = ext::type_index;
using result_type = std::size_t;

View File

@@ -12,7 +12,8 @@
* @tparam TApp application class
* @tparam TViewModules variadic list of ViewModules
*/
template <typename TApp, typename... TViewModules> class ViewController {
template <typename TApp, typename... TViewModules>
class ViewController {
public:
ViewController() {
event_queue = furi_message_queue_alloc(10, sizeof(typename TApp::Event));
@@ -44,7 +45,8 @@ public:
* @tparam T Concrete ViewModule class
* @return T* ViewModule pointer
*/
template <typename T> T* get() {
template <typename T>
T* get() {
uint32_t view_index = ext::make_type_index<T>().hash_code();
furi_check(holder.count(view_index) != 0);
return static_cast<T*>(holder[view_index]);
@@ -56,7 +58,8 @@ public:
* @tparam T Concrete ViewModule class
* @return T* ViewModule pointer
*/
template <typename T> operator T*() {
template <typename T>
operator T*() {
uint32_t view_index = ext::make_type_index<T>().hash_code();
furi_check(holder.count(view_index) != 0);
return static_cast<T*>(holder[view_index]);
@@ -68,7 +71,8 @@ public:
* @tparam T Concrete ViewModule class
* @return T* ViewModule pointer
*/
template <typename T> void switch_to() {
template <typename T>
void switch_to() {
uint32_t view_index = ext::make_type_index<T>().hash_code();
furi_check(holder.count(view_index) != 0);
view_dispatcher_switch_to_view(view_dispatcher, view_index);