GSwifiInterface library (interface for GainSpan Wi-Fi GS1011 modules) Please see https://mbed.org/users/gsfan/notebook/GSwifiInterface/

Dependents:   GSwifiInterface_HelloWorld GSwifiInterface_HelloServo GSwifiInterface_UDPEchoServer GSwifiInterface_UDPEchoClient ... more

Fork of WiflyInterface by mbed official

GainSpan Wi-Fi library

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

mbed RTOS supported.

/media/uploads/gsfan/gs_im_002.jpg /media/uploads/gsfan/gs1011m_2.jpg

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

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

mbed RTOS に対応しています。(mbed2.0)

GSwifiInterface.cpp

Committer:
gsfan
Date:
20 months ago
Revision:
22:d25a5a0d2497
Parent:
21:6431364fc667

File content as of revision 22:d25a5a0d2497:

/* Copyright (C) 2019 gsfan, MIT License
 *  port to the GainSpan (Telit) Wi-FI module GS1011/GS2000/GS2100
 */

#include "GSwifiInterface.h"

#ifdef CFG_SPI_DATAINTERFACE
GSwifiInterface::GSwifiInterface( PinName tx, PinName rx, PinName cts, PinName rts, PinName reset,
  PinName mosi, PinName miso, PinName sclk, PinName cs, PinName wake,
  PinName alarm, int baud, int freq) :
    GSwifi(tx, rx, cts, rts, reset, mosi, miso, sclk, cs, wake, alarm, baud, freq)
#else
GSwifiInterface::GSwifiInterface( PinName tx, PinName rx, PinName cts, PinName rts, PinName reset, PinName alarm, int baud) :
    GSwifi(tx, rx, cts, rts, reset, alarm, baud)
#endif
{
}

int GSwifiInterface::init(const char* name)
{
    return setAddress(name);
}

int GSwifiInterface::init(const char* ip, const char* netmask, const char* gateway, const char* dns, const char* name)
{
    return setAddress(ip, netmask, gateway, dns, name);
}

int GSwifiInterface::connect(Security sec, const char* ssid, const char* phrase, WiFiMode mode)
{
    setSsid(sec, ssid, phrase);
    switch (mode) {
    case WM_INFRASTRUCTURE:
        return join();
    case WM_ADHOCK:
        return adhock();
    case WM_LIMITEDAP:
        return limitedap();
    }
    return -1;
}

int GSwifiInterface::disconnect()
{
    return GSwifi::dissociate();
}

char * GSwifiInterface::getMACAddress()
{
    return _state.mac;
}

char * GSwifiInterface::getIPAddress()
{
    return _state.ip;
}

char * GSwifiInterface::getGateway()
{
    return _state.gateway;
}

char * GSwifiInterface::getNetworkMask()
{
    return _state.netmask;
}