subghz_protocol_keeloq.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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(SubGhzProtocolKeeloq* instance, SubGhzProtocolCommonEncoder* encoder);
  47. /** Reset internal state
  48. * @param instance - SubGhzProtocolKeeloq instance
  49. */
  50. void subghz_protocol_keeloq_reset(SubGhzProtocolKeeloq* instance);
  51. /** Parse accepted duration
  52. *
  53. * @param instance - SubGhzProtocolKeeloq instance
  54. * @param data - LevelDuration level_duration
  55. */
  56. void subghz_protocol_keeloq_parse(SubGhzProtocolKeeloq* instance, bool level, uint32_t duration);
  57. /** Outputting information from the parser
  58. *
  59. * @param instance - SubGhzProtocolKeeloq* instance
  60. * @param output - output string
  61. */
  62. void subghz_protocol_keeloq_to_str(SubGhzProtocolKeeloq* instance, string_t output);
  63. /** Get a string to save the protocol
  64. *
  65. * @param instance - SubGhzProtocolKeeloq instance
  66. * @param output - the resulting string
  67. */
  68. void subghz_protocol_keeloq_to_save_str(SubGhzProtocolKeeloq* instance, string_t output);
  69. /** Loading protocol from file
  70. *
  71. * @param file_worker - FileWorker file_worker
  72. * @param instance - SubGhzProtocolKeeloq instance
  73. * @return bool
  74. */
  75. bool subghz_protocol_keeloq_to_load_protocol_from_file(FileWorker* file_worker, SubGhzProtocolKeeloq* instance);
  76. /** Loading protocol from bin data
  77. *
  78. * @param instance - SubGhzProtocolKeeloq instance
  79. * @param context - SubGhzProtocolCommonLoad context
  80. */
  81. void subghz_decoder_keeloq_to_load_protocol(SubGhzProtocolKeeloq* instance, void* context);