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:
89 IRTools();
90
96 void init(fs::SDFS &sdInstance);
97
105 void sendRawIR(uint16_t *data, uint16_t length, uint16_t frequency);
106
111 void findDeviceTypes();
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
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.
Definition IRTools.cpp:52
void findDeviceTypes()
Find the Avaliable Device Types.
Definition IRTools.cpp:27
void captureIR(int duration)
Function to capture IR signals.
Definition IRTools.cpp:274
void sendIRCommand(IRCommand irCommand)
Function to send an IR command.
Definition IRTools.cpp:222
void findDeviceCommands(int deviceIndex)
Get the Avaliable Device Commands object.
Definition IRTools.cpp:124
std::vector< IRCommand > getDeviceCommands()
Get the Device Commands object.
Definition IRTools.cpp:214
std::vector< String > getDeviceBrands()
Get the Device Brands object.
Definition IRTools.cpp:86
std::vector< String > getDevices()
Get the Devices object.
Definition IRTools.cpp:117
IRTools()
Construct a new IRTools object.
Definition IRTools.cpp:15
void findDevices(int deviceBrandIndex)
Find the Avaliable Devices.
Definition IRTools.cpp:90
void findDeviceBrands(int deviceTypeIndex)
Find the Avaliable Device Brands.
Definition IRTools.cpp:59
void jamIR(int duration)
Function to jam IR signals.
Definition IRTools.cpp:264
void init(fs::SDFS &sdInstance)
Construct a new IRTools object.
Definition IRTools.cpp:19
void sendRawIR(uint16_t *data, uint16_t length, uint16_t frequency)
Function to send a custom raw IR command.
Definition IRTools.cpp:23
Struct to store IR command information.
Definition IRTools.h:52
Struct to store IR device information.
Definition IRTools.h:41