/** * NOTE: alignment (8) is done externally * @param dataTypeValue * @param dataCount * @param value * @return calculated (non-aligned) payload size. */ // TODO size could be extracted from DBR type obejct // TODO converting TYPE -> short and now short -> TYPE public static int calculatePayloadSize(short dataTypeValue, int dataCount, Object value) { DBRType dataType = DBRType.forValue(dataTypeValue); if (dataType == null) throw new IllegalArgumentException("Invalid data type value: " + dataTypeValue); int additionalPayload = PAYLOAD_SIZE[dataTypeValue]; return calculateValuePayloadSize(dataCount, value, dataType) + additionalPayload; }
/** * NOTE: alignment (8) is done externally * @param dataTypeValue * @param dataCount * @param value * @return calculated (non-aligned) payload size. */ // TODO size could be extracted from DBR type obejct // TODO converting TYPE -> short and now short -> TYPE public static int calculatePayloadSize(short dataTypeValue, int dataCount, Object value) { DBRType dataType = DBRType.forValue(dataTypeValue); if (dataType == null) throw new IllegalArgumentException("Invalid data type value: " + dataTypeValue); int additionalPayload = PAYLOAD_SIZE[dataTypeValue]; return calculateValuePayloadSize(dataCount, value, dataType) + additionalPayload; }
this.type = DBRType.forValue(typeCode); if (this.type == null) this.type = DBRType.UNKNOWN;
DBRType.forValue(requestedDataType), requestedDataCount, dbr, errorMessage); context.notifyException(cee);
/** * @see com.cosylab.epics.caj.impl.NotifyResponseRequest#response(int, short, int, java.nio.ByteBuffer) */ public void response( int status, short dataType, int dataCount, ByteBuffer dataPayloadBuffer) { try { if (callback != null) { DBRType type = DBRType.forValue(dataType); CAStatus caStatus = CAStatus.forStatusCode(status); // notify context.getEventDispatcher().dispatch( new PutEvent(channel, type, dataCount, caStatus), callback ); } } finally { // allways cancel request cancel(); } }
/** * @see com.cosylab.epics.caj.impl.NotifyResponseRequest#response(int, short, int, java.nio.ByteBuffer) */ public void response( int status, short dataType, int dataCount, ByteBuffer dataPayloadBuffer) { try { if (callback != null) { DBRType type = DBRType.forValue(dataType); CAStatus caStatus = CAStatus.forStatusCode(status); // notify context.getEventDispatcher().dispatch( new PutEvent(channel, type, dataCount, caStatus), callback ); } } finally { // allways cancel request cancel(); } }
/** * @see com.cosylab.epics.caj.impl.ResponseRequest#exception(int, java.lang.String) */ public void exception(int errorCode, String errorMessage) { cancel(); // TODO no status is dispatched if (errorMessage == null) { CAStatus status = CAStatus.forStatusCode(errorCode); if (status != null) errorMessage = status.getMessage(); } ContextExceptionEvent cee = new ContextExceptionEvent(context, channel, DBRType.forValue(requestedDataType), requestedDataCount, null, errorMessage); context.notifyException(cee); /* // ... and notify if (callback != null) { CAStatus status = CAStatus.forValue(errorCode); if (status == null) status = CAStatus.PUTFAIL; context.getEventDispatcher().dispatch( new PutEvent(channel, DBRType.UNKNOWN, 0, status), callback ); } */ }
/** * @see com.cosylab.epics.caj.impl.ResponseRequest#exception(int, java.lang.String) */ public void exception(int errorCode, String errorMessage) { cancel(); // TODO no status is dispatched if (errorMessage == null) { CAStatus status = CAStatus.forStatusCode(errorCode); if (status != null) errorMessage = status.getMessage(); } ContextExceptionEvent cee = new ContextExceptionEvent(context, channel, DBRType.forValue(requestedDataType), requestedDataCount, null, errorMessage); context.notifyException(cee); /* // ... and notify if (callback != null) { CAStatus status = CAStatus.forValue(errorCode); if (status == null) status = CAStatus.PUTFAIL; context.getEventDispatcher().dispatch( new PutEvent(channel, DBRType.UNKNOWN, 0, status), callback ); } */ }
DBRType.forValue(requestedDataType), requestedDataCount, dbr, errorMessage); context.notifyException(cee);
errorMessage = status.getMessage(); ContextExceptionEvent cee = new ContextExceptionEvent(context, channel, DBRType.forValue(requestedDataType), requestedDataCount, null, errorMessage); context.notifyException(cee);
errorMessage = status.getMessage(); ContextExceptionEvent cee = new ContextExceptionEvent(context, channel, DBRType.forValue(requestedDataType), requestedDataCount, null, errorMessage); context.notifyException(cee);
value = value.convert(DBRType.forValue(dataType)); } catch (CAStatusException cse) { eventAddFailureResponse(transport, dataType, dataCount, sid, ioid, cse.getStatus(), value);
this.type = DBRType.forValue(typeCode); if (this.type == null) this.type = DBRType.UNKNOWN;
serverChannelID = sid; this.type = DBRType.forValue(typeCode); if (this.type == null) this.type = DBRType.UNKNOWN;
serverChannelID = sid; this.type = DBRType.forValue(typeCode); if (this.type == null) this.type = DBRType.UNKNOWN;
value = value.convert(DBRType.forValue(dataType)); } catch (CAStatusException cse) { eventAddFailureResponse(transport, dataType, dataCount, sid, ioid, cse.getStatus(), value);
value = value.convert(DBRType.forValue(dataType)); } catch (CAStatusException cse) { readNotifyFailureResponse(transport, dataType, dataCount, sid, ioid, cse.getStatus());
value = value.convert(DBRType.forValue(dataType)); } catch (CAStatusException cse) { readNotifyFailureResponse(transport, dataType, dataCount, sid, ioid, cse.getStatus());
else type = DBRType.forValue(typeValue);
else type = DBRType.forValue(typeValue);