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
31class SubGHzTools {
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
103
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
150
158};
159
160#endif // SUBGHTOOLS_H
Definition SubGHzTools.h:31
void transmitRaw(int sampleInterval)
Transmit raw data from the CC1101 module.
SubGHzTools()
Construct a new SubGHz Tools object.
void configureModule()
Function to configure the CC1101 module.
bool isInitialised()
Check if the CC1101 module is initialised.
void captureRaw(int sampleInterval)
Capture raw data from the CC1101 module.
void jammer()
Jamming function for the CC1101 module.
void startJamming()
Enable jamming with the CC1101 module.
void setModule(int module)
Set the module to use (A or B)
void init()
Initialisation of the SubGHzTools object.
int getSelectedModule()
Get the Selected Module object.
void stopJamming()
Disable jamming with the CC1101 module.
void setFrequency(float freq)
Set the frequency for the CC1101 module.
void runAction()
Run the action based on the current mode (jamming, capturing, or transmitting)