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 
27 class M2MBlockMessage;
28 
29 
30 class M2MResource;
31 
33 
34 friend class M2MObjectInstance;
35 friend class M2MResource;
36 
37 private: // Constructor and destructor are private
38  // which means that these objects can be created or
39  // deleted only through a function provided by the M2MObjectInstance.
40 
42  const lwm2m_parameters_s* s,
43  M2MBase::DataType type);
55  const String &resource_name,
57  const String &resource_type,
58  M2MBase::DataType type,
59  char* path,
60  bool external_blockwise_store,
61  bool multiple_instance);
62 
77  const String &resource_name,
78  M2MBase::Mode mode,
79  const String &resource_type,
80  M2MBase::DataType type,
81  const uint8_t *value,
82  const uint8_t value_length,
83  char* path,
84  bool external_blockwise_store,
85  bool multiple_instance);
86 
87  // Prevents the use of default constructor.
89 
90  // Prevents the use of assignment operator.
91  M2MResourceInstance& operator=( const M2MResourceInstance& /*other*/ );
92 
93  // Prevents the use of copy constructor
94  M2MResourceInstance( const M2MResourceInstance& /*other*/ );
95 
99  virtual ~M2MResourceInstance();
100 
101 protected:
105  virtual M2MBase *get_parent() const;
106 
107 public:
108 
114 
119  virtual void set_observation_handler(M2MObservationHandler *handler);
120 
121 #if defined (MBED_CONF_MBED_CLIENT_ENABLE_OBSERVATION_PARAMETERS) && (MBED_CONF_MBED_CLIENT_ENABLE_OBSERVATION_PARAMETERS == 1)
122 
127  virtual bool handle_observation_attribute(const char *query);
128 #endif
129 
134  virtual uint16_t object_instance_id() const;
135 
140  virtual const char* object_name() const;
141 
146  virtual M2MResource& get_parent_resource() const;
147 
148 private:
149 
150  // Parent resource which owns this resource instance
151  M2MResource &_parent_resource;
152 
153  friend class Test_M2MResourceInstance;
154  friend class Test_M2MResource;
155  friend class Test_M2MObjectInstance;
156  friend class Test_M2MObject;
157  friend class Test_M2MDevice;
158  friend class Test_M2MSecurity;
159  friend class Test_M2MServer;
160  friend class Test_M2MNsdlInterface;
161  friend class Test_M2MFirmware;
162  friend class Test_M2MTLVSerializer;
163  friend class Test_M2MTLVDeserializer;
164 };
165 
166 #endif // M2M_RESOURCE_INSTANCE_H
Mode
Enum defining a resource type.
Definition: m2mbase.h:98
Definition: m2mobservationhandler.h:31
virtual void set_observation_handler(M2MObservationHandler *handler)
Sets the observation handler.
The base class based on which all LwM2M object models can be created.
Definition: m2mbase.h:63
virtual M2MObservationHandler * observation_handler() const
Returns the Observation Handler object.
M2MResourceBase. This class is the base class for mbed Client Resources. All defined LWM2M resource m...
Definition: m2mobjectinstance.h:36
uint32_t value_length() const
Returns the length of the value pointer.
LwM2M parameters.
Definition: m2mbase.h:210
Definition: m2mstring.h:33
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:107
Definition: m2mblockmessage.h:26
Mode mode() const
Returns the mode of the resource.
Definition: m2mresourceinstance.h:32
Definition: m2mresourcebase.h:43
The base class for Client Resources.
Definition: m2mresource.h:40
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.