applications.c 13 KB

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