I am fairly new to java and I have a program that I really need to get working. I need to pass 'alarmId' from class A to class B. I am not too sure how to go about this, any help would be greatly appreciated.
public void onStart()
{
}
public void onExecute() throws Exception
{
String newValue = getValue().valueToString(null);
}
public class A{
if(!newValue.equals("P Normal"))
{
BAlarmService service = (BAlarmService)Sys.getService(BAlarmService.TYPE);
BAlarmRecord record = new BAlarmRecord();
record.setTimestamp(BAbsTime.now());
record.setSourceState(BSourceState.offnormal);
record.setAckState(BAckState.unacked);
record.setAckRequired(false);
record.setSource(BOrdList.make(getProgram().getSlotPathOrd()));
record.setAlarmClass(service.getDefaultAlarmClass().getName());
record.setAlarmData(BFacets.make(BAlarmRecord.OFFNORMAL_VALUE, newValue));
record.setAlarmData(BFacets.make(BAlarmRecord.MSG_TEXT, newValue));
record.setLastUpdate(BAbsTime.now());
service.routeAlarm(record);
String uuidStr = record.getUuid().encodeToString();
BUuid alarmId = (BUuid)BUuid.DEFAULT.decodeFromString(uuidStr);
}
}
public class B{
if(newValue.equals("P Normal"))
{
int alarmId = A.getalarmId();
BAlarmService alarmService = (BAlarmService)Sys.getService(BAlarmService.TYPE);
BAlarmDatabase alarmDb = alarmService.getAlarmDb();
BAlarmRecord record1 = alarmDb.getRecord(alarmId);
record1.ackAlarm();
alarmDb.update(record1);
alarmService.ackAlarm(record1);
}
}
}