Initialize Tizen 2.3
[framework/osp/messaging.git] / src / FMsg_MmsManagerImpl.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
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.
16 //
17 /**
18  * @file                FMsg_MmsManagerImpl.h
19  * @brief               This is the header file for the _MmsManagerImpl class.
20  *
21  * This header file contains the declarations of the _MmsManagerImpl class.
22  */
23
24 #ifndef _FMSG_INTERNAL_MMS_MANAGER_IMPL_H_
25 #define _FMSG_INTERNAL_MMS_MANAGER_IMPL_H_
26
27 // Includes
28 #include <FBaseObject.h>
29 #include "FMsg_Types.h"
30
31 namespace Tizen { namespace Messaging
32 {
33
34 // forward declaration
35 class MmsManager;
36 class IMmsListener;
37 class MmsMessage;
38 class RecipientList;
39 class _MmsEvent;
40
41 /**
42 * @class        _MmsManagerImpl
43 * @brief        This class provides methods to use the MMS messaging service.
44 * @since        1.0
45 *
46 * This class provides methods to use the MMS messaging service. @n
47 */
48 class _MmsManagerImpl
49         : public Tizen::Base::Object
50 {
51         // Life cycle
52 public:
53         /**
54         *       This is the default constructor for this class.
55         *
56         * @since        1.0
57         */
58         _MmsManagerImpl(void);
59
60         /**
61         *       This is the destructor for this class.
62         *
63         * @since        1.0
64         */
65         virtual ~_MmsManagerImpl(void);
66
67 private:
68         _MmsManagerImpl(const _MmsManagerImpl& value);
69         _MmsManagerImpl& operator =(const _MmsManagerImpl& rhs);
70
71         // Operation
72 public:
73         /**
74         * Initializes this instance of _MmsManagerImpl with the specified listener.
75         *
76         * @since                        1.0
77         * @return                       An error code
78         * @param[in]    listener                The listener to receive a send result asynchronously
79         * @exception    E_SUCCESS               The method was successful.
80         */
81         result Construct(IMmsListener& listener);
82
83         /**
84         * Sends the MMS message.
85         *
86         * @since                        1.0
87         * @privlevel    SYSTEM
88         * @privgroup    http://tizen.org/privilege/messaging.mms
89         *
90         * @return               An error code
91         * @param[in]    message                                 The message to be sent
92         * @param[in]    recipientList                   The list of recipients
93         * @param[in]    saveToSentBox                   Set to @c true to save the message in the Sentbox, @n
94         *                                                                               else @c false
95         * @exception    E_SUCCESS                               The method was successful.
96         * @exception    E_ON_INITIALIZING               The mailbox is not completely loaded yet.
97         * @exception    E_STORAGE_FULL                  The storage is full.
98         * @exception    E_DEVICE_UNAVAILABLE    The device is unavailable.
99         * @exception    E_NETWORK_UNAVAILABLE   The network is unavailable.
100         * @exception    E_INVALID_CONDITION             The profile is not set.
101         * @exception    E_INVALID_ADDRESS               The address is invalid.
102         * @exception    E_FDN_MODE                              The FDN mode has been activated.
103         * @exception    E_INVALID_ARG                   The number of recipients is @c 0 or the message is empty. @n
104         * @exception    E_MAX_EXCEEDED                  The number of recipients crossed the limit (Maximum 10).
105         * @exception    E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
106         * @remarks      Some service providers may not support sending MMS messages with an empty subject or body. @n
107         *               In this case, the result of the status report will be the E_FAILURE exception.
108         * @see                  IMmsListener::OnMmsMessageSent()
109         */
110         result Send(const MmsMessage& message, const RecipientList& recipientList, bool saveToSentBox);
111
112 public:
113     /**
114      * Gets the Impl instance.
115      *
116      * @since 2.1
117      * @return              The pointer to _MmsManagerImpl
118      * @param[in]   mmsManager            An instance of MmsManager
119      */
120         static _MmsManagerImpl* GetInstance(MmsManager& mmsManager);
121
122     /**
123      * Gets the Impl instance.
124      *
125      * @since 2.1
126      * @return              The pointer to _MmsManagerImpl
127      * @param[in]   mmsManager            An instance of MmsManager
128      */
129         static const _MmsManagerImpl* GetInstance(const MmsManager& mmsManager);
130
131         //utility
132 private:
133         /**
134         * Converts platform error codes
135         *
136         * @return               An error code
137         * @param[in]    err                             The error to convert
138         *
139         */
140         result ConvertException(int err) const;
141
142 private:
143         std::unique_ptr<_MmsEvent> __pMmsEvent;
144         bool __isConstructed;
145         msg_handle_t __msgHandle;
146 }; // _MmsManagerImpl
147 } }
148
149 #endif // _FMSG_INTERNAL_MMS_MANAGER_IMPL_H_