Khakimov Rishat
/
Kurs
87ty78ot7iyu
Diff: main.cpp
- Revision:
- 35:052c1ba06ce7
- Parent:
- 33:12f0df4d51d7
- Child:
- 37:3a31525e2971
--- a/main.cpp Tue Sep 26 11:15:03 2017 +0100 +++ b/main.cpp Tue Sep 26 11:45:04 2017 +0100 @@ -63,7 +63,7 @@ { WiFiAccessPoint *ap; - printf("Scan:\r\n"); + printf("Scan:\n"); int count = wifi->scan(NULL,0); @@ -74,11 +74,11 @@ count = wifi->scan(ap, count); for (int i = 0; i < count; i++) { - printf("Network: %s secured: %s BSSID: %hhX:%hhX:%hhX:%hhx:%hhx:%hhx RSSI: %hhd Ch: %hhd\r\n", ap[i].get_ssid(), + printf("Network: %s secured: %s BSSID: %hhX:%hhX:%hhX:%hhx:%hhx:%hhx RSSI: %hhd Ch: %hhd\n", ap[i].get_ssid(), sec2str(ap[i].get_security()), ap[i].get_bssid()[0], ap[i].get_bssid()[1], ap[i].get_bssid()[2], ap[i].get_bssid()[3], ap[i].get_bssid()[4], ap[i].get_bssid()[5], ap[i].get_rssi(), ap[i].get_channel()); } - printf("%d networks available.\r\n", count); + printf("%d networks available.\n", count); delete[] ap; } @@ -88,13 +88,13 @@ TCPSocket socket; nsapi_error_t response; - printf("Sending HTTP request to www.arm.com...\r\n"); + printf("Sending HTTP request to www.arm.com...\n"); // Open a socket on the network interface, and create a TCP connection to www.arm.com socket.open(net); response = socket.connect("www.arm.com", 80); if(0 != response) { - printf("Error connecting: %d\r\n", response); + printf("Error connecting: %d\n", response); socket.close(); return; } @@ -107,13 +107,13 @@ { response = socket.send(sbuffer+response, size); if (response < 0) { - printf("Error sending data: %d\r\n", response); + printf("Error sending data: %d\n", response); socket.close(); return; } else { size -= response; // Check if entire message was sent or not - printf("sent %d [%.*s]\r\n", response, strstr(sbuffer, "\r\n")-sbuffer, sbuffer); + printf("sent %d [%.*s]\n", response, strstr(sbuffer, "\r\n")-sbuffer, sbuffer); } } @@ -121,9 +121,9 @@ char rbuffer[64]; response = socket.recv(rbuffer, sizeof rbuffer); if (response < 0) { - printf("Error receiving data: %d\r\n", response); + printf("Error receiving data: %d\n", response); } else { - printf("recv %d [%.*s]\r\n", response, strstr(rbuffer, "\r\n")-rbuffer, rbuffer); + printf("recv %d [%.*s]\n", response, strstr(rbuffer, "\r\n")-rbuffer, rbuffer); } // Close the socket to return its memory and bring down the network interface @@ -132,27 +132,27 @@ int main() { - printf("WiFi example\r\n\r\n"); + printf("WiFi example\n\n"); scan_demo(&wifi); - printf("\r\nConnecting...\r\n"); + printf("\nConnecting...\n"); int ret = wifi.connect(MBED_CONF_APP_WIFI_SSID, MBED_CONF_APP_WIFI_PASSWORD, NSAPI_SECURITY_WPA_WPA2); if (ret != 0) { - printf("\r\nConnection error\r\n"); + printf("\nConnection error\n"); return -1; } - printf("Success\r\n\r\n"); - printf("MAC: %s\r\n", wifi.get_mac_address()); - printf("IP: %s\r\n", wifi.get_ip_address()); - printf("Netmask: %s\r\n", wifi.get_netmask()); - printf("Gateway: %s\r\n", wifi.get_gateway()); - printf("RSSI: %d\r\n\r\n", wifi.get_rssi()); + printf("Success\n\n"); + printf("MAC: %s\n", wifi.get_mac_address()); + printf("IP: %s\n", wifi.get_ip_address()); + printf("Netmask: %s\n", wifi.get_netmask()); + printf("Gateway: %s\n", wifi.get_gateway()); + printf("RSSI: %d\n\n", wifi.get_rssi()); http_demo(&wifi); wifi.disconnect(); - printf("\r\nDone\r\n"); + printf("\nDone\n"); }