skeletonKey
BEng Dissertation; Pen-testing device
IRTools.h
Go to the documentation of this file.
1// IRTools.h
2#ifndef IRTOOLS_H
3#define IRTOOLS_H
4
16#include <Arduino.h>
17#include <FS.h>
18#include <IRrecv.h>
19#include <IRremoteESP8266.h>
20#include <IRsend.h>
21#include <IRutils.h>
22
23#include <string>
24#include <vector>
25
26#include "SD.h"
27
32typedef enum {
33 raw,
34 parsed
36
41typedef struct {
42 String deviceType;
43 String deviceBrand;
44 String deviceName;
45 String IRFile;
47
52typedef struct {
53 IRDeviceInfo deviceInfo;
54 String commandName;
55 IRCommandType commandType;
56 String commandProtocol;
57 uint32_t parsedCommandAddress;
58 uint32_t parsedCommandData;
59 uint32_t rawCommandFrequency;
60 float rawCommandDutyCycle;
61 uint16_t rawCommandLength;
62 std::vector<uint16_t> rawCommandData;
63} IRCommand;
64
65class IRTools {
66 private:
67 uint16_t kIrLed = 38;
68 uint16_t kRecvPin = 37;
69 IRsend irsend;
70 IRrecv irrecv;
71 fs::SDFS *_sd;
72 std::vector<String> deviceTypes;
73 std::vector<String> deviceBrands;
74 std::vector<String> devices;
75 std::vector<IRCommand> deviceCommands;
76 String deviceType;
77 String deviceBrand;
78 String devicePath;
79 String device;
80 decode_results results;
81
82 uint16_t jamSignal[2] = {65535, 0};
83
84 public:
90
96 void init(fs::SDFS &sdInstance);
97
105 void sendRawIR(uint16_t *data, uint16_t length, uint16_t frequency);
106
112
118 std::vector<String> getDeviceTypes();
119
125 void findDeviceBrands(int deviceTypeIndex);
126
132 std::vector<String> getDeviceBrands();
133
139 void findDevices(int deviceBrandIndex);
140
146 std::vector<String> getDevices();
147
153 void findDeviceCommands(int deviceIndex);
154
160 std::vector<IRCommand> getDeviceCommands();
161
167 void sendIRCommand(IRCommand irCommand);
168
174 void jamIR(int duration);
175
181 void captureIR(int duration);
182};
183
184#endif // IRTOOLS_H
IRCommandType
Enum to store the type of IR command.
Definition IRTools.h:32
Definition IRTools.h:65
std::vector< String > getDeviceTypes()
Get the Device Types object.
void findDeviceTypes()
Find the Avaliable Device Types.
void captureIR(int duration)
Function to capture IR signals.
void sendIRCommand(IRCommand irCommand)
Function to send an IR command.
void findDeviceCommands(int deviceIndex)
Get the Avaliable Device Commands object.
std::vector< IRCommand > getDeviceCommands()
Get the Device Commands object.
std::vector< String > getDeviceBrands()
Get the Device Brands object.
std::vector< String > getDevices()
Get the Devices object.
IRTools()
Construct a new IRTools object.
void findDevices(int deviceBrandIndex)
Find the Avaliable Devices.
void findDeviceBrands(int deviceTypeIndex)
Find the Avaliable Device Brands.
void jamIR(int duration)
Function to jam IR signals.
void init(fs::SDFS &sdInstance)
Construct a new IRTools object.
void sendRawIR(uint16_t *data, uint16_t length, uint16_t frequency)
Function to send a custom raw IR command.
Struct to store IR command information.
Definition IRTools.h:52
Struct to store IR device information.
Definition IRTools.h:41