2 // Open Service Platform
3 // Copyright (c) 2012-2013 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.
18 * @file FMsgMmsManager.h
19 * @brief This is the header file for the %MmsManager class.
21 * This header file contains the declarations of the %MmsManager class.
25 #ifndef _FMSG_MMS_MANAGER_H_
26 #define _FMSG_MMS_MANAGER_H_
30 #include <FMsgIMmsListener.h>
31 #include <FMsgMmsMessage.h>
32 #include <FMsgRecipientList.h>
34 namespace Tizen { namespace Messaging
37 // forward declaration for class extension
38 class _MmsManagerImpl;
42 * @brief This class provides methods to use the MMS messaging service.
46 * The %MmsManager class is used to send MMS messages.
48 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/messaging/messaging.htm">Messaging Guide</a>.
50 * The following example demonstrates how to use the %MmsManager class.
54 // Creates a listener to override the OnMmsMessageSent() function of IMmsListener
55 // in order to be notified of a change in the state of the message being sent.
62 void OnMmsMessageSent(result r);
64 void MmsListener::OnMmsMessageSent(result r)
77 SendMmsMessage::MmsTest(void)
81 // Creates an MmsListener instance.
82 MmsListener* pListener = new MmsListener();
84 // Creates an MMS manager instance with the listener as the callback to check the status of the message being sent.
85 MmsManager* pMmsManager = new MmsManager();
86 r = pMmsManager->Construct(*pListener);
88 // Creates a recipient list instance and add recipients.
89 RecipientList recipient;
90 r = recipient.Add (RECIPIENT_TYPE_TO, L"01012345678");
91 r = recipient.Add (RECIPIENT_TYPE_CC, L"01012345679");
92 r = recipient.Add (RECIPIENT_TYPE_BCC, L"01012345670");
94 // Creates an MMS message instance.
95 MmsMessage mmsMessage;
96 r = mmsMessage.SetSubject(L"Subject!!!");
97 r = mmsMessage.SetText(L"Hello, World");
98 r = mmsMessage.AddAttachment(MMS_IMAGE, L"/Home/Res/image.jpg");
99 r = mmsMessage.AddAttachment(MMS_IMAGE, L"/Home/Res/audio.wav");
101 // Sends the message, and set the saveToSentbox parameter to true if the message should be saved in the Sentbox; otherwise, set to false.
102 // MmsListener callback is called once the message has been completely sent.
103 r = pMmsManager->Send(mmsMessage, recipient, true);
108 class _OSP_EXPORT_ MmsManager
109 : public Tizen::Base::Object
114 * This is the default constructor for this class.
121 * This is the destructor for this class.
125 virtual ~MmsManager(void);
128 MmsManager(const MmsManager& value);
129 MmsManager& operator =(const MmsManager& rhs);
134 * Initializes this instance of %MmsManager with the specified parameter.
138 * @return An error code
139 * @param[in] listener The listener to receive a send result asynchronously
140 * @exception E_SUCCESS The method is successful.
141 * @exception E_OUT_OF_MEMORY The memory is insufficient.
143 result Construct(IMmsListener &listener);
146 * Sends the MMS message.
150 * @privilege http://tizen.org/privilege/messaging.mms
152 * @return An error code
153 * @param[in] message The message to be sent
154 * @param[in] recipientList The list of recipients
155 * @param[in] saveToSentbox Set to @c true to save the message in the Sentbox, @n
157 * @exception E_SUCCESS The method is successful.
158 * @exception E_ON_INITIALIZING The mailbox is not completely loaded as yet.
159 * @exception E_STORAGE_FULL The storage is full.
160 * @exception E_DEVICE_UNAVAILABLE The device is unavailable.
161 * @exception E_NETWORK_UNAVAILABLE The network is unavailable.
162 * @exception E_INVALID_CONDITION The profile is not set.
163 * @exception E_INVALID_ADDRESS The address is invalid.
164 * @exception E_FDN_MODE The FDN mode has been activated.
165 * @exception E_INVALID_ARG The number of recipients is @c 0 or the message is empty.
166 * @exception E_MAX_EXCEEDED The number of recipients has crossed the maximum limit (Maximum 10).
167 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
168 * @remarks Some service providers may not support sending MMS messages with an empty subject or body. @n
169 * In this case, the result of the status report will be the E_FAILURE exception. @n
170 * The CC and BCC recipients in the @c recipientList are merged with the TO recipients when sending an MMS message.
171 * @see IMmsListener::OnMmsMessageSent()
173 result Send(const MmsMessage& message, const RecipientList& recipientList, bool saveToSentbox);
176 _MmsManagerImpl* __pImpl;
179 friend class _MmsManagerImpl;
181 } } // Tizen::Messaging
182 #endif // _FMSG_MMS_MANAGER_H_