[SSM] Fix IOT-332, 333, 334 issues
[platform/upstream/iotivity.git] / service / soft-sensor-manager / SDK / java / org / iotivity / service / ssm / CoreController.java
1 package org.iotivity.service.ssm;
2
3 import java.util.List;
4
5 public class CoreController {
6         static {
7                 try {
8                         String workingPath = System.getProperty("user.dir");
9
10                         // for android: not complete method
11                         if (System.getProperty("os.name").toLowerCase().equals("linux")) {
12                                 // System.out.println("System load Android library");
13                                 System.loadLibrary("oc_logger");
14                                 System.loadLibrary("coap");
15                                 System.loadLibrary("octbstack");
16                                 System.loadLibrary("oc");
17                                 System.loadLibrary("SSMCore");
18                         } else {
19                                 // System.out.println("System load 32bit library");
20                                 System.load(workingPath + "SSMCore_Windows.dll");
21                         }
22                 } catch (UnsatisfiedLinkError e) {
23                         System.out.println(e.getMessage());
24                 }
25         }
26
27         static private CoreController coreController;
28
29         public static CoreController getInstance() {
30                 if (coreController == null)
31                         coreController = new CoreController();
32
33                 return coreController;
34         }
35
36         public native void InitializeSSMCore(String xmlDescription)
37                         throws Exception;
38
39         public native void StartSSMCore() throws Exception;
40
41         public native void StopSSMCore() throws Exception;
42
43         public native void TerminateSSMCore() throws Exception;
44
45         public native QueryEngine CreateQueryEngine() throws Exception;
46
47         public native int ReleaseQueryEngine(QueryEngine queryEngine);
48
49         // QueryEngine
50         public native int ExecuteContextQuery(int pQueryEngineInstance,
51                         String contextQuery) throws Exception;
52
53         public native void RegisterQueryEvent(int pQueryEngineInstance,
54                         IQueryEngineEvent queryEngineEvent);
55
56         public native void KillContextQuery(int pQueryEngineInstance, int cqid)
57                         throws Exception;
58
59         // public native void UnregiterQueryEvent(int pQueryEngineInstance,
60         // IQueryEngineEvent queryEngineEvent);
61
62         // IModelData
63         public native int GetDataId(int pIModelDataInstance);
64
65         public native int GetPropertyCount(int pIModelDataInstance);
66
67         public native String GetPropertyName(int pIModelDataInstance,
68                         int propertyIndex);
69
70         public native String GetPropertyValue(int pIModelDataInstance,
71                         int propertyIndex);
72
73         // IDataReader
74         public native List<String> GetAffectedModels(int pDataReaderInstance);
75
76         public native int GetModelDataCount(int pDataReaderInstance,
77                         String modelName) throws Exception;
78
79         public native ModelData GetModelData(int pDataReaderInstance,
80                         String modelName, int dataIndex) throws Exception;
81
82         public native void RegisterReportReceiver(IReportReceiver reportReceiver);
83 }