From 53970471a4c57c44de71ca86a626ed679dce73ba Mon Sep 17 00:00:00 2001 From: RogueMaster Date: Sat, 26 Nov 2022 23:19:06 -0500 Subject: [PATCH] Remove non working FAP --- ReadMe.md | 2 +- .../plugins/vbmigrate/.github/FUNDING.yml | 1 - .../vbmigrate/.github/workflows/build-fap.yml | 12 - applications/plugins/vbmigrate/LICENSE | 674 ------------------ applications/plugins/vbmigrate/README.md | 121 ---- .../plugins/vbmigrate/application.fam | 33 - .../vbmigrate/gui/modules/file_select.c | 481 ------------- .../vbmigrate/gui/modules/file_select.h | 31 - .../vbmigrate/icons/DolphinMafia_115x62.png | Bin 2504 -> 0 bytes .../vbmigrate/icons/DolphinNice_96x59.png | Bin 2459 -> 0 bytes .../plugins/vbmigrate/icons/Error_18x18.png | Bin 1083 -> 0 bytes .../plugins/vbmigrate/icons/Touch_26x26.png | Bin 14967 -> 0 bytes .../vbmigrate/scenes/vb_migrate_scene.c | 48 -- .../vbmigrate/scenes/vb_migrate_scene.h | 47 -- .../vbmigrate/scenes/vb_migrate_scene_about.c | 75 -- .../scenes/vb_migrate_scene_config.h | 33 - .../scenes/vb_migrate_scene_delete.c | 91 --- .../scenes/vb_migrate_scene_delete_captures.c | 85 --- ...vb_migrate_scene_delete_captures_success.c | 58 -- .../scenes/vb_migrate_scene_delete_success.c | 59 -- .../scenes/vb_migrate_scene_dev_menu.c | 107 --- .../scenes/vb_migrate_scene_from_app.c | 373 ---------- .../vbmigrate/scenes/vb_migrate_scene_info.c | 83 --- .../vbmigrate/scenes/vb_migrate_scene_load.c | 61 -- .../scenes/vb_migrate_scene_main_menu.c | 78 -- .../scenes/vb_migrate_scene_register.c | 436 ----------- .../scenes/vb_migrate_scene_register_save.c | 119 ---- .../scenes/vb_migrate_scene_save_success.c | 65 -- .../scenes/vb_migrate_scene_select.c | 57 -- .../scenes/vb_migrate_scene_to_app.c | 291 -------- applications/plugins/vbmigrate/vb_migrate.c | 319 --------- applications/plugins/vbmigrate/vb_migrate.h | 31 - applications/plugins/vbmigrate/vb_migrate_i.h | 97 --- applications/plugins/vbmigrate/vb_tag.c | 144 ---- applications/plugins/vbmigrate/vb_tag.h | 80 --- 35 files changed, 1 insertion(+), 4191 deletions(-) delete mode 100644 applications/plugins/vbmigrate/.github/FUNDING.yml delete mode 100644 applications/plugins/vbmigrate/.github/workflows/build-fap.yml delete mode 100644 applications/plugins/vbmigrate/LICENSE delete mode 100644 applications/plugins/vbmigrate/README.md delete mode 100644 applications/plugins/vbmigrate/application.fam delete mode 100644 applications/plugins/vbmigrate/gui/modules/file_select.c delete mode 100644 applications/plugins/vbmigrate/gui/modules/file_select.h delete mode 100644 applications/plugins/vbmigrate/icons/DolphinMafia_115x62.png delete mode 100644 applications/plugins/vbmigrate/icons/DolphinNice_96x59.png delete mode 100644 applications/plugins/vbmigrate/icons/Error_18x18.png delete mode 100644 applications/plugins/vbmigrate/icons/Touch_26x26.png delete mode 100644 applications/plugins/vbmigrate/scenes/vb_migrate_scene.c delete mode 100644 applications/plugins/vbmigrate/scenes/vb_migrate_scene.h delete mode 100644 applications/plugins/vbmigrate/scenes/vb_migrate_scene_about.c delete mode 100644 applications/plugins/vbmigrate/scenes/vb_migrate_scene_config.h delete mode 100644 applications/plugins/vbmigrate/scenes/vb_migrate_scene_delete.c delete mode 100644 applications/plugins/vbmigrate/scenes/vb_migrate_scene_delete_captures.c delete mode 100644 applications/plugins/vbmigrate/scenes/vb_migrate_scene_delete_captures_success.c delete mode 100644 applications/plugins/vbmigrate/scenes/vb_migrate_scene_delete_success.c delete mode 100644 applications/plugins/vbmigrate/scenes/vb_migrate_scene_dev_menu.c delete mode 100644 applications/plugins/vbmigrate/scenes/vb_migrate_scene_from_app.c delete mode 100644 applications/plugins/vbmigrate/scenes/vb_migrate_scene_info.c delete mode 100644 applications/plugins/vbmigrate/scenes/vb_migrate_scene_load.c delete mode 100644 applications/plugins/vbmigrate/scenes/vb_migrate_scene_main_menu.c delete mode 100644 applications/plugins/vbmigrate/scenes/vb_migrate_scene_register.c delete mode 100644 applications/plugins/vbmigrate/scenes/vb_migrate_scene_register_save.c delete mode 100644 applications/plugins/vbmigrate/scenes/vb_migrate_scene_save_success.c delete mode 100644 applications/plugins/vbmigrate/scenes/vb_migrate_scene_select.c delete mode 100644 applications/plugins/vbmigrate/scenes/vb_migrate_scene_to_app.c delete mode 100644 applications/plugins/vbmigrate/vb_migrate.c delete mode 100644 applications/plugins/vbmigrate/vb_migrate.h delete mode 100644 applications/plugins/vbmigrate/vb_migrate_i.h delete mode 100644 applications/plugins/vbmigrate/vb_tag.c delete mode 100644 applications/plugins/vbmigrate/vb_tag.h diff --git a/ReadMe.md b/ReadMe.md index 2a095b3f2..eecd361c9 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -31,6 +31,7 @@ Thank you to all the supporters! - Added: [VB Lab Migration Assistant (By GMMan)](https://github.com/GMMan/flipperzero-vb-migrate) `Req: Vital Bracelet` - Updated: [nfc: NTAG password auto capture (and other password-related changes) #1843 (By GMMan)](https://github.com/flipperdevices/flipperzero-firmware/pull/1843) - Renamed some FAPs to fix ordering in Applications, delete your `/ext/apps` folder to get rid of duplicates +- Removed: [VB Lab Migration Assistant (By GMMan)](https://github.com/GMMan/flipperzero-vb-migrate) `Req: Vital Bracelet` ## Install from Release FLASH STOCK FIRST BEFORE UPDATING TO CUSTOM FIRMWARE! @@ -244,7 +245,6 @@ $ ./fbt resources icons dolphin_ext - [UART Echo (By DrZlo13)-OFW](https://github.com/flipperdevices/flipperzero-firmware/pull/831) - [USB HID Autofire (By pbek)](https://github.com/pbek/usb_hid_autofire) - [USB Keyboard (By huuck)](https://github.com/huuck/FlipperZeroUSBKeyboard) -- [VB Lab Migration Assistant (By GMMan)](https://github.com/GMMan/flipperzero-vb-migrate) `Req: Vital Bracelet` - [WAV Player (By DrZlo13)](https://github.com/flipperdevices/flipperzero-firmware/tree/zlo/wav-player) Updated by Atmanos & RogueMaster To Work - [WiFi (Deauther) V2 (By Timmotools)](https://github.com/Timmotools/flipperzero_esp8266_deautherv2) `Req: ESP8266` - [WiFi (Marauder) (By 0xchocolate)](https://github.com/0xchocolate/flipperzero-firmware-with-wifi-marauder-companion) `Req: ESP32 WITH MARAUDER FLASHED` diff --git a/applications/plugins/vbmigrate/.github/FUNDING.yml b/applications/plugins/vbmigrate/.github/FUNDING.yml deleted file mode 100644 index 2cabf7401..000000000 --- a/applications/plugins/vbmigrate/.github/FUNDING.yml +++ /dev/null @@ -1 +0,0 @@ -ko_fi: caralynx diff --git a/applications/plugins/vbmigrate/.github/workflows/build-fap.yml b/applications/plugins/vbmigrate/.github/workflows/build-fap.yml deleted file mode 100644 index f65b8609a..000000000 --- a/applications/plugins/vbmigrate/.github/workflows/build-fap.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: Build FAP -on: [push] - -jobs: - build: - if: ${{ false }} - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Build - uses: oleksiikutuzov/flipperzero-ufbt-action@v1 diff --git a/applications/plugins/vbmigrate/LICENSE b/applications/plugins/vbmigrate/LICENSE deleted file mode 100644 index f288702d2..000000000 --- a/applications/plugins/vbmigrate/LICENSE +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/applications/plugins/vbmigrate/README.md b/applications/plugins/vbmigrate/README.md deleted file mode 100644 index 7238768f0..000000000 --- a/applications/plugins/vbmigrate/README.md +++ /dev/null @@ -1,121 +0,0 @@ -VB Lab Migration Assistant for Flipper Zero -=========================================== - -This app is designed to make transferring your characters from VB Lab and VBC -Lab more convenient. - -[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/C0C81P4PX) - -Background ----------- -The Vital Bracelet Arena app is going to be the new companion app for the Vital -Bracelet series of fitness bracelet toys, however the app does not support -account linking from VB Lab and VBC Lab, and requires you to transfer characters -one by one from those apps through your Vital Bracelet. Because the Vital -Bracelet can only hold at most two characters at a time and requires inserting -Dim/VBM to complete the transfer, transferring all of your characters may take -a significant amount of time. The VB Lab Migration Assistant is designed to make -this process faster by allowing you to store an unlimited amount of characters -on the Flipper and to bypass the Dim loading process, therefore allowing you to -transfer your characters without having to flip back and forth between the apps -or wasting time loading data that will never be used. - -Usage ------ - -### 1. Register Vital Bracelet - -Registering your Vital Bracelet to the Flipper creates template data used for -emulating the VB using the Flipper. - -1. Select "Register Vital Bracelet" from Migration Assistant's main menu. -2. If you have an active character on your Vital Bracelet, **transfer it to VB - Lab**. The active character slot on the VB has to be empty to avoid issues - when transferring character from VB Lab to the Flipper. Press the right key - on Flipper. -3. If there is an active character in VB Lab, put it in storage. -4. On VB Lab's "Scan" page, tap "Vital Bracelet -> App". Press the right key on - Flipper. -5. Tap the Flipper to your Vital Bracelet. You do not have to put the VB in - scan mode. When Flipper finishes reading, it will beep. -6. On VB Lab, tap "Send", and tap the Flipper to your phone. VB Lab will give - you an error message. This is normal, and you can dismiss it. The Flipper - will beep. Wait for it to switch to the next screen. -7. Tap the Flipper to the original Vital Bracelet again. The Flipper will beep - when it's finished reading. -8. Name the Vital Bracelet and select "Save". - -The Vital Bracelet info will show after saving. - -### 2. Select Vital Bracelet, Vital Bracelet Info - -Use the "Select Vital Bracelet" menu to load a previously registered VB. After -loading, you will see information about this Vital Bracelet: - -- Registered name -- Vital Bracelet type -- Number of characters captured - -Press the right key to see a menu of options you can use with the registered VB. - -### Spoof Version - -Vital Bracelet Arena splits Vital Bracelet and Vital Hero Digimon into -mutually-exclusive categories, and currently transferring VBM characters from -VBDM has not been tested, so if you want to transfer between categories, you -can select the Vital Bracelet version to spoof to change the VB type and force -the app to perform transfers between categories. - -### 3. Transfer App > Flipper - -Use this mode to transfer characters from VB Lab to Flipper. - -1. An instructions screen is displayed. Press right key to continue. -2. On your VB Lab app, wake up the character you want to send (if you have not - already). -3. Go to the "Scan" screen, and tap "App -> Vital Bracelet". Select "Check Dim - Card". If prompted to send Special Missions or items, tap "No". -4. Tap the Flipper to your phone. Release when VB Lab indicates to do so, and - wait for Flipper to beep. -5. Tap "Check Dim Installation" on VB Lab, and tap Flipper to your phone. - Flipper will beep. -6. Tap "Send" on VB Lab, and tap Flipper to your phone. Hold it there until VB - Lab shows the transfer animation. Flipper will beep after it has received - the character. -7. Tap "OK" on VB Lab. Flipper will have automatically reloaded the template so - you can repeat from step 2 again to transfer more characters. -8. When you are done transferring characters, press the left key on Flipper to - exit the transfer mode. - -Note if you have previously transferred characters to Flipper, the new -characters you transfer will be put at the end of the sequence of characters -when transferring from Flipper to app. - -### 4. Transfer Flipper > App - -Use this mode to transfer characters from Flipper to VB Lab. - -1. An instructions screen is displayed. Press right key to continue. -2. On your VB Lab app, if you have an active character, save the character into - storage. -3. Go to the "Scan" screen, and tap "Vital Bracelet -> App". -4. Tap "Send". Tap your Flipper to your phone, and hold until VB Lab shows the - transfer animation. Flipper will beep when it detected the transfer and will - load the next character. -5. Repeat from step 2 until all of your characters have been transferred. -6. If you want to skip a certain character, press the right key to skip and load - the next character. -7. You will see the "Transfers complete" screen on Flipper when all characters - have been transferred. Press the right key to return to the menu. - -### 5. Clear Captures - -If you are doing transfers in batches, you can clear the currently captured -characters so you do not have to skip them when transferring to app. Check the -details, and press the right key to confirm deletion. - -### 6. Delete Vital Bracelet - -If you want to unregister the Vital Bracelet, you can use this option to delete -its captures and remove it from the "Select Vital Bracelet" list. Check the -details, and press the right key to confirm deletion. diff --git a/applications/plugins/vbmigrate/application.fam b/applications/plugins/vbmigrate/application.fam deleted file mode 100644 index 66c612548..000000000 --- a/applications/plugins/vbmigrate/application.fam +++ /dev/null @@ -1,33 +0,0 @@ -# SPDX-License-Identifier: GPL-3.0-or-later -# -# VB Lab Migration Assistant for Flipper Zero -# Copyright (C) 2022 cyanic -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -App( - appid="VB_migrate", - name="VB Migration Assistant", - apptype=FlipperAppType.EXTERNAL, - entry_point="vb_migrate_app", - requires=["gui", "storage"], - stack_size=2 * 1024, - fap_version=(0,2), - fap_libs=["nfc", "misc", "mbedtls", "ST25RFAL002", "gcc", "toolbox"], - fap_category="Tools", - fap_description="Makes transferring characters with VB Lab less cumbersome", - fap_author="cyanic", - fap_weburl="https://github.com/GMMan/flipperzero-vb-migrate", - fap_icon_assets="icons", -) diff --git a/applications/plugins/vbmigrate/gui/modules/file_select.c b/applications/plugins/vbmigrate/gui/modules/file_select.c deleted file mode 100644 index c7560af75..000000000 --- a/applications/plugins/vbmigrate/gui/modules/file_select.c +++ /dev/null @@ -1,481 +0,0 @@ -#include "file_select.h" -#include -#include - -#define FILENAME_COUNT 4 - -struct FileSelect { - // public - View* view; - Storage* fs_api; - const char* path; - const char* extension; - - bool init_completed; - - FileSelectCallback callback; - void* context; - - char* buffer; - uint8_t buffer_size; -}; - -typedef struct { - FuriString* filename[FILENAME_COUNT]; - uint8_t position; - - uint16_t first_file_index; - uint16_t file_count; - -} FileSelectModel; - -bool file_select_fill_strings(FileSelect* file_select); -bool file_select_fill_count(FileSelect* file_select); -static bool file_select_init_inner(FileSelect* file_select); - -static void file_select_draw_callback(Canvas* canvas, void* _model) { - FileSelectModel* model = _model; - - FuriString* string_buff; - const uint8_t item_height = 16; - const uint8_t item_width = 123; - const uint8_t text_max_width = 115; - - canvas_clear(canvas); - canvas_set_font(canvas, FontSecondary); - - if(model->file_count) { - for(uint8_t i = 0; i < MIN(FILENAME_COUNT, model->file_count); i++) { - if(i == model->position) { - canvas_set_color(canvas, ColorBlack); - canvas_draw_box(canvas, 0, (i * item_height) + 1, item_width, item_height - 2); - - canvas_set_color(canvas, ColorWhite); - canvas_draw_dot(canvas, 0, (i * item_height) + 1); - canvas_draw_dot(canvas, 0, (i * item_height) + item_height - 2); - canvas_draw_dot(canvas, item_width - 1, (i * item_height) + 1); - canvas_draw_dot(canvas, item_width - 1, (i * item_height) + item_height - 2); - } else { - canvas_set_color(canvas, ColorBlack); - } - - string_buff = furi_string_alloc_set(model->filename[i]); - elements_string_fit_width(canvas, string_buff, text_max_width); - canvas_draw_str( - canvas, 6, (i * item_height) + item_height - 4, furi_string_get_cstr(string_buff)); - - furi_string_free(string_buff); - } - } else { - canvas_draw_str(canvas, 6, item_height, "Empty folder"); - } - elements_scrollbar(canvas, model->first_file_index + model->position, model->file_count); -} - -static bool file_select_input_callback(InputEvent* event, void* context) { - FileSelect* file_select = (FileSelect*)context; - bool consumed = false; - - if((event->type == InputTypeShort) | (event->type == InputTypeRepeat)) { - if(!file_select->init_completed) { - if(!file_select_init_inner(file_select)) { - file_select->callback(false, file_select->context); - } - } else if(event->key == InputKeyUp) { - with_view_model( - file_select->view, - FileSelectModel * model, - { - if(model->position == 0) { - if(model->first_file_index == 0) { - // wrap - int16_t max_first_file_index = model->file_count - FILENAME_COUNT; - model->position = MIN(FILENAME_COUNT - 1, model->file_count - 1); - model->first_file_index = - max_first_file_index < 0 ? 0 : max_first_file_index; - } else { - model->first_file_index--; - } - } else if(model->position == 1) { - if(model->first_file_index == 0) { - model->position--; - } else { - model->first_file_index--; - } - } else { - model->position--; - } - }, - true); - consumed = true; - if(!file_select_fill_strings(file_select)) { - file_select->callback(false, file_select->context); - } - } else if(event->key == InputKeyDown) { - with_view_model( - file_select->view, - FileSelectModel * model, - { - uint16_t max_first_file_index = model->file_count > FILENAME_COUNT ? - model->file_count - FILENAME_COUNT : - 0; - - if(model->position >= MIN(FILENAME_COUNT - 1, model->file_count - 1)) { - if(model->first_file_index >= max_first_file_index) { - // wrap - model->position = 0; - model->first_file_index = 0; - } else { - model->first_file_index++; - } - } else if(model->position >= (FILENAME_COUNT - 2)) { - if(model->first_file_index >= max_first_file_index) { - model->position++; - } else { - model->first_file_index++; - } - } else { - model->position++; - } - }, - true); - consumed = true; - if(!file_select_fill_strings(file_select)) { - file_select->callback(false, file_select->context); - } - } else if(event->key == InputKeyOk) { - if(file_select->callback != NULL) { - size_t files = 0; - if(file_select->buffer) { - with_view_model( - file_select->view, - FileSelectModel * model, - { - files = model->file_count; - strlcpy( - file_select->buffer, - furi_string_get_cstr(model->filename[model->position]), - file_select->buffer_size); - }, - false); - }; - if(files > 0) { - file_select->callback(true, file_select->context); - } - } - consumed = true; - } - } - - return consumed; -} - -static bool file_select_init_inner(FileSelect* file_select) { - bool result = false; - if(file_select->path && file_select->extension && file_select->fs_api) { - if(file_select_fill_count(file_select)) { - if(file_select_fill_strings(file_select)) { - file_select->init_completed = true; - result = true; - } - } - } - - return result; -} - -FileSelect* file_select_alloc() { - FileSelect* file_select = malloc(sizeof(FileSelect)); - file_select->view = view_alloc(); - file_select->fs_api = furi_record_open("storage"); - - view_set_context(file_select->view, file_select); - view_allocate_model(file_select->view, ViewModelTypeLockFree, sizeof(FileSelectModel)); - view_set_draw_callback(file_select->view, file_select_draw_callback); - view_set_input_callback(file_select->view, file_select_input_callback); - - with_view_model( - file_select->view, - FileSelectModel * model, - { - for(uint8_t i = 0; i < FILENAME_COUNT; i++) { - model->filename[i] = furi_string_alloc(); - } - - model->first_file_index = 0; - model->file_count = 0; - }, - false); - - return file_select; -} - -void file_select_free(FileSelect* file_select) { - furi_assert(file_select); - with_view_model( - file_select->view, - FileSelectModel * model, - { - for(uint8_t i = 0; i < FILENAME_COUNT; i++) { - furi_string_free(model->filename[i]); - } - }, - false); - view_free(file_select->view); - free(file_select); - furi_record_close("storage"); -} - -View* file_select_get_view(FileSelect* file_select) { - furi_assert(file_select); - return file_select->view; -} - -void file_select_set_callback(FileSelect* file_select, FileSelectCallback callback, void* context) { - file_select->context = context; - file_select->callback = callback; -} - -void file_select_set_filter(FileSelect* file_select, const char* path, const char* extension) { - furi_assert(file_select); - file_select->path = path; - file_select->extension = extension; -} - -void file_select_set_result_buffer(FileSelect* file_select, char* buffer, uint8_t buffer_size) { - file_select->buffer = buffer; - file_select->buffer_size = buffer_size; - - if(file_select->buffer) { - strlcpy(file_select->buffer, "", file_select->buffer_size); - } -} - -bool file_select_init(FileSelect* file_select) { - if(!file_select_init_inner(file_select)) { - file_select->callback(false, file_select->context); - return false; - } else { - return true; - } -} - -static bool filter_file(FileSelect* file_select, FileInfo* file_info, char* name) { - bool result = false; - - if((file_info->flags & FSF_DIRECTORY)) { - if(strcmp(file_select->extension, "*") == 0) { - result = true; - } else if(strstr(name, file_select->extension) != NULL) { - result = true; - } - } - - return result; -} - -bool file_select_fill_strings(FileSelect* file_select) { - furi_assert(file_select); - furi_assert(file_select->fs_api); - furi_assert(file_select->path); - furi_assert(file_select->extension); - - FileInfo file_info; - File* directory = storage_file_alloc(file_select->fs_api); - - uint8_t string_counter = 0; - uint16_t file_counter = 0; - const uint8_t name_length = 100; - char* name = malloc(name_length); - uint16_t first_file_index = 0; - - with_view_model( - file_select->view, - FileSelectModel * model, - { first_file_index = model->first_file_index; }, - false); - - if(!storage_dir_open(directory, file_select->path)) { - storage_dir_close(directory); - storage_file_free(directory); - free(name); - return true; - } - - while(1) { - if(!storage_dir_read(directory, &file_info, name, name_length)) { - break; - } - - if(storage_file_get_error(directory) == FSE_OK) { - if(filter_file(file_select, &file_info, name)) { - if(file_counter >= first_file_index) { - with_view_model( - file_select->view, - FileSelectModel * model, - { - furi_string_set(model->filename[string_counter], name); - - if(strcmp(file_select->extension, "*") != 0) { - furi_string_replace_all_str( - model->filename[string_counter], file_select->extension, ""); - } - }, - true); - string_counter++; - - if(string_counter >= FILENAME_COUNT) { - break; - } - } - file_counter++; - } - } else { - storage_dir_close(directory); - storage_file_free(directory); - free(name); - return false; - } - } - - storage_dir_close(directory); - storage_file_free(directory); - free(name); - return true; -} - -bool file_select_fill_count(FileSelect* file_select) { - furi_assert(file_select); - furi_assert(file_select->fs_api); - furi_assert(file_select->path); - furi_assert(file_select->extension); - - FileInfo file_info; - File* directory = storage_file_alloc(file_select->fs_api); - - uint16_t file_counter = 0; - const uint8_t name_length = 100; - char* name = malloc(name_length); - - if(!storage_dir_open(directory, file_select->path)) { - storage_dir_close(directory); - storage_file_free(directory); - free(name); - return true; - } - - while(1) { - if(!storage_dir_read(directory, &file_info, name, name_length)) { - break; - } - - if(storage_file_get_error(directory) == FSE_OK) { - if(filter_file(file_select, &file_info, name)) { - file_counter++; - } - } else { - storage_dir_close(directory); - storage_file_free(directory); - free(name); - return false; - } - } - - with_view_model( - file_select->view, FileSelectModel * model, { model->file_count = file_counter; }, false); - - storage_dir_close(directory); - storage_file_free(directory); - free(name); - return true; -} - -void file_select_set_selected_file_internal(FileSelect* file_select, const char* filename) { - furi_assert(file_select); - furi_assert(filename); - furi_assert(file_select->fs_api); - furi_assert(file_select->path); - furi_assert(file_select->extension); - - if(strlen(filename) == 0) return; - - FileInfo file_info; - File* directory = storage_file_alloc(file_select->fs_api); - - const uint8_t name_length = 100; - char* name = malloc(name_length); - uint16_t file_position = 0; - bool file_found = false; - - FuriString* filename_str = furi_string_alloc_set_str(filename); - if(strcmp(file_select->extension, "*") != 0) { - furi_string_cat_str(filename_str, file_select->extension); - } - - if(!storage_dir_open(directory, file_select->path)) { - furi_string_free(filename_str); - storage_dir_close(directory); - storage_file_free(directory); - free(name); - return; - } - - while(1) { - if(!storage_dir_read(directory, &file_info, name, name_length)) { - break; - } - - if(storage_file_get_error(directory) == FSE_OK) { - if(filter_file(file_select, &file_info, name)) { - if(strcmp(furi_string_get_cstr(filename_str), name) == 0) { - file_found = true; - break; - } - - file_position++; - } - } else { - furi_string_free(filename_str); - storage_dir_close(directory); - storage_file_free(directory); - free(name); - return; - } - } - - if(file_found) { - with_view_model( - file_select->view, - FileSelectModel * model, - { - uint16_t max_first_file_index = - model->file_count > FILENAME_COUNT ? model->file_count - FILENAME_COUNT : 0; - - model->first_file_index = file_position; - - if(model->first_file_index > 0) { - model->first_file_index -= 1; - } - - if(model->first_file_index >= max_first_file_index) { - model->first_file_index = max_first_file_index; - } - - model->position = file_position - model->first_file_index; - }, - true); - } - - furi_string_free(filename_str); - storage_dir_close(directory); - storage_file_free(directory); - free(name); -} - -void file_select_set_selected_file(FileSelect* file_select, const char* filename) { - file_select_set_selected_file_internal(file_select, filename); - - if(!file_select_fill_strings(file_select)) { - file_select->callback(false, file_select->context); - } -} diff --git a/applications/plugins/vbmigrate/gui/modules/file_select.h b/applications/plugins/vbmigrate/gui/modules/file_select.h deleted file mode 100644 index ed3d5b60c..000000000 --- a/applications/plugins/vbmigrate/gui/modules/file_select.h +++ /dev/null @@ -1,31 +0,0 @@ -/** - * @file file_select.h - * GUI: FileSelect view module API - */ - -#pragma once - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct FileSelect FileSelect; - -typedef void (*FileSelectCallback)(bool result, void* context); - -FileSelect* file_select_alloc(); - -void file_select_free(FileSelect* file_select); -View* file_select_get_view(FileSelect* file_select); - -void file_select_set_callback(FileSelect* file_select, FileSelectCallback callback, void* context); -void file_select_set_filter(FileSelect* file_select, const char* path, const char* extension); -void file_select_set_result_buffer(FileSelect* file_select, char* buffer, uint8_t buffer_size); -bool file_select_init(FileSelect* file_select); -void file_select_set_selected_file(FileSelect* file_select, const char* filename); - -#ifdef __cplusplus -} -#endif diff --git a/applications/plugins/vbmigrate/icons/DolphinMafia_115x62.png b/applications/plugins/vbmigrate/icons/DolphinMafia_115x62.png deleted file mode 100644 index 66fdb40ff2651916faed4a2ae1d564cafdbf7bcb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2504 zcmbVO3se(V8ji5Kg5ZmV3I#ewZHbsZB8b0=g#+k z_y7La$vcsnwa$(njyxXES*27&ad(Ehf@a%szx(??vFC0MMrAy=Img9%&ES885R5X2P@K{dB9p<$p?SQ()g~i~r4cNkC3JdH&i}sg6d%yza(--p8dMv@ zh!njtmnNcfH8EIj8V2M1)j>d@3E>C~1d9SDLpsSICOLnC7va{{Z80C1fUs$Deu(uz zAWj_#gi$mBNJXF!13?Io!6J#&-(L!@03Z+o#bAI~0tqEj1oTHFGGOY%=T4*XWF$)Q z`>C_ICpkZbWsQhfoSmI5%Jvgcv`#F6VOR`8Vh9p)2qBY0vZzT&GE1fz6a<6OdLyf+ zNWjX7YNwhuAF&nut zlTM%T7{|m!I$L;81?0JCCML&7h@%LG%A_%3 zO%`|J5~~^`5=Ij!OVKeDl|G%Q$Z2^1BoRS?PpqEAscc5@GXp|_vV@$^WlbUkA?_Ok zK?n#V5acTX5fGe&s<}GAQ5OB*z!a`e&iO^CEx1S+l}^!W3g`Ur;{!N`BvZ5jW@%VH?>OF2Tk@O zPGOv@&rGEfX|lv0Cxk2gKu)ie6Af#Vr9x}>!CI+Aiv@szVry$~6u{(al2-hTBEgTzn_D^}jklllIvu1V{Q`ig6OgP|0jI zN)sVEE|=@hm?j7H6PqgYzU5==|fB0<6@J90B?N8); z?B48M`Q6&q<>QYftD|a*tJ$!0YduA;TS}(23t@i9jJ}9E&d>+O-{j}lDtd6mP7wiU?pLh0* zla-TQ!!6f>9b(>jct-Z*@vzVmEjaUp9adYyRH)W#u&{1)0G7#K8z}OOe9Z4J`?k~5 z;u#n4^?R%GdBZDjly!H8xtVMF9ud_Q|CsUp%X4BI?jMd19&&9{QqgG_a)Rz9J*BH| z$zM9cbZYA6R(n(=QYD(cO(#Aoy6CQh;hG<}_gRz&>ZIovmNuT&Z9VwM8m5pu&$kG$ zvTJ!+pA|E6E-UBtJJrv;*XaRo7|Z#x4L(qON`UQa?6`jZqnkg3XliTEuJKo%PCa~M z@WlnE3u1ZRT?c;b@m&$07PGImr1km-TQZ8*DS|rZudw{x4R!5F9=$VOt{XWj(Y>BT zd-yG`a(KJ-o0Dfs8h&U=J*C(_ z=8hNq6aC?^r7wqGy5!v`zvX@KNEDDEpXqBVXiB`Z=eNZRgGG2tG`F;x~xDn9)G1Y@4Fl28Px*E!|ivy@~-8Lx%@`DyQ}?V z4f!BGF*jl}N~1D%!=YeZY6W)9lyDw_Uq#NDJx^=CJZDD2|CF# zA7Ixt{Z7BT8@4fZgFkI{D9fJxang<$JS``+d(*81cbB@prG*c!rZ)8U4y-<__Pt)Z zZ3lJfK;Y5eZHd?A3O-!mWX3$UChhmy)r@4iKkvyz(mdTtF7?TWn4`7t4=} zZ`OLe!fHzEo3eUH7jwVD-n?Xnx$AC<-H6`;RB2iYH9UO}ROfZkPOl32mRZ%`xW#FL zD@GqK${E&#=gzidc(qkxLZ^tk7u}u0Uu|;00}}A@rq4$9xE75>Hwj!4$Nk!`)YmDg{{4HeKCy?7Z85xPzg%Peucca}QJ6#D*z!+`G0ZOj diff --git a/applications/plugins/vbmigrate/icons/DolphinNice_96x59.png b/applications/plugins/vbmigrate/icons/DolphinNice_96x59.png deleted file mode 100644 index a299d3630239b4486e249cc501872bed5996df3b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2459 zcmbVO3s4i+8V(M(gEFORwSrA`4O0uPn|M|5y* zB*aMDxC&7(gP9JN;POOi-9khrC>Z9YJs2U!LnVcQEEC0fDtKo&ILlzb30%M}3J^;~ zv7RzcsilOs4Mq@tD*&R;!LMSk2A~{(`HK9|hQBqEX)3sQr9Je6SZU*F-^fD-p+~Hs; zHLkO%v?>ZoxEv+F#whudr%615FkA0DYR0tMEo}3OOY#xecLWe>x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14tZy5Vpht-acr3wzodSJ7LG$w~&R=k59#fB^z^J?I*uE3T>>~$A= zv}k2`_D4hxGLuL*QZ`HpN(v?gZCb}d+E%e($Qrg470Wh8L!SNcdRo!)nwHX%a#B%p z*|~I9OY7;JrO#Vx(vXMPq8C!=*?8#NVZH}g?Le%V4KSo6s1ni|jzPIeC<&Xy2dXNj zz{L`@9WTDQ6nCkgw1op_1EYLET+l1C>Fg7Np-(rEjMD;|PN}R0nkLjCM1rR3EG3vi zX~a_KYA3hc1AOxR-^6tGo!e{*7ot=XaSLN&)^x7*$R z_;8nL#iBJ=jXt&Rz8&Mh$jFComtIimxkqQi diff --git a/applications/plugins/vbmigrate/icons/Touch_26x26.png b/applications/plugins/vbmigrate/icons/Touch_26x26.png deleted file mode 100644 index 32a9f629394975433175a60ddc5cceafc09049ea..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 14967 zcmeHtWmH_vwk-sAC&4v%e?ut)M89q;}* zW4!x*o$j%__g=NuthHv%+BPauSy2iNnGhKY3JOg|T0-^ZpYZpF2>YGlv2IFT?#U;l^ZI7*!kg&!@UpP$ee6W0|HJ+8(Q3>x zZPp&L5U~&1hK|Vhwdv4776HSFZnu4f2cJ+=!^1jk+ijNn%cuC87CpHRKi_HYl6L>| zuC5b5*+ahErVz5stkpGt-<7-DHg%gr;S-;fy`qczL+fmls{Nsp!&Bc0rzMUH++$fA zS1;0oE4pi()5B%4Cg!-pLaGaHr$`%r27hE-LFG`-nEVU#+XE$P$NLebwTI(0UoyYy z{zLtf(Fcbdn7khY*ylPESkzr|{tv#p%6+JCE$BG+c;h#^?JJF>eG4nd?m6kJo?gtm zg|DBlaX^^Iz#FyEntnn( z@GH9H?z(o7V2_Y$q`-X@pzC(1Gx&P*NXz567d}bZc00?frAF+1;;QO&VS0omm$V7ry{3|;N9;t}R`)cg` zQC*d4iAkezUdDK5rU@$SneVa1gXYf7+aKlJPL{D#wx6_|obP_oG+lJ1WF_rC6>dK< zG_4hI?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2T4&0 z&Z`*2_odk7a$s3%iw*!`-Q)C;>tH9!(-B-$y^6o1t$$S4FZgcOp)t=$&sf6hWNJ pbZIQYS6vrI8*}w?f|C%o;o?uW2qWO$0bUA*l95!Ds1!2_`af7o8=n9G diff --git a/applications/plugins/vbmigrate/scenes/vb_migrate_scene.c b/applications/plugins/vbmigrate/scenes/vb_migrate_scene.c deleted file mode 100644 index fcc168e28..000000000 --- a/applications/plugins/vbmigrate/scenes/vb_migrate_scene.c +++ /dev/null @@ -1,48 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// -// VB Lab Migration Assistant for Flipper Zero -// Copyright (C) 2022 cyanic -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -#include "vb_migrate_scene.h" - -// Generate scene on_enter handlers array -#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_enter, -void (*const vb_migrate_on_enter_handlers[])(void*) = { -#include "vb_migrate_scene_config.h" -}; -#undef ADD_SCENE - -// Generate scene on_event handlers array -#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_event, -bool (*const vb_migrate_on_event_handlers[])(void* context, SceneManagerEvent event) = { -#include "vb_migrate_scene_config.h" -}; -#undef ADD_SCENE - -// Generate scene on_exit handlers array -#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_exit, -void (*const vb_migrate_on_exit_handlers[])(void* context) = { -#include "vb_migrate_scene_config.h" -}; -#undef ADD_SCENE - -// Initialize scene handlers configuration structure -const SceneManagerHandlers vb_migrate_scene_handlers = { - .on_enter_handlers = vb_migrate_on_enter_handlers, - .on_event_handlers = vb_migrate_on_event_handlers, - .on_exit_handlers = vb_migrate_on_exit_handlers, - .scene_num = VbMigrateSceneNum, -}; diff --git a/applications/plugins/vbmigrate/scenes/vb_migrate_scene.h b/applications/plugins/vbmigrate/scenes/vb_migrate_scene.h deleted file mode 100644 index 7187bdf0b..000000000 --- a/applications/plugins/vbmigrate/scenes/vb_migrate_scene.h +++ /dev/null @@ -1,47 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// -// VB Lab Migration Assistant for Flipper Zero -// Copyright (C) 2022 cyanic -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -#pragma once - -#include - -// Generate scene id and total number -#define ADD_SCENE(prefix, name, id) VbMigrateScene##id, -typedef enum { -#include "vb_migrate_scene_config.h" - VbMigrateSceneNum, -} VbMigrateScene; -#undef ADD_SCENE - -extern const SceneManagerHandlers vb_migrate_scene_handlers; - -// Generate scene on_enter handlers declaration -#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_enter(void*); -#include "vb_migrate_scene_config.h" -#undef ADD_SCENE - -// Generate scene on_event handlers declaration -#define ADD_SCENE(prefix, name, id) \ - bool prefix##_scene_##name##_on_event(void* context, SceneManagerEvent event); -#include "vb_migrate_scene_config.h" -#undef ADD_SCENE - -// Generate scene on_exit handlers declaration -#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_exit(void* context); -#include "vb_migrate_scene_config.h" -#undef ADD_SCENE diff --git a/applications/plugins/vbmigrate/scenes/vb_migrate_scene_about.c b/applications/plugins/vbmigrate/scenes/vb_migrate_scene_about.c deleted file mode 100644 index 19dc2f0f0..000000000 --- a/applications/plugins/vbmigrate/scenes/vb_migrate_scene_about.c +++ /dev/null @@ -1,75 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// -// VB Lab Migration Assistant for Flipper Zero -// Copyright (C) 2022 cyanic -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -#include "../vb_migrate_i.h" - -void vb_migrate_scene_about_on_enter(void* context) { - VbMigrate* inst = context; - - // Perform your setup here - FuriString* temp_str = furi_string_alloc_printf( - "\e#Information\n" - "Version: %s\n" - "Developed by: cyanic\n" - "GitHub: https://github.com/GMMan/flipperzero-vb-migrate\n" - "\n" - "\e#Description\n" - "Makes transferring\n" - "characters with VB Lab less\n" - "cumbersome", - VB_MIGRATE_VERSION); - - Widget* widget = inst->widget; - widget_add_text_box_element( - widget, - 0, - 0, - 128, - 14, - AlignCenter, - AlignBottom, - "\e#\e! \e!\n", - false); - widget_add_text_box_element( - widget, - 0, - 2, - 128, - 14, - AlignCenter, - AlignBottom, - "\e#\e! VB Migration Assistant \e!\n", - false); - widget_add_text_scroll_element(widget, 0, 16, 128, 50, furi_string_get_cstr(temp_str)); - furi_string_free(temp_str); - - view_dispatcher_switch_to_view(inst->view_dispatcher, VbMigrateViewWidget); -} - -bool vb_migrate_scene_about_on_event(void* context, SceneManagerEvent event) { - UNUSED(context); - UNUSED(event); - return false; -} - -void vb_migrate_scene_about_on_exit(void* context) { - VbMigrate* inst = context; - - // Perform your cleanup here - widget_reset(inst->widget); -} diff --git a/applications/plugins/vbmigrate/scenes/vb_migrate_scene_config.h b/applications/plugins/vbmigrate/scenes/vb_migrate_scene_config.h deleted file mode 100644 index f090de9df..000000000 --- a/applications/plugins/vbmigrate/scenes/vb_migrate_scene_config.h +++ /dev/null @@ -1,33 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// -// VB Lab Migration Assistant for Flipper Zero -// Copyright (C) 2022 cyanic -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -ADD_SCENE(vb_migrate, main_menu, MainMenu) -ADD_SCENE(vb_migrate, register, Register) -ADD_SCENE(vb_migrate, register_save, RegisterSave) -ADD_SCENE(vb_migrate, save_success, SaveSuccess) -ADD_SCENE(vb_migrate, select, Select) -ADD_SCENE(vb_migrate, load, Load) -ADD_SCENE(vb_migrate, info, Info) -ADD_SCENE(vb_migrate, dev_menu, DevMenu) -ADD_SCENE(vb_migrate, delete, Delete) -ADD_SCENE(vb_migrate, delete_success, DeleteSuccess) -ADD_SCENE(vb_migrate, from_app, FromApp) -ADD_SCENE(vb_migrate, to_app, ToApp) -ADD_SCENE(vb_migrate, delete_captures, DeleteCaptures) -ADD_SCENE(vb_migrate, delete_captures_success, DeleteCapturesSuccess) -ADD_SCENE(vb_migrate, about, About) diff --git a/applications/plugins/vbmigrate/scenes/vb_migrate_scene_delete.c b/applications/plugins/vbmigrate/scenes/vb_migrate_scene_delete.c deleted file mode 100644 index 314d0f3c2..000000000 --- a/applications/plugins/vbmigrate/scenes/vb_migrate_scene_delete.c +++ /dev/null @@ -1,91 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// -// VB Lab Migration Assistant for Flipper Zero -// Copyright (C) 2022 cyanic -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -#include "../vb_migrate_i.h" -#include "../vb_tag.h" - -static void - vb_migrate_scene_delete_widget_callback(GuiButtonType result, InputType type, void* context) { - VbMigrate* inst = context; - - if(type == InputTypeShort) { - view_dispatcher_send_custom_event(inst->view_dispatcher, result); - } -} - -void vb_migrate_scene_delete_on_enter(void* context) { - VbMigrate* inst = context; - FuriString* temp_str; - - // Perform your setup here - BantBlock* bant = vb_tag_get_bant_block(&inst->nfc_dev->dev_data); - const VbTagProduct* product = vb_tag_find_product(bant); - if(product) - temp_str = furi_string_alloc_printf("\e#Delete %s?\e#", product->short_name); - else - temp_str = furi_string_alloc_set_str("\e#Delete VB?\e#"); - - widget_add_text_box_element( - inst->widget, - 0, - 0, - 128, - 23, - AlignCenter, - AlignCenter, - furi_string_get_cstr(temp_str), - false); - widget_add_button_element( - inst->widget, GuiButtonTypeLeft, "Cancel", vb_migrate_scene_delete_widget_callback, inst); - widget_add_button_element( - inst->widget, GuiButtonTypeRight, "Delete", vb_migrate_scene_delete_widget_callback, inst); - - furi_string_printf(temp_str, "%s\nCharas. captured: %d", inst->text_store, inst->num_captured); - widget_add_string_multiline_element( - inst->widget, 64, 24, AlignCenter, AlignTop, FontSecondary, furi_string_get_cstr(temp_str)); - furi_string_free(temp_str); - - view_dispatcher_switch_to_view(inst->view_dispatcher, VbMigrateViewWidget); -} - -bool vb_migrate_scene_delete_on_event(void* context, SceneManagerEvent event) { - VbMigrate* inst = context; - bool consumed = false; - - if(event.type == SceneManagerEventTypeCustom) { - if(event.event == GuiButtonTypeLeft) { - consumed = scene_manager_previous_scene(inst->scene_manager); - } else if(event.event == GuiButtonTypeRight) { - if(vb_migrate_delete(inst, inst->text_store, true)) { - scene_manager_next_scene(inst->scene_manager, VbMigrateSceneDeleteSuccess); - consumed = true; - } else { - consumed = scene_manager_search_and_switch_to_previous_scene( - inst->scene_manager, VbMigrateSceneSelect); - } - } - } - return consumed; -} - -void vb_migrate_scene_delete_on_exit(void* context) { - VbMigrate* inst = context; - - // Perform your cleanup here - widget_reset(inst->widget); -} diff --git a/applications/plugins/vbmigrate/scenes/vb_migrate_scene_delete_captures.c b/applications/plugins/vbmigrate/scenes/vb_migrate_scene_delete_captures.c deleted file mode 100644 index c1c10b68c..000000000 --- a/applications/plugins/vbmigrate/scenes/vb_migrate_scene_delete_captures.c +++ /dev/null @@ -1,85 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// -// VB Lab Migration Assistant for Flipper Zero -// Copyright (C) 2022 cyanic -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -#include "../vb_migrate_i.h" - -static void vb_migrate_scene_delete_captures_widget_callback( - GuiButtonType result, - InputType type, - void* context) { - VbMigrate* inst = context; - - if(type == InputTypeShort) { - view_dispatcher_send_custom_event(inst->view_dispatcher, result); - } -} - -void vb_migrate_scene_delete_captures_on_enter(void* context) { - VbMigrate* inst = context; - - // Perform your setup here - widget_add_text_box_element( - inst->widget, 0, 0, 128, 23, AlignCenter, AlignCenter, "\e#Clear captures?\e#", false); - widget_add_button_element( - inst->widget, - GuiButtonTypeLeft, - "Cancel", - vb_migrate_scene_delete_captures_widget_callback, - inst); - widget_add_button_element( - inst->widget, - GuiButtonTypeRight, - "Delete", - vb_migrate_scene_delete_captures_widget_callback, - inst); - - FuriString* temp_str = - furi_string_alloc_printf("%s\nCharas. captured: %d", inst->text_store, inst->num_captured); - widget_add_string_multiline_element( - inst->widget, 64, 24, AlignCenter, AlignTop, FontSecondary, furi_string_get_cstr(temp_str)); - furi_string_free(temp_str); - - view_dispatcher_switch_to_view(inst->view_dispatcher, VbMigrateViewWidget); -} - -bool vb_migrate_scene_delete_captures_on_event(void* context, SceneManagerEvent event) { - VbMigrate* inst = context; - bool consumed = false; - - if(event.type == SceneManagerEventTypeCustom) { - if(event.event == GuiButtonTypeLeft) { - consumed = scene_manager_previous_scene(inst->scene_manager); - } else if(event.event == GuiButtonTypeRight) { - if(vb_migrate_delete(inst, inst->text_store, false)) { - scene_manager_next_scene(inst->scene_manager, VbMigrateSceneDeleteCapturesSuccess); - consumed = true; - } else { - consumed = scene_manager_previous_scene(inst->scene_manager); - } - inst->num_captured = vb_migrate_count_captured_mons(inst, inst->text_store); - } - } - return consumed; -} - -void vb_migrate_scene_delete_captures_on_exit(void* context) { - VbMigrate* inst = context; - - // Perform your cleanup here - widget_reset(inst->widget); -} diff --git a/applications/plugins/vbmigrate/scenes/vb_migrate_scene_delete_captures_success.c b/applications/plugins/vbmigrate/scenes/vb_migrate_scene_delete_captures_success.c deleted file mode 100644 index e083aacbc..000000000 --- a/applications/plugins/vbmigrate/scenes/vb_migrate_scene_delete_captures_success.c +++ /dev/null @@ -1,58 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// -// VB Lab Migration Assistant for Flipper Zero -// Copyright (C) 2022 cyanic -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -#include "../vb_migrate_i.h" -#include "VB_migrate_icons.h" - -static void vb_migrate_scene_delete_captures_success_popup_callback(void* context) { - VbMigrate* inst = context; - view_dispatcher_send_custom_event(inst->view_dispatcher, 0); -} - -void vb_migrate_scene_delete_captures_success_on_enter(void* context) { - VbMigrate* inst = context; - - // Perform your setup here - Popup* popup = inst->popup; - popup_set_icon(popup, 0, 2, &I_DolphinMafia_115x62); - popup_set_header(popup, "Cleared", 83, 19, AlignLeft, AlignBottom); - popup_set_timeout(popup, 1500); - popup_set_context(popup, inst); - popup_set_callback(popup, vb_migrate_scene_delete_captures_success_popup_callback); - popup_enable_timeout(popup); - - view_dispatcher_switch_to_view(inst->view_dispatcher, VbMigrateViewPopup); -} - -bool vb_migrate_scene_delete_captures_success_on_event(void* context, SceneManagerEvent event) { - VbMigrate* inst = context; - bool consumed = false; - - if(event.type == SceneManagerEventTypeCustom) { - consumed = scene_manager_search_and_switch_to_previous_scene( - inst->scene_manager, VbMigrateSceneDevMenu); - } - return consumed; -} - -void vb_migrate_scene_delete_captures_success_on_exit(void* context) { - VbMigrate* inst = context; - - // Perform your cleanup here - popup_reset(inst->popup); -} diff --git a/applications/plugins/vbmigrate/scenes/vb_migrate_scene_delete_success.c b/applications/plugins/vbmigrate/scenes/vb_migrate_scene_delete_success.c deleted file mode 100644 index 0635b1ada..000000000 --- a/applications/plugins/vbmigrate/scenes/vb_migrate_scene_delete_success.c +++ /dev/null @@ -1,59 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// -// VB Lab Migration Assistant for Flipper Zero -// Copyright (C) 2022 cyanic -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -#include "../vb_migrate_i.h" -#include "VB_migrate_icons.h" - -static void vb_migrate_scene_delete_success_popup_callback(void* context) { - VbMigrate* inst = context; - view_dispatcher_send_custom_event(inst->view_dispatcher, 0); -} - -void vb_migrate_scene_delete_success_on_enter(void* context) { - VbMigrate* inst = context; - - // Perform your setup here - Popup* popup = inst->popup; - popup_set_icon(popup, 0, 2, &I_DolphinMafia_115x62); - popup_set_header(popup, "Deleted", 83, 19, AlignLeft, AlignBottom); - popup_set_timeout(popup, 1500); - popup_set_context(popup, inst); - popup_set_callback(popup, vb_migrate_scene_delete_success_popup_callback); - popup_enable_timeout(popup); - - view_dispatcher_switch_to_view(inst->view_dispatcher, VbMigrateViewPopup); -} - -bool vb_migrate_scene_delete_success_on_event(void* context, SceneManagerEvent event) { - VbMigrate* inst = context; - bool consumed = false; - - if(event.type == SceneManagerEventTypeCustom) { - uint32_t back_scenes[] = {VbMigrateSceneSelect, VbMigrateSceneMainMenu}; - consumed = scene_manager_search_and_switch_to_previous_scene_one_of( - inst->scene_manager, back_scenes, COUNT_OF(back_scenes)); - } - return consumed; -} - -void vb_migrate_scene_delete_success_on_exit(void* context) { - VbMigrate* inst = context; - - // Perform your cleanup here - popup_reset(inst->popup); -} diff --git a/applications/plugins/vbmigrate/scenes/vb_migrate_scene_dev_menu.c b/applications/plugins/vbmigrate/scenes/vb_migrate_scene_dev_menu.c deleted file mode 100644 index b756ac27d..000000000 --- a/applications/plugins/vbmigrate/scenes/vb_migrate_scene_dev_menu.c +++ /dev/null @@ -1,107 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// -// VB Lab Migration Assistant for Flipper Zero -// Copyright (C) 2022 cyanic -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -#include "../vb_migrate_i.h" - -typedef enum { - SubmenuDevMenuIndexTransferFromApp, - SubmenuDevMenuIndexTransferToApp, - SubmenuDevMenuIndexSpoof, - SubmenuDevMenuIndexClearCaptures, - SubmenuDevMenuIndexDeleteVb, - SubmenuDevMenuIndexSpoofSelection, // Always keep this last because we add tag type to it -} SubmenuDevMenuIndex; - -static void vb_migrate_scene_dev_menu_var_list_enter_callback(void* context, uint32_t index) { - VbMigrate* inst = context; - - view_dispatcher_send_custom_event(inst->view_dispatcher, index); -} - -static void vb_migrate_scene_dev_menu_spoof_change_callback(VariableItem* item) { - VbMigrate* inst = variable_item_get_context(item); - uint8_t index = variable_item_get_current_value_index(item); - - VbTagType tag_type = index + 1; - variable_item_set_current_value_text(item, vb_tag_get_tag_type_name(tag_type)); - view_dispatcher_send_custom_event( - inst->view_dispatcher, SubmenuDevMenuIndexSpoofSelection + tag_type); -} - -void vb_migrate_scene_dev_menu_on_enter(void* context) { - VbMigrate* inst = context; - VariableItemList* variable_list = inst->variable_list; - VariableItem* item; - - variable_item_list_set_enter_callback( - variable_list, vb_migrate_scene_dev_menu_var_list_enter_callback, inst); - variable_item_list_add(variable_list, "Transfer App > Flipper", 0, NULL, NULL); - variable_item_list_add(variable_list, "Transfer Flipper > App", 0, NULL, NULL); - item = variable_item_list_add( - variable_list, - "Spoof Version", - VbTagTypeMax - 1, - vb_migrate_scene_dev_menu_spoof_change_callback, - inst); - variable_item_set_current_value_index(item, inst->override_type - 1); - variable_item_set_current_value_text(item, vb_tag_get_tag_type_name(inst->override_type)); - - variable_item_list_add(variable_list, "Clear Captures", 0, NULL, NULL); - variable_item_list_add(variable_list, "Delete Vital Bracelet", 0, NULL, NULL); - - variable_item_list_set_selected_item( - variable_list, scene_manager_get_scene_state(inst->scene_manager, VbMigrateSceneDevMenu)); - - view_dispatcher_switch_to_view(inst->view_dispatcher, VbMigrateViewVariableItemList); -} - -bool vb_migrate_scene_dev_menu_on_event(void* context, SceneManagerEvent event) { - VbMigrate* inst = context; - bool consumed = false; - - if(event.type == SceneManagerEventTypeCustom) { - if(event.event < SubmenuDevMenuIndexSpoofSelection) { - scene_manager_set_scene_state(inst->scene_manager, VbMigrateSceneDevMenu, event.event); - } - - if(event.event == SubmenuDevMenuIndexTransferFromApp) { - scene_manager_next_scene(inst->scene_manager, VbMigrateSceneFromApp); - consumed = true; - } else if(event.event == SubmenuDevMenuIndexTransferToApp) { - scene_manager_next_scene(inst->scene_manager, VbMigrateSceneToApp); - consumed = true; - } else if(event.event == SubmenuDevMenuIndexClearCaptures) { - scene_manager_next_scene(inst->scene_manager, VbMigrateSceneDeleteCaptures); - consumed = true; - } else if(event.event == SubmenuDevMenuIndexDeleteVb) { - scene_manager_next_scene(inst->scene_manager, VbMigrateSceneDelete); - consumed = true; - } else if(event.event >= SubmenuDevMenuIndexSpoofSelection) { - // Note: skipping SubmenuDevMenuIndexSpoof because there's nothing to do on enter - inst->override_type = event.event - SubmenuDevMenuIndexSpoofSelection; - consumed = true; - } - } - return consumed; -} - -void vb_migrate_scene_dev_menu_on_exit(void* context) { - VbMigrate* inst = context; - - variable_item_list_reset(inst->variable_list); -} diff --git a/applications/plugins/vbmigrate/scenes/vb_migrate_scene_from_app.c b/applications/plugins/vbmigrate/scenes/vb_migrate_scene_from_app.c deleted file mode 100644 index 69d5e05e0..000000000 --- a/applications/plugins/vbmigrate/scenes/vb_migrate_scene_from_app.c +++ /dev/null @@ -1,373 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// -// VB Lab Migration Assistant for Flipper Zero -// Copyright (C) 2022 cyanic -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -#include - -#include "../vb_migrate_i.h" -#include "../vb_tag.h" -#include "VB_migrate_icons.h" - -#define TAG "vb_migrate_scene_from_app" - -typedef enum { - FromAppStateInitial, - FromAppStateInstructions, - FromAppStateEmulateReady, - FromAppStateEmulateCheckDim, - FromAppStateEmulateTransferFromApp, - FromAppStateTemplateError, - FromAppStateSaveError, -} FromAppState; - -typedef enum { - FromAppEventTypeWidgetLeft, - FromAppEventTypeWidgetRight, - FromAppEventTypeTemplateLoadError, - FromAppEventTypeTagWrite, - FromAppEventTypeCaptureSaveError, - FromAppEventTypeCaptureSaveSuccess, -} FromAppEventType; - -static void - vb_migrate_scene_from_app_widget_callback(GuiButtonType result, InputType type, void* context) { - VbMigrate* inst = context; - - if(type == InputTypeShort) { - if(result == GuiButtonTypeLeft) - view_dispatcher_send_custom_event(inst->view_dispatcher, FromAppEventTypeWidgetLeft); - else if(result == GuiButtonTypeRight) - view_dispatcher_send_custom_event(inst->view_dispatcher, FromAppEventTypeWidgetRight); - } -} - -static bool vb_migrate_scene_from_app_worker_callback(NfcWorkerEvent event, void* context) { - VbMigrate* inst = context; - bool result = false; - - if(event == NfcWorkerEventSuccess) { - view_dispatcher_send_custom_event(inst->view_dispatcher, FromAppEventTypeTagWrite); - result = true; - } - - return result; -} - -static void vb_migrate_scene_from_app_set_nfc_state(VbMigrate* inst, FromAppState state) { - BantBlock* bant = vb_tag_get_bant_block(&inst->nfc_dev->dev_data); - if(state == FromAppStateEmulateReady) { - vb_tag_set_status(bant, VbTagStatusReady); - vb_tag_set_operation(bant, VbTagOperationReady); - } else if(state == FromAppStateEmulateCheckDim) { - vb_tag_set_status(bant, VbTagStatusReady | VbTagStatusDimReady); - vb_tag_set_operation(bant, VbTagOperationReady); - } else if(state == FromAppStateEmulateTransferFromApp) { - vb_tag_set_status(bant, 0); - vb_tag_set_operation(bant, VbTagOperationIdle); - } - - // Override tag type - if(inst->override_type != inst->orig_type && inst->override_type != VbTagTypeUnknown) { - vb_tag_set_item_id_no(bant, vb_tag_get_default_product(inst->override_type)); - } -} - -static bool vb_migrate_scene_from_app_is_state_changed(VbMigrate* inst, FromAppState state) { - BantBlock* bant = vb_tag_get_bant_block(&inst->nfc_dev->dev_data); - VbTagOperation operation = vb_tag_get_operation(bant); - - if(state == FromAppStateEmulateReady) { - return operation == VbTagOperationCheckDim; - } else if(state == FromAppStateEmulateCheckDim) { - return operation == VbTagOperationCheckDim || operation == VbTagOperationReturnFromApp; - } - - return false; -} - -static void vb_migrate_scene_from_app_set_state(VbMigrate* inst, FromAppState state) { - uint32_t curr_state = - scene_manager_get_scene_state(inst->scene_manager, VbMigrateSceneFromApp); - if(state != curr_state) { - Widget* widget = inst->widget; - - if(state == FromAppStateInstructions) { - widget_reset(widget); - widget_add_text_scroll_element( - widget, - 0, - 0, - 128, - 45, - "\e#To transfer characters\n" - "\e#to Flipper:\n" - "1. Wake up character from\n" - "storage\n" - "2. Sync character to Flipper\n" - "as if it was a Vital Bracelet.\n" - "Flipper will beep when it is\n" - "ready for the next step\n" - "3. The character is\n" - "automatically saved when the\n" - "transfer is complete, and will\n" - "be ready for another transfer\n" - "4. Repeat the above until you\n" - "have transferred all the\n" - "characters you want\n" - "\n" - "You can cancel at any time to\n" - "finish transferring."); - widget_add_button_element( - widget, - GuiButtonTypeLeft, - "Cancel", - vb_migrate_scene_from_app_widget_callback, - inst); - widget_add_button_element( - widget, - GuiButtonTypeRight, - "Next", - vb_migrate_scene_from_app_widget_callback, - inst); - - view_dispatcher_switch_to_view(inst->view_dispatcher, VbMigrateViewWidget); - } else if(state == FromAppStateEmulateReady) { - vb_migrate_show_loading_popup(inst, true); - if(vb_migrate_load_nfc(inst, inst->text_store, VB_MIGRATE_TEMPLATE_NAME)) { - widget_reset(widget); - widget_add_string_multiline_element( - widget, - 80, - 20, - AlignCenter, - AlignCenter, - FontPrimary, - "Ready, waiting\nfor Dim check"); - FuriString* temp_str = - furi_string_alloc_printf("Charas. captured: %d", inst->num_captured); - widget_add_string_element( - widget, - 63, - 43, - AlignCenter, - AlignCenter, - FontSecondary, - furi_string_get_cstr(temp_str)); - widget_add_icon_element(widget, 7, 7, &I_Touch_26x26); - widget_add_button_element( - widget, - GuiButtonTypeLeft, - "Cancel", - vb_migrate_scene_from_app_widget_callback, - inst); - - view_dispatcher_switch_to_view(inst->view_dispatcher, VbMigrateViewWidget); - furi_string_free(temp_str); - - vb_migrate_scene_from_app_set_nfc_state(inst, state); - nfc_worker_start( - inst->worker, - NfcWorkerStateMfUltralightEmulate, - &inst->nfc_dev->dev_data, - vb_migrate_scene_from_app_worker_callback, - inst); - vb_migrate_blink_emulate(inst); - } else { - view_dispatcher_send_custom_event( - inst->view_dispatcher, FromAppEventTypeTemplateLoadError); - } - vb_migrate_show_loading_popup(inst, false); - } else if(state == FromAppStateEmulateCheckDim) { - widget_reset(widget); - widget_add_string_multiline_element( - widget, - 80, - 31, - AlignCenter, - AlignCenter, - FontPrimary, - "Waiting for\nsecond Dim\ncheck/transfer"); - widget_add_icon_element(widget, 7, 18, &I_Touch_26x26); - widget_add_button_element( - widget, - GuiButtonTypeLeft, - "Cancel", - vb_migrate_scene_from_app_widget_callback, - inst); - - view_dispatcher_switch_to_view(inst->view_dispatcher, VbMigrateViewWidget); - notification_message(inst->notifications, &sequence_success); - vb_migrate_scene_from_app_set_nfc_state(inst, state); - nfc_worker_start( - inst->worker, - NfcWorkerStateMfUltralightEmulate, - &inst->nfc_dev->dev_data, - vb_migrate_scene_from_app_worker_callback, - inst); - vb_migrate_blink_emulate(inst); - } else if(state == FromAppStateEmulateTransferFromApp) { - widget_reset(widget); - widget_add_string_multiline_element( - widget, - 80, - 31, - AlignCenter, - AlignCenter, - FontPrimary, - "Transfer captured,\nsaving..."); - widget_add_button_element( - widget, - GuiButtonTypeLeft, - "Cancel", - vb_migrate_scene_from_app_widget_callback, - inst); - - view_dispatcher_switch_to_view(inst->view_dispatcher, VbMigrateViewWidget); - nfc_worker_stop(inst->worker); - vb_migrate_blink_stop(inst); - vb_migrate_scene_from_app_set_nfc_state(inst, state); - notification_message(inst->notifications, &sequence_success); - - // Restore original tag type if necessary - if(inst->override_type != inst->orig_type && inst->override_type != VbTagTypeUnknown) { - BantBlock* bant = vb_tag_get_bant_block(&inst->nfc_dev->dev_data); - vb_tag_set_item_id_no(bant, inst->orig_product); - } - - // Save the tag - inst->next_id = vb_migrate_get_next_id(inst, inst->text_store, inst->next_id, false); - FuriString* save_path = furi_string_alloc_printf( - VB_MIGRATE_CAPTURE_FORMAT, inst->next_id, NFC_APP_EXTENSION); - if(vb_migrate_save_nfc(inst, inst->text_store, furi_string_get_cstr(save_path))) { - view_dispatcher_send_custom_event( - inst->view_dispatcher, FromAppEventTypeCaptureSaveSuccess); - } else { - view_dispatcher_send_custom_event( - inst->view_dispatcher, FromAppEventTypeCaptureSaveError); - } - furi_string_free(save_path); - } else if(state == FromAppStateTemplateError) { - widget_reset(widget); - widget_add_string_multiline_element( - widget, 80, 31, AlignCenter, AlignCenter, FontPrimary, "Could not\nload template"); - widget_add_icon_element(widget, 15, 22, &I_Error_18x18); - widget_add_button_element( - widget, - GuiButtonTypeLeft, - "Cancel", - vb_migrate_scene_from_app_widget_callback, - inst); - - view_dispatcher_switch_to_view(inst->view_dispatcher, VbMigrateViewWidget); - notification_message(inst->notifications, &sequence_error); - notification_message(inst->notifications, &sequence_set_red_255); - } else if(state == FromAppStateSaveError) { - widget_reset(widget); - widget_add_string_multiline_element( - widget, 80, 31, AlignCenter, AlignCenter, FontPrimary, "Could not\nsave capture"); - widget_add_icon_element(widget, 15, 22, &I_Error_18x18); - widget_add_button_element( - widget, - GuiButtonTypeLeft, - "Cancel", - vb_migrate_scene_from_app_widget_callback, - inst); - - view_dispatcher_switch_to_view(inst->view_dispatcher, VbMigrateViewWidget); - notification_message(inst->notifications, &sequence_error); - notification_message(inst->notifications, &sequence_set_red_255); - } else { - furi_crash("Unknown new state in vb_migrate_scene_from_app_set_state"); - } - - scene_manager_set_scene_state(inst->scene_manager, VbMigrateSceneFromApp, state); - } -} - -void vb_migrate_scene_from_app_on_enter(void* context) { - VbMigrate* inst = context; - - // Perform your setup here - inst->next_id = 0; - scene_manager_set_scene_state(inst->scene_manager, VbMigrateSceneFromApp, FromAppStateInitial); - vb_migrate_scene_from_app_set_state(inst, FromAppStateInstructions); -} - -bool vb_migrate_scene_from_app_on_event(void* context, SceneManagerEvent event) { - VbMigrate* inst = context; - bool consumed = false; - - if(event.type == SceneManagerEventTypeCustom) { - if(event.event == FromAppEventTypeWidgetLeft) { - consumed = scene_manager_previous_scene(inst->scene_manager); - } else if(event.event == FromAppEventTypeWidgetRight) { - vb_migrate_scene_from_app_set_state(inst, FromAppStateEmulateReady); - consumed = true; - } else if(event.event == FromAppEventTypeTagWrite) { - uint32_t state = - scene_manager_get_scene_state(inst->scene_manager, VbMigrateSceneFromApp); - if(vb_migrate_scene_from_app_is_state_changed(inst, state)) { - if(state == FromAppStateEmulateReady) { - nfc_worker_stop(inst->worker); - vb_migrate_blink_stop(inst); - vb_migrate_scene_from_app_set_state(inst, FromAppStateEmulateCheckDim); - consumed = true; - } else if(state == FromAppStateEmulateCheckDim) { - BantBlock* bant = vb_tag_get_bant_block(&inst->nfc_dev->dev_data); - VbTagOperation operation = vb_tag_get_operation(bant); - - if(operation == VbTagOperationReturnFromApp) { - nfc_worker_stop(inst->worker); - vb_migrate_blink_stop(inst); - vb_migrate_scene_from_app_set_state( - inst, FromAppStateEmulateTransferFromApp); - consumed = true; - } else if(operation == VbTagOperationCheckDim) { - // Don't need to reset tag, but should make a beep - vb_migrate_blink_stop(inst); - notification_message_block(inst->notifications, &sequence_success); - vb_migrate_blink_emulate(inst); - } - } - } - } else if(event.event == FromAppEventTypeTemplateLoadError) { - vb_migrate_scene_from_app_set_state(inst, FromAppStateTemplateError); - consumed = true; - } else if(event.event == FromAppEventTypeCaptureSaveError) { - vb_migrate_scene_from_app_set_state(inst, FromAppStateSaveError); - consumed = true; - } else if(event.event == FromAppEventTypeCaptureSaveSuccess) { - ++inst->num_captured; - ++inst->next_id; - vb_migrate_scene_from_app_set_state(inst, FromAppStateEmulateReady); - consumed = true; - } else { - furi_crash("Unknown event in vb_migrate_scene_from_app_on_event"); - } - } - return consumed; -} - -void vb_migrate_scene_from_app_on_exit(void* context) { - VbMigrate* inst = context; - - // Perform your cleanup here - widget_reset(inst->widget); - nfc_worker_stop(inst->worker); - vb_migrate_blink_stop(inst); - notification_message_block(inst->notifications, &sequence_reset_red); -} diff --git a/applications/plugins/vbmigrate/scenes/vb_migrate_scene_info.c b/applications/plugins/vbmigrate/scenes/vb_migrate_scene_info.c deleted file mode 100644 index e60f5dc0f..000000000 --- a/applications/plugins/vbmigrate/scenes/vb_migrate_scene_info.c +++ /dev/null @@ -1,83 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// -// VB Lab Migration Assistant for Flipper Zero -// Copyright (C) 2022 cyanic -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -#include "../vb_migrate_i.h" -#include "../vb_tag.h" - -static void - vb_migrate_scene_info_button_callback(GuiButtonType result, InputType type, void* context) { - VbMigrate* inst = context; - - if(type == InputTypeShort) { - if(result == GuiButtonTypeRight) { - view_dispatcher_send_custom_event(inst->view_dispatcher, result); - } - } -} - -void vb_migrate_scene_info_on_enter(void* context) { - VbMigrate* inst = context; - FuriString* temp_str = furi_string_alloc(); - - // Build info scroll - // Name - furi_string_cat_printf(temp_str, "\ec%s\n", inst->text_store); - - // Type - if(inst->orig_product == NULL) - furi_string_cat(temp_str, "Unknown product\n"); - else - furi_string_cat_printf(temp_str, "\e#%s\n", inst->orig_product->name); - - // Number of mons loaded - furi_string_cat_printf(temp_str, "Charas. captured: %d", inst->num_captured); - - widget_add_text_scroll_element(inst->widget, 0, 0, 128, 52, furi_string_get_cstr(temp_str)); - furi_string_free(temp_str); - - widget_add_button_element( - inst->widget, GuiButtonTypeRight, "More", vb_migrate_scene_info_button_callback, inst); - view_dispatcher_switch_to_view(inst->view_dispatcher, VbMigrateViewWidget); -} - -bool vb_migrate_scene_info_on_event(void* context, SceneManagerEvent event) { - VbMigrate* inst = context; - bool consumed = false; - UNUSED(inst); - - if(event.type == SceneManagerEventTypeCustom) { - if(event.event == GuiButtonTypeRight) { - // Reset menu selection index - scene_manager_set_scene_state(inst->scene_manager, VbMigrateSceneDevMenu, 0); - scene_manager_next_scene(inst->scene_manager, VbMigrateSceneDevMenu); - consumed = true; - } - } else if(event.type == SceneManagerEventTypeBack) { - uint32_t back_scenes[] = {VbMigrateSceneSelect, VbMigrateSceneMainMenu}; - consumed = scene_manager_search_and_switch_to_previous_scene_one_of( - inst->scene_manager, back_scenes, COUNT_OF(back_scenes)); - } - return consumed; -} - -void vb_migrate_scene_info_on_exit(void* context) { - VbMigrate* inst = context; - - // Perform your cleanup here - widget_reset(inst->widget); -} diff --git a/applications/plugins/vbmigrate/scenes/vb_migrate_scene_load.c b/applications/plugins/vbmigrate/scenes/vb_migrate_scene_load.c deleted file mode 100644 index 8f316a1ed..000000000 --- a/applications/plugins/vbmigrate/scenes/vb_migrate_scene_load.c +++ /dev/null @@ -1,61 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// -// VB Lab Migration Assistant for Flipper Zero -// Copyright (C) 2022 cyanic -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -#include "../vb_migrate_i.h" - -#define TAG "vb_migrate_scene_load" - -void vb_migrate_scene_load_on_enter(void* context) { - VbMigrate* inst = context; - - // Perform your setup here - vb_migrate_show_loading_popup(inst, true); - view_dispatcher_send_custom_event(inst->view_dispatcher, 0); -} - -bool vb_migrate_scene_load_on_event(void* context, SceneManagerEvent event) { - VbMigrate* inst = context; - bool consumed = false; - - if(event.type == SceneManagerEventTypeCustom) { - if(vb_migrate_load_nfc(inst, inst->text_store, VB_MIGRATE_TEMPLATE_NAME)) { - inst->num_captured = vb_migrate_count_captured_mons(inst, inst->text_store); - - BantBlock* bant = vb_tag_get_bant_block(&inst->nfc_dev->dev_data); - const VbTagProduct* product = vb_tag_find_product(bant); - inst->orig_product = product; - if(product) { - inst->orig_type = product->type; - } else { - inst->orig_type = VbTagTypeUnknown; - } - inst->override_type = inst->orig_type; - - scene_manager_next_scene(inst->scene_manager, VbMigrateSceneInfo); - consumed = true; - } else { - consumed = scene_manager_previous_scene(inst->scene_manager); - } - vb_migrate_show_loading_popup(inst, false); - } - return consumed; -} - -void vb_migrate_scene_load_on_exit(void* context) { - UNUSED(context); -} diff --git a/applications/plugins/vbmigrate/scenes/vb_migrate_scene_main_menu.c b/applications/plugins/vbmigrate/scenes/vb_migrate_scene_main_menu.c deleted file mode 100644 index 13dea042d..000000000 --- a/applications/plugins/vbmigrate/scenes/vb_migrate_scene_main_menu.c +++ /dev/null @@ -1,78 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// -// VB Lab Migration Assistant for Flipper Zero -// Copyright (C) 2022 cyanic -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -#include "../vb_migrate_i.h" - -typedef enum { - SubmenuMainIndexRegister, - SubmenuMainIndexSelect, - SubmenuMainIndexAbout, -} SubmenuMainIndex; - -static void vb_migrate_scene_main_menu_submenu_callback(void* context, uint32_t index) { - VbMigrate* inst = context; - - view_dispatcher_send_custom_event(inst->view_dispatcher, index); -} - -void vb_migrate_scene_main_menu_on_enter(void* context) { - VbMigrate* inst = context; - Submenu* submenu = inst->submenu; - - submenu_add_item( - submenu, - "Register Vital Bracelet", - SubmenuMainIndexRegister, - vb_migrate_scene_main_menu_submenu_callback, - inst); - submenu_add_item( - submenu, - "Select Vital Bracelet", - SubmenuMainIndexSelect, - vb_migrate_scene_main_menu_submenu_callback, - inst); - submenu_add_item( - submenu, "About", SubmenuMainIndexAbout, vb_migrate_scene_main_menu_submenu_callback, inst); - - view_dispatcher_switch_to_view(inst->view_dispatcher, VbMigrateViewMenu); -} - -bool vb_migrate_scene_main_menu_on_event(void* context, SceneManagerEvent event) { - VbMigrate* inst = context; - bool consumed = false; - - if(event.type == SceneManagerEventTypeCustom) { - if(event.event == SubmenuMainIndexRegister) { - scene_manager_next_scene(inst->scene_manager, VbMigrateSceneRegister); - consumed = true; - } else if(event.event == SubmenuMainIndexSelect) { - scene_manager_next_scene(inst->scene_manager, VbMigrateSceneSelect); - consumed = true; - } else if(event.event == SubmenuMainIndexAbout) { - scene_manager_next_scene(inst->scene_manager, VbMigrateSceneAbout); - consumed = true; - } - } - return consumed; -} - -void vb_migrate_scene_main_menu_on_exit(void* context) { - VbMigrate* inst = context; - - submenu_reset(inst->submenu); -} diff --git a/applications/plugins/vbmigrate/scenes/vb_migrate_scene_register.c b/applications/plugins/vbmigrate/scenes/vb_migrate_scene_register.c deleted file mode 100644 index 5dfd52231..000000000 --- a/applications/plugins/vbmigrate/scenes/vb_migrate_scene_register.c +++ /dev/null @@ -1,436 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// -// VB Lab Migration Assistant for Flipper Zero -// Copyright (C) 2022 cyanic -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -#include - -#include "../vb_tag.h" -#include "../vb_migrate_i.h" -#include "VB_migrate_icons.h" - -typedef enum { - RegisterStateInitial, - RegisterStateInstructionInitial, - RegisterStateInstructionConnect, - RegisterStateCaptureInitial, - RegisterStateCaptureInvalidTag, - RegisterStateCapturePwd, - RegisterStateCaptureFull, - RegisterStateCaptureFailed, - RegisterStateCaptureIncorrectTag, -} RegisterState; - -typedef enum { - RegisterEventTypeNextButton, - RegisterEventTypePrevButton, - RegisterEventTypeVbReadInitial, - RegisterEventTypeVbPwdAuth, - RegisterEventTypeVbReadFullSuccess, - RegisterEventTypeVbReadFullFail, -} RegisterEventType; - -static void - vb_migrate_scene_register_widget_callback(GuiButtonType result, InputType type, void* context) { - VbMigrate* inst = context; - - if(type == InputTypeShort) { - if(result == GuiButtonTypeRight) - view_dispatcher_send_custom_event(inst->view_dispatcher, RegisterEventTypeNextButton); - else if(result == GuiButtonTypeLeft) - view_dispatcher_send_custom_event(inst->view_dispatcher, RegisterEventTypePrevButton); - } -} - -static bool - vb_migrate_scene_register_worker_read_initial_callback(NfcWorkerEvent event, void* context) { - VbMigrate* inst = context; - bool consumed = false; - - if(event == NfcWorkerEventReadMfUltralight) { - view_dispatcher_send_custom_event(inst->view_dispatcher, RegisterEventTypeVbReadInitial); - consumed = true; - } - - return consumed; -} - -static bool vb_migrate_scene_register_worker_auth_callback(NfcWorkerEvent event, void* context) { - VbMigrate* inst = context; - bool consumed = false; - - if(event == NfcWorkerEventMfUltralightPwdAuth) { - view_dispatcher_send_custom_event(inst->view_dispatcher, RegisterEventTypeVbPwdAuth); - consumed = true; - } - - return consumed; -} - -static bool - vb_migrate_scene_register_worker_full_capture_callback(NfcWorkerEvent event, void* context) { - VbMigrate* inst = context; - bool consumed = false; - - if(event == NfcWorkerEventMfUltralightPassKey) { - memcpy( - inst->nfc_dev->dev_data.mf_ul_data.auth_key, - inst->captured_pwd, - sizeof(inst->captured_pwd)); - consumed = true; - } else if(event == NfcWorkerEventSuccess) { - view_dispatcher_send_custom_event( - inst->view_dispatcher, RegisterEventTypeVbReadFullSuccess); - consumed = true; - } else if(event == NfcWorkerEventFail) { - view_dispatcher_send_custom_event(inst->view_dispatcher, RegisterEventTypeVbReadFullFail); - consumed = true; - } - - return consumed; -} - -static void vb_migrate_scene_register_cleanup_state(VbMigrate* inst, RegisterState state) { - if(state == RegisterStateCaptureInvalidTag || state == RegisterStateCaptureFailed || - state == RegisterStateCaptureIncorrectTag) { - notification_message(inst->notifications, &sequence_reset_red); - } else if( - state == RegisterStateCaptureInitial || state == RegisterStateCapturePwd || - state == RegisterStateCaptureFull) { - vb_migrate_blink_stop(inst); - nfc_worker_stop(inst->worker); - } -} - -static void vb_migrate_scene_register_set_state(VbMigrate* inst, RegisterState state) { - uint32_t curr_state = - scene_manager_get_scene_state(inst->scene_manager, VbMigrateSceneRegister); - if(state != curr_state) { - vb_migrate_scene_register_cleanup_state(inst, curr_state); - Widget* widget = inst->widget; - - if(state == RegisterStateInstructionInitial) { - widget_reset(widget); - widget_add_string_multiline_element( - widget, - 0, - 0, - AlignLeft, - AlignTop, - FontSecondary, - "Please make sure your current\ncharacter has been sent to\nVB Lab before continuing."); - widget_add_button_element( - widget, - GuiButtonTypeLeft, - "Cancel", - vb_migrate_scene_register_widget_callback, - inst); - widget_add_button_element( - widget, - GuiButtonTypeRight, - "Next", - vb_migrate_scene_register_widget_callback, - inst); - - view_dispatcher_switch_to_view(inst->view_dispatcher, VbMigrateViewWidget); - } else if(state == RegisterStateInstructionConnect) { - widget_reset(widget); - widget_add_string_multiline_element( - widget, - 0, - 0, - AlignLeft, - AlignTop, - FontSecondary, - "Prepare VB Lab:\n" - "1. Ensure current character in\n" - "VB Lab has been put in storage\n" - "2. Open the \"Scan\" screen\n" - "3. Tap \"Vital Bracelet -> App\""); - widget_add_button_element( - widget, - GuiButtonTypeLeft, - "Cancel", - vb_migrate_scene_register_widget_callback, - inst); - widget_add_button_element( - widget, - GuiButtonTypeRight, - "Next", - vb_migrate_scene_register_widget_callback, - inst); - - view_dispatcher_switch_to_view(inst->view_dispatcher, VbMigrateViewWidget); - } else if(state == RegisterStateCaptureInitial) { - widget_reset(widget); - widget_add_string_multiline_element( - widget, - 80, - 31, - AlignCenter, - AlignCenter, - FontPrimary, - "Tap Flipper to\nyour Vital\nBracelet"); - widget_add_button_element( - widget, - GuiButtonTypeLeft, - "Previous", - vb_migrate_scene_register_widget_callback, - inst); - - view_dispatcher_switch_to_view(inst->view_dispatcher, VbMigrateViewWidget); - nfc_device_clear(inst->nfc_dev); - inst->nfc_dev->dev_data.read_mode = NfcReadModeMfUltralight; - nfc_worker_start( - inst->worker, - NfcWorkerStateRead, - &inst->nfc_dev->dev_data, - vb_migrate_scene_register_worker_read_initial_callback, - inst); - vb_migrate_blink_read(inst); - } else if(state == RegisterStateCaptureInvalidTag) { - widget_reset(widget); - widget_add_string_multiline_element( - widget, - 80, - 31, - AlignCenter, - AlignCenter, - FontSecondary, - "Tag is not a valid\nVital Bracelet,\nplease try again"); - widget_add_icon_element(widget, 15, 22, &I_Error_18x18); - widget_add_button_element( - widget, - GuiButtonTypeLeft, - "Retry", - vb_migrate_scene_register_widget_callback, - inst); - - view_dispatcher_switch_to_view(inst->view_dispatcher, VbMigrateViewWidget); - notification_message(inst->notifications, &sequence_set_red_255); - } else if(state == RegisterStateCapturePwd) { - widget_reset(widget); - widget_add_string_multiline_element( - widget, - 80, - 31, - AlignCenter, - AlignCenter, - FontPrimary, - "Tap \"Send\" on\nVB Lab, then tap\nto Flipper"); - widget_add_icon_element(widget, 7, 18, &I_Touch_26x26); - widget_add_button_element( - widget, - GuiButtonTypeLeft, - "Previous", - vb_migrate_scene_register_widget_callback, - inst); - - view_dispatcher_switch_to_view(inst->view_dispatcher, VbMigrateViewWidget); - - BantBlock* bant = vb_tag_get_bant_block(&inst->nfc_dev->dev_data); - vb_tag_set_operation(bant, VbTagOperationReady); - vb_tag_set_status(bant, VbTagStatusReady); - nfc_worker_start( - inst->worker, - NfcWorkerStateMfUltralightEmulate, - &inst->nfc_dev->dev_data, - vb_migrate_scene_register_worker_auth_callback, - inst); - vb_migrate_blink_emulate(inst); - } else if(state == RegisterStateCaptureFull) { - widget_reset(widget); - widget_add_string_multiline_element( - widget, - 80, - 31, - AlignCenter, - AlignCenter, - FontPrimary, - "Tap Flipper to\nVital Bracelet\nagain"); - widget_add_button_element( - widget, - GuiButtonTypeLeft, - "Previous", - vb_migrate_scene_register_widget_callback, - inst); - - view_dispatcher_switch_to_view(inst->view_dispatcher, VbMigrateViewWidget); - - inst->nfc_dev->dev_data.mf_ul_data.auth_method = MfUltralightAuthMethodAuto; - nfc_worker_start( - inst->worker, - NfcWorkerStateReadMfUltralightReadAuth, - &inst->nfc_dev->dev_data, - vb_migrate_scene_register_worker_full_capture_callback, - inst); - vb_migrate_blink_read(inst); - } else if(state == RegisterStateCaptureFailed) { - widget_reset(widget); - widget_add_string_multiline_element( - widget, - 80, - 31, - AlignCenter, - AlignCenter, - FontSecondary, - "Failed to read\nVital Bracelet,\nplease try again"); - widget_add_icon_element(widget, 15, 22, &I_Error_18x18); - widget_add_button_element( - widget, - GuiButtonTypeLeft, - "Retry", - vb_migrate_scene_register_widget_callback, - inst); - - view_dispatcher_switch_to_view(inst->view_dispatcher, VbMigrateViewWidget); - notification_message(inst->notifications, &sequence_set_red_255); - } else if(state == RegisterStateCaptureIncorrectTag) { - widget_reset(widget); - widget_add_string_multiline_element( - widget, - 80, - 31, - AlignCenter, - AlignCenter, - FontSecondary, - "Different tag read,\nplease try again"); - widget_add_icon_element(widget, 15, 22, &I_Error_18x18); - widget_add_button_element( - widget, - GuiButtonTypeLeft, - "Retry", - vb_migrate_scene_register_widget_callback, - inst); - - view_dispatcher_switch_to_view(inst->view_dispatcher, VbMigrateViewWidget); - notification_message(inst->notifications, &sequence_set_red_255); - } else { - furi_crash("Unknown new state in vb_migrate_scene_register_set_state"); - } - - scene_manager_set_scene_state(inst->scene_manager, VbMigrateSceneRegister, state); - } -} - -static bool vb_migrate_scene_register_next_state(VbMigrate* inst, RegisterState state) { - if(state == RegisterStateInstructionInitial) { - vb_migrate_scene_register_set_state(inst, RegisterStateInstructionConnect); - return true; - } else if(state == RegisterStateInstructionConnect) { - vb_migrate_scene_register_set_state(inst, RegisterStateCaptureInitial); - return true; - } - - return false; -} - -static bool - vb_migrate_scene_register_prev_state(VbMigrate* inst, RegisterState state, bool is_back) { - UNUSED(is_back); - - if(state == RegisterStateInstructionInitial || state == RegisterStateInstructionConnect) { - return scene_manager_previous_scene(inst->scene_manager); - } else if(state == RegisterStateCaptureInitial) { - vb_migrate_scene_register_set_state(inst, RegisterStateInstructionConnect); - return true; - } else if( - state == RegisterStateCaptureInvalidTag || state == RegisterStateCapturePwd || - state == RegisterStateCaptureFull) { - vb_migrate_scene_register_set_state(inst, RegisterStateCaptureInitial); - return true; - } else if(state == RegisterStateCaptureFailed || state == RegisterStateCaptureIncorrectTag) { - vb_migrate_scene_register_set_state(inst, RegisterStateCaptureFull); - return true; - } - - return is_back; -} - -void vb_migrate_scene_register_on_enter(void* context) { - VbMigrate* inst = context; - - scene_manager_set_scene_state( - inst->scene_manager, VbMigrateSceneRegister, RegisterStateInitial); - vb_migrate_scene_register_set_state(inst, RegisterStateInstructionInitial); -} - -bool vb_migrate_scene_register_on_event(void* context, SceneManagerEvent event) { - VbMigrate* inst = context; - bool consumed = false; - RegisterState state = - scene_manager_get_scene_state(inst->scene_manager, VbMigrateSceneRegister); - - if(event.type == SceneManagerEventTypeCustom) { - if(event.event == RegisterEventTypeNextButton) { - consumed = vb_migrate_scene_register_next_state(inst, state); - } else if(event.event == RegisterEventTypePrevButton) { - consumed = vb_migrate_scene_register_prev_state(inst, state, false); - } else if(event.event == RegisterEventTypeVbReadInitial) { - if(vb_tag_validate_product(&inst->nfc_dev->dev_data)) { - memcpy( - inst->captured_uid, - inst->nfc_dev->dev_data.nfc_data.uid, - sizeof(inst->captured_uid)); - notification_message(inst->notifications, &sequence_success); - vb_migrate_scene_register_set_state(inst, RegisterStateCapturePwd); - } else { - notification_message(inst->notifications, &sequence_error); - vb_migrate_scene_register_set_state(inst, RegisterStateCaptureInvalidTag); - } - consumed = true; - } else if(event.event == RegisterEventTypeVbPwdAuth) { - // Set up for auth - memcpy( - inst->captured_pwd, - inst->nfc_dev->dev_data.mf_ul_auth.pwd.raw, - sizeof(inst->captured_pwd)); - - notification_message(inst->notifications, &sequence_success); - vb_migrate_scene_register_set_state(inst, RegisterStateCaptureFull); - consumed = true; - } else if(event.event == RegisterEventTypeVbReadFullSuccess) { - NfcDeviceData* dev_data = &inst->nfc_dev->dev_data; - if(memcmp(dev_data->nfc_data.uid, inst->captured_uid, sizeof(inst->captured_uid)) || - dev_data->mf_ul_data.data_read != dev_data->mf_ul_data.data_size) { - notification_message(inst->notifications, &sequence_error); - vb_migrate_scene_register_set_state(inst, RegisterStateCaptureIncorrectTag); - } else { - notification_message(inst->notifications, &sequence_success); - scene_manager_next_scene(inst->scene_manager, VbMigrateSceneRegisterSave); - } - consumed = true; - } else if(event.event == RegisterEventTypeVbReadFullFail) { - notification_message(inst->notifications, &sequence_error); - vb_migrate_scene_register_set_state(inst, RegisterStateCaptureFailed); - consumed = true; - } else { - furi_crash("Unknown event in vb_migrate_scene_register_on_event"); - } - } else if(event.type == SceneManagerEventTypeBack) { - consumed = vb_migrate_scene_register_prev_state(inst, state, true); - } - return consumed; -} - -void vb_migrate_scene_register_on_exit(void* context) { - VbMigrate* inst = context; - RegisterState state = - scene_manager_get_scene_state(inst->scene_manager, VbMigrateSceneRegister); - - vb_migrate_scene_register_cleanup_state(inst, state); - widget_reset(inst->widget); -} diff --git a/applications/plugins/vbmigrate/scenes/vb_migrate_scene_register_save.c b/applications/plugins/vbmigrate/scenes/vb_migrate_scene_register_save.c deleted file mode 100644 index e388ed25e..000000000 --- a/applications/plugins/vbmigrate/scenes/vb_migrate_scene_register_save.c +++ /dev/null @@ -1,119 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// -// VB Lab Migration Assistant for Flipper Zero -// Copyright (C) 2022 cyanic -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -#include - -#include "../vb_migrate_i.h" -#include "../vb_tag.h" - -// This thing doesn't know what a FuriString is -#include - -typedef enum { - RegisterSaveEventTextInput, -} RegisterSaveEvent; - -static void vb_migrate_scene_register_save_text_input_callback(void* context) { - VbMigrate* inst = context; - - view_dispatcher_send_custom_event(inst->view_dispatcher, RegisterSaveEventTextInput); -} - -void vb_migrate_scene_register_save_on_enter(void* context) { - VbMigrate* inst = context; - - // Setup view - TextInput* text_input = inst->text_input; - text_input_set_header_text(text_input, "Name this Vital Bracelet"); - text_input_set_result_callback( - text_input, - vb_migrate_scene_register_save_text_input_callback, - inst, - inst->text_store, - VB_MIGRATE_MAX_DEV_NAME_LENGTH, - true); - - // Set default name - FuriString* temp_str; - NfcDeviceData* dev_data = &inst->nfc_dev->dev_data; - BantBlock* bant = vb_tag_get_bant_block(dev_data); - const VbTagProduct* prod = vb_tag_find_product(bant); - temp_str = furi_string_alloc_printf("%s_", prod->short_name); - for(size_t i = 0; i < dev_data->nfc_data.uid_len; ++i) { - furi_string_cat_printf(temp_str, "%02x", dev_data->nfc_data.uid[i]); - } - vb_migrate_text_store_set(inst, furi_string_get_cstr(temp_str)); - furi_string_free(temp_str); - - // We're validating whether folder exists - ValidatorIsFile* validator_is_file = - validator_is_file_alloc_init(VB_MIGRATE_FOLDER, "/" VB_MIGRATE_TEMPLATE_NAME, NULL); - text_input_set_validator(text_input, validator_is_file_callback, validator_is_file); - - view_dispatcher_switch_to_view(inst->view_dispatcher, VbMigrateViewTextInput); - notification_message(inst->notifications, &sequence_set_green_255); -} - -bool vb_migrate_scene_register_save_on_event(void* context, SceneManagerEvent event) { - VbMigrate* inst = context; - bool consumed = false; - - if(event.type == SceneManagerEventTypeCustom) { - if(event.event == RegisterSaveEventTextInput) { - if(strlen(inst->text_store) != 0) { - vb_migrate_show_loading_popup(inst, true); - if(vb_migrate_save_nfc(inst, inst->text_store, VB_MIGRATE_TEMPLATE_NAME)) { - inst->num_captured = 0; - - BantBlock* bant = vb_tag_get_bant_block(&inst->nfc_dev->dev_data); - const VbTagProduct* product = vb_tag_find_product(bant); - inst->orig_product = product; - if(product) { - inst->orig_type = product->type; - } else { - inst->orig_type = VbTagTypeUnknown; - } - inst->override_type = inst->orig_type; - - // Go to success - scene_manager_next_scene(inst->scene_manager, VbMigrateSceneSaveSuccess); - } else { - // Otherwise just stay here - view_dispatcher_switch_to_view(inst->view_dispatcher, VbMigrateViewTextInput); - } - vb_migrate_show_loading_popup(inst, false); - - consumed = true; - } - } - } - return consumed; -} - -void vb_migrate_scene_register_save_on_exit(void* context) { - VbMigrate* inst = context; - - // Clear view - TextInput* text_input = inst->text_input; - ValidatorIsFile* validator = text_input_get_validator_callback_context(text_input); - text_input_set_validator(text_input, NULL, NULL); - validator_is_file_free(validator); - - text_input_reset(text_input); - notification_message_block(inst->notifications, &sequence_reset_green); -} diff --git a/applications/plugins/vbmigrate/scenes/vb_migrate_scene_save_success.c b/applications/plugins/vbmigrate/scenes/vb_migrate_scene_save_success.c deleted file mode 100644 index 8d92204aa..000000000 --- a/applications/plugins/vbmigrate/scenes/vb_migrate_scene_save_success.c +++ /dev/null @@ -1,65 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// -// VB Lab Migration Assistant for Flipper Zero -// Copyright (C) 2022 cyanic -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -#include "../vb_migrate_i.h" -#include "VB_migrate_icons.h" - -typedef enum { - SaveSuccessEventPopup, -} SaveSuccessEvent; - -static void vb_migrate_scene_save_success_popup_callback(void* context) { - VbMigrate* inst = context; - - view_dispatcher_send_custom_event(inst->view_dispatcher, SaveSuccessEventPopup); -} - -void vb_migrate_scene_save_success_on_enter(void* context) { - VbMigrate* inst = context; - - // Setup view - Popup* popup = inst->popup; - popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59); - popup_set_header(popup, "Saved!", 13, 22, AlignLeft, AlignBottom); - popup_set_timeout(popup, 1500); - popup_set_context(popup, inst); - popup_set_callback(popup, vb_migrate_scene_save_success_popup_callback); - popup_enable_timeout(popup); - - view_dispatcher_switch_to_view(inst->view_dispatcher, VbMigrateViewPopup); -} - -bool vb_migrate_scene_save_success_on_event(void* context, SceneManagerEvent event) { - VbMigrate* inst = context; - bool consumed = false; - - if(event.type == SceneManagerEventTypeCustom) { - if(event.event == SaveSuccessEventPopup) { - scene_manager_next_scene(inst->scene_manager, VbMigrateSceneInfo); - consumed = true; - } - } - return consumed; -} - -void vb_migrate_scene_save_success_on_exit(void* context) { - VbMigrate* inst = context; - - // Clear view - popup_reset(inst->popup); -} diff --git a/applications/plugins/vbmigrate/scenes/vb_migrate_scene_select.c b/applications/plugins/vbmigrate/scenes/vb_migrate_scene_select.c deleted file mode 100644 index 84f8590d8..000000000 --- a/applications/plugins/vbmigrate/scenes/vb_migrate_scene_select.c +++ /dev/null @@ -1,57 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// -// VB Lab Migration Assistant for Flipper Zero -// Copyright (C) 2022 cyanic -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -#include "../vb_migrate_i.h" - -static void vb_migrate_scene_select_file_select_callback(bool result, void* context) { - VbMigrate* inst = context; - - view_dispatcher_send_custom_event(inst->view_dispatcher, result); -} - -void vb_migrate_scene_select_on_enter(void* context) { - VbMigrate* inst = context; - - // Perform your setup here - file_select_set_callback( - inst->file_select, vb_migrate_scene_select_file_select_callback, inst); - file_select_set_filter(inst->file_select, VB_MIGRATE_FOLDER, "*"); - file_select_set_result_buffer(inst->file_select, inst->text_store, sizeof(inst->text_store)); - file_select_init(inst->file_select); - - view_dispatcher_switch_to_view(inst->view_dispatcher, VbMigrateViewFileSelect); -} - -bool vb_migrate_scene_select_on_event(void* context, SceneManagerEvent event) { - VbMigrate* inst = context; - bool consumed = false; - UNUSED(inst); - - if(event.type == SceneManagerEventTypeCustom) { - if(event.event) { - // File selected - scene_manager_next_scene(inst->scene_manager, VbMigrateSceneLoad); - consumed = true; - } - } - return consumed; -} - -void vb_migrate_scene_select_on_exit(void* context) { - UNUSED(context); -} diff --git a/applications/plugins/vbmigrate/scenes/vb_migrate_scene_to_app.c b/applications/plugins/vbmigrate/scenes/vb_migrate_scene_to_app.c deleted file mode 100644 index 43a13c8bb..000000000 --- a/applications/plugins/vbmigrate/scenes/vb_migrate_scene_to_app.c +++ /dev/null @@ -1,291 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// -// VB Lab Migration Assistant for Flipper Zero -// Copyright (C) 2022 cyanic -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -#include - -#include "../vb_migrate_i.h" -#include "../vb_tag.h" -#include "VB_migrate_icons.h" - -#define TAG "vb_migrate_scene_to_app" - -typedef enum { - ToAppStateInitial, - ToAppStateInstructions, - ToAppStateEmulateReady, - ToAppStateEmulateTransferToApp, - ToAppStateLoadError, - ToAppStateComplete, -} ToAppState; - -typedef enum { - ToAppEventTypeWidgetLeft, - ToAppEventTypeWidgetRight, - ToAppEventTypeEmulateStart, - ToAppEventTypeCaptureLoadError, - ToAppEventTypeTagWrite, -} ToAppEventType; - -static void - vb_migrate_scene_to_app_widget_callback(GuiButtonType result, InputType type, void* context) { - VbMigrate* inst = context; - - if(type == InputTypeShort) { - if(result == GuiButtonTypeLeft) - view_dispatcher_send_custom_event(inst->view_dispatcher, ToAppEventTypeWidgetLeft); - else if(result == GuiButtonTypeRight) - view_dispatcher_send_custom_event(inst->view_dispatcher, ToAppEventTypeWidgetRight); - } -} - -static bool vb_migrate_scene_to_app_worker_callback(NfcWorkerEvent event, void* context) { - VbMigrate* inst = context; - bool result = false; - - if(event == NfcWorkerEventSuccess) { - view_dispatcher_send_custom_event(inst->view_dispatcher, ToAppEventTypeTagWrite); - result = true; - } - - return result; -} - -static void vb_migrate_scene_to_app_set_nfc_state(VbMigrate* inst, ToAppState state) { - BantBlock* bant = vb_tag_get_bant_block(&inst->nfc_dev->dev_data); - if(state == ToAppStateEmulateReady) { - vb_tag_set_status(bant, VbTagStatusReady); - vb_tag_set_operation(bant, VbTagOperationReady); - } - - // Override tag type - if(inst->override_type != inst->orig_type && inst->override_type != VbTagTypeUnknown) { - vb_tag_set_item_id_no(bant, vb_tag_get_default_product(inst->override_type)); - } -} - -static bool vb_migrate_scene_to_app_is_state_changed(VbMigrate* inst, ToAppState state) { - BantBlock* bant = vb_tag_get_bant_block(&inst->nfc_dev->dev_data); - VbTagOperation operation = vb_tag_get_operation(bant); - - if(state == ToAppStateEmulateReady) { - return operation == VbTagOperationTransferToApp; - } - - return false; -} - -static void vb_migrate_scene_to_app_set_state(VbMigrate* inst, ToAppState state) { - uint32_t curr_state = scene_manager_get_scene_state(inst->scene_manager, VbMigrateSceneToApp); - if(state != curr_state) { - Widget* widget = inst->widget; - - if(state == ToAppStateInstructions) { - widget_reset(widget); - widget_add_text_scroll_element( - widget, - 0, - 0, - 128, - 45, - "\e#To transfer characters\n" - "\e#from Flipper:\n" - "1. Put the current character\n" - "into storage\n" - "2. Sync character from\n" - "Flipperas if it was a Vital\n" - "Bracelet. Flipper will beep\n" - "and automatically advance to\n" - "the next captured character\n" - "when VB Lab has transferred\n" - "the current character\n" - "\n" - "-> You can press the right\n" - "key to skip sending the\n" - "current character\n" - "3. Repeat the above until you\n" - "have transferred all the\n" - "characters you want\n" - "\n" - "You can cancel at any time to\n" - "finish transferring."); - widget_add_button_element( - widget, GuiButtonTypeLeft, "Cancel", vb_migrate_scene_to_app_widget_callback, inst); - widget_add_button_element( - widget, GuiButtonTypeRight, "Next", vb_migrate_scene_to_app_widget_callback, inst); - - view_dispatcher_switch_to_view(inst->view_dispatcher, VbMigrateViewWidget); - } else if(state == ToAppStateEmulateReady) { - view_dispatcher_send_custom_event(inst->view_dispatcher, ToAppEventTypeEmulateStart); - } else if(state == ToAppStateLoadError) { - FuriString* temp_str = - furi_string_alloc_printf("Could not load\ncapture %03d", inst->next_id); - widget_reset(widget); - widget_add_string_multiline_element( - widget, - 80, - 31, - AlignCenter, - AlignCenter, - FontPrimary, - furi_string_get_cstr(temp_str)); - widget_add_icon_element(widget, 15, 22, &I_Error_18x18); - widget_add_button_element( - widget, GuiButtonTypeLeft, "Cancel", vb_migrate_scene_to_app_widget_callback, inst); - - view_dispatcher_switch_to_view(inst->view_dispatcher, VbMigrateViewWidget); - furi_string_free(temp_str); - notification_message(inst->notifications, &sequence_error); - notification_message(inst->notifications, &sequence_set_red_255); - } else if(state == ToAppStateComplete) { - widget_reset(widget); - widget_add_icon_element(widget, 32, 5, &I_DolphinNice_96x59); - widget_add_string_multiline_element( - widget, 28, 26, AlignCenter, AlignBottom, FontPrimary, "Transfers\ncomplete"); - widget_add_button_element( - widget, GuiButtonTypeRight, "Done", vb_migrate_scene_to_app_widget_callback, inst); - - view_dispatcher_switch_to_view(inst->view_dispatcher, VbMigrateViewWidget); - } else { - furi_crash("Unknown new state in vb_migrate_scene_to_app_set_state"); - } - - scene_manager_set_scene_state(inst->scene_manager, VbMigrateSceneToApp, state); - } -} - -static void vb_migrate_scene_to_app_load_capture(VbMigrate* inst, bool go_next) { - if(go_next) { - nfc_worker_stop(inst->worker); - vb_migrate_blink_stop(inst); - ++inst->next_id; - ++inst->num_sent; - } - - if(inst->num_sent == inst->num_captured) { - vb_migrate_scene_to_app_set_state(inst, ToAppStateComplete); - } else { - uint32_t state = scene_manager_get_scene_state(inst->scene_manager, VbMigrateSceneToApp); - inst->next_id = vb_migrate_get_next_id(inst, inst->text_store, inst->next_id, true); - FuriString* temp_str = - furi_string_alloc_printf(VB_MIGRATE_CAPTURE_FORMAT, inst->next_id, NFC_APP_EXTENSION); - - vb_migrate_show_loading_popup(inst, true); - if(vb_migrate_load_nfc(inst, inst->text_store, furi_string_get_cstr(temp_str))) { - Widget* widget = inst->widget; - - widget_reset(widget); - widget_add_string_multiline_element( - widget, - 80, - 20, - AlignCenter, - AlignCenter, - FontPrimary, - "Ready, waiting\nfor transfer"); - furi_string_printf( - temp_str, "Progress: %d/%d", inst->num_sent + 1, inst->num_captured); - widget_add_string_element( - widget, - 63, - 43, - AlignCenter, - AlignCenter, - FontSecondary, - furi_string_get_cstr(temp_str)); - widget_add_icon_element(widget, 7, 7, &I_Touch_26x26); - widget_add_button_element( - widget, GuiButtonTypeLeft, "Cancel", vb_migrate_scene_to_app_widget_callback, inst); - widget_add_button_element( - widget, GuiButtonTypeRight, "Skip", vb_migrate_scene_to_app_widget_callback, inst); - - view_dispatcher_switch_to_view(inst->view_dispatcher, VbMigrateViewWidget); - - vb_migrate_scene_to_app_set_nfc_state(inst, state); - nfc_worker_start( - inst->worker, - NfcWorkerStateMfUltralightEmulate, - &inst->nfc_dev->dev_data, - vb_migrate_scene_to_app_worker_callback, - inst); - vb_migrate_blink_emulate(inst); - } else { - view_dispatcher_send_custom_event( - inst->view_dispatcher, ToAppEventTypeCaptureLoadError); - } - vb_migrate_show_loading_popup(inst, false); - furi_string_free(temp_str); - } -} - -void vb_migrate_scene_to_app_on_enter(void* context) { - VbMigrate* inst = context; - - // Perform your setup here - inst->next_id = 0; - inst->num_sent = 0; - scene_manager_set_scene_state(inst->scene_manager, VbMigrateSceneToApp, ToAppStateInitial); - vb_migrate_scene_to_app_set_state(inst, ToAppStateInstructions); -} - -bool vb_migrate_scene_to_app_on_event(void* context, SceneManagerEvent event) { - VbMigrate* inst = context; - uint32_t state = scene_manager_get_scene_state(inst->scene_manager, VbMigrateSceneToApp); - bool consumed = false; - - if(event.type == SceneManagerEventTypeCustom) { - if(event.event == ToAppEventTypeWidgetLeft) { - consumed = scene_manager_previous_scene(inst->scene_manager); - } else if(event.event == ToAppEventTypeWidgetRight) { - if(state == ToAppStateInstructions) { - vb_migrate_scene_to_app_set_state(inst, ToAppStateEmulateReady); - consumed = true; - } else if(state == ToAppStateEmulateReady) { - vb_migrate_scene_to_app_load_capture(inst, true); - consumed = true; - } else if(state == ToAppStateComplete) { - consumed = scene_manager_previous_scene(inst->scene_manager); - } - } else if(event.event == ToAppEventTypeEmulateStart) { - vb_migrate_scene_to_app_load_capture(inst, false); - } else if(event.event == ToAppEventTypeTagWrite) { - if(vb_migrate_scene_to_app_is_state_changed(inst, state)) { - if(state == ToAppStateEmulateReady) { - notification_message(inst->notifications, &sequence_success); - vb_migrate_scene_to_app_load_capture(inst, true); - consumed = true; - } - } - } else if(event.event == ToAppEventTypeCaptureLoadError) { - vb_migrate_scene_to_app_set_state(inst, ToAppStateLoadError); - consumed = true; - } else { - furi_crash("Unknown event in vb_migrate_scene_to_app_on_event"); - } - } - return consumed; -} - -void vb_migrate_scene_to_app_on_exit(void* context) { - VbMigrate* inst = context; - - // Perform your cleanup here - widget_reset(inst->widget); - nfc_worker_stop(inst->worker); - vb_migrate_blink_stop(inst); - notification_message_block(inst->notifications, &sequence_reset_red); -} diff --git a/applications/plugins/vbmigrate/vb_migrate.c b/applications/plugins/vbmigrate/vb_migrate.c deleted file mode 100644 index fec624a0b..000000000 --- a/applications/plugins/vbmigrate/vb_migrate.c +++ /dev/null @@ -1,319 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// -// VB Lab Migration Assistant for Flipper Zero -// Copyright (C) 2022 cyanic -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -#include - -#include "vb_migrate_i.h" - -#define TAG "vb_migrate" - -bool vb_migrate_custom_event_callback(void* context, uint32_t event) { - furi_assert(context); - VbMigrate* inst = context; - return scene_manager_handle_custom_event(inst->scene_manager, event); -} - -bool vb_migrate_back_event_callback(void* context) { - furi_assert(context); - VbMigrate* inst = context; - return scene_manager_handle_back_event(inst->scene_manager); -} - -void vb_migrate_blink_read(VbMigrate* inst) { - notification_message(inst->notifications, &sequence_blink_start_cyan); -} - -void vb_migrate_blink_emulate(VbMigrate* inst) { - notification_message(inst->notifications, &sequence_blink_start_magenta); -} - -void vb_migrate_blink_stop(VbMigrate* inst) { - notification_message_block(inst->notifications, &sequence_blink_stop); -} - -void vb_migrate_text_store_set(VbMigrate* inst, const char* text, ...) { - va_list args; - va_start(args, text); - - vsnprintf(inst->text_store, sizeof(inst->text_store), text, args); - - va_end(args); -} - -void vb_migrate_text_store_clear(VbMigrate* inst) { - memset(inst->text_store, 0, sizeof(inst->text_store)); -} - -bool vb_migrate_save_nfc(VbMigrate* inst, const char* dev_name, const char* file_name) { - bool saved = false; - FuriString* temp_str = furi_string_alloc(); - - do { - furi_string_printf(temp_str, "%s/%s", VB_MIGRATE_FOLDER, dev_name); - if(!storage_simply_mkdir(inst->storage, furi_string_get_cstr(temp_str))) { - dialog_message_show_storage_error(inst->dialogs, "Can not create\ndata folder"); - break; - } - furi_string_cat_printf(temp_str, "/%s", file_name); - inst->nfc_dev->format = NfcDeviceSaveFormatMifareUl; - saved = nfc_device_save(inst->nfc_dev, furi_string_get_cstr(temp_str)); - } while(false); - - furi_string_free(temp_str); - return saved; -} - -bool vb_migrate_load_nfc(VbMigrate* inst, const char* dev_name, const char* file_name) { - bool saved = false; - FuriString* temp_str = - furi_string_alloc_printf("%s/%s/%s", VB_MIGRATE_FOLDER, dev_name, file_name); - saved = nfc_device_load(inst->nfc_dev, furi_string_get_cstr(temp_str), true); - - furi_string_free(temp_str); - return saved; -} - -bool vb_migrate_delete(VbMigrate* inst, const char* dev_name, bool whole_vb) { - bool deleted = false; - FuriString* dir_path = furi_string_alloc_printf("%s/%s", VB_MIGRATE_FOLDER, dev_name); - - if(whole_vb) { - deleted = storage_simply_remove_recursive(inst->storage, furi_string_get_cstr(dir_path)); - } else { - File* dir_handle = storage_file_alloc(inst->storage); - if(storage_dir_open(dir_handle, furi_string_get_cstr(dir_path))) { - FileInfo file_info; - char name[256]; - FuriString* file_path = furi_string_alloc(); - while(storage_dir_read(dir_handle, &file_info, name, sizeof(name))) { - // Files that is .nfc, but is not template - if(!(file_info.flags & FSF_DIRECTORY) && strstr(name, NFC_APP_EXTENSION) && - !strstr(name, VB_MIGRATE_TEMPLATE_NAME)) { - furi_string_printf(file_path, "%s/%s", furi_string_get_cstr(dir_path), name); - deleted = - storage_simply_remove(inst->storage, furi_string_get_cstr(file_path)); - if(!deleted) break; - } - } - - furi_string_free(file_path); - storage_dir_close(dir_handle); - } - storage_file_free(dir_handle); - } - - furi_string_free(dir_path); - return deleted; -} - -int vb_migrate_count_captured_mons(VbMigrate* inst, const char* dev_name) { - int count = 0; - - FuriString* dir_path = furi_string_alloc_printf("%s/%s", VB_MIGRATE_FOLDER, dev_name); - File* dir_handle = storage_file_alloc(inst->storage); - if(storage_dir_open(dir_handle, furi_string_get_cstr(dir_path))) { - FileInfo file_info; - char name[256]; - while(storage_dir_read(dir_handle, &file_info, name, sizeof(name))) { - // Files that is .nfc, but is not template - if(!(file_info.flags & FSF_DIRECTORY) && strstr(name, NFC_APP_EXTENSION) && - !strstr(name, VB_MIGRATE_TEMPLATE_NAME)) - ++count; - } - - storage_dir_close(dir_handle); - } - storage_file_free(dir_handle); - furi_string_free(dir_path); - - return count; -} - -int vb_migrate_get_next_id(VbMigrate* inst, const char* dev_name, int i, bool is_load) { - FuriString* dir_path = furi_string_alloc_printf("%s/%s", VB_MIGRATE_FOLDER, dev_name); - FuriString* file_path = furi_string_alloc(); - while(true) { - furi_string_printf( - file_path, - "%s/" VB_MIGRATE_CAPTURE_FORMAT, - furi_string_get_cstr(dir_path), - i, - NFC_APP_EXTENSION); - bool exit_cond = - storage_common_stat(inst->storage, furi_string_get_cstr(file_path), NULL) == - FSE_NOT_EXIST; - if(is_load) exit_cond = !exit_cond; - if(exit_cond) break; - ++i; - } - - furi_string_free(file_path); - furi_string_free(dir_path); - return i; -} - -void vb_migrate_show_loading_popup(VbMigrate* inst, bool show) { - TaskHandle_t timer_task = xTaskGetHandle(configTIMER_SERVICE_TASK_NAME); - - if(show) { - // Raise timer priority so that animations can play - vTaskPrioritySet(timer_task, configMAX_PRIORITIES - 1); - view_dispatcher_switch_to_view(inst->view_dispatcher, VbMigrateViewLoading); - } else { - // Restore default timer priority - vTaskPrioritySet(timer_task, configTIMER_TASK_PRIORITY); - } -} - -VbMigrate* vb_migrate_alloc() { - VbMigrate* inst = malloc(sizeof(VbMigrate)); - - inst->view_dispatcher = view_dispatcher_alloc(); - inst->scene_manager = scene_manager_alloc(&vb_migrate_scene_handlers, inst); - view_dispatcher_enable_queue(inst->view_dispatcher); - view_dispatcher_set_event_callback_context(inst->view_dispatcher, inst); - view_dispatcher_set_custom_event_callback( - inst->view_dispatcher, vb_migrate_custom_event_callback); - view_dispatcher_set_navigation_event_callback( - inst->view_dispatcher, vb_migrate_back_event_callback); - - // GUI - inst->gui = furi_record_open(RECORD_GUI); - - // Storage - inst->storage = furi_record_open(RECORD_STORAGE); - - // Notifications service - inst->notifications = furi_record_open(RECORD_NOTIFICATION); - - // Dialogs - inst->dialogs = furi_record_open(RECORD_DIALOGS); - - // NFC - inst->nfc_dev = nfc_device_alloc(); - inst->worker = nfc_worker_alloc(); - - // Submenu - inst->submenu = submenu_alloc(); - view_dispatcher_add_view( - inst->view_dispatcher, VbMigrateViewMenu, submenu_get_view(inst->submenu)); - - // Popup - inst->popup = popup_alloc(); - view_dispatcher_add_view( - inst->view_dispatcher, VbMigrateViewPopup, popup_get_view(inst->popup)); - - // Widget - inst->widget = widget_alloc(); - view_dispatcher_add_view( - inst->view_dispatcher, VbMigrateViewWidget, widget_get_view(inst->widget)); - - // File select - inst->file_select = file_select_alloc(); - view_dispatcher_add_view( - inst->view_dispatcher, VbMigrateViewFileSelect, file_select_get_view(inst->file_select)); - - // Text input - inst->text_input = text_input_alloc(); - view_dispatcher_add_view( - inst->view_dispatcher, VbMigrateViewTextInput, text_input_get_view(inst->text_input)); - - // Loading - inst->loading = loading_alloc(); - view_dispatcher_add_view( - inst->view_dispatcher, VbMigrateViewLoading, loading_get_view(inst->loading)); - - // Variable item list - inst->variable_list = variable_item_list_alloc(); - view_dispatcher_add_view( - inst->view_dispatcher, - VbMigrateViewVariableItemList, - variable_item_list_get_view(inst->variable_list)); - - // Dialog ex - // inst->dialog_ex = dialog_ex_alloc(); - // view_dispatcher_add_view( - // inst->view_dispatcher, VbMigrateViewDialogEx, dialog_ex_get_view(inst->dialog_ex)); - - return inst; -} - -void vb_migrate_free(VbMigrate* inst) { - // Dialog ex - // view_dispatcher_remove_view(inst->view_dispatcher, VbMigrateViewDialogEx); - // dialog_ex_free(inst->dialog_ex); - - // Variable item list - view_dispatcher_remove_view(inst->view_dispatcher, VbMigrateViewVariableItemList); - variable_item_list_free(inst->variable_list); - - // Loading - view_dispatcher_remove_view(inst->view_dispatcher, VbMigrateViewLoading); - loading_free(inst->loading); - - // Text input - view_dispatcher_remove_view(inst->view_dispatcher, VbMigrateViewTextInput); - text_input_free(inst->text_input); - - // File select - view_dispatcher_remove_view(inst->view_dispatcher, VbMigrateViewFileSelect); - file_select_free(inst->file_select); - - // Widget - view_dispatcher_remove_view(inst->view_dispatcher, VbMigrateViewWidget); - widget_free(inst->widget); - - // Popup - view_dispatcher_remove_view(inst->view_dispatcher, VbMigrateViewPopup); - popup_free(inst->popup); - - // Submenu - view_dispatcher_remove_view(inst->view_dispatcher, VbMigrateViewMenu); - submenu_free(inst->submenu); - - // NFC - nfc_worker_free(inst->worker); - nfc_device_free(inst->nfc_dev); - - furi_record_close(RECORD_DIALOGS); - furi_record_close(RECORD_NOTIFICATION); - furi_record_close(RECORD_STORAGE); - furi_record_close(RECORD_GUI); - - view_dispatcher_free(inst->view_dispatcher); - scene_manager_free(inst->scene_manager); - - free(inst); -} - -int32_t vb_migrate_app(void* p) { - UNUSED(p); - - VbMigrate* inst = vb_migrate_alloc(); - view_dispatcher_attach_to_gui(inst->view_dispatcher, inst->gui, ViewDispatcherTypeFullscreen); - - if(storage_simply_mkdir(inst->storage, VB_MIGRATE_FOLDER)) { - scene_manager_next_scene(inst->scene_manager, VbMigrateSceneMainMenu); - view_dispatcher_run(inst->view_dispatcher); - } else { - dialog_message_show_storage_error(inst->dialogs, "Can not create\napp folder"); - } - - vb_migrate_free(inst); - return 0; -} diff --git a/applications/plugins/vbmigrate/vb_migrate.h b/applications/plugins/vbmigrate/vb_migrate.h deleted file mode 100644 index 886ba0773..000000000 --- a/applications/plugins/vbmigrate/vb_migrate.h +++ /dev/null @@ -1,31 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// -// VB Lab Migration Assistant for Flipper Zero -// Copyright (C) 2022 cyanic -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -#pragma once - -#include - -#define VB_MIGRATE_VERSION "0.2" - -#define VB_MIGRATE_FOLDER ANY_PATH("vb_migrate") - -typedef struct VbMigrate VbMigrate; - -VbMigrate* vb_migrate_alloc(); - -void vb_migrate_free(VbMigrate* inst); diff --git a/applications/plugins/vbmigrate/vb_migrate_i.h b/applications/plugins/vbmigrate/vb_migrate_i.h deleted file mode 100644 index 51a32318e..000000000 --- a/applications/plugins/vbmigrate/vb_migrate_i.h +++ /dev/null @@ -1,97 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// -// VB Lab Migration Assistant for Flipper Zero -// Copyright (C) 2022 cyanic -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -// #include -#include "gui/modules/file_select.h" -#include -#include - -#include -#include - -#include - -#include "vb_migrate.h" -#include "scenes/vb_migrate_scene.h" -#include "vb_tag.h" - -#define VB_MIGRATE_TEMPLATE_NAME "template" NFC_APP_EXTENSION -#define VB_MIGRATE_CAPTURE_FORMAT "%03d%s" - -#define VB_MIGRATE_MAX_DEV_NAME_LENGTH (30) - -struct VbMigrate { - Gui* gui; - Storage* storage; - DialogsApp* dialogs; - NotificationApp* notifications; - ViewDispatcher* view_dispatcher; - SceneManager* scene_manager; - Submenu* submenu; - Popup* popup; - Widget* widget; - // DialogEx* dialog_ex; - FileSelect* file_select; - TextInput* text_input; - Loading* loading; - VariableItemList* variable_list; - NfcWorker* worker; - NfcDevice* nfc_dev; - char text_store[128]; - uint8_t captured_pwd[4]; - uint8_t captured_uid[7]; - int num_captured; - int next_id; - int num_sent; - VbTagType orig_type; - VbTagType override_type; - const VbTagProduct* orig_product; -}; - -typedef enum { - VbMigrateViewMenu, - VbMigrateViewPopup, - VbMigrateViewWidget, - VbMigrateViewTextInput, - // VbMigrateViewDialogEx, - VbMigrateViewFileSelect, - VbMigrateViewLoading, - VbMigrateViewVariableItemList, -} VbMigrateView; - -void vb_migrate_blink_read(VbMigrate* inst); -void vb_migrate_blink_emulate(VbMigrate* inst); -void vb_migrate_blink_stop(VbMigrate* inst); -void vb_migrate_text_store_set(VbMigrate* inst, const char* text, ...); -void vb_migrate_text_store_clear(VbMigrate* inst); -bool vb_migrate_save_nfc(VbMigrate* inst, const char* dev_name, const char* file_name); -bool vb_migrate_load_nfc(VbMigrate* inst, const char* dev_name, const char* file_name); -int vb_migrate_count_captured_mons(VbMigrate* inst, const char* dev_name); -bool vb_migrate_delete(VbMigrate* inst, const char* dev_name, bool whole_vb); -int vb_migrate_get_next_id(VbMigrate* inst, const char* dev_name, int i, bool is_load); -void vb_migrate_show_loading_popup(VbMigrate* inst, bool show); diff --git a/applications/plugins/vbmigrate/vb_tag.c b/applications/plugins/vbmigrate/vb_tag.c deleted file mode 100644 index ce8edf7d5..000000000 --- a/applications/plugins/vbmigrate/vb_tag.c +++ /dev/null @@ -1,144 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// -// VB Lab Migration Assistant for Flipper Zero -// Copyright (C) 2022 cyanic -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -#include "vb_tag.h" - -#define VB_NAME_VBDM "VB Digital Monster" -#define VB_NAME_VBV "VB Digivice -V-" -#define VB_NAME_VBC "VB Characters" -#define VB_NAME_VH "Vital Hero" - -#define VB_NAME_VBDM_SHORT "VBDM" -#define VB_NAME_VBV_SHORT "VBV" -#define VB_NAME_VBC_SHORT "VBC" -#define VB_NAME_VH_SHORT "VH" - -static const VbTagProduct vb_tag_valid_products[] = { - {.item_id = 0x0200, - .item_no = 0x0100, - .name = VB_NAME_VBDM, - .short_name = VB_NAME_VBDM_SHORT, - .type = VbTagTypeVBDM}, - {.item_id = 0x0200, - .item_no = 0x0200, - .name = VB_NAME_VBDM, - .short_name = VB_NAME_VBDM_SHORT, - .type = VbTagTypeVBDM}, - {.item_id = 0x0200, - .item_no = 0x0300, - .name = VB_NAME_VBDM, - .short_name = VB_NAME_VBDM_SHORT, - .type = VbTagTypeVBDM}, - {.item_id = 0x0200, - .item_no = 0x0400, - .name = VB_NAME_VBV, - .short_name = VB_NAME_VBV_SHORT, - .type = VbTagTypeVBV}, - {.item_id = 0x0200, - .item_no = 0x0500, - .name = VB_NAME_VBV, - .short_name = VB_NAME_VBV_SHORT, - .type = VbTagTypeVBV}, - {.item_id = 0x0200, - .item_no = 0x0600, - .name = VB_NAME_VH, - .short_name = VB_NAME_VH_SHORT, - .type = VbTagTypeVH}, - {.item_id = 0x0300, - .item_no = 0x0100, - .name = VB_NAME_VBC, - .short_name = VB_NAME_VBC_SHORT, - .type = VbTagTypeVBC}, -}; - -static const char* vb_tag_type_names[] = { - "Unknown", - VB_NAME_VBDM_SHORT, - VB_NAME_VBV_SHORT, - VB_NAME_VBC_SHORT, - VB_NAME_VH_SHORT, -}; - -BantBlock* vb_tag_get_bant_block(NfcDeviceData* dev) { - return (BantBlock*)&dev->mf_ul_data.data[16]; -} - -const VbTagProduct* vb_tag_find_product(const BantBlock* bant) { - for(size_t i = 0; i < COUNT_OF(vb_tag_valid_products); ++i) { - const VbTagProduct* product = &vb_tag_valid_products[i]; - if(bant->item_id == product->item_id && bant->item_no == product->item_no) return product; - } - - return NULL; -} - -bool vb_tag_validate_product(NfcDeviceData* dev) { - // Must be NTAG I2C Plus 1k - if(dev->protocol != NfcDeviceProtocolMifareUl) return false; - if(dev->mf_ul_data.type != MfUltralightTypeNTAGI2CPlus1K) return false; - // Must match one of the known product IDs - BantBlock* bant = vb_tag_get_bant_block(dev); - if(bant->magic != BANT_MAGIC) return false; - return vb_tag_find_product(bant) != NULL; -} - -VbTagStatus vb_tag_get_status(const BantBlock* bant) { - return bant->status; -} - -void vb_tag_set_status(BantBlock* bant, VbTagStatus status) { - bant->status = status; -} - -VbTagOperation vb_tag_get_operation(const BantBlock* bant) { - return bant->operation; -} - -void vb_tag_set_operation(BantBlock* bant, VbTagOperation operation) { - bant->operation = operation; -} - -const VbTagProduct* vb_tag_get_default_product(VbTagType type) { - // IMPORTANT: Update when vb_tag_valid_products changes - switch(type) { - case VbTagTypeVBDM: - return &vb_tag_valid_products[2]; - case VbTagTypeVBV: - return &vb_tag_valid_products[4]; - case VbTagTypeVBC: - return &vb_tag_valid_products[6]; - case VbTagTypeVH: - return &vb_tag_valid_products[5]; - - default: - return NULL; - } -} - -void vb_tag_set_item_id_no(BantBlock* bant, const VbTagProduct* product) { - bant->item_id = product->item_id; - bant->item_no = product->item_no; -} - -const char* vb_tag_get_tag_type_name(VbTagType type) { - if(type < VbTagTypeMax) { - return vb_tag_type_names[type]; - } else { - return NULL; - } -} diff --git a/applications/plugins/vbmigrate/vb_tag.h b/applications/plugins/vbmigrate/vb_tag.h deleted file mode 100644 index e101bade2..000000000 --- a/applications/plugins/vbmigrate/vb_tag.h +++ /dev/null @@ -1,80 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// -// VB Lab Migration Assistant for Flipper Zero -// Copyright (C) 2022 cyanic -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -#pragma once - -#include -#include - -#define BANT_MAGIC (0x544E4142) - -typedef struct { - uint32_t magic; - // Note: this should be big endian, but for convenience, we'll treat them as little endian - uint16_t item_id; - uint16_t item_no; - uint8_t status; - uint8_t dim_no; - uint8_t operation; - uint8_t reserved; - uint8_t app_flag; - uint8_t padding[3]; -} __attribute__((packed)) BantBlock; - -typedef enum { - VbTagTypeUnknown, - VbTagTypeVBDM, - VbTagTypeVBV, - VbTagTypeVBC, - VbTagTypeVH, - VbTagTypeMax -} VbTagType; - -typedef struct { - uint16_t item_id; - uint16_t item_no; - const char* name; - const char* short_name; - VbTagType type; -} VbTagProduct; - -typedef enum { - VbTagStatusReady = 1 << 0, - VbTagStatusDimReady = 1 << 1, -} VbTagStatus; - -typedef enum { - VbTagOperationIdle, - VbTagOperationReady, - VbTagOperationTransferToApp, - VbTagOperationCheckDim, - VbTagOperationReturnFromApp, - VbTagOperationSpotInit, - VbTagOperationSpotCommit, -} VbTagOperation; - -BantBlock* vb_tag_get_bant_block(NfcDeviceData* dev); -const VbTagProduct* vb_tag_find_product(const BantBlock* bant); -bool vb_tag_validate_product(NfcDeviceData* dev); -VbTagStatus vb_tag_get_status(const BantBlock* bant); -void vb_tag_set_status(BantBlock* bant, VbTagStatus status); -VbTagOperation vb_tag_get_operation(const BantBlock* bant); -void vb_tag_set_operation(BantBlock* bant, VbTagOperation operation); -const VbTagProduct* vb_tag_get_default_product(VbTagType type); -void vb_tag_set_item_id_no(BantBlock* bant, const VbTagProduct* product); -const char* vb_tag_get_tag_type_name(VbTagType type);