This repository has been archived on 2020-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
Files
Indoor/sensors/radio/scan/WiFiRAW.h
frank da477866c1 worked on wifi-scanner for linux
new time-grouping for vap grouper
adjusted test-cases
minor changes/fixes/improvements
2017-10-11 14:00:24 +02:00

48 lines
837 B
C++

#ifndef INDOOR_WIFIRAW_H
#define INDOOR_WIFIRAW_H
#include <iostream>
/**
* parse raw binary wifi packets as defined within the standard
*/
class WiFiRAW {
public:
enum Tags {
TAG_SSID = 0x00
};
struct TaggedParams {
std::string ssid;
};
/** parsed tagged params within wifi packets: [tag][len][len-bytes][tag][len][len-bytes]... */
static TaggedParams parseTaggedParams(const uint8_t* data, const size_t len) {
TaggedParams res;
int pos = 0;
while(pos < len) {
const int tag = data[pos+0]; // the tag-ID
const int len = data[pos+1]; // the lenght of the following data
switch(tag) {
case TAG_SSID: res.ssid = std::string( (const char*) &(data[pos+2]), len); break;
}
// position at the start of the next tag
pos += 1 + 1 + len;
}
return res;
}
};
#endif // INDOOR_WIFIRAW_H