Core Base Classes for the Light Endpoints
Dependents: mbed_mqtt_endpoint_ublox_ethernet mbed_mqtt_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_ethernet ... more
BaseClass.cpp@192:54b758a8eaaa, 2014-09-26 (annotated)
- Committer:
- ansond
- Date:
- Fri Sep 26 05:16:07 2014 +0000
- Revision:
- 192:54b758a8eaaa
- Parent:
- 155:582462821bd7
updates to new logger name
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ansond | 134:58e7537a8c5f | 1 | /* Copyright C2013 Doug Anson, MIT License |
ansond | 134:58e7537a8c5f | 2 | * |
ansond | 134:58e7537a8c5f | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
ansond | 134:58e7537a8c5f | 4 | * and associated documentation files the "Software", to deal in the Software without restriction, |
ansond | 134:58e7537a8c5f | 5 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
ansond | 134:58e7537a8c5f | 6 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
ansond | 134:58e7537a8c5f | 7 | * furnished to do so, subject to the following conditions: |
ansond | 134:58e7537a8c5f | 8 | * |
ansond | 134:58e7537a8c5f | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
ansond | 134:58e7537a8c5f | 10 | * substantial portions of the Software. |
ansond | 134:58e7537a8c5f | 11 | * |
ansond | 134:58e7537a8c5f | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
ansond | 134:58e7537a8c5f | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
ansond | 134:58e7537a8c5f | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
ansond | 134:58e7537a8c5f | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
ansond | 134:58e7537a8c5f | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
ansond | 134:58e7537a8c5f | 17 | */ |
ansond | 134:58e7537a8c5f | 18 | |
ansond | 134:58e7537a8c5f | 19 | // base class support |
ansond | 134:58e7537a8c5f | 20 | #include "BaseClass.h" |
ansond | 134:58e7537a8c5f | 21 | |
ansond | 134:58e7537a8c5f | 22 | // default constructor |
ansond | 192:54b758a8eaaa | 23 | BaseClass::BaseClass(Logger *logger,void *endpoint) { |
ansond | 192:54b758a8eaaa | 24 | this->m_logger = logger; |
ansond | 155:582462821bd7 | 25 | this->m_endpoint = endpoint; |
ansond | 134:58e7537a8c5f | 26 | } |
ansond | 134:58e7537a8c5f | 27 | |
ansond | 134:58e7537a8c5f | 28 | // default destructor |
ansond | 134:58e7537a8c5f | 29 | BaseClass::~BaseClass() { |
ansond | 134:58e7537a8c5f | 30 | } |
ansond | 134:58e7537a8c5f | 31 | |
ansond | 192:54b758a8eaaa | 32 | // Logger accessor |
ansond | 192:54b758a8eaaa | 33 | Logger *BaseClass::logger() { return this->m_logger; } |
ansond | 134:58e7537a8c5f | 34 | |
ansond | 134:58e7537a8c5f | 35 | // Endpoint accessor |
ansond | 135:7f3f963cd159 | 36 | void *BaseClass::getEndpoint() { return this->m_endpoint; } |
ansond | 135:7f3f963cd159 | 37 | void BaseClass::setEndpoint(void *endpoint) { this->m_endpoint = endpoint; } |
ansond | 135:7f3f963cd159 | 38 | |
ansond | 135:7f3f963cd159 | 39 | // min function |
ansond | 135:7f3f963cd159 | 40 | int BaseClass::min(int value1,int value2) { |
ansond | 135:7f3f963cd159 | 41 | if (value1 < value2) return value1; |
ansond | 135:7f3f963cd159 | 42 | return value2; |
ansond | 135:7f3f963cd159 | 43 | } |