This document introduces the demo project of "configure_network_demo", including how to configure the network in AP or STA modes.



Content


IDE Preperation

          (Either one of following)


Download

Win32-Demo



Compiling

  1. Right click on "configure_network_demo" project, set as StartUp project.
  2. 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.




  3. Right click on " configure_network_demo ", then "properties",set "Command Arguments" as follows:  
    Syntax :
    configure_network_demo [OPTS] <SDP IP Address>
    slamware_address The ip address string of the SLAMWARE SDP.
    AP Configurate network in AP mode.
    STA Configurate network in STA mode.
    --disable-dhcp disable dhcp.
    --enable-dhcp enable dhcp.
    --disable-wifi disable wifi
    -h Show this message
  4. Click " F5" to execute.
  5. Configure in AP and STA modes
  1. 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.

  2. 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.

     

  3. Similarly, you can use commands as described above to disable/enable DHCP, disable WIFI.


Code

	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);			
		}