Ram Gandikota
/
IOTMetronome
FRDM K64F Metronome
mbed-client/test/mbedclient/utest/m2mtlvdeserializer/test_m2mtlvserializer.cpp@0:dbad57390bd1, 2017-05-14 (annotated)
- Committer:
- ram54288
- Date:
- Sun May 14 18:37:05 2017 +0000
- Revision:
- 0:dbad57390bd1
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ram54288 | 0:dbad57390bd1 | 1 | /* |
ram54288 | 0:dbad57390bd1 | 2 | * Copyright (c) 2015 ARM Limited. All rights reserved. |
ram54288 | 0:dbad57390bd1 | 3 | * SPDX-License-Identifier: Apache-2.0 |
ram54288 | 0:dbad57390bd1 | 4 | * Licensed under the Apache License, Version 2.0 (the License); you may |
ram54288 | 0:dbad57390bd1 | 5 | * not use this file except in compliance with the License. |
ram54288 | 0:dbad57390bd1 | 6 | * You may obtain a copy of the License at |
ram54288 | 0:dbad57390bd1 | 7 | * |
ram54288 | 0:dbad57390bd1 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
ram54288 | 0:dbad57390bd1 | 9 | * |
ram54288 | 0:dbad57390bd1 | 10 | * Unless required by applicable law or agreed to in writing, software |
ram54288 | 0:dbad57390bd1 | 11 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT |
ram54288 | 0:dbad57390bd1 | 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
ram54288 | 0:dbad57390bd1 | 13 | * See the License for the specific language governing permissions and |
ram54288 | 0:dbad57390bd1 | 14 | * limitations under the License. |
ram54288 | 0:dbad57390bd1 | 15 | */ |
ram54288 | 0:dbad57390bd1 | 16 | #include "CppUTest/TestHarness.h" |
ram54288 | 0:dbad57390bd1 | 17 | #include "test_m2mtlvserializer.h" |
ram54288 | 0:dbad57390bd1 | 18 | #include "m2mobject_stub.h" |
ram54288 | 0:dbad57390bd1 | 19 | #include "m2mobjectinstance_stub.h" |
ram54288 | 0:dbad57390bd1 | 20 | #include "m2mresource_stub.h" |
ram54288 | 0:dbad57390bd1 | 21 | #include "m2mresourceinstance_stub.h" |
ram54288 | 0:dbad57390bd1 | 22 | #include "m2mbase_stub.h" |
ram54288 | 0:dbad57390bd1 | 23 | |
ram54288 | 0:dbad57390bd1 | 24 | |
ram54288 | 0:dbad57390bd1 | 25 | Test_M2MTLVSerializer::Test_M2MTLVSerializer() |
ram54288 | 0:dbad57390bd1 | 26 | { |
ram54288 | 0:dbad57390bd1 | 27 | serializer = new M2MTLVSerializer(); |
ram54288 | 0:dbad57390bd1 | 28 | } |
ram54288 | 0:dbad57390bd1 | 29 | |
ram54288 | 0:dbad57390bd1 | 30 | Test_M2MTLVSerializer::~Test_M2MTLVSerializer() |
ram54288 | 0:dbad57390bd1 | 31 | { |
ram54288 | 0:dbad57390bd1 | 32 | delete serializer; |
ram54288 | 0:dbad57390bd1 | 33 | } |
ram54288 | 0:dbad57390bd1 | 34 | |
ram54288 | 0:dbad57390bd1 | 35 | void Test_M2MTLVSerializer::test_serialize_object() |
ram54288 | 0:dbad57390bd1 | 36 | { |
ram54288 | 0:dbad57390bd1 | 37 | uint32_t size = 0; |
ram54288 | 0:dbad57390bd1 | 38 | uint8_t *data = 0; |
ram54288 | 0:dbad57390bd1 | 39 | |
ram54288 | 0:dbad57390bd1 | 40 | M2MObject *object = new M2MObject("1", "1"); |
ram54288 | 0:dbad57390bd1 | 41 | M2MObjectInstance* instance = new M2MObjectInstance(*object,"1", "type", "1"); |
ram54288 | 0:dbad57390bd1 | 42 | |
ram54288 | 0:dbad57390bd1 | 43 | m2mobject_stub::instance_list.push_back(instance); |
ram54288 | 0:dbad57390bd1 | 44 | |
ram54288 | 0:dbad57390bd1 | 45 | |
ram54288 | 0:dbad57390bd1 | 46 | |
ram54288 | 0:dbad57390bd1 | 47 | M2MResource* resource = new M2MResource(*instance, |
ram54288 | 0:dbad57390bd1 | 48 | "1", |
ram54288 | 0:dbad57390bd1 | 49 | "type", |
ram54288 | 0:dbad57390bd1 | 50 | M2MResourceInstance::INTEGER, |
ram54288 | 0:dbad57390bd1 | 51 | false, |
ram54288 | 0:dbad57390bd1 | 52 | "1"); |
ram54288 | 0:dbad57390bd1 | 53 | |
ram54288 | 0:dbad57390bd1 | 54 | |
ram54288 | 0:dbad57390bd1 | 55 | m2mobjectinstance_stub::resource_list.push_back(resource); |
ram54288 | 0:dbad57390bd1 | 56 | |
ram54288 | 0:dbad57390bd1 | 57 | m2mbase_stub::name_id_value = 0; |
ram54288 | 0:dbad57390bd1 | 58 | data = serializer->serialize( m2mobject_stub::instance_list,size); |
ram54288 | 0:dbad57390bd1 | 59 | CHECK(data != NULL); |
ram54288 | 0:dbad57390bd1 | 60 | |
ram54288 | 0:dbad57390bd1 | 61 | if(data) { |
ram54288 | 0:dbad57390bd1 | 62 | free(data); |
ram54288 | 0:dbad57390bd1 | 63 | data = 0; |
ram54288 | 0:dbad57390bd1 | 64 | } |
ram54288 | 0:dbad57390bd1 | 65 | |
ram54288 | 0:dbad57390bd1 | 66 | M2MResourceInstance* res_instance = new M2MResourceInstance(*m2mobjectinstance_stub::resource, |
ram54288 | 0:dbad57390bd1 | 67 | "1", |
ram54288 | 0:dbad57390bd1 | 68 | "type", |
ram54288 | 0:dbad57390bd1 | 69 | M2MResourceInstance::STRING, |
ram54288 | 0:dbad57390bd1 | 70 | 0, |
ram54288 | 0:dbad57390bd1 | 71 | "1", |
ram54288 | 0:dbad57390bd1 | 72 | false); |
ram54288 | 0:dbad57390bd1 | 73 | |
ram54288 | 0:dbad57390bd1 | 74 | M2MResourceInstance* res_instance_1 = new M2MResourceInstance(*m2mobjectinstance_stub::resource, |
ram54288 | 0:dbad57390bd1 | 75 | "2", |
ram54288 | 0:dbad57390bd1 | 76 | "type", |
ram54288 | 0:dbad57390bd1 | 77 | M2MResourceInstance::STRING, |
ram54288 | 0:dbad57390bd1 | 78 | 0, |
ram54288 | 0:dbad57390bd1 | 79 | "2", |
ram54288 | 0:dbad57390bd1 | 80 | false); |
ram54288 | 0:dbad57390bd1 | 81 | |
ram54288 | 0:dbad57390bd1 | 82 | |
ram54288 | 0:dbad57390bd1 | 83 | m2mresource_stub::bool_value = true; |
ram54288 | 0:dbad57390bd1 | 84 | m2mresource_stub::list.push_back(res_instance); |
ram54288 | 0:dbad57390bd1 | 85 | m2mresource_stub::list.push_back(res_instance_1); |
ram54288 | 0:dbad57390bd1 | 86 | data = serializer->serialize( m2mobject_stub::instance_list,size); |
ram54288 | 0:dbad57390bd1 | 87 | CHECK(data != NULL); |
ram54288 | 0:dbad57390bd1 | 88 | |
ram54288 | 0:dbad57390bd1 | 89 | if(data) { |
ram54288 | 0:dbad57390bd1 | 90 | free(data); |
ram54288 | 0:dbad57390bd1 | 91 | data = 0; |
ram54288 | 0:dbad57390bd1 | 92 | } |
ram54288 | 0:dbad57390bd1 | 93 | |
ram54288 | 0:dbad57390bd1 | 94 | m2mbase_stub::name_id_value = 256; |
ram54288 | 0:dbad57390bd1 | 95 | |
ram54288 | 0:dbad57390bd1 | 96 | m2mresourceinstance_stub::int_value = 6; |
ram54288 | 0:dbad57390bd1 | 97 | m2mresourceinstance_stub::value = (uint8_t*) malloc(m2mresourceinstance_stub::int_value); |
ram54288 | 0:dbad57390bd1 | 98 | data = serializer->serialize( m2mobject_stub::instance_list,size); |
ram54288 | 0:dbad57390bd1 | 99 | CHECK(data != NULL); |
ram54288 | 0:dbad57390bd1 | 100 | |
ram54288 | 0:dbad57390bd1 | 101 | if(data) { |
ram54288 | 0:dbad57390bd1 | 102 | free(data); |
ram54288 | 0:dbad57390bd1 | 103 | data = 0; |
ram54288 | 0:dbad57390bd1 | 104 | } |
ram54288 | 0:dbad57390bd1 | 105 | free(m2mresourceinstance_stub::value); |
ram54288 | 0:dbad57390bd1 | 106 | m2mresourceinstance_stub::value = NULL; |
ram54288 | 0:dbad57390bd1 | 107 | |
ram54288 | 0:dbad57390bd1 | 108 | m2mresourceinstance_stub::int_value = 256; |
ram54288 | 0:dbad57390bd1 | 109 | m2mresourceinstance_stub::value = (uint8_t*) malloc(m2mresourceinstance_stub::int_value); |
ram54288 | 0:dbad57390bd1 | 110 | data = serializer->serialize( m2mobject_stub::instance_list,size); |
ram54288 | 0:dbad57390bd1 | 111 | CHECK(data != NULL); |
ram54288 | 0:dbad57390bd1 | 112 | |
ram54288 | 0:dbad57390bd1 | 113 | if(data) { |
ram54288 | 0:dbad57390bd1 | 114 | free(data); |
ram54288 | 0:dbad57390bd1 | 115 | data = 0; |
ram54288 | 0:dbad57390bd1 | 116 | } |
ram54288 | 0:dbad57390bd1 | 117 | free(m2mresourceinstance_stub::value); |
ram54288 | 0:dbad57390bd1 | 118 | m2mresourceinstance_stub::value = NULL; |
ram54288 | 0:dbad57390bd1 | 119 | |
ram54288 | 0:dbad57390bd1 | 120 | m2mresourceinstance_stub::int_value = 65536; |
ram54288 | 0:dbad57390bd1 | 121 | m2mresourceinstance_stub::value = (uint8_t*) malloc(m2mresourceinstance_stub::int_value); |
ram54288 | 0:dbad57390bd1 | 122 | data = serializer->serialize( m2mobject_stub::instance_list,size); |
ram54288 | 0:dbad57390bd1 | 123 | CHECK(data != NULL); |
ram54288 | 0:dbad57390bd1 | 124 | |
ram54288 | 0:dbad57390bd1 | 125 | if(data) { |
ram54288 | 0:dbad57390bd1 | 126 | free(data); |
ram54288 | 0:dbad57390bd1 | 127 | data = 0; |
ram54288 | 0:dbad57390bd1 | 128 | } |
ram54288 | 0:dbad57390bd1 | 129 | |
ram54288 | 0:dbad57390bd1 | 130 | m2mbase_stub::name_id_value = -1; |
ram54288 | 0:dbad57390bd1 | 131 | data = serializer->serialize( m2mobject_stub::instance_list,size); |
ram54288 | 0:dbad57390bd1 | 132 | CHECK(data == NULL); |
ram54288 | 0:dbad57390bd1 | 133 | |
ram54288 | 0:dbad57390bd1 | 134 | delete res_instance_1; |
ram54288 | 0:dbad57390bd1 | 135 | delete res_instance; |
ram54288 | 0:dbad57390bd1 | 136 | delete resource; |
ram54288 | 0:dbad57390bd1 | 137 | delete instance; |
ram54288 | 0:dbad57390bd1 | 138 | delete object; |
ram54288 | 0:dbad57390bd1 | 139 | |
ram54288 | 0:dbad57390bd1 | 140 | free(m2mresourceinstance_stub::value); |
ram54288 | 0:dbad57390bd1 | 141 | |
ram54288 | 0:dbad57390bd1 | 142 | m2mresourceinstance_stub::clear(); |
ram54288 | 0:dbad57390bd1 | 143 | m2mresource_stub::clear(); |
ram54288 | 0:dbad57390bd1 | 144 | m2mobjectinstance_stub::clear(); |
ram54288 | 0:dbad57390bd1 | 145 | m2mobject_stub::clear(); |
ram54288 | 0:dbad57390bd1 | 146 | } |
ram54288 | 0:dbad57390bd1 | 147 | |
ram54288 | 0:dbad57390bd1 | 148 | void Test_M2MTLVSerializer::test_serialize_object_instance() |
ram54288 | 0:dbad57390bd1 | 149 | { |
ram54288 | 0:dbad57390bd1 | 150 | M2MObject *object = new M2MObject("1", "1"); |
ram54288 | 0:dbad57390bd1 | 151 | M2MObjectInstance* instance = new M2MObjectInstance(*object,"1","type", "1"); |
ram54288 | 0:dbad57390bd1 | 152 | |
ram54288 | 0:dbad57390bd1 | 153 | uint32_t size = 0; |
ram54288 | 0:dbad57390bd1 | 154 | uint8_t *data = 0; |
ram54288 | 0:dbad57390bd1 | 155 | m2mbase_stub::name_id_value = 0; |
ram54288 | 0:dbad57390bd1 | 156 | M2MResource* resource = new M2MResource(*instance, |
ram54288 | 0:dbad57390bd1 | 157 | "1", |
ram54288 | 0:dbad57390bd1 | 158 | "type", |
ram54288 | 0:dbad57390bd1 | 159 | M2MResourceInstance::STRING, |
ram54288 | 0:dbad57390bd1 | 160 | false, |
ram54288 | 0:dbad57390bd1 | 161 | "1"); |
ram54288 | 0:dbad57390bd1 | 162 | |
ram54288 | 0:dbad57390bd1 | 163 | M2MResourceInstance* res_instance = new M2MResourceInstance(*resource, |
ram54288 | 0:dbad57390bd1 | 164 | "1", |
ram54288 | 0:dbad57390bd1 | 165 | "type", |
ram54288 | 0:dbad57390bd1 | 166 | M2MResourceInstance::STRING, |
ram54288 | 0:dbad57390bd1 | 167 | 0, |
ram54288 | 0:dbad57390bd1 | 168 | "1", |
ram54288 | 0:dbad57390bd1 | 169 | false); |
ram54288 | 0:dbad57390bd1 | 170 | |
ram54288 | 0:dbad57390bd1 | 171 | m2mobjectinstance_stub::resource_list.clear(); |
ram54288 | 0:dbad57390bd1 | 172 | m2mobjectinstance_stub::resource_list.push_back(resource); |
ram54288 | 0:dbad57390bd1 | 173 | |
ram54288 | 0:dbad57390bd1 | 174 | m2mresource_stub::bool_value = true; |
ram54288 | 0:dbad57390bd1 | 175 | m2mresource_stub::list.push_back(res_instance); |
ram54288 | 0:dbad57390bd1 | 176 | |
ram54288 | 0:dbad57390bd1 | 177 | m2mbase_stub::operation = M2MBase::GET_ALLOWED; |
ram54288 | 0:dbad57390bd1 | 178 | |
ram54288 | 0:dbad57390bd1 | 179 | data = serializer->serialize( m2mobjectinstance_stub::resource_list,size); |
ram54288 | 0:dbad57390bd1 | 180 | CHECK(data != NULL); |
ram54288 | 0:dbad57390bd1 | 181 | |
ram54288 | 0:dbad57390bd1 | 182 | if(data) { |
ram54288 | 0:dbad57390bd1 | 183 | free(data); |
ram54288 | 0:dbad57390bd1 | 184 | data = NULL; |
ram54288 | 0:dbad57390bd1 | 185 | } |
ram54288 | 0:dbad57390bd1 | 186 | |
ram54288 | 0:dbad57390bd1 | 187 | |
ram54288 | 0:dbad57390bd1 | 188 | m2mbase_stub::name_id_value = -1; |
ram54288 | 0:dbad57390bd1 | 189 | data = serializer->serialize( m2mobject_stub::instance_list,size); |
ram54288 | 0:dbad57390bd1 | 190 | CHECK(data == NULL); |
ram54288 | 0:dbad57390bd1 | 191 | |
ram54288 | 0:dbad57390bd1 | 192 | delete res_instance; |
ram54288 | 0:dbad57390bd1 | 193 | delete resource; |
ram54288 | 0:dbad57390bd1 | 194 | delete instance; |
ram54288 | 0:dbad57390bd1 | 195 | delete object; |
ram54288 | 0:dbad57390bd1 | 196 | |
ram54288 | 0:dbad57390bd1 | 197 | m2mresource_stub::clear(); |
ram54288 | 0:dbad57390bd1 | 198 | m2mobjectinstance_stub::clear(); |
ram54288 | 0:dbad57390bd1 | 199 | m2mobject_stub::clear(); |
ram54288 | 0:dbad57390bd1 | 200 | } |
ram54288 | 0:dbad57390bd1 | 201 | |
ram54288 | 0:dbad57390bd1 | 202 | void Test_M2MTLVSerializer::test_serialize_resource() |
ram54288 | 0:dbad57390bd1 | 203 | { |
ram54288 | 0:dbad57390bd1 | 204 | M2MObject *object = new M2MObject("1","1"); |
ram54288 | 0:dbad57390bd1 | 205 | M2MObjectInstance* instance =new M2MObjectInstance(*object,"1","type", "1"); |
ram54288 | 0:dbad57390bd1 | 206 | |
ram54288 | 0:dbad57390bd1 | 207 | uint32_t size = 0; |
ram54288 | 0:dbad57390bd1 | 208 | uint8_t *data = 0; |
ram54288 | 0:dbad57390bd1 | 209 | m2mbase_stub::name_id_value = 0; |
ram54288 | 0:dbad57390bd1 | 210 | M2MResource* resource = new M2MResource(*instance, |
ram54288 | 0:dbad57390bd1 | 211 | "1", |
ram54288 | 0:dbad57390bd1 | 212 | "type", |
ram54288 | 0:dbad57390bd1 | 213 | M2MResourceInstance::INTEGER, |
ram54288 | 0:dbad57390bd1 | 214 | false, |
ram54288 | 0:dbad57390bd1 | 215 | "1"); |
ram54288 | 0:dbad57390bd1 | 216 | |
ram54288 | 0:dbad57390bd1 | 217 | M2MResourceInstance* res_instance = new M2MResourceInstance(*resource, |
ram54288 | 0:dbad57390bd1 | 218 | "1", |
ram54288 | 0:dbad57390bd1 | 219 | "type", |
ram54288 | 0:dbad57390bd1 | 220 | M2MResourceInstance::INTEGER, |
ram54288 | 0:dbad57390bd1 | 221 | 0, |
ram54288 | 0:dbad57390bd1 | 222 | "1", |
ram54288 | 0:dbad57390bd1 | 223 | false); |
ram54288 | 0:dbad57390bd1 | 224 | |
ram54288 | 0:dbad57390bd1 | 225 | |
ram54288 | 0:dbad57390bd1 | 226 | m2mobjectinstance_stub::resource_list.clear(); |
ram54288 | 0:dbad57390bd1 | 227 | m2mobjectinstance_stub::resource_list.push_back(resource); |
ram54288 | 0:dbad57390bd1 | 228 | |
ram54288 | 0:dbad57390bd1 | 229 | m2mresource_stub::bool_value = true; |
ram54288 | 0:dbad57390bd1 | 230 | m2mresource_stub::list.push_back(res_instance); |
ram54288 | 0:dbad57390bd1 | 231 | |
ram54288 | 0:dbad57390bd1 | 232 | m2mbase_stub::operation = M2MBase::GET_ALLOWED; |
ram54288 | 0:dbad57390bd1 | 233 | |
ram54288 | 0:dbad57390bd1 | 234 | data = serializer->serialize( resource,size); |
ram54288 | 0:dbad57390bd1 | 235 | CHECK(data != NULL); |
ram54288 | 0:dbad57390bd1 | 236 | |
ram54288 | 0:dbad57390bd1 | 237 | if(data) { |
ram54288 | 0:dbad57390bd1 | 238 | free(data); |
ram54288 | 0:dbad57390bd1 | 239 | data = NULL; |
ram54288 | 0:dbad57390bd1 | 240 | } |
ram54288 | 0:dbad57390bd1 | 241 | |
ram54288 | 0:dbad57390bd1 | 242 | m2mbase_stub::name_id_value = -1; |
ram54288 | 0:dbad57390bd1 | 243 | data = serializer->serialize( m2mobject_stub::instance_list,size); |
ram54288 | 0:dbad57390bd1 | 244 | CHECK(data == NULL); |
ram54288 | 0:dbad57390bd1 | 245 | |
ram54288 | 0:dbad57390bd1 | 246 | delete res_instance; |
ram54288 | 0:dbad57390bd1 | 247 | delete resource; |
ram54288 | 0:dbad57390bd1 | 248 | delete instance; |
ram54288 | 0:dbad57390bd1 | 249 | delete object; |
ram54288 | 0:dbad57390bd1 | 250 | |
ram54288 | 0:dbad57390bd1 | 251 | m2mresource_stub::clear(); |
ram54288 | 0:dbad57390bd1 | 252 | m2mobjectinstance_stub::clear(); |
ram54288 | 0:dbad57390bd1 | 253 | m2mobject_stub::clear(); |
ram54288 | 0:dbad57390bd1 | 254 | } |
ram54288 | 0:dbad57390bd1 | 255 | |
ram54288 | 0:dbad57390bd1 | 256 | void Test_M2MTLVSerializer::test_serialize_resource_instance() |
ram54288 | 0:dbad57390bd1 | 257 | { |
ram54288 | 0:dbad57390bd1 | 258 | M2MObject *object = new M2MObject("1","1"); |
ram54288 | 0:dbad57390bd1 | 259 | M2MObjectInstance* instance = new M2MObjectInstance(*object,"1","type", "1"); |
ram54288 | 0:dbad57390bd1 | 260 | |
ram54288 | 0:dbad57390bd1 | 261 | uint32_t size = 0; |
ram54288 | 0:dbad57390bd1 | 262 | uint8_t *data = 0; |
ram54288 | 0:dbad57390bd1 | 263 | m2mbase_stub::name_id_value = 0; |
ram54288 | 0:dbad57390bd1 | 264 | M2MResource* resource = new M2MResource(*instance, |
ram54288 | 0:dbad57390bd1 | 265 | "1", |
ram54288 | 0:dbad57390bd1 | 266 | "type", |
ram54288 | 0:dbad57390bd1 | 267 | M2MResourceInstance::INTEGER, |
ram54288 | 0:dbad57390bd1 | 268 | false, |
ram54288 | 0:dbad57390bd1 | 269 | "1"); |
ram54288 | 0:dbad57390bd1 | 270 | |
ram54288 | 0:dbad57390bd1 | 271 | M2MResourceInstance* res_instance = new M2MResourceInstance(*resource, |
ram54288 | 0:dbad57390bd1 | 272 | "1", |
ram54288 | 0:dbad57390bd1 | 273 | "type", |
ram54288 | 0:dbad57390bd1 | 274 | M2MResourceInstance::INTEGER, |
ram54288 | 0:dbad57390bd1 | 275 | 0, |
ram54288 | 0:dbad57390bd1 | 276 | "1", |
ram54288 | 0:dbad57390bd1 | 277 | false); |
ram54288 | 0:dbad57390bd1 | 278 | |
ram54288 | 0:dbad57390bd1 | 279 | |
ram54288 | 0:dbad57390bd1 | 280 | m2mobjectinstance_stub::resource_list.clear(); |
ram54288 | 0:dbad57390bd1 | 281 | m2mobjectinstance_stub::resource_list.push_back(resource); |
ram54288 | 0:dbad57390bd1 | 282 | |
ram54288 | 0:dbad57390bd1 | 283 | m2mresource_stub::bool_value = true; |
ram54288 | 0:dbad57390bd1 | 284 | m2mresource_stub::list.push_back(res_instance); |
ram54288 | 0:dbad57390bd1 | 285 | |
ram54288 | 0:dbad57390bd1 | 286 | m2mbase_stub::operation = M2MBase::GET_ALLOWED; |
ram54288 | 0:dbad57390bd1 | 287 | |
ram54288 | 0:dbad57390bd1 | 288 | data = serializer->serialize( m2mobjectinstance_stub::resource_list,size); |
ram54288 | 0:dbad57390bd1 | 289 | CHECK(data != NULL); |
ram54288 | 0:dbad57390bd1 | 290 | |
ram54288 | 0:dbad57390bd1 | 291 | if(data) { |
ram54288 | 0:dbad57390bd1 | 292 | free(data); |
ram54288 | 0:dbad57390bd1 | 293 | data = NULL; |
ram54288 | 0:dbad57390bd1 | 294 | } |
ram54288 | 0:dbad57390bd1 | 295 | |
ram54288 | 0:dbad57390bd1 | 296 | |
ram54288 | 0:dbad57390bd1 | 297 | m2mbase_stub::name_id_value = -1; |
ram54288 | 0:dbad57390bd1 | 298 | data = serializer->serialize( m2mobject_stub::instance_list,size); |
ram54288 | 0:dbad57390bd1 | 299 | CHECK(data == NULL); |
ram54288 | 0:dbad57390bd1 | 300 | |
ram54288 | 0:dbad57390bd1 | 301 | delete res_instance; |
ram54288 | 0:dbad57390bd1 | 302 | delete resource; |
ram54288 | 0:dbad57390bd1 | 303 | delete instance; |
ram54288 | 0:dbad57390bd1 | 304 | delete object; |
ram54288 | 0:dbad57390bd1 | 305 | |
ram54288 | 0:dbad57390bd1 | 306 | m2mresource_stub::clear(); |
ram54288 | 0:dbad57390bd1 | 307 | m2mobjectinstance_stub::clear(); |
ram54288 | 0:dbad57390bd1 | 308 | m2mobject_stub::clear(); |
ram54288 | 0:dbad57390bd1 | 309 | } |