notification manager is only provide resource hosting feature.
and resource hosting feature break off notifcation manager.
Change-Id: I96a0a60df60e60c44ecb9935cb73250949993fb6
Signed-off-by: jyong2.kim <jyong2.kim@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/3205
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Hun-je Yeon <hunje.yeon@samsung.com>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
SConscript('things-manager/SConscript')
# Build notification manager project
- SConscript('notification-manager/SConscript')
+ SConscript('resource-hosting/SConscript')
# Build resource-encapsulation project
SConscript('resource-encapsulation/SConscript')
+++ /dev/null
-LinuxMain.o
-NotificationManager.o
-RegistrationManager.o
-ResourceManager.o
-SampleConsumer.o
-SampleProvider.o
-VirtualRepresentation.o
-NotificationManager
-SampleConsumer
-SampleProvider
-
+++ /dev/null
-##
-# NotificationManager build script
-##
-
-Import('env')
-
-lib_env = env.Clone()
-SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
-notimgr_env = lib_env.Clone()
-
-######################################################################
-# Build flags
-######################################################################
-notimgr_env.AppendUnique(CPPPATH = ['../../NotificationManager/include'])
-notimgr_env.AppendUnique(CPPPATH = ['../../../../extlibs/cjson'])
-notimgr_env.AppendUnique(CPPPATH = ['../../../../resource/csdk/connectivity/api'])
-notimgr_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
-notimgr_sample_env = notimgr_env.Clone()
-notimgr_env.AppendUnique(LIBS = [
- 'NotificationManager',
- 'rcs_client',
- 'rcs_server',
- 'rcs_common',
- 'oc',
- 'octbstack',
- 'oc_logger',
- 'connectivity_abstraction',
- 'coap',
- 'pthread'
- ])
-notimgr_sample_env.AppendUnique(LIBS = [
- 'oc',
- 'octbstack',
- 'oc_logger',
- 'connectivity_abstraction',
- 'coap',
- 'pthread'
- ])
-
-if env.get('SECURED') == '1':
- notimgr_env.AppendUnique(LIBS = ['tinydtls'])
- notimgr_sample_env.AppendUnique(LIBS = ['tinydtls'])
-if 'rt' in notimgr_env.get('LIBS'):
- notimgr_env.Append(LIBS = ['rt'])
-if 'rt' in notimgr_sample_env.get('LIBS'):
- notimgr_sample_env.Append(LIBS = ['rt'])
-
-####################################################################
-# Source files and Targets
-######################################################################
-sampleprovider = notimgr_sample_env.Program('sampleprovider', 'sampleProvider/SampleProvider.cpp')
-sampleconsumer = notimgr_sample_env.Program('sampleconsumer', 'sampleConsumer/SampleConsumer.cpp')
-
-notificationmanager = notimgr_env.Program('notificationmanager', 'notificationManager/main.cpp')
-
-#notimgr_sample_env.InstallTarget(sampleprovider, 'sampleprovider')
-#notimgr_sample_env.InstallTarget(sampleconsumer, 'sampleconsumer')
-#notimgr_env.InstallTarget(notificationmanager, 'notificationmanager')
\ No newline at end of file
+++ /dev/null
-NotificationManager
-SampleConsumer
-SampleProvider
-
+++ /dev/null
-LINK_DIRECTORIES(${LIB_INSTALL_DIR})
-
-SET(NOTI_BASE_DIR "${BASE_SRC_DIR}/notification-manager")
-
-INCLUDE_DIRECTORIES(${INCLUDE_INSTALL_DIR}/oic)
-INCLUDE_DIRECTORIES(${INCLUDE_INSTALL_DIR}/oic/stack)
-INCLUDE_DIRECTORIES(${INCLUDE_INSTALL_DIR}/boost)
-INCLUDE_DIRECTORIES(${NOTI_BASE_DIR}/NotificationManager/include)
-
-SET(NOTIFICATIONMANAGER "NotificationManager")
-SET(EX_NOTIPROVIDER "SampleProvider")
-SET(EX_NOTICONSUMER "SampleConsumer")
-
-SET(EXTRA_CXXFLAGS "-std=c++0x")
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXXFLAGS}")
-
-FILE(GLOB MANAGER_SRCS ${NOTI_BASE_DIR}/NotificationManager/src/*.cpp)
-
-ADD_EXECUTABLE(${NOTIFICATIONMANAGER} ${MANAGER_SRCS})
-TARGET_LINK_LIBRARIES(${NOTIFICATIONMANAGER} ${OCLIB} ${OCTBSTACK} pthread)
-INSTALL(TARGETS ${NOTIFICATIONMANAGER} DESTINATION ${BIN_INSTALL_DIR})
-
-ADD_EXECUTABLE(${EX_NOTIPROVIDER} ${NOTI_BASE_DIR}/SampleApp/linux/sampleProvider/SampleProvider.cpp)
-TARGET_LINK_LIBRARIES(${EX_NOTIPROVIDER} ${OCLIB} ${OCTBSTACK} pthread)
-INSTALL(TARGETS ${EX_NOTIPROVIDER} DESTINATION ${BIN_INSTALL_DIR})
-
-ADD_EXECUTABLE(${EX_NOTICONSUMER} ${NOTI_BASE_DIR}/SampleApp/linux/sampleConsumer/SampleConsumer.cpp)
-TARGET_LINK_LIBRARIES(${EX_NOTICONSUMER} ${OCLIB} ${OCTBSTACK} pthread)
-INSTALL(TARGETS ${EX_NOTICONSUMER} DESTINATION ${BIN_INSTALL_DIR})
-
lib_env = env.Clone()
SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
-notimgr_env = lib_env.Clone()
+resourcehosting_env = lib_env.Clone()
target_os = env.get('TARGET_OS')
######################################################################
# Build flags
######################################################################
-notimgr_env.AppendUnique(CPPPATH = ['NotificationManager/include'])
-notimgr_env.AppendUnique(CPPPATH = ['../resource-encapsulation/include'])
-notimgr_env.AppendUnique(CPPPATH = ['../resource-encapsulation/src/common/primitiveResource/include'])
+resourcehosting_env.AppendUnique(CPPPATH = ['include'])
+resourcehosting_env.AppendUnique(CPPPATH = ['../resource-encapsulation/include'])
+resourcehosting_env.AppendUnique(CPPPATH = ['../resource-encapsulation/src/common/primitiveResource/include'])
-notimgr_env.PrependUnique(LIBS = [
+resourcehosting_env.PrependUnique(LIBS = [
'rcs_client',
'rcs_server',
'rcs_common',
])
if target_os not in ['windows', 'winrt']:
- notimgr_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
+ resourcehosting_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
- notimgr_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
+ resourcehosting_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
if target_os == 'linux':
- notimgr_env.AppendUnique(LIBS = ['pthread'])
+ resourcehosting_env.AppendUnique(LIBS = ['pthread'])
if target_os == 'android':
- notimgr_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
- notimgr_env.AppendUnique(LIBS = ['gnustl_shared','log'])
+ resourcehosting_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
+ resourcehosting_env.AppendUnique(LIBS = ['gnustl_shared','log'])
if not env.get('RELEASE'):
- notimgr_env.AppendUnique(LIBS = ['log'])
+ resourcehosting_env.AppendUnique(LIBS = ['log'])
######################################################################
# Source files and Targets
######################################################################
-NOTI_SRC_DIR = 'NotificationManager/src/'
-notimgr_src = [
- NOTI_SRC_DIR + 'hosting.cpp',
- NOTI_SRC_DIR + 'ResourceHosting.cpp',
- NOTI_SRC_DIR + 'HostingObject.cpp',
- NOTI_SRC_DIR + 'RequestObject.cpp'
+HOSTING_SRC_DIR = 'src/'
+resourcehosting_src = [
+ HOSTING_SRC_DIR + 'hosting.cpp',
+ HOSTING_SRC_DIR + 'ResourceHosting.cpp',
+ HOSTING_SRC_DIR + 'HostingObject.cpp',
+ HOSTING_SRC_DIR + 'RequestObject.cpp'
]
if target_os in ['tizen','android'] :
- notificationsdk = notimgr_env.SharedLibrary('NotificationManager', notimgr_src)
+ resourcehostingsdk = resourcehosting_env.SharedLibrary('resource_hosting', resourcehosting_src)
else :
- notificationsdk = notimgr_env.StaticLibrary('NotificationManager', notimgr_src)
+ resourcehostingsdk = resourcehosting_env.StaticLibrary('resource_hosting', resourcehosting_src)
-notimgr_env.InstallTarget(notificationsdk, 'libResouceHosting')
-notimgr_env.UserInstallTargetLib(notificationsdk, 'libResouceHosting')
-notimgr_env.UserInstallTargetHeader('NotificationManager/include/hosting.h',\
- 'service/notification-manager', 'hosting.h')
+resourcehosting_env.InstallTarget(resourcehostingsdk, 'libresource_hosting')
+resourcehosting_env.UserInstallTargetLib(resourcehostingsdk, 'libresource_hosting')
+resourcehosting_env.UserInstallTargetHeader('include/hosting.h',\
+ 'service/resource-hosting', 'hosting.h')
# Go to build Unit test
if target_os == 'linux':
- SConscript('NotificationManager/src/unittest/SConscript')
+ SConscript('src/unittest/SConscript')
# Go to build sample apps
SConscript('SampleApp/SConscript')
--- /dev/null
+##
+# NotificationManager build script
+##
+
+Import('env')
+
+lib_env = env.Clone()
+SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
+resourcehosting_env = lib_env.Clone()
+
+######################################################################
+# Build flags
+######################################################################
+resourcehosting_env.AppendUnique(CPPPATH = ['../../include'])
+resourcehosting_env.AppendUnique(CPPPATH = ['../../../../extlibs/cjson'])
+resourcehosting_env.AppendUnique(CPPPATH = ['../../../../resource/csdk/connectivity/api'])
+resourcehosting_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
+resourcehosting_sample_env = resourcehosting_env.Clone()
+resourcehosting_env.AppendUnique(LIBS = [
+ 'resource_hosting',
+ 'rcs_client',
+ 'rcs_server',
+ 'rcs_common',
+ 'oc',
+ 'octbstack',
+ 'oc_logger',
+ 'connectivity_abstraction',
+ 'coap',
+ 'pthread'
+ ])
+resourcehosting_sample_env.AppendUnique(LIBS = [
+ 'oc',
+ 'octbstack',
+ 'oc_logger',
+ 'connectivity_abstraction',
+ 'coap',
+ 'pthread'
+ ])
+
+if env.get('SECURED') == '1':
+ resourcehosting_env.AppendUnique(LIBS = ['tinydtls'])
+ resourcehosting_sample_env.AppendUnique(LIBS = ['tinydtls'])
+if 'rt' in resourcehosting_env.get('LIBS'):
+ resourcehosting_env.Append(LIBS = ['rt'])
+if 'rt' in resourcehosting_sample_env.get('LIBS'):
+ resourcehosting_sample_env.Append(LIBS = ['rt'])
+
+####################################################################
+# Source files and Targets
+######################################################################
+sampleprovider = resourcehosting_sample_env.Program('sampleprovider', 'sampleProvider/SampleProvider.cpp')
+sampleconsumer = resourcehosting_sample_env.Program('sampleconsumer', 'sampleConsumer/SampleConsumer.cpp')
+
+sampleresourcehosting = resourcehosting_env.Program('sampleresourcehosting', 'sampleResourceHosting/main.cpp')
+
+#resourcehosting_sample_env.InstallTarget(sampleprovider, 'sampleprovider')
+#resourcehosting_sample_env.InstallTarget(sampleconsumer, 'sampleconsumer')
+#resourcehosting_env.InstallTarget(sampleresourcehosting, 'sampleresourcehosting')
include $(CLEAR_VARS)
OIC_LIB_PATH := ../../../../../../out/android/$(TARGET_ARCH_ABI)/release
-LOCAL_MODULE := NotificationManager
-LOCAL_SRC_FILES := $(OIC_LIB_PATH)/libNotificationManager.so
+LOCAL_MODULE := resourceHosting
+LOCAL_SRC_FILES := $(OIC_LIB_PATH)/libresource_hosting.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_STATIC_LIBRARIES += rcsCommon
LOCAL_STATIC_LIBRARIES += rcsClient
LOCAL_STATIC_LIBRARIES += rcsServer
-LOCAL_STATIC_LIBRARIES += NotificationManager
+LOCAL_STATIC_LIBRARIES += resourceHosting
OIC_SRC_DIR := ../../../../..
$(OIC_SRC_DIR)/resource/oc_logger/include \
$(OIC_SRC_DIR)/extlibs/boost/boost_1_58_0 \
$(OIC_SRC_DIR)/service/resource-encapsulation/include \
- $(OIC_SRC_DIR)/service/notification-manager/NotificationManager/include \
+ $(OIC_SRC_DIR)/service/resource-hosting/include \
LOCAL_SRC_FILES := ResourceHosing_JNI.cpp
include $(BUILD_SHARED_LIBRARY)
System.loadLibrary("rcs_common");
System.loadLibrary("rcs_client");
System.loadLibrary("rcs_server");
- System.loadLibrary("NotificationManager");
+ System.loadLibrary("resourceHosting");
System.loadLibrary("ResourceHosing_JNI");
}
}
ResourceHosting::ResourceHosting()
: hostingObjectList(),
discoveryManager(nullptr),
- presenceHandle(),
- pPresenceCB(nullptr), pDiscoveryCB(nullptr)
+ pDiscoveryCB(nullptr)
{
}
{
try
{
- requestMulticastPresence();
requestMulticastDiscovery();
}catch(const RCSPlatformException &e)
{
void ResourceHosting::stopHosting()
{
- // clear list hostingObjectList
- if(presenceHandle.isSubscribing())
- {
- presenceHandle.unsubscribe();
- }
hostingObjectList.clear();
}
void ResourceHosting::initializeResourceHosting()
{
- pPresenceCB = std::bind(&ResourceHosting::presenceHandler, this,
- std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);
pDiscoveryCB = std::bind(&ResourceHosting::discoverHandler, this,
std::placeholders::_1);
discoveryManager = RCSDiscoveryManager::getInstance();
}
-void ResourceHosting::requestMulticastPresence()
-{
- try
- {
- presenceHandle = PresenceSubscriber(MULTICAST_PRESENCE_ADDRESS,
- OCConnectivityType::CT_DEFAULT, pPresenceCB);
- }catch(...)
- {
- throw;
- }
-}
-
-void ResourceHosting::presenceHandler(OCStackResult ret, const unsigned int /*seq*/,
- const std::string & address)
-{
- switch(ret)
- {
- case OC_STACK_OK:
- case OC_STACK_CONTINUE:
- case OC_STACK_RESOURCE_CREATED:
- {
- // TODO start discovery
- requestDiscovery(address);
- break;
- }
-
- case OC_STACK_RESOURCE_DELETED:
- case OC_STACK_COMM_ERROR:
- case OC_STACK_TIMEOUT:
- case OC_STACK_PRESENCE_STOPPED:
- case OC_STACK_PRESENCE_TIMEOUT:
- case OC_STACK_PRESENCE_DO_NOT_HANDLE:
- case OC_STACK_ERROR:
- // TODO presence error
- break;
-
- case OC_STACK_INVALID_URI:
- case OC_STACK_INVALID_QUERY:
- case OC_STACK_INVALID_IP:
- case OC_STACK_INVALID_PORT:
- case OC_STACK_INVALID_CALLBACK:
- case OC_STACK_INVALID_METHOD:
- case OC_STACK_INVALID_PARAM:
- case OC_STACK_INVALID_OBSERVE_PARAM:
- case OC_STACK_NO_MEMORY:
- case OC_STACK_ADAPTER_NOT_ENABLED:
- case OC_STACK_NOTIMPL:
- case OC_STACK_NO_RESOURCE:
- case OC_STACK_RESOURCE_ERROR:
- case OC_STACK_SLOW_RESOURCE:
- case OC_STACK_DUPLICATE_REQUEST:
- case OC_STACK_NO_OBSERVERS:
- case OC_STACK_OBSERVER_NOT_FOUND:
- case OC_STACK_INVALID_OPTION:
- case OC_STACK_VIRTUAL_DO_NOT_HANDLE:
- case OC_STACK_MALFORMED_RESPONSE:
- case OC_STACK_PERSISTENT_BUFFER_REQUIRED:
- case OC_STACK_INVALID_REQUEST_HANDLE:
- case OC_STACK_INVALID_DEVICE_INFO:
- case OC_STACK_INVALID_JSON:
- break;
- default:
- // TODO unknown presence result
- break;
- }
-}
-
void ResourceHosting::requestMulticastDiscovery()
{
- requestDiscovery();
-}
-void ResourceHosting::requestDiscovery(std::string address)
-{
- std::string host = address;
- RCSAddress rcsAddress = RCSAddress::unicast(host);
discoveryTask = discoveryManager->discoverResourceByType(
- rcsAddress, OC_RSRVD_WELL_KNOWN_URI, HOSTING_RESOURSE_TYPE, pDiscoveryCB);
+ RCSAddress::multicast(), OC_RSRVD_WELL_KNOWN_URI, HOSTING_RESOURSE_TYPE, pDiscoveryCB);
}
void ResourceHosting::discoverHandler(RemoteObjectPtr remoteResource)
{
+ std::cout << "Discovered Resource uri : " << remoteResource->getUri() << std::endl;
std::string discoverdUri = remoteResource->getUri();
if(discoverdUri.compare(
discoverdUri.size()-HOSTING_TAG_SIZE, HOSTING_TAG_SIZE, HOSTING_TAG) != 0)
typedef std::shared_ptr<PrimitiveResource> PrimiteveResourcePtr;
typedef std::function<
- void(OCStackResult, const unsigned int, const std::string&)> SubscribeCallback;
- typedef std::function<
void(std::shared_ptr<RCSRemoteResourceObject>)> DiscoveryCallback;
typedef std::function<void()> DestroyedCallback;
std::list<HostingObjectPtr> hostingObjectList;
RCSDiscoveryManager * discoveryManager;
- PresenceSubscriber presenceHandle;
std::unique_ptr<RCSDiscoveryManager::DiscoveryTask> discoveryTask;
- SubscribeCallback pPresenceCB;
DiscoveryCallback pDiscoveryCB;
void initializeResourceHosting();
- void requestMulticastPresence();
void requestMulticastDiscovery();
- void requestDiscovery(std::string address = std::string());
- void presenceHandler(OCStackResult ret, const unsigned int seq, const std::string & address);
void discoverHandler(RemoteObjectPtr remoteResource);
HostingObjectPtr findRemoteResource(RemoteObjectPtr remoteResource);
#hosting_test_env.AppendUnique(LIBPATH = [gtest_dir + '/lib/.libs'])
hosting_test_env.AppendUnique(LIBPATH = [lib_env.get('BUILD_DIR')])
hosting_test_env.AppendUnique(LIBS = [
- 'NotificationManager', 'rcs_server', 'rcs_client','rcs_common',
+ 'resource_hosting', 'rcs_server', 'rcs_client','rcs_common',
'oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'coap',
GTest_Main, GTest])
hosting_test_env.PrependUnique(CPPPATH = [ src_dir + '/extlibs/hippomocks-master',
gtest_dir + '/include'])
hosting_test_env.AppendUnique(CPPPATH = ['../'])
-hosting_test_env.AppendUnique(CPPPATH = ['../../../../resource-encapsulation/include'])
-hosting_test_env.AppendUnique(CPPPATH = ['../../../../resource-encapsulation/src/common/primitiveResource/include'])
-hosting_test_env.AppendUnique(CPPPATH = ['../../../../resource-encapsulation/src/common/utils/include'])
+hosting_test_env.AppendUnique(CPPPATH = ['../../../resource-encapsulation/include'])
+hosting_test_env.AppendUnique(CPPPATH = ['../../../resource-encapsulation/src/common/primitiveResource/include'])
+hosting_test_env.AppendUnique(CPPPATH = ['../../../resource-encapsulation/src/common/utils/include'])
######################################################################
# Build Test
######################################################################