IOsObserver.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. #ifndef __IOSOBSERVER_H__
  30. #define __IOSOBSERVER_H__
  31. #include <unordered_set>
  32. #include <string>
  33. #include <IDataItemObserver.h>
  34. #include <IDataItemSubscription.h>
  35. #include <IFrameworkActionReq.h>
  36. using namespace std;
  37. namespace loc_core
  38. {
  39. /**
  40. * @brief IOsObserver interface
  41. * @details IOsObserver interface;
  42. * In OS dependent code this type serves as a handle to
  43. * an OS independent instance of this interface.
  44. */
  45. class IOsObserver :
  46. public IDataItemObserver,
  47. public IDataItemSubscription,
  48. public IFrameworkActionReq {
  49. public:
  50. // To set the subscription object
  51. virtual void setSubscriptionObj(IDataItemSubscription *subscriptionObj) = 0;
  52. // To set the framework action request object
  53. virtual void setFrameworkActionReqObj(IFrameworkActionReq *frameworkActionReqObj) = 0;
  54. // IDataItemObserver Overrides
  55. inline virtual void getName (string & /*name*/) {}
  56. inline virtual void notify (const std::unordered_set <IDataItemCore *> & /*dlist*/) {}
  57. // IDataItemSubscription Overrides
  58. inline virtual void subscribe
  59. (
  60. const std :: unordered_set <DataItemId> & /*l*/,
  61. IDataItemObserver * /*client*/
  62. ){}
  63. inline virtual void updateSubscription
  64. (
  65. const std :: unordered_set <DataItemId> & /*l*/,
  66. IDataItemObserver * /*client*/
  67. ){}
  68. inline virtual void requestData
  69. (
  70. const std :: unordered_set <DataItemId> & /*l*/,
  71. IDataItemObserver * /*client*/
  72. ){}
  73. inline virtual void unsubscribe
  74. (
  75. const std :: unordered_set <DataItemId> & /*l*/,
  76. IDataItemObserver * /*client*/
  77. ){}
  78. inline virtual void unsubscribeAll (IDataItemObserver * /*client*/){}
  79. // IFrameworkActionReq Overrides
  80. inline virtual void turnOn (DataItemId /*dit*/, int /*timeOut*/){}
  81. inline virtual void turnOff (DataItemId /*dit*/) {}
  82. #ifdef USE_GLIB
  83. inline virtual bool connectBackhaul(const BackhaulContext& ctx) { return false; }
  84. inline virtual bool disconnectBackhaul(const BackhaulContext& ctx) { return false; }
  85. #endif
  86. /**
  87. * @brief Destructor
  88. * @details Destructor
  89. */
  90. virtual ~IOsObserver () {}
  91. };
  92. } // namespace loc_core
  93. #endif // #ifndef __IOSOBSERVER_H__