mayuresh bharmoria / Mbed OS mbed-os-example-wifi
Committer:
mayur098
Date:
Thu Jun 21 17:50:21 2018 +0000
Revision:
0:8f8e8f3cbd1c
first commit;

Who changed what in which revision?

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