989
Dependencies: mbed Servo X_NUCLEO_IKS01A2 X_NUCLEO_IDW01M1v2 NetworkSocketAPI NDefLib MQTT
main.cpp
- Committer:
- mridup
- Date:
- 2016-04-13
- Revision:
- 2:ba0531d896f0
- Parent:
- 1:041e9f05738c
- Child:
- 3:dfb8c6c8c31b
File content as of revision 2:ba0531d896f0:
/* NetworkSocketAPI Example Program * Copyright (c) 2015 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "mbed.h" #include "SPWFInterface.h" #include "NSAPITests.h" //------------------------------------ // Hyperterminal configuration // 9600 bauds, 8-bit data, no parity //------------------------------------ Serial pc(SERIAL_TX, SERIAL_RX); SpwfSAInterface *spwf; int main() { int32_t err; char * ssid = "STM"; char * seckey = "STMdemoPWD"; spwf = createSPWFInstance(); err = spwf->init(); if(err!=0) { pc.printf("\r\nerror initializing.\r\n"); return -1; } pc.printf("\r\nconnecting to AP\r\n"); err = spwf->connect(ssid, seckey, NS_SECURITY_WPA); if (err) { printf("Interface failed to connect with code %d\r\n", err); } else { nsapi_tests("SPWF Tests", spwf, "192.168.1.5", 32001); spwf->disconnect(); } while(1); }