Initial merge-commit of the OIC code. Should successfully do discovery for single...
[platform/upstream/iotivity.git] / csdk / controller / core / include / core / Characteristic.hpp
1 //******************************************************************
2 //
3 // Copyright 2014 Intel Corporation All Rights Reserved.
4 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
5
6 #ifndef CHARACTERISTIC_H_
7 #define CHARACTERISTIC_H_
8
9 // ============================================================================
10 // Includes
11 // ============================================================================
12 #include <string>
13 #include <memory>
14 #include <functional>
15 #include <stdint.h>
16 #include "Core.h"
17
18 // ============================================================================
19 // Namespace
20 // ============================================================================
21 namespace Intel {
22 namespace CCFL {
23 namespace API {
24
25 // ============================================================================
26 // Class
27 // ============================================================================
28 class PropertyGetResult {
29         // ============================================================
30         // Destructor
31         // ============================================================
32         public:
33                 virtual ~PropertyGetResult() {}
34
35         // ============================================================
36         // Public Method(s)
37         // ============================================================
38         public:
39                 virtual QueryResultType getResult() const = 0;
40                 virtual const std::string& getName() const = 0;
41                 virtual const std::string& getValue() const = 0;
42 };
43
44 typedef std::function<void (const PropertyGetResult&)> PropertyGetFunction;
45
46 // ============================================================================
47 // Class
48 // ============================================================================
49 class PropertySetResult {
50         // ============================================================
51         // Destructor
52         // ============================================================
53         public:
54                 virtual ~PropertySetResult() {}
55
56         // ============================================================
57         // Public Method(s)
58         // ============================================================
59         public:
60                 virtual QueryResultType getResult() const = 0;
61                 virtual const std::string& getName() const = 0;
62                 virtual const std::string& getValue() const = 0;
63 };
64
65 typedef std::function<void (const PropertySetResult&)> PropertySetFunction;
66
67 // ============================================================================
68 // Class
69 // ============================================================================
70
71 class Characteristic {
72   // ============================================================
73   // Type Definition(s)
74   // ============================================================
75   public:
76     typedef std::shared_ptr<Characteristic> SharedPtr;
77     typedef std::weak_ptr<Characteristic> WeakPtr;
78
79   // ============================================================
80   // Destructor
81   // ============================================================
82   public:
83     virtual ~Characteristic() {}
84
85   // ============================================================
86   // Public Method(s)
87   // ============================================================
88   public:
89     virtual const std::string& getName() const = 0;
90     virtual bool isReadable() const = 0;
91     virtual bool isWritable() const = 0;
92     virtual bool isConstant() const = 0;
93 };
94
95 }
96 }
97 }
98
99 #endif