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