Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef INC_TECH_CHANNEL_H_
- #define INC_TECH_CHANNEL_H_
- #ifdef __cplusplus
- extern "C" {
- #endif
- #include "global.h"
- #include <stdint.h>
- #include <stddef.h>
- class Tech_Channel {
- public:
- Tech_Channel(const Tech_Channel& rhs) = delete;
- Tech_Channel(Tech_Channel&& rhs) = delete;
- Tech_Channel& operator =(const Tech_Channel& rhs) = delete;
- Tech_Channel& operator =(Tech_Channel&& rhs) = delete;
- virtual ~Tech_Channel() = default;
- virtual void push_to_calc(int64_t data1_, int64_t data2_, int64_t data3_) = 0;
- virtual const int get_triggered() const = 0;
- virtual const int get_trigglvl() const = 0;
- virtual const int ret_events_count() const {
- return events_count;
- }
- virtual void reset_events_count() {
- events_count = 0;
- }
- bool has_detected();
- void switch_to_running_mode();
- void switch_to_background_mode();
- void stop_triggering();
- static constexpr int tech_ch_length = 1700;
- static constexpr int silence_sec = 15;
- protected:
- Tech_Channel();
- bool is_background_mode_on = true;
- bool is_triggered = false;
- int64_t tech_buf[tech_ch_length];
- int events_count = 0;
- };
- inline
- Tech_Channel::Tech_Channel() : tech_buf{} // init tech_buf with 0
- {}
- inline
- bool Tech_Channel::has_detected() {
- return is_triggered;
- }
- inline
- void Tech_Channel::switch_to_background_mode() {
- is_background_mode_on = true;
- is_triggered = false;
- }
- inline
- void Tech_Channel::stop_triggering() {
- is_triggered = false;
- }
- inline
- void Tech_Channel::switch_to_running_mode() {
- is_background_mode_on = false;
- is_triggered = false;
- }
- #ifdef __cplusplus
- }
- #endif
- #endif /* INC_TECH_CHANNEL_H_ */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement