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 | /* Service Management Layer (SML) class declaration. The functions listed here |
---|
29 | * are required by the VTCROSS API for service-oriented VTCROSS radio |
---|
30 | * architectures. |
---|
31 | */ |
---|
32 | class ServiceManagementLayer : public Component |
---|
33 | { |
---|
34 | public: |
---|
35 | ServiceManagementLayer(); |
---|
36 | ~ServiceManagementLayer(); |
---|
37 | |
---|
38 | /* Overloaded constructor that creates an SML and connects it to the |
---|
39 | * shell with the passed hostname and port. |
---|
40 | */ |
---|
41 | ServiceManagementLayer(const char* SML_Config, const char* serverName, \ |
---|
42 | const char* serverPort, int16_t clientPort); |
---|
43 | |
---|
44 | /* Connect and register with the shell component at the passed hostname |
---|
45 | * and port. |
---|
46 | */ |
---|
47 | void ConnectToShell(const char* serverName, const char* serverPort); |
---|
48 | void SendComponentType(); |
---|
49 | void MessageHandler(int32_t ID); |
---|
50 | void Shutdown(); |
---|
51 | void Reset(); |
---|
52 | void RegisterComponent(); |
---|
53 | void DeregisterComponent(); |
---|
54 | |
---|
55 | /* Starts the SML Server and watches it for incoming messages |
---|
56 | */ |
---|
57 | void StartSMLServer(); |
---|
58 | |
---|
59 | private: |
---|
60 | /* Receive the radio configuration settings from the shell and pass them |
---|
61 | * on to another component. |
---|
62 | */ |
---|
63 | void TransferRadioConfiguration(int32_t ID); |
---|
64 | |
---|
65 | /* Receive information regarding a completed 'experience' and pass it on |
---|
66 | * to the appropriate cognitive engine. |
---|
67 | */ |
---|
68 | void TransferExperience(int32_t ID); |
---|
69 | |
---|
70 | /* Listen for other components registering their available services with |
---|
71 | * the SML. |
---|
72 | */ |
---|
73 | void ReceiveServices(int32_t ID); |
---|
74 | void DeregisterServices(int32_t ID); |
---|
75 | |
---|
76 | /* Change the active mission of the radio to a new one and adjust radio |
---|
77 | * behavoir appropriately. |
---|
78 | */ |
---|
79 | void SetActiveMission(); |
---|
80 | |
---|
81 | /* TODO |
---|
82 | */ |
---|
83 | void RegisterCognitiveEngine(int32_t ID); |
---|
84 | void DeregisterCognitiveEngine(int32_t ID); |
---|
85 | |
---|
86 | /* List all services provided to the radio by registered components. |
---|
87 | */ |
---|
88 | void ListServices(); |
---|
89 | |
---|
90 | /* Load/Relead the XML configuration file. |
---|
91 | */ |
---|
92 | void ReloadConfiguration(); |
---|
93 | void LoadConfiguration(const char *SML_Config, Mission* &mList); |
---|
94 | |
---|
95 | /* Create and initialize the DB to hold the services |
---|
96 | */ |
---|
97 | void CreateServicesDB(); |
---|
98 | void CreateDataDB(); |
---|
99 | |
---|
100 | /* TODO |
---|
101 | */ |
---|
102 | void PerformActiveMission(); |
---|
103 | void TransactData(int32_t sourceID); |
---|
104 | |
---|
105 | /* The socket file descriptor information for the shell which this SML |
---|
106 | * is connected to. |
---|
107 | */ |
---|
108 | int32_t shellSocketFD; |
---|
109 | |
---|
110 | /* TODO |
---|
111 | */ |
---|
112 | int16_t CEPort; |
---|
113 | int16_t SMLport; |
---|
114 | |
---|
115 | uint32_t numberOfCognitiveEngines; |
---|
116 | |
---|
117 | int32_t cogEngSrv; |
---|
118 | int32_t activeMission; |
---|
119 | |
---|
120 | uint32_t Current_ID; |
---|
121 | |
---|
122 | bool CE_Present; |
---|
123 | CE_Reg *CE_List; |
---|
124 | Mission *miss; |
---|
125 | }; |
---|
126 | |
---|
127 | #endif |
---|