16
16
using System ;
17
17
using System . Collections . Generic ;
18
18
using System . Linq ;
19
- using System . Text ;
20
19
21
20
namespace S7CommPlusDriver
22
21
{
@@ -200,7 +199,7 @@ public int BrowseAllBlocks(out List<BlockInfo> exploreData)
200
199
return 0 ;
201
200
}
202
201
203
- public int GetBlockXml ( uint relid , out string xml_linecomment , out Dictionary < uint , string > xml_comment , out string interfaceDescription , out string [ ] blockBody , out string fuctionalObjectCode , out string [ ] intRef , out string [ ] extRef )
202
+ public int GetBlockXml ( uint relid , out string blockName , out ProgrammingLanguage lang , out uint blockNumber , out string xml_linecomment , out Dictionary < uint , string > xml_comment , out string interfaceDescription , out string [ ] blockBody , out string fuctionalObjectCode , out string [ ] intRef , out string [ ] extRef )
204
203
{
205
204
int res ;
206
205
// With requesting DataInterface_InterfaceDescription, whe would be able to get all informations like the access ids and
@@ -213,14 +212,21 @@ public int GetBlockXml(uint relid, out string xml_linecomment, out Dictionary<ui
213
212
fuctionalObjectCode = String . Empty ;
214
213
intRef = new string [ 0 ] ;
215
214
extRef = new string [ 0 ] ;
215
+ blockName = null ;
216
+ lang = ProgrammingLanguage . Undef ;
217
+ blockNumber = relid & 0xffff ;
216
218
217
219
var exploreReq = new ExploreRequest ( ProtocolVersion . V2 ) ;
218
220
exploreReq . ExploreId = relid ;
219
221
exploreReq . ExploreRequestId = Ids . None ;
220
222
exploreReq . ExploreChildsRecursive = 1 ;
221
- exploreReq . ExploreParents = 0 ;
223
+ exploreReq . ExploreParents = 0 ;
224
+
225
+ // We want to know the following attributes
226
+ exploreReq . AddressList . Add ( Ids . ObjectVariableTypeName ) ;
227
+ //exploreReq.AddressList.Add(Ids.Block_BlockNumber);
228
+ exploreReq . AddressList . Add ( Ids . Block_BlockLanguage ) ;
222
229
223
- // We want to know the following attributes
224
230
exploreReq . AddressList . Add ( Ids . ASObjectES_Comment ) ;
225
231
exploreReq . AddressList . Add ( Ids . DataInterface_LineComments ) ;
226
232
exploreReq . AddressList . Add ( Ids . DataInterface_InterfaceDescription ) ;
@@ -252,7 +258,22 @@ public int GetBlockXml(uint relid, out string xml_linecomment, out Dictionary<ui
252
258
foreach ( var att in obj . Attributes )
253
259
{
254
260
switch ( att . Key )
255
- {
261
+ {
262
+ case Ids . ObjectVariableTypeName :
263
+ {
264
+ blockName = ( ( ValueWString ) att . Value ) . GetValue ( ) ;
265
+ break ;
266
+ }
267
+ case Ids . Block_BlockNumber :
268
+ {
269
+ break ;
270
+ }
271
+ case Ids . Block_BlockLanguage :
272
+ {
273
+ var l = ( ( ValueUInt ) att . Value ) . GetValue ( ) ;
274
+ lang = ( ProgrammingLanguage ) l ;
275
+ break ;
276
+ }
256
277
case Ids . FunctionalObject_extRefData :
257
278
{
258
279
var xx = ( ValueBlobSparseArray ) att . Value ;
0 commit comments