Simulated product dispenser

Dependencies:   HTS221

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

Committer:
JimCarver
Date:
Thu Oct 25 14:00:12 2018 +0000
Revision:
4:e518dde96e59
Parent:
0:6b753f761943
Simulated dispenser

Who changed what in which revision?

UserRevisionLine numberNew contents of line
JimCarver 0:6b753f761943 1 // ----------------------------------------------------------------------------
JimCarver 0:6b753f761943 2 // Copyright 2016-2018 ARM Ltd.
JimCarver 0:6b753f761943 3 //
JimCarver 0:6b753f761943 4 // SPDX-License-Identifier: Apache-2.0
JimCarver 0:6b753f761943 5 //
JimCarver 0:6b753f761943 6 // Licensed under the Apache License, Version 2.0 (the "License");
JimCarver 0:6b753f761943 7 // you may not use this file except in compliance with the License.
JimCarver 0:6b753f761943 8 // You may obtain a copy of the License at
JimCarver 0:6b753f761943 9 //
JimCarver 0:6b753f761943 10 // http://www.apache.org/licenses/LICENSE-2.0
JimCarver 0:6b753f761943 11 //
JimCarver 0:6b753f761943 12 // Unless required by applicable law or agreed to in writing, software
JimCarver 0:6b753f761943 13 // distributed under the License is distributed on an "AS IS" BASIS,
JimCarver 0:6b753f761943 14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
JimCarver 0:6b753f761943 15 // See the License for the specific language governing permissions and
JimCarver 0:6b753f761943 16 // limitations under the License.
JimCarver 0:6b753f761943 17 // ----------------------------------------------------------------------------
JimCarver 0:6b753f761943 18
JimCarver 0:6b753f761943 19 #ifndef RESOURCE_H
JimCarver 0:6b753f761943 20 #define RESOURCE_H
JimCarver 0:6b753f761943 21
JimCarver 0:6b753f761943 22
JimCarver 0:6b753f761943 23 /**
JimCarver 0:6b753f761943 24 * \brief Helper function for creating different kind of resources.
JimCarver 0:6b753f761943 25 * The path of the resource will be "object_id/instance_id/resource_id"
JimCarver 0:6b753f761943 26 * For example if object_id = 1, instance_id = 2, resource_id = 3
JimCarver 0:6b753f761943 27 * the path would be 1/2/3
JimCarver 0:6b753f761943 28 *
JimCarver 0:6b753f761943 29 * \param list Pointer to the object list,
JimCarver 0:6b753f761943 30 * contains objects to be registered to the server.
JimCarver 0:6b753f761943 31 * \param object_id Name of the object in integer format.
JimCarver 0:6b753f761943 32 * \param instance_id Name of the instance in integer format.
JimCarver 0:6b753f761943 33 * \param resource_id Name of the resource in integer format.
JimCarver 0:6b753f761943 34 * \param resource_type Resource type name.
JimCarver 0:6b753f761943 35 * \param data_type Data type of the resource value.
JimCarver 0:6b753f761943 36 * \param allowed Methods allowed for accessing this resource.
JimCarver 0:6b753f761943 37 * \param value Resource value as a null terminated string.
JimCarver 0:6b753f761943 38 * May be set as NULL.
JimCarver 0:6b753f761943 39 * \param observable Resource set observable if true.
JimCarver 0:6b753f761943 40 * \param cb Function pointer to either:
JimCarver 0:6b753f761943 41 * value_updated_callback2 if allowed & GET_PUT_ALLOWED
JimCarver 0:6b753f761943 42 * OR
JimCarver 0:6b753f761943 43 * execute_callback_2 in if allowed & POST_ALLOWED.
JimCarver 0:6b753f761943 44 * In other cases this parameter is ignored.
JimCarver 0:6b753f761943 45 *
JimCarver 0:6b753f761943 46 * NOTE: This function is not designed to support setting both
JimCarver 0:6b753f761943 47 * GET_PUT_ALLOWED and POST_ALLOWED for parameter allowed
JimCarver 0:6b753f761943 48 * at the same time.
JimCarver 0:6b753f761943 49 * \param notification_status_cb Function pointer to notification_delivery_status_cb
JimCarver 0:6b753f761943 50 * if resource is set to be observable.
JimCarver 0:6b753f761943 51 */
JimCarver 0:6b753f761943 52 M2MResource* add_resource(M2MObjectList *list,
JimCarver 0:6b753f761943 53 uint16_t object_id,
JimCarver 0:6b753f761943 54 uint16_t instance_id,
JimCarver 0:6b753f761943 55 uint16_t resource_id,
JimCarver 0:6b753f761943 56 const char *resource_type,
JimCarver 0:6b753f761943 57 M2MResourceInstance::ResourceType data_type,
JimCarver 0:6b753f761943 58 M2MBase::Operation allowed,
JimCarver 0:6b753f761943 59 const char *value,
JimCarver 0:6b753f761943 60 bool observable,
JimCarver 0:6b753f761943 61 Callback<void(const char*)> *put_cb,
JimCarver 0:6b753f761943 62 Callback<void(void*)> *post_cb,
JimCarver 0:6b753f761943 63 Callback<void(const M2MBase&, const NoticationDeliveryStatus)> *notification_status_cb);
JimCarver 0:6b753f761943 64
JimCarver 0:6b753f761943 65 #endif //RESOURCE_H