1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
|
/*****************************************************************
*
* Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************/
#ifndef __SAMSUNG_EXPERIENCE_SERVICE_SMARTTHINGS_PAYLOAD_H__
#define __SAMSUNG_EXPERIENCE_SERVICE_SMARTTHINGS_PAYLOAD_H__
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @file smartthings_payload.h
*/
/**
* @addtogroup CAPI_SMARTTHINGS_THING_PAYLOAD_MODULE
* @{
*/
/**
* @brief The SmartThings payload handle.
* @since_ses 1
*/
typedef struct smartthings_payload_s *smartthings_payload_h;
/**
* @brief Creates a SmartThings payload handle.
* @since_ses 1
*
* @remarks The @a payload must be released using smartthings_payload_destroy().
* @remarks If the @a payload is set to parent payload as an object or object array
* using smartthings_payload_set_object() or smartthings_payload_set_object_array(),
* the @a payload must not be released.
* @param[out] payload The SmartThings payload handle to be newly created on success
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SMARTTHINGS_RESOURCE_ERROR_NONE Successful
* @retval #SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #SMARTTHINGS_RESOURCE_ERROR_OUT_OF_MEMORY Out of memory
*
* @see smartthings_payload_destroy()
*/
int smartthings_payload_create(smartthings_payload_h *payload);
/**
* @brief Destroys a SmartThings payload handle and releases all its resources.
* @since_ses 1
*
* @remarks If the @a payload has child payload, its child payload will be released as well.
*
* @param[in] payload The SmartThings payload handle
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SMARTTHINGS_RESOURCE_ERROR_NONE Successful
* @retval #SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER Invalid parameter
*
* @see smartthings_payload_create()
*/
int smartthings_payload_destroy(smartthings_payload_h payload);
/**
* @brief Sets an integer value for the attribute name.
* @since_ses 1
*
* @remarks The @a attr_name is key value, one of several properties of the resource type.
* @remarks The function replaces any existing value for the given @a attr_name.
*
* @param[in] payload The SmartThings payload handle
* @param[in] attr_name The attribute name
* @param[in] value The value to set
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SMARTTHINGS_RESOURCE_ERROR_NONE Successful
* @retval #SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER Invalid parameter
*/
int smartthings_payload_set_int(smartthings_payload_h payload, const char *attr_name, int value);
/**
* @brief Sets a boolean value for the attribute name.
* @since_ses 1
*
* @remarks The @a attr_name is key value, one of several properties of the resource type.
* @remarks The function replaces any existing value for the given @a attr_name.
*
* @param[in] payload The SmartThings payload handle
* @param[in] attr_name The attribute name
* @param[in] value The value to set
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SMARTTHINGS_RESOURCE_ERROR_NONE Successful
* @retval #SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER Invalid parameter
*/
int smartthings_payload_set_bool(smartthings_payload_h payload, const char *attr_name, bool value);
/**
* @brief Sets a double value for the attribute name.
* @since_ses 1
*
* @remarks The @a attr_name is key value, one of several properties of the resource type.
* @remarks The function replaces any existing value for the given @a attr_name.
*
* @param[in] payload The SmartThings payload handle
* @param[in] attr_name The attribute name
* @param[in] value The value to set
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SMARTTHINGS_RESOURCE_ERROR_NONE Successful
* @retval #SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER Invalid parameter
*/
int smartthings_payload_set_double(smartthings_payload_h payload, const char *attr_name, double value);
/**
* @brief Sets a string value for the attribute name.
* @since_ses 1
*
* @remarks The @a attr_name is key value, one of several properties of the resource type.
* @remarks The function replaces any existing value for the given @a attr_name.
*
* @param[in] payload The SmartThings payload handle
* @param[in] attr_name The attribute name
* @param[in] value The value to set
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SMARTTHINGS_RESOURCE_ERROR_NONE Successful
* @retval #SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER Invalid parameter
*/
int smartthings_payload_set_string(smartthings_payload_h payload, const char *attr_name, const char *value);
/**
* @brief Sets a byte string value and length for the attribute name.
* @since_ses 1
*
* @remarks The @a attr_name is key value, one of several properties of the resource type.
* @remarks The function replaces any existing value for the given @a attr_name.
*
* @param[in] payload The SmartThings payload handle
* @param[in] attr_name The attribute name
* @param[in] value The value to set
* @param[in] length The size of value
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SMARTTHINGS_RESOURCE_ERROR_NONE Successful
* @retval #SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #SMARTTHINGS_RESOURCE_ERROR_OPERATION_FAILED Operation failed
*/
int smartthings_payload_set_byte_string(smartthings_payload_h payload, const char *attr_name, const char *value, unsigned int length);
/**
* @brief Sets an object value for the attribute name.
* @since_ses 1
*
* @remarks The @a attr_name is key value, one of several properties of the resource type.
* @remarks The @a value is SmartThings payload handle.
* @remarks The function replaces any existing value for the given @a attr_name.
*
* @param[in] payload The SmartThings payload handle
* @param[in] attr_name The attribute name
* @param[in] value The value to set
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SMARTTHINGS_RESOURCE_ERROR_NONE Successful
* @retval #SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER Invalid parameter
*/
int smartthings_payload_set_object(smartthings_payload_h payload, const char *attr_name, smartthings_payload_h value);
/**
* @brief Sets an integer array for the attribute name.
* @since_ses 1
*
* @remarks The @a attr_name is key value, one of several properties of the resource type.
* @remarks The function replaces any existing array for the given @a attr_name.
*
* @param[in] payload The SmartThings payload handle
* @param[in] attr_name The attribute name
* @param[in] array The array associated with the given attribute name
* @param[in] length The length of @a array
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SMARTTHINGS_RESOURCE_ERROR_NONE Successful
* @retval #SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER Invalid parameter
*/
int smartthings_payload_set_int_array(smartthings_payload_h payload, const char *attr_name, const int *array, unsigned int length);
/**
* @brief Sets a boolean array for the attribute name.
* @since_ses 1
*
* @remarks The @a attr_name is key value, one of several properties of the resource type.
* @remarks The function replaces any existing array for the given @a attr_name.
*
* @param[in] payload The SmartThings payload handle
* @param[in] attr_name The attribute name
* @param[in] array The array associated with the given attribute name
* @param[in] length The length of @a array
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SMARTTHINGS_RESOURCE_ERROR_NONE Successful
* @retval #SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER Invalid parameter
*/
int smartthings_payload_set_bool_array(smartthings_payload_h payload, const char *attr_name, const bool *array, unsigned int length);
/**
* @brief Sets a double array for the attribute name.
* @since_ses 1
*
* @remarks The @a attr_name is key value, one of several properties of the resource type.
* @remarks The function replaces any existing array for the given @a attr_name.
*
* @param[in] payload The SmartThings payload handle
* @param[in] attr_name The attribute name
* @param[in] array The array associated with the given attribute name
* @param[in] length The length of @a array
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SMARTTHINGS_RESOURCE_ERROR_NONE Successful
* @retval #SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER Invalid parameter
*/
int smartthings_payload_set_double_array(smartthings_payload_h payload, const char *attr_name, const double *array, unsigned int length);
/**
* @brief Sets a string array for the attribute name.
* @since_ses 1
*
* @remarks The @a attr_name is key value, one of several properties of the resource type.
* @remarks The function replaces any existing array for the given @a attr_name.
*
* @param[in] payload The SmartThings payload handle
* @param[in] attr_name The attribute name
* @param[in] array The array associated with the given attribute name
* @param[in] length The length of @a array
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SMARTTHINGS_RESOURCE_ERROR_NONE Successful
* @retval #SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER Invalid parameter
*/
int smartthings_payload_set_string_array(smartthings_payload_h payload, const char *attr_name, const char **array, unsigned int length);
/**
* @brief Sets an object array for the attribute name.
* @since_ses 1
*
* @remarks The @a attr_name is key value, one of several properties of the resource type.
* @remarks The function replaces any existing array for the given @a attr_name.
*
* @param[in] payload The SmartThings payload handle
* @param[in] attr_name The attribute name
* @param[in] array The array associated with the given attribute name
* @param[in] length The length of @a array
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SMARTTHINGS_RESOURCE_ERROR_NONE Successful
* @retval #SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #SMARTTHINGS_RESOURCE_ERROR_OUT_OF_MEMORY Out of memory
*/
int smartthings_payload_set_object_array(smartthings_payload_h payload, const char *attr_name, smartthings_payload_h *array, unsigned int length);
/**
* @brief Adds a payload for child resource of collection resource.
* @since_ses 1
*
* @remarks The @a resource_uri is key value, one of several child resources of the collection resource.
* @remarks The @a value is SmartThings payload handle.
* @remarks The function replaces any existing payload for the given @a resource_uri.
*
* @param[in] payload The SmartThings payload handle
* @param[in] resource_uri The resource URI of child resource
* @param[in] value The payload associated with the given resource URI
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SMARTTHINGS_RESOURCE_ERROR_NONE Successful
* @retval #SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER Invalid parameter
*/
int smartthings_payload_add_collection_object(smartthings_payload_h payload, const char *resource_uri, smartthings_payload_h value);
/**
* @brief Gets an integer value for the attribute name.
* @since_ses 1
*
* @remarks The @a attr_name is key value, one of several properties of the resource type.
*
* @param[in] payload The SmartThings payload handle
* @param[in] attr_name The attribute name
* @param[out] value The value associated with the given attribute name
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SMARTTHINGS_RESOURCE_ERROR_NONE Successful
* @retval #SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #SMARTTHINGS_RESOURCE_ERROR_NO_DATA No data
*/
int smartthings_payload_get_int(smartthings_payload_h payload, const char *attr_name, int *value);
/**
* @brief Gets a boolean value for the attribute name.
* @since_ses 1
*
* @remarks The @a attr_name is key value, one of several properties of the resource type.
*
* @param[in] payload The SmartThings payload handle
* @param[in] attr_name The attribute name
* @param[out] value The value associated with the given attribute name
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SMARTTHINGS_RESOURCE_ERROR_NONE Successful
* @retval #SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #SMARTTHINGS_RESOURCE_ERROR_NO_DATA No data
*/
int smartthings_payload_get_bool(smartthings_payload_h payload, const char *attr_name, bool *value);
/**
* @brief Gets a double value for the attribute name.
* @since_ses 1
*
* @remarks The @a attr_name is key value, one of several properties of the resource type.
*
* @param[in] payload The SmartThings payload handle
* @param[in] attr_name The attribute name
* @param[out] value The value associated with the given attribute name
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SMARTTHINGS_RESOURCE_ERROR_NONE Successful
* @retval #SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #SMARTTHINGS_RESOURCE_ERROR_NO_DATA No data
*/
int smartthings_payload_get_double(smartthings_payload_h payload, const char *attr_name, double *value);
/**
* @brief Gets a string value for the attribute name.
* @since_ses 1
*
* @remarks The @a attr_name is key value, one of several properties of the resource type.
* @remarks The @a value should be released using free().
*
* @param[in] payload The SmartThings payload handle
* @param[in] attr_name The attribute name
* @param[out] value The value associated with the given attribute name
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SMARTTHINGS_RESOURCE_ERROR_NONE Successful
* @retval #SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #SMARTTHINGS_RESOURCE_ERROR_NO_DATA No data
*/
int smartthings_payload_get_string(smartthings_payload_h payload, const char *attr_name, char **value);
/**
* @brief Gets a byte string value and length for the attribute name.
* @since_ses 1
*
* @remarks The @a attr_name is key value, one of several properties of the resource type.
* @remarks The @a value should be released using free().
*
* @param[in] payload The SmartThings payload handle
* @param[in] attr_name The attribute name
* @param[out] value The value associated with the given attribute name
* @param[out] length The size of value
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SMARTTHINGS_RESOURCE_ERROR_NONE Successful
* @retval #SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #SMARTTHINGS_RESOURCE_ERROR_NO_DATA No data
*/
int smartthings_payload_get_byte_string(smartthings_payload_h payload, const char *attr_name, char **value, unsigned int *length);
/**
* @brief Gets an object value for the attribute name.
* @since_ses 1
*
* @remarks The @a attr_name is key value, one of several properties of the resource type.
* @remarks The @a value is SmartThings payload handle.
* @remarks The @a value must be released using smartthings_payload_release_object().
*
* @param[in] payload The SmartThings payload handle
* @param[in] attr_name The attribute name
* @param[out] value The value associated with the given attribute name
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SMARTTHINGS_RESOURCE_ERROR_NONE Successful
* @retval #SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #SMARTTHINGS_RESOURCE_ERROR_OUT_OF_MEMORY Out of memory
* @retval #SMARTTHINGS_RESOURCE_ERROR_NO_DATA No data
*/
int smartthings_payload_get_object(smartthings_payload_h payload, const char *attr_name, smartthings_payload_h *value);
/**
* @brief Gets an integer array for the attribute name.
* @since_ses 1
*
* @remarks The @a attr_name is key value, one of several properties of the resource type.
* @remarks The @a array must be released using smartthings_payload_release_int_array().
*
* @param[in] payload The SmartThings payload handle
* @param[in] attr_name The attribute name
* @param[out] array The array associated with the given attribute name
* @param[out] length The length of @a array
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SMARTTHINGS_RESOURCE_ERROR_NONE Successful
* @retval #SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #SMARTTHINGS_RESOURCE_ERROR_OUT_OF_MEMORY Out of memory
* @retval #SMARTTHINGS_RESOURCE_ERROR_NO_DATA No data
*
* @see smartthings_payload_release_int_array()
*/
int smartthings_payload_get_int_array(smartthings_payload_h payload, const char *attr_name, int **array, unsigned int *length);
/**
* @brief Gets a boolean array for the attribute name.
* @since_ses 1
*
* @remarks The @a attr_name is key value, one of several properties of the resource type.
* @remarks The @a array must be released using smartthings_payload_release_bool_array().
*
* @param[in] payload The SmartThings payload handle
* @param[in] attr_name The attribute name
* @param[out] array The array associated with the given attribute name
* @param[out] length The length of @a array
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SMARTTHINGS_RESOURCE_ERROR_NONE Successful
* @retval #SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #SMARTTHINGS_RESOURCE_ERROR_OUT_OF_MEMORY Out of memory
* @retval #SMARTTHINGS_RESOURCE_ERROR_NO_DATA No data
*
* @see smartthings_payload_release_bool_array()
*/
int smartthings_payload_get_bool_array(smartthings_payload_h payload, const char *attr_name, bool **array, unsigned int *length);
/**
* @brief Gets a double array for the attribute name.
* @since_ses 1
*
* @remarks The @a attr_name is key value, one of several properties of the resource type.
* @remarks The @a array must be released using smartthings_payload_release_double_array().
*
* @param[in] payload The SmartThings payload handle
* @param[in] attr_name The attribute name
* @param[out] array The array associated with the given attribute name
* @param[out] length The length of @a array
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SMARTTHINGS_RESOURCE_ERROR_NONE Successful
* @retval #SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #SMARTTHINGS_RESOURCE_ERROR_OUT_OF_MEMORY Out of memory
* @retval #SMARTTHINGS_RESOURCE_ERROR_NO_DATA No data
*
* @see smartthings_payload_release_double_array()
*/
int smartthings_payload_get_double_array(smartthings_payload_h payload, const char *attr_name, double **array, unsigned int *length);
/**
* @brief Gets a string array for the attribute name.
* @since_ses 1
*
* @remarks The @a attr_name is key value, one of several properties of the resource type.
* @remarks The @a array must be released using smartthings_payload_release_string_array().
*
* @param[in] payload The SmartThings payload handle
* @param[in] attr_name The attribute name
* @param[out] array The array associated with the given attribute name
* @param[out] length The length of @a array
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SMARTTHINGS_RESOURCE_ERROR_NONE Successful
* @retval #SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #SMARTTHINGS_RESOURCE_ERROR_OUT_OF_MEMORY Out of memory
* @retval #SMARTTHINGS_RESOURCE_ERROR_NO_DATA No data
*
* @see smartthings_payload_release_string_array()
*/
int smartthings_payload_get_string_array(smartthings_payload_h payload, const char *attr_name, char ***array, unsigned int *length);
/**
* @brief Gets an object array for the attribute name.
* @since_ses 1
*
* @remarks The @a attr_name is key value, one of several properties of the resource type.
* @remarks The @a array is a list of SmartThings payload handle.
* @remarks The @a array must be released using smartthings_payload_release_object_array().
*
* @param[in] payload The SmartThings payload handle
* @param[in] attr_name The attribute name
* @param[out] array The array associated with the given attribute name
* @param[out] length The length of @a array
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SMARTTHINGS_RESOURCE_ERROR_NONE Successful
* @retval #SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #SMARTTHINGS_RESOURCE_ERROR_OUT_OF_MEMORY Out of memory
* @retval #SMARTTHINGS_RESOURCE_ERROR_NO_DATA No data
*
* @see smartthings_payload_release_object_array()
*/
int smartthings_payload_get_object_array(smartthings_payload_h payload, const char *attr_name, smartthings_payload_h **array, unsigned int *length);
/**
* @brief Gets a payload for child resource of collection resource.
* @since_ses 1
*
* @remarks The @a resource_uri is key value, one of several child resources of the collection resource.
* @remarks The @a value is SmartThings payload handle.
* @remarks The @a value must be released using smartthings_payload_release_object().
*
* @param[in] payload The SmartThings payload handle
* @param[in] resource_uri The resource URI of child resource
* @param[out] value The payload associated with the given resource URI
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SMARTTHINGS_RESOURCE_ERROR_NONE Successful
* @retval #SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #SMARTTHINGS_RESOURCE_ERROR_OUT_OF_MEMORY Out of memory
* @retval #SMARTTHINGS_RESOURCE_ERROR_NO_DATA No data
*/
int smartthings_payload_get_collection_object(smartthings_payload_h payload, const char *resource_uri, smartthings_payload_h *value);
/**
* @brief Releases an integer array of the SmartThings payload.
* @since_ses 1
*
* @param[in] array The array to release
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SMARTTHINGS_RESOURCE_ERROR_NONE Successful
* @retval #SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER Invalid parameter
*
* @see smartthings_payload_get_int_array()
*/
int smartthings_payload_release_int_array(int *array);
/**
* @brief Releases a boolean array of the SmartThings payload.
* @since_ses 1
*
* @param[in] array The array to release
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SMARTTHINGS_RESOURCE_ERROR_NONE Successful
* @retval #SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER Invalid parameter
*
* @see smartthings_payload_get_bool_array()
*/
int smartthings_payload_release_bool_array(bool *array);
/**
* @brief Releases a double array of the SmartThings payload.
* @since_ses 1
*
* @param[in] array The array to release
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SMARTTHINGS_RESOURCE_ERROR_NONE Successful
* @retval #SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER Invalid parameter
*
* @see smartthings_payload_get_double_array()
*/
int smartthings_payload_release_double_array(double *array);
/**
* @brief Releases a string array of the SmartThings payload.
* @since_ses 1
*
* @param[in] array The array to release
* @param[in] length The length of @a array
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SMARTTHINGS_RESOURCE_ERROR_NONE Successful
* @retval #SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER Invalid parameter
*
* @see smartthings_payload_get_string_array()
*/
int smartthings_payload_release_string_array(char **array, unsigned int length);
/**
* @brief Releases an object array of the SmartThings payload.
* @since_ses 1
*
* @param[in] array The array to release
* @param[in] length The length of @a array
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SMARTTHINGS_RESOURCE_ERROR_NONE Successful
* @retval #SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER Invalid parameter
*
* @see smartthings_payload_get_object_array()
*/
int smartthings_payload_release_object_array(smartthings_payload_h *array, unsigned int length);
/**
* @brief Releases a SmartThings payload.
* @since_ses 1
*
* @remarks The function is different with smartthings_payload_destroy().
* @remarks The function releases only payload value that is obtained by smartthings_payload_get_object().
*
* @param[in] payload The payload to release
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SMARTTHINGS_RESOURCE_ERROR_NONE Successful
* @retval #SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER Invalid parameter
*
* @see smartthings_payload_get_object()
*/
int smartthings_payload_release_object(smartthings_payload_h payload);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __SAMSUNG_EXPERIENCE_SERVICE_SMARTTHINGS_PAYLOAD_H__ */
|