Merge "Partial Implementation of US1574:"
[platform/upstream/iotivity.git] / csdk / controller / core / include / core / Characteristic.hpp
1 //******************************************************************
2 //
3 // Copyright 2014 Intel Mobile Communications GmbH 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 #ifndef CHARACTERISTIC_H_
22 #define CHARACTERISTIC_H_
23
24 // ============================================================================
25 // Includes
26 // ============================================================================
27 #include <string>
28 #include <memory>
29 #include <functional>
30 #include <stdint.h>
31 #include "Core.h"
32
33 // ============================================================================
34 // Namespace
35 // ============================================================================
36 namespace Intel {
37 namespace CCFL {
38 namespace API {
39
40 // ============================================================================
41 // Class
42 // ============================================================================
43 class PropertyGetResult {
44         // ============================================================
45         // Destructor
46         // ============================================================
47         public:
48                 virtual ~PropertyGetResult() {}
49
50         // ============================================================
51         // Public Method(s)
52         // ============================================================
53         public:
54                 virtual QueryResultType getResult() const = 0;
55                 virtual const std::string& getName() const = 0;
56                 virtual const std::string& getValue() const = 0;
57 };
58
59 typedef std::function<void (const PropertyGetResult&)> PropertyGetFunction;
60
61 // ============================================================================
62 // Class
63 // ============================================================================
64 class PropertySetResult {
65         // ============================================================
66         // Destructor
67         // ============================================================
68         public:
69                 virtual ~PropertySetResult() {}
70
71         // ============================================================
72         // Public Method(s)
73         // ============================================================
74         public:
75                 virtual QueryResultType getResult() const = 0;
76                 virtual const std::string& getName() const = 0;
77                 virtual const std::string& getValue() const = 0;
78 };
79
80 typedef std::function<void (const PropertySetResult&)> PropertySetFunction;
81
82 // ============================================================================
83 // Class
84 // ============================================================================
85
86 class Characteristic {
87   // ============================================================
88   // Type Definition(s)
89   // ============================================================
90   public:
91     typedef std::shared_ptr<Characteristic> SharedPtr;
92     typedef std::weak_ptr<Characteristic> WeakPtr;
93
94   // ============================================================
95   // Destructor
96   // ============================================================
97   public:
98     virtual ~Characteristic() {}
99
100   // ============================================================
101   // Public Method(s)
102   // ============================================================
103   public:
104     virtual const std::string& getName() const = 0;
105     virtual bool isReadable() const = 0;
106     virtual bool isWritable() const = 0;
107     virtual bool isConstant() const = 0;
108 };
109
110 }
111 }
112 }
113
114 #endif