Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F1494031
attach_modules.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Size
1 KB
Referenced Files
None
Subscribers
None
attach_modules.cpp
View Options
#include
"attach_modules.h"
#include
"rlutil.h"
using
namespace
rlutil
;
bool
attach_historyModuleToSensorSlotInAgent
(
Agent
*
agent
,
Sensor
*
sensor
,
Channel
*
inputPort
,
HistoryModule
*
historyModule
)
{
if
(
agent
!=
NULL
&&
inputPort
!=
NULL
&&
historyModule
!=
NULL
)
{
SensorSlotOfAgent
*
sensorSlotOfAgent
=
agent
->
get_sensorHandlerOfAgent
()
->
get_sensorSlotAddress
(
inputPort
);
if
(
sensorSlotOfAgent
!=
NULL
)
{
printf
(
" > HistoryModule "
);
setColor
(
TXTCOLOR_LIGHTCYAN
);
printf
(
"%s "
,
historyModule
->
get_name
());
setColor
(
TXTCOLOR_GREY
);
printf
(
"(id: %03u) "
,
historyModule
->
get_id
());
if
(
sensorSlotOfAgent
->
set_historyModule
(
historyModule
))
{
setColor
(
TXTCOLOR_LIGHTGREEN
);
printf
(
"attached "
);
setColor
(
TXTCOLOR_GREY
);
printf
(
"to Sensor "
);
setColor
(
TXTCOLOR_LIGHTCYAN
);
printf
(
"%s "
,
sensor
->
get_name
());
setColor
(
TXTCOLOR_GREY
);
printf
(
"(id: %03u) in Agent "
,
sensor
->
get_id
());
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 attach the HistoryModule!
\n
"
);
setColor
(
TXTCOLOR_GREY
);
}
}
else
{
setColor
(
TXTCOLOR_LIGHTRED
);
printf
(
" > Couldn't attach the HistoryModule because Sensor isn't mounted in %s (id: %03u)!
\n
"
,
agent
->
get_name
(),
agent
->
get_id
());
setColor
(
TXTCOLOR_GREY
);
}
}
else
{
setColor
(
TXTCOLOR_LIGHTRED
);
printf
(
" > Couldn't attach the HistoryModule because Agent, Channel, or HistoryModule is not valid!
\n
"
);
setColor
(
TXTCOLOR_GREY
);
}
return
false
;
}
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Sun, Mar 1, 6:29 PM (1 d, 17 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
281409
Default Alt Text
attach_modules.cpp (1 KB)
Attached To
Mode
R20 SoC_Rosa_repo
Attached
Detach File
Event Timeline
Log In to Comment