Before scons build is not working because of cpluff build and mqtt build.
It is resolved.
Remove null check point cpluff.
PluginManger will pass the argument to plugins later.
Currently it is not needed yet.
Comment out related code.
Modify the readme file for scons build
Before readme file is for makefile.
Comment Out Notification build in the Scons script.
Because of scons build error.
Change-Id: I1d74179ee6439535f218bb45a2f93248fb731228
Signed-off-by: heesung84.kim <heesung84.kim@samsung.com>
SConscript('soft-sensor-manager/SConscript')
# Build protocol plugin project
- # protocol-plugin use 'sys/inotify.h', this header file doesn't
- # exist on MAC OSX
- if target_os not in ['darwin', 'ios']:
- SConscript('protocol-plugin/SConscript')
+ SConscript('protocol-plugin/SConscript')
# Build notification manager project
- SConscript('notification-manager/SConscript')
+# SConscript('notification-manager/SConscript')
else:
SConscript('notification-manager/SampleApp/arduino/SConscript')
######################################################################
# Build flags
######################################################################
-cpluff_env.AppendUnique(CPPPATH = ['libcpluff/'])
-if target_os not in ['windows', 'winrt']:
- cpluff_env.AppendUnique(CFLAGS = ['-g','-fPIC', '-DPIC',
- '-DDLOPEN_POSIX',
- '-DCP_HOST=\\"' + platform.platform() + '\\"',
- '-DCP_SHREXT=\\".so\\"',
- '-DCP_FNAMESEP_CHAR=\\"\'/\'\\"',
- '-DCP_THREADS=\\"Posix\\"'])
- cpluff_env.AppendUnique(LIBS = ['dl'])
+cpluff_env.AppendUnique(CPPDEFINES = ['CP_C_API=CP_EXPORT',
+ 'CP_HOST=\"\\"'+env.get('TARGET_OS')+'\\"\"',
+ 'CP_DATADIR=\"\\\"/usr/local/share\\\"\"',
+ 'DLOPEN_POSIX',
+ 'DPIC',
+ 'CP_THREADS=\"\\\"Posix\\"\"',
+ 'CP_SHREXT=\"\\".so\\"\"',
+ 'CP_FNAMESEP_CHAR=\"\'/\'\"',
+ 'CP_FNAMESEP_STR=\"\\\"/\\"\"',
+ 'PACKAGE=\"\\\"cpluff\\\"\"'])
+cpluff_env.AppendUnique(LIBS = ['dl'])
+cpluff_env.PrependUnique(CCFLAGS = ['-fPIC'])
######################################################################
# Source files and Targets
######################################################################
CHECK_NOT_NULL(context);
CHECK_NOT_NULL(name);
- CHECK_NOT_NULL(ptr);
+// CHECK_NOT_NULL(ptr);
if (context->plugin == NULL) {
cpi_fatalf(_("Only plug-ins can define context specific symbols."));
}
######################################################################
plugin_manager_env.AppendUnique(CPPPATH = [
'../lib/cpluff/libcpluff',
- 'src'
+ 'src',
+ '../lib/rapidxml'
])
if target_os not in ['windows', 'winrt']:
plugin_manager_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
plugin_manager_env.AppendUnique(LIBS = ['boost_thread-gcc-mt-1_49', 'gnustl_static'])
+plugin_manager_env.AppendUnique(CPPDEFINES = ['CP_C_API=CP_EXPORT',
+ 'CP_HOST=\"\\"'+env.get('TARGET_OS')+'\\"\"',
+ 'CP_DATADIR=\"\\\"/usr/local/share\\\"\"',
+ 'DLOPEN_POSIX',
+ 'DPIC',
+ 'CP_THREADS=\"\\\"Posix\\"\"',
+ 'CP_SHREXT=\"\\".so\\"\"',
+ 'CP_FNAMESEP_CHAR=\"\'/\'\"',
+ 'CP_FNAMESEP_STR=\"\\\"/\\"\"',
+ 'PACKAGE=\"\\\"cpluff\\\"\"'])
+
+
plugin_manager_env.AppendUnique(LIBS = ['oc', 'octbstack', 'expat', 'dl'])
######################################################################
# Source files and Targets
'src/CpluffAdapter.cpp',
'src/FelixAdapter.cpp',
'src/Plugin.cpp',
- 'src/PluginManagerImpl.cpp']
+ 'src/PluginManagerImpl.cpp',
+ 'src/Config.cpp']
pmimpl_env = plugin_manager_env.Clone()
pmimpl_env.PrependUnique(CCFLAGS = ['-fPIC'])
{
ctx = cpi_new_context((cp_plugin_t *)hnode_get(hash_lookup(m_context->env->plugins, id.c_str())),
m_context->env, &status);
- cp_define_symbol(ctx, "START_ARGUMENT", arg);
+ //cp_define_symbol(ctx, "START_ARGUMENT", arg);
//printf("start ocplatform address : %x\n", arg);
if ((status = cp_start_plugin(m_context, (char *)id.c_str()) ) != CP_OK)
#include <sys/stat.h>
#include <errno.h>
#include <sys/types.h>
-#include <sys/inotify.h>
#include <unistd.h>
#include <boost/thread.hpp>
#include <boost/bind.hpp>
#include "Plugin.h"
#include "Config.h"
-#define EVENT_SIZE ( sizeof (struct inotify_event) )
#define BUF_LEN (int)( 1024 * ( EVENT_SIZE + 16 ) )
namespace OIC
#include <sys/stat.h>
#include <errno.h>
#include <sys/types.h>
-#include <sys/inotify.h>
#include <unistd.h>
#include <boost/thread.hpp>
#include <boost/bind.hpp>
#include "Plugin.h"
#include "Config.h"
-#define EVENT_SIZE ( sizeof (struct inotify_event) )
#define BUF_LEN (int)( 1024 * ( EVENT_SIZE + 16 ) )
namespace OIC
if target_os not in ['windows', 'winrt']:
plugins_env.AppendUnique(CXXFLAGS = ['-g3', '-Wall', '-pthread', '-std=c++0x'])
+ plugins_env.PrependUnique(CCFLAGS = ['-fPIC'])
plugins_env.AppendUnique(LINKFLAGS = ['-fPIC'])
if target_os not in ['arduino', 'android']:
plugins_env.AppendUnique(LIBS = ['gnustl_static'])
plugins_env.AppendUnique(CPPDEFINES = ['_GLIBCXX_USE_C99=1', '_GLIBCXX_HAVE_WCSTOF=1'])
+plugins_env.AppendUnique(LIBS = [File(env.get('BUILD_DIR') + '/libmosquitto.a'),
+ 'mosquitto', 'ssl', 'rt'])
+
+
######################################################################
# Source files and Targets
######################################################################
+plugins_env['LIBPREFIX'] = ''
+
mqtt_fan_src = Glob('mqtt-fan/src/' + '*.cpp')
-fanserver = plugins_env.SharedLibrary('fanserver_mqtt_plugin', mqtt_fan_src)
+fanserver = plugins_env.SharedLibrary('mqtt-fan/fanserver_mqtt_plugin', mqtt_fan_src)
mqtt_light_src = Glob('mqtt-light/src/' + '*.cpp')
-lightserver = plugins_env.SharedLibrary('lightserver_mqtt_plugin', mqtt_light_src)
+lightserver = plugins_env.SharedLibrary('mqtt-light/lightserver_mqtt_plugin', mqtt_light_src)
SConscript('mqtt-fan/lib/SConscript')
{
plugin_data_t *data = (plugin_data_t *)d;
- data->str = (void *)cp_resolve_symbol(data->ctx, "fanserver_mqtt_plugin", "START_ARGUMENT", NULL);
+ //data->str = (void *)cp_resolve_symbol(data->ctx, "fanserver_mqtt_plugin", "START_ARGUMENT", NULL);
//cp_run_function(data->ctx, (cp_run_func_t)start_fanserver); // 1
pthread_create(&(data->m_thread), NULL, start_fanserver, data); // 2
plugin_data_t *data = (plugin_data_t *)d;
data->flag = false;
- cp_release_symbol(data->ctx, data->str);
+ //cp_release_symbol(data->ctx, data->str);
pthread_join(data->m_thread, (void **)NULL);
}
{
plugin_data_t *data = (plugin_data_t *)d;
- data->str = (void *)cp_resolve_symbol(data->ctx, "lightserver_mqtt_plugin", "START_ARGUMENT", NULL);
+ //data->str = (void *)cp_resolve_symbol(data->ctx, "lightserver_mqtt_plugin", "START_ARGUMENT", NULL);
//cp_run_function(data->ctx, (cp_run_func_t)start_fanserver); // 1
pthread_create(&(data->m_thread), NULL, start_lightserver, data); // 2
plugin_data_t *data = (plugin_data_t *)d;
data->flag = false;
- cp_release_symbol(data->ctx, data->str);
+ //cp_release_symbol(data->ctx, data->str);
pthread_join(data->m_thread, (void **)NULL);
}
/build Directory for Building and Binary Release
+If you build by scons skip 2,3.
+
2. Compiling C-Pluff library
Before building Protocol-Plugin Manager, C-Pluff library should be compiled as follows.
4. Using Plugins
This version of protocol plug-in source code has following functionality.
-1) provides plug-in manager which can start and stop plug-in library.
-2) provides plug-in library which can communicate with MQTT protocol Fan and Light.
-3) provides OIC Sample Client which can get info about Fan and Light with configuration file(pluginmanager.xml).
- before starting sample app need as below command.
- $export LD_LIBRARY_PATH={Top_Dir}/out/linux/x86/release/:$LD_LIBRARY_PATH
+1) Provides plug-in manager which can start and stop plug-in library.
+2) Provides plug-in library which can communicate with MQTT protocol Fan and Light.
+3) Locate shared plug-in library and XML file in a specific folder.
So, to test a plug-in, follow below steps.
-1) Locate shared plug-in library and XML file in a specific folder.
-2) Register the plug-in with directory path input from plug-in manager sample.
-3) Start the plug-in from plug-in manager sample.
-4) Run OIC sample client.
+1) Copy libpmimple.so from {Top_Dir}/out/linux/x86/release to sample-app folder.
+2) Provides OIC Sample Client which can get info about Fan and Light with configuration file(pluginmanager.xml).
+3) Copy the pluginmanager.xml from ~/service/protocol-plugin/sample-app/linux/mqtt/ to sample-app folder.
+4) Modifty the pluginmanager.xml
+5) Before starting sample app need as below command.
+ $export LD_LIBRARY_PATH={Top_Dir}/out/linux/x86/release/:$LD_LIBRARY_PATH
+6) Start the plug-in from plug-in manager sample.
ex)~service/protocol-plugin/sample-app/linux/mqtt$./mqttclient
- (mqtt broker is already installed in the local system.)
+ (Need mqtt broker working in the local system(127.0.0.1) for test.)
######################################################################
# Build flags
######################################################################
-sample_env.AppendUnique(CPPPATH = ['../../plugin-manager/src/',
- '../../lib/cpluff/libcpluff/'])
+sample_env.AppendUnique(CPPPATH = [
+ '../../plugin-manager/src/',
+ '../../lib/cpluff/libcpluff/',
+ '../../lib/rapidxml'])
if target_os not in ['windows', 'winrt']:
sample_env.AppendUnique(CXXFLAGS = ['-Wall', '-pthread', '-std=c++0x'])
+sample_env.AppendUnique(LIBS = ['pthread'])
sample_env.AppendUnique(LIBS = ['oc', 'oc_logger', 'octbstack', 'coap', 'ppm', 'pmimpl', 'dl'])
######################################################################
# Source files and Targets
######################################################################
-fanclient = sample_env.Program('fanclient', 'fan-control/fanclient.cpp')
+mqttclient = sample_env.Program('mqtt/mqttclient', 'mqtt/mqttclient.cpp')
-Alias('fanclient', fanclient)
-env.AppendTarget('fanclient')
\ No newline at end of file
+Alias('mqttclient', mqttclient)
+env.AppendTarget('mqttclient')
\ No newline at end of file