WiFi example for mbed OS, fork from https://github.com/ARMmbed/mbed-os-example-wifi

This is an example of a Wi-Fi application using the Wi-Fi and network socket APIs that Mbed OS provides.

The program brings up the Wi-Fi and the underlying network interface and uses it to scan available networks, connects to a network, prints interface and connection details and performs an HTTP operation.

For more information about Wi-Fi APIs, please visit the Mbed OS Wi-Fi documentation.

This example has been used on the following platforms

Committer:
1050186
Date:
Wed Dec 12 05:42:30 2018 +0000
Revision:
7:ab1ae55ec482
Parent:
6:09f1e7ff743c
Delete unnecessary files

Who changed what in which revision?

UserRevisionLine numberNew contents of line
group-Renesas-Electronics-Corp 0:0593b97dec0b 1 properties ([[$class: 'ParametersDefinitionProperty', parameterDefinitions: [
group-Renesas-Electronics-Corp 0:0593b97dec0b 2 [$class: 'StringParameterDefinition', name: 'mbed_os_revision', defaultValue: '', description: 'Revision of mbed-os to build. Use format "pull/PR-NUMBER/head" to access mbed-os PR']
group-Renesas-Electronics-Corp 0:0593b97dec0b 3 ]]])
group-Renesas-Electronics-Corp 0:0593b97dec0b 4
group-Renesas-Electronics-Corp 0:0593b97dec0b 5 if (params.mbed_os_revision == '') {
group-Renesas-Electronics-Corp 0:0593b97dec0b 6 echo 'Use mbed OS revision from mbed-os.lib'
group-Renesas-Electronics-Corp 0:0593b97dec0b 7 } else {
group-Renesas-Electronics-Corp 0:0593b97dec0b 8 echo "Use mbed OS revisiong ${params.mbed_os_revision}"
group-Renesas-Electronics-Corp 0:0593b97dec0b 9 if (params.mbed_os_revision.matches('pull/\\d+/head')) {
group-Renesas-Electronics-Corp 0:0593b97dec0b 10 echo "Revision is a Pull Request"
group-Renesas-Electronics-Corp 0:0593b97dec0b 11 }
group-Renesas-Electronics-Corp 0:0593b97dec0b 12 }
group-Renesas-Electronics-Corp 0:0593b97dec0b 13
group-Renesas-Electronics-Corp 0:0593b97dec0b 14 // List of targets with supported RF shields to compile
group-Renesas-Electronics-Corp 0:0593b97dec0b 15 def targets = [
TomoYamanaka 6:09f1e7ff743c 16 "UBLOX_EVK_ODIN_W2": ["internal"],
TomoYamanaka 6:09f1e7ff743c 17 "REALTEK_RTL8195AM": ["internal"],
TomoYamanaka 6:09f1e7ff743c 18 "K64F": ["esp8266-driver"],
TomoYamanaka 6:09f1e7ff743c 19 "NUCLEO_F429ZI": ["esp8266-driver"]
group-Renesas-Electronics-Corp 0:0593b97dec0b 20 ]
group-Renesas-Electronics-Corp 0:0593b97dec0b 21
group-Renesas-Electronics-Corp 0:0593b97dec0b 22 // Map toolchains to compilers
group-Renesas-Electronics-Corp 0:0593b97dec0b 23 def toolchains = [
group-Renesas-Electronics-Corp 0:0593b97dec0b 24 ARM: "armcc",
group-Renesas-Electronics-Corp 0:0593b97dec0b 25 GCC_ARM: "arm-none-eabi-gcc",
group-Renesas-Electronics-Corp 0:0593b97dec0b 26 IAR: "IAR-linux"
group-Renesas-Electronics-Corp 0:0593b97dec0b 27 ]
group-Renesas-Electronics-Corp 0:0593b97dec0b 28
group-Renesas-Electronics-Corp 0:0593b97dec0b 29 // Supported RF shields
group-Renesas-Electronics-Corp 0:0593b97dec0b 30 def radioshields = [
TomoYamanaka 6:09f1e7ff743c 31 "internal",
TomoYamanaka 6:09f1e7ff743c 32 "esp8266-driver"
group-Renesas-Electronics-Corp 0:0593b97dec0b 33 ]
group-Renesas-Electronics-Corp 0:0593b97dec0b 34
group-Renesas-Electronics-Corp 0:0593b97dec0b 35 def stepsForParallel = [:]
group-Renesas-Electronics-Corp 0:0593b97dec0b 36
group-Renesas-Electronics-Corp 0:0593b97dec0b 37 // Jenkins pipeline does not support map.each, we need to use oldschool for loop
group-Renesas-Electronics-Corp 0:0593b97dec0b 38 for (int i = 0; i < targets.size(); i++) {
group-Renesas-Electronics-Corp 0:0593b97dec0b 39 for(int j = 0; j < toolchains.size(); j++) {
group-Renesas-Electronics-Corp 0:0593b97dec0b 40 for(int k = 0; k < radioshields.size(); k++) {
group-Renesas-Electronics-Corp 0:0593b97dec0b 41 def target = targets.keySet().asList().get(i)
group-Renesas-Electronics-Corp 0:0593b97dec0b 42 def allowed_shields = targets.get(target)
group-Renesas-Electronics-Corp 0:0593b97dec0b 43 def toolchain = toolchains.keySet().asList().get(j)
group-Renesas-Electronics-Corp 0:0593b97dec0b 44 def compilerLabel = toolchains.get(toolchain)
group-Renesas-Electronics-Corp 0:0593b97dec0b 45 def radioshield = radioshields.get(k)
group-Renesas-Electronics-Corp 0:0593b97dec0b 46
group-Renesas-Electronics-Corp 0:0593b97dec0b 47 def stepName = "${target} ${toolchain} ${radioshield}"
group-Renesas-Electronics-Corp 0:0593b97dec0b 48 if(allowed_shields.contains(radioshield)) {
group-Renesas-Electronics-Corp 0:0593b97dec0b 49 stepsForParallel[stepName] = buildStep(target, compilerLabel, toolchain, radioshield)
group-Renesas-Electronics-Corp 0:0593b97dec0b 50 }
group-Renesas-Electronics-Corp 0:0593b97dec0b 51 }
group-Renesas-Electronics-Corp 0:0593b97dec0b 52 }
group-Renesas-Electronics-Corp 0:0593b97dec0b 53 }
group-Renesas-Electronics-Corp 0:0593b97dec0b 54
group-Renesas-Electronics-Corp 0:0593b97dec0b 55 timestamps {
group-Renesas-Electronics-Corp 0:0593b97dec0b 56 parallel stepsForParallel
group-Renesas-Electronics-Corp 0:0593b97dec0b 57 }
group-Renesas-Electronics-Corp 0:0593b97dec0b 58
group-Renesas-Electronics-Corp 0:0593b97dec0b 59 def buildStep(target, compilerLabel, toolchain, radioShield) {
group-Renesas-Electronics-Corp 0:0593b97dec0b 60 return {
group-Renesas-Electronics-Corp 0:0593b97dec0b 61 stage ("${target}_${compilerLabel}_${radioShield}") {
group-Renesas-Electronics-Corp 0:0593b97dec0b 62 node ("${compilerLabel}") {
group-Renesas-Electronics-Corp 0:0593b97dec0b 63 deleteDir()
group-Renesas-Electronics-Corp 0:0593b97dec0b 64 dir("mbed-os-example-wifi") {
group-Renesas-Electronics-Corp 0:0593b97dec0b 65 checkout scm
group-Renesas-Electronics-Corp 0:0593b97dec0b 66 def config_file = "mbed_app.json"
group-Renesas-Electronics-Corp 0:0593b97dec0b 67
group-Renesas-Electronics-Corp 0:0593b97dec0b 68 // Set mbed-os to revision received as parameter
group-Renesas-Electronics-Corp 0:0593b97dec0b 69 execute ("mbed deploy --protocol ssh")
group-Renesas-Electronics-Corp 0:0593b97dec0b 70 if (params.mbed_os_revision != '') {
group-Renesas-Electronics-Corp 0:0593b97dec0b 71 dir ("mbed-os") {
group-Renesas-Electronics-Corp 0:0593b97dec0b 72 if (params.mbed_os_revision.matches('pull/\\d+/head')) {
group-Renesas-Electronics-Corp 0:0593b97dec0b 73 execute("git fetch origin ${params.mbed_os_revision}:PR")
group-Renesas-Electronics-Corp 0:0593b97dec0b 74 execute("git checkout PR")
group-Renesas-Electronics-Corp 0:0593b97dec0b 75 } else {
group-Renesas-Electronics-Corp 0:0593b97dec0b 76 execute ("git checkout ${params.mbed_os_revision}")
group-Renesas-Electronics-Corp 0:0593b97dec0b 77 }
group-Renesas-Electronics-Corp 0:0593b97dec0b 78 }
group-Renesas-Electronics-Corp 0:0593b97dec0b 79 }
group-Renesas-Electronics-Corp 0:0593b97dec0b 80 execute("mbed new .")
TomoYamanaka 6:09f1e7ff743c 81
group-Renesas-Electronics-Corp 0:0593b97dec0b 82 execute ("mbed compile --build out/${target}_${toolchain}_${radioShield}/ -m ${target} -t ${toolchain} -c --app-config ${config_file}")
group-Renesas-Electronics-Corp 0:0593b97dec0b 83 }
group-Renesas-Electronics-Corp 0:0593b97dec0b 84 stash name: "${target}_${toolchain}_${radioShield}", includes: '**/mbed-os-example-wifi.bin'
group-Renesas-Electronics-Corp 0:0593b97dec0b 85 archive '**/mbed-os-example-wifi.bin'
group-Renesas-Electronics-Corp 0:0593b97dec0b 86 step([$class: 'WsCleanup'])
group-Renesas-Electronics-Corp 0:0593b97dec0b 87 }
group-Renesas-Electronics-Corp 0:0593b97dec0b 88 }
group-Renesas-Electronics-Corp 0:0593b97dec0b 89 }
group-Renesas-Electronics-Corp 0:0593b97dec0b 90 }