// // Tizen Web Device API // Copyright (c) 2012 Samsung Electronics Co., Ltd. // // 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 SMS_H #define SMS_H #include "ISms.h" #include "ISendingObserver.h" #include extern "C" { #include #include } namespace DeviceAPI { namespace Messaging { class Sms : public ISms, public ISendingObserver, public DPL::Event::Controller::Type > { public: explicit Sms(const std::string& id = ""); explicit Sms(const std::string& id, const msg_struct_t msg_data); virtual ~Sms(); // implementation of interface of IMessage class virtual void update(bool draftsOnly = false); virtual void readAllData(); virtual void moveToFolder(const FolderType newFolder); virtual void moveToFolder(const std::string& newFolder); virtual void copyToFolder(const FolderType newFolder); virtual void copyToFolder(const std::string& newFolder); virtual void remove(); virtual int send(); virtual void sendCancel(int handle) { } virtual void sendingCallback(msg_struct_t sent_status); virtual void OnEventReceived(const int& /*event*/); static FolderType toFolder(const std::string &folder); private: //! \brief Gets Flight mode //! //! This function is used to obtain Flight Mode directly //! from VCONF CORE API. //! //! \retval true if Flight Mode is on //! \retval false if Flight Mode if off static bool getFlightModeOn(); //! \brief Gets cellular network status //! //! This function is used to obtain cellular network status directly //! from Connection CORE API. //! //! \retval true if cellular network is accessible //! \retval false if cellular network is not accessible static bool getCellularOn(); void sendSubMessage(); void setSendingStatusOk(); void setSendingStatusFailed(EventOnSendingFailed::ErrorCode error = EventOnSendingFailed::UNKNOWN); void createNewMessage(); void readExistingMessage(); void updateBody(); void updateTo(); void updateFrom(); void updateSourceAddress(); void updateReadStatus(); void updateIsRead(); void updateMessage(); void addMessageToDraft(); void createSendMessage(); void readConversationId(msg_struct_t& messageData); void readRecipientList(msg_struct_t& messageData); void readBody(msg_struct_t& messageData); void readFolder(msg_struct_t& messageData); void readDateTime(msg_struct_t& messageData); void readReadStatus(msg_struct_t& messageData); void readSize(msg_struct_t& messageData); void readMessageStatus(msg_struct_t& messageData); std::queue& currentQueue() { return m_sendRequests.front().queue; } msg_struct_t createNewCopyOfPLatformMsg(const msg_struct_t src) const; msg_struct_t createNewCopyOfPLatformMsgWithAddressList(const msg_struct_t src) const; private: msg_struct_t m_messageData; bool m_sendingFailed; DPL::Mutex m_mutex; struct SendRequest { // queue of sub messages for each recipient std::queue queue; bool failed; SendRequest() : failed(false) { } }; // queue of send requests std::queue m_sendRequests; }; } } #endif