Wi-Fi Parameters Management

From openPicus Wiki
Jump to: navigation, search

Contents

What you are going to learn

This tutorial describes some ways to setup Wi-Fi network parameters using Flyport IDE Wizard and code. If you search for ready to use configuration page embedded in your Flyport's webserver, please take a look at Smart Network Configuration to provide an easy to use application right from the start.

Wi-Fi Profiles

There are two different network profiles: WF_DEFAULT and WF_CUSTOM.

Available parameters

In each Wi-Fi profile there are available the following parameters:

  • IP Address of Flyport (warning: it can be changed by DHCP Server if you enabled the DHCP Client feature of Flyport Module)
  • MAC Address of Flyport
  • DNS Server Address
    • IP Address of Primary DNS Server
    • IP Address of Secondary DNS Server
  • Default Gateway
  • Default Subnet Mask
  • DHCP Client Enable/Disable (you have to enable DHCP Client feature on IDE TCP/IP Wizard to use this parameter)
  • Netbios name of Flyport
  • SSID Name of Wi-Fi network to connect/create
  • Network Type:
    • Adhoc
    • Infrastructure
    • SoftAP (Flyport Wi-Fi B does not support this feature)
  • Security Configuration
    • Open
    • WEP
      • WEP 40
      • WEP 104
    • WPA
    • WPA2
    • WPA AUTO
    • WPS with push button (Flyport Wi-Fi B does not support this feature)
  • Wi-Fi enabled channels (Flyport Wi-Fi B does not support this feature)
  • BSSID of Router/access point to be connected to (Flyport Wi-Fi B does not support this feature)


WF_DEFAULT

WF_DEFAULT is a "read only" connection profile, its values can be changed using IDE Wizard and are written inside Flyport Flash Memory. To change values of DEFAULT profile it is always needed to flash a new firmware on Flyport Module.

WF_CUSTOM

WF_CUSTOM can be changed at runtime by user firmware, using the provided APIs.
At Flyport startup WF_CUSTOM profile equals WF_DEFAULT profile. To use customized values (if any) user code have to reload custom configuration.

Available APIs

User can use the following APIs to customize Wi-Fi profile from code:

  • NETCustomExist() - returns TRUE if a custom profile was saved on Flyport memory, otherwise returns FALSE. NOTE: each time you perform a firmware download on Flyport Module using Flyport IDE, custom profiles are deleted.
  • NETCustomDelete() - deletes any previous custom profile from non volatile flash memory.
  • NETCustomSave() - saves current WF_CUSTOM structure content to non volatile flash memory.
  • NETCustomLoad() - load custom profile values from non volatile memory. It is mandatory to load Custom Profile at Flyport Startup (if any custom profile is saved) otherwise WF_CUSTOM contains the same values of WF_DEFAULT profile.
  • NETSetParam(...) - changes provided network parameters.
  • WFSetSecurity(...) - changes security type and passphrase/passkey if needed
  • WFSetChannel(...) - changes enabled Wi-Fi Channels


Security Setup Examples

Each Wi-Fi Default profile can be configured using the IDE Wizard tool. Following are some code example to change WF_CUSTOM profile's security type.

Open Network

WFSetSecurity(WF_SECURITY_OPEN, "", 0, 0);

WEP 40 bit

WFSetSecurity(WF_SECURITY_WEP_40, "HEX VALUES GENERATED", 20, 2);

HEX VALUES GENERATED for WEP Security type

To generate WEP HEx values starting from a passphrase please refer to this web site. Values generated as 64bit keys can be used as HEX values for WEP40; values generated as 128bit keys can be used as WEP104 passkey.

Example of WEP40

  • passphrase = "picus"
  • WEP40
    • index 1: EA43DEC7CE
    • index 2: A7C03583C6
    • index 3: EA614007F7
    • index 4: 0C1553FF77

To use index 2: WFSetSecurity(WF_SECURITY_WEP_40, "\xEA\x43\xDE\xC7\xCE\xA7\xC0\x35\x83\xC6\xEA\x61\x40\x07\xF7\x0C\x15\x53\xFF\x77", 20, 2);

WPA/WPA2 with passphrase

  • WPA

WFSetSecurity(WF_SECURITY_WPA_WITH_PASS_PHRASE, "passphrase", [passphrase length], 0);

  • WPA2:

WFSetSecurity(WF_SECURITY_WPA2_WITH_PASS_PHRASE, "passphrase", [passphrase length], 0);

NOTE: passkey calculation using passphrase security requires about 20 seconds. To speed up your Connection using Flyport it is highly suggested to use passkey instead!

WPA/WPA2 with passkey

  • WPA

WFSetSecurity(WF_SECURITY_WPA_WITH_KEY, "HEX VALUES CALCULATED for WPA/WPA2", [passkey length, generally 32], 0);

  • WPA2:

WFSetSecurity(WF_SECURITY_WPA2_WITH_KEY, "HEX VALUES CALCULATED for WPA/WPA2", [passkey length, generally 32], 0);

HEX VALUES GENERATED for WPA/WPA2

To generate Passkey HEX values starting from a passphrase please refer to this web site.

Example of WPA2 Security type with key

  • passphrase = "picus"
  • SSID = "picusNetwork"
  • calculated key: "04832dfc6fee575f48ceb84ab9c905876e01aebeca1d3c9919d8e76431ee350a"

WFSetSecurity(WF_SECURITY_WPA_WITH_KEY, "\x04\x83\x2d\xfc\x6f\xee\x57\x5f\x48\xce\xb8\x4a\xb9\xc9\x05\x87\x6e\x01\xae\xbe\xca\x1d\x3c\x99\x19\xd8\xe7\x64\x31\xee\x35\x0a", 32, 0);

WPS Push Button

WFSetSecurity(WF_SECURITY_WPS_PUSH_BUTTON, "", 0, 0);

Using WPS Push button Flyport will use WPA or WPA2 autoselect. Please use your router WPS push button to allow Flyport to connect to Wi-Fi network during Wi-Fi connections attempts made by Flyport Wi-Fi module.

For further info about WPS, please refer to WPS Push Button Tutorial

Personal tools
Namespaces

Variants
Actions
START HERE
DEVELOPMENT
HARDWARE INFO
RESOURCES
PHASED OUT
Toolbox