subghz_protocol_keeloq.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #pragma once
  2. #include "subghz_protocol_common.h"
  3. typedef struct SubGhzKeystore SubGhzKeystore;
  4. typedef struct SubGhzProtocolKeeloq SubGhzProtocolKeeloq;
  5. /** Allocate SubGhzProtocolKeeloq
  6. *
  7. * @return SubGhzProtocolKeeloq*
  8. */
  9. SubGhzProtocolKeeloq* subghz_protocol_keeloq_alloc(SubGhzKeystore* keystore);
  10. /** Free SubGhzProtocolKeeloq
  11. *
  12. * @param instance
  13. */
  14. void subghz_protocol_keeloq_free(SubGhzProtocolKeeloq* instance);
  15. /** Find and get manufacture name
  16. *
  17. * @param context - SubGhzProtocolKeeloq context
  18. * @return name - char* manufacture name
  19. */
  20. const char* subghz_protocol_keeloq_find_and_get_manufacture_name(void* context);
  21. /** Get manufacture name
  22. *
  23. * @param context - SubGhzProtocolKeeloq context
  24. * @return name - char* manufacture name
  25. */
  26. const char* subghz_protocol_keeloq_get_manufacture_name(void* context);
  27. /** Set manufacture name
  28. *
  29. * @param manufacture_name - manufacture name
  30. * @param context - SubGhzProtocolKeeloq context
  31. * @return bool
  32. */
  33. bool subghz_protocol_keeloq_set_manufacture_name(void* context, const char* manufacture_name);
  34. /** Get key keeloq
  35. *
  36. * @param context - SubGhzProtocolKeeloq context
  37. * @return key
  38. */
  39. uint64_t subghz_protocol_keeloq_gen_key(void* context);
  40. /** Get upload protocol
  41. *
  42. * @param instance - SubGhzProtocolKeeloq instance
  43. * @param encoder - SubGhzProtocolCommonEncoder encoder
  44. * @return bool
  45. */
  46. bool subghz_protocol_keeloq_send_key(
  47. SubGhzProtocolKeeloq* instance,
  48. SubGhzProtocolCommonEncoder* encoder);
  49. /** Reset internal state
  50. * @param instance - SubGhzProtocolKeeloq instance
  51. */
  52. void subghz_protocol_keeloq_reset(SubGhzProtocolKeeloq* instance);
  53. /** Parse accepted duration
  54. *
  55. * @param instance - SubGhzProtocolKeeloq instance
  56. * @param data - LevelDuration level_duration
  57. */
  58. void subghz_protocol_keeloq_parse(SubGhzProtocolKeeloq* instance, bool level, uint32_t duration);
  59. /** Outputting information from the parser
  60. *
  61. * @param instance - SubGhzProtocolKeeloq* instance
  62. * @param output - output string
  63. */
  64. void subghz_protocol_keeloq_to_str(SubGhzProtocolKeeloq* instance, string_t output);
  65. /** Adding data to a file
  66. *
  67. * @param instance - SubGhzProtocolKeeloq instance
  68. * @param flipper_file - FlipperFile
  69. * @return bool
  70. */
  71. bool subghz_protocol_keeloq_to_save_file(SubGhzProtocolKeeloq* instance, FlipperFile* flipper_file);
  72. /** Loading protocol from file
  73. *
  74. * @param flipper_file - FlipperFile
  75. * @param instance - SubGhzProtocolKeeloq instance
  76. * @param file_path - file path
  77. * @return bool
  78. */
  79. bool subghz_protocol_keeloq_to_load_protocol_from_file(
  80. FlipperFile* flipper_file,
  81. SubGhzProtocolKeeloq* instance,
  82. const char* file_path);
  83. /** Loading protocol from bin data
  84. *
  85. * @param instance - SubGhzProtocolKeeloq instance
  86. * @param context - SubGhzProtocolCommonLoad context
  87. */
  88. void subghz_decoder_keeloq_to_load_protocol(SubGhzProtocolKeeloq* instance, void* context);