PicoScenes API Docs
 
Loading...
Searching...
No Matches
MAC80211InjectionOnlyFrontEnd.hxx
Go to the documentation of this file.
1//
2// Created by Zhiping Jiang on 12/24/19.
3//
4
5#ifndef PICOSCENES_PLATFORM_MAC80211INJECTIONONLYFRONTEND_HXX
6#define PICOSCENES_PLATFORM_MAC80211INJECTIONONLYFRONTEND_HXX
7
9#include "MAC80211Utils.hxx"
10#include "FrontEndFactory.hxx"
11
23 friend FrontEndFactory;
24public:
30 static bool isMAC80211CompatibleFrontEnd(const std::string &referredInterfaceName);
31
36 int startTx() override;
37
42 int stopTx() override;
43
48 int startRx() override;
49
54 int stopRx() override;
55
61 int transmit(const ModularPicoScenesTxFrame &frame) override;
62
69 int transmitFramesInBatch(const std::vector<const ModularPicoScenesTxFrame *> &frames, uint32_t repeat) override;
70
77 int transmitFramesInBatch(const std::vector<ModularPicoScenesTxFrame> &frames, uint32_t repeat) override;
78
83
88 [[nodiscard]] const std::string &getDevId() const;
89
94 [[nodiscard]] const std::string &getMonId() const;
95
100 [[nodiscard]] uint16_t getPhyIdNumber() const;
101
106 [[nodiscard]] const std::string &getPhyPath() const;
107
112 [[nodiscard]] const std::array<uint8_t, 6> &getMacAddressMon() const;
113
118 [[nodiscard]] const std::array<uint8_t, 6> &getMacAddressDev() const;
119
124 std::tuple<double, double, double> getChannelAndBandwidth() override;
125
133 int setChannelAndBandwidth(double control, double bw, double center) override;
134
142 int setChannelAndBandwidth(std::optional<double> control, std::optional<double> bw, std::optional<double> center) override;
143
148 double getCarrierFrequency() override;
149
154 void setCarrierFrequency(double carrierFrequency) override;
155
160 double getSamplingRate() override;
161
166 void setSamplingRate(double samplingRate) override;
167
172 double getControlChannelFrequency() override;
173
178 void setControlChannelFrequency(double controlFrequency) override;
179
184 double getRxChannelBandwidth() override;
185
190 void setRxChannelBandwidth(double rxcbw) override;
191
196 double getTxpower() override;
197
202 void setTxpower(double txpower) override;
203
208 double getRxGain() override;
209
214 void setRxGain(double rxGain) override;
215
221 void setRxGain(double rxGain, uint8_t channel) override;
222
227 uint8_t getTxChainMask() override;
228
233 void setTxChainMask(uint8_t txChainMask) override;
234
239 uint8_t getRxChainMask() override;
240
245 void setRxChainMask(uint8_t rxChainMask) override;
246
251 std::vector<size_t> getTxChannels() override;
252
257 void setTxChannels(const std::vector<size_t> &txChannels) override;
258
263 std::vector<size_t> getRxChannels() override;
264
269 void setRxChannels(const std::vector<size_t> &rxChannels) override;
270
275 uint16_t getChannelFlags() override;
276
281 ExtraInfo buildExtraInfo() override;
282
287 [[nodiscard]] const std::vector<double> &getSystemSupportedFrequencies() const;
288
294 [[nodiscard]] bool isMAC80211SupportedCarrierFrequency(double frequency) const;
295
299 void printStatus() override;
300
301protected:
306 explicit MAC80211InjectionOnlyFrontEnd(const std::string &referredName);
307
308 std::string devId;
309 std::string monId;
310 uint16_t phyIdNumber = 0;
311 std::string phyPath;
312 std::shared_ptr<uint8_t> txContext;
313
314 std::array<uint8_t, 6> macAddress_MON{0, 0, 0, 0, 0, 0};
315 std::array<uint8_t, 6> macAddress_DEV{0, 0, 0, 0, 0, 0};
316
317 std::vector<double> systemSupportedFrequencies;
318};
319
320
321#endif //PICOSCENES_PLATFORM_MAC80211INJECTIONONLYFRONTEND_HXX
The shared abstract frontend interface for both SDR and NIC.
std::string referredInterfaceName
the user specified frontend name
Factory class for creating and managing front-end instances.
Frontend class for MAC80211-based devices supporting frame injection.
double getRxChannelBandwidth() override
Get receive channel bandwidth.
void setCarrierFrequency(double carrierFrequency) override
Set carrier frequency.
int transmitFramesInBatch(const std::vector< const ModularPicoScenesTxFrame * > &frames, uint32_t repeat) override
Transmit multiple frames in batch mode.
double getControlChannelFrequency() override
Get control channel frequency.
const std::vector< double > & getSystemSupportedFrequencies() const
Get system supported frequencies.
int transmit(const ModularPicoScenesTxFrame &frame) override
Transmit a single frame.
std::array< uint8_t, 6 > macAddress_MON
Monitor interface MAC address.
std::tuple< double, double, double > getChannelAndBandwidth() override
Get current channel and bandwidth configuration.
int startTx() override
Start transmission service.
std::vector< double > systemSupportedFrequencies
List of supported frequencies.
void setRxChannels(const std::vector< size_t > &rxChannels) override
Set active receive channels.
void printStatus() override
Print current frontend status.
~MAC80211InjectionOnlyFrontEnd() override
Destructor.
void setRxGain(double rxGain, uint8_t channel) override
Set receive gain for specific channel.
std::string devId
Device interface identifier.
static bool isMAC80211CompatibleFrontEnd(const std::string &referredInterfaceName)
Check if a given interface is compatible with MAC80211.
const std::array< uint8_t, 6 > & getMacAddressDev() const
Get device interface MAC address.
int stopRx() override
Stop reception service.
int setChannelAndBandwidth(std::optional< double > control, std::optional< double > bw, std::optional< double > center) override
Set channel and bandwidth with optional parameters.
double getRxGain() override
Get receive gain.
uint8_t getTxChainMask() override
Get transmit chain mask.
void setRxChannelBandwidth(double rxcbw) override
Set receive channel bandwidth.
std::vector< size_t > getTxChannels() override
Get active transmit channels.
const std::string & getMonId() const
Get monitor interface identifier.
double getTxpower() override
Get transmit power.
double getCarrierFrequency() override
Get carrier frequency.
void setSamplingRate(double samplingRate) override
Set sampling rate.
std::shared_ptr< uint8_t > txContext
Transmission context.
bool isMAC80211SupportedCarrierFrequency(double frequency) const
Check if frequency is supported by MAC80211.
int setChannelAndBandwidth(double control, double bw, double center) override
Set channel and bandwidth configuration.
void setTxpower(double txpower) override
Set transmit power.
std::string phyPath
Path to physical interface.
MAC80211InjectionOnlyFrontEnd(const std::string &referredName)
Protected constructor.
void setRxChainMask(uint8_t rxChainMask) override
Set receive chain mask.
int stopTx() override
Stop transmission service.
std::array< uint8_t, 6 > macAddress_DEV
Device interface MAC address.
std::vector< size_t > getRxChannels() override
Get active receive channels.
uint8_t getRxChainMask() override
Get receive chain mask.
void setControlChannelFrequency(double controlFrequency) override
Set control channel frequency.
uint16_t getChannelFlags() override
Get channel flags.
int startRx() override
Start reception service.
void setRxGain(double rxGain) override
Set receive gain.
const std::string & getPhyPath() const
Get physical interface path.
int transmitFramesInBatch(const std::vector< ModularPicoScenesTxFrame > &frames, uint32_t repeat) override
Transmit multiple frames in batch mode (vector version)
void setTxChainMask(uint8_t txChainMask) override
Set transmit chain mask.
const std::array< uint8_t, 6 > & getMacAddressMon() const
Get monitor interface MAC address.
const std::string & getDevId() const
Get device interface identifier.
uint16_t getPhyIdNumber() const
Get physical interface number.
double getSamplingRate() override
Get sampling rate.
std::string monId
Monitor interface identifier.
uint16_t phyIdNumber
Physical interface number.
void setTxChannels(const std::vector< size_t > &txChannels) override
Set active transmit channels.
ExtraInfo buildExtraInfo() override
Build extra information about the frontend.