infactory.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #pragma once
  2. #include <lib/subghz/protocols/base.h>
  3. #include <lib/subghz/blocks/const.h>
  4. #include <lib/subghz/blocks/decoder.h>
  5. #include <lib/subghz/blocks/encoder.h>
  6. #include "ws_generic.h"
  7. #include <lib/subghz/blocks/math.h>
  8. #define WS_PROTOCOL_INFACTORY_NAME "inFactory-TH"
  9. typedef struct WSProtocolDecoderInfactory WSProtocolDecoderInfactory;
  10. typedef struct WSProtocolEncoderInfactory WSProtocolEncoderInfactory;
  11. extern const SubGhzProtocolDecoder ws_protocol_infactory_decoder;
  12. extern const SubGhzProtocolEncoder ws_protocol_infactory_encoder;
  13. extern const SubGhzProtocol ws_protocol_infactory;
  14. /**
  15. * Allocate WSProtocolDecoderInfactory.
  16. * @param environment Pointer to a SubGhzEnvironment instance
  17. * @return WSProtocolDecoderInfactory* pointer to a WSProtocolDecoderInfactory instance
  18. */
  19. void* ws_protocol_decoder_infactory_alloc(SubGhzEnvironment* environment);
  20. /**
  21. * Free WSProtocolDecoderInfactory.
  22. * @param context Pointer to a WSProtocolDecoderInfactory instance
  23. */
  24. void ws_protocol_decoder_infactory_free(void* context);
  25. /**
  26. * Reset decoder WSProtocolDecoderInfactory.
  27. * @param context Pointer to a WSProtocolDecoderInfactory instance
  28. */
  29. void ws_protocol_decoder_infactory_reset(void* context);
  30. /**
  31. * Parse a raw sequence of levels and durations received from the air.
  32. * @param context Pointer to a WSProtocolDecoderInfactory instance
  33. * @param level Signal level true-high false-low
  34. * @param duration Duration of this level in, us
  35. */
  36. void ws_protocol_decoder_infactory_feed(void* context, bool level, uint32_t duration);
  37. /**
  38. * Getting the hash sum of the last randomly received parcel.
  39. * @param context Pointer to a WSProtocolDecoderInfactory instance
  40. * @return hash Hash sum
  41. */
  42. uint8_t ws_protocol_decoder_infactory_get_hash_data(void* context);
  43. /**
  44. * Serialize data WSProtocolDecoderInfactory.
  45. * @param context Pointer to a WSProtocolDecoderInfactory instance
  46. * @param flipper_format Pointer to a FlipperFormat instance
  47. * @param preset The modulation on which the signal was received, SubGhzRadioPreset
  48. * @return status
  49. */
  50. SubGhzProtocolStatus ws_protocol_decoder_infactory_serialize(
  51. void* context,
  52. FlipperFormat* flipper_format,
  53. SubGhzRadioPreset* preset);
  54. /**
  55. * Deserialize data WSProtocolDecoderInfactory.
  56. * @param context Pointer to a WSProtocolDecoderInfactory instance
  57. * @param flipper_format Pointer to a FlipperFormat instance
  58. * @return status
  59. */
  60. SubGhzProtocolStatus
  61. ws_protocol_decoder_infactory_deserialize(void* context, FlipperFormat* flipper_format);
  62. /**
  63. * Getting a textual representation of the received data.
  64. * @param context Pointer to a WSProtocolDecoderInfactory instance
  65. * @param output Resulting text
  66. */
  67. void ws_protocol_decoder_infactory_get_string(void* context, FuriString* output);