Mbed Cloud example program for workshop in W27 2018.

Dependencies:   MMA7660 LM75B

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SPWFSA01.h Source File

SPWFSA01.h

00001 /* SPWFSA01 Device
00002  * Copyright (c) 2015 ARM Limited
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016  
00017 #ifndef SPWFSA01_H
00018 #define SPWFSA01_H
00019 
00020 #include "mbed.h"
00021 #include "ATCmdParser.h"
00022 #include "BlockExecuter.h"
00023 
00024 #include "./spwfsa01_at_strings.h"
00025 #include "../SPWFSAxx.h"
00026 
00027 class SpwfSAInterface;
00028 
00029 /** SPWFSA01 Interface class.
00030     This is an interface to a SPWFSA01 module.
00031  */
00032 class SPWFSA01 : public SPWFSAxx
00033 {
00034 public:
00035     SPWFSA01(PinName tx, PinName rx,
00036              PinName rts, PinName cts,
00037              SpwfSAInterface &ifce, bool debug,
00038              PinName wakeup, PinName reset);
00039 
00040     /**
00041      * Open a socketed connection
00042      *
00043      * @param type the type of socket to open "u" (UDP) or "t" (TCP)
00044      * @param id id to get the new socket number, valid 0-7
00045      * @param port port to open connection with
00046      * @param addr the IP address of the destination
00047      * @return true only if socket opened successfully
00048      */
00049     bool open(const char *type, int* id, const char* addr, int port);
00050 
00051     /** Scan for available networks
00052      *
00053      * @param  ap    Pointer to allocated array to store discovered AP
00054      * @param  limit Size of allocated @a res array, or 0 to only count available AP
00055      * @return       Number of entries in @a res, or if @a count was 0 number of available networks, negative on error
00056      *               see @a nsapi_error
00057      */
00058     nsapi_size_or_error_t scan(WiFiAccessPoint *res, unsigned limit);
00059 
00060 private:
00061     bool _recv_ap(nsapi_wifi_ap_t *ap);
00062 
00063     virtual int _read_in(char*, int, uint32_t);
00064 };
00065 
00066 #endif // SPWFSA01_H