2023-11-28 15:11:30 -05:00
/*
Base class for all weather protocols .
This and most of the weather protocols uses code from Flipper XTreme codebase ( https : //github.com/Flipper-XFW/Xtreme-Firmware/tree/dev/lib/subghz ). Thanks for their work!
For comments in a protocol implementation check w - nexus - th . hpp
*/
# ifndef __FPROTO_BASE_H__
# define __FPROTO_BASE_H__
Subghz decoder (#1646)
* Initial commit - wip
* Half part of the transition of baseband processor.
* More SGD
* WIP, Weather refactor, UI improv
* Rename
* Added 4msps, and fixes
* Fixes
* princeton working
* Renamed proc_weather, bc now multifunctional
* Proto: bett
* FPS_CAME = 4,
FPS_PRASTEL = 5,
FPS_AIRFORCE = 6,
* Came Atomo, fixes
* Separate weather and sgd, bc of baseband size limit
* Fix display
* Save space
* More protos
* Dooya proto added
* More protos
* add protos
* More protos
* Move weather to ext app
* nw
* Revert "Move weather to ext app"
This reverts commit 8a84aac2f59274b72de7c7803deb137a21838076.
* revert
* Fix merge
* Better naming
* More protos
* More protos
* Add protos
* Fix warning
* Add NeroRadio
* more protos
* more protos
* More protos
* Shrink a bit
* fixes
* More protos
* Nicer code
* Fix naming
* Fix format
* Remove unused
* Fix some protos, that needs a LOOOONG part with the same lo/high
* Modify key calculation
2023-12-16 17:37:51 -05:00
# include "fprotogeneral.hpp"
2023-11-28 15:11:30 -05:00
# include "weathertypes.hpp"
# include <string>
// default walues to indicate 'no value'
class FProtoWeatherBase ;
typedef void ( * SubGhzProtocolDecoderBaseRxCallback ) ( FProtoWeatherBase * instance ) ;
class FProtoWeatherBase {
public :
FProtoWeatherBase ( ) { }
virtual ~ FProtoWeatherBase ( ) { }
virtual void feed ( bool level , uint32_t duration ) = 0 ; // need to be implemented on each protocol handler.
void setCallback ( SubGhzProtocolDecoderBaseRxCallback cb ) { callback = cb ; } // this is called when there is a hit.
uint8_t getSensorType ( ) { return sensorType ; }
2024-09-06 14:23:11 -04:00
uint64_t getData ( ) { return decode_data ; }
2023-11-28 15:11:30 -05:00
protected :
// Helper functions to keep it as compatible with flipper as we can, so adding new protos will be easy.
void subghz_protocol_blocks_add_bit ( uint8_t bit ) {
decode_data = decode_data < < 1 | bit ;
decode_count_bit + + ;
}
2023-11-30 06:36:59 -05:00
2024-07-24 05:53:09 -04:00
// needs to be in this chaotic order, to save flash!
// General weather data holder
2023-11-28 15:11:30 -05:00
uint8_t sensorType = FPW_Invalid ;
2024-07-24 05:53:09 -04:00
// inner logic stuff
uint8_t parser_step = 0 ;
Subghz decoder (#1646)
* Initial commit - wip
* Half part of the transition of baseband processor.
* More SGD
* WIP, Weather refactor, UI improv
* Rename
* Added 4msps, and fixes
* Fixes
* princeton working
* Renamed proc_weather, bc now multifunctional
* Proto: bett
* FPS_CAME = 4,
FPS_PRASTEL = 5,
FPS_AIRFORCE = 6,
* Came Atomo, fixes
* Separate weather and sgd, bc of baseband size limit
* Fix display
* Save space
* More protos
* Dooya proto added
* More protos
* add protos
* More protos
* Move weather to ext app
* nw
* Revert "Move weather to ext app"
This reverts commit 8a84aac2f59274b72de7c7803deb137a21838076.
* revert
* Fix merge
* Better naming
* More protos
* More protos
* Add protos
* Fix warning
* Add NeroRadio
* more protos
* more protos
* More protos
* Shrink a bit
* fixes
* More protos
* Nicer code
* Fix naming
* Fix format
* Remove unused
* Fix some protos, that needs a LOOOONG part with the same lo/high
* Modify key calculation
2023-12-16 17:37:51 -05:00
// inner logic stuff, also for flipper compatibility.
2023-11-28 15:11:30 -05:00
uint16_t header_count = 0 ;
2024-07-24 05:53:09 -04:00
// inner logic stuff,
2023-11-28 15:11:30 -05:00
uint32_t te_last = 0 ;
uint32_t decode_count_bit = 0 ;
2024-07-24 05:53:09 -04:00
uint64_t decode_data = 0 ;
2024-09-06 14:23:11 -04:00
2024-07-24 05:53:09 -04:00
SubGhzProtocolDecoderBaseRxCallback callback = NULL ;
2023-11-28 15:11:30 -05:00
} ;
# endif