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:
Gregg 2023-01-28 18:05:59 -06:00
parent 21a88f0ed4
commit 03ba061b9b
3 changed files with 11 additions and 4 deletions

View File

@ -61,7 +61,7 @@ void setup() {
// 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);
}

View File

@ -1032,13 +1032,14 @@ void Span::processSerialCommand(const char *c){
uint8_t channel;
wifi_second_chan_t 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",d,d,d,d,d);
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(),
(*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));
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");
@ -2248,6 +2249,11 @@ void SpanPoint::init(const char *password){
if(WiFi.getMode()==WIFI_OFF)
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];
mbedtls_sha256_ret((const unsigned char *)password,strlen(password),hash,0); // produce 256-bit bit hash from password

View File

@ -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,
// as well as compile and test from this point. This file is ignored when the library is included in other sketches.
#include "HomeSpan.h"
struct RemoteTempSensor : Service::TemperatureSensor {