private String toStringDBR(DBR value) { StringBuilder builder = new StringBuilder(); if (value == null) { return "null"; } if (value.getValue() instanceof double[]) { builder.append(Arrays.toString((double[]) value.getValue())); } else if (value.getValue() instanceof short[]) { builder.append(Arrays.toString((short[]) value.getValue())); } else if (value.getValue() instanceof String[]) { builder.append(Arrays.toString((String[]) value.getValue())); } else { builder.append(value.getValue().toString()); } return builder.toString(); }
private String toStringDBR(DBR value) { StringBuilder builder = new StringBuilder(); if (value == null) { return "null"; } if (value.getValue() instanceof double[]) { builder.append(Arrays.toString((double[]) value.getValue())); } else if (value.getValue() instanceof short[]) { builder.append(Arrays.toString((short[]) value.getValue())); } else if (value.getValue() instanceof String[]) { builder.append(Arrays.toString((String[]) value.getValue())); } else { builder.append(value.getValue().toString()); } return builder.toString(); }
/** * Read value. * Fills-in DBR, sets timestamp (time when value was written) and copies value from local memory (array). * No status and severity (alarms) are set - to be done in <code>fillInDBR</code> method (extending it). * @see gov.aps.jca.cas.ProcessVariable#read(gov.aps.jca.dbr.DBR, gov.aps.jca.cas.ProcessVariableReadCallback) */ public synchronized CAStatus read(DBR value, ProcessVariableReadCallback asyncReadCallback) throws CAException { // fill fillInDBR(value); // given DBR is always at least TIME ((TIME)value).setTimeStamp(timestamp); int minCount = Math.min(count, value.getCount()); System.arraycopy(this.value, 0, value.getValue(), 0, minCount); return CAStatus.NORMAL; }
/** * Read value. * Fills-in DBR, sets timestamp (time when value was written) and copies value from local memory (array). * No status and severity (alarms) are set - to be done in <code>fillInDBR</code> method (extending it). * @see gov.aps.jca.cas.ProcessVariable#read(gov.aps.jca.dbr.DBR, gov.aps.jca.cas.ProcessVariableReadCallback) */ public synchronized CAStatus read(DBR value, ProcessVariableReadCallback asyncReadCallback) throws CAException { // fill fillInDBR(value); // given DBR is always at least TIME ((TIME)value).setTimeStamp(timestamp); int minCount = Math.min(count, value.getCount()); System.arraycopy(this.value, 0, value.getValue(), 0, minCount); return CAStatus.NORMAL; }
arr = (String[])inDBR.getValue(); else arr = new String[dataCount]; arr = (short[])inDBR.getValue(); else arr = new short[dataCount]; arr = (float[])inDBR.getValue(); else arr = new float[dataCount]; arr = (short[])inDBR.getValue(); else arr = new short[dataCount]; arr = (byte[])inDBR.getValue(); else arr = new byte[dataCount]; arr = (int[])inDBR.getValue(); else arr = new int[dataCount]; arr = (double[])inDBR.getValue(); else arr = new double[dataCount];
arr = (String[])inDBR.getValue(); else arr = new String[dataCount]; arr = (short[])inDBR.getValue(); else arr = new short[dataCount]; arr = (float[])inDBR.getValue(); else arr = new float[dataCount]; arr = (short[])inDBR.getValue(); else arr = new short[dataCount]; arr = (byte[])inDBR.getValue(); else arr = new byte[dataCount]; arr = (int[])inDBR.getValue(); else arr = new int[dataCount]; arr = (double[])inDBR.getValue(); else arr = new double[dataCount];
/** * Write value. * Copies given value to local memory (array). * If event interest flag <code>interest</code> is set, an event is fired to <code>eventCallback</code>. * @see gov.aps.jca.cas.ProcessVariable#write(gov.aps.jca.dbr.DBR, gov.aps.jca.cas.ProcessVariableWriteCallback) */ public synchronized CAStatus write(DBR value, ProcessVariableWriteCallback asyncWriteCallback) throws CAException { this.value = value.getValue(); this.count = java.lang.reflect.Array.getLength(this.value); this.timestamp = new TimeStamp(); // notify if (interest) { DBR monitorDBR = AbstractCASResponseHandler.createDBRforReading(this); fillInDBR(monitorDBR); ((TIME)monitorDBR).setTimeStamp(timestamp); System.arraycopy(this.value, 0, monitorDBR.getValue(), 0, count); eventCallback.postEvent(Monitor.VALUE|Monitor.LOG, monitorDBR); } return CAStatus.NORMAL; }
/** * Write value. * Copies given value to local memory (array). * If event interest flag <code>interest</code> is set, an event is fired to <code>eventCallback</code>. * @see gov.aps.jca.cas.ProcessVariable#write(gov.aps.jca.dbr.DBR, gov.aps.jca.cas.ProcessVariableWriteCallback) */ public synchronized CAStatus write(DBR value, ProcessVariableWriteCallback asyncWriteCallback) throws CAException { this.value = value.getValue(); this.count = java.lang.reflect.Array.getLength(this.value); this.timestamp = new TimeStamp(); // notify if (interest) { DBR monitorDBR = AbstractCASResponseHandler.createDBRforReading(this); fillInDBR(monitorDBR); ((TIME)monitorDBR).setTimeStamp(timestamp); System.arraycopy(this.value, 0, monitorDBR.getValue(), 0, count); eventCallback.postEvent(Monitor.VALUE|Monitor.LOG, monitorDBR); } return CAStatus.NORMAL; }
calculatedPayloadSize = DBREncoder.calculatePayloadSize((short)dataType, dataCount, value.getValue()); int alignedPayloadSize = calculateAlignedSize(8, calculatedPayloadSize); int alignedMessageSize = alignedPayloadSize + CAConstants.CA_MESSAGE_HEADER_SIZE;
calculatedPayloadSize = DBREncoder.calculatePayloadSize((short)dataType, dataCount, value.getValue()); int alignedPayloadSize = calculateAlignedSize(8, calculatedPayloadSize); int alignedMessageSize = alignedPayloadSize + CAConstants.CA_MESSAGE_HEADER_SIZE;
int calculatedPayloadSize = DBREncoder.calculatePayloadSize((short)dataType, dataCount, value.getValue()); int alignedPayloadSize = calculateAlignedSize(8, calculatedPayloadSize); int alignedMessageSize = alignedPayloadSize + CAConstants.CA_MESSAGE_HEADER_SIZE;
int calculatedPayloadSize = DBREncoder.calculatePayloadSize((short)dataType, dataCount, value.getValue()); int alignedPayloadSize = calculateAlignedSize(8, calculatedPayloadSize); int alignedMessageSize = alignedPayloadSize + CAConstants.CA_MESSAGE_HEADER_SIZE;
insertPayload(payloadBuffer, dataTypeValue, dataCount, value.getValue());
insertPayload(payloadBuffer, dataTypeValue, dataCount, value.getValue());