mbed client on ethernet with LWIP

Dependencies:   mbed Socket lwip-eth lwip-sys lwip

Fork of mbed-client-classic-example-lwip by sandbox

Committer:
mbedAustin
Date:
Thu Jun 09 17:08:36 2016 +0000
Revision:
11:cada08fc8a70
Commit for public Consumption

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbedAustin 11:cada08fc8a70 1 /*
mbedAustin 11:cada08fc8a70 2 * Copyright (c) 2015 ARM Limited. All rights reserved.
mbedAustin 11:cada08fc8a70 3 * SPDX-License-Identifier: Apache-2.0
mbedAustin 11:cada08fc8a70 4 * Licensed under the Apache License, Version 2.0 (the License); you may
mbedAustin 11:cada08fc8a70 5 * not use this file except in compliance with the License.
mbedAustin 11:cada08fc8a70 6 * You may obtain a copy of the License at
mbedAustin 11:cada08fc8a70 7 *
mbedAustin 11:cada08fc8a70 8 * http://www.apache.org/licenses/LICENSE-2.0
mbedAustin 11:cada08fc8a70 9 *
mbedAustin 11:cada08fc8a70 10 * Unless required by applicable law or agreed to in writing, software
mbedAustin 11:cada08fc8a70 11 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
mbedAustin 11:cada08fc8a70 12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
mbedAustin 11:cada08fc8a70 13 * See the License for the specific language governing permissions and
mbedAustin 11:cada08fc8a70 14 * limitations under the License.
mbedAustin 11:cada08fc8a70 15 */
mbedAustin 11:cada08fc8a70 16 #include "mbed-client/m2mvector.h"
mbedAustin 11:cada08fc8a70 17 #include "mbed-client/m2mobject.h"
mbedAustin 11:cada08fc8a70 18 #include "mbed-client/m2mobjectinstance.h"
mbedAustin 11:cada08fc8a70 19 #include "mbed-client/m2mresource.h"
mbedAustin 11:cada08fc8a70 20
mbedAustin 11:cada08fc8a70 21 /**
mbedAustin 11:cada08fc8a70 22 * @brief M2MTLVSerializer
mbedAustin 11:cada08fc8a70 23 * TLV Serialiser constructs the binary representation of object instances,
mbedAustin 11:cada08fc8a70 24 * resources and resource instances (see OMA-LWM2M specification, chapter 6.1
mbedAustin 11:cada08fc8a70 25 * for resource model) as OMA-TLV according described in chapter 6.3.3.
mbedAustin 11:cada08fc8a70 26 *
mbedAustin 11:cada08fc8a70 27 */
mbedAustin 11:cada08fc8a70 28 class M2MTLVSerializer {
mbedAustin 11:cada08fc8a70 29
mbedAustin 11:cada08fc8a70 30 public:
mbedAustin 11:cada08fc8a70 31
mbedAustin 11:cada08fc8a70 32 /**
mbedAustin 11:cada08fc8a70 33 * Constructor.
mbedAustin 11:cada08fc8a70 34 */
mbedAustin 11:cada08fc8a70 35 M2MTLVSerializer();
mbedAustin 11:cada08fc8a70 36
mbedAustin 11:cada08fc8a70 37 /**
mbedAustin 11:cada08fc8a70 38 * Destructor.
mbedAustin 11:cada08fc8a70 39 */
mbedAustin 11:cada08fc8a70 40 virtual ~M2MTLVSerializer();
mbedAustin 11:cada08fc8a70 41
mbedAustin 11:cada08fc8a70 42 /**
mbedAustin 11:cada08fc8a70 43 * Serialises given objects instances that contain resources or multiple
mbedAustin 11:cada08fc8a70 44 * resources. Object instance IDs are also encoded. This method must be
mbedAustin 11:cada08fc8a70 45 * used when an operation targets an object with (potential) multiple
mbedAustin 11:cada08fc8a70 46 * instances like "GET /1". In that case the generated TLV will contain the
mbedAustin 11:cada08fc8a70 47 * following data:
mbedAustin 11:cada08fc8a70 48 * <ul>
mbedAustin 11:cada08fc8a70 49 * <li> ./0
mbedAustin 11:cada08fc8a70 50 * <li> ./0/0
mbedAustin 11:cada08fc8a70 51 * <li> ./0/1
mbedAustin 11:cada08fc8a70 52 * <li> ...
mbedAustin 11:cada08fc8a70 53 * <li> ./1
mbedAustin 11:cada08fc8a70 54 * <li> ./1/0
mbedAustin 11:cada08fc8a70 55 * <li> ./1/1
mbedAustin 11:cada08fc8a70 56 * <li> ...
mbedAustin 11:cada08fc8a70 57 * </ul>
mbedAustin 11:cada08fc8a70 58 *
mbedAustin 11:cada08fc8a70 59 * @param objects List of object instances.
mbedAustin 11:cada08fc8a70 60 * @return Object instances encoded binary as OMA-TLV
mbedAustin 11:cada08fc8a70 61 * @see #serializeObjectInstances(List)
mbedAustin 11:cada08fc8a70 62 */
mbedAustin 11:cada08fc8a70 63 uint8_t* serialize(M2MObjectInstanceList object_instance_list, uint32_t &size);
mbedAustin 11:cada08fc8a70 64
mbedAustin 11:cada08fc8a70 65 /**
mbedAustin 11:cada08fc8a70 66 * Serialises given resources with no information about the parent object
mbedAustin 11:cada08fc8a70 67 * instance. This method must be used when an operation targets an object
mbedAustin 11:cada08fc8a70 68 * instance like "GET /1/0" or a single-instance object like "GET /3//".
mbedAustin 11:cada08fc8a70 69 * Resources may have single or multiple instances. The generated TLV will
mbedAustin 11:cada08fc8a70 70 * contain the following data as response to "GET /3//":
mbedAustin 11:cada08fc8a70 71 * <ul>
mbedAustin 11:cada08fc8a70 72 * <li> ./0
mbedAustin 11:cada08fc8a70 73 * <li> ./1
mbedAustin 11:cada08fc8a70 74 * <li> ./2
mbedAustin 11:cada08fc8a70 75 * <li> ./6/0 (1st instance of a multiple resource)
mbedAustin 11:cada08fc8a70 76 * <li> ./6/1 (2nd instance of a multiple resource)
mbedAustin 11:cada08fc8a70 77 * <li> ...
mbedAustin 11:cada08fc8a70 78 * </ul>
mbedAustin 11:cada08fc8a70 79 * @param resources Array of resources and resource instances.
mbedAustin 11:cada08fc8a70 80 * @return Resources encoded binary as OMA-TLV
mbedAustin 11:cada08fc8a70 81 * @see #serializeResources(List)
mbedAustin 11:cada08fc8a70 82 */
mbedAustin 11:cada08fc8a70 83 uint8_t* serialize(M2MResourceList resource_list, uint32_t &size);
mbedAustin 11:cada08fc8a70 84
mbedAustin 11:cada08fc8a70 85 uint8_t* serialize(M2MResource *resource, uint32_t &size);
mbedAustin 11:cada08fc8a70 86
mbedAustin 11:cada08fc8a70 87 private :
mbedAustin 11:cada08fc8a70 88
mbedAustin 11:cada08fc8a70 89 uint8_t* serialize_object_instances(M2MObjectInstanceList object_instance_list, uint32_t &size);
mbedAustin 11:cada08fc8a70 90
mbedAustin 11:cada08fc8a70 91 uint8_t* serialize_resources(M2MResourceList resource_list, uint32_t &size, bool &valid);
mbedAustin 11:cada08fc8a70 92
mbedAustin 11:cada08fc8a70 93 void serialize(uint16_t id, M2MObjectInstance *object_instance, uint8_t *&data, uint32_t &size);
mbedAustin 11:cada08fc8a70 94
mbedAustin 11:cada08fc8a70 95 bool serialize (M2MResource *resource, uint8_t *&data, uint32_t &size);
mbedAustin 11:cada08fc8a70 96
mbedAustin 11:cada08fc8a70 97 bool serialize_resource(M2MResource *resource, uint8_t *&data, uint32_t &size);
mbedAustin 11:cada08fc8a70 98
mbedAustin 11:cada08fc8a70 99 bool serialize_multiple_resource(M2MResource *resource, uint8_t *&data, uint32_t &size);
mbedAustin 11:cada08fc8a70 100
mbedAustin 11:cada08fc8a70 101 void serialize_resource_instance(uint16_t id, M2MResourceInstance *resource, uint8_t *&data, uint32_t &size);
mbedAustin 11:cada08fc8a70 102
mbedAustin 11:cada08fc8a70 103 void serialize_TILV (uint8_t type, uint16_t id, uint8_t *value, uint32_t value_length, uint8_t *&data, uint32_t &size);
mbedAustin 11:cada08fc8a70 104
mbedAustin 11:cada08fc8a70 105 uint8_t* serialize_id(uint16_t id, uint32_t &size);
mbedAustin 11:cada08fc8a70 106
mbedAustin 11:cada08fc8a70 107 uint8_t* serialize_length(uint32_t length, uint32_t &size);
mbedAustin 11:cada08fc8a70 108 };