skeletonKey
BEng Dissertation; Pen-testing device
SubGHzTools.h
Go to the documentation of this file.
1// SubGHzTools.h
2#ifndef SUBGHTOOLS_H
3#define SUBGHTOOLS_H
4
16#include <Arduino.h>
17#include <ELECHOUSE_CC1101_SRC_DRV.h>
18
19#include "SPI.h"
20
21#define RECORDINGBUFFERSIZE 4096
22#define CCBUFFERSIZE 64
23
24typedef enum {
25 SubGHz_IDLE,
26 CAPTURE_RAW,
27 TRANSMIT_RAW,
28 JAMMER
29} SubGHzTools_flag;
30
32 private:
33 ELECHOUSE_CC1101 ELECHOUSE_cc1101;
34 byte CC1101_A_sck = 39;
35 byte CC1101_A_miso = 41;
36 byte CC1101_A_mosi = 40;
37 byte CC1101_A_ss = 8;
38 int CC1101_A_gdo0 = 9;
39 int CC1101_A_RF_Switch = 10;
40 byte CC1101_B_sck = 17;
41 byte CC1101_B_miso = 15;
42 byte CC1101_B_mosi = 16;
43 byte CC1101_B_ss = 3;
44 int CC1101_B_gdo0 = 11;
45 int CC1101_B_RF_Switch = 12;
46
47 int CC1101_gdo0 = 11;
48 int CC1101_RF_Switch = 12;
49
50 bool CC1101_A_initialised = false;
51
52 // buffer for sending CC1101
53 // byte CC1101_A_sendingbuffer[CCBUFFERSIZE] = {0};
54 byte CC1101_sendingbuffer[CCBUFFERSIZE] = {0};
55
56 // buffer for receiving CC1101
57 // byte CC1101_A_receivingbuffer[CCBUFFERSIZE] = {0};
58 byte CC1101_receivingbuffer[CCBUFFERSIZE] = {0};
59
60 // buffer for recording and replaying of many frames
61 // byte CC1101_A_bigrecordingbuffer[RECORDINGBUFFERSIZE] = {0};
62 byte CC1101_bigrecordingbuffer[RECORDINGBUFFERSIZE] = {0};
63
64 int jammingMode = 0;
65 float defaultFrequency = 433.92;
66 float frequency = 433.92;
67 int selectedModule = 1;
68 int samplingInterval = 1;
69 int setting, setting2;
70 SubGHzTools_flag currentMode = SubGHz_IDLE;
71
76 void
78
83 void jammer();
84
85 public:
91
96 void init();
97
102 void startJamming();
103
108 void stopJamming();
109
114 void runAction();
115
121 void setFrequency(float freq);
122
128 void captureRaw(int sampleInterval);
129
135 void transmitRaw(int sampleInterval);
136
142 void setModule(int module);
143
149 int getSelectedModule();
150
157 bool isInitialised();
158};
159
160#endif // SUBGHTOOLS_H
Definition SubGHzTools.h:31
void transmitRaw(int sampleInterval)
Transmit raw data from the CC1101 module.
Definition SubGHzTools.cpp:203
SubGHzTools()
Construct a new SubGHz Tools object.
Definition SubGHzTools.cpp:10
void configureModule()
Function to configure the CC1101 module.
Definition SubGHzTools.cpp:15
bool isInitialised()
Check if the CC1101 module is initialised.
Definition SubGHzTools.cpp:262
void captureRaw(int sampleInterval)
Capture raw data from the CC1101 module.
Definition SubGHzTools.cpp:161
void jammer()
Jamming function for the CC1101 module.
Definition SubGHzTools.cpp:106
void startJamming()
Enable jamming with the CC1101 module.
Definition SubGHzTools.cpp:116
void setModule(int module)
Set the module to use (A or B)
Definition SubGHzTools.cpp:232
void init()
Initialisation of the SubGHzTools object.
Definition SubGHzTools.cpp:46
int getSelectedModule()
Get the Selected Module object.
Definition SubGHzTools.cpp:257
void stopJamming()
Disable jamming with the CC1101 module.
Definition SubGHzTools.cpp:128
void setFrequency(float freq)
Set the frequency for the CC1101 module.
Definition SubGHzTools.cpp:146
void runAction()
Run the action based on the current mode (jamming, capturing, or transmitting)
Definition SubGHzTools.cpp:134