Esempio n. 1
0
static pwr_tStatus configure_object( ldh_sMenuCall *ip, pwr_sAttrRef *aref, 
				     unsigned int disable_mask)
{
  pwr_tStatus 	sts;
  pwr_tCid 	cid;
  ldh_sParDef 	*bodydef;
  int 		rows;
  int		i;
  pwr_sAttrRef  aaref, daref;
  pwr_tDisableAttr disable;
  int disableattr_cnt = 0;
  
  sts = ldh_GetAttrRefTid( ip->PointedSession, aref, &cid);
  if ( EVEN(sts)) return sts;

  sts = ldh_GetObjectBodyDef( ip->PointedSession, cid, "RtBody", 1,
				  &bodydef, &rows);
  if (EVEN(sts)) return sts;

  for ( i = 0; i < rows; i++) {
    if ( bodydef[i].Par->Param.Info.Flags & PWR_MASK_DISABLEATTR) {
      // Disable or enable dependent on mask
      sts = ldh_ArefANameToAref( ip->PointedSession, aref, bodydef[i].ParName, &aaref);
      if ( EVEN(sts)) return sts;

      daref = cdh_ArefToDisableAref( &aaref);

      if ( (1 << disableattr_cnt++) & disable_mask)
	disable = 1;
      else
	disable = 0;

      sts = ldh_WriteAttribute( ip->PointedSession, &daref, (void *)&disable, 
				sizeof(disable));
      if ( EVEN(sts)) return sts;
    }
#if 0
    if ( bodydef[i].Par->Param.Info.Flags & PWR_MASK_CLASS) {
      // Examine object attribute
      sts = ldh_ArefANameToAref( ip->PointedSession, aref, bodydef[i].ParName, &aaref);
      if ( EVEN(sts)) return sts;

      sts = configure_object( ip, &aaref, disable_mask, disableattr_cnt);
      if ( EVEN(sts)) return sts;
    }
#endif
  }
  free( (char *)bodydef);

  return LDH__SUCCESS;
}
Esempio n. 2
0
static pwr_tStatus configure_parse_attr( ldh_sMenuCall *ip, pwr_tAttrRef *parent, char *str)
{
  int nr;
  unsigned int disable_mask;
  char attr[80];
  pwr_tAttrRef aaref;
  pwr_tStatus sts;

  // Read attribute and mask

  nr = sscanf( str, "%s %d", attr, &disable_mask);
  if ( nr != 2)
    return LDH__COMPSYNTAX;

  // printf( "-- Setting disable mask %d on object '%s'\n", disable_mask, attr);

  sts = ldh_ArefANameToAref( ip->PointedSession, parent, attr, 
			     &aaref);
  if ( ODD(sts)) {
    sts = configure_object( ip, &aaref, disable_mask);
    if ( EVEN(sts)) return sts;
  
    sts = configure_attrmask( ip, &aaref, str);
    if ( EVEN(sts)) return sts;
  }

  return LDH__SUCCESS;
}
Esempio n. 3
0
int pndevice_save_cb(void* sctx)
{
  device_sCtx* ctx = (device_sCtx*)sctx;
  pwr_tStatus sts;
  pwr_tOName name;
  int size;
  pwr_tOid oid;
  pwr_tStatus rsts = PB__SUCCESS;

  // Syntax check
  if (ctx->attr->attrnav->device_num == 0) {
    MsgWindow::message('E', "Device type not selected");
    return PB__SYNTAX;
  }

  for (unsigned int i = 1; i < ctx->attr->attrnav->dev_data.slot_data.size();
       i++) {
    if (ctx->attr->attrnav->dev_data.slot_data[i]->module_enum_number == 0
        && ctx->attr->attrnav->dev_data.slot_data[i]->module_class != 0) {
      // Module class selected but not module type
      char msg[20];

      sprintf(msg, "Slot %d", i);
      MsgWindow::message('E', "Module type not selected, ", msg);
      rsts = PB__MODULETYPE;
    }
    if (ctx->attr->attrnav->dev_data.slot_data[i]->module_class == 0
        && ctx->attr->attrnav->dev_data.slot_data[i]->module_enum_number != 0) {
      // Module type selected but not module class
      char msg[20];

      sprintf(msg, "Slot %d", i);
      MsgWindow::message('E', "Module class not selected, ", msg);
      rsts = PB__MODULECLASS;
    }
  }

  // Save configuration
  ((WNav*)ctx->editor_ctx)->set_nodraw();

  sts = ldh_ObjidToName(ctx->ldhses, ctx->aref.Objid, ldh_eName_Hierarchy, name,
      sizeof(name), &size);
  if (EVEN(sts))
    goto return_now;

  // Check that Slot attribute corresponds to the and module_oid
  for (unsigned int i = 1; i < ctx->attr->attrnav->dev_data.slot_data.size();
       i++)
    ctx->attr->attrnav->dev_data.slot_data[i]->module_oid = pwr_cNOid;

  for (sts = ldh_GetChild(ctx->ldhses, ctx->aref.Objid, &oid); ODD(sts);
       sts = ldh_GetNextSibling(ctx->ldhses, oid, &oid)) {
    unsigned int *slotnumberp, slotnumber;

    sts = ldh_GetObjectPar(
        ctx->ldhses, oid, "RtBody", "Slot", (char**)&slotnumberp, &size);
    if (EVEN(sts)) {
      MsgWindow::message(
          'E', "Not a Profinet module object", msgw_ePop_Yes, oid);
      continue;
    }
    slotnumber = *slotnumberp;
    free(slotnumberp);

    if (slotnumber >= ctx->attr->attrnav->dev_data.slot_data.size()) {
      MsgWindow::message('E', "Slot too large", msgw_ePop_Yes, oid);
      continue;
    }

    if (cdh_ObjidIsNotNull(
            ctx->attr->attrnav->dev_data.slot_data[slotnumber]->module_oid)) {
      MsgWindow::message('E', "Slot already used", msgw_ePop_Yes, oid);
      continue;
    }

    if (ctx->attr->attrnav->dev_data.slot_data[slotnumber]->module_class
        == pwr_cNCid)
      // Should be removed
      continue;

    ctx->attr->attrnav->dev_data.slot_data[slotnumber]->module_oid = oid;
  }

  // Remove modules that wasn't configured any more
  pwr_tOid moid[100];
  int mcnt;
  int found;
  mcnt = 0;
  for (sts = ldh_GetChild(ctx->ldhses, ctx->aref.Objid, &oid); ODD(sts);
       sts = ldh_GetNextSibling(ctx->ldhses, oid, &oid)) {
    found = 0;
    for (unsigned int i = 0; i < ctx->attr->attrnav->dev_data.slot_data.size();
         i++) {
      if (cdh_ObjidIsEqual(
              ctx->attr->attrnav->dev_data.slot_data[i]->module_oid, oid)) {
        found = 1;
        break;
      }
    }
    if (!found) {
      moid[mcnt++] = oid;
      if (mcnt > (int)(sizeof(moid) / sizeof(moid[0])))
        break;
    }
  }

  for (int i = 0; i < mcnt; i++)
    sts = ldh_DeleteObjectTree(ctx->ldhses, moid[i], 0);

  // Create new module objects
  for (unsigned int i = 0; i < ctx->attr->attrnav->dev_data.slot_data.size();
       i++) {
    GsdmlSlotData* slot = ctx->attr->attrnav->dev_data.slot_data[i];

    if (cdh_ObjidIsNull(slot->module_oid) && slot->module_class != pwr_cNCid) {
      char mname[20];
      sprintf(mname, "M%d", i);

      if (i == 1)
        sts = ldh_CreateObject(ctx->ldhses, &slot->module_oid, mname,
            slot->module_class, ctx->aref.Objid, ldh_eDest_IntoFirst);
      else {
        // Find sibling
        pwr_tOid dest_oid = pwr_cNOid;
        int dest_found = 0;
        for (int j = i - 1; j > 0; j--) {
          if (cdh_ObjidIsNotNull(
                  ctx->attr->attrnav->dev_data.slot_data[j]->module_oid)) {
            dest_oid = ctx->attr->attrnav->dev_data.slot_data[j]->module_oid;
            dest_found = 1;
            break;
          }
        }
        if (!dest_found)
          sts = ldh_CreateObject(ctx->ldhses, &slot->module_oid, mname,
              slot->module_class, ctx->aref.Objid, ldh_eDest_IntoFirst);
        else
          sts = ldh_CreateObject(ctx->ldhses, &slot->module_oid, mname,
              slot->module_class, dest_oid, ldh_eDest_After);
      }
      if (EVEN(sts)) {
        MsgWindow::message('E', "Error creating module object", mname);
        sts = 0;
        goto return_now;
      }

      pwr_tAttrRef aaref;
      pwr_tAttrRef modulearef = cdh_ObjidToAref(slot->module_oid);

      // Set Slot
      pwr_tUInt32 slotnumber = i;
      sts = ldh_ArefANameToAref(ctx->ldhses, &modulearef, "Slot", &aaref);
      if (EVEN(sts))
        goto return_now;

      sts = ldh_WriteAttribute(
          ctx->ldhses, &aaref, &slotnumber, sizeof(slotnumber));
      if (EVEN(sts))
        goto return_now;
    }
  }

  for (unsigned int i = 0; i < ctx->attr->attrnav->dev_data.slot_data.size();
       i++) {
    GsdmlSlotData* slot = ctx->attr->attrnav->dev_data.slot_data[i];

    if (i == 0) {
      std::vector<ChanItem> input_vect;
      std::vector<ChanItem> output_vect;

      sts = pndevice_check_io(ctx,
          ctx->attr->attrnav->device_item->VirtualSubmoduleList, input_vect,
          output_vect);
      if (sts == PB__CREATECHAN) {
        char msg[20];
        sprintf(msg, "Slot %d", i);
        MsgWindow::message(
            'W', "Unexpected datatype, channel not created, ", msg);
      }
    } else {
      if (slot->module_class == pwr_cClass_PnModule) {
        std::vector<ChanItem> input_vect;
        std::vector<ChanItem> output_vect;
        gsdml_UseableModules* um
            = ctx->gsdml->ApplicationProcess->DeviceAccessPointList
                  ->DeviceAccessPointItem[ctx->attr->attrnav->device_num - 1]
                  ->UseableModules;

        if (!um)
          continue;
        gsdml_ModuleItem* mi
            = (gsdml_ModuleItem*)um->ModuleItemRef[slot->module_enum_number - 1]
                  ->Body.ModuleItemTarget.p;

        sts = pndevice_check_io(
            ctx, mi->VirtualSubmoduleList, input_vect, output_vect);
        if (sts == PB__CREATECHAN) {
          char msg[20];
          sprintf(msg, "Slot %d", i);
          MsgWindow::message(
              'W', "Unexpected datatype, channel not created, ", msg);
        }

        // Create the channels
        if (EVEN(ldh_GetChild(ctx->ldhses, slot->module_oid, &oid))) {
          unsigned int chan_cnt = 0;
          for (unsigned int j = 0; j < input_vect.size(); j++) {
            char name[80];
            sprintf(name, "Ch%02u", chan_cnt++);
            sts = ldh_CreateObject(ctx->ldhses, &oid, name, input_vect[j].cid,
                slot->module_oid, ldh_eDest_IntoLast);
            if (EVEN(sts))
              goto return_now;

            pwr_tAttrRef aaref;
            pwr_tAttrRef chanaref = cdh_ObjidToAref(oid);

            // Set Representation
            pwr_tEnum representation = input_vect[j].representation;
            sts = ldh_ArefANameToAref(
                ctx->ldhses, &chanaref, "Representation", &aaref);
            if (EVEN(sts))
              goto return_now;

            sts = ldh_WriteAttribute(
                ctx->ldhses, &aaref, &representation, sizeof(representation));
            if (EVEN(sts))
              goto return_now;

            // Set Number
            pwr_tUInt16 number = input_vect[j].number;
            sts = ldh_ArefANameToAref(ctx->ldhses, &chanaref, "Number", &aaref);
            if (EVEN(sts))
              goto return_now;

            sts = ldh_WriteAttribute(
                ctx->ldhses, &aaref, &number, sizeof(number));
            if (EVEN(sts))
              goto return_now;

            // Set Description
            pwr_tString80 description;
            strncpy(
                description, input_vect[j].description, sizeof(description));
            sts = ldh_ArefANameToAref(
                ctx->ldhses, &chanaref, "Description", &aaref);
            if (EVEN(sts))
              goto return_now;

            sts = ldh_WriteAttribute(
                ctx->ldhses, &aaref, description, sizeof(description));
            if (EVEN(sts))
              goto return_now;
          }
          for (unsigned int j = 0; j < output_vect.size(); j++) {
            char name[80];
            sprintf(name, "Ch%02u", chan_cnt++);
            sts = ldh_CreateObject(ctx->ldhses, &oid, name, output_vect[j].cid,
                slot->module_oid, ldh_eDest_IntoLast);
            if (EVEN(sts))
              goto return_now;

            pwr_tAttrRef aaref;
            pwr_tAttrRef chanaref = cdh_ObjidToAref(oid);

            // Set Representation
            pwr_tEnum representation = output_vect[j].representation;
            sts = ldh_ArefANameToAref(
                ctx->ldhses, &chanaref, "Representation", &aaref);
            if (EVEN(sts))
              goto return_now;

            sts = ldh_WriteAttribute(
                ctx->ldhses, &aaref, &representation, sizeof(representation));
            if (EVEN(sts))
              goto return_now;

            // Set Number
            pwr_tUInt16 number = output_vect[j].number;
            sts = ldh_ArefANameToAref(ctx->ldhses, &chanaref, "Number", &aaref);
            if (EVEN(sts))
              goto return_now;

            sts = ldh_WriteAttribute(
                ctx->ldhses, &aaref, &number, sizeof(number));
            if (EVEN(sts))
              goto return_now;

            // Set Description
            pwr_tString80 description;
            strncpy(
                description, output_vect[j].description, sizeof(description));
            sts = ldh_ArefANameToAref(
                ctx->ldhses, &chanaref, "Description", &aaref);
            if (EVEN(sts))
              goto return_now;

            sts = ldh_WriteAttribute(
                ctx->ldhses, &aaref, description, sizeof(description));
            if (EVEN(sts))
              goto return_now;
          }
        }
      } else {
        // Remove existing channels
        std::vector<pwr_tOid> chanvect;
        pwr_tCid cid;

        for (sts = ldh_GetChild(ctx->ldhses, slot->module_oid, &oid); ODD(sts);
             sts = ldh_GetNextSibling(ctx->ldhses, oid, &oid)) {
          sts = ldh_GetObjectClass(ctx->ldhses, oid, &cid);
          if (EVEN(sts))
            goto return_now;

          switch (cid) {
          case pwr_cClass_ChanDi:
          case pwr_cClass_ChanDo:
          case pwr_cClass_ChanAi:
          case pwr_cClass_ChanAo:
          case pwr_cClass_ChanIi:
          case pwr_cClass_ChanIo:
            chanvect.push_back(oid);
            break;
          default:;
          }
        }
        for (unsigned int i = 0; i < chanvect.size(); i++) {
          sts = ldh_DeleteObject(ctx->ldhses, chanvect[i]);
          if (EVEN(sts))
            goto return_now;
        }
      }
    }
  }

  // Write data of all devices for profinet viewer
  // Data is device name, IP and MAC address
  sts = generate_viewer_data(ctx);

  sts = rsts;

return_now:
  ((WNav*)ctx->editor_ctx)->reset_nodraw();
  return sts;
}
Esempio n. 4
0
static pwr_tStatus ConfigureComponent( ldh_sMenuCall *ip) 
{
  pwr_tStatus sts;
  unsigned int disable_mask;
  pwr_sMenuButton   mb;
  pwr_tEnum graph_configuration;
  pwr_sAttrRef aaref;
  char vect[10][80];
  char item[3][80];
  int i;
  int nr;
  int vect_cnt;
  
  sts = ldh_ReadObjectBody(ip->PointedSession, ip->ItemList[ip->ChosenItem].MenuObject,
    "SysBody", &mb, sizeof(pwr_sMenuButton));

  // Reset previoius disable configuration
  configure_object_reset( ip, &ip->Pointed, &mb);

  // Set disable attributes from argument 0
  if ( mb.MethodArguments[0][0] != '(') {
    // Old syntax, eg '7, CircuitBreaker 4, Contactor 5'
    vect_cnt = dcli_parse( mb.MethodArguments[0], ",", "", (char *)vect, 
			   sizeof( vect) / sizeof( vect[0]), 
			   sizeof( vect[0]), 0);
  
    for ( i = 0; i < vect_cnt; i++) {
      nr = dcli_parse( vect[i], " 	", "", (char *)item,
		       sizeof( item) / sizeof( item[0]), 
		       sizeof( item[0]), 0);
      if ( nr == 1) {
	
	if ( sscanf( item[0], "%d", &disable_mask) != 1)
	  graph_configuration = 0;

	sts = configure_object( ip, &ip->Pointed, disable_mask);
	if ( EVEN(sts)) return sts;
      }
      else if ( nr == 2) {
	pwr_tAName aname;
	
	if ( sscanf( item[1], "%d", &disable_mask) != 1)
	  disable_mask = 0;

	strncpy( aname, item[0], sizeof(aname));
	
	sts = ldh_ArefANameToAref( ip->PointedSession, &ip->Pointed, aname, 
				   &aaref);
	if ( ODD(sts)) {
	  sts = configure_object( ip, &aaref, disable_mask);
	  if ( EVEN(sts)) return sts;
	}
      }
    }
  }
  else {
    // New syntax, eg '(7 (CircuitBreaker 4, Contactor 5))'
    char str1[256];
    char *s;

    strncpy( str1, &mb.MethodArguments[0][1], sizeof(str1));
    s = strrchr( str1, ')');
    if ( !s)
      return LDH__COMPSYNTAX;

    *s = 0;
    
    dcli_trim( str1, str1);
    nr = sscanf( str1, "%d", &disable_mask);
    if ( nr != 1)
      return LDH__COMPSYNTAX;

    sts = configure_object( ip, &ip->Pointed, disable_mask);
    if ( EVEN(sts)) return sts;

    sts = configure_attrmask( ip, &ip->Pointed, str1);
    if ( EVEN(sts)) return sts;
  }

  // Set GraphConfiguration from argument 1
  vect_cnt = dcli_parse( mb.MethodArguments[1], ",", "", (char *)vect, 
		   sizeof( vect) / sizeof( vect[0]), 
		   sizeof( vect[0]), 0);
  
  for ( i = 0; i < vect_cnt; i++) {
    nr = dcli_parse( vect[i], " 	", "", (char *)item,
		   sizeof( item) / sizeof( item[0]), 
		   sizeof( item[0]), 0);
    if ( nr == 1) {

      if ( sscanf( item[0], "%d", &graph_configuration) != 1)
	graph_configuration = 0;

      sts = ldh_ArefANameToAref( ip->PointedSession, &ip->Pointed, "GraphConfiguration", 
				 &aaref);
      if ( ODD(sts)) {
	sts = ldh_WriteAttribute( ip->PointedSession, &aaref, (void *)&graph_configuration, 
				  sizeof(graph_configuration));
	if ( EVEN(sts)) return sts;
      }
    }
    else if ( nr == 2) {
      pwr_tAName aname;

      if ( sscanf( item[1], "%d", &graph_configuration) != 1)
	graph_configuration = 0;

      strncpy( aname, item[0], sizeof(aname));
      strncat( aname, ".GraphConfiguration", sizeof(aname));

      sts = ldh_ArefANameToAref( ip->PointedSession, &ip->Pointed, aname, 
				 &aaref);
      if ( ODD(sts)) {
	sts = ldh_WriteAttribute( ip->PointedSession, &aaref, (void *)&graph_configuration, 
				  sizeof(graph_configuration));
	if ( EVEN(sts)) return sts;
      }
    }
  }
  return 1;
}
Esempio n. 5
0
static pwr_tStatus configure_object_reset( ldh_sMenuCall *ip, pwr_sAttrRef *aref,
					   pwr_sMenuButton *mb)
{
  pwr_tStatus 	sts;
  pwr_tCid 	cid;
  ldh_sParDef 	*bodydef;
  int 		rows;
  int		i, j;
  pwr_sAttrRef  aaref, daref;
  pwr_tDisableAttr disable = 0;
  char 		vect[10][80];
  int 		vect_cnt;
  int 		skip;
  char		*s;
  
  // Attribute objects in argument 2 are not controlled by the configure method
  if ( mb) {
    vect_cnt = dcli_parse( mb->MethodArguments[2], ",", "", (char *)vect, 
			   sizeof( vect) / sizeof( vect[0]), 
			   sizeof( vect[0]), 0);
    for ( j = 0; j < vect_cnt; j++)
      dcli_trim( vect[j], vect[j]);
  }
  else
    vect_cnt = 0;

  sts = ldh_GetAttrRefTid( ip->PointedSession, aref, &cid);
  if ( EVEN(sts)) return sts;

  sts = ldh_GetObjectBodyDef( ip->PointedSession, cid, "RtBody", 1,
				  &bodydef, &rows);
  if (EVEN(sts)) return sts;

  for ( i = 0; i < rows; i++) {

    // Check if attribute is controlled by this method
    skip = 0;
    if ( mb) {
      // Remove leading Super.
      s = bodydef[i].ParName;
      while ( strncmp( s, "Super.", 6) == 0)
	s += 6;
      for ( j = 0; j < vect_cnt; j++) {
	if ( cdh_NoCaseStrcmp( vect[j], s) == 0) {
	  // This object should not be reset
	  skip = 1;
	  break;
	}
      }
      if ( skip)
	continue;
    }

    if ( bodydef[i].Par->Param.Info.Flags & PWR_MASK_DISABLEATTR) {
      // Enable all attributes
      sts = ldh_ArefANameToAref( ip->PointedSession, aref, bodydef[i].ParName, &aaref);
      if ( EVEN(sts)) return sts;

      daref = cdh_ArefToDisableAref( &aaref);

      sts = ldh_WriteAttribute( ip->PointedSession, &daref, (void *)&disable, 
				sizeof(disable));
      if ( EVEN(sts)) return sts;
    }

    if ( bodydef[i].Par->Param.Info.Flags & PWR_MASK_CLASS) {
      // Reset object attribute
      sts = ldh_ArefANameToAref( ip->PointedSession, aref, bodydef[i].ParName, &aaref);
      if ( EVEN(sts)) return sts;

      sts = configure_object_reset( ip, &aaref, 0);
      if ( EVEN(sts)) return sts;
    }
  }
  free( (char *)bodydef);

  return LDH__SUCCESS;
}
Esempio n. 6
0
static pwr_tStatus ConfigureComponent( ldh_sMenuCall *ip) 
{
  pwr_tStatus sts;
  unsigned int disable_mask;
  pwr_sMenuButton   mb;
  pwr_tEnum graph_configuration;
  pwr_sAttrRef aaref;
  char vect[10][80];
  char item[3][80];
  int i;
  int nr;
  int vect_cnt;
  
  sts = ldh_ReadObjectBody(ip->PointedSession, ip->ItemList[ip->ChosenItem].MenuObject,
    "SysBody", &mb, sizeof(pwr_sMenuButton));

  // Reset previoius disable configuration
  configure_object_reset( ip, &ip->Pointed, &mb);

  // Set disable attributes from argument 0
  vect_cnt = dcli_parse( mb.MethodArguments[0], ",", "", (char *)vect, 
		   sizeof( vect) / sizeof( vect[0]), 
		   sizeof( vect[0]), 0);
  
  for ( i = 0; i < vect_cnt; i++) {
    nr = dcli_parse( vect[i], " 	", "", (char *)item,
		   sizeof( item) / sizeof( item[0]), 
		   sizeof( item[0]), 0);
    if ( nr == 1) {

      if ( sscanf( item[0], "%d", &disable_mask) != 1)
	graph_configuration = 0;

      sts = configure_object( ip, &ip->Pointed, disable_mask);
      if ( EVEN(sts)) return sts;
    }
    else if ( nr == 2) {
      pwr_tAName aname;

      if ( sscanf( item[1], "%d", &disable_mask) != 1)
	disable_mask = 0;

      strcpy( aname, item[0]);

      sts = ldh_ArefANameToAref( ip->PointedSession, &ip->Pointed, aname, 
				 &aaref);
      if ( ODD(sts)) {
	sts = configure_object( ip, &aaref, disable_mask);
	if ( EVEN(sts)) return sts;
      }
    }
  }

  // Set GraphConfiguration from argument 1
  vect_cnt = dcli_parse( mb.MethodArguments[1], ",", "", (char *)vect, 
		   sizeof( vect) / sizeof( vect[0]), 
		   sizeof( vect[0]), 0);
  
  for ( i = 0; i < vect_cnt; i++) {
    nr = dcli_parse( vect[i], " 	", "", (char *)item,
		   sizeof( item) / sizeof( item[0]), 
		   sizeof( item[0]), 0);
    if ( nr == 1) {

      if ( sscanf( item[0], "%d", &graph_configuration) != 1)
	graph_configuration = 0;

      sts = ldh_ArefANameToAref( ip->PointedSession, &ip->Pointed, "GraphConfiguration", 
				 &aaref);
      if ( ODD(sts)) {
	sts = ldh_WriteAttribute( ip->PointedSession, &aaref, (void *)&graph_configuration, 
				  sizeof(graph_configuration));
	if ( EVEN(sts)) return sts;
      }
    }
    else if ( nr == 2) {
      pwr_tAName aname;

      if ( sscanf( item[1], "%d", &graph_configuration) != 1)
	graph_configuration = 0;

      strcpy( aname, item[0]);
      strcat( aname, ".GraphConfiguration");

      sts = ldh_ArefANameToAref( ip->PointedSession, &ip->Pointed, aname, 
				 &aaref);
      if ( ODD(sts)) {
	sts = ldh_WriteAttribute( ip->PointedSession, &aaref, (void *)&graph_configuration, 
				  sizeof(graph_configuration));
	if ( EVEN(sts)) return sts;
      }
    }
  }
  return 1;
}