Modifying version number for building on tizen 3.0
[platform/upstream/iotivity.git] / service / soft-sensor-manager / SoftSensorPlugin / DiscomfortIndexSensor / include / DiscomfortIndexSensor.h
1 /******************************************************************
2  *
3  * Copyright 2014 Samsung Electronics All Rights Reserved.
4  *
5  *
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  ******************************************************************/
20
21 /*
22  * DiscomfortIndexSensor.h
23  */
24
25 #ifndef DISCOMFORTINDEXSENSOR_H_
26 #define DISCOMFORTINDEXSENSOR_H_
27
28 /**
29  * This header file is included to define _EXPORT_.
30  */
31 #include "SSMModelDefinition.h"
32
33 #define _EXPORT_
34
35 #ifdef __cplusplus
36 extern "C"
37 {
38 #endif
39 void _EXPORT_ InitializeContext(ICtxDelegate *pDelegate);
40 #ifdef __cplusplus
41
42 }
43 ;
44 #endif
45
46 namespace DiscomfortIndexSensorName
47 {
48 #define PHYSICAL_EA 2
49
50     typedef struct _physicalInput_
51     {
52         char *m_thingName;
53         int m_inputNum;
54         void *m_pInputStruct;
55     } physicalInput;
56
57     typedef enum
58     {
59         SUCCESS = 0, ERROR, ALL_DISCOMPORT, HALF_DISCOMPORT, LITTLE_DISCOMPORT, ALL_COMPORT
60     } DIResult;
61
62     class DiscomfortIndexSensor: public ICtxEvent
63     {
64         private:
65
66             static physicalInput s_PHYSICAL_SOFTSENSORs[PHYSICAL_EA];
67
68             class InValue
69             {
70                 public:
71                     std::string m_timestamp; // .
72                     std::string m_discomfortIndex; // Discomfort Index. ( 2 ~ 5 )
73                     std::string m_humidity; // relative humidity.
74                     std::string m_temperature; // celsius temperature.
75             };
76
77             InValue m_DI[PHYSICAL_EA];
78             InValue m_result;
79
80             int runLogic(std::vector< ContextData > &contextDataList);
81
82         public:
83             DiscomfortIndexSensor();
84
85             void onCtxEvent(enum CTX_EVENT_TYPE eventType, std::vector< ContextData > contextDataList);
86
87             DIResult getInput(std::vector< ContextData > &contextDataList, InValue *data);
88             DIResult makeDiscomfortIndex(InValue *data);
89             ContextData setOutput(int property_count, InValue *data);
90
91             friend void _EXPORT_ initializeContext(ICtxDelegate *pDelegate);
92     };
93 }
94 ;
95
96 #endif /* DISCOMFORTINDEXSENSOR_H_ */