dolphin_deed.c 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #include "dolphin_deed.h"
  2. #include <furi.h>
  3. static const DolphinDeedWeight dolphin_deed_weights[] = {
  4. {1, DolphinAppSubGhz}, // DolphinDeedSubGhzReceiverInfo
  5. {3, DolphinAppSubGhz}, // DolphinDeedSubGhzSave
  6. {1, DolphinAppSubGhz}, // DolphinDeedSubGhzRawRec
  7. {2, DolphinAppSubGhz}, // DolphinDeedSubGhzAddManually
  8. {2, DolphinAppSubGhz}, // DolphinDeedSubGhzSend
  9. {1, DolphinAppSubGhz}, // DolphinDeedSubGhzFrequencyAnalyzer
  10. {1, DolphinAppRfid}, // DolphinDeedRfidRead
  11. {3, DolphinAppRfid}, // DolphinDeedRfidReadSuccess
  12. {3, DolphinAppRfid}, // DolphinDeedRfidSave
  13. {2, DolphinAppRfid}, // DolphinDeedRfidEmulate
  14. {2, DolphinAppRfid}, // DolphinDeedRfidAdd
  15. {1, DolphinAppNfc}, // DolphinDeedNfcRead
  16. {3, DolphinAppNfc}, // DolphinDeedNfcReadSuccess
  17. {3, DolphinAppNfc}, // DolphinDeedNfcSave
  18. {1, DolphinAppNfc}, // DolphinDeedNfcDetectReader
  19. {2, DolphinAppNfc}, // DolphinDeedNfcEmulate
  20. {2, DolphinAppNfc}, // DolphinDeedNfcMfcAdd
  21. {1, DolphinAppNfc}, // DolphinDeedNfcAddSave
  22. {1, DolphinAppNfc}, // DolphinDeedNfcAddEmulate
  23. {1, DolphinAppIr}, // DolphinDeedIrSend
  24. {3, DolphinAppIr}, // DolphinDeedIrLearnSuccess
  25. {3, DolphinAppIr}, // DolphinDeedIrSave
  26. {1, DolphinAppIbutton}, // DolphinDeedIbuttonRead
  27. {3, DolphinAppIbutton}, // DolphinDeedIbuttonReadSuccess
  28. {3, DolphinAppIbutton}, // DolphinDeedIbuttonSave
  29. {2, DolphinAppIbutton}, // DolphinDeedIbuttonEmulate
  30. {2, DolphinAppIbutton}, // DolphinDeedIbuttonAdd
  31. {3, DolphinAppBadusb}, // DolphinDeedBadUsbPlayScript
  32. {3, DolphinAppPlugin}, // DolphinDeedU2fAuthorized
  33. {1, DolphinAppPlugin}, // DolphinDeedGpioUartBridge
  34. {1, DolphinAppPlugin}, // DolphinDeedPluginStart
  35. {1, DolphinAppPlugin}, // DolphinDeedPluginGameStart
  36. {10, DolphinAppPlugin}, // DolphinDeedPluginGameWin
  37. };
  38. static uint8_t dolphin_deed_limits[] = {
  39. 20, // DolphinAppSubGhz
  40. 20, // DolphinAppRfid
  41. 20, // DolphinAppNfc
  42. 20, // DolphinAppIr
  43. 20, // DolphinAppIbutton
  44. 20, // DolphinAppBadusb
  45. 20, // DolphinAppPlugin
  46. };
  47. _Static_assert(COUNT_OF(dolphin_deed_weights) == DolphinDeedMAX, "dolphin_deed_weights size error");
  48. _Static_assert(COUNT_OF(dolphin_deed_limits) == DolphinAppMAX, "dolphin_deed_limits size error");
  49. uint8_t dolphin_deed_get_weight(DolphinDeed deed) {
  50. furi_check(deed < DolphinDeedMAX);
  51. return dolphin_deed_weights[deed].icounter;
  52. }
  53. DolphinApp dolphin_deed_get_app(DolphinDeed deed) {
  54. furi_check(deed < DolphinDeedMAX);
  55. return dolphin_deed_weights[deed].app;
  56. }
  57. uint8_t dolphin_deed_get_app_limit(DolphinApp app) {
  58. furi_check(app < DolphinAppMAX);
  59. return dolphin_deed_limits[app];
  60. }