• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright (c) 2017, 2020 The Linux Foundation. All rights reserved.
2  *
3  * Redistribution and use in source and binary forms, with or without
4  * modification, are permitted provided that the following conditions are
5  * met:
6  *     * Redistributions of source code must retain the above copyright
7  *       notice, this list of conditions and the following disclaimer.
8  *     * Redistributions in binary form must reproduce the above
9  *       copyright notice, this list of conditions and the following
10  *       disclaimer in the documentation and/or other materials provided
11  *       with the distribution.
12  *     * Neither the name of The Linux Foundation, nor the names of its
13  *       contributors may be used to endorse or promote products derived
14  *       from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  */
29 
30 #ifndef __IOSOBSERVER_H__
31 #define __IOSOBSERVER_H__
32 
33 #include  <list>
34 #include <string>
35 #include <IDataItemObserver.h>
36 #include <IDataItemSubscription.h>
37 #include <IFrameworkActionReq.h>
38 
39 using namespace std;
40 
41 namespace loc_core
42 {
43 
44 /**
45  * @brief IOsObserver interface
46  * @details IOsObserver interface;
47  *          In OS dependent code this type serves as a handle to
48  *          an OS independent instance of this interface.
49  */
50 class IOsObserver :
51                 public IDataItemObserver,
52                 public IDataItemSubscription,
53                 public IFrameworkActionReq {
54 
55 public:
56 
57     // To set the subscription object
58     virtual void setSubscriptionObj(IDataItemSubscription *subscriptionObj) = 0;
59 
60     // To set the framework action request object
61     virtual void setFrameworkActionReqObj(IFrameworkActionReq *frameworkActionReqObj) = 0;
62 
63     // IDataItemObserver Overrides
getName(string &)64     inline virtual void getName (string & /*name*/) {}
notify(const std::list<IDataItemCore * > &)65     inline virtual void notify (const std::list <IDataItemCore *> & /*dlist*/) {}
66 
67     // IDataItemSubscription Overrides
subscribe(const std::list<DataItemId> &,IDataItemObserver *)68     inline virtual void subscribe
69     (
70         const std :: list <DataItemId> & /*l*/,
71         IDataItemObserver * /*client*/
72     ){}
updateSubscription(const std::list<DataItemId> &,IDataItemObserver *)73     inline virtual void updateSubscription
74     (
75         const std :: list <DataItemId> & /*l*/,
76         IDataItemObserver * /*client*/
77     ){}
requestData(const std::list<DataItemId> &,IDataItemObserver *)78     inline virtual void requestData
79     (
80         const std :: list <DataItemId> & /*l*/,
81         IDataItemObserver * /*client*/
82     ){}
unsubscribe(const std::list<DataItemId> &,IDataItemObserver *)83     inline virtual void unsubscribe
84     (
85         const std :: list <DataItemId> & /*l*/,
86         IDataItemObserver * /*client*/
87     ){}
unsubscribeAll(IDataItemObserver *)88     inline virtual void unsubscribeAll (IDataItemObserver * /*client*/){}
89 
90     // IFrameworkActionReq Overrides
turnOn(DataItemId,int)91     inline virtual void turnOn (DataItemId /*dit*/, int /*timeOut*/){}
turnOff(DataItemId)92     inline virtual void turnOff (DataItemId /*dit*/) {}
93 #ifdef USE_GLIB
connectBackhaul(const string & clientName)94     inline virtual bool connectBackhaul(const string& clientName) { return false; }
disconnectBackhaul(const string & clientName)95     inline virtual bool disconnectBackhaul(const string& clientName) { return false; }
96 #endif
97 
98     /**
99      * @brief Destructor
100      * @details Destructor
101      */
~IOsObserver()102     virtual ~IOsObserver () {}
103 };
104 
105 } // namespace loc_core
106 
107 #endif // #ifndef __IOSOBSERVER_H__
108