summaryrefslogtreecommitdiff
path: root/lib-common/inc/ContactsAppControl.h
blob: 2cba5a278958c5be4ec8a0f416d2d636ece92f07 (plain)
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
/*
 * Copyright (c) 2009-2015 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 _CONTACTS_APP_CONTROL_H_
#define _CONTACTS_APP_CONTROL_H_

#include <app_control.h>

#define APP_CONTROL_OPERATION_ADD "http://tizen.org/appcontrol/operation/add"
#define APP_CONTROL_OPERATION_UPDATE "http://tizen.org/appcontrol/operation/update"
#define APP_CONTROL_MIME_CONTACT "application/vnd.tizen.contact"

#define APP_CONTROL_DATA_TYPE "http://tizen.org/appcontrol/data/type"
#define APP_CONTROL_DATA_ID "http://tizen.org/appcontrol/data/id"
#define APP_CONTROL_DATA_NAME "http://tizen.org/appcontrol/data/name"
#define APP_CONTROL_DATA_PHONE "http://tizen.org/appcontrol/data/phone"
#define APP_CONTROL_DATA_EMAIL "http://tizen.org/appcontrol/data/email"
#define APP_CONTROL_DATA_URL "http://tizen.org/appcontrol/data/url"
#define APP_CONTROL_DATA_LIMIT "http://tizen.org/appcontrol/data/total_count"

#define APP_CONTROL_DATA_SELECTION_MODE_SINGLE "single"
#define APP_CONTROL_DATA_SELECTION_MODE_MULTIPLE "multiple"

#define APP_CONTROL_DATA_TYPE_ID "id"
#define APP_CONTROL_DATA_TYPE_PHONE "phone"
#define APP_CONTROL_DATA_TYPE_EMAIL "email"
#define APP_CONTROL_DATA_TYPE_PHONE_OR_EMAIL "phone_or_email"
#define APP_CONTROL_DATA_TYPE_VCARD "vcf"

#define APP_CONTROL_DATA_TYPE_PHONE_CALL "phone_call"
#define APP_CONTROL_DATA_TYPE_PHONE_MESSAGE "phone_message"

/**
 * @brief Request contact creation operation
 * @param[in]   number  Phone number to save to the new contact
 * @return App Control launch result
 * @see app_control_send_launch_request()
 */
int launchContactCreate(const char *number);

/**
 * @brief Request contact view operation
 * @param[in]   personId    ID of person to view
 * @return App Control launch result
 * @see app_control_send_launch_request()
 */
int launchContactDetails(int personId);

/**
 * @brief Request contact edit operation
 * @param[in]   personId    ID of person to edit or 0 to launch pick first
 * @param[in]   number      Phone number to add to the edited contact
 * @return App Control launch result
 * @see app_control_send_launch_request()
 */
int launchContactEdit(int personId, const char *number);

/**
 * @brief Request contact pick operation
 * @param[in]   selectionMode   One of APP_CONTROL_DATA_SELECTION_MODE_* values
 * @param[in]   resultType      One of APP_CONTROL_DATA_TYPE_* values
 * @param[in]   replyCallback   Callback to receive selection result
 * @param[in]   userData        Data passed to @a replyCallback
 * @param[in]   groupMode       Whether to group launched application with current
 * @param[out]  appControl      Created App Control handle if not nullptr
 * @remark If appControl is not nullptr it should be destroyed by the caller
 * @return App Control launch result
 * @see app_control_send_launch_request()
 */
int launchContactPick(const char *selectionMode, const char *resultType,
		app_control_reply_cb replyCallback, void *userData,
		bool groupMode = true, app_control_h *appControl = nullptr);

/**
 * @brief Request telephony call
 * @param[in]   number  Number to call
 * @return App Control launch result
 * @see app_control_send_launch_request()
 */
int launchCall(const char *number);

/**
 * @brief Request compose message
 * @param[in]   scheme      URI scheme (e.g. sms:, mmsto: or mailto:)
 * @param[in]   to          Message recipient
 * @param[in]   subject     Message subject
 * @param[in]   text        Message text
 * @return App Control launch result
 * @see app_control_send_launch_request()
 */
int launchMessageComposer(const char *scheme, const char *to, const char *subject = nullptr, const char *text = nullptr,
		bool groupMode = true);

/**
 * @brief Request single share of contact
 * @param[in]   personId    person id
 * @param[in]   isMyProfile true if person id is My profile id
 * @return App Control launch result
 * @see app_control_send_launch_request()
 */
int launchShareContact(const char *personId, bool isMyProfile);

/**
 * @brief Request multi share of contacts
 * @param[in]   personIdArray   array of person id
 * @param[in]   count           person id count
 * @return App Control launch result
 * @see app_control_send_launch_request()
 */
int launchMultiShareContacts(const char **personIdArray, int count);

#endif /* _CONTACTS_APP_CONTROL_H_ */