From: jk13 Date: Fri, 13 Feb 2015 00:25:04 +0000 (+0900) Subject: [SSM] Fix Tizen sample and soft sensor declaration X-Git-Tag: 1.2.0+RC1~1934 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fea1aa7f7088fdf206ebc3ff587766da96836708;p=platform%2Fupstream%2Fiotivity.git [SSM] Fix Tizen sample and soft sensor declaration 1. Fix Tizen sample to load description and so from specific location 2. Fix Soft Sensor declaration to support which built under Tizen IDE Change-Id: I73bdc793c5b1b6e100e9af36aca9503be9522b3e Signed-off-by: jk13 Reviewed-on: https://gerrit.iotivity.org/gerrit/335 Tested-by: jenkins-iotivity Reviewed-by: Uze Choi --- diff --git a/service/soft-sensor-manager/SSMCore/src/Common/PlatformLayer.h b/service/soft-sensor-manager/SSMCore/src/Common/PlatformLayer.h index 4ed125c..2648219 100644 --- a/service/soft-sensor-manager/SSMCore/src/Common/PlatformLayer.h +++ b/service/soft-sensor-manager/SSMCore/src/Common/PlatformLayer.h @@ -37,6 +37,8 @@ #elif defined(TIZEN) +#include + #endif #endif @@ -64,8 +66,9 @@ void ReportMessage(const char *tag, const char *msg); #elif defined(TIZEN) -#define REPORT_MESSAGE(tag, msg) printf("[%s] %s\n", tag, msg) -#define PRINT_LOG(strError) printf("[SSM] %s:%d %s\n", __PRETTY_FUNCTION__, __LINE__, strError) +void ReportMessage(const char *tag, const char *msg); +#define REPORT_MESSAGE(tag, msg) ReportMessage(tag, msg) +#define PRINT_LOG(strError) dlog_print(DLOG_DEBUG, "SSM", "%s:%d %s", __PRETTY_FUNCTION__, __LINE__, strError) #else //Default linux diff --git a/service/soft-sensor-manager/SSMCore/src/SSMInterface/SSMCore.h b/service/soft-sensor-manager/SSMCore/src/SSMInterface/SSMCore.h index 4c690d4..91b229b 100644 --- a/service/soft-sensor-manager/SSMCore/src/SSMInterface/SSMCore.h +++ b/service/soft-sensor-manager/SSMCore/src/SSMInterface/SSMCore.h @@ -28,17 +28,6 @@ using namespace OIC; #define IN #define OUT -/* -#if defined(WIN32) && defined(SSMCORE_WINDOWS_EXPORTS) -#define INTERFACE_DECLSPEC __declspec(dllexport) -#elif defined(WIN32) -#define INTERFACE_DECLSPEC __declspec(dllimport) -#pragma comment(lib, "SSMCore_Windows.lib") -#else -#define INTERFACE_DECLSPEC -#endif -*/ -#define INTERFACE_DECLSPEC /** * @class IQueryEngine diff --git a/service/soft-sensor-manager/SSMCore/src/SSMInterface/SSMModelDefinition.h b/service/soft-sensor-manager/SSMCore/src/SSMInterface/SSMModelDefinition.h index c670db3..73cbe58 100644 --- a/service/soft-sensor-manager/SSMCore/src/SSMInterface/SSMModelDefinition.h +++ b/service/soft-sensor-manager/SSMCore/src/SSMInterface/SSMModelDefinition.h @@ -23,6 +23,26 @@ #include #include +#if defined(WIN32) + +#if defined(SSMSENSOR_WINDOWS_EXPORTS) +#define INTERFACE_DECLSPEC __declspec(dllexport) +#elif defined(WIN32) +#define INTERFACE_DECLSPEC __declspec(dllimport) +#endif + +#elif defined(TIZEN) + +#include + +#define INTERFACE_DECLSPEC EXPORT_API + +#else + +#define INTERFACE_DECLSPEC + +#endif + #define SSM_MODEL_RETRY 3 typedef enum {SSM_ONCE, SSM_REPEAT} TypeofEvent; typedef enum {SSM_EVENT_NORMAL, SSM_EVENT_ADDED, SSM_REMOVED, SSM_UPDATED} RESOURCE_EVENT_TYPE; @@ -37,6 +57,7 @@ class ISSMResource ISSMResource(const std::string &n, const std::string &t) : name(n), type(t) { + location = SENSOR_LOCATION_LOCAL; } SENSOR_LOCATION location; std::string name; diff --git a/service/soft-sensor-manager/SampleApp/tizen/SSMTesterApp/src/ssmtesterapp.cpp b/service/soft-sensor-manager/SampleApp/tizen/SSMTesterApp/src/ssmtesterapp.cpp index caa3abe..de80aac 100644 --- a/service/soft-sensor-manager/SampleApp/tizen/SSMTesterApp/src/ssmtesterapp.cpp +++ b/service/soft-sensor-manager/SampleApp/tizen/SSMTesterApp/src/ssmtesterapp.cpp @@ -30,10 +30,15 @@ typedef struct appdata { Evas_Object *unregister_query_label; } appdata_s; +typedef struct threadContext{ + appdata_s *ad; + const char *log; +} threadContext_s; + #define ELM_DEMO_EDJ "opt/usr/apps/org.iotivity.service.ssm.ssmtesterapp/res/ui_controls.edj" char log_buffer[10000]; -void updateLog(appdata_s *ad , char *newlog) +void updateLog(appdata_s *ad, const char *newlog) { const char *log_text = NULL; @@ -41,17 +46,30 @@ void updateLog(appdata_s *ad , char *newlog) strcpy(log_buffer,log_text); strcat(log_buffer,newlog); elm_entry_entry_set(ad->log,log_buffer); + elm_entry_cursor_end_set(ad->log); +} + +void* updateCallbackLog(void *data) +{ + threadContext_s *pThreadContext = (threadContext_s*)data; + + updateLog(pThreadContext->ad, pThreadContext->log); + + return NULL; } class CQueryEngineEvent : public OIC::IQueryEngineEvent { private: appdata_s *m_pAppData; + threadContext_s m_ThreadContext; public: CQueryEngineEvent(appdata_s *pAppData) { m_pAppData = pAppData; + m_ThreadContext.ad = m_pAppData; + m_ThreadContext.log = NULL; } OIC::SSMRESULT onQueryEngineEvent(int cqid, OIC::IDataReader *pResult) @@ -85,7 +103,8 @@ public: sprintf(buf,"Type: %s Value: %s
", (pModelData->getPropertyName(j)).c_str(), (pModelData->getPropertyValue(j)).c_str()); strcat(log,buf); } - updateLog(m_pAppData, log); + m_ThreadContext.log = log; + ecore_main_loop_thread_safe_call_sync((void *(*)(void *))updateCallbackLog, &m_ThreadContext); } } @@ -157,7 +176,7 @@ discomfort_index_cb(void *data , Evas_Object *obj , void *event_info) { appdata_s *ad = (appdata_s *)data; elm_entry_entry_set(ad->query_text, "subscribe Device.DiscomfortIndexSensor "\ - "if Device.DiscomfortIndexSensor.discomfortIndex > 0"); + "if Device.DiscomfortIndexSensor.discomfortIndex != 0"); } static void @@ -435,6 +454,10 @@ app_create(void *data) "MyPC" "PC" "" + "" + "/opt/usr/apps/org.iotivity.service.ssm.ssmtesterapp/lib/SoftSensorDescription.xml" + "/opt/usr/apps/org.iotivity.service.ssm.ssmtesterapp/lib/" + "" ""; g_pQueryEngineEvent = new CQueryEngineEvent(ad); diff --git a/service/soft-sensor-manager/SoftSensorPlugin/DiscomfortIndexSensor/include/DiscomfortIndexSensor.h b/service/soft-sensor-manager/SoftSensorPlugin/DiscomfortIndexSensor/include/DiscomfortIndexSensor.h index a0145f2..6bed98e 100644 --- a/service/soft-sensor-manager/SoftSensorPlugin/DiscomfortIndexSensor/include/DiscomfortIndexSensor.h +++ b/service/soft-sensor-manager/SoftSensorPlugin/DiscomfortIndexSensor/include/DiscomfortIndexSensor.h @@ -30,15 +30,12 @@ */ #include "SSMModelDefinition.h" -#define _EXPORT_ - #ifdef __cplusplus extern "C" { #endif -void _EXPORT_ InitializeContext(ICtxDelegate *pDelegate); +INTERFACE_DECLSPEC void InitializeContext(ICtxDelegate *pDelegate); #ifdef __cplusplus - } ; #endif @@ -88,7 +85,7 @@ namespace DiscomfortIndexSensorName DIResult makeDiscomfortIndex(InValue *data); ContextData setOutput(int property_count, InValue *data); - friend void _EXPORT_ initializeContext(ICtxDelegate *pDelegate); + friend void INTERFACE_DECLSPEC initializeContext(ICtxDelegate *pDelegate); }; } ; diff --git a/service/soft-sensor-manager/SoftSensorPlugin/IndoorTrajectorySensor/include/ITS.h b/service/soft-sensor-manager/SoftSensorPlugin/IndoorTrajectorySensor/include/ITS.h index adb1ecc..ab20039 100644 --- a/service/soft-sensor-manager/SoftSensorPlugin/IndoorTrajectorySensor/include/ITS.h +++ b/service/soft-sensor-manager/SoftSensorPlugin/IndoorTrajectorySensor/include/ITS.h @@ -37,7 +37,7 @@ extern "C" { #endif -void _EXPORT_ InitializeContext(ICtxDelegate *pDelegate); +INTERFACE_DECLSPEC void InitializeContext(ICtxDelegate *pDelegate); #ifdef __cplusplus }; @@ -114,7 +114,7 @@ namespace ITSName Trajectory *makeTrajectory(CurrentService *CService); ITSResult setOutput( Trajectory *m_result, ContextData *out ); - friend void _EXPORT_ initializeContext(ICtxDelegate *pDelegate); + friend void INTERFACE_DECLSPEC initializeContext(ICtxDelegate *pDelegate); }; } ;