Added logic to hide AP SSID from broadcasting when WIFI_AP_STA used for SpanPoint
This does NOT effect the HomeSpan Access Point from being broadcast as usual when launched.
This commit is contained in:
parent
21a88f0ed4
commit
03ba061b9b
|
|
@ -61,7 +61,7 @@ void setup() {
|
||||||
|
|
||||||
// In the line below, replace the MAC Address with that of your MAIN HOMESPAN DEVICE
|
// In the line below, replace the MAC Address with that of your MAIN HOMESPAN DEVICE
|
||||||
|
|
||||||
mainDevice=new SpanPoint("7C:DF:A1:61:E4:A8",sizeof(float),0); // create a SpanPoint with send size=sizeof(float) and receive size=0
|
mainDevice=new SpanPoint("84:CC:A8:11:B4:84",sizeof(float),0); // create a SpanPoint with send size=sizeof(float) and receive size=0
|
||||||
|
|
||||||
homeSpan.setLogLevel(1);
|
homeSpan.setLogLevel(1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1032,13 +1032,14 @@ void Span::processSerialCommand(const char *c){
|
||||||
uint8_t channel;
|
uint8_t channel;
|
||||||
wifi_second_chan_t channel2;
|
wifi_second_chan_t channel2;
|
||||||
esp_wifi_get_channel(&channel,&channel2);
|
esp_wifi_get_channel(&channel,&channel2);
|
||||||
Serial.printf("\nSpanPoint Channel=%d:\n\n",channel);
|
Serial.printf("\nFound %d SpanPoint Links:\n\n",SpanPoint::SpanPoints.size());
|
||||||
Serial.printf("%-17s %18s %7s %7s %7s\n","Local MAC Address","Remote MAC Address","Send","Receive","Depth");
|
Serial.printf("%-17s %18s %7s %7s %7s\n","Local MAC Address","Remote MAC Address","Send","Receive","Depth");
|
||||||
Serial.printf("%.17s %.18s %.7s %.7s %.7s\n",d,d,d,d,d);
|
Serial.printf("%.17s %.18s %.7s %.7s %.7s\n",d,d,d,d,d);
|
||||||
for(auto it=SpanPoint::SpanPoints.begin();it!=SpanPoint::SpanPoints.end();it++)
|
for(auto it=SpanPoint::SpanPoints.begin();it!=SpanPoint::SpanPoints.end();it++)
|
||||||
Serial.printf("%-18s %02X:%02X:%02X:%02X:%02X:%02X %7d %7d %7d\n",(*it)->peerInfo.ifidx==WIFI_IF_AP?WiFi.softAPmacAddress().c_str():WiFi.macAddress().c_str(),
|
Serial.printf("%-18s %02X:%02X:%02X:%02X:%02X:%02X %7d %7d %7d\n",(*it)->peerInfo.ifidx==WIFI_IF_AP?WiFi.softAPmacAddress().c_str():WiFi.macAddress().c_str(),
|
||||||
(*it)->peerInfo.peer_addr[0],(*it)->peerInfo.peer_addr[1],(*it)->peerInfo.peer_addr[2],(*it)->peerInfo.peer_addr[3],(*it)->peerInfo.peer_addr[4],(*it)->peerInfo.peer_addr[5],
|
(*it)->peerInfo.peer_addr[0],(*it)->peerInfo.peer_addr[1],(*it)->peerInfo.peer_addr[2],(*it)->peerInfo.peer_addr[3],(*it)->peerInfo.peer_addr[4],(*it)->peerInfo.peer_addr[5],
|
||||||
(*it)->sendSize,(*it)->receiveSize,uxQueueSpacesAvailable((*it)->receiveQueue));
|
(*it)->sendSize,(*it)->receiveSize,uxQueueSpacesAvailable((*it)->receiveQueue));
|
||||||
|
Serial.printf("\nSpanPoint using WiFi Channel %d%s\n",channel,WiFi.status()!=WL_CONNECTED?" (subject to change once WiFi connection established)":"");
|
||||||
}
|
}
|
||||||
|
|
||||||
Serial.print("\n*** End Info ***\n\n");
|
Serial.print("\n*** End Info ***\n\n");
|
||||||
|
|
@ -2221,7 +2222,7 @@ SpanPoint::SpanPoint(const char *macAddress, int sendSize, int receiveSize, int
|
||||||
if(receiveSize>0)
|
if(receiveSize>0)
|
||||||
WiFi.mode(WIFI_AP_STA);
|
WiFi.mode(WIFI_AP_STA);
|
||||||
else if(WiFi.getMode()==WIFI_OFF)
|
else if(WiFi.getMode()==WIFI_OFF)
|
||||||
WiFi.mode(WIFI_STA);
|
WiFi.mode(WIFI_STA);
|
||||||
|
|
||||||
init(); // initialize SpanPoint
|
init(); // initialize SpanPoint
|
||||||
peerInfo.channel=0; // 0 = matches current WiFi channel
|
peerInfo.channel=0; // 0 = matches current WiFi channel
|
||||||
|
|
@ -2248,6 +2249,11 @@ void SpanPoint::init(const char *password){
|
||||||
if(WiFi.getMode()==WIFI_OFF)
|
if(WiFi.getMode()==WIFI_OFF)
|
||||||
WiFi.mode(WIFI_STA);
|
WiFi.mode(WIFI_STA);
|
||||||
|
|
||||||
|
wifi_config_t conf; // make sure AP is hidden (if WIFI_AP_STA is used), since it is just a "dummy" AP to keep WiFi alive for ESP-NOW
|
||||||
|
esp_wifi_get_config(WIFI_IF_AP,&conf);
|
||||||
|
conf.ap.ssid_hidden=1;
|
||||||
|
esp_wifi_set_config(WIFI_IF_AP,&conf);
|
||||||
|
|
||||||
uint8_t hash[32];
|
uint8_t hash[32];
|
||||||
mbedtls_sha256_ret((const unsigned char *)password,strlen(password),hash,0); // produce 256-bit bit hash from password
|
mbedtls_sha256_ret((const unsigned char *)password,strlen(password),hash,0); // produce 256-bit bit hash from password
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
|
|
||||||
// This is a placeholder .ino file that allows you to easily edit the contents of this library using the Arduino IDE,
|
// This is a placeholder .ino file that allows you to easily edit the contents of this library using the Arduino IDE,
|
||||||
// as well as compile and test from this point. This file is ignored when the library is included in other sketches.
|
// as well as compile and test from this point. This file is ignored when the library is included in other sketches.
|
||||||
|
|
||||||
#include "HomeSpan.h"
|
#include "HomeSpan.h"
|
||||||
|
|
||||||
struct RemoteTempSensor : Service::TemperatureSensor {
|
struct RemoteTempSensor : Service::TemperatureSensor {
|
||||||
|
|
@ -75,7 +76,7 @@ void setup() {
|
||||||
void loop(){
|
void loop(){
|
||||||
|
|
||||||
homeSpan.poll();
|
homeSpan.poll();
|
||||||
|
|
||||||
} // end of loop()
|
} // end of loop()
|
||||||
|
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue