示例#1
0
int Ev::seve_acknowledge_cb( void *ctx, mh_sEventId *id)
{
  Ev *ev = (Ev *)ctx;

  mh_sEventId lid = *id;
  ev->ala->ack( id);
  ev->eve->ack( id);
  for ( int i = 0; i < ev->seve_cnt; i++)
    ev->seve[i]->ack( id);
  for ( int i = 0; i < ev->sala_cnt; i++)
    ev->sala[i]->ack( id);
  mh_OutunitAck( &lid);
  return 1;
}
示例#2
0
void Ev::eve_activate_ack_last()
{
  mh_sEventId *id;
  int sts;

  if (is_authorized_cb && !is_authorized_cb( parent_ctx, pwr_mAccess_RtEventsAck | pwr_mAccess_System))
    return;

  sts = ala->get_last_not_acked( &id);
  if ( EVEN(sts)) return;

  mh_sEventId lid = *id;
  ala->ack( id);
  eve->ack( id);
  for ( int i = 0; i < sala_cnt; i++)
    sala[i]->ack( id);
  for ( int i = 0; i < seve_cnt; i++)
    seve[i]->ack( id);
  mh_OutunitAck( &lid);
}
示例#3
0
void Ev::ack_last_prio( unsigned long type, unsigned long prio)
{
  mh_sEventId 	*id;
  int		sts;

  if (is_authorized_cb && !is_authorized_cb( parent_ctx, pwr_mAccess_RtEventsAck | pwr_mAccess_System))
    return;

  sts = ala->get_last_not_acked_prio( &id, type, prio);
  if ( ODD(sts))
  {
    mh_sEventId lid = *id;

    ala->ack( id);
    eve->ack( id);
    for ( int i = 0; i < sala_cnt; i++)
      sala[i]->ack( id);
    for ( int i = 0; i < seve_cnt; i++)
      seve[i]->ack( id);
    mh_OutunitAck( &lid);
  }
}
示例#4
0
void Ev::ala_activate_ack_last()
{
  mh_sEventId *id;
  int sts;

  if (is_authorized_cb && !is_authorized_cb( parent_ctx, pwr_mAccess_RtEventsAck | pwr_mAccess_System))
    return;

  if ( ala->brow == ala->browbase) {
    // Flat view, acknowledge last
    sts = ala->get_last_not_acked( &id);
    if ( EVEN(sts)) return;
  }
  else {
    // Tree view, acknowledge selected
    ItemAlarm *item;
    pwr_tAName eventname;

    sts = ala->get_selected_event( eventname, &item);
    if ( EVEN(sts)) return;

    switch ( item->type) {
    case evlist_eItemType_Alarm:
      id = &item->eventid;
      break;
    default:
      return;
    }
  }

  mh_sEventId lid = *id;
  ala->ack( id);
  eve->ack( id);
  for ( int i = 0; i < sala_cnt; i++)
    sala[i]->ack( id);
  for ( int i = 0; i < seve_cnt; i++)
    seve[i]->ack( id);
  mh_OutunitAck( &lid);
}
示例#5
0
JNIEXPORT jobject JNICALL Java_jpwr_rt_Mh_outunitAck
  (JNIEnv *env, jclass obj, jobject id)
{
  int sts = 1;

  //char *str;
  char *str_copy;
  mh_sEventId eventId;
  jfieldID nix_fid;
  jfieldID idx_fid;
  jfieldID birthTime_fid;
  jclass mhrsEventId_class;
  pwr_tTime t;

  jclass pwrtStatus_id = NULL;
  static jmethodID pwrtStatus_cid = NULL;

  jint jsts;  
  jobject return_obj;

  jstring jstr;
  
  pwrtStatus_id = (*env)->FindClass( env, "jpwr/rt/PwrtStatus");
  if(pwrtStatus_id == NULL)
  {
    printf("fel vid PwrtStatus classidhämtning\n");
    return NULL;
  }
  
  if(pwrtStatus_cid == NULL)
  {

    //hämta upp classid och sedan pekare till konstruktorn för PwrtStatus
    pwrtStatus_cid = (*env)->GetMethodID( env, pwrtStatus_id,
    	                                  "<init>", "(I)V");  
    if(pwrtStatus_cid == NULL)
    {
      printf("fel vid PwrtStatus methodidhämtning\n");
      return NULL;
    }
  }
  
  //hämta upp classid till MhrsEventId-objektet
  mhrsEventId_class =(*env)->GetObjectClass(env,id);
  
  nix_fid =(*env)->GetFieldID(env,mhrsEventId_class,"nix", "I");
  if (nix_fid ==NULL)
  {
    printf("hittade inte nix\n");
    sts = -2;//lyckades inte hitta fältet
  }
  
  //printf("efter nix hämtning\n");
  
  idx_fid =(*env)->GetFieldID(env,mhrsEventId_class,"idx", "I");
  if (idx_fid ==NULL)
  {
    printf("hittade inte idx\n");
    sts = -2;//lyckades inte hitta fältet
  }
  
  //printf("efter idx hämtning\n");
  
  birthTime_fid =(*env)->GetFieldID(env,mhrsEventId_class,"birthTime",
                                    "Ljava/lang/String;");
  if (birthTime_fid ==NULL)
  {
    printf("hittade inte birthTime\n");
    sts = -2;//lyckades inte hitta fältet
  }
  
  eventId.Nix = (pwr_tNodeIndex)(*env)->GetIntField(env,id,nix_fid);
  eventId.Idx = (pwr_tUInt32)(*env)->GetIntField(env,id,idx_fid);
    
  jstr = (*env)->GetObjectField(env,id,birthTime_fid);
  str_copy = (char *)(*env)->GetStringUTFChars(env,jstr,NULL);

  if (str_copy ==NULL)
  {
    sts = -1;//out of memory
  }
  
  t = net_NetTimeToTime( &eventId.BirthTime);
  time_AsciiToA(str_copy, &t);
  
  sts = mh_OutunitAck(&eventId);
  (*env)->ReleaseStringUTFChars(env,jstr,str_copy);
  
  jsts = (jint) sts; 
  //skapa returobjekt
  return_obj = (*env)->NewObject( env, pwrtStatus_id,
  	pwrtStatus_cid, jsts);
  
  (*env)->DeleteLocalRef(env,pwrtStatus_id);
  return return_obj;
}