dbytrderf

Dependencies:   WizFi310Interface_Legacy45566 mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /*
00002  * Copyright (C) 2015 Wiznet, MIT License
00003  *
00004  * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
00005  * and associated documentation files (the "Software"), to deal in the Software without restriction,
00006  * including without limitation the rights to use, copy, modify, merge, publish, distribute,
00007  * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
00008  * furnished to do so, subject to the following conditions:
00009  *
00010  * The above copyright notice and this permission notice shall be included in all copies or
00011  * substantial portions of the Software.
00012  *
00013  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
00014  * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00015  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
00016  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00017  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00018  */
00019 
00020 #include <stdio.h>
00021 #include "mbed.h"
00022 #include "WizFi310Interface.h"
00023 #include "TCPSocketServer.h"
00024 
00025 
00026 #define SECURE WizFi310::SEC_WPA2_MIXED
00027 //#define SSID "CDI"
00028 //#define PASS "Cdi*1717"
00029 #define SSID "CDIWIZFI310TEST"
00030 #define PASS "1234567890"
00031 
00032 
00033 #if defined(TARGET_WIZwiki_W7500)
00034     WizFi310Interface wizfi310(D1, D0, D7, D6, D8, NC, 115200);
00035     Serial pc(USBTX, USBRX);
00036 #endif
00037 
00038 
00039 /**
00040  *  \brief Hello World
00041  *  \param none
00042  *  \return int
00043  */
00044 int main()
00045 {
00046     pc.baud(115200);
00047  
00048     printf("WizFi310  AP. \r\n");
00049     wizfi310.init();
00050     printf("After Initialisation. \r\n");
00051     wizfi310.setAddress("192.168.200.1","255.255.255.0","192.168.200.1");
00052     printf("After Set Address. \r\n");
00053     if ( wizfi310.connect(SECURE, SSID, PASS, WizFi310::WM_AP))      return -1;
00054     printf("After Connect. \r\n");
00055     printf("IP Address is %s\r\n", wizfi310.getIPAddress());
00056     
00057     //wizfi310.test1();
00058    // wizfi310.test2();
00059   // wizfi310.test3();
00060     //int a=TCPSocketServer::bind(80);
00061     wizfi310.bind();
00062     
00063     //wizfi310.disconnect();
00064 }