inc
src
src/inc
+ /usr/include/chromium
/usr/include/appfw
/usr/include/glib-2.0
/usr/lib/glib-2.0/include
/usr/lib/dbus-1.0/include
/usr/include/email-service
/usr/include/libxml2
+ /usr/include/osp/io
)
SET (${this_target}_SOURCE_FILES
src/FMsg_EtwsPrimaryNotificationImpl.cpp
src/FMsg_MsgUtil.cpp
src/FMsg_SmsMmsCallbackHandler.cpp
+ src/FMsg_MessagingMessageTypes.cpp
+ src/FMsg_MessagingIpcProxy.cpp
)
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Wall" )
-//\r
-// Open Service Platform\r
-// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
-//\r
-// Licensed under the Apache License, Version 2.0 (the License);\r
-// you may not use this file except in compliance with the License.\r
-// You may obtain a copy of the License at\r
-//\r
-// http://www.apache.org/licenses/LICENSE-2.0\r
-//\r
-// Unless required by applicable law or agreed to in writing, software\r
-// distributed under the License is distributed on an "AS IS" BASIS,\r
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-// See the License for the specific language governing permissions and\r
-// limitations under the License.\r
-//\r
-/**\r
-* @file FMsgCbsChannel.h\r
-* @brief This is the header file for the %CbsChannel class.\r
-*\r
-* This header file contains the declarations of the %CbsChannel class.\r
-*/\r
-\r
-#ifndef _FMSG_CBS_CHANNEL_H_\r
-#define _FMSG_CBS_CHANNEL_H_\r
-\r
-namespace Tizen { namespace Base\r
-{\r
-class String;\r
-} }\r
-\r
-#include <FBaseObject.h>\r
-\r
-namespace Tizen { namespace Messaging\r
-{\r
-class _CbsChannelImpl;\r
-\r
-/**\r
-* @class CbsChannel\r
-* @brief This class provides methods for handling a Cell Broadcast Service (CBS) channel.\r
-*\r
-* @since 2.0\r
-*\r
-* @final This class is not intended for extension.\r
-*\r
-* The %CbsChannel class provides methods for handling a CBS channel. @n\r
-* It allows you to get and set the CBS channel information.\r
-*/\r
-class _OSP_EXPORT_ CbsChannel\r
- : public Tizen::Base::Object\r
-{\r
-public:\r
-\r
- /**\r
- * This destructor overrides Tizen::Base::Object::~Object().\r
- *\r
- * @since 2.0\r
- */\r
- virtual ~CbsChannel(void);\r
-\r
- /**\r
- * Gets the range of a CBS channel.\r
- *\r
- * @since 2.0\r
- *\r
- * @return An error code\r
- * @param[out] from The starting index of the message ID of the channel\r
- * @param[out] to The last index of the message ID of the channel\r
- * @exception E_SUCCESS The method is successful.\r
- * @exception E_INVALID_STATE The range has not been set as yet.\r
- * @exception E_SYSTEM A system error has occurred.\r
- * @remarks In case of an error, this method sets the negative values for @c from and @c to. For example, @c -1.\r
- */\r
- result GetRange(int& from, int& to) const;\r
-\r
- /**\r
- * Gets the name of a CBS channel.\r
- *\r
- * @since 2.0\r
- *\r
- * @return The name of the channel @n\r
- * The name can be an empty string.\r
- */\r
- Tizen::Base::String GetName(void) const;\r
-\r
- /**\r
- * Checks whether a CBS channel is activated.\r
- *\r
- * @since 2.0\r
- *\r
- * @return @c true if a CBS channel is activated, @n\r
- * else @c false\r
- */\r
- bool IsActivated(void) const;\r
-\r
- /**\r
- * Activates the status of a CBS channel.\r
- *\r
- * @since 2.0\r
- * @privlevel platform\r
- * @privilege %http://tizen.org/privilege/cellbroadcast\r
- *\r
- * @return An error code\r
- * @exception E_SUCCESS The method is successful.\r
- * @exception E_ILLEGAL_ACCESS The application does not have the permission to activate the CBS channel status.\r
- * @exception E_SYSTEM A system error has occurred.\r
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
- */\r
- result Activate(void);\r
-\r
- /**\r
- * Deactivates the status of a CBS channel.\r
- *\r
- * @since 2.0\r
- * @privlevel platform\r
- * @privilege %http://tizen.org/privilege/cellbroadcast\r
- *\r
- * @return An error code\r
- * @exception E_SUCCESS The method is successful.\r
- * @exception E_ILLEGAL_ACCESS The application does not have the permission to activate the CBS channel status.\r
- * @exception E_SYSTEM A system error has occurred.\r
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
- */\r
- result Deactivate(void);\r
-\r
- /**\r
- * Updates the name of a CBS channel.\r
- *\r
- * @since 2.0\r
- * @privlevel platform\r
- * @privilege %http://tizen.org/privilege/cellbroadcast\r
- \r
- * @return An error code\r
- * @param[in] name The name of the CBS channel to update\r
- * @exception E_SUCCESS The method is successful.\r
- * @exception E_ILLEGAL_ACCESS The application does not have the permission to update the CBS channel name.\r
- * @exception E_SYSTEM A system error has occurred.\r
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
- */\r
- result UpdateName(const Tizen::Base::String& name);\r
-\r
-private:\r
- /**\r
- * This default constructor is intentionally declared as private so that only the platform can create an instance.\r
- *\r
- * @since 2.0\r
- */\r
- CbsChannel(void);\r
-\r
- /**\r
- * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.\r
- *\r
- * @param[in] rhs An instance of %CbsChannel\r
- */\r
- CbsChannel(const CbsChannel& rhs);\r
-\r
- /**\r
- * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.\r
- *\r
- * @param[in] rhs An instance of %CbsChannel\r
- */\r
- CbsChannel& operator =(const CbsChannel& rhs);\r
-\r
- /**\r
- * Initializes this instance of %CbsChannel with the specified parameters.\r
- *\r
- * @since 2.0\r
- *\r
- * @return An error code\r
- * @param[in] from The starting index of the message ID of the channel\r
- * @param[in] to The last index of the message ID of the channel\r
- * @param[in] name The name of the channel (can be an empty string)\r
- * @exception E_SUCCESS The method is successful.\r
- * @exception E_INVALID_ARG Either of the following conditions has occurred: @n\r
- * - The specified @c to parameter is smaller than @c from. @n\r
- * - The specified @c to or @c from parameter is a negative value. @n\r
- * - The specified @c to parameter exceeds the limit (0xFFFF). @n\r
- * - The range (@c to - @c from) exceeds the limit (0xFFFF). @n\r
- * - The specified @c name string length is greater than @c 32. @n\r
- * @exception E_SYSTEM A system error has occurred.\r
- */\r
- result Construct(int from, int to, const Tizen::Base::String& name);\r
-\r
-private:\r
- _CbsChannelImpl* __pCbsChannelImpl;\r
-\r
- friend class _CbsChannelImpl;\r
-}; // CbsChannel\r
-\r
-} } // Tizen::Messaging\r
-#endif // _FMSG_CBS_CHANNEL_H_\r
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 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.
+//
+/**
+* @file FMsgCbsChannel.h
+* @brief This is the header file for the %CbsChannel class.
+*
+* This header file contains the declarations of the %CbsChannel class.
+*/
+
+#ifndef _FMSG_CBS_CHANNEL_H_
+#define _FMSG_CBS_CHANNEL_H_
+
+namespace Tizen { namespace Base
+{
+class String;
+} }
+
+#include <FBaseObject.h>
+
+namespace Tizen { namespace Messaging
+{
+class _CbsChannelImpl;
+
+/**
+* @class CbsChannel
+* @brief This class provides methods for handling a Cell Broadcast Service (CBS) channel.
+*
+* @since 2.0
+*
+* @final This class is not intended for extension.
+*
+* The %CbsChannel class provides methods for handling a CBS channel. @n
+* It allows you to get and set the CBS channel information.
+*/
+class _OSP_EXPORT_ CbsChannel
+ : public Tizen::Base::Object
+{
+public:
+
+ /**
+ * This destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.0
+ */
+ virtual ~CbsChannel(void);
+
+ /**
+ * Gets the range of a CBS channel.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[out] from The starting index of the message ID of the channel
+ * @param[out] to The last index of the message ID of the channel
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_STATE The range has not been set as yet.
+ * @exception E_SYSTEM A system error has occurred.
+ * @remarks In case of an error, this method sets the negative values for @c from and @c to. For example, @c -1.
+ */
+ result GetRange(int& from, int& to) const;
+
+ /**
+ * Gets the name of a CBS channel.
+ *
+ * @since 2.0
+ *
+ * @return The name of the channel @n
+ * The name can be an empty string.
+ */
+ Tizen::Base::String GetName(void) const;
+
+ /**
+ * Checks whether a CBS channel is activated.
+ *
+ * @since 2.0
+ *
+ * @return @c true if a CBS channel is activated, @n
+ * else @c false
+ */
+ bool IsActivated(void) const;
+
+ /**
+ * Activates the status of a CBS channel.
+ *
+ * @since 2.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/cellbroadcast
+ *
+ * @return An error code
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_ILLEGAL_ACCESS The application does not have the permission to activate the CBS channel status.
+ * @exception E_SYSTEM A system error has occurred.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ */
+ result Activate(void);
+
+ /**
+ * Deactivates the status of a CBS channel.
+ *
+ * @since 2.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/cellbroadcast
+ *
+ * @return An error code
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_ILLEGAL_ACCESS The application does not have the permission to activate the CBS channel status.
+ * @exception E_SYSTEM A system error has occurred.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ */
+ result Deactivate(void);
+
+ /**
+ * Updates the name of a CBS channel.
+ *
+ * @since 2.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/cellbroadcast
+
+ * @return An error code
+ * @param[in] name The name of the CBS channel to update
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_ILLEGAL_ACCESS The application does not have the permission to update the CBS channel name.
+ * @exception E_SYSTEM A system error has occurred.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ */
+ result UpdateName(const Tizen::Base::String& name);
+
+private:
+ /**
+ * This default constructor is intentionally declared as private so that only the platform can create an instance.
+ *
+ * @since 2.0
+ */
+ CbsChannel(void);
+
+ /**
+ * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
+ *
+ * @param[in] rhs An instance of %CbsChannel
+ */
+ CbsChannel(const CbsChannel& rhs);
+
+ /**
+ * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ *
+ * @param[in] rhs An instance of %CbsChannel
+ */
+ CbsChannel& operator =(const CbsChannel& rhs);
+
+ /**
+ * Initializes this instance of %CbsChannel with the specified parameters.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] from The starting index of the message ID of the channel
+ * @param[in] to The last index of the message ID of the channel
+ * @param[in] name The name of the channel (can be an empty string)
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
+ * - The specified @c to parameter is smaller than @c from. @n
+ * - The specified @c to or @c from parameter is a negative value. @n
+ * - The specified @c to parameter exceeds the limit (0xFFFF). @n
+ * - The range (@c to - @c from) exceeds the limit (0xFFFF). @n
+ * - The specified @c name string length is greater than @c 32. @n
+ * @exception E_SYSTEM A system error has occurred.
+ */
+ result Construct(int from, int to, const Tizen::Base::String& name);
+
+private:
+ _CbsChannelImpl* __pCbsChannelImpl;
+
+ friend class _CbsChannelImpl;
+}; // CbsChannel
+
+} } // Tizen::Messaging
+#endif // _FMSG_CBS_CHANNEL_H_
License: Apache License, Version 2.0
Source0: %{name}-%{version}.tar.gz
BuildRequires: cmake
+BuildRequires: pkgconfig(chromium)
BuildRequires: pkgconfig(capi-appfw-application)
BuildRequires: pkgconfig(msg-service)
BuildRequires: pkgconfig(push)
-//\r
-// Open Service Platform\r
-// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
-//\r
-// Licensed under the Apache License, Version 2.0 (the License);\r
-// you may not use this file except in compliance with the License.\r
-// You may obtain a copy of the License at\r
-//\r
-// http://www.apache.org/licenses/LICENSE-2.0\r
-//\r
-// Unless required by applicable law or agreed to in writing, software\r
-// distributed under the License is distributed on an "AS IS" BASIS,\r
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-// See the License for the specific language governing permissions and\r
-// limitations under the License.\r
-//\r
-/**\r
- * @if VISPARTNER-OPERATOR\r
- *\r
- * @file FMsgCbsChannel.cpp\r
- * @brief This is the implementation file for the %CbsChannel class.\r
- *\r
- * @visibility partner-operator\r
- *\r
- * This file contains the implementation of the %CbsChannel class.\r
- *\r
- * @endif\r
-*/\r
-\r
-#include <FMsgCbsChannel.h>\r
-#include <FBaseSysLog.h>\r
-#include <FSec_AccessController.h>\r
-#include "FMsg_Types.h"\r
-#include "FMsg_CbsChannelImpl.h"\r
-\r
-using namespace Tizen::Base;\r
-using namespace Tizen::Messaging;\r
-using namespace Tizen::Security;\r
-\r
-namespace Tizen { namespace Messaging\r
-{\r
-\r
-CbsChannel::CbsChannel(void)\r
-{\r
- __pCbsChannelImpl = new (std::nothrow) _CbsChannelImpl();\r
- SysTryReturnVoidResult(NID_MSG, __pCbsChannelImpl != null, E_OUT_OF_MEMORY, "Memory allocation failed.");\r
-}\r
-\r
-CbsChannel::CbsChannel(const CbsChannel& value)\r
-{\r
- __pCbsChannelImpl = new (std::nothrow) _CbsChannelImpl(*(value.__pCbsChannelImpl));\r
- SysTryReturnVoidResult(NID_MSG, __pCbsChannelImpl != null, E_OUT_OF_MEMORY, "Memory allocation failed.");\r
-}\r
-\r
-CbsChannel::~CbsChannel(void)\r
-{\r
- if (__pCbsChannelImpl)\r
- {\r
- delete __pCbsChannelImpl;\r
- }\r
- __pCbsChannelImpl = null;\r
-}\r
-\r
-CbsChannel&\r
-CbsChannel::operator =(const CbsChannel& rhs)\r
-{\r
- if (this != &rhs)\r
- {\r
- *__pCbsChannelImpl = *(rhs.__pCbsChannelImpl);\r
- }\r
-\r
- return (*this);\r
-}\r
-\r
-result\r
-CbsChannel::Construct(int from, int to, const Tizen::Base::String& name)\r
-{\r
- result r = E_SUCCESS;\r
-\r
- SysAssertf(__pCbsChannelImpl != null, "The CbsChannel instance is not constructed yet.");\r
-\r
- // argument check\r
- SysTryReturnResult(NID_MSG, name.GetLength() <= MAX_CBS_CHANNEL_NAME_LENGTH, E_INVALID_ARG,\r
- "The length (%d) of channel name is too long.", name.GetLength());\r
-\r
- SysTryReturnResult(NID_MSG,\r
- ((to >= 0) && (from >= 0) && (to >= from) && (to <= MAX_CBS_CHANNEL_LIMIT) && ((to - from) <= MAX_CBS_CHANNEL_RANGE)),\r
- E_INVALID_ARG, "Failed to add construct channel, invalid arguments. to:[%d], from:[%d]", to , from);\r
-\r
- r = __pCbsChannelImpl->Construct(from, to, name);\r
- SysTryReturnResult(NID_MSG, r == E_SUCCESS, E_INVALID_ARG, "Failed to construct CbsChannel");\r
-\r
- return r;\r
-}\r
-\r
-result\r
-CbsChannel::UpdateName(const Tizen::Base::String& name)\r
-{\r
- result r = E_SUCCESS;\r
-\r
- SysAssertf(__pCbsChannelImpl != null, "The CbsChannel instance is not constructed yet.");\r
-\r
- // checking privilege\r
- r = _AccessController::CheckUserPrivilege(_PRV_CELLBROADCAST);\r
- SysTryReturn(NID_MSG, r == E_SUCCESS, E_PRIVILEGE_DENIED, r = E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] Propagating.");\r
-\r
- // argument check\r
- SysTryReturn(NID_MSG, name.GetLength() <= MAX_CBS_CHANNEL_NAME_LENGTH, E_INVALID_ARG, r = E_INVALID_ARG,\r
- "[E_INVALID_ARG] invalid channel name.");\r
-\r
- r = __pCbsChannelImpl->UpdateName(name);\r
-\r
- return r;\r
-}\r
-\r
-result\r
-CbsChannel::Deactivate(void)\r
-{\r
- result r = E_SUCCESS;\r
-\r
- SysAssertf(__pCbsChannelImpl != null, "The CbsChannel instance is not constructed yet.");\r
-\r
- // checking privilege\r
- r = _AccessController::CheckUserPrivilege(_PRV_CELLBROADCAST);\r
- SysTryReturn(NID_MSG, r == E_SUCCESS, E_PRIVILEGE_DENIED, r = E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] Propagating.");\r
-\r
- r = __pCbsChannelImpl->Deactivate();\r
- return r;\r
-}\r
-\r
-result\r
-CbsChannel::Activate(void)\r
-{\r
- result r = E_SUCCESS;\r
-\r
- SysAssertf(__pCbsChannelImpl != null, "The CbsChannel instance is not constructed yet.");\r
-\r
- // checking privilege\r
- r = _AccessController::CheckUserPrivilege(_PRV_CELLBROADCAST);\r
- SysTryReturn(NID_MSG, r == E_SUCCESS, E_PRIVILEGE_DENIED, r = E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] Propagating.");\r
-\r
- return __pCbsChannelImpl->Activate();\r
-}\r
-\r
-bool\r
-CbsChannel::IsActivated(void) const\r
-{\r
- SysAssertf(__pCbsChannelImpl != null, "The CbsChannel instance is not constructed yet.");\r
-\r
- return(__pCbsChannelImpl->IsActivated());\r
-}\r
-\r
-Tizen::Base::String\r
-CbsChannel::GetName(void) const\r
-{\r
- SysAssertf(__pCbsChannelImpl != null, "The CbsChannel instance is not constructed yet.");\r
-\r
- return(__pCbsChannelImpl->GetName());\r
-}\r
-\r
-result\r
-CbsChannel::GetRange(int& from, int& to) const\r
-{\r
- result r = E_SUCCESS;\r
-\r
- SysAssertf(__pCbsChannelImpl != null, "The CbsChannel instance is not constructed yet.");\r
-\r
- r = __pCbsChannelImpl->GetRange(from, to);\r
-\r
- return r;\r
-}\r
-\r
-} } // Tizen::Messaging\r
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 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.
+//
+/**
+ * @if VISPARTNER-OPERATOR
+ *
+ * @file FMsgCbsChannel.cpp
+ * @brief This is the implementation file for the %CbsChannel class.
+ *
+ * @visibility partner-operator
+ *
+ * This file contains the implementation of the %CbsChannel class.
+ *
+ * @endif
+*/
+
+#include <FMsgCbsChannel.h>
+#include <FBaseSysLog.h>
+#include <FSec_AccessController.h>
+#include "FMsg_Types.h"
+#include "FMsg_CbsChannelImpl.h"
+#include "FMsg_MessagingIpcProxy.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Messaging;
+using namespace Tizen::Security;
+
+namespace Tizen { namespace Messaging
+{
+
+CbsChannel::CbsChannel(void)
+{
+ __pCbsChannelImpl = new (std::nothrow) _CbsChannelImpl();
+ SysTryReturnVoidResult(NID_MSG, __pCbsChannelImpl != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
+}
+
+CbsChannel::CbsChannel(const CbsChannel& value)
+{
+ __pCbsChannelImpl = new (std::nothrow) _CbsChannelImpl(*(value.__pCbsChannelImpl));
+ SysTryReturnVoidResult(NID_MSG, __pCbsChannelImpl != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
+}
+
+CbsChannel::~CbsChannel(void)
+{
+ if (__pCbsChannelImpl)
+ {
+ delete __pCbsChannelImpl;
+ }
+ __pCbsChannelImpl = null;
+}
+
+CbsChannel&
+CbsChannel::operator =(const CbsChannel& rhs)
+{
+ if (this != &rhs)
+ {
+ *__pCbsChannelImpl = *(rhs.__pCbsChannelImpl);
+ }
+
+ return (*this);
+}
+
+result
+CbsChannel::Construct(int from, int to, const Tizen::Base::String& name)
+{
+ result r = E_SUCCESS;
+
+ SysAssertf(__pCbsChannelImpl != null, "The CbsChannel instance is not constructed yet.");
+
+ // argument check
+ SysTryReturnResult(NID_MSG, name.GetLength() <= MAX_CBS_CHANNEL_NAME_LENGTH, E_INVALID_ARG,
+ "The length (%d) of channel name is too long.", name.GetLength());
+
+ SysTryReturnResult(NID_MSG,
+ ((to >= 0) && (from >= 0) && (to >= from) && (to <= MAX_CBS_CHANNEL_LIMIT) && ((to - from) <= MAX_CBS_CHANNEL_RANGE)),
+ E_INVALID_ARG, "Failed to add construct channel, invalid arguments. to:[%d], from:[%d]", to , from);
+
+ r = __pCbsChannelImpl->Construct(from, to, name);
+ SysTryReturnResult(NID_MSG, r == E_SUCCESS, E_INVALID_ARG, "Failed to construct CbsChannel");
+
+ return r;
+}
+
+result
+CbsChannel::UpdateName(const Tizen::Base::String& name)
+{
+ result r = E_SUCCESS;
+
+ SysAssertf(__pCbsChannelImpl != null, "The CbsChannel instance is not constructed yet.");
+
+ // checking privilege
+ r = _AccessController::CheckUserPrivilege(_PRV_CELLBROADCAST);
+ SysTryReturn(NID_MSG, r == E_SUCCESS, E_PRIVILEGE_DENIED, r = E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] Propagating.");
+
+ // argument check
+ SysTryReturn(NID_MSG, name.GetLength() <= MAX_CBS_CHANNEL_NAME_LENGTH, E_INVALID_ARG, r = E_INVALID_ARG,
+ "[E_INVALID_ARG] invalid channel name.");
+
+ r = __pCbsChannelImpl->UpdateName(name);
+
+ return r;
+}
+
+result
+CbsChannel::Deactivate(void)
+{
+ result r = E_SUCCESS;
+
+ SysAssertf(__pCbsChannelImpl != null, "The CbsChannel instance is not constructed yet.");
+
+ // checking privilege
+ r = _AccessController::CheckUserPrivilege(_PRV_CELLBROADCAST);
+ SysTryReturn(NID_MSG, r == E_SUCCESS, E_PRIVILEGE_DENIED, r = E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] Propagating.");
+
+ r = __pCbsChannelImpl->Deactivate();
+ return r;
+}
+
+result
+CbsChannel::Activate(void)
+{
+ result r = E_SUCCESS;
+
+ SysAssertf(__pCbsChannelImpl != null, "The CbsChannel instance is not constructed yet.");
+
+ // checking privilege
+ r = _AccessController::CheckUserPrivilege(_PRV_CELLBROADCAST);
+ SysTryReturn(NID_MSG, r == E_SUCCESS, E_PRIVILEGE_DENIED, r = E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] Propagating.");
+
+ return __pCbsChannelImpl->Activate();
+}
+
+bool
+CbsChannel::IsActivated(void) const
+{
+ SysAssertf(__pCbsChannelImpl != null, "The CbsChannel instance is not constructed yet.");
+
+ return(__pCbsChannelImpl->IsActivated());
+}
+
+Tizen::Base::String
+CbsChannel::GetName(void) const
+{
+ SysAssertf(__pCbsChannelImpl != null, "The CbsChannel instance is not constructed yet.");
+
+ return(__pCbsChannelImpl->GetName());
+}
+
+result
+CbsChannel::GetRange(int& from, int& to) const
+{
+ result r = E_SUCCESS;
+
+ SysAssertf(__pCbsChannelImpl != null, "The CbsChannel instance is not constructed yet.");
+
+ r = __pCbsChannelImpl->GetRange(from, to);
+
+ return r;
+}
+
+} } // Tizen::Messaging
-//\r
-// Open Service Platform\r
-// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
-//\r
-// Licensed under the Apache License, Version 2.0 (the License);\r
-// you may not use this file except in compliance with the License.\r
-// You may obtain a copy of the License at\r
-//\r
-// http://www.apache.org/licenses/LICENSE-2.0\r
-//\r
-// Unless required by applicable law or agreed to in writing, software\r
-// distributed under the License is distributed on an "AS IS" BASIS,\r
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-// See the License for the specific language governing permissions and\r
-// limitations under the License.\r
-//\r
-/**\r
- * @if VISPARTNER-OPERATOR\r
- *\r
- * @file FMsg_CbsChannelImpl.cpp\r
- * @brief This is the implementation file for the %_CbsChannelImpl class.\r
- *\r
- * @visibility partner-operator\r
- *\r
- * This file contains the implementation of the %_CbsChannelImpl class.\r
- *\r
- * @endif\r
- */\r
-\r
-#include <msg.h>\r
-#include <msg_transport.h>\r
-#include <msg_storage.h>\r
-#include <FMsgCbsChannel.h>\r
-#include <FBaseSysLog.h>\r
-#include <FBaseUtilStringUtil.h>\r
-#include <FBase_StringConverter.h>\r
-#include <FSec_AccessController.h>\r
-#include "FMsg_Types.h"\r
-#include "FMsg_CbsChannelImpl.h"\r
-#include "FMsg_SmsMmsCallbackHandler.h"\r
-\r
-using namespace Tizen::Base;\r
-using namespace Tizen::Messaging;\r
-using namespace Tizen::Security;\r
-\r
-namespace Tizen { namespace Messaging\r
-{\r
-\r
-_CbsChannelImpl::_CbsChannelImpl(void)\r
- : __fromId(-1)\r
- , __toId(-1)\r
- , __channelName(L"")\r
- , __isChannelEnable(false)\r
-{\r
-}\r
-\r
-_CbsChannelImpl::_CbsChannelImpl(const _CbsChannelImpl& value)\r
-{\r
- __fromId = value.__fromId;\r
- __toId = value.__toId;\r
- __channelName = value.__channelName;\r
- __isChannelEnable = value.__isChannelEnable;\r
-}\r
-\r
-_CbsChannelImpl::~_CbsChannelImpl(void)\r
-{\r
-}\r
-\r
-_CbsChannelImpl&\r
-_CbsChannelImpl::operator =(const _CbsChannelImpl& rhs)\r
-{\r
- if (this != &rhs)\r
- {\r
- __fromId = rhs.__fromId;\r
- __toId = rhs.__toId;\r
- __channelName = rhs.__channelName;\r
- __isChannelEnable = rhs.__isChannelEnable;\r
- }\r
-\r
- return (*this);\r
-}\r
-\r
-result\r
-_CbsChannelImpl::Construct(int from, int to, const Tizen::Base::String& name)\r
-{\r
- __fromId = from;\r
- __toId = to;\r
- __channelName = name;\r
- __isChannelEnable = false;\r
-\r
- return E_SUCCESS;\r
-}\r
-\r
-CbsChannel*\r
-_CbsChannelImpl::GetCbsChannelN(int from, int to, const Tizen::Base::String& name)\r
-{\r
- result r = E_SUCCESS;\r
- CbsChannel* pCbsChannel = null;\r
-\r
- pCbsChannel = new (std::nothrow) CbsChannel();\r
- SysTryCatch(NID_MSG, pCbsChannel != null, r = E_OUT_OF_MEMORY, r, "memory allocation failed");\r
-\r
- r = pCbsChannel->Construct(from, to, name);\r
- SysTryCatch(NID_MSG, r == E_SUCCESS, , r, "failed to construct channel.");\r
-\r
- SetLastResult(GetLastResult());\r
- return pCbsChannel;\r
-\r
-CATCH:\r
- SetLastResult(GetLastResult());\r
-\r
- if(pCbsChannel)\r
- {\r
- delete pCbsChannel;\r
- pCbsChannel = null;\r
- }\r
-\r
- return null;\r
-}\r
-\r
-_CbsChannelImpl*\r
-_CbsChannelImpl::GetInstance(CbsChannel& cbsChannel)\r
-{\r
- return cbsChannel.__pCbsChannelImpl;\r
-}\r
-\r
-result\r
-_CbsChannelImpl::UpdateName(const Tizen::Base::String& name)\r
-{\r
- result r = E_SUCCESS;\r
- ClearLastResult();\r
-\r
- // save the setting\r
- r = _SmsMmsCallbackHandler::GetInstance()->UpdateCbsChannel(__fromId, __toId, name, __isChannelEnable);\r
- SysTryReturn(NID_MSG, r == E_SUCCESS, r, r, "Failed to save the setting.");\r
-\r
- __channelName = name;\r
-\r
- return r;\r
-}\r
-\r
-result\r
-_CbsChannelImpl::Deactivate(void)\r
-{\r
- result r = E_SUCCESS;\r
- ClearLastResult();\r
-\r
- // save the setting\r
- r = _SmsMmsCallbackHandler::GetInstance()->UpdateCbsChannel(__fromId, __toId, __channelName, false);\r
- SysTryReturn(NID_MSG, r == E_SUCCESS, r, r, "Failed to save the setting.");\r
-\r
- __isChannelEnable = false;\r
-\r
- return r;\r
-}\r
-\r
-result\r
-_CbsChannelImpl::Activate(void)\r
-{\r
- result r = E_SUCCESS;\r
- ClearLastResult();\r
-\r
- // save the setting\r
- r = _SmsMmsCallbackHandler::GetInstance()->UpdateCbsChannel(__fromId, __toId, __channelName, true);\r
- SysTryReturn(NID_MSG, r == E_SUCCESS, r, r, "Failed to save the setting.");\r
-\r
- __isChannelEnable = true;\r
-\r
- return r;\r
-}\r
-\r
-bool\r
-_CbsChannelImpl::IsActivated(void) const\r
-{\r
- return __isChannelEnable;\r
-}\r
-\r
-Tizen::Base::String\r
-_CbsChannelImpl::GetName(void) const\r
-{\r
- return __channelName;\r
-}\r
-\r
-result\r
-_CbsChannelImpl::GetRange(int& from, int& to) const\r
-{\r
- result r = E_SUCCESS;\r
-\r
- from = __fromId;\r
- to = __toId;\r
-\r
- return r;\r
-}\r
-\r
-void \r
-_CbsChannelImpl::SetCbsChannelName(Tizen::Base::String channelName)\r
-{\r
- __channelName = channelName;\r
-}\r
-\r
-void \r
-_CbsChannelImpl::SetCbsChannelState(bool isChannelEnable)\r
-{\r
- __isChannelEnable = isChannelEnable;\r
-}\r
-\r
-} } // Tizen::Messaging\r
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 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.
+//
+/**
+ * @if VISPARTNER-OPERATOR
+ *
+ * @file FMsg_CbsChannelImpl.cpp
+ * @brief This is the implementation file for the %_CbsChannelImpl class.
+ *
+ * @visibility partner-operator
+ *
+ * This file contains the implementation of the %_CbsChannelImpl class.
+ *
+ * @endif
+ */
+
+#include <msg.h>
+#include <msg_transport.h>
+#include <msg_storage.h>
+#include <FMsgCbsChannel.h>
+#include <FBaseSysLog.h>
+#include <FBaseUtilStringUtil.h>
+#include <FBase_StringConverter.h>
+#include <FSec_AccessController.h>
+#include "FMsg_Types.h"
+#include "FMsg_CbsChannelImpl.h"
+#include "FMsg_SmsMmsCallbackHandler.h"
+#include "FMsg_MessagingIpcProxy.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Messaging;
+using namespace Tizen::Security;
+
+namespace Tizen { namespace Messaging
+{
+
+_CbsChannelImpl::_CbsChannelImpl(void)
+ : __fromId(-1)
+ , __toId(-1)
+ , __channelName(L"")
+ , __isChannelEnable(false)
+{
+}
+
+_CbsChannelImpl::_CbsChannelImpl(const _CbsChannelImpl& value)
+{
+ __fromId = value.__fromId;
+ __toId = value.__toId;
+ __channelName = value.__channelName;
+ __isChannelEnable = value.__isChannelEnable;
+}
+
+_CbsChannelImpl::~_CbsChannelImpl(void)
+{
+}
+
+_CbsChannelImpl&
+_CbsChannelImpl::operator =(const _CbsChannelImpl& rhs)
+{
+ if (this != &rhs)
+ {
+ __fromId = rhs.__fromId;
+ __toId = rhs.__toId;
+ __channelName = rhs.__channelName;
+ __isChannelEnable = rhs.__isChannelEnable;
+ }
+
+ return (*this);
+}
+
+result
+_CbsChannelImpl::Construct(int from, int to, const Tizen::Base::String& name)
+{
+ __fromId = from;
+ __toId = to;
+ __channelName = name;
+ __isChannelEnable = false;
+
+ return E_SUCCESS;
+}
+
+CbsChannel*
+_CbsChannelImpl::GetCbsChannelN(int from, int to, const Tizen::Base::String& name)
+{
+ result r = E_SUCCESS;
+ CbsChannel* pCbsChannel = null;
+
+ pCbsChannel = new (std::nothrow) CbsChannel();
+ SysTryCatch(NID_MSG, pCbsChannel != null, r = E_OUT_OF_MEMORY, r, "memory allocation failed");
+
+ r = pCbsChannel->Construct(from, to, name);
+ SysTryCatch(NID_MSG, r == E_SUCCESS, , r, "failed to construct channel.");
+
+ SetLastResult(GetLastResult());
+ return pCbsChannel;
+
+CATCH:
+ SetLastResult(GetLastResult());
+
+ if(pCbsChannel)
+ {
+ delete pCbsChannel;
+ pCbsChannel = null;
+ }
+
+ return null;
+}
+
+_CbsChannelImpl*
+_CbsChannelImpl::GetInstance(CbsChannel& cbsChannel)
+{
+ return cbsChannel.__pCbsChannelImpl;
+}
+
+result
+_CbsChannelImpl::UpdateName(const Tizen::Base::String& name)
+{
+ result r = E_SUCCESS;
+ ClearLastResult();
+ SysTryReturnResult(NID_MSG, _MessagingProxy::GetInstance()!= null, E_OUT_OF_MEMORY,"Failed to get msg proxy instance");
+ r = _MessagingProxy::GetInstance()->UpdateCbsChannel(__fromId, __toId, name, __isChannelEnable);
+ SysTryReturnResult(NID_MSG, r == E_SUCCESS, r, "Failed to update cbs channel.");
+
+ __channelName = name;
+
+ return r;
+}
+
+result
+_CbsChannelImpl::Deactivate(void)
+{
+ result r = E_SUCCESS;
+ ClearLastResult();
+
+ SysTryReturnResult(NID_MSG, _MessagingProxy::GetInstance()!= null, E_OUT_OF_MEMORY,"Failed to get msg proxy instance");
+ r = _MessagingProxy::GetInstance()->UpdateCbsChannel(__fromId, __toId, __channelName, false);
+ SysTryReturnResult(NID_MSG, r == E_SUCCESS, r, "Failed to save the setting.");
+
+ __isChannelEnable = false;
+
+ return r;
+}
+
+result
+_CbsChannelImpl::Activate(void)
+{
+ result r = E_SUCCESS;
+ ClearLastResult();
+
+ SysTryReturnResult(NID_MSG, _MessagingProxy::GetInstance()!= null, E_OUT_OF_MEMORY, "Failed to get msg proxy instance");
+ r = _MessagingProxy::GetInstance()->UpdateCbsChannel(__fromId, __toId, __channelName, true);
+ SysTryReturnResult(NID_MSG, r == E_SUCCESS, r, "Failed to save the setting.");
+
+ __isChannelEnable = true;
+
+ return r;
+}
+
+bool
+_CbsChannelImpl::IsActivated(void) const
+{
+ return __isChannelEnable;
+}
+
+Tizen::Base::String
+_CbsChannelImpl::GetName(void) const
+{
+ return __channelName;
+}
+
+result
+_CbsChannelImpl::GetRange(int& from, int& to) const
+{
+ result r = E_SUCCESS;
+
+ from = __fromId;
+ to = __toId;
+
+ return r;
+}
+
+void
+_CbsChannelImpl::SetCbsChannelName(Tizen::Base::String channelName)
+{
+ __channelName = channelName;
+}
+
+void
+_CbsChannelImpl::SetCbsChannelState(bool isChannelEnable)
+{
+ __isChannelEnable = isChannelEnable;
+}
+
+} } // Tizen::Messaging
-//\r
-// Open Service Platform\r
-// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
-//\r
-// Licensed under the Apache License, Version 2.0 (the License);\r
-// you may not use this file except in compliance with the License.\r
-// You may obtain a copy of the License at\r
-//\r
-// http://www.apache.org/licenses/LICENSE-2.0\r
-//\r
-// Unless required by applicable law or agreed to in writing, software\r
-// distributed under the License is distributed on an "AS IS" BASIS,\r
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-// See the License for the specific language governing permissions and\r
-// limitations under the License.\r
-//\r
-/**\r
- * @if VISPARTNER-OPERATOR\r
- *\r
- * @file FMsg_CbsChannelImpl.h\r
- * @brief This is the header file for the _CbsChannelImpl class.\r
- *\r
- * @visibility partner-operator\r
- *\r
- * This header file contains the declarations of the _CbsChannelImpl class.\r
- *\r
- * @endif\r
- */\r
-\r
-#ifndef _FMSG_INTERNAL_CBS_CHANNEL_IMPL_H_\r
-#define _FMSG_INTERNAL_CBS_CHANNEL_IMPL_H_\r
-\r
-namespace Tizen { namespace Messaging\r
-{\r
-\r
-/**\r
-* @if VISPARTNER-OPERATOR\r
-*\r
-* @class _CbsChannelImpl\r
-* @brief This class provides methods for handling a Cell Broadcast Service (CBS) channel.\r
-*\r
-* @since 2.1\r
-*\r
-* @final This class is not intended for extension.\r
-*\r
-* @visibility partner-operator\r
-*\r
-* The %_CbsChannelImpl class provides methods for handling a CBS channel. @n\r
-* It allows you to get and set the CBS channel information.\r
-*\r
-* @endif\r
-*/\r
-\r
-class _CbsChannelImpl\r
- : public Tizen::Base::Object\r
-{\r
-public:\r
-\r
- /**\r
- * @if VISPARTNER-OPERATOR\r
- *\r
- * This destructor overrides Tizen::Base::Object::~Object().\r
- *\r
- * @since 2.1\r
- *\r
- * @visibility partner-operator\r
- *\r
- * @endif\r
- */\r
- virtual ~_CbsChannelImpl(void);\r
-\r
- /**\r
- * @if VISPARTNER-OPERATOR\r
- *\r
- * Gets the range of the channel\r
- *\r
- * @since 2.1\r
- *\r
- * @visibility partner-operator\r
- *\r
- * @privlevel user\r
- * @privilege http://tizen.org/privilege/cellbroadcast\r
- *\r
- *\r
- * @return An error code\r
- * @param[out] from The starting index of the message ID of the channel.\r
- * @param[out] to The last index of the message ID of the channel.\r
- * @exception E_SUCCESS The method is successful.\r
- * @exception E_INVALID_STATE The range has not been set as yet.\r
- * @exception E_SYSTEM A system error has occurred.\r
- * @remarks In case of an error, this method sets the negative values for @c from and @c to. For example, @c -1.\r
- *\r
- * @endif\r
- */\r
- result GetRange(int& from, int& to) const;\r
-\r
- /**\r
- * @if VISPARTNER-OPERATOR\r
- *\r
- * Gets the name of the channel.\r
- *\r
- * @since 2.1\r
- *\r
- * @visibility partner-operator\r
- *\r
- * @privlevel user\r
- * @privilege http://tizen.org/privilege/cellbroadcast\r
- *\r
- * @return The name of the channel\r
- *\r
- * @remark The name can be an empty string.\r
- *\r
- * @endif\r
- */\r
- Tizen::Base::String GetName(void) const;\r
-\r
- /**\r
- * @if VISPARTNER-OPERATOR\r
- *\r
- * Gets the activation status of the channel.\r
- *\r
- * @since 2.1\r
- *\r
- * @visibility partner-operator\r
- *\r
- * @privlevel user\r
- * @privilege http://tizen.org/privilege/cellbroadcast\r
- *\r
- * @return @c true if the channel is activated,\r
- * else @c false\r
- *\r
- * @endif\r
- */\r
- bool IsActivated(void) const;\r
-\r
- /**\r
- * @if VISPARTNER-OPERATOR\r
- *\r
- * Activates the channel status .\r
- *\r
- * @since 2.1\r
- *\r
- * @visibility partner-operator\r
- *\r
- * @privlevel user\r
- * @privilege http://tizen.org/privilege/cellbroadcast\r
- *\r
- * @return An error code\r
- * @exception E_SUCCESS The method is successful.\r
- * @exception E_ILLEGAL_ACCESS The application does not have the permission to activate the CBS channel status.\r
- * @exception E_SYSTEM A system error has occurred.\r
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
- *\r
- * @endif\r
- */\r
- result Activate(void);\r
-\r
- /**\r
- * @if VISPARTNER-OPERATOR\r
- *\r
- * Deactivates the channel status\r
- *\r
- * @privlevel user\r
- * @privilege http://tizen.org/privilege/cellbroadcast\r
- *\r
- * @since 2.1\r
- *\r
- * @visibility partner-operator\r
- *\r
- * @return An error code\r
- * @exception E_SUCCESS The method is successful.\r
- * @exception E_ILLEGAL_ACCESS The application does not have the permission to activate the CBS channel status.\r
- * @exception E_SYSTEM A system error has occurred.\r
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
- *\r
- * @endif\r
- */\r
- result Deactivate(void);\r
-\r
- /**\r
- * @if VISPARTNER-OPERATOR\r
- *\r
- * Updates the name of the channel.\r
- *\r
- * @privlevel user\r
- * @privilege http://tizen.org/privilege/cellbroadcast\r
- *\r
- * @since 2.1\r
- *\r
- * @visibility partner-operator\r
- *\r
- * @return An error code\r
- * @param[in] name The name of the CBS channel to update\r
- * @exception E_SUCCESS The method is successful.\r
- * @exception E_ILLEGAL_ACCESS The application does not have the permission to update the CBS channel name.\r
- * @exception E_SYSTEM A system error has occurred.\r
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
- *\r
- * @endif\r
- */\r
- result UpdateName(const Tizen::Base::String& name);\r
-\r
- /**\r
- * Sets the cbs channel name to CbsChannelImpl object.\r
- *\r
- * @since 2.1\r
- * @param[in] channelName An Cbs Channel Name\r
- */\r
- void SetCbsChannelName(Tizen::Base::String channelName);\r
-\r
- /**\r
- * Sets the cbs Channel State to CbsChannelImpl object.\r
- *\r
- * @since 2.1\r
- * @param[in] isChannelEnable CBS on/off flag\r
- */\r
- void SetCbsChannelState(bool isChannelEnable);\r
-\r
-public:\r
- /**\r
- * Gets the instance of CbsChannel\r
- *\r
- * @since 2.1\r
- */\r
- static CbsChannel* GetCbsChannelN(int from, int to, const Tizen::Base::String& name);\r
-\r
- /**\r
- * Gets the Impl instance.\r
- *\r
- * @since 2.1\r
- * @return The pointer to _CbsChannelImpl\r
- * @param[in] CbsChannel An instance of CbsChannel\r
- */\r
- static _CbsChannelImpl* GetInstance(CbsChannel& cbsChannel);\r
-\r
-public:\r
- /**\r
- * This default constructor is intentionally declared as private so that only the platform can create an instance.\r
- *\r
- * @since 2.1\r
- */\r
- _CbsChannelImpl(void);\r
-\r
- /**\r
- * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.\r
- *\r
- * @param[in] rhs An instance of _CbsChannelImpl\r
- */\r
- _CbsChannelImpl(const _CbsChannelImpl& rhs);\r
-\r
- /**\r
- * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.\r
- *\r
- * @param[in] rhs An instance of _CbsChannelImpl\r
- */\r
- _CbsChannelImpl& operator =(const _CbsChannelImpl& rhs);\r
-\r
- /**\r
- * Initializes this instance of %_CbsChannelImpl with the specified parameter.\r
- *\r
- * @since 2.1\r
- *\r
- * @return An error code\r
- * @param[in] from The starting index of the message ID of the channel.\r
- * @param[in] to The last index of the message ID of the channel.\r
- * @param[in] name The name of the channel. (can be an empty string)\r
- * @exception E_SUCCESS The method is successful.\r
- * @exception E_INVALID_ARG The specified @c to parameter is smaller than @c from. @n\r
- * The specified @c to or @c from parameter is a negative value. @n\r
- * The specified @c to parameter exceeds the limit (0xFFFF). @n\r
- * The range (@c to - @c from) exceeds the limit (0xFFFF).\r
- * The specified @c name string length is greater than @c 32. @n\r
- * @exception E_OUT_OF_MEMORY The memory is insufficient.\r
- * @exception E_SYSTEM A system error has occurred.\r
- */\r
- result Construct(int from, int to, const Tizen::Base::String& name);\r
-\r
-private:\r
- int __fromId;\r
- int __toId;\r
- Tizen::Base::String __channelName;\r
- bool __isChannelEnable;\r
-}; // _CbsChannelImpl\r
-\r
-} } // Tizen::Messaging\r
-#endif // _FMSG_INTERNAL_CBS_CHANNEL_IMPL_H_\r
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 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.
+//
+/**
+ * @if VISPARTNER-OPERATOR
+ *
+ * @file FMsg_CbsChannelImpl.h
+ * @brief This is the header file for the _CbsChannelImpl class.
+ *
+ * @visibility partner-operator
+ *
+ * This header file contains the declarations of the _CbsChannelImpl class.
+ *
+ * @endif
+ */
+
+#ifndef _FMSG_INTERNAL_CBS_CHANNEL_IMPL_H_
+#define _FMSG_INTERNAL_CBS_CHANNEL_IMPL_H_
+
+namespace Tizen { namespace Messaging
+{
+
+/**
+* @if VISPARTNER-OPERATOR
+*
+* @class _CbsChannelImpl
+* @brief This class provides methods for handling a Cell Broadcast Service (CBS) channel.
+*
+* @since 2.1
+*
+* @final This class is not intended for extension.
+*
+* @visibility partner-operator
+*
+* The %_CbsChannelImpl class provides methods for handling a CBS channel. @n
+* It allows you to get and set the CBS channel information.
+*
+* @endif
+*/
+
+class _CbsChannelImpl
+ : public Tizen::Base::Object
+{
+public:
+
+ /**
+ * @if VISPARTNER-OPERATOR
+ *
+ * This destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.1
+ *
+ * @visibility partner-operator
+ *
+ * @endif
+ */
+ virtual ~_CbsChannelImpl(void);
+
+ /**
+ * @if VISPARTNER-OPERATOR
+ *
+ * Gets the range of the channel
+ *
+ * @since 2.1
+ *
+ * @visibility partner-operator
+ *
+ * @privlevel user
+ * @privilege http://tizen.org/privilege/cellbroadcast
+ *
+ *
+ * @return An error code
+ * @param[out] from The starting index of the message ID of the channel.
+ * @param[out] to The last index of the message ID of the channel.
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_STATE The range has not been set as yet.
+ * @exception E_SYSTEM A system error has occurred.
+ * @remarks In case of an error, this method sets the negative values for @c from and @c to. For example, @c -1.
+ *
+ * @endif
+ */
+ result GetRange(int& from, int& to) const;
+
+ /**
+ * @if VISPARTNER-OPERATOR
+ *
+ * Gets the name of the channel.
+ *
+ * @since 2.1
+ *
+ * @visibility partner-operator
+ *
+ * @privlevel user
+ * @privilege http://tizen.org/privilege/cellbroadcast
+ *
+ * @return The name of the channel
+ *
+ * @remark The name can be an empty string.
+ *
+ * @endif
+ */
+ Tizen::Base::String GetName(void) const;
+
+ /**
+ * @if VISPARTNER-OPERATOR
+ *
+ * Gets the activation status of the channel.
+ *
+ * @since 2.1
+ *
+ * @visibility partner-operator
+ *
+ * @privlevel user
+ * @privilege http://tizen.org/privilege/cellbroadcast
+ *
+ * @return @c true if the channel is activated,
+ * else @c false
+ *
+ * @endif
+ */
+ bool IsActivated(void) const;
+
+ /**
+ * @if VISPARTNER-OPERATOR
+ *
+ * Activates the channel status .
+ *
+ * @since 2.1
+ *
+ * @visibility partner-operator
+ *
+ * @privlevel user
+ * @privilege http://tizen.org/privilege/cellbroadcast
+ *
+ * @return An error code
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_ILLEGAL_ACCESS The application does not have the permission to activate the CBS channel status.
+ * @exception E_SYSTEM A system error has occurred.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ *
+ * @endif
+ */
+ result Activate(void);
+
+ /**
+ * @if VISPARTNER-OPERATOR
+ *
+ * Deactivates the channel status
+ *
+ * @privlevel user
+ * @privilege http://tizen.org/privilege/cellbroadcast
+ *
+ * @since 2.1
+ *
+ * @visibility partner-operator
+ *
+ * @return An error code
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_ILLEGAL_ACCESS The application does not have the permission to activate the CBS channel status.
+ * @exception E_SYSTEM A system error has occurred.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ *
+ * @endif
+ */
+ result Deactivate(void);
+
+ /**
+ * @if VISPARTNER-OPERATOR
+ *
+ * Updates the name of the channel.
+ *
+ * @privlevel user
+ * @privilege http://tizen.org/privilege/cellbroadcast
+ *
+ * @since 2.1
+ *
+ * @visibility partner-operator
+ *
+ * @return An error code
+ * @param[in] name The name of the CBS channel to update
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_ILLEGAL_ACCESS The application does not have the permission to update the CBS channel name.
+ * @exception E_SYSTEM A system error has occurred.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ *
+ * @endif
+ */
+ result UpdateName(const Tizen::Base::String& name);
+
+ /**
+ * Sets the cbs channel name to CbsChannelImpl object.
+ *
+ * @since 2.1
+ * @param[in] channelName An Cbs Channel Name
+ */
+ void SetCbsChannelName(Tizen::Base::String channelName);
+
+ /**
+ * Sets the cbs Channel State to CbsChannelImpl object.
+ *
+ * @since 2.1
+ * @param[in] isChannelEnable CBS on/off flag
+ */
+ void SetCbsChannelState(bool isChannelEnable);
+
+public:
+ /**
+ * Gets the instance of CbsChannel
+ *
+ * @since 2.1
+ */
+ static CbsChannel* GetCbsChannelN(int from, int to, const Tizen::Base::String& name);
+
+ /**
+ * Gets the Impl instance.
+ *
+ * @since 2.1
+ * @return The pointer to _CbsChannelImpl
+ * @param[in] CbsChannel An instance of CbsChannel
+ */
+ static _CbsChannelImpl* GetInstance(CbsChannel& cbsChannel);
+
+public:
+ /**
+ * This default constructor is intentionally declared as private so that only the platform can create an instance.
+ *
+ * @since 2.1
+ */
+ _CbsChannelImpl(void);
+
+ /**
+ * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
+ *
+ * @param[in] rhs An instance of _CbsChannelImpl
+ */
+ _CbsChannelImpl(const _CbsChannelImpl& rhs);
+
+ /**
+ * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ *
+ * @param[in] rhs An instance of _CbsChannelImpl
+ */
+ _CbsChannelImpl& operator =(const _CbsChannelImpl& rhs);
+
+ /**
+ * Initializes this instance of %_CbsChannelImpl with the specified parameter.
+ *
+ * @since 2.1
+ *
+ * @return An error code
+ * @param[in] from The starting index of the message ID of the channel.
+ * @param[in] to The last index of the message ID of the channel.
+ * @param[in] name The name of the channel. (can be an empty string)
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified @c to parameter is smaller than @c from. @n
+ * The specified @c to or @c from parameter is a negative value. @n
+ * The specified @c to parameter exceeds the limit (0xFFFF). @n
+ * The range (@c to - @c from) exceeds the limit (0xFFFF).
+ * The specified @c name string length is greater than @c 32. @n
+ * @exception E_OUT_OF_MEMORY The memory is insufficient.
+ * @exception E_SYSTEM A system error has occurred.
+ */
+ result Construct(int from, int to, const Tizen::Base::String& name);
+
+private:
+ int __fromId;
+ int __toId;
+ Tizen::Base::String __channelName;
+ bool __isChannelEnable;
+}; // _CbsChannelImpl
+
+} } // Tizen::Messaging
+#endif // _FMSG_INTERNAL_CBS_CHANNEL_IMPL_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 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.
+//
+/**
+ * @file FMsg_MessagingIpcProxy.cpp
+ * @brief This is the implementation file for the %_MessagingProxy class.
+ *
+ * This file contains the implementation of the %_MessagingProxy class.
+ */
+#include <msg.h>
+#include <msg_transport.h>
+#include <msg_storage.h>
+#include <dbus/dbus.h>
+#include <email-api.h>
+#include <FIo_IpcClient.h>
+#include <FBase_StringConverter.h>
+#include <FBaseInteger.h>
+#include "FMsg_MessagingMessageTypes.h"
+#include "FMsg_MessagingIpcProxy.h"
+#include "FMsg_SmsEvent.h"
+#include "FMsg_SmsEventArg.h"
+#include "FMsg_MsgUtil.h"
+#include "FMsg_SmsMmsCallbackHandler.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Messaging;
+using namespace Tizen::Io;
+
+namespace Tizen { namespace Messaging
+{
+
+_MessagingProxy* _MessagingProxy::__pSelf = null;
+
+_MessagingProxy::_MessagingProxy(void)
+ : __pIpcClient(null)
+ ,__pWapPushListener(null)
+ ,__pSmsListenerList(null)
+ ,__pCbsListenerEvent(null)
+ ,__pEtwsListenerEvent(null)
+
+{
+}
+
+
+_MessagingProxy::~_MessagingProxy(void)
+{
+ if(__pIpcClient)
+ {
+ delete __pIpcClient;
+ }
+
+}
+result
+_MessagingProxy::Construct(void)
+{
+
+
+ __pIpcClient = new (std::nothrow) _IpcClient();
+ SysTryReturnResult(NID_MSG, __pIpcClient != null, E_OUT_OF_MEMORY, "_IpcClient creation failed.");
+
+ result r = __pIpcClient->Construct(MESSAGING_IPC_SERVER_NAME, this);
+ SysTryReturnResult(NID_MSG, !IsFailed(r), r, "_IpcClient constructing faliied.");
+ std::atexit(DestroyInstance);
+
+ return r;
+}
+
+
+_MessagingProxy*
+_MessagingProxy::GetInstance(void)
+{
+ if(_MessagingProxy::__pSelf == null)
+ {
+ _MessagingProxy::__pSelf = new (std::nothrow)_MessagingProxy();
+ SysTryCatch(NID_MSG, __pSelf != null, , E_OUT_OF_MEMORY, "_IpcClient creation failed.");
+
+ result r = _MessagingProxy::__pSelf->Construct();
+ SysTryCatch(NID_MSG, !IsFailed(r), , r, "_IpcClient creation failed.");
+
+ }
+ return _MessagingProxy::__pSelf;
+
+CATCH:
+ if(_MessagingProxy::__pSelf)
+ {
+ delete _MessagingProxy::__pSelf;
+ _MessagingProxy::__pSelf = null;
+ }
+ return null;
+}
+
+void
+_MessagingProxy::DestroyInstance(void)
+{
+ if(_MessagingProxy::__pSelf)
+ {
+ delete _MessagingProxy::__pSelf ;
+ _MessagingProxy::__pSelf = null;
+
+ }
+
+}
+
+void
+_MessagingProxy::OnIpcResponseReceived(Tizen::Io::_IpcClient& client, const IPC::Message& message)
+{
+ IPC_BEGIN_MESSAGE_MAP(_MessagingProxy, message)
+ IPC_MESSAGE_HANDLER(MessagingMsgStart_wapPushEventCallBack, OnWapPushEventCallBack, &client)
+ IPC_MESSAGE_HANDLER(MessagingMsgStart_incomingEtwsCallback, OnIncomingEtwsCallback, &client)
+ IPC_MESSAGE_HANDLER(MessagingMsgStart_incomingCbsCallback, OnIncomingCbsCallback, &client)
+ IPC_MESSAGE_HANDLER(MessagingMsgStart_incomingSmsCallback, OnIncomingSmsCallback, &client)
+ IPC_END_MESSAGE_MAP()
+}
+
+
+result
+_MessagingProxy::AddWapPushEventListener(const Tizen::Base::String& wapApplicationId, _SmsEvent* pListener)
+{
+ result r = E_SUCCESS;
+ IPC::Message* pMessage = null;
+ unsigned long ret = 0;
+
+ SysTryReturnResult(NID_MSG, pListener != null, E_SYSTEM, "A system error occurred.");
+ __pWapPushListener = pListener;
+
+ pMessage = new (std::nothrow) MessagingMsgStart_addWapPushEventListener(wapApplicationId, &ret);
+ SysTryReturnResult(NID_MSG, pMessage != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ r = __pIpcClient->SendRequest(*pMessage);
+ delete pMessage;
+ SysTryReturnResult(NID_MSG, r == E_SUCCESS, E_SYSTEM, "A system error occurred.");
+
+ SysLog(NID_MSG, "The result of checking through IPC is %d.", ret);
+
+ return ret;
+
+}
+
+
+void
+_MessagingProxy::OnWapPushEventCallBack(const Tizen::Base::String &header, const Tizen::Base::ByteBuffer &body, int bodyLength)
+{
+
+ SysLog(NID_MSG, "push msg body: [%s]", body.GetPointer());
+ SysLog(NID_MSG, "push msg header: [%ls]", header.GetPointer());
+ SysLog(NID_MSG, "push body length: [%d]", bodyLength);
+
+ if (__pWapPushListener)
+ {
+ _SmsEventArg* pSmsEventArg = null;
+ pSmsEventArg = new (std::nothrow) _SmsEventArg(header, body, _SMS_EVENT_TYPE_WAP_PUSH_RECEIVE_RESULT);
+ SysTryReturnVoidResult(NID_MSG, pSmsEventArg != null, E_OUT_OF_MEMORY, "memory allocation failed.");
+ __pWapPushListener->Fire(*pSmsEventArg);
+ }
+
+}
+
+
+/*
+result
+_MessagingProxy::RemoveWapPushEventListener(const Tizen::Base::String& wapApplicationId)
+{
+ result r = E_SUCCESS;
+ IPC::Message* pMessage = null;
+ unsigned long ret = 0;
+
+
+ pMessage = new (std::nothrow) MessagingMsgStart_removeWapPushEventListener(wapApplicationId, &ret);
+ SysTryReturn(NID_MSG, pMessage != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+
+ r = __pIpcClient->SendRequest(*pMessage);
+ delete pMessage;
+ SysTryReturn(NID_MSG, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
+
+ SysLog(NID_MSG, "The result of checking through IPC is %d.", ret);
+
+ return ret;
+
+}
+*/
+result
+_MessagingProxy::RegisterCondition(const Tizen::Base::String& wapApplicationId, const Tizen::Base::String& contentType)
+{
+ result r = E_SUCCESS;
+ IPC::Message* pMessage = null;
+ unsigned long ret = 0;
+
+
+ pMessage = new (std::nothrow) MessagingMsgStart_registerCondition(wapApplicationId, contentType, &ret);
+ SysTryReturnResult(NID_MSG, pMessage != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ r = __pIpcClient->SendRequest(*pMessage);
+ delete pMessage;
+ SysTryReturnResult(NID_MSG, r == E_SUCCESS, E_SYSTEM, "A system error occurred.");
+
+ SysLog(NID_MSG, "The result of checking through IPC is %d.", ret);
+
+ return ret;
+
+}
+
+result
+_MessagingProxy::UnregisterCondition(const Tizen::Base::String& wapApplicationId, const Tizen::Base::String& contentType)
+{
+ result r = E_SUCCESS;
+ IPC::Message* pMessage = null;
+ unsigned long ret = 0;
+
+
+ pMessage = new (std::nothrow) MessagingMsgStart_unregisterCondition(wapApplicationId, contentType, &ret);
+ SysTryReturnResult(NID_MSG, pMessage != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ r = __pIpcClient->SendRequest(*pMessage);
+ delete pMessage;
+ SysTryReturnResult(NID_MSG, r == E_SUCCESS, E_SYSTEM, "A system error occurred.");
+
+ SysLog(NID_MSG, "The result of checking through IPC is %d.", ret);
+
+ return ret;
+
+}
+
+result
+_MessagingProxy::OpenMsgHandle()
+{
+
+ result r = 0;
+ IPC::Message* pMessage = null;
+ unsigned long ret = 0;
+
+
+ pMessage = new (std::nothrow) MessagingMsgStart_openMsgHandle(&ret);
+ SysTryReturnResult(NID_MSG, pMessage != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ r = __pIpcClient->SendRequest(*pMessage);
+ delete pMessage;
+ SysTryReturnResult(NID_MSG, r == E_SUCCESS, E_SYSTEM, "A system error occurred.");
+
+ SysLog(NID_MSG, "The result of checking through IPC is %d.", ret);
+
+ return ret;
+
+}
+
+
+result
+_MessagingProxy::OpenCbsHandle()
+{
+
+ result r = 0;
+ IPC::Message* pMessage = null;
+ unsigned long ret = 0;
+
+
+ pMessage = new (std::nothrow) MessagingMsgStart_openCbsHandle(&ret);
+ SysTryReturnResult(NID_MSG, pMessage != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ r = __pIpcClient->SendRequest(*pMessage);
+ delete pMessage;
+ SysTryReturnResult(NID_MSG, r == E_SUCCESS, E_SYSTEM, "A system error occurred.");
+
+ SysLog(NID_MSG, "The result of checking through IPC is %d.", ret);
+
+ return ret;
+
+}
+
+
+result
+_MessagingProxy::AddSmsEventListener(int port, Tizen::Base::Collection::ArrayList* pListenerList)
+{
+ result r = E_SUCCESS;
+ IPC::Message* pMessage = null;
+ unsigned long ret = 0;
+
+ SysTryReturnResult(NID_MSG, pListenerList != null, E_SYSTEM, "A system error occurred.");
+ __pSmsListenerList = pListenerList;
+
+ pMessage = new (std::nothrow) MessagingMsgStart_addSmsEventListener(port, &ret);
+ SysTryReturnResult(NID_MSG, pMessage != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ r = __pIpcClient->SendRequest(*pMessage);
+ delete pMessage;
+ SysTryReturnResult(NID_MSG, r == E_SUCCESS, E_SYSTEM, "A system error occurred.");
+
+ SysLog(NID_MSG, "The result of checking through IPC is %d.", ret);
+
+ return ret;
+
+}
+
+void
+_MessagingProxy::OnIncomingSmsCallback(int port, int displayTime, const Tizen::Base::String &message, const Tizen::Base::String &senderAddress)
+{
+
+ DateTime receivedTime = _MsgUtil::ConvertTime((time_t *) &displayTime);
+ if (_SmsMmsCallbackHandler::GetInstance()->GetInComingSmsCallback() && __pSmsListenerList->GetCount() > 0)
+ {
+ for( int i = 0; i < __pSmsListenerList->GetCount(); i++)
+ {
+ _SmsEvent* pSmsEvent = static_cast <_SmsEvent*>(__pSmsListenerList->GetAt(i));
+
+ if (pSmsEvent)
+ {
+ if (pSmsEvent->GetPort() == port)
+ {
+ _SmsEventArg* pSmsEventArg = null;
+ pSmsEventArg = new (std::nothrow) _SmsEventArg(port, receivedTime, message, senderAddress);
+ SysTryReturnVoidResult(NID_MSG, pSmsEventArg != null, E_OUT_OF_MEMORY, "memory allocation failed.");
+
+ pSmsEvent->Fire(*pSmsEventArg);
+ break;
+ }
+ }
+ }
+ }
+
+}
+
+result
+_MessagingProxy::AddCbsEtwsEventListener(bool enabled)
+{
+ result r = E_SUCCESS;
+ IPC::Message* pMessage = null;
+ unsigned long ret = 0;
+
+ pMessage = new (std::nothrow) MessagingMsgStart_addCbsEtwsEventListener(enabled, &ret);
+ SysTryReturnResult(NID_MSG, pMessage != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
+ r = __pIpcClient->SendRequest(*pMessage);
+ delete pMessage;
+ SysTryReturnResult(NID_MSG, r == E_SUCCESS, E_SYSTEM, "A system error occurred.");
+ SysLog(NID_MSG, "The result of checking through IPC is %d.", ret);
+
+ return ret;
+
+}
+
+void
+_MessagingProxy::OnIncomingEtwsCallback(int tempReceivedTime, const Tizen::Base::ByteBuffer &msgSerialNumber, const Tizen::Base::ByteBuffer &msgSecurityInfo, int messgeId, const Tizen::Base::ByteBuffer &etwsMsgWarningType)
+{
+
+ _SmsEventArg* pSmsEventArg = null;
+ DateTime receivedTime;
+ receivedTime = _MsgUtil::ConvertTime((time_t *) &tempReceivedTime);
+ SysLog(NID_MSG, "Etws In Handle[%d]", __pEtwsListenerEvent);
+
+ if (__pEtwsListenerEvent)
+ {
+ pSmsEventArg = new (std::nothrow) _SmsEventArg(receivedTime, msgSerialNumber, msgSecurityInfo, messgeId,
+ etwsMsgWarningType, _SMS_EVENT_TYPE_ETWS_RECEIVE_RESULT);
+ SysTryReturnVoidResult(NID_MSG, pSmsEventArg != null, E_OUT_OF_MEMORY, "memory allocation failed.");
+ __pEtwsListenerEvent->Fire(*pSmsEventArg);
+ }
+
+
+
+}
+
+void
+_MessagingProxy::OnIncomingCbsCallback(const Tizen::Base::String &message, const Tizen::Base::ByteBuffer &msgSerialNumber, int tempReceivedTime, int messgeId, int dataCodingScheme, const Tizen::Base::String &messageLanguage)
+{
+
+ _SmsEventArg* pSmsEventArg = null;
+ DateTime receivedTime = _MsgUtil::ConvertTime((time_t *) &tempReceivedTime);
+ Tizen::Base::Integer dataCodingSchemeTemp(dataCodingScheme);
+ SysLog(NID_MSG, "CBS In Handle[%d]", __pCbsListenerEvent);
+
+ if (__pCbsListenerEvent)
+ {
+ pSmsEventArg = new (std::nothrow) _SmsEventArg(message, msgSerialNumber, receivedTime, messgeId, false,
+ ((byte) dataCodingSchemeTemp.ToChar()),messageLanguage, _SMS_EVENT_TYPE_CBS_RECEIVE_RESULT);
+ SysTryReturnVoidResult(NID_MSG, pSmsEventArg != null, E_OUT_OF_MEMORY, "memory allocation failed.");
+ __pCbsListenerEvent->Fire(*pSmsEventArg);
+ }
+
+}
+
+void
+_MessagingProxy::SetCbsAndEtwsUserEvent(_MessageType msgType, _SmsEvent* pEvent)
+{
+ if (msgType == _MSG_CBS)
+ {
+ __pCbsListenerEvent = pEvent;
+ }
+ else
+ {
+ __pEtwsListenerEvent = pEvent;
+ }
+}
+
+
+result
+_MessagingProxy::SetSavingToCbsBoxEnabled(bool enable)
+{
+
+ result r = 0;
+ IPC::Message* pMessage = null;
+ unsigned long ret = 0;
+
+
+ pMessage = new (std::nothrow) MessagingMsgStart_setSavingToCbsBoxEnabled(enable, &ret);
+ SysTryReturnResult(NID_MSG, pMessage != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ r = __pIpcClient->SendRequest(*pMessage);
+ delete pMessage;
+ SysTryReturnResult(NID_MSG, r == E_SUCCESS, E_SYSTEM, "A system error occurred.");
+ SysLog(NID_MSG, "The result of checking through IPC is %d.", ret);
+
+ return ret;
+}
+result
+_MessagingProxy::IsCbsEnabled(bool* isCbsEnabled)
+{
+
+ result r = 0;
+ IPC::Message* pMessage = null;
+ unsigned long ret = 0;
+
+ SysTryReturnResult(NID_MSG, isCbsEnabled != null, E_SYSTEM, "isCbsEnabled is null.");
+
+ pMessage = new (std::nothrow) MessagingMsgStart_isCbsEnabled(isCbsEnabled, &ret);
+ SysTryReturnResult(NID_MSG, pMessage != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ r = __pIpcClient->SendRequest(*pMessage);
+ delete pMessage;
+ SysTryReturnResult(NID_MSG, r == E_SUCCESS, E_SYSTEM, "A system error occurred.");
+
+ SysLog(NID_MSG, "The result of checking through IPC is %d. isCbsEnabled = %d", ret, *isCbsEnabled );
+
+ return ret;
+}
+
+
+result
+_MessagingProxy::SetCbsEnabled(bool enable)
+{
+
+ result r = 0;
+ IPC::Message* pMessage = null;
+ unsigned long ret = 0;
+
+
+ pMessage = new (std::nothrow) MessagingMsgStart_setCbsEnabled(enable, &ret);
+ SysTryReturnResult(NID_MSG, pMessage != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ r = __pIpcClient->SendRequest(*pMessage);
+ delete pMessage;
+ SysTryReturnResult(NID_MSG, r == E_SUCCESS, E_SYSTEM, "A system error occurred.");
+
+ SysLog(NID_MSG, "The result of checking through IPC is %d.", ret);
+
+ return ret;
+}
+
+result
+_MessagingProxy::AddCbsChannel(int from, int to, Tizen::Base::String& name, bool activate)
+{
+
+ result r = 0;
+ IPC::Message* pMessage = null;
+ unsigned long ret = 0;
+
+ pMessage = new (std::nothrow) MessagingMsgStart_addCbsChannel(from, to, name, activate, &ret);
+ SysTryReturnResult(NID_MSG, pMessage != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ r = __pIpcClient->SendRequest(*pMessage);
+ delete pMessage;
+ SysTryReturnResult(NID_MSG, r == E_SUCCESS, E_SYSTEM, "A system error occurred.");
+
+ SysLog(NID_MSG, "The result of checking through IPC is %d.", ret);
+
+ return ret;
+}
+result
+_MessagingProxy::RemoveCbsChannel(int from, int to)
+{
+
+ result r = 0;
+ IPC::Message* pMessage = null;
+ unsigned long ret = 0;
+
+
+ pMessage = new (std::nothrow) MessagingMsgStart_removeCbsChannel(from, to, &ret);
+ SysTryReturnResult(NID_MSG, pMessage != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ r = __pIpcClient->SendRequest(*pMessage);
+ delete pMessage;
+ SysTryReturnResult(NID_MSG, r == E_SUCCESS, E_SYSTEM, "A system error occurred.");
+
+ SysLog(NID_MSG, "The result of checking through IPC is %d.", ret);
+
+ return ret;
+}
+
+result
+_MessagingProxy::GetCbsChannelN(int from, int to, bool &isActive, String &channelName)
+{
+
+ result r = 0;
+ IPC::Message* pMessage = null;
+ unsigned long ret = 0;
+
+
+ pMessage = new (std::nothrow) MessagingMsgStart_getCbsChannelN(from, to, &isActive, &channelName,&ret);
+ SysTryReturnResult(NID_MSG, pMessage != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ r = __pIpcClient->SendRequest(*pMessage);
+ delete pMessage;
+ SysTryReturnResult(NID_MSG, r == E_SUCCESS, E_SYSTEM, "A system error occurred.");
+ SysLog(NID_MSG, "The result of checking through IPC is %d.", ret);
+
+ return ret;
+
+}
+
+result
+_MessagingProxy::GetCbsChannelListN(Tizen::Base::Collection::ArrayList &pCbsList)
+{
+ result r = 0;
+ IPC::Message* pMessage = null;
+ unsigned long ret = 0;
+
+
+ pMessage = new (std::nothrow) MessagingMsgStart_getCbsChannelListN(&pCbsList,&ret);
+ SysTryReturnResult(NID_MSG, pMessage != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ r = __pIpcClient->SendRequest(*pMessage);
+ delete pMessage;
+ SysTryReturnResult(NID_MSG, r == E_SUCCESS, E_SYSTEM, "A system error occurred.");
+ SysLog(NID_MSG, "The result of checking through IPC is %d.", ret);
+
+ return ret;
+}
+
+result
+_MessagingProxy::UpdateCbsChannel(int from, int to, Tizen::Base::String name, bool isChannelEnable)
+{
+
+ result r = 0;
+ IPC::Message* pMessage = null;
+ unsigned long ret = 0;
+
+ pMessage = new (std::nothrow) MessagingMsgStart_updateCbsChannel(from, to, name, isChannelEnable, &ret);
+ SysTryReturnResult(NID_MSG, pMessage != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
+ r = __pIpcClient->SendRequest(*pMessage);
+ delete pMessage;
+ SysTryReturnResult(NID_MSG, r == E_SUCCESS, E_SYSTEM, "A system error occurred.");
+
+ SysLog(NID_MSG, "The result of checking through IPC is %d.", ret);
+
+ return ret;
+}
+
+
+} }
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 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 _FMSG_MESSAGING_PROXY_H_
+#define _FMSG_MESSAGING_PROXY_H_
+
+#include <FBaseObject.h>
+#include <FIo_IpcCommonDataTypes.h>
+#include <FIo_IIpcClientEventListener.h>
+#include "FMsg_Types.h"
+
+namespace Tizen { namespace Base {
+class String;
+} }
+
+namespace Tizen { namespace Io {
+class _IpcClient;
+} }
+namespace Tizen { namespace Messaging
+{
+
+class _SmsEvent;
+class CbsChannel;
+class _MessagingProxy
+ : public Tizen::Base::Object
+ , public Tizen::Io::_IIpcClientEventListener
+{
+
+public:
+ result Construct(void);
+ result AddWapPushEventListener(const Tizen::Base::String& wapApplicationId, _SmsEvent* pListener);
+ //result RemoveWapPushEventListener(const Tizen::Base::String& wapApplicationId);
+ result RegisterCondition(const Tizen::Base::String& wapApplicationId, const Tizen::Base::String& contentType);
+ result UnregisterCondition(const Tizen::Base::String& wapApplicationId, const Tizen::Base::String& contentType);
+
+ result OpenMsgHandle();
+ result OpenCbsHandle();
+ result AddSmsEventListener(int port, Tizen::Base::Collection::ArrayList* pListenerList);
+ result AddCbsEtwsEventListener(bool enabled);
+ result SetSavingToCbsBoxEnabled(bool enable);
+ result IsCbsEnabled(bool* isCbsEnabled);
+ result SetCbsEnabled(bool enable);
+ result AddCbsChannel(int from, int to, Tizen::Base::String& name, bool activate);
+ result RemoveCbsChannel(int from, int to);
+ result UpdateCbsChannel(int from, int to, Tizen::Base::String name, bool isChannelEnable);
+ result GetCbsChannelN(int from, int to, bool &isActive, Tizen::Base::String &channelName);
+ result GetCbsChannelListN(Tizen::Base::Collection::ArrayList &pCbsList);
+
+ static _MessagingProxy* GetInstance(void);
+ static void DestroyInstance(void);
+
+ void OnIpcResponseReceived(Tizen::Io::_IpcClient& client, const IPC::Message& message);
+ void OnWapPushEventCallBack(const Tizen::Base::String &header, const Tizen::Base::ByteBuffer &body, int bodyLength);
+ void OnIncomingEtwsCallback(int tempReceivedTime, const Tizen::Base::ByteBuffer &msgSerialNumber,const Tizen::Base::ByteBuffer &msgSecurityInfo, int messgeId, const Tizen::Base::ByteBuffer &etwsMsgWarningType);
+ void OnIncomingCbsCallback(const Tizen::Base::String &message, const Tizen::Base::ByteBuffer &msgSerialNumber, int tempReceivedTime, int messgeId, int dataCodingScheme, const Tizen::Base::String &messageLanguage);
+ void OnIncomingSmsCallback(int port, int displayTime, const Tizen::Base::String &message, const Tizen::Base::String &senderAddress);
+ void SetCbsAndEtwsUserEvent(_MessageType msgType, _SmsEvent* pEvent);
+
+private:
+ _MessagingProxy(void);
+ virtual ~_MessagingProxy(void);
+
+private:
+ Tizen::Io::_IpcClient* __pIpcClient;
+ static _MessagingProxy *__pSelf;
+ _SmsEvent* __pWapPushListener;
+ Tizen::Base::Collection::ArrayList* __pSmsListenerList;
+ _SmsEvent* __pCbsListenerEvent;
+ _SmsEvent* __pEtwsListenerEvent;
+}; // _MessagingProxy
+
+} } // Tizen::Messaging
+#endif // _FMSG_MESSAGING_PROXY_H_
\ No newline at end of file
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 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.
+//
+
+/**
+ * @file FMsg_MessagingMessageTypes.cpp
+ * @brief This is the generator of IPC messages for the wap push.
+ */
+
+#define IPC_MESSAGE_IMPL
+#include "FMsg_MessagingMessageTypes.h"
+
+// Generate constructors.
+#include <ipc/struct_constructor_macros.h>
+#include "FMsg_MessagingMessageTypes.h"
+
+// Generate destructors.
+#include <ipc/struct_destructor_macros.h>
+#include "FMsg_MessagingMessageTypes.h"
+
+// Generate param traits write methods.
+#include <ipc/param_traits_write_macros.h>
+namespace IPC {
+#include "FMsg_MessagingMessageTypes.h"
+} // namespace IPC
+
+// Generate param traits read methods.
+#include <ipc/param_traits_read_macros.h>
+namespace IPC {
+#include "FMsg_MessagingMessageTypes.h"
+} // namespace IPC
+
#include "FMsg_RecipientListImpl.h"
#include "FMsg_SmsMmsCallbackHandler.h"
#include "FMsg_CbsChannelImpl.h"
+#include "FMsg_MessagingIpcProxy.h"
+
using namespace std;
using namespace Tizen::Base;
, __pEtwsReceiveEvent(null)
, __pSmsTriggerEventList(null)
, __msgHandle(0)
- , __cbsSettingsHandle(0)
, __pCbsListener(null)
, __pEtwsListener(null)
+ ,__isOpenCbsHandle(0)
{
}
r = ConvertException(err);
SysTryReturn(NID_MSG, r == E_SUCCESS, r, r, "Failed to register sms,mms callback.");
- // open cbs message handle
- err = _SmsMmsCallbackHandler::GetInstance()->OpenCbsSettingsHandle(__cbsSettingsHandle);
-
- if (err == MSG_ERR_NO_SIM)
- {
- r = E_SUCCESS;
- SysLog(NID_MSG, "Sim card is not present in device"); // even no sim, return sucess so that app will launch sucess
- }
- else
- {
- r = ConvertException(err);
+ SysTryReturnResult(NID_MSG, _MessagingProxy::GetInstance()!= null, E_OUT_OF_MEMORY, "Failed to get msg proxy instance");
+ r = _MessagingProxy::GetInstance()->OpenMsgHandle();
+ SysTryReturn(NID_MSG, r == E_SUCCESS, r, r, "Failed to open messageHandle.");
+ r = _MessagingProxy::GetInstance()->OpenCbsHandle();
SysTryReturn(NID_MSG, r == E_SUCCESS, r, r, "Failed to open cbs Settings Handle");
+ __isOpenCbsHandle = true;
- // check value of cbs settings handle
- SysTryReturnResult(NID_MSG, __cbsSettingsHandle > 0, E_SYSTEM, "cbsSettingsHandle is invalid.");
- }
-
- // load cbs settings
- _SmsMmsCallbackHandler::GetInstance()->LoadCbsSettings();
__pSmsEvent = move(pSmsEvent);
__isConstructed = true;
result r = E_SUCCESS;
_SmsEvent* pSmsTriggerEvent = null;
- int err = MSG_SUCCESS;
// check duplications
if (__pSmsTriggerEventList)
r = __pSmsTriggerEventList->Add(*pSmsTriggerEvent);
SysTryCatch(NID_MSG, r == E_SUCCESS, , r, "[%s] Failed to add a listener.", GetErrorMessage(r));
- // Register SMS Trigger
- err = msg_reg_sms_message_callback(__msgHandle, &_SmsMmsCallbackHandler::IncomingSmsMessageCallback, port, (void*) pSmsTriggerEvent);
-
- if (err != MSG_SUCCESS)
- {
- r = __pSmsTriggerEventList->Remove(*pSmsTriggerEvent);
- r = E_SYSTEM;
- SysLogException(NID_MSG, r, "[%s] Failed to register for incoming sms callback.", GetErrorMessage(r));
-
- goto CATCH;
- }
+ SysTryCatch(NID_MSG, _MessagingProxy::GetInstance()!= null, ,E_OUT_OF_MEMORY, "Failed to get msg proxy instance");
+ r = _MessagingProxy::GetInstance()->AddSmsEventListener(port, __pSmsTriggerEventList);
+ SysTryCatch(NID_MSG, r == E_SUCCESS, , r, "[%s] Failed to add a listener.", GetErrorMessage(r));
return r;
SysAssertf(__msgHandle > 0, "message handle is invalid.");
result r = E_SUCCESS;
- int err = MSG_SUCCESS;
if (!pListener)
{
r = __pCbsReceiveEvent->AddListener(*__pCbsListener, true);
SysTryCatch(NID_MSG, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "Failed to add cbs listner");
- err = msg_reg_cb_message_callback(__msgHandle, &_SmsMmsCallbackHandler::IncomingCbsMessageCallback, __isCbsSaveEnabled, null);
- r = ConvertException(err);
+ SysTryCatch(NID_MSG, _MessagingProxy::GetInstance()!= null, r = E_OUT_OF_MEMORY,E_OUT_OF_MEMORY, "Failed to get msg proxy instance");
+ r = _MessagingProxy::GetInstance()->AddCbsEtwsEventListener(__isCbsSaveEnabled);
+
SysTryCatch(NID_MSG, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "Failed to set cbs incoming callback");
if (r == E_SUCCESS)
{
- if (_SmsMmsCallbackHandler::GetInstance())
- {
- _SmsMmsCallbackHandler::GetInstance()->SetCbsAndEtwsUserEvent(_MSG_CBS, __pCbsReceiveEvent);
- }
- else
- {
- r = E_SYSTEM;
- }
+ _MessagingProxy::GetInstance()->SetCbsAndEtwsUserEvent(_MSG_CBS, __pCbsReceiveEvent);
+ }
+ else
+ {
+ r = E_SYSTEM;
}
return r;
SysAssertf(__msgHandle > 0, "message handle is invalid.");
result r = E_SUCCESS;
- int err = MSG_SUCCESS;
if (!pListener)
{
r = __pEtwsReceiveEvent->AddListener(*__pEtwsListener, true);
SysTryCatch(NID_MSG, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "Failed to add an etws primary notification event listener.");
- err = msg_reg_cb_message_callback(__msgHandle, &_SmsMmsCallbackHandler::IncomingCbsMessageCallback, __isCbsSaveEnabled, null);
- r = ConvertException(err);
+ SysTryCatch(NID_MSG, _MessagingProxy::GetInstance()!= null, r = E_OUT_OF_MEMORY,E_OUT_OF_MEMORY, "Failed to get msg proxy instance");
+ r = _MessagingProxy::GetInstance()->AddCbsEtwsEventListener(__isCbsSaveEnabled);
SysTryCatch(NID_MSG, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM,"Failed to add an etws primary notification event listener.");
if (r == E_SUCCESS)
{
- if (_SmsMmsCallbackHandler::GetInstance())
- {
- _SmsMmsCallbackHandler::GetInstance()->SetCbsAndEtwsUserEvent(_MSG_ETWS, __pEtwsReceiveEvent);
- }
- else
- {
- r = E_SYSTEM;
- }
+ _MessagingProxy::GetInstance()->SetCbsAndEtwsUserEvent(_MSG_ETWS, __pEtwsReceiveEvent);
+ }
+ else
+ {
+ r = E_SYSTEM;
}
+
return r;
CATCH:
{
SysAssertf(__isConstructed == true, "_SmsManagerImpl instance is not constructed yet.");
SysAssertf(__msgHandle > 0, "message handle is invalid.");
- SysTryReturnResult(NID_MSG, __cbsSettingsHandle != NULL, E_SYSTEM, "Cb handle is null");
-
- int err = MSG_SUCCESS;
+ result r = E_SUCCESS;
+ SysTryReturnResult(NID_MSG, __isOpenCbsHandle == true, E_SYSTEM, "Cb handle is null");
- err = msg_reg_cb_message_callback(__msgHandle, &_SmsMmsCallbackHandler::IncomingCbsMessageCallback, enable, null);
- SysTryReturnResult(NID_MSG, err == MSG_SUCCESS, E_SYSTEM, "Failed to set SavingToCbsBoxEnabled option.");
+ SysTryReturnResult(NID_MSG, _MessagingProxy::GetInstance()!= null, E_OUT_OF_MEMORY, "Failed to get msg proxy instance");
+ r = _MessagingProxy::GetInstance()->SetSavingToCbsBoxEnabled(enable);
+ SysTryReturn(NID_MSG, r == E_SUCCESS, r, r, "[%s] Setting of CbsBoxEnabled Failed", GetErrorMessage(r));
__isCbsSaveEnabled = enable;
- return E_SUCCESS;
+ return r;
}
bool
{
SysAssertf(__isConstructed == true, "_SmsManagerImpl instance is not constructed yet.");
SysAssertf(__msgHandle > 0, "message handle is invalid.");
- SysTryReturn(NID_MSG, __cbsSettingsHandle != NULL, false, E_SYSTEM, "Cb handle is null");
+ SysTryReturn(NID_MSG, __isOpenCbsHandle != false, false, E_SYSTEM, "Cb handle is null");
bool isCbsEnabled = false;
- int err = MSG_SUCCESS;
+ result r = E_SUCCESS;
- err = msg_get_bool_value(__cbsSettingsHandle, MSG_CB_RECEIVE_BOOL, &isCbsEnabled);
- SysTryReturn(NID_MSG, err == MSG_SUCCESS, false, E_SYSTEM, "Failed to set SavingToCbsBoxEnabled option.");
+ SysTryReturnResult(NID_MSG, _MessagingProxy::GetInstance()!= null, false, "Failed to get msg proxy instance");
+ r = _MessagingProxy::GetInstance()->IsCbsEnabled(&isCbsEnabled);
+ SysTryReturn(NID_MSG, r == E_SUCCESS, r, r, "[%s] Geting the Cbs Status Failed ", GetErrorMessage(r));
return isCbsEnabled;
}
{
SysAssertf(__isConstructed == true, "_SmsManagerImpl instance is not constructed yet.");
SysAssertf(__msgHandle > 0, "message handle is invalid.");
- SysTryReturnResult(NID_MSG, __cbsSettingsHandle != NULL, E_SYSTEM, "Cb handle is null");
-
- int err = MSG_SUCCESS;
result r = E_SUCCESS;
+ SysTryReturnResult(NID_MSG, __isOpenCbsHandle != false, E_SYSTEM, "Cb handle is null");
- err = msg_set_bool_value(__cbsSettingsHandle, MSG_CB_RECEIVE_BOOL, enable);
- SysTryReturnResult(NID_MSG, err == MSG_SUCCESS, E_SYSTEM, "Failed to set cbs enabled.");
+ SysTryReturnResult(NID_MSG, _MessagingProxy::GetInstance()!= null, E_OUT_OF_MEMORY, "Failed to get msg proxy instance");
+ r = _MessagingProxy::GetInstance()->SetCbsEnabled(enable);
+ SysTryReturn(NID_MSG, r == E_SUCCESS, r, r, "[%s] Set status failed", GetErrorMessage(r));
- r = _SmsMmsCallbackHandler::GetInstance()->SaveCbsSettings();
- SysTryReturnResult(NID_MSG, r == E_SUCCESS, E_SYSTEM, "Failed to save cbs settings.");
- return E_SUCCESS;
+ return r;
}
result
{
SysAssertf(__isConstructed == true, "_SmsManagerImpl instance is not constructed yet.");
SysAssertf(__msgHandle > 0, "message handle is invalid.");
- SysTryReturnResult(NID_MSG, __cbsSettingsHandle != NULL, E_SYSTEM, "Cb handle is null");
-
result r = E_SUCCESS;
- int count = 0;
-
- r = _SmsMmsCallbackHandler::GetInstance()->GetCbsChannelsCount(count);
- SysTryReturn(NID_MSG, r == E_SUCCESS, r, r, "Failed to get CB Channel count.");
-
- if (CB_CHANNEL_MAX <= count)
- {
- return E_ALREADY_SET;
- }
+ SysTryReturnResult(NID_MSG, __isOpenCbsHandle != false, E_SYSTEM, "Cb handle is null");
- // add channel
- r = _SmsMmsCallbackHandler::GetInstance()->AddCbsChannel(from, to, name, activate);
- SysTryReturn(NID_MSG, r == E_SUCCESS, r, r, "Failed to add a CB Channel.");
+ SysTryReturnResult(NID_MSG, _MessagingProxy::GetInstance()!= null, E_OUT_OF_MEMORY, "Failed to get msg proxy instance");
+ r = _MessagingProxy::GetInstance()->AddCbsChannel(from, to, name, activate);
+ SysTryReturn(NID_MSG, r == E_SUCCESS, r, r, "[%s] adding channel Failed", GetErrorMessage(r));
return r;
}
{
SysAssertf(__isConstructed == true, "_SmsManagerImpl instance is not constructed yet.");
SysAssertf(__msgHandle > 0, "message handle is invalid.");
- SysTryReturnResult(NID_MSG, __cbsSettingsHandle != NULL, E_SYSTEM, "Cb handle is null");
+ SysTryReturnResult(NID_MSG, __isOpenCbsHandle != false, E_SYSTEM, "Cb handle is null");
result r = E_SUCCESS;
- // remove channel
- r = _SmsMmsCallbackHandler::GetInstance()->RemoveCbsChannel(from, to);
- SysTryReturn(NID_MSG, r == E_SUCCESS, r, r, "Failed to remove a CB Channel.");
+ SysTryReturnResult(NID_MSG, _MessagingProxy::GetInstance()!= null, E_OUT_OF_MEMORY, "Failed to get msg proxy instance");
+ r = _MessagingProxy::GetInstance()->RemoveCbsChannel(from, to);
+ SysTryReturn(NID_MSG, r == E_SUCCESS, r, r, "[%s] To remove channel Failed", GetErrorMessage(r));
+
return r;
}
{
SysAssertf(__isConstructed == true, "_SmsManagerImpl instance is not constructed yet.");
SysAssertf(__msgHandle > 0, "message handle is invalid.");
- SysTryReturn(NID_MSG, __cbsSettingsHandle != null, null, E_SYSTEM, "Cb handle is null.");
+ SysTryReturn(NID_MSG, __isOpenCbsHandle != null, null, E_SYSTEM, "Cb handle is null.");
result r = E_SUCCESS;
- int fromId = 0;
- int toId = 0;
- int index = 0;
bool isActive = false;
String channelName;
std::unique_ptr<CbsChannel> pCbsChannel;
- ClearLastResult();
-
- // search channel
- r = _SmsMmsCallbackHandler::GetInstance()->SearchCbsChannel(from, to, index);
- SysTryReturn(NID_MSG, r == E_SUCCESS, null, r, "Failed to find the cb channel.");
-
- // get channel
- r = _SmsMmsCallbackHandler::GetInstance()->GetCbsChannel(index, fromId, toId, channelName, isActive);
- SysTryReturn(NID_MSG, r == E_SUCCESS, null, r, "Failed to get the cb channel.");
+ SysTryReturn(NID_MSG, _MessagingProxy::GetInstance()!= null, null, E_OUT_OF_MEMORY,"Failed to get msg proxy instance");
+ r = _MessagingProxy::GetInstance()->GetCbsChannelN(from, to, isActive, channelName);
+ SysTryReturn(NID_MSG, r == E_SUCCESS, null, r, "Failed to get msg proxy instance");
// creates channel
- pCbsChannel.reset(_CbsChannelImpl::GetCbsChannelN(fromId, toId, channelName));
+ pCbsChannel.reset(_CbsChannelImpl::GetCbsChannelN(from, to, channelName));
if (isActive)
{
- pCbsChannel->Activate();
+ _CbsChannelImpl::GetInstance(*pCbsChannel.get())->SetCbsChannelState(true);
+
}
return pCbsChannel.release();
{
SysAssertf(__isConstructed == true, "_SmsManagerImpl instance is not constructed yet.");
SysAssertf(__msgHandle > 0, "message handle is invalid.");
- SysTryReturn(NID_MSG, __cbsSettingsHandle != null, null, E_SYSTEM, "Cb handle is null.");
+ SysTryReturn(NID_MSG, __isOpenCbsHandle != null, null, E_SYSTEM, "Cb handle is null.");
result r = E_SUCCESS;
unique_ptr<ArrayList, AllElementsDeleter> pList;
int cbChannelCount = 0;
int fromId = 0;
int toId = 0;
- bool isActive = false;
+ int isActive = false;
String channelName;
std::unique_ptr<CbsChannel> pCbsChannel;
+ Tizen::Base::Collection::ArrayList pCbsList;
ClearLastResult();
r = pList->Construct();
SysTryReturn(NID_MSG, r == E_SUCCESS, null, r, "Failed to construct array list.");
- r = _SmsMmsCallbackHandler::GetInstance()->GetCbsChannelsCount(cbChannelCount);
- SysTryReturn(NID_MSG, r == E_SUCCESS, null, r, "Failed to get CB Channel count.");
- for (int index = 0; index < cbChannelCount; index++)
+ SysTryReturn(NID_MSG, _MessagingProxy::GetInstance()!= null, null, E_OUT_OF_MEMORY,"Failed to get msg proxy instance");
+ r = _MessagingProxy::GetInstance()->GetCbsChannelListN(pCbsList);
+ SysTryReturn(NID_MSG, r == E_SUCCESS, null, r, "Failed to get msg proxy instance");
+
+
+ cbChannelCount = pCbsList.GetCount();
+ for (int index = 0; index < cbChannelCount; )
{
- // get channel
- r = _SmsMmsCallbackHandler::GetInstance()->GetCbsChannel(index, fromId, toId, channelName, isActive);
- SysTryReturn(NID_MSG, r == E_SUCCESS, null, r , "Failed to get the cb channel.");
+
+ Integer::Parse(*static_cast <String*>(pCbsList.GetAt(index++)), fromId);
+ Integer::Parse(*static_cast <String*>(pCbsList.GetAt(index++)), toId);
+ channelName = *static_cast <String*>(pCbsList.GetAt(index++));
+ Integer::Parse(*static_cast <String*>(pCbsList.GetAt(index++)),isActive);
+ SysLog(NID_MSG, "cbs %d, %d, %ls, %d",fromId, toId, channelName.GetPointer(),(bool)isActive);
pCbsChannel.reset(_CbsChannelImpl::GetCbsChannelN(fromId, toId, channelName));
- if (pCbsChannel && isActive)
+ if (isActive)
{
- _CbsChannelImpl::GetInstance(*pCbsChannel)->SetCbsChannelState(isActive);
- // add to the list
- pList->Add(*pCbsChannel.release());
+ _CbsChannelImpl::GetInstance(*pCbsChannel.get())->SetCbsChannelState((bool)isActive);
+
}
+ pList->Add(*pCbsChannel.release());
}
+ pCbsList.RemoveAll();
return pList.release();
}
_SmsEvent* __pEtwsReceiveEvent;
Tizen::Base::Collection::ArrayList* __pSmsTriggerEventList;
msg_handle_t __msgHandle;
- msg_struct_t __cbsSettingsHandle;
ICbsMessageEventListener* __pCbsListener;
IEtwsPrimaryNotificationEventListener* __pEtwsListener;
+ bool __isOpenCbsHandle;
+
}; // _SmsManagerImpl
} } // Tizen::Messaging
int fromId = 0;
int toId = 0;
bool channelFound = false;
- SysLog(NID_MSG, "AddCbsChannel from %d to %d name %s activate %d ",from, to, name.GetPointer(), activate);
+ SysLog(NID_MSG, "AddCbsChannel from %d to %d name %ls activate %d ",from, to, name.GetPointer(), activate);
for (int index = 0; index < __pTempCbsChannelList->GetCount(); index++)
{
bool channelFound = false;
int index = 0;
CbsChannel* pCbsChannel = NULL;
- SysLog(NID_MSG, "UpdateCbsChannel from %d to %d name %s activate %d ",from, to, name.GetPointer(), activate);
+ SysLog(NID_MSG, "UpdateCbsChannel from %d to %d name %ls activate %d ",from, to, name.GetPointer(), activate);
for (int i = 0; i < __pTempCbsChannelList->GetCount(); i++)
{
{
__incomingSmsCallbackRegistered = incomingSmsCallbackRegistered;
}
-
-void
-_SmsMmsCallbackHandler::SetCbsAndEtwsUserEvent(_MessageType msgType, Tizen::Base::Object* pEvent)
+bool
+_SmsMmsCallbackHandler::GetInComingSmsCallback()
{
- if (msgType == _MSG_CBS)
- {
- __pCbsUserEvent = pEvent;
- }
- else
- {
- __pEtwsUserEvent = pEvent;
- }
+ return __incomingSmsCallbackRegistered;
}
result
SysLog(NID_MSG, "cbs msg_body: [%s]", msgBody);
SysLog(NID_MSG, "cbs dataCodingScheme: [%d]", dataCodingScheme);
- SysLog(NID_MSG, "cbs languageType: [%s]", messageLanguage.GetPointer());
+ SysLog(NID_MSG, "cbs languageType: [%ls]", messageLanguage.GetPointer());
}
SysLog(NID_MSG, "cbs msg_id: [%d]", messgeId);
* @param[in] incomingSmsCallbackRegistered SMS registered flag
*/
void SetInComingSmsCallback(bool incomingSmsCallbackRegistered);
+ bool GetInComingSmsCallback();
- /**
- * Sets the Cbs And Etws UserEvent.
- *
- * @since 3.0
- * @param[in] msgType message type
- * @param[in] pEvent message Event
- */
- void SetCbsAndEtwsUserEvent(_MessageType msgType, Tizen::Base::Object* pEvent);
// for incoming CBS/Etws
static void IncomingCbsMessageCallback(msg_handle_t hMsgHandle, msg_struct_t newMsg, void* pUserParam);
#include "FMsg_Types.h"
#include "FMsg_WapPushManagerImpl.h"
#include "FMsg_SmsMmsCallbackHandler.h"
+#include "FMsg_MessagingIpcProxy.h"
using namespace Tizen::Base;
using namespace Tizen::Messaging;
_WapPushManagerImpl::AddWapPushEventListener(const Tizen::Base::String& wapApplicationId, const IWapPushEventListener& listener)
{
result r = E_SUCCESS;
- int err = MSG_SUCCESS;
- char* pWapAppId = null;
ClearLastResult();
-
- pWapAppId = _StringConverter::CopyToCharArrayN(wapApplicationId);
- SysTryCatch(NID_MSG, pWapAppId != null, r = E_OUT_OF_MEMORY, r, "memory allocation failed");
-
// set event
if (!__pWapPushReceiveEvent)
{
r = __pWapPushReceiveEvent->AddListener(listener, true);
SysTryCatch(NID_MSG, r == E_SUCCESS, , r, "failed to add push listner.");
- SysTryCatch(NID_MSG, _SmsMmsCallbackHandler::GetInstance() != null, r = E_OUT_OF_MEMORY, r, "failed to get msg handle.");
-
- // open message handle
- err = _SmsMmsCallbackHandler::GetInstance()->OpenMessageHandle(__msgHandle);
-
- r = ConvertException(err);
- SysTryCatch(NID_MSG, r == E_SUCCESS, , r, "[%s] Failed to Open Message Handle", GetErrorMessage(r));
-
- SysLog(NID_MSG, "The value of __msgHandle is [%d]", __msgHandle);
-
- // check value of msg handle
- SysTryCatch(NID_MSG, __msgHandle > 0, r = E_SYSTEM, r, "failed to get msg handle.");
-
- err = msg_reg_push_message_callback(__msgHandle, &_SmsMmsCallbackHandler::IncomingWapPushMessageCallback, pWapAppId, (void*) __pWapPushReceiveEvent);
-
- r = ConvertException(err);
- SysTryCatch(NID_MSG, r == E_SUCCESS, , r, "[%s] Failed to Add WapPush EventListener.", GetErrorMessage(r));
-
- if (pWapAppId)
- {
- delete[] pWapAppId;
- pWapAppId = null;
- }
+ SysTryReturnResult(NID_MSG, _MessagingProxy::GetInstance()!= null, E_OUT_OF_MEMORY, "Failed to get msg proxy instance");
+ r = _MessagingProxy::GetInstance()->AddWapPushEventListener(wapApplicationId, __pWapPushReceiveEvent);
return r;
CATCH:
- if (pWapAppId)
- {
- delete[] pWapAppId;
- pWapAppId = null;
- }
+
if (__pWapPushReceiveEvent)
{
_WapPushManagerImpl::RegisterCondition(const Tizen::Base::String& wapApplicationId, const Tizen::Base::String& contentType)
{
result r = E_SUCCESS;
- int err = MSG_SUCCESS;
- char* pWapAppId = null;
- char* pContentType = null;
- msg_struct_t pushInfo = null;
- char* pPkgName = null;
-
- ClearLastResult();
+ SysTryReturnResult(NID_MSG, _MessagingProxy::GetInstance()!= null, E_OUT_OF_MEMORY, "Failed to get msg proxy instance");
+ r = _MessagingProxy::GetInstance()->RegisterCondition(wapApplicationId,contentType);
- pWapAppId = _StringConverter::CopyToCharArrayN(wapApplicationId);
- SysTryCatch(NID_MSG, pWapAppId != null, r = E_OUT_OF_MEMORY, r, "memory allocation failed");
-
- pContentType = _StringConverter::CopyToCharArrayN(contentType);
- SysTryCatch(NID_MSG, pContentType != null, r = E_OUT_OF_MEMORY, r, "memory allocation failed");
-
- err = app_get_package(&pPkgName);
- SysTryCatch(NID_MSG, err == APP_ERROR_NONE && pPkgName != null, r = E_SYSTEM, r, "[%s] Failed to Open Message Handle", GetErrorMessage(r));
-
- pushInfo = msg_create_struct(MSG_STRUCT_PUSH_CONFIG_INFO);
- SysTryCatch(NID_MSG, pushInfo != null, r = E_SYSTEM, r, "[%s] Failed to create push data info", GetErrorMessage(r));
- msg_set_str_value(pushInfo, MSG_PUSH_CONFIG_CONTENT_TYPE_STR, (char *)pContentType, MAX_WAPPUSH_CONTENT_TYPE_LEN);
- msg_set_str_value(pushInfo, MSG_PUSH_CONFIG_APPLICATON_ID_STR, (char *)pWapAppId, MAX_WAPPUSH_ID_LEN);
- msg_set_str_value(pushInfo, MSG_PUSH_CONFIG_PACKAGE_NAME_STR, pPkgName, MSG_FILEPATH_LEN_MAX);
- free(pPkgName);
- pPkgName = null;
-
- err = msg_add_push_event(__msgHandle, pushInfo);
- msg_release_struct(&pushInfo);
-
- r = ConvertException(err);
- SysTryCatch(NID_MSG, r == E_SUCCESS, , r, "[%s] Failed to register Condition for wap push.", GetErrorMessage(r));
-
- if (pWapAppId)
- {
- delete[] pWapAppId;
- pWapAppId = null;
- }
-
- if (pContentType)
- {
- delete[] pContentType;
- pContentType = null;
- }
return r;
-CATCH:
- if (pPkgName)
- {
- free(pPkgName);
- pPkgName = null;
- }
-
- if (pushInfo)
- {
- msg_release_struct(&pushInfo);
- pushInfo = null;
- }
-
- if (pWapAppId)
- {
- delete[] pWapAppId;
- pWapAppId = null;
- }
-
- if (pContentType)
- {
- delete[] pContentType;
- pContentType = null;
- }
- return r;
}
result
_WapPushManagerImpl::UnregisterCondition(const Tizen::Base::String& wapApplicationId, const Tizen::Base::String& contentType)
{
result r = E_SUCCESS;
- int err = MSG_SUCCESS;
- char* pWapAppId = null;
- char* pContentType = null;
- msg_struct_t pushInfo = null;
- char* pPkgName = null;
-
- ClearLastResult();
-
- pWapAppId = _StringConverter::CopyToCharArrayN(wapApplicationId);
- SysTryCatch(NID_MSG, pWapAppId != null, r = E_OUT_OF_MEMORY, r, "memory allocation failed");
-
- pContentType = _StringConverter::CopyToCharArrayN(contentType);
- SysTryCatch(NID_MSG, pContentType != null, r = E_OUT_OF_MEMORY, r, "memory allocation failed");
-
- err = app_get_package(&pPkgName);
- SysTryCatch(NID_MSG, err == APP_ERROR_NONE, r = E_SYSTEM, r, "[%s] Failed to Open Message Handle", GetErrorMessage(r));
-
- pushInfo = msg_create_struct(MSG_STRUCT_PUSH_CONFIG_INFO);
- msg_set_str_value(pushInfo, MSG_PUSH_CONFIG_CONTENT_TYPE_STR, pContentType, MAX_WAPPUSH_CONTENT_TYPE_LEN);
- msg_set_str_value(pushInfo, MSG_PUSH_CONFIG_APPLICATON_ID_STR, pWapAppId, MAX_WAPPUSH_ID_LEN);
- msg_set_str_value(pushInfo, MSG_PUSH_CONFIG_PACKAGE_NAME_STR, pPkgName, MSG_FILEPATH_LEN_MAX);
- free(pPkgName);
- pPkgName = null;
-
- err = msg_delete_push_event(__msgHandle, pushInfo);
- msg_release_struct(&pushInfo);
-
- r = ConvertException(err);
- SysTryCatch(NID_MSG, r == E_SUCCESS, , r, "[%s] Failed to Unregister Condition for wap push", GetErrorMessage(r));
-
- if (pWapAppId)
- {
- delete[] pWapAppId;
- pWapAppId = null;
- }
+ SysTryReturnResult(NID_MSG, _MessagingProxy::GetInstance()!= null, E_OUT_OF_MEMORY, "Failed to get msg proxy instance");
+ r = _MessagingProxy::GetInstance()->UnregisterCondition(wapApplicationId,contentType);
- if (pContentType)
- {
- delete[] pContentType;
- pContentType = null;
- }
return r;
-CATCH:
- if (pPkgName)
- {
- free(pPkgName);
- pPkgName = null;
- }
-
- if (pushInfo)
- {
- msg_release_struct(&pushInfo);
- pushInfo = null;
- }
-
- if (pWapAppId)
- {
- delete[] pWapAppId;
- pWapAppId = null;
- }
-
- if (pContentType)
- {
- delete[] pContentType;
- pContentType = null;
- }
- return r;
}
result
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 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.
+//
+/**
+ * @file FMsg_MessagingMessageTypes.h
+ * @brief This is the header file for the Messaging's IPC messages.
+ *
+ * This header file contains the declarations of the IPC messages for the wap push.
+ */
+
+#include <ipc/ipc_message_macros.h>
+#include <FIo_IpcCommonParamTraits.h> // must be modified.
+#include <FIo_IpcMessageStart.h>
+//#include "FMsg_MessagingIpcParamTraits.h"
+
+#ifndef MESSAGING_IPC_SERVER_NAME
+#define MESSAGING_IPC_SERVER_NAME "osp.messaging.ipcserver.msg"
+#endif
+#define IPC_MESSAGE_START MessagingMsgStart
+/* Sync */
+ /* WapPush */
+ IPC_SYNC_MESSAGE_CONTROL1_1(MessagingMsgStart_addWapPushEventListener, Tizen::Base::String /* wapApplicationId */, unsigned long /* result */)
+ //IPC_SYNC_MESSAGE_CONTROL1_1(MessagingMsgStart_removeWapPushEventListener, Tizen::Base::String /* wapApplicationId */, unsigned long /* result */)
+ IPC_SYNC_MESSAGE_CONTROL2_1(MessagingMsgStart_registerCondition, Tizen::Base::String /* wapApplicationId */, Tizen::Base::String /* contentType*/, unsigned long /* result */)
+ IPC_SYNC_MESSAGE_CONTROL2_1(MessagingMsgStart_unregisterCondition, Tizen::Base::String /* wapApplicationId */, Tizen::Base::String /* contentType*/, unsigned long /* result */)
+
+
+ /* etc control */
+ IPC_SYNC_MESSAGE_CONTROL0_1(MessagingMsgStart_openCbsHandle, unsigned long /* result */);
+ IPC_SYNC_MESSAGE_CONTROL0_1(MessagingMsgStart_openMsgHandle, unsigned long /* result */);
+
+ IPC_SYNC_MESSAGE_CONTROL1_1(MessagingMsgStart_addSmsEventListener, int /* port */, unsigned long /* result */)
+ IPC_SYNC_MESSAGE_CONTROL1_1(MessagingMsgStart_addCbsEtwsEventListener, bool /* enabled */, unsigned long /* result */)
+
+
+ IPC_SYNC_MESSAGE_CONTROL1_1(MessagingMsgStart_setSavingToCbsBoxEnabled, bool /* enable */, unsigned long /* result */);
+ IPC_SYNC_MESSAGE_CONTROL0_2(MessagingMsgStart_isCbsEnabled, bool /* isCbsEnabled */, unsigned long /* result */);
+ IPC_SYNC_MESSAGE_CONTROL1_1(MessagingMsgStart_setCbsEnabled, bool /* enable */, unsigned long /* result */);
+ IPC_SYNC_MESSAGE_CONTROL4_1(MessagingMsgStart_addCbsChannel , int /* from */, int /* to */, Tizen::Base::String /* name */, bool /* activate */, unsigned long /* result */)
+ IPC_SYNC_MESSAGE_CONTROL2_1(MessagingMsgStart_removeCbsChannel, int /* from */, int /* to */, unsigned long /* result */)
+ IPC_SYNC_MESSAGE_CONTROL2_3(MessagingMsgStart_getCbsChannelN, int /* from */, int /* to */,bool /* isActive */, Tizen::Base::String /* channelName */, unsigned long /* result */)
+ IPC_SYNC_MESSAGE_CONTROL0_2(MessagingMsgStart_getCbsChannelListN, Tizen::Base::Collection::ArrayList /*pCbsList*/, unsigned long /* result */)
+ IPC_SYNC_MESSAGE_CONTROL4_1(MessagingMsgStart_updateCbsChannel, int /* from */, int /* to */, Tizen::Base::String /* name */, bool /* isChannelEnable */, unsigned long /* result */)
+
+
+/* Async */
+ /* WapPush */
+ IPC_MESSAGE_CONTROL3(MessagingMsgStart_wapPushEventCallBack, Tizen::Base::String /* header */, Tizen::Base::ByteBuffer /* body */, int /* bodyLength */)
+ /* Sms */
+ IPC_MESSAGE_CONTROL4(MessagingMsgStart_incomingSmsCallback, int/* port */, int /* displayTime */, Tizen::Base::String /* message */, Tizen::Base::String/* senderAddress */)
+ IPC_MESSAGE_CONTROL5(MessagingMsgStart_incomingEtwsCallback, int /* tempReceivedTime */, Tizen::Base::ByteBuffer /* msgSerialNumber */, Tizen::Base::ByteBuffer /* msgSecurityInfo */, int /* messgeId */, Tizen::Base::ByteBuffer /* etwsMsgWarningType */)
+ IPC_MESSAGE_CONTROL6(MessagingMsgStart_incomingCbsCallback, Tizen::Base::String /* message */, Tizen::Base::ByteBuffer /* msgSerialNumber */, int /* tempReceivedTime */, int /* messgeId */, int /* dataCodingScheme */, Tizen::Base::String /* messageLanguage */)
+
+
+