2023-12-08 13:12:48 +01:00
|
|
|
/*
|
|
|
|
This is the protocol list handler. It holds an instance of all known protocols.
|
|
|
|
So include here the .hpp, and add a new element to the protos vector in the constructor. That's all you need to do here if you wanna add a new proto.
|
|
|
|
@htotoo
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <memory>
|
|
|
|
#include "portapack_shared_memory.hpp"
|
|
|
|
|
|
|
|
#include "fprotolistgeneral.hpp"
|
|
|
|
#include "subghzdbase.hpp"
|
2023-12-09 22:10:04 +01:00
|
|
|
// #include "s-ansonic.hpp" //skip, since fm
|
2023-12-08 14:55:27 +01:00
|
|
|
#include "s-princeton.hpp"
|
2023-12-09 19:34:00 +01:00
|
|
|
#include "s-bett.hpp"
|
2023-12-09 20:38:02 +01:00
|
|
|
#include "s-came.hpp"
|
2023-12-09 21:00:34 +01:00
|
|
|
#include "s-came_atomo.hpp"
|
2023-12-09 22:01:15 +01:00
|
|
|
#include "s-came_twee.hpp"
|
2023-12-08 13:12:48 +01:00
|
|
|
|
|
|
|
#ifndef __FPROTO_PROTOLISTSGZ_H__
|
|
|
|
#define __FPROTO_PROTOLISTSGZ_H__
|
|
|
|
|
|
|
|
class SubGhzDProtos : public FProtoListGeneral {
|
|
|
|
public:
|
|
|
|
SubGhzDProtos() {
|
|
|
|
// add protos
|
2023-12-09 22:10:04 +01:00
|
|
|
// protos.push_back(std::make_unique<FProtoSubGhzDAnsonic>()); // 1 //skip since fm
|
2023-12-08 14:55:27 +01:00
|
|
|
protos.push_back(std::make_unique<FProtoSubGhzDPrinceton>()); // 2
|
2023-12-09 19:34:00 +01:00
|
|
|
protos.push_back(std::make_unique<FProtoSubGhzDBett>()); // 3
|
2023-12-09 20:38:02 +01:00
|
|
|
protos.push_back(std::make_unique<FProtoSubGhzDCame>()); // 4, 5, 6
|
2023-12-09 21:00:34 +01:00
|
|
|
protos.push_back(std::make_unique<FProtoSubGhzDCameAtomo>()); // 7
|
2023-12-09 22:01:15 +01:00
|
|
|
protos.push_back(std::make_unique<FProtoSubGhzDCameTwee>()); // 8
|
2023-12-08 13:12:48 +01:00
|
|
|
|
|
|
|
// set callback for them
|
|
|
|
for (const auto& obj : protos) {
|
|
|
|
obj->setCallback(callbackTarget);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void callbackTarget(FProtoSubGhzDBase* instance) {
|
2023-12-09 19:34:00 +01:00
|
|
|
SubGhzDDataMessage packet_message{instance->getSensorType(), instance->getSensorSerial(), instance->getBits(), instance->getData(), instance->getData2(), instance->getBtn()};
|
2023-12-09 21:00:34 +01:00
|
|
|
// todo add cnt, cnt2
|
2023-12-08 13:12:48 +01:00
|
|
|
shared_memory.application_queue.push(packet_message);
|
|
|
|
}
|
|
|
|
|
|
|
|
void feed(bool level, uint32_t duration) {
|
|
|
|
for (const auto& obj : protos) {
|
2023-12-08 13:32:28 +01:00
|
|
|
if (obj->modulation == modulation_) obj->feed(level, duration);
|
2023-12-08 13:12:48 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
std::vector<std::unique_ptr<FProtoSubGhzDBase>> protos{};
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|