Пример #1
0
 // can be re-applied
 void STC_FLASHMEM ConfigurationManager::applyWiFi()
 {
     // WiFi Mode
     WiFi::setMode(getWiFiMode());
                                 
     if (getWiFiMode() == WiFi::AccessPoint || getWiFiMode() == WiFi::ClientAndAccessPoint)
     {
         // Access point parameters
         char const* SSID;
         char const* securityKey;
         uint8_t channel;
         WiFi::SecurityProtocol securityProtocol;
         bool hiddenSSID;
         getAccessPointParams(&SSID, &securityKey, &channel, &securityProtocol, &hiddenSSID);
         WiFi::configureAccessPoint(SSID, securityKey, channel, securityProtocol, hiddenSSID);
     }
     
     if (getWiFiMode() == WiFi::Client || getWiFiMode() == WiFi::ClientAndAccessPoint)
     {			
         // Client parameters
         char const* SSID;
         char const* securityKey;
         getClientParams(&SSID, &securityKey);
         WiFi::configureClient(SSID, securityKey);
     }
 }
Пример #2
0
// can be re-applied
void STC_FLASHMEM ConfigurationManager::applyAccessPointIP() {
  if (getWiFiMode() == WiFi::AccessPoint || getWiFiMode() == WiFi::ClientAndAccessPoint) {
    // Access Point IP
    char const *IP;
    char const *netmask;
    char const *gateway;
    getAccessPointIPParams(&IP, &netmask, &gateway);
    IP::configureStatic(WiFi::AccessPointNetwork, IP, netmask, gateway);
  }
}
Пример #3
0
// can be re-applied
void STC_FLASHMEM ConfigurationManager::applyDHCPServer() {
  // DCHP Server
  if (getWiFiMode() == WiFi::AccessPoint || getWiFiMode() == WiFi::ClientAndAccessPoint) {
    bool enabled;
    char const *startIP;
    char const *endIP;
    getDHCPServerParams(&enabled, &startIP, &endIP);
    if (enabled)
      DHCPServer::configure(startIP, endIP);
  }
}
Пример #4
0
// can be re-applied
void STC_FLASHMEM ConfigurationManager::applyClientIP() {
  if (getWiFiMode() == WiFi::Client || getWiFiMode() == WiFi::ClientAndAccessPoint) {
    // Client IP
    bool staticIP;
    char const *IP;
    char const *netmask;
    char const *gateway;
    getClientIPParams(&staticIP, &IP, &netmask, &gateway);
    if (staticIP)
      IP::configureStatic(WiFi::ClientNetwork, IP, netmask, gateway);
    else
      IP::configureDHCP(WiFi::ClientNetwork);
  }
}