Skip to content

Commit

Permalink
Hack: Use serial number to generate wifi api
Browse files Browse the repository at this point in the history
This commit changes the SSID of the Wifi AP to PREFIX-<SERIALNUMBER> in
accordance with Eltako wifi ap. This change is likely not compatible
with Matter. However we do not support commissioning using Wifi anyway.
Yet we need wifi to be available to configure the device by other means.
In the future we need to find a way to either enable the ap without
using Matter functions or provide proper commissioning over wifi.
The latter is likely the better way.
  • Loading branch information
dbahrdt committed Jun 21, 2023
1 parent a11cd16 commit 39fe904
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/platform/ESP32/ConnectivityManagerImpl_WiFi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -933,11 +933,13 @@ CHIP_ERROR ConnectivityManagerImpl::ConfigureWiFiAP()

uint16_t vendorId;
uint16_t productId;
char serial[sizeof(wifiConfig.ap.ssid)-sizeof(CHIP_DEVICE_CONFIG_WIFI_AP_SSID_PREFIX)];
memset(serial, 0, sizeof(serial));
ReturnErrorOnFailure(GetDeviceInstanceInfoProvider()->GetVendorId(vendorId));
ReturnErrorOnFailure(GetDeviceInstanceInfoProvider()->GetProductId(productId));
ReturnErrorOnFailure(GetDeviceInstanceInfoProvider()->GetSerialNumber(serial, sizeof(serial)));

snprintf((char *) wifiConfig.ap.ssid, sizeof(wifiConfig.ap.ssid), "%s%03X-%04X-%04X", CHIP_DEVICE_CONFIG_WIFI_AP_SSID_PREFIX,
discriminator, vendorId, productId);
snprintf((char *) wifiConfig.ap.ssid, sizeof(wifiConfig.ap.ssid), "%s-%s", CHIP_DEVICE_CONFIG_WIFI_AP_SSID_PREFIX, serial);
wifiConfig.ap.channel = CHIP_DEVICE_CONFIG_WIFI_AP_CHANNEL;
wifiConfig.ap.authmode = WIFI_AUTH_OPEN;
wifiConfig.ap.max_connection = CHIP_DEVICE_CONFIG_WIFI_AP_MAX_STATIONS;
Expand Down

0 comments on commit 39fe904

Please sign in to comment.