Skip to content

Commit

Permalink
ADD frame count
Browse files Browse the repository at this point in the history
  • Loading branch information
TalusL committed Jun 12, 2024
1 parent d4f1ef1 commit 7735e97
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
10 changes: 5 additions & 5 deletions qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -258,21 +258,21 @@ ApplicationWindow {
Text {
id: wfbPktCountText
x: 5
text: "0"
font.pixelSize: 32
text: ""+NativeApi.wfbFrameCount
font.pixelSize: 12
color: "#000000"
}
Text {
x: 5
text: " / "
font.pixelSize: 32
font.pixelSize: 12
color: "#000000"
}
Text {
id: airPktCountText
x: 5
text: "0"
font.pixelSize: 32
text: ""+NativeApi.wifiFrameCount
font.pixelSize: 12
color: "#000000"
}
}
Expand Down
17 changes: 16 additions & 1 deletion src/QmlNativeAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
*/
class QmlNativeAPI : public QObject {
Q_OBJECT
Q_PROPERTY(qulonglong wifiFrameCount READ wifiFrameCount NOTIFY onWifiFrameCount )
Q_PROPERTY(qulonglong wfbFrameCount READ wfbFrameCount NOTIFY onWfbFrameCount )
public:
static QmlNativeAPI &Instance() {
static QmlNativeAPI api;
Expand Down Expand Up @@ -39,11 +41,24 @@ class QmlNativeAPI : public QObject {
void NotifyWifiStop(){
emit onWifiStop();
}

void UpdateCount() {
emit onWifiFrameCount(wifiFrameCount_);
emit onWfbFrameCount(wfbFrameCount_);
}
qulonglong wfbFrameCount() {
return wfbFrameCount_;
}
qulonglong wifiFrameCount() {
return wifiFrameCount_;
}
qulonglong wfbFrameCount_ = 0;
qulonglong wifiFrameCount_ = 0;
signals :
// onlog
void onLog(QString level, QString msg);
void onWifiStop();
void onWifiFrameCount(qulonglong count);
void onWfbFrameCount(qulonglong count);
};

#endif // CTRLCENTER_QMLNATIVEAPI_H
11 changes: 10 additions & 1 deletion src/WFBReceiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ std::vector<std::string> WFBReceiver::GetDongleList() {
}
bool WFBReceiver::Start(const std::string &vidPid, uint8_t channel,
int channelWidth,const std::string& kPath) {

QmlNativeAPI::Instance().wifiFrameCount_ = 0;
QmlNativeAPI::Instance().wfbFrameCount_ = 0;
QmlNativeAPI::Instance().UpdateCount();

keyPath = kPath;
if(usbThread){
return false;
Expand Down Expand Up @@ -131,10 +136,15 @@ bool WFBReceiver::Start(const std::string &vidPid, uint8_t channel,
return true;
}
void WFBReceiver::handle80211Frame(const Packet &packet) {

QmlNativeAPI::Instance().wifiFrameCount_ ++;
RxFrame frame(packet.Data);
if (!frame.IsValidWfbFrame()) {
return;
}
QmlNativeAPI::Instance().wfbFrameCount_ ++;
QmlNativeAPI::Instance().UpdateCount();

static int8_t rssi[4] = {1,1,1,1};
static uint8_t antenna[4] = {1,1,1,1};

Expand Down Expand Up @@ -166,7 +176,6 @@ bool WFBReceiver::Stop() {
if(rtlDevice){
rtlDevice->should_stop = true;
}

QmlNativeAPI::Instance().NotifyWifiStop();
return true;
}
Expand Down

0 comments on commit 7735e97

Please sign in to comment.