Toyomasa Watarai
/
Mbed-example-WS-W27
Mbed Cloud example program for workshop in W27 2018.
easy-connect/wifi-x-nucleo-idw01m1/SPWFSA01/SPWFSA01.h@0:119624335925, 2018-06-30 (annotated)
- Committer:
- MACRUM
- Date:
- Sat Jun 30 01:40:30 2018 +0000
- Revision:
- 0:119624335925
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MACRUM | 0:119624335925 | 1 | /* SPWFSA01 Device |
MACRUM | 0:119624335925 | 2 | * Copyright (c) 2015 ARM Limited |
MACRUM | 0:119624335925 | 3 | * |
MACRUM | 0:119624335925 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
MACRUM | 0:119624335925 | 5 | * you may not use this file except in compliance with the License. |
MACRUM | 0:119624335925 | 6 | * You may obtain a copy of the License at |
MACRUM | 0:119624335925 | 7 | * |
MACRUM | 0:119624335925 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
MACRUM | 0:119624335925 | 9 | * |
MACRUM | 0:119624335925 | 10 | * Unless required by applicable law or agreed to in writing, software |
MACRUM | 0:119624335925 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
MACRUM | 0:119624335925 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
MACRUM | 0:119624335925 | 13 | * See the License for the specific language governing permissions and |
MACRUM | 0:119624335925 | 14 | * limitations under the License. |
MACRUM | 0:119624335925 | 15 | */ |
MACRUM | 0:119624335925 | 16 | |
MACRUM | 0:119624335925 | 17 | #ifndef SPWFSA01_H |
MACRUM | 0:119624335925 | 18 | #define SPWFSA01_H |
MACRUM | 0:119624335925 | 19 | |
MACRUM | 0:119624335925 | 20 | #include "mbed.h" |
MACRUM | 0:119624335925 | 21 | #include "ATCmdParser.h" |
MACRUM | 0:119624335925 | 22 | #include "BlockExecuter.h" |
MACRUM | 0:119624335925 | 23 | |
MACRUM | 0:119624335925 | 24 | #include "./spwfsa01_at_strings.h" |
MACRUM | 0:119624335925 | 25 | #include "../SPWFSAxx.h" |
MACRUM | 0:119624335925 | 26 | |
MACRUM | 0:119624335925 | 27 | class SpwfSAInterface; |
MACRUM | 0:119624335925 | 28 | |
MACRUM | 0:119624335925 | 29 | /** SPWFSA01 Interface class. |
MACRUM | 0:119624335925 | 30 | This is an interface to a SPWFSA01 module. |
MACRUM | 0:119624335925 | 31 | */ |
MACRUM | 0:119624335925 | 32 | class SPWFSA01 : public SPWFSAxx |
MACRUM | 0:119624335925 | 33 | { |
MACRUM | 0:119624335925 | 34 | public: |
MACRUM | 0:119624335925 | 35 | SPWFSA01(PinName tx, PinName rx, |
MACRUM | 0:119624335925 | 36 | PinName rts, PinName cts, |
MACRUM | 0:119624335925 | 37 | SpwfSAInterface &ifce, bool debug, |
MACRUM | 0:119624335925 | 38 | PinName wakeup, PinName reset); |
MACRUM | 0:119624335925 | 39 | |
MACRUM | 0:119624335925 | 40 | /** |
MACRUM | 0:119624335925 | 41 | * Open a socketed connection |
MACRUM | 0:119624335925 | 42 | * |
MACRUM | 0:119624335925 | 43 | * @param type the type of socket to open "u" (UDP) or "t" (TCP) |
MACRUM | 0:119624335925 | 44 | * @param id id to get the new socket number, valid 0-7 |
MACRUM | 0:119624335925 | 45 | * @param port port to open connection with |
MACRUM | 0:119624335925 | 46 | * @param addr the IP address of the destination |
MACRUM | 0:119624335925 | 47 | * @return true only if socket opened successfully |
MACRUM | 0:119624335925 | 48 | */ |
MACRUM | 0:119624335925 | 49 | bool open(const char *type, int* id, const char* addr, int port); |
MACRUM | 0:119624335925 | 50 | |
MACRUM | 0:119624335925 | 51 | /** Scan for available networks |
MACRUM | 0:119624335925 | 52 | * |
MACRUM | 0:119624335925 | 53 | * @param ap Pointer to allocated array to store discovered AP |
MACRUM | 0:119624335925 | 54 | * @param limit Size of allocated @a res array, or 0 to only count available AP |
MACRUM | 0:119624335925 | 55 | * @return Number of entries in @a res, or if @a count was 0 number of available networks, negative on error |
MACRUM | 0:119624335925 | 56 | * see @a nsapi_error |
MACRUM | 0:119624335925 | 57 | */ |
MACRUM | 0:119624335925 | 58 | nsapi_size_or_error_t scan(WiFiAccessPoint *res, unsigned limit); |
MACRUM | 0:119624335925 | 59 | |
MACRUM | 0:119624335925 | 60 | private: |
MACRUM | 0:119624335925 | 61 | bool _recv_ap(nsapi_wifi_ap_t *ap); |
MACRUM | 0:119624335925 | 62 | |
MACRUM | 0:119624335925 | 63 | virtual int _read_in(char*, int, uint32_t); |
MACRUM | 0:119624335925 | 64 | }; |
MACRUM | 0:119624335925 | 65 | |
MACRUM | 0:119624335925 | 66 | #endif // SPWFSA01_H |