root/vtcross/trunk/src/service_management_layer/ServiceManagementLayer.cpp @ 204

Revision 204, 2.4 KB (checked in by bhilburn, 15 years ago)

Fleshed out the basic functions of the SML class. The meat is still
missing.

Line 
1/* Virginia Tech Cognitive Radio Open Source Systems
2 * Virginia Tech, 2009
3 *
4 * LICENSE INFORMATION GOES HERE
5 */
6
7/* DESCRIPTION OF FILE.
8 */
9
10
11#include <cstdlib>
12#include <cstring>
13#include <stdint.h>
14
15#include "vtcross/common.h"
16#include "vtcross/components.h"
17#include "vtcross/containers.h"
18#include "vtcross/debug.h"
19#include "vtcross/error.h"
20#include "vtcross/socketcomm.h"
21
22
23ServiceManagementLayer::ServiceManagementLayer()
24{
25    LOG("Creating Service Management Layer.\n");
26    shellSocketFD = -1;
27    LoadConfiguration();
28}
29
30
31ServiceManagementLayer::~ServiceManagementLayer()
32{
33}
34
35
36ServiceManagementLayer::ServiceManagementLayer(const char* serverName, \
37        const char* serverPort)
38{
39    LOG("Creating Service Management Layer.\n");
40
41    ConnectToShell(serverName, serverPort);
42
43    LoadConfiguration();
44}
45
46
47void
48ServiceManagementLayer::SendComponentType()
49{
50    SendMessage(shellSocketFD, "response_sml");
51    LOG("SML responded to GetRemoteComponentType query.\n");
52}
53
54
55void
56ServiceManagementLayer::ConnectToShell(const char* serverName, \
57        const char* serverPort)
58{
59    shellSocketFD = ClientSocket(serverName, serverPort);
60
61    RegisterComponent();
62}
63
64
65void
66ServiceManagementLayer::WaitForSignal()
67{
68}
69
70
71void
72ServiceManagementLayer::Shutdown()
73{
74    DeregisterComponent();
75}
76
77
78void
79ServiceManagementLayer::Reset()
80{
81    DeregisterComponent();
82    LoadConfiguration();
83}
84
85
86void
87ServiceManagementLayer::RegisterComponent()
88{
89    SendMessage(shellSocketFD, "register_sml");
90    LOG("ServiceManagementLayer:: Registration message sent.\n");
91}
92
93
94void
95ServiceManagementLayer::DeregisterComponent()
96{
97    SendMessage(shellSocketFD, "deregister_sml");
98    LOG("ServiceManagementLayer:: Deregistration message sent.\n");
99
100    shutdown(shellSocketFD, 2);
101    close(shellSocketFD);
102    shellSocketFD = -1;
103    LOG("ServiceManagementLayer:: Shell socket closed.\n");
104}
105
106
107void
108ServiceManagementLayer::TransferRadioConfiguration()
109{
110}
111
112
113void
114ServiceManagementLayer::TransferExperience()
115{
116}
117
118
119void
120ServiceManagementLayer::ReceiveServices()
121{
122}
123
124
125void
126ServiceManagementLayer::SetActiveMission()
127{
128}
129
130
131void
132ServiceManagementLayer::ListServices()
133{
134}
135
136
137void
138ServiceManagementLayer::ReloadConfiguration()
139{
140    LOG("ServiceManagementLayer:: Reloading Configuration.\n");
141}
142
143
144void
145ServiceManagementLayer::LoadConfiguration()
146{
147    LOG("ServiceManagementLayer:: Loading Configuration.\n");
148}
149
Note: See TracBrowser for help on using the browser.