The driver for the ESP8266 WiFi module - isConnected function added, working and tested with mbed os 5.7.6

Fork of esp8266-driver by ESP8266

Committer:
mareszym
Date:
Sun Nov 04 12:50:49 2018 +0000
Revision:
2:0bc0b654995c
Parent:
0:6946b0b9e323
isConnected function added

Who changed what in which revision?

UserRevisionLine numberNew contents of line
group-ESP8266 0:6946b0b9e323 1
group-ESP8266 0:6946b0b9e323 2 /**
group-ESP8266 0:6946b0b9e323 3 * @file Buffer.cpp
group-ESP8266 0:6946b0b9e323 4 * @brief Software Buffer - Templated Ring Buffer for most data types
group-ESP8266 0:6946b0b9e323 5 * @author sam grove
group-ESP8266 0:6946b0b9e323 6 * @version 1.0
group-ESP8266 0:6946b0b9e323 7 * @see
group-ESP8266 0:6946b0b9e323 8 *
group-ESP8266 0:6946b0b9e323 9 * Copyright (c) 2013
group-ESP8266 0:6946b0b9e323 10 *
group-ESP8266 0:6946b0b9e323 11 * Licensed under the Apache License, Version 2.0 (the "License");
group-ESP8266 0:6946b0b9e323 12 * you may not use this file except in compliance with the License.
group-ESP8266 0:6946b0b9e323 13 * You may obtain a copy of the License at
group-ESP8266 0:6946b0b9e323 14 *
group-ESP8266 0:6946b0b9e323 15 * http://www.apache.org/licenses/LICENSE-2.0
group-ESP8266 0:6946b0b9e323 16 *
group-ESP8266 0:6946b0b9e323 17 * Unless required by applicable law or agreed to in writing, software
group-ESP8266 0:6946b0b9e323 18 * distributed under the License is distributed on an "AS IS" BASIS,
group-ESP8266 0:6946b0b9e323 19 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
group-ESP8266 0:6946b0b9e323 20 * See the License for the specific language governing permissions and
group-ESP8266 0:6946b0b9e323 21 * limitations under the License.
group-ESP8266 0:6946b0b9e323 22 */
group-ESP8266 0:6946b0b9e323 23
group-ESP8266 0:6946b0b9e323 24 #include "MyBuffer.h"
group-ESP8266 0:6946b0b9e323 25
group-ESP8266 0:6946b0b9e323 26 template <class T>
group-ESP8266 0:6946b0b9e323 27 MyBuffer<T>::MyBuffer(uint32_t size)
group-ESP8266 0:6946b0b9e323 28 {
group-ESP8266 0:6946b0b9e323 29 _buf = new T [size];
group-ESP8266 0:6946b0b9e323 30 _size = size;
group-ESP8266 0:6946b0b9e323 31 clear();
group-ESP8266 0:6946b0b9e323 32
group-ESP8266 0:6946b0b9e323 33 return;
group-ESP8266 0:6946b0b9e323 34 }
group-ESP8266 0:6946b0b9e323 35
group-ESP8266 0:6946b0b9e323 36 template <class T>
group-ESP8266 0:6946b0b9e323 37 MyBuffer<T>::~MyBuffer()
group-ESP8266 0:6946b0b9e323 38 {
group-ESP8266 0:6946b0b9e323 39 delete [] _buf;
group-ESP8266 0:6946b0b9e323 40
group-ESP8266 0:6946b0b9e323 41 return;
group-ESP8266 0:6946b0b9e323 42 }
group-ESP8266 0:6946b0b9e323 43
group-ESP8266 0:6946b0b9e323 44 template <class T>
group-ESP8266 0:6946b0b9e323 45 uint32_t MyBuffer<T>::getSize()
group-ESP8266 0:6946b0b9e323 46 {
group-ESP8266 0:6946b0b9e323 47 return this->_size;
group-ESP8266 0:6946b0b9e323 48 }
group-ESP8266 0:6946b0b9e323 49
group-ESP8266 0:6946b0b9e323 50 template <class T>
group-ESP8266 0:6946b0b9e323 51 void MyBuffer<T>::clear(void)
group-ESP8266 0:6946b0b9e323 52 {
group-ESP8266 0:6946b0b9e323 53 _wloc = 0;
group-ESP8266 0:6946b0b9e323 54 _rloc = 0;
group-ESP8266 0:6946b0b9e323 55 memset(_buf, 0, _size);
group-ESP8266 0:6946b0b9e323 56
group-ESP8266 0:6946b0b9e323 57 return;
group-ESP8266 0:6946b0b9e323 58 }
group-ESP8266 0:6946b0b9e323 59
group-ESP8266 0:6946b0b9e323 60 template <class T>
group-ESP8266 0:6946b0b9e323 61 uint32_t MyBuffer<T>::peek(char c)
group-ESP8266 0:6946b0b9e323 62 {
group-ESP8266 0:6946b0b9e323 63 return 1;
group-ESP8266 0:6946b0b9e323 64 }
group-ESP8266 0:6946b0b9e323 65
group-ESP8266 0:6946b0b9e323 66 // make the linker aware of some possible types
group-ESP8266 0:6946b0b9e323 67 template class MyBuffer<uint8_t>;
group-ESP8266 0:6946b0b9e323 68 template class MyBuffer<int8_t>;
group-ESP8266 0:6946b0b9e323 69 template class MyBuffer<uint16_t>;
group-ESP8266 0:6946b0b9e323 70 template class MyBuffer<int16_t>;
group-ESP8266 0:6946b0b9e323 71 template class MyBuffer<uint32_t>;
group-ESP8266 0:6946b0b9e323 72 template class MyBuffer<int32_t>;
group-ESP8266 0:6946b0b9e323 73 template class MyBuffer<uint64_t>;
group-ESP8266 0:6946b0b9e323 74 template class MyBuffer<int64_t>;
group-ESP8266 0:6946b0b9e323 75 template class MyBuffer<char>;
group-ESP8266 0:6946b0b9e323 76 template class MyBuffer<wchar_t>;