3 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * Licensed under the Apache License, Version 2.0 (the License);
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
22 #include "common/dm_error.h"
23 #include "serviceadapter/sa_define.h"
26 * @par Description: API to create add command
30 * @par Typical use case:
31 * @par Method of function operation:
32 * @par Important notes:
33 * @param[in] Session structure
34 * @param[in] Location structure(about source info)
35 * @param[in] string type, content type
36 * @param[in] string type, data value
37 * @param[in] int type, size
38 * @param[in] int type, moreData
39 * @param[out] Command structure
41 * @return ERROR_INTERNAL_OK on success
42 * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error
55 DM_ERROR create_add_cmd(Session * session, char *luid, const char *contenttype, char *data, unsigned int size, int moreData, Command ** pCommand);
58 * @par Description: API to create delete command
62 * @par Typical use case:
63 * @par Method of function operation:
64 * @par Important notes:
65 * @param[in] Session structure
66 * @param[in] Location structure(about source info)
67 * @param[in] string type, content type
68 * @param[out] Command structure
70 * @return ERROR_INTERNAL_OK on success
71 * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error
84 DM_ERROR create_delete_cmd(Session * session, char *luid, const char *contenttype, Command ** pCommand);
87 * @par Description: API to create alert command
91 * @par Typical use case:
92 * @par Method of function operation:
93 * @par Important notes:
94 * @param[in] Session structure
95 * @param[in] enum type, alert type
96 * @param[out] Command structure
98 * @return DM_OK on success
112 DM_ERROR create_alert_cmd(Session * session, AlertType syncType, Command ** pCommand);
115 * @par Description: API to create replace command
119 * @par Typical use case:
120 * @par Method of function operation:
121 * @par Important notes:
122 * @param[in] Session structure
123 * @param[out] Command structure
125 * @return DM_OK on success
139 DM_ERROR create_replace_cmd(Session * session, Command ** pCommand);
142 * @par Description: API to create result command
146 * @par Typical use case:
147 * @par Method of function operation:
148 * @par Important notes:
149 * @param[in] Session structure
150 * @param[out] Command structure
152 * @return DM_OK on success
166 DM_ERROR create_results_cmd(Session * session, Command ** pCommand);
169 * @par Description: API to create duplicate command
173 * @par Typical use case:
174 * @par Method of function operation:
175 * @par Important notes:
179 * @return DM_OK on success
193 DM_ERROR duplicate_command(Command * source, Command ** target);
196 * @par Description: API to free commands
200 * @par Typical use case:
201 * @par Method of function operation:
202 * @par Important notes:
203 * @param[in] commnads
218 void free_commands(GList * commands);
221 * @par Description: API to free command
225 * @par Typical use case:
226 * @par Method of function operation:
227 * @par Important notes:
228 * @param[in] Command structure
243 void free_command(Command * pCommand);
246 * @par Description: API to free command
250 * @par Typical use case:
251 * @par Method of function operation:
252 * @par Important notes:
253 * @param[in] Command structure
254 * @param[in] string type, correlator
256 * @return DM_OK on success
270 DM_ERROR set_correlator(Command ** pAlertCommand, char *pCorrelator);
273 * @par Description: API to set result command msg ref
277 * @par Typical use case:
278 * @par Method of function operation:
279 * @par Important notes:
280 * @param[in] Command structure
283 * @return DM_OK on success
297 DM_ERROR set_resultscommand_msgref(Command * pCommand, unsigned int msgRef);
300 * @par Description: API to set result command cmd ref
304 * @par Typical use case:
305 * @par Method of function operation:
306 * @par Important notes:
307 * @param[in] Command structure
310 * @return DM_OK on success
324 DM_ERROR set_resultscommand_cmdref(Command * pCommand, unsigned int cmdRef);
327 * @par Description: API to set result command cmd ref
331 * @par Typical use case:
332 * @par Method of function operation:
333 * @par Important notes:
334 * @param[in] Command structure
335 * @param[in] location target uri
337 * @return DM_OK on success
351 DM_ERROR set_resultscommand_targetref(Command * pCommand, Location * pLocation);
354 * @par Description: API to create new status location
358 * @par Typical use case:
359 * @par Method of function operation:
360 * @par Important notes:
361 * @param[in] session structure
362 * @param[in] enum type, dm error
363 * @param[in] command structure
364 * @param[in] string type, loaction source uri
365 * @param[in] string type, location target uri
366 * @param[in] enum type, command type
367 * @param[out] status structure
369 * @return DM_OK on success
383 DM_ERROR create_newstatuslocation(Session * session, DM_ERROR data, Command * command, Location * sourceref, Location * targetref, CommandType type, Status ** pStatus);
386 * @par Description: API to create new status
390 * @par Typical use case:
391 * @par Method of function operation:
392 * @par Important notes:
393 * @param[in] session structure
394 * @param[in] enum type, dm error
395 * @param[in] command structure
396 * @param[in] string type, loaction source uri
397 * @param[in] string type, location target uri
398 * @param[in] enum type, command type
399 * @param[in] status structure
401 * @return DM_OK on success
415 DM_ERROR create_newstatus(Session * session, DM_ERROR data, Command * command, Location * sourceref, Location * targetref, CommandType type, Status ** pStatus);
418 * @par Description: API to create new status location
422 * @par Typical use case:
423 * @par Method of function operation:
424 * @par Important notes: *
425 * @param[in] enum type, dm error
426 * @param[in] int type, cmd id
427 * @param[in] int type, msg ref
428 * @param[in] int type, cmd ref
429 * @param[in] string type, location source ref
430 * @param[in] string type, location target ref
431 * @param[in] chalenge structure
432 * @param[in] enum type, commadn type
433 * @param[out] status structure
435 * @return DM_OK on success
449 DM_ERROR create_status(DM_ERROR data, unsigned int cmdID, unsigned int msgref, unsigned int cmdref, Location * sourceref, Location * targetref, Chal * pChal, CommandType type, Status ** pStatus);
452 * @par Description: API to create new status location
456 * @par Typical use case:
457 * @par Method of function operation:
458 * @par Important notes: *
459 * @param[in] session structure
460 * @param[in] command structure
461 * @param[in] item structure
462 * @param[in] enum type, dm error
464 * @return DM_OK on success
478 DM_ERROR set_status_data(Session * session, Command * pCommand, Item * item, DM_ERROR data);
481 * @par Description: API to free status list
485 * @par Typical use case:
486 * @par Method of function operation:
487 * @par Important notes: *
488 * @param[in] status list
503 void free_statuses(GList * status);
506 * @par Description: API to free status
510 * @par Typical use case:
511 * @par Method of function operation:
512 * @par Important notes: *
528 void free_status(Status * status);
531 * @par Description: API to get status code
535 * @par Typical use case:
536 * @par Method of function operation:
537 * @par Important notes: *
540 * @return DM_OK on success
553 DM_ERROR get_statuscode(Status * status);
556 * @par Description: API to convert int type to change type
560 * @par Typical use case:
561 * @par Method of function operation:
562 * @par Important notes: *
565 * @return enum type, ChangeType
579 ChangeType converttochangetype(unsigned int type);
582 * @par Description: API to convert change type to int type
586 * @par Typical use case:
587 * @par Method of function operation:
588 * @par Important notes: *
591 * @return int type, int
605 unsigned int convertfromchangetype(ChangeType changeType);
608 * @par Description: API to convert string type to command type
612 * @par Typical use case:
613 * @par Method of function operation:
614 * @par Important notes: *
615 * @param[in] string type, type
617 * @return CommandType
631 CommandType converttocommandtype(char *type);
634 * @par Description: API to convert command type to string
638 * @par Typical use case:
639 * @par Method of function operation:
640 * @par Important notes: *
641 * @param[in] string type, type
643 * @return string type, string
657 char *convertfromcommandtype(CommandType type);
659 #endif /* SA_COMMAND_H_ */