NetBurner 3.5.8
PDF Version
Toggle main menu visibility
nbWifiApi.h
1
/*NB_REVISION*/
2
3
/*NB_COPYRIGHT*/
4
8
9
#ifndef __NBWIFIAPI_H
10
#define __NBWIFIAPI_H
11
12
#include <buffers.h>
13
#include <nettypes.h>
14
#include <wifi/nbWifiConstants.h>
15
16
// Scanning and connecting uses the SAME exact AP deifition.
17
struct
APDefinition
18
{
19
char
SSID[SSID_MAX_LEN + 1];
20
char
PassPhrase[PASS_MAX_LEN + 1];
// Should be "" empty string for open networks.
21
MACADR BSSID;
// All Zeros ignored on connect.
22
bool
bAdhoc;
// True if its an or to create an Adhoc network.
23
char
Security[SEC_HUMAN_MAX_LEN + 1];
// On scan empty string for open on connect empty string for don't care OPEN for forcing open.
24
char
Cipher[CIPHER_HUMAN_MAX_LEN + 1];
// On Scan indicates the Cipher used with the security, ignored on connect.
25
NB::Constants::RadioBand band;
26
uint16_t Channel;
27
int
rssi;
// Ignored on connect calls....
28
};
29
30
#define WIFI_Result_Success (1)
31
#define WIFI_Result_BadPass (-1)
32
#define WIFI_Result_NoAPFound (-2)
33
#define WIFI_Result_BSSID_NotFound (-3)
34
#define WIFI_Result_TimedOut (-4)
35
36
typedef
void (*ReceiveScanResultFunc)(
const
APDefinition &ap);
37
40
class
WifiInterface
41
{
42
public
:
43
// Connection functions
44
// If all three SSID, BSSID and PassPhrase are empty, connects to strongest open network
45
int
Connect();
// Use the SSID and PassPhrase stored in the config record.
46
int
Connect(
const
char
*SSID,
const
char
*Pass,
bool
bAdHoc =
false
);
47
int
Connect(APDefinition &ap);
48
int
Connect(APDefinition *pAps);
// Connect to the AP deifitions on the list in order of preference.
49
50
void
Disconnect();
51
52
// Scan Functions:
53
54
// Syncronous Scan...
55
APDefinition *Scan(
const
char
*ssid =
nullptr
);
// nullptr SSID means scan for all
56
APDefinition *ScanWithSettings(
const
char
*ssid =
nullptr
,
57
uint8_t channelCount = 0,
58
const
uint16_t *channelList =
nullptr
,
59
uint8_t band = 0,
60
uint8_t infrastructureType = 0);
61
// Returns a pointer to a list of APDefinitions
62
// SSID, nullptr on the last one in the list.
63
// This function is not reentrant and the result is only valid until the Next call to Scan
64
65
// Asyncronous Scan....
66
67
// If the underlying WIFI driver has an internally timed scan then the
68
// call back funciton will receive an AP with SSID =nullptr as the last indicator...
69
// Otherwise you shoudl probably call StopAsyncScan
70
int
StartAsyncScan(ReceiveScanResultFunc *pCallBackFunc,
const
char
*ssid =
nullptr
);
71
int
StartAsyncScanWithSettings(ReceiveScanResultFunc *pCallBackFunc,
72
const
char
*ssid =
nullptr
,
73
uint8_t channelCount = 0,
74
const
uint16_t *channelList =
nullptr
,
75
uint8_t band = 0,
76
uint8_t infrastructureType = 0);
77
// In some implmentaions this may be an empty function....
78
int
StopAsyncScan();
79
80
// Status functions:
81
int
GetCurSSID(
char
*buf,
int
maxlen);
82
MACADR
GetCurBSSID();
83
int
GetCurrentAP(APDefinition &ap);
84
bool
Connected();
85
int
GetSignalStrength();
86
};
87
88
#endif
/* ----- #ifndef __NBWIFIAPI_H ----- */
MACADR
Used to store and manipulate MAC addresses.
Definition
nettypes.h:69
WifiInterface
WiFi Interface clas.
Definition
nbWifiApi.h:41
libraries
include
wifi
nbwifi
nbWifiApi.h
Generated by
1.18.0