applications.c 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. #include "applications.h"
  2. #include <assets_icons.h>
  3. // Services
  4. extern int32_t rpc_srv(void* p);
  5. extern int32_t bt_srv(void* p);
  6. extern int32_t cli_srv(void* p);
  7. extern int32_t dialogs_srv(void* p);
  8. extern int32_t dolphin_srv(void* p);
  9. extern int32_t gui_srv(void* p);
  10. extern int32_t input_srv(void* p);
  11. extern int32_t loader_srv(void* p);
  12. extern int32_t notification_srv(void* p);
  13. extern int32_t power_srv(void* p);
  14. extern int32_t storage_srv(void* p);
  15. extern int32_t desktop_srv(void* p);
  16. extern int32_t updater_srv(void* p);
  17. // Apps
  18. extern int32_t accessor_app(void* p);
  19. extern int32_t archive_app(void* p);
  20. extern int32_t bad_usb_app(void* p);
  21. extern int32_t u2f_app(void* p);
  22. extern int32_t uart_echo_app(void* p);
  23. extern int32_t blink_test_app(void* p);
  24. extern int32_t bt_debug_app(void* p);
  25. extern int32_t delay_test_app(void* p);
  26. extern int32_t display_test_app(void* p);
  27. extern int32_t gpio_app(void* p);
  28. extern int32_t ibutton_app(void* p);
  29. extern int32_t infrared_app(void* p);
  30. extern int32_t infrared_monitor_app(void* p);
  31. extern int32_t keypad_test_app(void* p);
  32. extern int32_t lfrfid_app(void* p);
  33. extern int32_t lfrfid_debug_app(void* p);
  34. extern int32_t nfc_app(void* p);
  35. extern int32_t passport_app(void* p);
  36. extern int32_t scened_app(void* p);
  37. extern int32_t storage_test_app(void* p);
  38. extern int32_t subghz_app(void* p);
  39. extern int32_t usb_mouse_app(void* p);
  40. extern int32_t usb_test_app(void* p);
  41. extern int32_t vibro_test_app(void* p);
  42. extern int32_t bt_hid_app(void* p);
  43. extern int32_t battery_test_app(void* p);
  44. extern int32_t text_box_test_app(void* p);
  45. extern int32_t file_browser_app(void* p);
  46. // Plugins
  47. extern int32_t music_player_app(void* p);
  48. extern int32_t snake_game_app(void* p);
  49. // On system start hooks declaration
  50. extern void bt_on_system_start();
  51. extern void crypto_on_system_start();
  52. extern void ibutton_on_system_start();
  53. extern void infrared_on_system_start();
  54. extern void lfrfid_on_system_start();
  55. extern void music_player_on_system_start();
  56. extern void nfc_on_system_start();
  57. extern void storage_on_system_start();
  58. extern void subghz_on_system_start();
  59. extern void power_on_system_start();
  60. extern void unit_tests_on_system_start();
  61. extern void updater_on_system_start();
  62. // Settings
  63. extern int32_t notification_settings_app(void* p);
  64. extern int32_t storage_settings_app(void* p);
  65. extern int32_t bt_settings_app(void* p);
  66. extern int32_t desktop_settings_app(void* p);
  67. extern int32_t about_settings_app(void* p);
  68. extern int32_t power_settings_app(void* p);
  69. extern int32_t system_settings_app(void* p);
  70. const FlipperApplication FLIPPER_SERVICES[] = {
  71. /* Services */
  72. #ifdef SRV_RPC
  73. {.app = rpc_srv,
  74. .name = "RpcSrv",
  75. .stack_size = 1024 * 4,
  76. .icon = NULL,
  77. .flags = FlipperApplicationFlagDefault},
  78. #endif
  79. #ifdef SRV_BT
  80. {.app = bt_srv,
  81. .name = "BtSrv",
  82. .stack_size = 1024,
  83. .icon = NULL,
  84. .flags = FlipperApplicationFlagDefault},
  85. #endif
  86. #ifdef SRV_CLI
  87. {.app = cli_srv,
  88. .name = "CliSrv",
  89. .stack_size = 4096,
  90. .icon = NULL,
  91. .flags = FlipperApplicationFlagDefault},
  92. #endif
  93. #ifdef SRV_DIALOGS
  94. {.app = dialogs_srv,
  95. .name = "DialogsSrv",
  96. .stack_size = 1024,
  97. .icon = NULL,
  98. .flags = FlipperApplicationFlagDefault},
  99. #endif
  100. #ifdef SRV_DOLPHIN
  101. {.app = dolphin_srv,
  102. .name = "DolphinSrv",
  103. .stack_size = 1024,
  104. .icon = NULL,
  105. .flags = FlipperApplicationFlagDefault},
  106. #endif
  107. #ifdef SRV_DESKTOP
  108. #ifdef SRV_UPDATER
  109. #error SRV_UPDATER and SRV_DESKTOP are mutually exclusive!
  110. #endif
  111. {.app = desktop_srv,
  112. .name = "DesktopSrv",
  113. .stack_size = 2048,
  114. .icon = NULL,
  115. .flags = FlipperApplicationFlagDefault},
  116. #endif
  117. #ifdef SRV_GUI
  118. {.app = gui_srv,
  119. .name = "GuiSrv",
  120. .stack_size = 2048,
  121. .icon = NULL,
  122. .flags = FlipperApplicationFlagDefault},
  123. #endif
  124. #ifdef SRV_INPUT
  125. {.app = input_srv,
  126. .name = "InputSrv",
  127. .stack_size = 1024,
  128. .icon = NULL,
  129. .flags = FlipperApplicationFlagDefault},
  130. #endif
  131. #ifdef SRV_LOADER
  132. {.app = loader_srv,
  133. .name = "LoaderSrv",
  134. .stack_size = 1024,
  135. .icon = NULL,
  136. .flags = FlipperApplicationFlagDefault},
  137. #endif
  138. #ifdef SRV_NOTIFICATION
  139. {.app = notification_srv,
  140. .name = "NotificationSrv",
  141. .stack_size = 1536,
  142. .icon = NULL,
  143. .flags = FlipperApplicationFlagDefault},
  144. #endif
  145. #ifdef SRV_POWER
  146. {.app = power_srv,
  147. .name = "PowerSrv",
  148. .stack_size = 1024,
  149. .icon = NULL,
  150. .flags = FlipperApplicationFlagDefault},
  151. #endif
  152. #ifdef SRV_STORAGE
  153. {.app = storage_srv,
  154. .name = "StorageSrv",
  155. .stack_size = 3072,
  156. .icon = NULL,
  157. .flags = FlipperApplicationFlagDefault},
  158. #endif
  159. #ifdef SRV_UPDATER
  160. #ifdef SRV_DESKTOP
  161. #error SRV_UPDATER and SRV_DESKTOP are mutually exclusive!
  162. #endif
  163. {.app = updater_srv,
  164. .name = "UpdaterSrv",
  165. .stack_size = 2048,
  166. .icon = NULL,
  167. .flags = FlipperApplicationFlagDefault},
  168. #endif
  169. };
  170. const size_t FLIPPER_SERVICES_COUNT = COUNT_OF(FLIPPER_SERVICES);
  171. const FlipperApplication FLIPPER_SYSTEM_APPS[] = {
  172. #ifdef APP_UPDATER
  173. #ifdef SRV_UPDATER
  174. #error APP_UPDATER and SRV_UPDATER are mutually exclusive!
  175. #endif
  176. {.app = updater_srv,
  177. .name = "UpdaterApp",
  178. .stack_size = 2048,
  179. .icon = NULL,
  180. .flags = FlipperApplicationFlagDefault},
  181. #endif
  182. };
  183. const size_t FLIPPER_SYSTEM_APPS_COUNT = COUNT_OF(FLIPPER_SYSTEM_APPS);
  184. // Main menu APP
  185. const FlipperApplication FLIPPER_APPS[] = {
  186. #ifdef APP_SUBGHZ
  187. {.app = subghz_app,
  188. .name = "Sub-GHz",
  189. .stack_size = 2048,
  190. .icon = &A_Sub1ghz_14,
  191. .flags = FlipperApplicationFlagDefault},
  192. #endif
  193. #ifdef APP_LF_RFID
  194. {.app = lfrfid_app,
  195. .name = "125 kHz RFID",
  196. .stack_size = 2048,
  197. .icon = &A_125khz_14,
  198. .flags = FlipperApplicationFlagDefault},
  199. #endif
  200. #ifdef APP_NFC
  201. {.app = nfc_app,
  202. .name = "NFC",
  203. .stack_size = 4096,
  204. .icon = &A_NFC_14,
  205. .flags = FlipperApplicationFlagDefault},
  206. #endif
  207. #ifdef APP_INFRARED
  208. {.app = infrared_app,
  209. .name = "Infrared",
  210. .stack_size = 1024 * 3,
  211. .icon = &A_Infrared_14,
  212. .flags = FlipperApplicationFlagDefault},
  213. #endif
  214. #ifdef APP_GPIO
  215. {.app = gpio_app,
  216. .name = "GPIO",
  217. .stack_size = 1024,
  218. .icon = &A_GPIO_14,
  219. .flags = FlipperApplicationFlagDefault},
  220. #endif
  221. #ifdef APP_IBUTTON
  222. {.app = ibutton_app,
  223. .name = "iButton",
  224. .stack_size = 2048,
  225. .icon = &A_iButton_14,
  226. .flags = FlipperApplicationFlagDefault},
  227. #endif
  228. #ifdef APP_BAD_USB
  229. {.app = bad_usb_app,
  230. .name = "Bad USB",
  231. .stack_size = 2048,
  232. .icon = &A_BadUsb_14,
  233. .flags = FlipperApplicationFlagDefault},
  234. #endif
  235. #ifdef APP_U2F
  236. {.app = u2f_app,
  237. .name = "U2F",
  238. .stack_size = 2048,
  239. .icon = &A_U2F_14,
  240. .flags = FlipperApplicationFlagDefault},
  241. #endif
  242. };
  243. const size_t FLIPPER_APPS_COUNT = COUNT_OF(FLIPPER_APPS);
  244. // On system start hooks
  245. const FlipperOnStartHook FLIPPER_ON_SYSTEM_START[] = {
  246. crypto_on_system_start,
  247. #ifdef APP_INFRARED
  248. infrared_on_system_start,
  249. #endif
  250. #ifdef APP_MUSIC_PLAYER
  251. music_player_on_system_start,
  252. #endif
  253. #ifdef APP_NFC
  254. nfc_on_system_start,
  255. #endif
  256. #ifdef APP_SUBGHZ
  257. subghz_on_system_start,
  258. #endif
  259. #ifdef APP_LF_RFID
  260. lfrfid_on_system_start,
  261. #endif
  262. #ifdef APP_IBUTTON
  263. ibutton_on_system_start,
  264. #endif
  265. #ifdef SRV_BT
  266. bt_on_system_start,
  267. #endif
  268. #ifdef SRV_POWER
  269. power_on_system_start,
  270. #endif
  271. #ifdef SRV_STORAGE
  272. storage_on_system_start,
  273. #endif
  274. #ifdef APP_UNIT_TESTS
  275. unit_tests_on_system_start,
  276. #endif
  277. #ifdef APP_UPDATER
  278. updater_on_system_start,
  279. #endif
  280. };
  281. const size_t FLIPPER_ON_SYSTEM_START_COUNT = COUNT_OF(FLIPPER_ON_SYSTEM_START);
  282. // Plugin menu
  283. const FlipperApplication FLIPPER_PLUGINS[] = {
  284. #ifdef APP_BLE_HID
  285. {.app = bt_hid_app,
  286. .name = "Bluetooth Remote",
  287. .stack_size = 1024,
  288. .icon = NULL,
  289. .flags = FlipperApplicationFlagDefault},
  290. #endif
  291. #ifdef APP_MUSIC_PLAYER
  292. {.app = music_player_app,
  293. .name = "Music Player",
  294. .stack_size = 2048,
  295. .icon = &A_Plugins_14,
  296. .flags = FlipperApplicationFlagDefault},
  297. #endif
  298. #ifdef APP_SNAKE_GAME
  299. {.app = snake_game_app,
  300. .name = "Snake Game",
  301. .stack_size = 1024,
  302. .icon = &A_Plugins_14,
  303. .flags = FlipperApplicationFlagDefault},
  304. #endif
  305. };
  306. const size_t FLIPPER_PLUGINS_COUNT = COUNT_OF(FLIPPER_PLUGINS);
  307. // Plugin menu
  308. const FlipperApplication FLIPPER_DEBUG_APPS[] = {
  309. #ifdef APP_BLINK
  310. {.app = blink_test_app,
  311. .name = "Blink Test",
  312. .stack_size = 1024,
  313. .icon = NULL,
  314. .flags = FlipperApplicationFlagDefault},
  315. #endif
  316. #ifdef APP_VIBRO_TEST
  317. {.app = vibro_test_app,
  318. .name = "Vibro Test",
  319. .stack_size = 1024,
  320. .icon = NULL,
  321. .flags = FlipperApplicationFlagDefault},
  322. #endif
  323. #ifdef APP_KEYPAD_TEST
  324. {.app = keypad_test_app,
  325. .name = "Keypad Test",
  326. .stack_size = 1024,
  327. .icon = NULL,
  328. .flags = FlipperApplicationFlagDefault},
  329. #endif
  330. #ifdef APP_ACCESSOR
  331. {.app = accessor_app,
  332. .name = "Accessor",
  333. .stack_size = 4096,
  334. .icon = NULL,
  335. .flags = FlipperApplicationFlagDefault},
  336. #endif
  337. #ifdef APP_USB_TEST
  338. {.app = usb_test_app,
  339. .name = "USB Test",
  340. .stack_size = 1024,
  341. .icon = NULL,
  342. .flags = FlipperApplicationFlagDefault},
  343. #endif
  344. #ifdef APP_USB_MOUSE
  345. {.app = usb_mouse_app,
  346. .name = "USB Mouse Demo",
  347. .stack_size = 1024,
  348. .icon = NULL,
  349. .flags = FlipperApplicationFlagDefault},
  350. #endif
  351. #ifdef APP_UART_ECHO
  352. {.app = uart_echo_app,
  353. .name = "Uart Echo",
  354. .stack_size = 2048,
  355. .icon = NULL,
  356. .flags = FlipperApplicationFlagDefault},
  357. #endif
  358. #ifdef APP_INFRARED_MONITOR
  359. {.app = infrared_monitor_app,
  360. .name = "Infrared Monitor",
  361. .stack_size = 1024,
  362. .icon = NULL,
  363. .flags = FlipperApplicationFlagDefault},
  364. #endif
  365. #ifdef APP_LF_RFID
  366. {.app = lfrfid_debug_app,
  367. .name = "LF-RFID Debug",
  368. .stack_size = 1024,
  369. .icon = NULL,
  370. .flags = FlipperApplicationFlagDefault},
  371. #endif
  372. #ifdef SRV_BT
  373. {.app = bt_debug_app,
  374. .name = "Bluetooth Debug",
  375. .stack_size = 1024,
  376. .icon = NULL,
  377. .flags = FlipperApplicationFlagDefault},
  378. #endif
  379. #ifdef APP_UNIT_TESTS
  380. {.app = delay_test_app,
  381. .name = "Delay Test",
  382. .stack_size = 1024,
  383. .icon = NULL,
  384. .flags = FlipperApplicationFlagDefault},
  385. #endif
  386. #ifdef APP_DISPLAY_TEST
  387. {.app = display_test_app,
  388. .name = "Display Test",
  389. .stack_size = 1024,
  390. .icon = NULL,
  391. .flags = FlipperApplicationFlagDefault},
  392. #endif
  393. #ifdef APP_FILE_BROWSER_TEST
  394. {.app = file_browser_app,
  395. .name = "File Browser test",
  396. .stack_size = 2048,
  397. .icon = &A_BadUsb_14,
  398. .flags = FlipperApplicationFlagDefault},
  399. #endif
  400. #ifdef APP_BATTERY_TEST
  401. {.app = battery_test_app,
  402. .name = "Battery Test",
  403. .stack_size = 1024,
  404. .icon = NULL,
  405. .flags = FlipperApplicationFlagDefault},
  406. #endif
  407. #ifdef APP_TEXT_BOX_TEST
  408. {.app = text_box_test_app,
  409. .name = "Text Box Test",
  410. .stack_size = 1024,
  411. .icon = NULL,
  412. .flags = FlipperApplicationFlagDefault},
  413. #endif
  414. };
  415. const size_t FLIPPER_DEBUG_APPS_COUNT = COUNT_OF(FLIPPER_DEBUG_APPS);
  416. #ifdef APP_ARCHIVE
  417. const FlipperApplication FLIPPER_ARCHIVE = {
  418. .app = archive_app,
  419. .name = "Archive",
  420. .stack_size = 4096,
  421. .icon = &A_FileManager_14,
  422. .flags = FlipperApplicationFlagDefault};
  423. #endif
  424. // Settings menu
  425. const FlipperApplication FLIPPER_SETTINGS_APPS[] = {
  426. #ifdef SRV_BT
  427. {.app = bt_settings_app,
  428. .name = "Bluetooth",
  429. .stack_size = 1024,
  430. .icon = NULL,
  431. .flags = FlipperApplicationFlagDefault},
  432. #endif
  433. #ifdef SRV_NOTIFICATION
  434. {.app = notification_settings_app,
  435. .name = "LCD and Notifications",
  436. .stack_size = 1024,
  437. .icon = NULL,
  438. .flags = FlipperApplicationFlagDefault},
  439. #endif
  440. #ifdef SRV_STORAGE
  441. {.app = storage_settings_app,
  442. .name = "Storage",
  443. .stack_size = 2048,
  444. .icon = NULL,
  445. .flags = FlipperApplicationFlagDefault},
  446. #endif
  447. #ifdef SRV_POWER
  448. {.app = power_settings_app,
  449. .name = "Power",
  450. .stack_size = 1024,
  451. .icon = NULL,
  452. .flags = FlipperApplicationFlagInsomniaSafe},
  453. #endif
  454. #ifdef SRV_DESKTOP
  455. {.app = desktop_settings_app,
  456. .name = "Desktop",
  457. .stack_size = 1024,
  458. .icon = NULL,
  459. .flags = FlipperApplicationFlagDefault},
  460. #endif
  461. #ifdef APP_PASSPORT
  462. {.app = passport_app,
  463. .name = "Passport",
  464. .stack_size = 1024,
  465. .icon = NULL,
  466. .flags = FlipperApplicationFlagDefault},
  467. #endif
  468. #ifdef SRV_GUI
  469. {.app = system_settings_app,
  470. .name = "System",
  471. .stack_size = 1024,
  472. .icon = NULL,
  473. .flags = FlipperApplicationFlagDefault},
  474. #endif
  475. #ifdef APP_ABOUT
  476. {.app = about_settings_app,
  477. .name = "About",
  478. .stack_size = 1024,
  479. .icon = NULL,
  480. .flags = FlipperApplicationFlagDefault},
  481. #endif
  482. };
  483. const size_t FLIPPER_SETTINGS_APPS_COUNT = COUNT_OF(FLIPPER_SETTINGS_APPS);