/*********************************************************** * Iterate over DAT **********************************************************/ public static IEnumerable <SaHpiAlarmT> Dat(long sid, long severity = HpiConst.SAHPI_ALL_SEVERITIES, long unacknowledged_only = HpiConst.SAHPI_FALSE) { long id = HpiConst.SAHPI_FIRST_ENTRY; long timestamp = 0; do { SaHpiAlarmT a = NewAlarm(id, timestamp); long rv = Api.saHpiAlarmGetNext(sid, severity, unacknowledged_only, ref a); if (rv == HpiConst.SA_ERR_HPI_NOT_PRESENT) { yield break; } if (rv != HpiConst.SA_OK) { yield break; } id = a.AlarmId; timestamp = a.Timestamp; yield return(a); } while (id != HpiConst.SAHPI_LAST_ENTRY); }
public SaHpiAlarmT DemarshalSaHpiAlarmT() { SaHpiAlarmT x = new SaHpiAlarmT(); x.AlarmId = DemarshalSaHpiAlarmIdT(); x.Timestamp = DemarshalSaHpiTimeT(); x.Severity = DemarshalSaHpiSeverityT(); x.Acknowledged = DemarshalSaHpiBoolT(); x.AlarmCond = DemarshalSaHpiConditionT(); return x; }
public void MarshalSaHpiAlarmT( SaHpiAlarmT x ) { MarshalSaHpiAlarmIdT( x.AlarmId ); MarshalSaHpiTimeT( x.Timestamp ); MarshalSaHpiSeverityT( x.Severity ); MarshalSaHpiBoolT( x.Acknowledged ); MarshalSaHpiConditionT( x.AlarmCond ); }
public static long saHpiAlarmGetNext( long SessionId, long Severity, long UnacknowledgedOnly, ref SaHpiAlarmT Alarm ) { long rv; bool rc; rc = HpiUtil.Check( Alarm ); if ( !rc ) { return HpiConst.SA_ERR_HPI_INVALID_PARAMS; } HpiSession s = HpiCore.GetSession( SessionId ); if ( s == null ) { return HpiConst.SA_ERR_HPI_INVALID_SESSION; } OhpiMarshal m = s.GetMarshal(); if ( m == null ) { return HpiConst.SA_ERR_HPI_NO_RESPONSE; } m.MarshalSaHpiSessionIdT( s.GetRemoteSid() ); m.MarshalSaHpiSeverityT( Severity ); m.MarshalSaHpiBoolT( UnacknowledgedOnly ); m.MarshalSaHpiAlarmT( Alarm ); rc = m.Interchange( OhpiConst.RPC_SAHPI_ALARM_GET_NEXT ); if ( !rc ) { m.Close(); return HpiConst.SA_ERR_HPI_NO_RESPONSE; } rv = m.DemarshalSaErrorT(); if ( rv == HpiConst.SA_OK ) { Alarm = m.DemarshalSaHpiAlarmT(); } s.PutMarshal( m ); return rv; }
public static long saHpiAlarmGet( long SessionId, long AlarmId, out SaHpiAlarmT Alarm ) { long rv; bool rc; Alarm = null; HpiSession s = HpiCore.GetSession( SessionId ); if ( s == null ) { return HpiConst.SA_ERR_HPI_INVALID_SESSION; } OhpiMarshal m = s.GetMarshal(); if ( m == null ) { return HpiConst.SA_ERR_HPI_NO_RESPONSE; } m.MarshalSaHpiSessionIdT( s.GetRemoteSid() ); m.MarshalSaHpiAlarmIdT( AlarmId ); rc = m.Interchange( OhpiConst.RPC_SAHPI_ALARM_GET ); if ( !rc ) { m.Close(); return HpiConst.SA_ERR_HPI_NO_RESPONSE; } rv = m.DemarshalSaErrorT(); if ( rv == HpiConst.SA_OK ) { Alarm = m.DemarshalSaHpiAlarmT(); } s.PutMarshal( m ); return rv; }
/** * Check function for HPI struct SaHpiAlarmT */ public static bool Check( SaHpiAlarmT x ) { if ( x == null ) { return false; } if ( !Check( x.AlarmCond ) ) { return false; } return true; }