Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Accelerators
Generic
AttributeCombiner
Commits
19fe9165
Commit
19fe9165
authored
Sep 27, 2018
by
Jean-Luc Pons
Browse files
Added DeviceList attribute and timeout property
parent
8ae1f45e
Changes
6
Hide whitespace changes
Inline
Side-by-side
AttributeCombiner.cpp
View file @
19fe9165
...
...
@@ -69,9 +69,10 @@
//================================================================
//================================================================
// Attributes managed
is
:
// Attributes managed
are
:
//================================================================
// Errors | Tango::DevString Spectrum ( max = 2048)
// Errors | Tango::DevString Spectrum ( max = 2048)
// DeviceList | Tango::DevString Spectrum ( max = 4096)
//================================================================
namespace
AttributeCombiner_ns
...
...
@@ -134,6 +135,7 @@ void AttributeCombiner::delete_device()
}
/*----- PROTECTED REGION END -----*/
// AttributeCombiner::delete_device
delete
[]
attr_DeviceList_read
;
}
//--------------------------------------------------------
...
...
@@ -155,6 +157,7 @@ void AttributeCombiner::init_device()
// Get the device properties from database
get_device_property
();
attr_DeviceList_read
=
new
Tango
::
DevString
[
4096
];
/*----- PROTECTED REGION ID(AttributeCombiner::init_device) ENABLED START -----*/
set_state
(
Tango
::
ON
);
...
...
@@ -170,7 +173,7 @@ void AttributeCombiner::init_device()
errorStack
.
push_back
(
it
);
}
deviceGroup
->
add
(
deviceList
);
deviceGroup
->
set_timeout_millis
(
1500
);
deviceGroup
->
set_timeout_millis
(
timeout
);
//TangoSys_OMemStream ss;
//blmGroup->dump(ss);
...
...
@@ -217,6 +220,7 @@ void AttributeCombiner::get_device_property()
dev_prop
.
push_back
(
Tango
::
DbDatum
(
"AttributeRefList"
));
dev_prop
.
push_back
(
Tango
::
DbDatum
(
"DeviceList"
));
dev_prop
.
push_back
(
Tango
::
DbDatum
(
"CommandList"
));
dev_prop
.
push_back
(
Tango
::
DbDatum
(
"Timeout"
));
// is there at least one property to be read ?
if
(
dev_prop
.
size
()
>
0
)
...
...
@@ -275,6 +279,17 @@ void AttributeCombiner::get_device_property()
// And try to extract CommandList value from database
if
(
dev_prop
[
i
].
is_empty
()
==
false
)
dev_prop
[
i
]
>>
commandList
;
// Try to initialize Timeout from class property
cl_prop
=
ds_class
->
get_class_property
(
dev_prop
[
++
i
].
name
);
if
(
cl_prop
.
is_empty
()
==
false
)
cl_prop
>>
timeout
;
else
{
// Try to initialize Timeout from default device value
def_prop
=
ds_class
->
get_default_device_property
(
dev_prop
[
i
].
name
);
if
(
def_prop
.
is_empty
()
==
false
)
def_prop
>>
timeout
;
}
// And try to extract Timeout value from database
if
(
dev_prop
[
i
].
is_empty
()
==
false
)
dev_prop
[
i
]
>>
timeout
;
}
/*----- PROTECTED REGION ID(AttributeCombiner::get_device_property_after) ENABLED START -----*/
...
...
@@ -340,6 +355,28 @@ void AttributeCombiner::read_Errors(Tango::Attribute &attr)
/*----- PROTECTED REGION END -----*/
// AttributeCombiner::read_Errors
}
//--------------------------------------------------------
/**
* Read attribute DeviceList related method
* Description:
*
* Data type: Tango::DevString
* Attr type: Spectrum max = 4096
*/
//--------------------------------------------------------
void
AttributeCombiner
::
read_DeviceList
(
Tango
::
Attribute
&
attr
)
{
DEBUG_STREAM
<<
"AttributeCombiner::read_DeviceList(Tango::Attribute &attr) entering... "
<<
endl
;
/*----- PROTECTED REGION ID(AttributeCombiner::read_DeviceList) ENABLED START -----*/
for
(
int
i
=
0
;
i
<
(
int
)
deviceList
.
size
();
i
++
)
{
attr_DeviceList_read
[
i
]
=
CORBA
::
string_dup
(
deviceList
[
i
].
c_str
());
}
attr
.
set_value
(
attr_DeviceList_read
,
deviceList
.
size
());
/*----- PROTECTED REGION END -----*/
// AttributeCombiner::read_DeviceList
}
//--------------------------------------------------------
/**
...
...
AttributeCombiner.h
View file @
19fe9165
...
...
@@ -131,10 +131,13 @@ public:
vector
<
string
>
deviceList
;
// CommandList: List of global VoidVoid command
vector
<
string
>
commandList
;
// Timeout: Timeout value of grouped call
Tango
::
DevLong
timeout
;
// Attribute data members
public:
Tango
::
DevString
*
attr_Errors_read
;
Tango
::
DevString
*
attr_DeviceList_read
;
// Constructors and destructors
public:
...
...
@@ -205,6 +208,15 @@ public:
*/
virtual
void
read_Errors
(
Tango
::
Attribute
&
attr
);
virtual
bool
is_Errors_allowed
(
Tango
::
AttReqType
type
);
/**
* Attribute DeviceList related methods
* Description:
*
* Data type: Tango::DevString
* Attr type: Spectrum max = 4096
*/
virtual
void
read_DeviceList
(
Tango
::
Attribute
&
attr
);
virtual
bool
is_DeviceList_allowed
(
Tango
::
AttReqType
type
);
//--------------------------------------------------------
...
...
AttributeCombiner.xmi
View file @
19fe9165
...
...
@@ -21,6 +21,11 @@
<type
xsi:type=
"pogoDsl:StringVectorType"
/>
<status
abstract=
"false"
inherited=
"false"
concrete=
"true"
concreteHere=
"true"
/>
</deviceProperties>
<deviceProperties
name=
"Timeout"
description=
"Timeout value of grouped call"
>
<type
xsi:type=
"pogoDsl:IntType"
/>
<status
abstract=
"false"
inherited=
"false"
concrete=
"true"
concreteHere=
"true"
/>
<DefaultPropValue>
1500
</DefaultPropValue>
</deviceProperties>
<commands
name=
"State"
description=
"This command gets the device state (stored in its device_state data member) and returns it to the caller."
execMethod=
"dev_state"
displayLevel=
"OPERATOR"
polledPeriod=
"0"
>
<argin
description=
"none"
>
<type
xsi:type=
"pogoDsl:VoidType"
/>
...
...
@@ -119,6 +124,14 @@
<status
abstract=
"false"
inherited=
"false"
concrete=
"true"
concreteHere=
"true"
/>
<properties
description=
""
label=
""
unit=
""
standardUnit=
""
displayUnit=
""
format=
""
maxValue=
""
minValue=
""
maxAlarm=
""
minAlarm=
""
maxWarning=
""
minWarning=
""
deltaTime=
""
deltaValue=
""
/>
</attributes>
<attributes
name=
"DeviceList"
attType=
"Spectrum"
rwType=
"READ"
displayLevel=
"EXPERT"
polledPeriod=
"0"
maxX=
"4096"
maxY=
""
allocReadMember=
"true"
isDynamic=
"false"
>
<dataType
xsi:type=
"pogoDsl:StringType"
/>
<changeEvent
fire=
"false"
libCheckCriteria=
"false"
/>
<archiveEvent
fire=
"false"
libCheckCriteria=
"false"
/>
<dataReadyEvent
fire=
"false"
libCheckCriteria=
"true"
/>
<status
abstract=
"false"
inherited=
"false"
concrete=
"true"
concreteHere=
"true"
/>
<properties
description=
""
label=
""
unit=
""
standardUnit=
""
displayUnit=
""
format=
""
maxValue=
""
minValue=
""
maxAlarm=
""
minAlarm=
""
maxWarning=
""
minWarning=
""
deltaTime=
""
deltaValue=
""
/>
</attributes>
<preferences
docHome=
"./doc_html"
makefileHome=
"/segfs/tango/cppserver/env"
/>
<additionalFiles
name=
"AttributeMap"
path=
"/mntdirect/_segfs/tango/cppserver/calculcation/AttributeCombiner/AttributeMap.cpp"
/>
</classes>
...
...
AttributeCombinerClass.cpp
View file @
19fe9165
...
...
@@ -423,6 +423,20 @@ void AttributeCombinerClass::set_default_property()
}
else
add_wiz_dev_prop
(
prop_name
,
prop_desc
);
prop_name
=
"Timeout"
;
prop_desc
=
"Timeout value of grouped call"
;
prop_def
=
"1500"
;
vect_data
.
clear
();
vect_data
.
push_back
(
"1500"
);
if
(
prop_def
.
length
()
>
0
)
{
Tango
::
DbDatum
data
(
prop_name
);
data
<<
vect_data
;
dev_def_prop
.
push_back
(
data
);
add_wiz_dev_prop
(
prop_name
,
prop_desc
,
prop_def
);
}
else
add_wiz_dev_prop
(
prop_name
,
prop_desc
);
}
//--------------------------------------------------------
...
...
@@ -553,6 +567,30 @@ void AttributeCombinerClass::attribute_factory(vector<Tango::Attr *> &att_list)
// Not Memorized
att_list
.
push_back
(
errors
);
// Attribute : DeviceList
DeviceListAttrib
*
devicelist
=
new
DeviceListAttrib
();
Tango
::
UserDefaultAttrProp
devicelist_prop
;
// description not set for DeviceList
// label not set for DeviceList
// unit not set for DeviceList
// standard_unit not set for DeviceList
// display_unit not set for DeviceList
// format not set for DeviceList
// max_value not set for DeviceList
// min_value not set for DeviceList
// max_alarm not set for DeviceList
// min_alarm not set for DeviceList
// max_warning not set for DeviceList
// min_warning not set for DeviceList
// delta_t not set for DeviceList
// delta_val not set for DeviceList
devicelist
->
set_default_properties
(
devicelist_prop
);
// Not Polled
devicelist
->
set_disp_level
(
Tango
::
EXPERT
);
// Not Memorized
att_list
.
push_back
(
devicelist
);
// Create a list of static attributes
create_static_attribute_list
(
get_class_attr
()
->
get_attr_list
());
...
...
AttributeCombinerClass.h
View file @
19fe9165
...
...
@@ -182,6 +182,19 @@ public:
{
return
(
static_cast
<
AttributeCombiner
*>
(
dev
))
->
is_Errors_allowed
(
ty
);}
};
// Attribute DeviceList class definition
class
DeviceListAttrib
:
public
Tango
::
SpectrumAttr
{
public:
DeviceListAttrib
()
:
SpectrumAttr
(
"DeviceList"
,
Tango
::
DEV_STRING
,
Tango
::
READ
,
4096
)
{};
~
DeviceListAttrib
()
{};
virtual
void
read
(
Tango
::
DeviceImpl
*
dev
,
Tango
::
Attribute
&
att
)
{(
static_cast
<
AttributeCombiner
*>
(
dev
))
->
read_DeviceList
(
att
);}
virtual
bool
is_allowed
(
Tango
::
DeviceImpl
*
dev
,
Tango
::
AttReqType
ty
)
{
return
(
static_cast
<
AttributeCombiner
*>
(
dev
))
->
is_DeviceList_allowed
(
ty
);}
};
//=========================================
// Define classes for commands
...
...
AttributeCombinerStateMachine.cpp
View file @
19fe9165
...
...
@@ -64,6 +64,22 @@ bool AttributeCombiner::is_Errors_allowed(TANGO_UNUSED(Tango::AttReqType type))
return
true
;
}
//--------------------------------------------------------
/**
* Method : AttributeCombiner::is_DeviceList_allowed()
* Description : Execution allowed for DeviceList attribute
*/
//--------------------------------------------------------
bool
AttributeCombiner
::
is_DeviceList_allowed
(
TANGO_UNUSED
(
Tango
::
AttReqType
type
))
{
// Not any excluded states for DeviceList attribute in read access.
/*----- PROTECTED REGION ID(AttributeCombiner::DeviceListStateAllowed_READ) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/
// AttributeCombiner::DeviceListStateAllowed_READ
return
true
;
}
//=================================================
// Commands Allowed Methods
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment