upload tizen1.0 source
[profile/ivi/wrt-plugins-tizen.git] / src / platform / API / Messaging / EventGetMessagingService.h
1 /*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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. 
15 */
16
17 #ifndef WRTPLUGINS_API_GET_MESSAGING_SERVICE_EVENT_MESSAGING_H_
18 #define WRTPLUGINS_API_GET_MESSAGING_SERVICE_EVENT_MESSAGING_H_
19
20 #include <vector>
21 #include <Commons/IEvent.h>
22 #include <dpl/shared_ptr.h>
23 #include <Commons/Exception.h>
24
25 #include "IMessagingService.h"
26 #include "IMessagingTypes.h"
27
28 namespace TizenApis {
29 namespace Api {
30 namespace Messaging {
31 class EventGetMessagingService: public WrtDeviceApis::Commons::IEvent<EventGetMessagingService> 
32 {
33         
34 public:
35         static const int MESSAGING_SERVICE_MANAGER_EVENT_TYPE_ALL = 1;
36         static const int MESSAGING_SERVICE_MANAGER_EVENT_TYPE_ACCOUNT = 2;
37
38 private:
39         
40      long m_accountID;
41         int m_messagingServiceType;
42      int m_eventType;
43                 
44      std::vector< IMessagingServicePtr > m_messagingServices;
45         
46 public:
47         void setAccountID(long value) {
48                 //ToDo : check vailded Account, now temporary
49                 m_accountID = value;
50                 m_eventType = MESSAGING_SERVICE_MANAGER_EVENT_TYPE_ACCOUNT; //if set account, type will be changed as account type
51         }
52
53         long getAccountID() const {
54                 return m_accountID;
55         }
56
57         void setEventType(int type) {
58                 m_eventType = type;
59         }
60         
61         int getEventType() const{
62                 return m_eventType;
63         }       
64
65         void setMessagingServiceType(int type) {
66                 m_messagingServiceType = type;
67         }
68
69         int getMessagingServiceType() const {
70                 return m_messagingServiceType;
71         }
72                 
73         void setMessagingServicesRef(const std::vector< IMessagingServicePtr > &msgServices)
74         {
75                 m_messagingServices = msgServices;
76         }
77
78         std::size_t getNumberOfMessagingService()
79         {
80                 return m_messagingServices.size();
81         }
82                 
83         IMessagingServicePtr getMessagingService(std::size_t index)
84         {
85                 if (index >= m_messagingServices.size() || m_messagingServices.size() == 0) {
86                         Throw(WrtDeviceApis::Commons::InvalidArgumentException);
87                 }
88                 
89                 return m_messagingServices[index];
90         }
91         
92         std::vector<IMessagingServicePtr> getMessagingServices()
93         {
94                 return m_messagingServices;
95         }
96         
97         EventGetMessagingService() 
98         {
99                 m_accountID = -1, 
100                 m_eventType = MESSAGING_SERVICE_MANAGER_EVENT_TYPE_ALL;
101         }
102 };
103
104 typedef DPL::SharedPtr<EventGetMessagingService> EventGetMessagingServicePtr;
105
106 } // Api
107 } // WrtPlugins
108 }
109 #endif //WRTPLUGINS_API_GET_MESSAGING_SERVICE_EVENT_MESSAGING_H_