00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 #ifndef __JAUS_MOBILITY_LIST_MANAGER__H 00041 #define __JAUS_MOBILITY_LIST_MANAGER__H 00042 00043 #include "jaus/core/management/management.h" 00044 #include "jaus/mobility/list/element.h" 00045 #include "jaus/mobility/list/setelement.h" 00046 #include "jaus/mobility/list/confirmelementrequest.h" 00047 #include "jaus/mobility/list/deleteelement.h" 00048 #include "jaus/mobility/list/executelist.h" 00049 #include "jaus/mobility/list/queryactiveelement.h" 00050 #include "jaus/mobility/list/queryelement.h" 00051 #include "jaus/mobility/list/queryelementcount.h" 00052 #include "jaus/mobility/list/queryelementlist.h" 00053 #include "jaus/mobility/list/rejectelementrequest.h" 00054 #include "jaus/mobility/list/reportactiveelement.h" 00055 #include "jaus/mobility/list/reportelement.h" 00056 #include "jaus/mobility/list/reportelementcount.h" 00057 #include "jaus/mobility/list/reportelementlist.h" 00058 00059 namespace JAUS 00060 { 00083 class JAUS_MOBILITY_DLL ListManager : public Management::Child 00084 { 00085 public: 00097 class JAUS_MOBILITY_DLL Child : public Management::Child 00098 { 00099 friend class ListManager; 00100 public: 00101 Child(const ID& serviceIdentifier, 00102 const ID& parentServiceIdentifier); 00103 virtual ~Child(); 00104 // Method called when transitioning to a ready state. 00105 virtual bool Resume() = 0; 00106 // Method called to transition due to reset. 00107 virtual bool Reset() = 0; 00108 // Method called when transitioning to a standby state. 00109 virtual bool Standby() = 0; 00110 // Method called to check if an element type (message payload) is supported. 00111 virtual bool IsElementSupported(const Message* message) const = 0; 00112 // Sets the current active list element. 00113 void SetActiveListElement(const UShort uid); 00114 // Deletes an element from the list. 00115 bool DeleteListElement(const UShort id, Byte& rejectReason); 00116 // Inserts an element into the list. 00117 bool SetElements(const Element::List& elements); 00118 // Get the current active element in the list. 00119 Element GetActiveListElement() const; 00120 // Method to get a specific element. 00121 Element GetElement(const UShort id) const; 00122 // Gets the current active element (0 if not initialized yet or list is complete). 00123 UShort GetActiveListElementID() const { return mActiveElement; } 00124 // Advances the active element in the list (called when active element is completed). 00125 void AdvanceListElement(); 00126 // Method to get a copy of the element list. 00127 Element::Map GetElementList() const; 00128 // Gets a copy of the list IDs. 00129 void GetElementList(std::vector<UShort>& list) const; 00130 // Get the size of the element list. 00131 unsigned int GetElementCount() const; 00132 private: 00133 Mutex mListMutex; 00134 Element::Map mElementList; 00135 UShort mActiveElement; 00136 }; 00137 const static std::string Name; 00138 ListManager(); 00139 ~ListManager(); 00140 virtual bool Resume() { return true; } 00141 virtual bool Reset(); 00142 virtual bool Standby() { return true; } 00143 virtual bool IsDiscoverable() const { return true; } 00144 virtual bool GenerateEvent(const Events::Subscription& info) const; 00145 virtual bool IsEventSupported(const Events::Type type, 00146 const double requestedPeriodicRate, 00147 const Message* queryMessage, 00148 double& confirmedPeriodicRate, 00149 std::string& errorMessage) const; 00150 virtual void Receive(const Message* message); 00151 virtual Message* CreateMessage(const UShort messageCode) const; 00152 }; 00153 } 00154 00155 #endif 00156 /* End of File */