Simulated product dispenser

Dependencies:   HTS221

Fork of mbed-cloud-workshop-connect-HTS221 by Jim Carver

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers m2mobservationhandler.h Source File

m2mobservationhandler.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2015 ARM Limited. All rights reserved.
00003  * SPDX-License-Identifier: Apache-2.0
00004  * Licensed under the Apache License, Version 2.0 (the License); you may
00005  * 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, WITHOUT
00012  * 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 #ifndef M2M_OBSERVATION_HANDLER_H
00017 #define M2M_OBSERVATION_HANDLER_H
00018 
00019 //FORWARD DECLARATION
00020 class M2MBase;
00021 class M2MResourceInstance;
00022 
00023 /*! \file m2mobservationhandler.h
00024  * \brief M2MObservationHandler.
00025  * An interface for handling observation
00026  * callbacks from different objects.
00027  *
00028  */
00029 class M2MObservationHandler
00030 {
00031   public:
00032 
00033     /**
00034      * \brief The observation callback to be sent to the
00035      * server due to a change in a parameter under observation.
00036      * \param object The observed object whose information needs to be sent.
00037      * \param obs_number The observation number.
00038      * \param changed_instance_ids A list of changed object instance IDs.
00039      * \param send_object Indicates whether the whole object will be sent or not.
00040      *
00041      * \return True if the message was send, False if there is already ongoing notification.
00042      */
00043     virtual bool observation_to_be_sent(M2MBase *object,
00044                                         uint16_t obs_number,
00045                                         const m2m::Vector<uint16_t> &changed_instance_ids,
00046                                         bool send_object = false) = 0;
00047 
00048     /**
00049      * \brief A callback for removing an NSDL resource from the data structures.
00050      * \param The M2MBase derived observed object whose information
00051      * needs to be removed.
00052      */
00053     virtual void resource_to_be_deleted(M2MBase *base) = 0;
00054 
00055     /**
00056      * \brief A callback indicating that the value of the resource object is updated by server.
00057      * \param base The object whose value is updated.
00058      * \param object_name The name of the updated resource, default is empty.
00059      */
00060     virtual void value_updated(M2MBase *base) = 0;
00061 
00062     /**
00063      * \brief A callback for removing an object from the list.
00064      * \param object The M2MObject to be removed.
00065      */
00066     virtual void remove_object(M2MBase *object) = 0;
00067 
00068 #ifndef DISABLE_DELAYED_RESPONSE
00069     /**
00070      * \brief A delayed response callback to be sent to the
00071      * server due to a changed response.
00072      * \param base The resource sending the response.
00073      */
00074     virtual void send_delayed_response(M2MBase *base) = 0;
00075 #endif
00076 };
00077 
00078 
00079 #endif // M2M_OBSERVATION_HANDLER_H