2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
22 * @author Pawel Misiak (p.misiak@samsung.com)
29 #include <API/Messaging/ISms.h>
30 #include "ISendingObserver.h"
34 #include <msg_transport.h>
42 class Sms : public Api::Messaging::ISms,
43 public ISendingObserver,
44 public DPL::Event::Controller<DPL::TypeListDecl<int>::Type >
47 explicit Sms(const std::string& id = "");
49 explicit Sms(const std::string& id, const msg_struct_t msg_data);
53 // implementation of interface of IMessage class
54 virtual void update(bool draftsOnly = false);
56 virtual void readAllData();
58 virtual void moveToFolder(const Api::Messaging::FolderType newFolder);
60 virtual void moveToFolder(const std::string& newFolder);
62 virtual void copyToFolder(const Api::Messaging::FolderType newFolder);
64 virtual void copyToFolder(const std::string& newFolder);
66 virtual void remove();
70 virtual void sendCancel(int handle)
74 virtual void sendingCallback(msg_struct_t sent_status);
76 virtual void OnEventReceived(const int& /*event*/);
78 static Api::Messaging::FolderType toFolder(const std::string &folder);
81 void sendSubMessage();
83 void setSendingStatusOk(const std::string &recipient = std::string());
85 void setSendingStatusFailed(const std::string &recipient = std::string());
87 void createNewMessage();
89 void readExistingMessage();
97 void updateSourceAddress();
99 void updateReadStatus();
103 void updateMessage();
105 void addMessageToDraft();
107 void createSendMessage();
109 void readRecipientList(msg_struct_t& messageData);
111 void readBody(msg_struct_t& messageData);
113 void readFolder(msg_struct_t& messageData);
115 void readDateTime(msg_struct_t& messageData);
117 void readReadStatus(msg_struct_t& messageData);
119 void readSize(msg_struct_t& messageData);
121 std::queue<msg_struct_t>& currentQueue()
123 return m_sendRequests.front().queue;
126 msg_struct_t createNewCopyOfPLatformMsg(const msg_struct_t src) const;
129 msg_struct_t m_messageData;
130 bool m_sendingFailed;
135 // queue of sub messages for each recipient
136 std::queue<msg_struct_t> queue;
139 SendRequest() : failed(false)
143 // queue of send requests
144 std::queue<SendRequest> m_sendRequests;