1 | /* |
---|
2 | Copyright 2009 Virginia Polytechnic Institute and State University |
---|
3 | |
---|
4 | Licensed under the Apache License, Version 2.0 (the "License"); |
---|
5 | you may not use this file except in compliance with the License. |
---|
6 | You may obtain a copy of the License at |
---|
7 | |
---|
8 | http://www.apache.org/licenses/LICENSE-2.0 |
---|
9 | |
---|
10 | Unless required by applicable law or agreed to in writing, software |
---|
11 | distributed under the License is distributed on an "AS IS" BASIS, |
---|
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
13 | See the License for the specific language governing permissions and |
---|
14 | limitations under the License. |
---|
15 | */ |
---|
16 | |
---|
17 | /*! This header exports the declaration for the Service Management Layer |
---|
18 | * component. |
---|
19 | */ |
---|
20 | |
---|
21 | #ifndef SML_H |
---|
22 | #define SML_H |
---|
23 | |
---|
24 | |
---|
25 | #include "components.h" |
---|
26 | |
---|
27 | |
---|
28 | /*! \brief Service Management Layer (SML) class declaration. |
---|
29 | * |
---|
30 | * The functions listed here are required by the CROSS API for |
---|
31 | * service-oriented CROSS radio architectures. Note that most public functions |
---|
32 | * are documented in the parent class, Component. |
---|
33 | */ |
---|
34 | class ServiceManagementLayer : public Component |
---|
35 | { |
---|
36 | public: |
---|
37 | /*! \brief Default SML Constructor. */ |
---|
38 | ServiceManagementLayer(); |
---|
39 | |
---|
40 | /*! \brief Default SML Destructor. */ |
---|
41 | ~ServiceManagementLayer(); |
---|
42 | |
---|
43 | /*! \brief Preferred SML Constructor. |
---|
44 | * |
---|
45 | * Overloaded constructor that creates an SML and connects it to the |
---|
46 | * shell with the passed hostname and port. |
---|
47 | */ |
---|
48 | ServiceManagementLayer(const char* SML_Config, const char* serverName, \ |
---|
49 | const char* serverPort, int16_t clientPort); |
---|
50 | |
---|
51 | /*! \brief Connect the SML to a remote Shell control component. |
---|
52 | * |
---|
53 | * Connect and register with the shell component at the passed hostname |
---|
54 | * and port. |
---|
55 | */ |
---|
56 | void ConnectToShell(const char* serverName, const char* serverPort); |
---|
57 | |
---|
58 | void SendComponentType(); |
---|
59 | void MessageHandler(int32_t ID); |
---|
60 | void Shutdown(); |
---|
61 | void Reset(); |
---|
62 | void RegisterComponent(); |
---|
63 | void DeregisterComponent(); |
---|
64 | |
---|
65 | /*! \brief Starts the SML Server and watches it for incoming messages |
---|
66 | * |
---|
67 | * TODO |
---|
68 | */ |
---|
69 | void StartSMLServer(); |
---|
70 | |
---|
71 | private: |
---|
72 | /*! \brief Pass the radio configuration onto another component. |
---|
73 | * |
---|
74 | * Receive the radio configuration settings from the shell and pass them |
---|
75 | * on to another component. |
---|
76 | */ |
---|
77 | void TransferRadioConfiguration(int32_t ID); |
---|
78 | |
---|
79 | /*! \brief Pass a radio experience onto another component. |
---|
80 | * |
---|
81 | * Receive information regarding a completed 'experience' and pass it on |
---|
82 | * to the appropriate cognitive engine. |
---|
83 | */ |
---|
84 | void TransferExperience(int32_t ID); |
---|
85 | |
---|
86 | /*! Listen for other components registering their available services with |
---|
87 | * the SML. |
---|
88 | */ |
---|
89 | void ReceiveServices(int32_t ID); |
---|
90 | void DeregisterServices(int32_t ID); |
---|
91 | |
---|
92 | /*! Change the active mission of the radio to a new one and adjust radio |
---|
93 | * behavoir appropriately. |
---|
94 | */ |
---|
95 | void SetActiveMission(); |
---|
96 | |
---|
97 | /*! TODO |
---|
98 | */ |
---|
99 | void RegisterCognitiveEngine(int32_t ID); |
---|
100 | void DeregisterCognitiveEngine(int32_t ID); |
---|
101 | |
---|
102 | /*! List all services provided to the radio by registered components. |
---|
103 | */ |
---|
104 | void ListServices(); |
---|
105 | |
---|
106 | /*! Load/Relead the XML configuration file. |
---|
107 | */ |
---|
108 | void ReloadConfiguration(); |
---|
109 | void LoadConfiguration(const char *SML_Config, Mission* &mList); |
---|
110 | |
---|
111 | /*! Create and initialize the DB to hold the services |
---|
112 | */ |
---|
113 | void CreateServicesDB(); |
---|
114 | void CreateDataDB(); |
---|
115 | |
---|
116 | /*! TODO |
---|
117 | */ |
---|
118 | void PerformActiveMission(); |
---|
119 | void TransactData(int32_t sourceID); |
---|
120 | |
---|
121 | /*! The socket file descriptor information for the shell which this SML |
---|
122 | * is connected to. |
---|
123 | */ |
---|
124 | int32_t shellSocketFD; |
---|
125 | |
---|
126 | /*! TODO |
---|
127 | */ |
---|
128 | int16_t CEPort; |
---|
129 | int16_t SMLport; |
---|
130 | |
---|
131 | uint32_t numberOfCognitiveEngines; |
---|
132 | |
---|
133 | int32_t cogEngSrv; |
---|
134 | int32_t activeMission; |
---|
135 | |
---|
136 | uint32_t Current_ID; |
---|
137 | |
---|
138 | bool CE_Present; |
---|
139 | CE_Reg *CE_List; |
---|
140 | Mission *miss; |
---|
141 | }; |
---|
142 | |
---|
143 | #endif |
---|