forked from kfoysalhaque/BeamSense
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFeedback_split_STAs.sh
More file actions
executable file
·128 lines (104 loc) · 4.45 KB
/
Feedback_split_STAs.sh
File metadata and controls
executable file
·128 lines (104 loc) · 4.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/bin/bash
<<com
This script extracts the MU-MIMO feedbacks of the available stations
from the raw pcap captures.
Copyright (C) 2022 Khandaker Foysal Haque
email: haque.k@northeastern.edu
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
com
stations=("9C" "25" "89")
rooms=("Classroom" "Kitchen" "Livingroom")
beamf_labels=("A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U")
for FOLDERNAME in Data
do
cd "$FOLDERNAME"
cd "$1"
# Ensure the 'Processed' directory and its subdirectories exist
if [ ! -d 'Processed' ]; then
mkdir 'Processed'
fi
for ROOM in "${rooms[@]}"; do
if [ ! -d "Processed/$ROOM" ]; then
mkdir "Processed/$ROOM"
fi
# Ensure directories for stations exist within each room
for STATION in "${stations[@]}"; do
base_path="Processed/$ROOM/$STATION"
if [ ! -d "$base_path" ]; then
mkdir -p "$base_path"
fi
# Create subdirectories inside each station's folder
subdirs=("beamf_angles" "exclusive_beamf_report" "time_vector" "vtilde_matrices" "FeedBack_Pcap")
for DIR in "${subdirs[@]}"; do
if [ ! -d "$base_path/$DIR" ]; then
mkdir -p "$base_path/$DIR"
fi
done
# Create beamf_angles subdirectories
for LABEL in "${beamf_labels[@]}"; do
if [ ! -d "$base_path/beamf_angles/$LABEL" ]; then
mkdir -p "$base_path/beamf_angles/$LABEL"
fi
if [ ! -d "$base_path/beamf_angles/${LABEL}_batch" ]; then
mkdir -p "$base_path/beamf_angles/${LABEL}_batch"
fi
done
done
done
# Process pcap files
cd Raw
for ROOM in "${rooms[@]}"; do
# Ensure the room directory exists in Raw
if [ ! -d "$ROOM" ]; then
echo "Room $ROOM does not exist in Raw, skipping."
continue
fi
echo "moving into $ROOM dir"
for SUBJECT in "$ROOM"/*; do
# Check if it's a valid directory for a subject
if [ -d "$SUBJECT" ]; then
for FILENAME in "$SUBJECT"/*; do
echo "$FILENAME"
if [ -f "$FILENAME" ]; then
echo "Processing file: $FILENAME"
# Extract base filename for output
FILENAMEOUTBASE=$(basename "$FILENAME" .pcapng)
echo "$FILENAMEOUTBASE"
for STATION in "${stations[@]}"; do
case $STATION in
"89")
ADDR="CC:40:D0:57:EA:89"
;;
"9C")
ADDR="B0:B9:8A:63:55:9C"
;;
"25")
ADDR="38:94:ED:12:3C:25"
;;
esac
# Define output file path
FILENAMEOUT="../Processed/$ROOM/$STATION/FeedBack_Pcap/${FILENAMEOUTBASE}_${STATION}.pcapng"
# Create the output directory if it doesn't exist
mkdir -p "$(dirname "$FILENAMEOUT")"
# Run tshark command if output file doesn't exist
if [ ! -f "$FILENAMEOUT" ]; then
echo "Generating: $FILENAMEOUT"
tshark -r "$FILENAME" -Y "wlan.vht.mimo_control.feedbacktype==MU && wlan.addr==$ADDR" -w "$FILENAMEOUT"
fi
done
fi
done
fi
done
done
cd ../..
done