2 // Open Service Platform
\r
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
\r
5 // Licensed under the Apache License, Version 2.0 (the License);
\r
6 // you may not use this file except in compliance with the License.
\r
7 // You may obtain a copy of the License at
\r
9 // http://www.apache.org/licenses/LICENSE-2.0
\r
11 // Unless required by applicable law or agreed to in writing, software
\r
12 // distributed under the License is distributed on an "AS IS" BASIS,
\r
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
14 // See the License for the specific language governing permissions and
\r
15 // limitations under the License.
\r
18 * @file FMsgEtwsPrimaryNotification.cpp
\r
19 * @brief This is the implementation file for the %EtwsPrimaryNotification class.
\r
21 * This file contains the implementation of the %EtwsPrimaryNotification class.
\r
25 #include <msg_transport.h>
\r
26 #include <msg_storage.h>
\r
27 #include <FMsgEtwsPrimaryNotification.h>
\r
28 #include <FBaseSysLog.h>
\r
29 #include <FSec_AccessController.h>
\r
30 #include "FMsg_Types.h"
\r
31 #include "FMsg_EtwsPrimaryNotificationImpl.h"
\r
33 using namespace Tizen::Base;
\r
34 using namespace Tizen::Messaging;
\r
35 using namespace Tizen::Security;
\r
37 namespace Tizen { namespace Messaging
\r
40 EtwsPrimaryNotification::EtwsPrimaryNotification(void)
\r
42 __pEtwsPrimaryNotificationImpl = new (std::nothrow) _EtwsPrimaryNotificationImpl();
\r
43 SysTryReturnVoidResult(NID_MSG, __pEtwsPrimaryNotificationImpl != null, E_OUT_OF_MEMORY, "memory allocation failed.");
\r
46 EtwsPrimaryNotification::EtwsPrimaryNotification(const EtwsPrimaryNotification& value)
\r
48 __pEtwsPrimaryNotificationImpl = new (std::nothrow) _EtwsPrimaryNotificationImpl(*(value.__pEtwsPrimaryNotificationImpl));
\r
49 SysTryReturnVoidResult(NID_MSG, __pEtwsPrimaryNotificationImpl != null, E_OUT_OF_MEMORY, "memory allocation failed.");
\r
52 EtwsPrimaryNotification::~EtwsPrimaryNotification(void)
\r
54 if (__pEtwsPrimaryNotificationImpl)
\r
56 delete __pEtwsPrimaryNotificationImpl;
\r
58 __pEtwsPrimaryNotificationImpl = null;
\r
61 EtwsPrimaryNotification&
\r
62 EtwsPrimaryNotification::operator =(const EtwsPrimaryNotification& rhs)
\r
66 *__pEtwsPrimaryNotificationImpl = *(rhs.__pEtwsPrimaryNotificationImpl);
\r
72 EtwsPrimaryNotification*
\r
73 EtwsPrimaryNotification::CloneN() const
\r
75 return __pEtwsPrimaryNotificationImpl->CloneN();
\r
79 EtwsPrimaryNotification::Equals(const Tizen::Base::Object& obj) const
\r
81 const EtwsPrimaryNotification* pEtwsPrimaryNotification = dynamic_cast<const EtwsPrimaryNotification*>(&obj);
\r
82 if (!pEtwsPrimaryNotification)
\r
84 SysLog(NID_MSG, "dynamic_cast is failed");
\r
88 return __pEtwsPrimaryNotificationImpl->Equals(*(pEtwsPrimaryNotification->__pEtwsPrimaryNotificationImpl));
\r
92 EtwsPrimaryNotification::GetHashCode(void) const
\r
94 return __pEtwsPrimaryNotificationImpl->GetHashCode();
\r
97 Tizen::Base::ByteBuffer*
\r
98 EtwsPrimaryNotification::GetSerialNumberN(void) const
\r
100 result r = E_SUCCESS;
\r
101 Tizen::Base::ByteBuffer* pSerialnumber = null;
\r
104 SysAssertf(__pEtwsPrimaryNotificationImpl != null, "The CbsChannel instance is not constructed yet.");
\r
106 pSerialnumber = __pEtwsPrimaryNotificationImpl->GetSerialNumberN();
\r
108 r = GetLastResult();
\r
111 SysTryCatch(NID_MSG, r == E_SUCCESS, , r, "failed to get cbs message SerialNumber .");
\r
113 return pSerialnumber;
\r
116 SetLastResult(GetLastResult());
\r
120 delete pSerialnumber;
\r
121 pSerialnumber = null;
\r
126 Tizen::Base::DateTime
\r
127 EtwsPrimaryNotification::GetReceivedTime(void) const
\r
129 SysAssertf(__pEtwsPrimaryNotificationImpl != null, "The CbsChannel instance is not constructed yet.");
\r
131 return (__pEtwsPrimaryNotificationImpl->GetReceivedTime());
\r
134 Tizen::Base::ByteBuffer*
\r
135 EtwsPrimaryNotification::GetWarningSecurityInfoN(void) const
\r
137 result r = E_SUCCESS;
\r
138 Tizen::Base::ByteBuffer* pSecurityInfo = null;
\r
141 SysAssertf(__pEtwsPrimaryNotificationImpl != null, "The CbsChannel instance is not constructed yet.");
\r
143 pSecurityInfo = __pEtwsPrimaryNotificationImpl->GetWarningSecurityInfoN();
\r
145 r = GetLastResult();
\r
148 SysTryCatch(NID_MSG, r == E_SUCCESS, , r, "failed to get cbs message SerialNumber .");
\r
150 return pSecurityInfo;
\r
153 SetLastResult(GetLastResult());
\r
157 delete pSecurityInfo;
\r
158 pSecurityInfo = null;
\r
164 EtwsPrimaryNotification::GetMessageId(void) const
\r
166 SysAssertf(__pEtwsPrimaryNotificationImpl != null, "The CbsChannel instance is not constructed yet.");
\r
168 return (__pEtwsPrimaryNotificationImpl->GetMessageId());
\r
171 Tizen::Base::ByteBuffer*
\r
172 EtwsPrimaryNotification::GetWarningTypeN(void) const
\r
174 SysAssertf(__pEtwsPrimaryNotificationImpl != null, "The CbsChannel instance is not constructed yet.");
\r
176 result r = E_SUCCESS;
\r
177 Tizen::Base::ByteBuffer* pWarningType = null;
\r
180 SysAssertf(__pEtwsPrimaryNotificationImpl != null, "The CbsChannel instance is not constructed yet.");
\r
182 pWarningType = __pEtwsPrimaryNotificationImpl->GetWarningTypeN();
\r
184 r = GetLastResult();
\r
187 SysTryCatch(NID_MSG, r == E_SUCCESS, , r, "failed to get cbs Warning type .");
\r
189 return pWarningType;
\r
192 SetLastResult(GetLastResult());
\r
196 delete pWarningType;
\r
197 pWarningType = null;
\r
202 } } // Tizen::Messaging
\r