Commit 451c7cab authored by Claes Sjofors's avatar Claes Sjofors

Profinet: ModuleIdentNumber added to datafile

parent ed6416af
......@@ -1361,6 +1361,24 @@ int GsdmlAttrNav::save( const char *filename)
strncpy( dev_data.version, gsdml->ProfileHeader->Body.ProfileRevision, sizeof(dev_data.version));
dev_data.byte_order = gsdml->byte_order;
// Store ModuleIdentNumber
gsdml_UseableModules *um = device_item->UseableModules;
for ( unsigned int i = 0; i < dev_data.slot_data.size(); i++) {
if ( i == 0) {
dev_data.slot_data[i]->module_ident_number = device_item->Body.ModuleIdentNumber;
}
else {
if ( dev_data.slot_data[i]->module_enum_number != 0) {
gsdml_ModuleItem *mi = (gsdml_ModuleItem *)um->
ModuleItemRef[dev_data.slot_data[i]->module_enum_number-1]->Body.ModuleItemTarget.p;
dev_data.slot_data[i]->module_ident_number = mi->Body.ModuleIdentNumber;
}
else
dev_data.slot_data[i]->module_ident_number = 0;
}
}
// Create IOCR data
if ( dev_data.iocr_data.size() < 1) {
GsdmlIOCRData *iod = new GsdmlIOCRData();
......
......@@ -92,6 +92,7 @@ int GsdmlSlotData::print( ofstream& fp)
{
fp <<
" <Slot ModuleEnumNumber=\"" << module_enum_number << "\"" << endl <<
" ModuleIdentNumber=\"" << module_ident_number << "\"" << endl <<
" ModuleClass=\"" << module_class << "\"" << endl <<
" ModuleText=\"" << module_text << "\"" << endl <<
" SlotNumber=\"" << slot_number << "\" >" << endl;
......@@ -421,6 +422,8 @@ int GsdmlDataReader::tag_attribute( const char *name, const char *value)
if ( strcmp( name, "ModuleEnumNumber") == 0)
sscanf( value, "%d", &sd->module_enum_number);
else if ( strcmp( name, "ModuleIdentNumber") == 0)
sscanf( value, "%u", &sd->module_ident_number);
else if ( strcmp( name, "ModuleClass") == 0)
sscanf( value, "%u", &sd->module_class);
else if ( strcmp( name, "ModuleText") == 0)
......
......@@ -93,6 +93,7 @@ class GsdmlSlotData {
slot_number(0), slot_idx(0)
{ module_text[0]=0;}
unsigned int module_enum_number;
unsigned int module_ident_number;
pwr_tCid module_class;
pwr_tOid module_oid;
char module_text[160];
......
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