applications.c 12 KB

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