Commit c0688e77 authored by Claes Sjofors's avatar Claes Sjofors

Profinet Device method, CopyDevice, added

parent 3fd39085
......@@ -140,6 +140,86 @@ static pwr_tStatus ConfigureFilter (
return 1;
}
//
// Copy Device.
//
static pwr_tStatus CopyDevice (
ldh_sMenuCall *ip
)
{
char *gsdml;
int size;
int sts;
pwr_tOid oid;
pwr_tAttrRef aref[2];
pwr_tFileName datafile_src, datafile_dest;
pwr_tFileName found_file;
pwr_tCmd cmd;
// Check if data file exist
sprintf( datafile_src, "$pwrp_load/pwr_pn_%s.xml", id_to_string( ip->Pointed.Objid));
dcli_translate_filename( datafile_src, datafile_src);
sts = dcli_search_file( datafile_src, found_file, DCLI_DIR_SEARCH_INIT);
dcli_search_file( datafile_src, found_file, DCLI_DIR_SEARCH_END);
if ( EVEN(sts)) return sts;
sts = ldh_GetObjectPar( ip->PointedSession, ip->Pointed.Objid, "RtBody",
"GSDMLfile", &gsdml, &size);
if ( EVEN(sts)) return sts;
if ( strcmp( gsdml, "") == 0) {
free( gsdml);
return 0;
}
free( gsdml);
memset( aref, 0, sizeof(aref));
aref[0] = ip->Pointed;
sts = ldh_CopyObjectTrees( ip->PointedSession, aref, ip->Pointed.Objid,
ldh_eDest_After, 0, 1, 0);
if ( EVEN(sts)) return sts;
sts = ldh_GetNextSibling( ip->PointedSession, ip->Pointed.Objid, &oid);
if ( EVEN(sts)) return sts;
sprintf( datafile_dest, "$pwrp_load/pwr_pn_%s.xml", id_to_string( oid));
dcli_translate_filename( datafile_dest, datafile_dest);
snprintf( cmd, sizeof(cmd), "cp %s %s", datafile_src, datafile_dest);
system( cmd);
return 1;
}
static pwr_tStatus CopyDeviceFilter (
ldh_sMenuCall *ip
)
{
char *gsdml;
int size;
int sts;
pwr_tFileName datafile;
pwr_tFileName found_file;
// Check if data file exist
sprintf( datafile, "$pwrp_load/pwr_pn_%s.xml", id_to_string( ip->Pointed.Objid));
dcli_translate_filename( datafile, datafile);
sts = dcli_search_file( datafile, found_file, DCLI_DIR_SEARCH_INIT);
dcli_search_file( datafile, found_file, DCLI_DIR_SEARCH_END);
if ( EVEN(sts)) return 0;
sts = ldh_GetObjectPar( ip->PointedSession, ip->Pointed.Objid, "RtBody",
"GSDMLfile", &gsdml, &size);
if ( EVEN(sts)) return sts;
if ( strcmp( gsdml, "") == 0) {
free( gsdml);
return 0;
}
free( gsdml);
return 1;
}
//
// Syntax check.
//
......@@ -213,6 +293,8 @@ static pwr_tStatus SetIoDeviceData (
pwr_dExport pwr_BindMethods(PnDevice) = {
pwr_BindMethod(Configure),
pwr_BindMethod(ConfigureFilter),
pwr_BindMethod(CopyDevice),
pwr_BindMethod(CopyDeviceFilter),
pwr_BindMethod(SyntaxCheck),
pwr_BindMethod(GetIoDeviceData),
pwr_BindMethod(SetIoDeviceData),
......
Volume Profibus $ClassVolume 0.0.250.7
Body SysBody 05-SEP-2005 17:51:40.00
Attr NextOix = "_X209"
Attr NextOix = "_X213"
Attr NextCix = "_X20"
Attr NextTix[0] = "_X12"
EndBody
......@@ -3204,7 +3204,7 @@ Volume Profibus $ClassVolume 0.0.250.7
Object WriteReq $Attribute 105 07-SEP-2011 10:24:03.67
Body SysBody 07-SEP-2011 10:24:13.69
Attr PgmName = "WriteReq"
Attr Flags = 16908288
Attr Flags = 131072
Attr TypeRef = "Profibus:Class-PnWriteReq"
EndBody
EndObject
......@@ -3218,6 +3218,13 @@ Volume Profibus $ClassVolume 0.0.250.7
Attr FilterName = "PnDevice-ConfigureFilter"
EndBody
EndObject
Object CopyDevice $MenuButton 213 22-NOV-2011 10:13:58.01
Body SysBody 22-NOV-2011 10:13:58.01
Attr ButtonName = "CopyDevice"
Attr MethodName = "PnDevice-CopyDevice"
Attr FilterName = "PnDevice-CopyDeviceFilter"
EndBody
EndObject
EndObject
EndObject
Object ConfiguratorPoscn $Menu 125 21-APR-2009 13:41:08.17
......@@ -3229,6 +3236,13 @@ Volume Profibus $ClassVolume 0.0.250.7
Attr FilterName = "PnDevice-ConfigureFilter"
EndBody
EndObject
Object CopyDevice $MenuButton 212 22-NOV-2011 10:13:53.30
Body SysBody 22-NOV-2011 10:13:53.30
Attr ButtonName = "CopyDevice"
Attr MethodName = "PnDevice-CopyDevice"
Attr FilterName = "PnDevice-CopyDeviceFilter"
EndBody
EndObject
EndObject
EndObject
Object ConfiguratorPosos $Menu 128 21-APR-2009 13:41:08.17
......@@ -3240,6 +3254,13 @@ Volume Profibus $ClassVolume 0.0.250.7
Attr FilterName = "PnDevice-ConfigureFilter"
EndBody
EndObject
Object CopyDevice $MenuButton 211 22-NOV-2011 10:13:47.81
Body SysBody 22-NOV-2011 10:13:47.81
Attr ButtonName = "CopyDevice"
Attr MethodName = "PnDevice-CopyDevice"
Attr FilterName = "PnDevice-CopyDeviceFilter"
EndBody
EndObject
EndObject
EndObject
Object ConfiguratorPoson $Menu 131 21-APR-2009 13:41:08.17
......@@ -3251,6 +3272,13 @@ Volume Profibus $ClassVolume 0.0.250.7
Attr FilterName = "PnDevice-ConfigureFilter"
EndBody
EndObject
Object CopyDevice $MenuButton 210 22-NOV-2011 10:13:27.97
Body SysBody 22-NOV-2011 10:12:33.44
Attr ButtonName = "CopyDevice"
Attr MethodName = "PnDevice-CopyDevice"
Attr FilterName = "PnDevice-CopyDeviceFilter"
EndBody
EndObject
Object ConnectThread $MenuButton 134 21-APR-2009 13:41:08.17
Body SysBody 21-APR-2009 13:41:08.17
Attr ButtonName = "Connect PlcThread"
......
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