Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbedConnectorInterfaceWithDM by
ResourceObserver.cpp
00001 /** 00002 * @file ResourceObserver.cpp 00003 * @brief mbed CoAP DynamicResource observer (implementation) 00004 * @author Doug Anson/Chris Paola 00005 * @version 1.0 00006 * @see 00007 * 00008 * Copyright (c) 2014 00009 * 00010 * Licensed under the Apache License, Version 2.0 (the "License"); 00011 * you may not use this file except in compliance with the License. 00012 * You may obtain a copy of the License at 00013 * 00014 * http://www.apache.org/licenses/LICENSE-2.0 00015 * 00016 * Unless required by applicable law or agreed to in writing, software 00017 * distributed under the License is distributed on an "AS IS" BASIS, 00018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00019 * See the License for the specific language governing permissions and 00020 * limitations under the License. 00021 */ 00022 00023 // Class support 00024 #include "mbed-connector-interface/ResourceObserver.h" 00025 00026 // constructor 00027 ResourceObserver::ResourceObserver(DynamicResource *resource,int sleep_time) : m_is_observing(false), m_sleep_time(sleep_time) { 00028 this->m_resource = resource; 00029 if (resource != NULL) resource->setObserver(this); 00030 } 00031 00032 // copy constructor 00033 ResourceObserver::ResourceObserver(const ResourceObserver &observer) { 00034 this->m_resource = observer.m_resource; 00035 } 00036 00037 // destructor 00038 ResourceObserver::~ResourceObserver() { 00039 } 00040 00041 // get our resource 00042 DynamicResource *ResourceObserver::getResource() { 00043 return this->m_resource; 00044 } 00045 00046 // we are observing? 00047 bool ResourceObserver::isObserving() { 00048 return this->m_is_observing; 00049 } 00050 00051 // set our observation state 00052 void ResourceObserver::setObserving(bool observing) { 00053 this->m_is_observing = observing; 00054 } 00055 00056 // get our sleep time 00057 int ResourceObserver::getSleepTime() { 00058 return this->m_sleep_time; 00059 } 00060 00061 // halt the underlying observer mechanism 00062 void ResourceObserver::halt() { 00063 } 00064 00065 // get our logger instance 00066 Logger *ResourceObserver::logger() { 00067 if (this->m_resource != NULL) { 00068 return this->m_resource->logger(); 00069 } 00070 return NULL; 00071 }
Generated on Wed Jul 13 2022 01:24:02 by
