keso.core
Class AlarmService

java.lang.Object
  extended by keso.core.AlarmService

public final class AlarmService
extends Object

Provides access to Counter/Alarm related OSEK system services.


Constructor Summary
AlarmService()
           
 
Method Summary
static int cancelAlarm(Alarm alarmID)
          Cancels the Alarm specified by alarmID.
static int getAlarm(Alarm alarmID)
          Query relative value in ticks before the Alarm expires.
static int getAlarmBase(Alarm alarmID, AlarmBase info)
          Read the AlarmBase characteristics of an Alarm.
static Alarm getAlarmByName(String name)
          Get a reference to an Alarm object by specifying its name as it was defined in KESORC.
static int setAbsAlarm(Alarm alarmID, int start, int cycle)
          Winds up the Alarm specified by alarmID using an absolute counter value.
static int setRelAlarm(Alarm alarmID, int increment, int cycle)
          Winds up the Alarm specified by alarmID relative to the current counter value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait
 

Constructor Detail

AlarmService

public AlarmService()
Method Detail

getAlarmBase

public static int getAlarmBase(Alarm alarmID,
                               AlarmBase info)
Read the AlarmBase characteristics of an Alarm. The characteristics of the Alarm will be written to info, an object of class AlarmBase provided by the caller.

Parameters:
alarmID - Alarm system object the base of which is to be determined.
info - output AlarmBase object where the attributes of the underlying counter will be stored in.
Returns:
return value of the underlying OSEK call

getAlarm

public static int getAlarm(Alarm alarmID)
Query relative value in ticks before the Alarm expires. TODO return status is not accessable by the application. Throw an OSEKException when an error occurs.

Parameters:
alarmID - Alarm system object of the alarm to be queried
Returns:
number of counter ticks till the alarm expires

setRelAlarm

public static int setRelAlarm(Alarm alarmID,
                              int increment,
                              int cycle)
Winds up the Alarm specified by alarmID relative to the current counter value. After increment ticks have elapsed the task assigned to this alarm is activated/the assigned event is set/the alarm callback routine is called.

Parameters:
alarmID - Alarm system object of the alarm to be configured
increment - number of counter (major) ticks relative to the current counter value until the alarm triggers
cycle - number of counter (major) ticks that a cyclic alarm is triggered with. Becomes active after the first shot configured by increment was triggered. Use 0 for a single-shot alarm.
Returns:
return value of the underlying OSEK call

setAbsAlarm

public static int setAbsAlarm(Alarm alarmID,
                              int start,
                              int cycle)
Winds up the Alarm specified by alarmID using an absolute counter value. After start ticks are reached by the base counter the task assigned to this alarm is activated/the assigned event is set/the alarm callback routine is called.

Parameters:
alarmID - Alarm system object of the alarm to be configured
start - absolute counter (major) tick value at which the alarm triggers
cycle - number of counter (major) ticks that a cyclic alarm is triggered with. Becomes active after the first shot configured by increment was triggered. Use 0 for a single-shot alarm.
Returns:
return value of the underlying OSEK call

cancelAlarm

public static int cancelAlarm(Alarm alarmID)
Cancels the Alarm specified by alarmID.

Parameters:
alarmID - Alarm system object of the alarm to be configured
Returns:
return value of the underlying OSEK call

getAlarmByName

public static Alarm getAlarmByName(String name)
Get a reference to an Alarm object by specifying its name as it was defined in KESORC.

Parameters:
name - Name of the alarm whose system object should be returned. Must be a String constant.
Returns:
To enforce service protection, the system object will only be provided if the queried alarm either belongs to the calling domain or if it was explicitely made available to the calling domain using the ImportAlarm directive in the KESORC file. Otherwise this service returns null. If no alarm with the given name exists, this service returns null as well.