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