Commit 697a10ac authored by Marcus Nordenberg's avatar Marcus Nordenberg

Add editing support for bit values in PROFINET Configurator

parent 478e6708
...@@ -4142,7 +4142,7 @@ ItemPnParEnum::ItemPnParEnum( GsdmlAttrNav *attrnav, const char *item_name, ...@@ -4142,7 +4142,7 @@ ItemPnParEnum::ItemPnParEnum( GsdmlAttrNav *attrnav, const char *item_name,
// Get the values and corresponding texts // Get the values and corresponding texts
gsdml_ValueItem *vi = (gsdml_ValueItem *)value_ref->Body.ValueItemTarget.p; gsdml_ValueItem *vi = (gsdml_ValueItem *)value_ref->Body.ValueItemTarget.p;
gsdml_Valuelist *allowed_values = 0; gsdml_Valuelist *allowed_values = 0;
if ( strcmp( value_ref->Body.AllowedValues, "") != 0) if ( strcmp( value_ref->Body.AllowedValues, "") != 0)
allowed_values = new gsdml_Valuelist( value_ref->Body.AllowedValues); allowed_values = new gsdml_Valuelist( value_ref->Body.AllowedValues);
...@@ -4151,9 +4151,12 @@ ItemPnParEnum::ItemPnParEnum( GsdmlAttrNav *attrnav, const char *item_name, ...@@ -4151,9 +4151,12 @@ ItemPnParEnum::ItemPnParEnum( GsdmlAttrNav *attrnav, const char *item_name,
for ( unsigned int i = 0; i < vi->Assignments->Assign.size(); i++) { for ( unsigned int i = 0; i < vi->Assignments->Assign.size(); i++) {
ParEnumValue eval; ParEnumValue eval;
int num; int num;
num = sscanf( vi->Assignments->Assign[i]->Body.Content, "%u", &eval.value); num = sscanf( vi->Assignments->Assign[i]->Body.Content, "%u", &eval.value);
if ( num != 1) if ( num != 1)
continue; continue;
if ( allowed_values && !allowed_values->in_list( eval.value)) if ( allowed_values && !allowed_values->in_list( eval.value))
continue; continue;
...@@ -4163,6 +4166,20 @@ ItemPnParEnum::ItemPnParEnum( GsdmlAttrNav *attrnav, const char *item_name, ...@@ -4163,6 +4166,20 @@ ItemPnParEnum::ItemPnParEnum( GsdmlAttrNav *attrnav, const char *item_name,
values.push_back( eval); values.push_back( eval);
} }
} }
else if (datatype == gsdml_eValueDataType_Bit)
{
ParEnumValue eval;
eval.value = 1;
strncpy( eval.text, "On", sizeof(eval.text));
eval.value <<= bit_offset;
values.push_back( eval);
eval.value = 0;
strncpy( eval.text, "Off", sizeof(eval.text));
values.push_back( eval);
}
if ( allowed_values) if ( allowed_values)
delete allowed_values; delete allowed_values;
...@@ -4218,15 +4235,12 @@ int ItemPnParEnum::open_children( GsdmlAttrNav *attrnav, double x, double y) ...@@ -4218,15 +4235,12 @@ int ItemPnParEnum::open_children( GsdmlAttrNav *attrnav, double x, double y)
else { else {
brow_SetNodraw( attrnav->brow->ctx); brow_SetNodraw( attrnav->brow->ctx);
gsdml_ValueItem *vi = (gsdml_ValueItem *)value_ref->Body.ValueItemTarget.p; for ( unsigned int i = 0; i < values.size(); i++) {
new ItemPnParEnumBit( attrnav, values[i].text, datatype, data,
if ( vi && vi->Assignments) { byte_offset, values[i].value, mask, noedit,
for ( unsigned int i = 0; i < values.size(); i++) { node, flow_eDest_IntoLast);
new ItemPnParEnumBit( attrnav, values[i].text, datatype, data,
byte_offset, values[i].value, mask, noedit,
node, flow_eDest_IntoLast);
}
} }
brow_SetOpen( node, attrnav_mOpen_Children); brow_SetOpen( node, attrnav_mOpen_Children);
brow_SetAnnotPixmap( node, 0, attrnav->brow->pixmap_openmap); brow_SetAnnotPixmap( node, 0, attrnav->brow->pixmap_openmap);
brow_ResetNodraw( attrnav->brow->ctx); brow_ResetNodraw( attrnav->brow->ctx);
...@@ -4973,4 +4987,4 @@ int ItemPnEnumSendClock::scan( GsdmlAttrNav *attrnav, void *p) ...@@ -4973,4 +4987,4 @@ int ItemPnEnumSendClock::scan( GsdmlAttrNav *attrnav, void *p)
old_value = *(int *)p; old_value = *(int *)p;
return 1; return 1;
} }
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment