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