GainSpan Wi-Fi library see: http://mbed.org/users/gsfan/notebook/gainspan_wifi/

Fork of GSwifi_old by gs fan

GainSpan Wi-Fi library

The GS1011 is an ultra low power 802.11b wireless module from GainSpan.

see: http://mbed.org/users/gsfan/notebook/gainspan_wifi/

Information

Please change the baud rate in advance.

  • ATB=115200
  • AT&W0

It may be better and sometimes faster.
GSwifi gs(p13, p14, baud);

Heavily modified new library: http://mbed.org/users/gsfan/code/GSwifi

ゲインスパン Wi-Fi モジュール ライブラリ

ゲインスパン社の低電力 Wi-Fiモジュール(無線LAN) GS1011 シリーズ用のライブラリです。

解説: http://mbed.org/users/gsfan/notebook/gainspan_wifi/

Information

モジュールはあらかじめ次のコマンドでボーレートを変更しておく。

  • ATB=115200
  • AT&W0

場合によってはもっと高速の方がいいかもしれない。クラス宣言時にレート設定をする。
GSwifi gs(p13, p14, baud);

大幅に更新された新しいライブラリ: http://mbed.org/users/gsfan/code/GSwifi

Committer:
gsfan
Date:
Wed Jan 23 07:41:23 2013 +0000
Revision:
24:5c350ae2e703
Parent:
0:2f6062c6d018
auto re-connect

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gsfan 0:2f6062c6d018 1
gsfan 0:2f6062c6d018 2 /*
gsfan 0:2f6062c6d018 3 Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com)
gsfan 0:2f6062c6d018 4
gsfan 0:2f6062c6d018 5 Permission is hereby granted, free of charge, to any person obtaining a copy
gsfan 0:2f6062c6d018 6 of this software and associated documentation files (the "Software"), to deal
gsfan 0:2f6062c6d018 7 in the Software without restriction, including without limitation the rights
gsfan 0:2f6062c6d018 8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
gsfan 0:2f6062c6d018 9 copies of the Software, and to permit persons to whom the Software is
gsfan 0:2f6062c6d018 10 furnished to do so, subject to the following conditions:
gsfan 0:2f6062c6d018 11
gsfan 0:2f6062c6d018 12 The above copyright notice and this permission notice shall be included in
gsfan 0:2f6062c6d018 13 all copies or substantial portions of the Software.
gsfan 0:2f6062c6d018 14
gsfan 0:2f6062c6d018 15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
gsfan 0:2f6062c6d018 16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
gsfan 0:2f6062c6d018 17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
gsfan 0:2f6062c6d018 18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
gsfan 0:2f6062c6d018 19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
gsfan 0:2f6062c6d018 20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
gsfan 0:2f6062c6d018 21 THE SOFTWARE.
gsfan 0:2f6062c6d018 22 */
gsfan 0:2f6062c6d018 23
gsfan 0:2f6062c6d018 24 #ifndef HOST_H
gsfan 0:2f6062c6d018 25 #define HOST_H
gsfan 0:2f6062c6d018 26
gsfan 0:2f6062c6d018 27 #include "ipaddr.h"
gsfan 0:2f6062c6d018 28 #include <string.h>
gsfan 0:2f6062c6d018 29
gsfan 0:2f6062c6d018 30 ///Host information container
gsfan 0:2f6062c6d018 31 /**
gsfan 0:2f6062c6d018 32 This class is a container for data relative to a connection:
gsfan 0:2f6062c6d018 33 - IP Address
gsfan 0:2f6062c6d018 34 - Port number
gsfan 0:2f6062c6d018 35 - Host Name
gsfan 0:2f6062c6d018 36 */
gsfan 0:2f6062c6d018 37 class Host
gsfan 0:2f6062c6d018 38 {
gsfan 0:2f6062c6d018 39 public:
gsfan 0:2f6062c6d018 40 ///Initiliazes host with null values
gsfan 0:2f6062c6d018 41 Host() : m_ip(0,0,0,0), m_port(0), m_name(NULL)
gsfan 0:2f6062c6d018 42 {
gsfan 0:2f6062c6d018 43
gsfan 0:2f6062c6d018 44 }
gsfan 0:2f6062c6d018 45
gsfan 0:2f6062c6d018 46 ///Initializes host
gsfan 0:2f6062c6d018 47 Host(const IpAddr& ip, const int& port, const char* name="" ) : m_ip(ip), m_port(port), m_name(NULL)
gsfan 0:2f6062c6d018 48 {
gsfan 0:2f6062c6d018 49 setName(name);
gsfan 0:2f6062c6d018 50 }
gsfan 0:2f6062c6d018 51
gsfan 0:2f6062c6d018 52 ~Host()
gsfan 0:2f6062c6d018 53 {
gsfan 0:2f6062c6d018 54 if(m_name)
gsfan 0:2f6062c6d018 55 {
gsfan 0:2f6062c6d018 56 delete[] m_name;
gsfan 0:2f6062c6d018 57 }
gsfan 0:2f6062c6d018 58 }
gsfan 0:2f6062c6d018 59
gsfan 0:2f6062c6d018 60 ///Returns IP address
gsfan 0:2f6062c6d018 61 const IpAddr& getIp() const
gsfan 0:2f6062c6d018 62 {
gsfan 0:2f6062c6d018 63 return m_ip;
gsfan 0:2f6062c6d018 64 }
gsfan 0:2f6062c6d018 65
gsfan 0:2f6062c6d018 66 ///Returns port number
gsfan 0:2f6062c6d018 67 const int& getPort() const
gsfan 0:2f6062c6d018 68 {
gsfan 0:2f6062c6d018 69 return m_port;
gsfan 0:2f6062c6d018 70 }
gsfan 0:2f6062c6d018 71
gsfan 0:2f6062c6d018 72 ///Returns host name
gsfan 0:2f6062c6d018 73 const char* getName() const
gsfan 0:2f6062c6d018 74 {
gsfan 0:2f6062c6d018 75 return m_name;
gsfan 0:2f6062c6d018 76 }
gsfan 0:2f6062c6d018 77
gsfan 0:2f6062c6d018 78 ///Sets IP address
gsfan 0:2f6062c6d018 79 void setIp(const IpAddr& ip)
gsfan 0:2f6062c6d018 80 {
gsfan 0:2f6062c6d018 81 m_ip = ip;
gsfan 0:2f6062c6d018 82 }
gsfan 0:2f6062c6d018 83
gsfan 0:2f6062c6d018 84 ///Sets port number
gsfan 0:2f6062c6d018 85 void setPort(int port)
gsfan 0:2f6062c6d018 86 {
gsfan 0:2f6062c6d018 87 m_port = port;
gsfan 0:2f6062c6d018 88 }
gsfan 0:2f6062c6d018 89
gsfan 0:2f6062c6d018 90 ///Sets host name
gsfan 0:2f6062c6d018 91 void setName(const char* name)
gsfan 0:2f6062c6d018 92 {
gsfan 0:2f6062c6d018 93 if(m_name)
gsfan 0:2f6062c6d018 94 delete[] m_name;
gsfan 0:2f6062c6d018 95 int len = strlen(name);
gsfan 0:2f6062c6d018 96 if(len)
gsfan 0:2f6062c6d018 97 {
gsfan 0:2f6062c6d018 98 m_name = new char[len+1];
gsfan 0:2f6062c6d018 99 strcpy(m_name, name);
gsfan 0:2f6062c6d018 100 }
gsfan 0:2f6062c6d018 101 }
gsfan 0:2f6062c6d018 102
gsfan 0:2f6062c6d018 103 private:
gsfan 0:2f6062c6d018 104 IpAddr m_ip;
gsfan 0:2f6062c6d018 105 int m_port;
gsfan 0:2f6062c6d018 106 char* m_name;
gsfan 0:2f6062c6d018 107 };
gsfan 0:2f6062c6d018 108
gsfan 0:2f6062c6d018 109 #endif