@@ -29,6 +29,19 @@ class M2MTLVDeserializer {
29
29
30
30
public :
31
31
32
+ typedef enum {
33
+ None,
34
+ NotFound,
35
+ NotAllowed,
36
+ NotValid
37
+ } Error;
38
+
39
+ typedef enum {
40
+ Put,
41
+ Post
42
+ } Operation;
43
+
44
+
32
45
/* *
33
46
* Constructor.
34
47
*/
@@ -79,33 +92,61 @@ public :
79
92
/* *
80
93
* Deserialises the given binary that must encode object instances. Binary
81
94
* array can be checked before invoking this method with
82
- * {@link #isObjectInstance(byte[])}.
83
- * @param tlv Binary in OMA-TLV format
84
- * @return List of <code>M2MObjectInstance</code> objects.
85
- * @throws IllegalArgumentException if given binary is not a valid OMA-TLV
86
- * or it encodes a structure other than object instances.
87
- * @see #deserializeResources(byte[])
88
95
*/
89
- void deserialise_object_instances (uint8_t * tlv, uint32_t tlv_size, M2MObjectInstanceList &list);
96
+ M2MTLVDeserializer::Error deserialise_object_instances (uint8_t * tlv,
97
+ uint32_t tlv_size,
98
+ M2MObject &object,
99
+ M2MTLVDeserializer::Operation operation);
90
100
91
101
/* *
92
102
* Deserialises the given binary that must encode resources. Binary array
93
- * can be checked before invoking this method with {@link #isResource(byte[])}.
94
- * @param tlv Binary in OMA-TLV format
95
- * @return List of <code>M2MObjectInstance</code> objects.
96
- * @throws IllegalArgumentException if given binary is not a valid OMA-TLV
97
- * or it encodes a structure other than object instances.
98
- * @see #deserializeResources(byte[])
103
+ * can be checked before invoking this method.
104
+ */
105
+ M2MTLVDeserializer::Error deserialize_resources (uint8_t *tlv,
106
+ uint32_t tlv_size,
107
+ M2MObjectInstance &object_instance,
108
+ M2MTLVDeserializer::Operation operation);
109
+
110
+ /* *
111
+ * Deserialises the given binary that must encode resource instances. Binary array
112
+ * can be checked before invoking this method.
99
113
*/
100
- void deserialize_resources (uint8_t *tlv, uint32_t tlv_size, M2MResourceList &list);
114
+ M2MTLVDeserializer::Error deserialize_resource_instances (uint8_t *tlv,
115
+ uint32_t tlv_size,
116
+ M2MResource &resource,
117
+ M2MTLVDeserializer::Operation operation);
118
+
101
119
102
120
private:
103
121
104
- void deserialize_object_instances (uint8_t *tlv, uint32_t tlv_size, uint32_t offset, M2MObjectInstanceList &list);
105
-
106
- void deserialize_resources (uint8_t *tlv, uint32_t tlv_size, uint32_t offset, M2MResourceList &list);
122
+ M2MTLVDeserializer::Error deserialize_object_instances (uint8_t *tlv,
123
+ uint32_t tlv_size,
124
+ uint32_t offset,
125
+ M2MObject &object,
126
+ M2MTLVDeserializer::Operation operation,
127
+ bool update_value);
107
128
108
- void deserialize_resource_instances (uint8_t *tlv, uint32_t tlv_size, uint32_t offset, M2MResourceInstanceList &list);
129
+ M2MTLVDeserializer::Error deserialize_resources (uint8_t *tlv,
130
+ uint32_t tlv_size,
131
+ uint32_t offset,
132
+ M2MObjectInstance &object_instance,
133
+ M2MTLVDeserializer::Operation operation,
134
+ bool update_value);
135
+
136
+ M2MTLVDeserializer::Error deserialize_resource_instances (uint8_t *tlv,
137
+ uint32_t tlv_size,
138
+ uint32_t offset,
139
+ M2MResource &resource,
140
+ M2MObjectInstance &object_instance,
141
+ M2MTLVDeserializer::Operation operation,
142
+ bool update_value);
143
+
144
+ M2MTLVDeserializer::Error deserialize_resource_instances (uint8_t *tlv,
145
+ uint32_t tlv_size,
146
+ uint32_t offset,
147
+ M2MResource &resource,
148
+ M2MTLVDeserializer::Operation operation,
149
+ bool update_value);
109
150
110
151
bool is_object_instance (uint8_t *tlv, uint32_t offset);
111
152
0 commit comments