This document introduces the demo project of "configure_network_demo", including how to configure the network in AP or STA modes. |
Content
Sample Code:
Higher version of Visual Studio will cause errors. Sometime you will need to upgrade SP1 package to make your VS compatable with .Net Framework. |
(Either one of following)
Right click on " configure_network_demo ", then " Properties",configure "include" and "lib" directories to the corresponding folder path of Slamware SDK.
It's not necessary to copy files to the project directory, user will only need to configure the path of SDK. |
Please input the SSID and password of the a available LAN. After completion, the robot will access the LAN and can be connected with the IP allocated by the robot.
Verification: The slamware module can be accessed by connecting the client to the same LAN. In the figure below, the IP address assigned by the robot is 10.0.129.75.
Similarly, you can use commands as described above to disable/enable DHCP, disable WIFI.
std::map<std::string, std::string> options; options["ssid"] = "test"; options["password"] = "12345678"; // password length should surpass 8 options["ip"] = "192.168.11.101"; // do not use address from 192.168.11.1 to 192.168.11.100 (reserved for internal usage) options["channel"] = "6"; result = sdp.configurateNetwork(NetworkMode::NetworkModeAP, options); |
std::map<std::string, std::string> options; options["ssid"] = ssid; options["password"] = password; result = sdp.configurateNetwork(NetworkMode::NetworkModeStation, options); |
if (opt_enable_dhcp == true) { std::cout << "enable DHCP" << std::endl; options.clear(); result = sdp.configurateNetwork(NetworkModeDHCPEnabled, options); } if (opt_disable_dhcp == true) { std::cout << "disable DHCP" << std::endl; options.clear(); result = sdp.configurateNetwork(NetworkModeDHCPEnabled, options); } |
if (opt_disable_wifi == true) { std::cout << "disable wifi" << std::endl; options.clear(); result = sdp.configurateNetwork(NetworkMode::NetworkModeWifiDisabled, options); } |