base.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #pragma once
  2. #include "../types.h"
  3. typedef struct SubGhzProtocolDecoderBase SubGhzProtocolDecoderBase;
  4. typedef void (
  5. *SubGhzProtocolDecoderBaseRxCallback)(SubGhzProtocolDecoderBase* instance, void* context);
  6. typedef void (
  7. *SubGhzProtocolDecoderBaseSerialize)(SubGhzProtocolDecoderBase* decoder_base, string_t output);
  8. struct SubGhzProtocolDecoderBase {
  9. // Decoder general section
  10. const SubGhzProtocol* protocol;
  11. // Callback section
  12. SubGhzProtocolDecoderBaseRxCallback callback;
  13. void* context;
  14. };
  15. void subghz_protocol_decoder_base_set_decoder_callback(
  16. SubGhzProtocolDecoderBase* decoder_base,
  17. SubGhzProtocolDecoderBaseRxCallback callback,
  18. void* context);
  19. bool subghz_protocol_decoder_base_get_string(
  20. SubGhzProtocolDecoderBase* decoder_base,
  21. string_t output);
  22. bool subghz_protocol_decoder_base_serialize(
  23. SubGhzProtocolDecoderBase* decoder_base,
  24. FlipperFormat* flipper_format,
  25. uint32_t frequency,
  26. FuriHalSubGhzPreset preset);
  27. bool subghz_protocol_decoder_base_deserialize(
  28. SubGhzProtocolDecoderBase* decoder_base,
  29. FlipperFormat* flipper_format);
  30. uint8_t subghz_protocol_decoder_base_get_hash_data(SubGhzProtocolDecoderBase* decoder_base);
  31. // Encoder Base
  32. typedef struct SubGhzProtocolEncoderBase SubGhzProtocolEncoderBase;
  33. struct SubGhzProtocolEncoderBase {
  34. // Decoder general section
  35. const SubGhzProtocol* protocol;
  36. // Callback section
  37. };