Mistake on this page? Email us
m2mresourceinstance.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 ARM Limited. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  * Licensed under the Apache License, Version 2.0 (the License); you may
5  * not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef M2M_RESOURCE_INSTANCE_H
17 #define M2M_RESOURCE_INSTANCE_H
18 
20 
21 
24 // Forward declarations
25 
26 class M2MBlockMessage;
27 class M2MResource;
28 
39 
40 friend class M2MObjectInstance;
41 friend class M2MResource;
42 
43 private:
45  const lwm2m_parameters_s* s,
46  M2MBase::DataType type);
58  const String &resource_name,
60  const String &resource_type,
61  M2MBase::DataType type,
62  char* path,
63  bool external_blockwise_store,
64  bool multiple_instance);
65 
80  const String &resource_name,
81  M2MBase::Mode mode,
82  const String &resource_type,
83  M2MBase::DataType type,
84  const uint8_t *value,
85  const uint8_t value_length,
86  char* path,
87  bool external_blockwise_store,
88  bool multiple_instance);
89 
90  // Prevents the use of default constructor.
92 
93  // Prevents the use of assignment operator.
94  M2MResourceInstance& operator=( const M2MResourceInstance& /*other*/ );
95 
96  // Prevents the use of copy constructor
97  M2MResourceInstance( const M2MResourceInstance& /*other*/ );
98 
102  virtual ~M2MResourceInstance();
103 
104 protected:
108  virtual M2MBase *get_parent() const;
109 
110 public:
111 
117 
122  virtual void set_observation_handler(M2MObservationHandler *handler);
123 
124 #if defined (MBED_CONF_MBED_CLIENT_ENABLE_OBSERVATION_PARAMETERS) && (MBED_CONF_MBED_CLIENT_ENABLE_OBSERVATION_PARAMETERS == 1)
125 
130  virtual bool handle_observation_attribute(const char *query);
131 #endif
132 
137  virtual uint16_t object_instance_id() const;
138 
143  virtual const char* object_name() const;
144 
149  virtual M2MResource& get_parent_resource() const;
150 
151 private:
152 
153  // Parent resource which owns this resource instance
154  M2MResource &_parent_resource;
155 
156  friend class Test_M2MResourceInstance;
157  friend class Test_M2MResource;
158  friend class Test_M2MObjectInstance;
159  friend class Test_M2MObject;
160  friend class Test_M2MDevice;
161  friend class Test_M2MSecurity;
162  friend class Test_M2MServer;
163  friend class Test_M2MNsdlInterface;
164  friend class Test_M2MTLVSerializer;
165  friend class Test_M2MTLVDeserializer;
166  friend class Test_M2MDiscover;
167 };
168 
169 #endif // M2M_RESOURCE_INSTANCE_H
Mode
Enum defining a resource type.
Definition: m2mbase.h:89
Definition: m2mobservationhandler.h:30
virtual void set_observation_handler(M2MObservationHandler *handler)
Sets the observation handler.
Definition: m2mbase.h:54
virtual M2MObservationHandler * observation_handler() const
Returns the Observation Handler object.
header for M2MResourceBase.
Definition: m2mobjectinstance.h:42
uint32_t value_length() const
Returns the length of the value pointer.
LwM2M parameters.
Definition: m2mbase.h:199
virtual const char * object_name() const
Returns the name of the object where the resource exists.
virtual M2MBase * get_parent() const
Returns the owner object. Can return NULL if the object has no parent.
virtual M2MResource & get_parent_resource() const
Get reference to the resource owning this resource instance.
DataType
Enum defining a resource data type.
Definition: m2mbase.h:98
Definition: m2mblockmessage.h:26
Mode mode() const
Returns the mode of the resource.
Definition: m2mresourceinstance.h:38
Definition: m2mresourcebase.h:49
Definition: m2mresource.h:38
const char * resource_type() const
Returns the resource type of the object.
virtual uint16_t object_instance_id() const
Returns the instance ID of the object where the resource exists.
uint8_t * value() const
Returns the value pointer of the object.