Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F1497424
mount_nodes.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Size
3 KB
Referenced Files
None
Subscribers
None
mount_nodes.cpp
View Options
#include
"mount_nodes.h"
#include
"attach_modules.h"
//#include "rlutil.h"
#include
<stdio.h>
// using namespace rlutil;
bool
mount_sensorInAgent
(
Agent
*
agent
,
Sensor
*
sensor
,
Channel
*
channel
)
{
if
(
agent
!=
NULL
&&
sensor
!=
NULL
&&
channel
!=
NULL
)
{
printf
(
" > Sensor "
);
// setColor(TXTCOLOR_LIGHTCYAN);
printf
(
"%s "
,
sensor
->
get_name
());
// setColor(TXTCOLOR_GREY);
printf
(
"(id: %03u) "
,
sensor
->
get_id
());
if
(
agent
->
get_sensorHandlerOfAgent
()
->
mount_sensorIntoSensorSlot
(
channel
)
&&
sensor
->
mount_agent
(
channel
))
{
// setColor(TXTCOLOR_LIGHTGREEN);
printf
(
"mounted "
);
// setColor(TXTCOLOR_GREY);
printf
(
"in Agent "
);
// setColor(TXTCOLOR_LIGHTCYAN);
printf
(
"%s "
,
agent
->
get_name
());
// setColor(TXTCOLOR_GREY);
printf
(
"(id: %03u)
\n
"
,
agent
->
get_id
());
return
true
;
}
else
{
// setColor(TXTCOLOR_LIGHTRED);
printf
(
"couldn't be mounted in %s (id: %03u)
\n
"
,
agent
->
get_name
(),
agent
->
get_id
());
// setColor(TXTCOLOR_GREY);
}
}
else
{
// setColor(TXTCOLOR_LIGHTRED);
printf
(
" > Agent, Sensor, or Channel is not valid
\n
"
);
// setColor(TXTCOLOR_GREY);
}
return
false
;
}
bool
mount_sensorInAgent
(
Agent
*
agent
,
Sensor
*
sensor
,
Channel
*
channel
,
HistoryModule
*
historyModule
)
{
if
(
agent
!=
NULL
&&
sensor
!=
NULL
&&
channel
!=
NULL
&&
historyModule
!=
NULL
)
{
if
(
mount_sensorInAgent
(
agent
,
sensor
,
channel
))
{
return
attach_historyModuleToSensorSlotInAgent
(
agent
,
sensor
,
channel
,
historyModule
);
}
}
else
{
// setColor(TXTCOLOR_LIGHTRED);
printf
(
"Agent, Sensor, Channel, or HistoryModule is not valid
\n
"
);
// setColor(TXTCOLOR_GREY);
}
return
false
;
}
bool
mount_agentInAgent
(
Agent
*
masteragent
,
Agent
*
slaveagent
,
Channel
*
channel
)
{
if
(
masteragent
!=
NULL
&&
slaveagent
!=
NULL
&&
channel
!=
NULL
)
{
if
(
masteragent
->
get_slaveAgentHandlerOfAgent
()
->
mount_slaveAgentIntoSlaveAgentSlot
(
channel
))
{
if
(
slaveagent
->
get_masterAgentHandlerOfAgent
()
->
mount_masterAgentIntoSlaveAgentSlot
(
channel
))
{
printf
(
" > Agent "
);
// setColor(TXTCOLOR_LIGHTCYAN);
printf
(
"%s "
,
slaveagent
->
get_name
());
// setColor(TXTCOLOR_GREY);
printf
(
"(id: %03u) "
,
slaveagent
->
get_id
());
// setColor(TXTCOLOR_LIGHTGREEN);
printf
(
"mounted "
);
// setColor(TXTCOLOR_GREY);
printf
(
"in Agent "
);
// setColor(TXTCOLOR_LIGHTCYAN);
printf
(
"%s "
,
masteragent
->
get_name
());
// setColor(TXTCOLOR_GREY);
printf
(
"(id: %03u)
\n
"
,
masteragent
->
get_id
());
return
true
;
}
else
{
// setColor(TXTCOLOR_LIGHTRED);
printf
(
" > Could not mount Master Agent %s (id: %03u) in Slave Agent "
"%s (id: %03u)
\n
"
,
masteragent
->
get_name
(),
masteragent
->
get_id
(),
slaveagent
->
get_name
(),
slaveagent
->
get_id
());
// setColor(TXTCOLOR_GREY);
masteragent
->
get_slaveAgentHandlerOfAgent
()
->
demount_slaveAgentIntoSlaveAgentSlot
(
channel
);
}
}
}
else
{
// setColor(TXTCOLOR_LIGHTRED);
printf
(
" > One of the Agents or Channel not valid
\n
"
);
// setColor(TXTCOLOR_GREY);
}
return
false
;
}
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Sun, Mar 1, 9:33 PM (23 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
282024
Default Alt Text
mount_nodes.cpp (3 KB)
Attached To
Mode
R20 SoC_Rosa_repo
Attached
Detach File
Event Timeline
Log In to Comment