#elif defined(TIZEN)
+#include <dlog.h>
+
#endif
#endif
#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
#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
#include <string>
#include <vector>
+#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 <tizen.h>
+
+#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;
ISSMResource(const std::string &n, const std::string &t) :
name(n), type(t)
{
+ location = SENSOR_LOCATION_LOCAL;
}
SENSOR_LOCATION location;
std::string name;
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;
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)
sprintf(buf,"Type: %s Value: %s<br>", (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);
}
}
{
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
"<Name>MyPC</Name>"
"<Type>PC</Type>"
"</Device>"
+ "<Config>"
+ "<SoftSensorDescription>/opt/usr/apps/org.iotivity.service.ssm.ssmtesterapp/lib/SoftSensorDescription.xml</SoftSensorDescription>"
+ "<SoftSensorRepository>/opt/usr/apps/org.iotivity.service.ssm.ssmtesterapp/lib/</SoftSensorRepository>"
+ "</Config>"
"</SSMCore>";
g_pQueryEngineEvent = new CQueryEngineEvent(ad);
*/
#include "SSMModelDefinition.h"
-#define _EXPORT_
-
#ifdef __cplusplus
extern "C"
{
#endif
-void _EXPORT_ InitializeContext(ICtxDelegate *pDelegate);
+INTERFACE_DECLSPEC void InitializeContext(ICtxDelegate *pDelegate);
#ifdef __cplusplus
-
}
;
#endif
DIResult makeDiscomfortIndex(InValue *data);
ContextData setOutput(int property_count, InValue *data);
- friend void _EXPORT_ initializeContext(ICtxDelegate *pDelegate);
+ friend void INTERFACE_DECLSPEC initializeContext(ICtxDelegate *pDelegate);
};
}
;
extern "C"
{
#endif
-void _EXPORT_ InitializeContext(ICtxDelegate *pDelegate);
+INTERFACE_DECLSPEC void InitializeContext(ICtxDelegate *pDelegate);
#ifdef __cplusplus
};
Trajectory *makeTrajectory(CurrentService *CService);
ITSResult setOutput( Trajectory *m_result, ContextData *out );
- friend void _EXPORT_ initializeContext(ICtxDelegate *pDelegate);
+ friend void INTERFACE_DECLSPEC initializeContext(ICtxDelegate *pDelegate);
};
}
;