示例#1
0
void fastobject::close()
{
  if ( trigg)
    gdh_DLUnrefObjectInfo( trigg_dlid);

  for ( int i = 0; i < FAST_CURVES; i++) {
    if ( p->CurveValid[i]) {
      gdh_DLUnrefObjectInfo( attributes_dlid[i]);
    }
  }
  gdh_DLUnrefObjectInfo( time_buffer_dlid);
  for ( int i = 0; i < FAST_CURVES; i++) {
    if ( p->CurveValid[i]) {
      gdh_DLUnrefObjectInfo( buffers_dlid[i]);
    }
  }
  for ( int i = 0; i < FAST_CURVES; i++)
    p->CurveValid[i] = 0;
  gdh_DLUnrefObjectInfo( p_dlid);
}
示例#2
0
static void
reinit_nodes ()
{
  pwr_tStatus sts;
  LstLink(sNode) *nl;
  sNode *np;
  pwr_tObjid oid;

  /* Mark all links in the NodeLink list */
  for (nl= LstFir(&node_l); nl != LstEnd(&node_l); nl = LstNex(nl))
    LstObj(nl)->found = FALSE;

  for (
    sts = gdh_GetClassList(pwr_cClass_NodeLinkSup, &oid);
    ODD(sts);
    sts = gdh_GetNextObject(oid, &oid)
  ) {
    if ((np = get_nodes(oid)) == NULL) {
      np = init_node(oid, NULL, 1);
      if (np != NULL) {
	nl = LstIns(nl, np, node_l);
	np->found = TRUE;
      }
    } else {
      update_node(np);
    }
  }

  for (nl = LstFir(&node_l); nl != LstEnd(&node_l); nl = LstNex(nl)) {
    np = LstObj(nl);
    if (!np->found) {
      nl = LstPre(&np->node_l);
      LstRem(&np->node_l);
      LstNul(&np->node_l);
      gdh_SubUnrefObjectInfo (np->o->SubId);
      gdh_DLUnrefObjectInfo(np->dlid);
      free(np);
    }
  }	    
}
示例#3
0
void sysmon_object::close()
{
  gdh_DLUnrefObjectInfo( p_dlid);
}
示例#4
0
static sNode *
init_node (
  pwr_tObjid oid,
  sNode *np,
  pwr_tBoolean new_sub
)
{
  pwr_tStatus		 sts;
  pwr_sAttrRef		 aref;
  pwr_sClass_NodeLinkSup *o;
  gdh_tDlid		 dlid = pwr_cNDlid;
  pwr_tBoolean		 is_alias = 0;
  cdh_uTypeId		 tid;

  sts = gdh_IsAlias(oid, &is_alias);
  if (is_alias)
    return NULL;

  /* Allocate and initiate NodeLink control block */
  if (np == NULL) {
    tid.pwr = pwr_cClass_NodeLinkSup;
    tid.c.bix = 1;
    aref.Objid = oid;
    aref.Offset = 0;
    aref.Size = sizeof(pwr_sClass_NodeLinkSup);
    aref.Body = tid.pwr;
    aref.Flags.m = 0;	    
    sts = gdh_DLRefObjectInfoAttrref(&aref, (pwr_tAddress *)&o, &dlid);
    if (EVEN(sts)) {
      errh_Error("Couldn't get direct link to NodeLink object, %m", sts);
      return NULL;
    }
    np = (sNode*) calloc(1, sizeof(sNode));
    if (np == NULL) {
      if (cdh_DlidIsNotNull (dlid))
	gdh_DLUnrefObjectInfo (dlid);
      errh_Error("Error calloc, sNode");
      return NULL;
    }
    memcpy (&np->node, o, sizeof (np->node)); 
    np->dlid = dlid;
    np->o = o;
    np->oid = oid;
    np->timer = (void *)&o->TimerFlag;
  }

  /* Setup subscription to supervised Node object's attribute CurVersion. */

  if (new_sub) {
    int dt;
    int tmo;

    dt = MAX(1, (int)(o->SubscriptionInterval * 1000));
    tmo = MAX(2 * dt/100, 100); /* 10 s */
    sts = gdh_SetSubscriptionDefaults (dt, tmo);

    tid.pwr = pwr_eClass_Node;
    tid.c.bix = 1;
    
    aref.Objid = o->Node;
    sts = gdh_ClassAttrToAttrref(pwr_eClass_Node, ".SystemStatus", &aref);
    sts = gdh_SubRefObjectInfoAttrref(&aref, &o->SubId);
    if ( EVEN(sts)) {
      errh_Error("Couldn't get link to Node object, %m", sts);
      o->SystemStatus = PWR__NETTIMEOUT;
    }
    else
      gdh_SubAssociateBuffer(o->SubId, (void **)&np->subvalue, sizeof(pwr_tStatus));
  }

  return np;
}