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 resource.h Source File

resource.h

00001 // ----------------------------------------------------------------------------
00002 // Copyright 2016-2018 ARM Ltd.
00003 //
00004 // SPDX-License-Identifier: Apache-2.0
00005 //
00006 // Licensed under the Apache License, Version 2.0 (the "License");
00007 // you may not use this file except in compliance with the License.
00008 // You may obtain a copy of the License at
00009 //
00010 //     http://www.apache.org/licenses/LICENSE-2.0
00011 //
00012 // Unless required by applicable law or agreed to in writing, software
00013 // distributed under the License is distributed on an "AS IS" BASIS,
00014 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015 // See the License for the specific language governing permissions and
00016 // limitations under the License.
00017 // ----------------------------------------------------------------------------
00018 
00019 #ifndef RESOURCE_H
00020 #define RESOURCE_H
00021 
00022 
00023 /**
00024  * \brief Helper function for creating different kind of resources.
00025  *        The path of the resource will be "object_id/instance_id/resource_id"
00026  *        For example if object_id = 1, instance_id = 2, resource_id = 3
00027  *        the path would be 1/2/3
00028  *
00029  * \param list Pointer to the object list,
00030  *             contains objects to be registered to the server.
00031  * \param object_id Name of the object in integer format.
00032  * \param instance_id Name of the instance in integer format.
00033  * \param resource_id Name of the resource in integer format.
00034  * \param resource_type Resource type name.
00035  * \param data_type Data type of the resource value.
00036  * \param allowed Methods allowed for accessing this resource.
00037  * \param value Resource value as a null terminated string.
00038  *              May be set as NULL.
00039  * \param observable Resource set observable if true.
00040  * \param cb Function pointer to either:
00041  *           value_updated_callback2 if allowed & GET_PUT_ALLOWED
00042  *           OR
00043  *           execute_callback_2 in if allowed & POST_ALLOWED.
00044  *           In other cases this parameter is ignored.
00045  *
00046  *        NOTE: This function is not designed to support setting both
00047  *              GET_PUT_ALLOWED and POST_ALLOWED for parameter allowed
00048  *              at the same time.
00049  * \param notification_status_cb Function pointer to notification_delivery_status_cb
00050  *          if resource is set to be observable.
00051  */
00052 M2MResource* add_resource(M2MObjectList *list,
00053                           uint16_t object_id,
00054                           uint16_t instance_id,
00055                           uint16_t resource_id,
00056                           const char *resource_type,
00057                           M2MResourceInstance::ResourceType data_type,
00058                           M2MBase::Operation allowed,
00059                           const char *value,
00060                           bool observable,
00061                           Callback<void(const char*)> *put_cb,
00062                           Callback<void(void*)> *post_cb,
00063                           Callback<void(const M2MBase&, const NoticationDeliveryStatus)> *notification_status_cb);
00064 
00065 #endif //RESOURCE_H